Changeset 5b9ec351 in rtems


Ignore:
Timestamp:
08/15/97 16:40:21 (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
2d997375
Parents:
d074e12
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/tools/bmenu/main.c

    rd074e12 r5b9ec351  
    2828
    2929/* XXX -- just for testing -- these should be set by options */
    30 char DocsNextNode[]     = "";
    31 char DocsPreviousNode[] = "Top";
    32 char DocsUpNode[]       = "Top";
     30char TopString[]   = "Top";
     31char EmptyString[] = "";
     32
     33char *DocsNextNode;
     34char *DocsPreviousNode;
     35char *DocsUpNode;
    3336
    3437extern int   optind;     /* Why is this not in <stdlib.h>? */
     
    5659char *Usage_Strings[] = {
    5760  "\n",
    58   "usage: cmd [-bv] files ...\n",
     61  "usage: cmd [-bv] [-p prev] [-n next] [-u up] files ...\n",
    5962  "\n",
    6063  "EOF"
     
    418421
    419422  Verbose = FALSE;
    420 
    421   while ((c = getopt(argc, argv, "bv")) != EOF) {
     423  DocsNextNode     = EmptyString;
     424  DocsPreviousNode = TopString;
     425  DocsUpNode       = TopString;
     426
     427  while ((c = getopt(argc, argv, "vp:n:u:")) != EOF) {
    422428    switch (c) {
    423429      case 'v':
    424430        Verbose = TRUE;
    425431        break;
     432      case 'p':
     433        DocsPreviousNode = strdup(optarg);
     434        break;
     435      case 'n':
     436        DocsNextNode = strdup(optarg);
     437        break;
     438      case 'u':
     439        DocsUpNode = strdup(optarg);
     440        break;
     441
    426442      case '?':
    427443        usage();
     
    466482     }
    467483
     484     if ( !strcmp( &inname[index], ".texi" ) ) {
     485        fprintf( stderr, "Input file already has .texi extension\n" );
     486        exit_application( 1 );
     487     }
     488
    468489     out[ index++ ] = '.';
    469490     out[ index++ ] = 't';
     491     out[ index++ ] = 'e';
    470492     out[ index++ ] = 'x';
    471      out[ index++ ] = 't';
     493     out[ index++ ] = 'i';
    472494     out[ index ] = '\0';
    473 
    474495   }
    475496
Note: See TracChangeset for help on using the changeset viewer.