[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: CVS update: parsecmd.c



  User: sdb     
  Date: 06/03/03 14:35:52

  Modified:    .        parsecmd.c
  Log:
  Changed getopt to getopt_long to enable support for multichar command line
  
  flags.  This follwing up discussion on geda-user.
  
  
  
  
  Revision  Changes    Path
  1.22      +23 -0     eda/geda/devel/gnetlist/src/parsecmd.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: parsecmd.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gnetlist/src/parsecmd.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -b -r1.21 -r1.22
  --- parsecmd.c	17 May 2005 15:33:37 -0000	1.21
  +++ parsecmd.c	3 Mar 2006 19:35:52 -0000	1.22
  @@ -27,6 +27,10 @@
   #include <unistd.h>
   #endif
   
  +#ifdef HAVE_GETOPT_H
  +#include <getopt.h>
  +#endif
  +
   #include <libgeda/libgeda.h>
   
   #include "../include/globals.h"
  @@ -44,10 +48,23 @@
   #endif
   
   
  +/* Added by SDB 3.3.2006.  */
  +#ifdef HAVE_GETOPT_LONG
  +struct option long_options[] =
  +{
  +  {"help", 0, 0, 0},
  +  /* will add other args later */
  +  {0, 0, 0, 0}
  +};
  +#endif
  +
  +
  +
   void usage(char *cmd)
   {
       printf("Usage: %s [OPTIONS] filename1 ... filenameN\n", cmd);
       printf("  -e                Force embedding contents of .include file\n");
  +    printf("  -h --help         Print this help string\n");
       printf("  -i                Interactive scheme mode\n");
       printf("  -I                Put .INCLUDE <filename> in output file instead\n");
       printf("                    of model file's contents\n");
  @@ -101,8 +118,14 @@
   int parse_commandline(int argc, char *argv[])
   {
       int ch;
  +    int option_index = 0;
   
  +    /* Converted to getopt_long by SDB 3.3.2006 */
  +#ifdef HAVE_GETOPT_LONG
  +    while ((ch = getopt_long(argc, argv, OPTIONS, long_options, &option_index)) != -1) {
  +#else
       while ((ch = getopt(argc, argv, OPTIONS)) != -1) {
  +#endif
   	switch (ch) {
   
   	case 'v':