summaryrefslogtreecommitdiffstats
path: root/doc/tools/bmenu/main.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1997-08-15 16:40:21 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1997-08-15 16:40:21 +0000
commit5b9ec3516618d5fcc498f0029b99c49d2047cb86 (patch)
treea8da1e05520784268020542a45fc2975b5e5ed98 /doc/tools/bmenu/main.c
parentSwitched to new version of mc68681.h (diff)
downloadrtems-5b9ec3516618d5fcc498f0029b99c49d2047cb86.tar.bz2
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.
Diffstat (limited to 'doc/tools/bmenu/main.c')
-rw-r--r--doc/tools/bmenu/main.c35
1 files changed, 28 insertions, 7 deletions
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 <string.h>
/* 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 <stdlib.h>? */
extern char *optarg; /* Why is this not in <stdlib.h>? */
@@ -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';
-
}
/*