# extract.awk --- extract files and run programs from Texinfo files # # Arnold Robbins, arnold@skeeve.com, Public Domain # May 1993 # Revised September 2000 BEGIN { IGNORECASE = 1 } /^@c(omment)?[ \t]+system/ { if (NF < 3) { e = ("extract: " FILENAME ":" FNR) e = (e ": badly formed `system' line") print e > "/dev/stderr" next } $1 = "" $2 = "" stat = system($0) if (stat != 0) { e = ("extract: " FILENAME ":" FNR) e = (e ": warning: system returned " stat) print e > "/dev/stderr" } } /^@c(omment)?[ \t]+file/ { if (NF != 3) { e = ("extract: " FILENAME ":" FNR ": badly formed `file' line") print e > "/dev/stderr" next } if ($3 != curfile) { if (curfile != "") close(curfile) curfile = $3 } for (;;) { if ((getline line) <= 0) unexpected_eof() if (line ~ /^@c(omment)?[ \t]+endfile/) break else if (line ~ /^@(end[ \t]+)?group/) continue else if (line ~ /^@c(omment+)?[ \t]+/) continue if (index(line, "@") == 0) { print line > curfile continue } n = split(line, a, "@") # if a[1] == "", means leading @, # don't add one back in. for (i = 2; i <= n; i++) { if (a[i] == "") { # was an @@ a[i] = "@" if (a[i+1] == "") i++ } } print join(a, 1, n, SUBSEP) > curfile } } function unexpected_eof() { printf("extract: %s:%d: unexpected EOF or error\n", FILENAME, FNR) > "/dev/stderr" exit 1 } END { if (curfile) close(curfile) }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
alarm.awk | File | 2.31 KB | 0644 |
|
anagram.awk | File | 1.33 KB | 0644 |
|
awksed.awk | File | 515 B | 0644 |
|
cut.awk | File | 3.61 KB | 0644 |
|
dupword.awk | File | 507 B | 0644 |
|
egrep.awk | File | 1.91 KB | 0644 |
|
extract.awk | File | 1.74 KB | 0644 |
|
guide.awk | File | 165 B | 0644 |
|
histsort.awk | File | 283 B | 0644 |
|
id.awk | File | 1.22 KB | 0644 |
|
igawk.sh | File | 3.11 KB | 0644 |
|
indirectcall.awk | File | 952 B | 0644 |
|
labels.awk | File | 1014 B | 0644 |
|
split.awk | File | 1.17 KB | 0644 |
|
tee.awk | File | 770 B | 0644 |
|
testbits.awk | File | 729 B | 0644 |
|
translate.awk | File | 1.15 KB | 0644 |
|
uniq.awk | File | 2.64 KB | 0644 |
|
wc.awk | File | 1.45 KB | 0644 |
|
wordfreq.awk | File | 347 B | 0644 |
|