Date: Tue, 12 Jan 1999 23:43:06 +1300 From: Joe Abley <jabley@clear.co.nz> To: Mike Smith <mike@smith.net.au> Cc: freebsd-hackers@FreeBSD.ORG, jabley@clear.co.nz Subject: Re: FICL and setting BTX variables Message-ID: <19990112234306.A2738@clear.co.nz> In-Reply-To: <199901120832.AAA01933@dingo.cdrom.com>; from Mike Smith on Tue, Jan 12, 1999 at 12:32:09AM -0800 References: <19990112213121.B54045@clear.co.nz> <199901120832.AAA01933@dingo.cdrom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 12, 1999 at 12:32:09AM -0800, Mike Smith wrote: > > Should the resulting helpfile be in the same format as the help.i386 and > > help.alpha files? > > > > I'm presuming the answer is "yes" and I am steaming ahead :) > > Yup; the goal is a merge of the two. OK. Try this. It's a bit messy at the moment (and I'm not sure that my linked list implementation is as elegant as it could be), but take a look and see if it's doing the right kind of thing. Driving instructions: + cat help.i386 help.alpha help.sparc | mergehelp.awk >help.unified + keep to left + watch out for pedestrians #!/usr/bin/awk -f # # $Id: mergehelp.awk,v 1.1 1999/01/12 10:37:38 jabley Exp $ # # Merge two boot loader help files for FreeBSD 3.0 # Joe Abley <jabley@clear.co.nz> BEGIN \ { state = 0; first = 0; ind = 0; } # beginning of first command /^###/ && (state == 0) \ { state = 1; next; } # entry header /^# T[[:graph:]]+ (S[[:graph:]]+ )*D[[:graph:]][[:print:]]*$/ && (state == 1) \ { match($0, " T[[:graph:]]+"); T = substr($0, RSTART + 2, RLENGTH - 2); match($0, " S[[:graph:]]+"); S = (RLENGTH == -1) ? "" : substr($0, RSTART + 2, RLENGTH - 2); match($0, " D[[:graph:]][[:print:]]*$"); D = substr($0, RSTART + 2); # find a suitable place to store this one... ind++; if (ind == 1) { first = ind; help[ind, "T"] = T; help[ind, "S"] = S; help[ind, "link"] = -1; } else { i = first; j = -1; while (help[i, "T"] help[i, "S"] < T S) { j = i; i = help[i, "link"]; if (i == -1) break; } if (i == -1) { help[j, "link"] = ind; help[ind, "link"] = -1; } else { help[ind, "link"] = i; if (j == -1) first = ind; else help[j, "link"] = ind; } } help[ind, "T"] = T; help[ind, "S"] = S; help[ind, "D"] = D; # set our state state = 2; next; } /^[[:blank:]]+[[:graph:]][[:print:]]*$/ && (state == 2) \ { sub("^[[:blank:]]+", ""); sub("[[:blank:]]+$", ""); help[ind, "synopsis"] = $0; help[ind, "text"] = 0; state = 3; next; } /^[[:blank:]][[:graph:]][[:print:]]*$/ && (state == 3) \ { sub("^[[:blank:]]+", ""); sub("[[:blank:]]+$", ""); help[ind, "text", help[ind, "text"]] = $0; help[ind, "text"]++; next; } # end of last command, beginning of next one /^###/ && (state == 3) \ { state = 1; } # show them what we have (it's already sorted in help[]) END \ { node = first; while (node != -1) { printf "################################################################################\n"; printf "# T%s ", help[node, "T"]; if (help[node, "S"] != "") printf "S%s ", help[node, "S"]; printf "D%s\n", help[node, "D"]; printf "\n\t%s\n\n", help[node, "synopsis"]; for (i = 0; i < help[node, "text"]; i++) printf "\t%s\n", help[node, "text", i]; printf "\n"; node = help[node, "link"]; } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990112234306.A2738>