1# $FreeBSD: releng/10.2/contrib/top/sigconv.awk 164784 2006-12-01 07:01:19Z keramida $ 2 3BEGIN { 4 nsig = 0; 5 j = 0; 6 print "/* This file was automatically generated */" 7 print "/* by the awk script \"sigconv.awk\". */\n" 8 print "struct sigdesc {" 9 print " char *name;" 10 print " int number;" 11 print "};\n" 12 print "struct sigdesc sigdesc[] = {" 13 } 14 15/^#define[ \t][ \t]*SIG[A-Z]+[0-9]*[ \t]/ { 16 17 j = sprintf("%d", $3); 18 str = $2; 19 20 if (nsig < j) 21 nsig = j; 22 23 siglist[j] = sprintf("{ \"%s\",\t%2d },", \ 24 substr(str, 4), j); 25 } 26/^#[ \t]*define[ \t][ \t]*SIG[A-Z]+[0-9]*[ \t]/ { 27 28 j = sprintf("%d", $4); 29 str = $3; 30 31 if (nsig < j) 32 nsig = j; 33 34 siglist[j] = sprintf("{ \"%s\",\t%2d },", \ 35 substr(str, 4), j); 36 } 37/^#[ \t]*define[ \t][ \t]*_SIG[A-Z]+[0-9]*[ \t]/ { 38 39 j = sprintf("%d", $4); 40 str = $3; 41 42 if (nsig < j) 43 nsig = j; 44 45 siglist[j] = sprintf("{ \"%s\",\t%2d },", \ 46 substr(str, 5), j); 47 } 48 49END { 50 for (n = 1; n <= nsig; n++) 51 if (siglist[n] != "") 52 printf(" %s\n", siglist[n]); 53 54 printf(" { NULL,\t 0 }\n};\n"); 55 } 56