[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/boot/common/merge_help.awk

Version: -  FREEBSD  -  FREEBSD7  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  OPENSOLARIS  -  minix-3-1-1  -  TRUSTEDBSD-SEBSD  -  FREEBSD-LIBC  -  FREEBSD7-LIBC  -  FREEBSD6-LIBC  -  GLIBC27 
SearchContext: -  none  -  excerpts  -  bigexcerpts 

  1 #!/usr/bin/awk -f
  2 #
  3 # $FreeBSD: src/sys/boot/common/merge_help.awk,v 1.6 2006/09/28 19:06:20 jhb Exp $
  4 #
  5 # Merge two boot loader help files for FreeBSD 3.0
  6 # Joe Abley <jabley@patho.gen.nz>
  7 
  8 BEGIN \
  9 {
 10   state = 0;
 11   first = -1;
 12   ind = 0;
 13 }
 14 
 15 # beginning of first command
 16 /^###/ && (state == 0) \
 17 {
 18   state = 1;
 19   next;
 20 }
 21 
 22 # entry header
 23 /^# T[[:graph:]]+ (S[[:graph:]]+ )*D[[:graph:]][[:print:]]*$/ && (state == 1) \
 24 {
 25   match($0, " T[[:graph:]]+");
 26   T = substr($0, RSTART + 2, RLENGTH - 2);
 27   match($0, " S[[:graph:]]+");
 28   SSTART = RSTART
 29   S = (RLENGTH == -1) ? "" : substr($0, RSTART + 2, RLENGTH - 2);
 30   match($0, " D[[:graph:]][[:print:]]*$");
 31   D = substr($0, RSTART + 2);
 32   if (SSTART > RSTART)
 33     S = "";
 34 
 35   # find a suitable place to store this one...
 36   ind++;
 37   if (ind == 1)
 38   {
 39     first = ind;
 40     help[ind, "T"] = T;
 41     help[ind, "S"] = S;
 42     help[ind, "link"] = -1;
 43   } else {
 44     i = first; j = -1;
 45     while (help[i, "T"] help[i, "S"] < T S)
 46     {
 47       j = i;
 48       i = help[i, "link"];
 49       if (i == -1) break;
 50     }
 51 
 52     if (i == -1)
 53     {
 54       help[j, "link"] = ind;
 55       help[ind, "link"] = -1;
 56     } else {
 57       help[ind, "link"] = i;
 58       if (j == -1)
 59         first = ind;
 60       else
 61         help[j, "link"] = ind;
 62     }
 63   }
 64   help[ind, "T"] = T;
 65   help[ind, "S"] = S;
 66   help[ind, "D"] = D;
 67 
 68   # set our state
 69   state = 2;
 70   help[ind, "text"] = 0;
 71   next;
 72 }
 73 
 74 # end of last command, beginning of next one
 75 /^###/ && (state == 2) \
 76 {
 77   state = 1;
 78 }
 79 
 80 (state == 2) \
 81 {
 82   sub("[[:blank:]]+$", "");
 83   if (help[ind, "text"] == 0 && $0 ~ /^[[:blank:]]*$/) next;
 84   help[ind, "text", help[ind, "text"]] = $0;
 85   help[ind, "text"]++;
 86   next;
 87 }
 88 
 89 # show them what we have (it's already sorted in help[])
 90 END \
 91 {
 92   node = first;
 93   while (node != -1)
 94   {
 95     printf "################################################################################\n";
 96     printf "# T%s ", help[node, "T"];
 97     if (help[node, "S"] != "") printf "S%s ", help[node, "S"];
 98     printf "D%s\n\n", help[node, "D"];
 99     for (i = 0; i < help[node, "text"]; i++)
100       printf "%s\n", help[node, "text", i];
101     node = help[node, "link"];
102   }
103   printf "################################################################################\n";
104 }

Cache object: 045cf7847a796de1dfff18a0f203e568


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.