[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
un-GNU awk code in ifnames.sh
From: |
Paul Martinolich |
Subject: |
un-GNU awk code in ifnames.sh |
Date: |
Wed, 1 Nov 2000 12:58:38 -0600 (CST) |
Hi,
This undoes the GNU standardization of the awk code in ifnames.sh.
from Paul Martinolich <address@hidden>
* ifnames.sh (un-GNU awk code):
Don't use GNU coding standard for awk code
==================================================================
--- ifnames.sh.orig Wed Nov 1 12:39:15 2000
+++ ifnames.sh Wed Nov 1 12:40:00 2000
@@ -72,12 +72,9 @@
$AWK '
# Record that sym was found in FILENAME.
- function file_sym(sym, i, fs)
- {
- if (sym ~ /^[A-Za-z_]/)
- {
- if (!found[sym,FILENAME])
- {
+ function file_sym(sym, i, fs) {
+ if (sym ~ /^[A-Za-z_]/) {
+ if (!found[sym,FILENAME]) {
found[sym,FILENAME] = 1
# Insert FILENAME into files[sym], keeping the list sorted.
@@ -84,8 +81,7 @@
i = 1
fs = files[sym]
while (match(substr(fs, i), /^ [^ ]*/) \
- && substr(fs, i + 1, RLENGTH - 1) < FILENAME)
- {
+ && substr(fs, i + 1, RLENGTH - 1) < FILENAME) {
i += RLENGTH
}
files[sym] = substr(fs, 1, i - 1) " " FILENAME substr(fs, i)
@@ -94,8 +90,7 @@
}
{
- while (sub(/\\$/, "", $0) > 0)
- {
+ while (sub(/\\$/, "", $0) > 0) {
if ((getline tmp) > 0)
$0 = $0 tmp
else
@@ -103,20 +98,16 @@
}
}
- /^[\t ]*#/
- {
- if (sub(/^[\t ]*#[\t ]*ifn?def[\t ]+/, "", $0))
- {
+ /^[\t ]*#/ {
+ if (sub(/^[\t ]*#[\t ]*ifn?def[\t ]+/, "", $0)) {
sub(/[^A-Za-z_0-9].*/, "", $0)
file_sym($0)
}
- if (sub(/^[\t ]*#[\t ]*(el)?if[\t ]+/, "", $0))
- {
+ if (sub(/^[\t ]*#[\t ]*(el)?if[\t ]+/, "", $0)) {
# Remove comments. Not perfect, but close enough.
gsub(/\/\*[^\/]*(\*\/)?/, "", $0)
- for (i = split($0, field, /[^A-Za-z_0-9]+/); 1 <= i; i--)
- {
+ for (i = split($0, field, /[^A-Za-z_0-9]+/); 1 <= i; i--) {
if (field[i] != "defined")
{
file_sym(field[i])
@@ -125,10 +116,8 @@
}
}
- END
- {
- for (sym in files)
- {
+ END {
+ for (sym in files) {
print sym files[sym]
}
}
+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
Paul Martinolich/Software Engr. e-mail: address@hidden
Neptune Sciences, Inc. voice: (228) 688-5280
NRL Remote Sensing/Ocean Color http://www7240.nrlssc.navy.mil/ocolor/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- un-GNU awk code in ifnames.sh,
Paul Martinolich <=