diff options
author | Freya Murphy <freya@freyacat.org> | 2024-11-17 04:01:08 +0000 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-11-17 04:01:08 +0000 |
commit | 5e60794b428035db69899f229befac504d6dc043 (patch) | |
tree | 6135a66fcaad554b71f012f211e625f56faa787f /lib/config.awk | |
parent | add openwrt (diff) | |
download | freyanet-5e60794b428035db69899f229befac504d6dc043.tar.gz freyanet-5e60794b428035db69899f229befac504d6dc043.tar.bz2 freyanet-5e60794b428035db69899f229befac504d6dc043.zip |
Diffstat (limited to 'lib/config.awk')
-rwxr-xr-x | lib/config.awk | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/lib/config.awk b/lib/config.awk deleted file mode 100755 index 9d0a117..0000000 --- a/lib/config.awk +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/awk -f - -BEGIN { - FS = "[ ]"; # use a single space as field separator and don't trim input - ind = 0; # indentation level - last = ARGC - 3; # last argument index - exitcode = 1; # whether anything has been matched - if(last < 0) { # there should be at least one argument after the filename - exit 1; - } - ARGC = 2; # don't read ARGV[2] and onward as files -} - -END { - exit exitcode; -} - -$0 != "" { # exit when the indentation block is exited - for(i = 0; i < ind; i++) { - if(! sub(/^\t/, "")) { - exit exitcode; - } - } -} - -# if on the last argument, interpret it as a key and print the value -ind == last && $1 == ARGV[ind + 2] { - exitcode = 0; - print substr($0, length($1) + 2); -} -# if not on the last argument, find the string exactly and increment indentation -ind != last && $0 == ARGV[ind + 2] { - ind++; -} - |