From 5b9ec3516618d5fcc498f0029b99c49d2047cb86 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 15 Aug 1997 16:40:21 +0000 Subject: Added command line options for next, previous, and up node. Added error check to insure we don't write over a .texi file given to us as input. --- doc/tools/bmenu/main.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'doc/tools/bmenu/main.c') diff --git a/doc/tools/bmenu/main.c b/doc/tools/bmenu/main.c index 7568b379aa..d60c559ea5 100644 --- a/doc/tools/bmenu/main.c +++ b/doc/tools/bmenu/main.c @@ -27,9 +27,12 @@ #include /* XXX -- just for testing -- these should be set by options */ -char DocsNextNode[] = ""; -char DocsPreviousNode[] = "Top"; -char DocsUpNode[] = "Top"; +char TopString[] = "Top"; +char EmptyString[] = ""; + +char *DocsNextNode; +char *DocsPreviousNode; +char *DocsUpNode; extern int optind; /* Why is this not in ? */ extern char *optarg; /* Why is this not in ? */ @@ -55,7 +58,7 @@ FILE *OutFile = stdout; char *Usage_Strings[] = { "\n", - "usage: cmd [-bv] files ...\n", + "usage: cmd [-bv] [-p prev] [-n next] [-u up] files ...\n", "\n", "EOF" }; @@ -417,12 +420,25 @@ int main( boolean single_file_mode; Verbose = FALSE; + DocsNextNode = EmptyString; + DocsPreviousNode = TopString; + DocsUpNode = TopString; - while ((c = getopt(argc, argv, "bv")) != EOF) { + while ((c = getopt(argc, argv, "vp:n:u:")) != EOF) { switch (c) { case 'v': Verbose = TRUE; break; + case 'p': + DocsPreviousNode = strdup(optarg); + break; + case 'n': + DocsNextNode = strdup(optarg); + break; + case 'u': + DocsUpNode = strdup(optarg); + break; + case '?': usage(); return 0; @@ -465,12 +481,17 @@ void ProcessFile( out[ index ] = inname[ index ]; } + if ( !strcmp( &inname[index], ".texi" ) ) { + fprintf( stderr, "Input file already has .texi extension\n" ); + exit_application( 1 ); + } + out[ index++ ] = '.'; out[ index++ ] = 't'; + out[ index++ ] = 'e'; out[ index++ ] = 'x'; - out[ index++ ] = 't'; + out[ index++ ] = 'i'; out[ index ] = '\0'; - } /* -- cgit v1.2.3