savannah-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Savannah-hackers] submission of C library to parse command line args -


From: damien . cassou
Subject: [Savannah-hackers] submission of C library to parse command line args - savannah.nongnu.org
Date: Tue, 27 May 2003 14:39:13 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686) Gecko/20030428 Galeon/1.3.3

A package was submitted to savannah.nongnu.org
This mail was sent to address@hidden, address@hidden


Damien CASSOU <address@hidden> described the package as follows:
License: gpl
Other License: 
Package: C library to parse command line args
System name: libargs
Type: non-GNU

Description:
I would like to create a librairie that will parse all the command line options 
of a programm. It will be useful to avoid construction like this :

if ( (strcmp(argv[i], \"-h\") == 0) || (strcmp(argv[i], \"--help\") == 0) )
  {
    ...
  }
  else if ( (strcmp(argv[i], \"-l\") == 0) || (strcmp(argv[i], --licence\") == 
0) )
  {
    ...
  }
...

which is not very maintainable. It will be for C programs and will use the GNU 
standards for options (short and long type args). It might use getopt_long but 
will be easyer than it because everything will be implemented in the library.
There are no sources at all for now.

I want user to do :
larg_add_argument(\'v\',\"version\",\"Print the version of this 
software\",version);
larg_add_argument(\'h\',\"help\",\"Print a short help message\",help)
...
(where version and help are the functions to run when the argument is passed)

Prototype might be :
void larg_add_argument(char shortArg, char *longArg, char *desc, void 
(*func)());

Hoping that my project will be accepted


Other Software Required:
stdlib.h stdio.h string.h...
maybe : getopt.h unistd.h

Other Comments:






reply via email to

[Prev in Thread] Current Thread [Next in Thread]