forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -27,9 +27,12 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* XXX -- just for testing -- these should be set by options */
|
/* XXX -- just for testing -- these should be set by options */
|
||||||
char DocsNextNode[] = "";
|
char TopString[] = "Top";
|
||||||
char DocsPreviousNode[] = "Top";
|
char EmptyString[] = "";
|
||||||
char DocsUpNode[] = "Top";
|
|
||||||
|
char *DocsNextNode;
|
||||||
|
char *DocsPreviousNode;
|
||||||
|
char *DocsUpNode;
|
||||||
|
|
||||||
extern int optind; /* Why is this not in <stdlib.h>? */
|
extern int optind; /* Why is this not in <stdlib.h>? */
|
||||||
extern char *optarg; /* 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[] = {
|
char *Usage_Strings[] = {
|
||||||
"\n",
|
"\n",
|
||||||
"usage: cmd [-bv] files ...\n",
|
"usage: cmd [-bv] [-p prev] [-n next] [-u up] files ...\n",
|
||||||
"\n",
|
"\n",
|
||||||
"EOF"
|
"EOF"
|
||||||
};
|
};
|
||||||
@@ -417,12 +420,25 @@ int main(
|
|||||||
boolean single_file_mode;
|
boolean single_file_mode;
|
||||||
|
|
||||||
Verbose = FALSE;
|
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) {
|
switch (c) {
|
||||||
case 'v':
|
case 'v':
|
||||||
Verbose = TRUE;
|
Verbose = TRUE;
|
||||||
break;
|
break;
|
||||||
|
case 'p':
|
||||||
|
DocsPreviousNode = strdup(optarg);
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
DocsNextNode = strdup(optarg);
|
||||||
|
break;
|
||||||
|
case 'u':
|
||||||
|
DocsUpNode = strdup(optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
usage();
|
usage();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -465,12 +481,17 @@ void ProcessFile(
|
|||||||
out[ index ] = inname[ index ];
|
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++ ] = '.';
|
||||||
out[ index++ ] = 't';
|
out[ index++ ] = 't';
|
||||||
|
out[ index++ ] = 'e';
|
||||||
out[ index++ ] = 'x';
|
out[ index++ ] = 'x';
|
||||||
out[ index++ ] = 't';
|
out[ index++ ] = 'i';
|
||||||
out[ index ] = '\0';
|
out[ index ] = '\0';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user