diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-06-18 08:42:32 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-06-18 08:42:32 +0000 |
commit | 6afe7232e18f682ad33e982c51dfe5a2a993e2be (patch) | |
tree | bb0f0a8c508e0ed7e15fcc2e5d75aac43e5e5dd7 /usr.bin | |
parent | 23130902cf0bf67087ec153ed5b067670b68dac9 (diff) |
cleanup, and now it produces KNF output
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/top/sigconv.awk | 77 |
1 files changed, 36 insertions, 41 deletions
diff --git a/usr.bin/top/sigconv.awk b/usr.bin/top/sigconv.awk index 1d5c076ad09..479bc05545a 100644 --- a/usr.bin/top/sigconv.awk +++ b/usr.bin/top/sigconv.awk @@ -25,57 +25,52 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -BEGIN { - nsig = 0; - j = 0; - print "/* This file was automatically generated */" - print "/* by the awk script \"sigconv.awk\". */" - print "/* $OpenBSD: sigconv.awk,v 1.3 2002/07/15 17:20:36 deraadt Exp $ */\n" - print "struct sigdesc {" - print " char *name;" - print " int number;" - print "};\n" - print "struct sigdesc sigdesc[] = {" - } +BEGIN { + nsig = 0; + j = 0; + print "/* This file was automatically generated */" + print "/* by the awk script \"sigconv.awk\". */" + print "/* $OpenBSD: sigconv.awk,v 1.4 2003/06/18 08:42:31 deraadt Exp $ */\n" + print "struct sigdesc {" + print " char *name;" + print " int number;" + print "};\n" + print "struct sigdesc sigdesc[] = {" +} /^#define[ \t][ \t]*SIG[A-Z]/ { - j = sprintf("%d", $3); - str = $2; + j = sprintf("%d", $3); + str = $2; + if (nsig < j) + nsig = j; + siglist[j] = sprintf("\"%s\",\t%2d", substr(str, 4), j); +} - if (nsig < j) - nsig = j; - - siglist[j] = sprintf("\"%s\",\t%2d", \ - substr(str, 4), j); - } /^#[ \t]*define[ \t][ \t]*SIG[A-Z]/ { - j = sprintf("%d", $4); - str = $3; - - if (nsig < j) - nsig = j; + j = sprintf("%d", $4); + str = $3; + if (nsig < j) + nsig = j; + siglist[j] = sprintf("\"%s\",\t%2d", substr(str, 4), j); +} - siglist[j] = sprintf("\"%s\",\t%2d", \ - substr(str, 4), j); - } /^#[ \t]*define[ \t][ \t]*_SIG[A-Z]/ { - j = sprintf("%d", $4); - str = $3; + j = sprintf("%d", $4); + str = $3; + if (nsig < j) + nsig = j; - if (nsig < j) - nsig = j; + siglist[j] = sprintf("\"%s\",\t%2d", substr(str, 5), j); +} - siglist[j] = sprintf("\"%s\",\t%2d", \ - substr(str, 5), j); - } +END { + for (n = 1; n <= nsig; n++) + if (siglist[n] != "") + printf(" { %s },\n", siglist[n]); -END { - for (n = 1; n <= nsig; n++) - if (siglist[n] != "") - printf(" { %s },\n", siglist[n]); + printf(" { NULL,\t 0 }\n};\n"); +} - printf(" { NULL,\t 0 }\n};\n"); - } |