Main Page | Data Structures | File List | Data Fields | Globals

popts2.c File Reference

#include "popts2.h"

Functions

unsigned int popts2_add (char *s, OClass oc, OType ot, void *var)
void popts2_desc_cat_add (char *cname, char *text)
int popts2_desc_add (char *cname, char *desc)
void popts2_desc_connect (unsigned int did, unsigned int oid)
void popts2_desc_print (void)
void popts2_help_add (void)
void popts2_parse (int argc, char **argv)
void popts2_done (void)

Detailed Description

String based array functions. Mainly intended for strings.

Function Documentation

unsigned int popts2_add char *  s,
OClass  oc,
OType  ot,
void *  var
 

Parameters:
s The switch character or string.
oc Option class. If its a single character, string or special type.
ot Option type. The variable type to expect and to convert to.
var The variable to minipulate when the option is parsed.
Return values:
unsigned int A non-zero identifyer for the newly added option. This is used to attach a description to this option.
0 On failure. Failures include: NULL argument 's' and it is not of the class OCSpecial or the switch is allready being used.
Description:
Adds a switch option to search for when parseing the command line options.

int popts2_desc_add char *  cname,
char *  desc
 

Parameters:
cname The description catagory to add this description to. If NULL it will be added to 'Options'.
desc The description text.
Return values:
int A non-zero positive integer of the added description ID.
0 If the 'desc' option was NULL.
Description:
Adds a description.

void popts2_desc_cat_add char *  cname,
char *  text
 

Parameters:
cname Catagory name.
text Some optional, extra text to print for this catagory.
Description:
Adds a new description catagory.

void popts2_desc_connect unsigned int  did,
unsigned int  oid
 

Parameters:
did The description ID to attach to.
oid The command option ID to attach.
Description:
Connects a command option to a description.

void popts2_desc_print void   ) 
 

Description:
Prints out the command options and descriptions. Organized by the categories the options are attached to. Unattached options are printed after all the options that had descriptions. If a description is attached to the OString2d or OFuncString2d special type, it is printed as the very last thing.

void popts2_done void   ) 
 

Description:
Frees and cleans up all the variables. After calling this function it is safe to begin addin new options for a seprate parse, with out conflict from the previous options.

void popts2_help_add void   ) 
 

Description:
Automaticly adds the '-h' and '--help' options to call popts2_desc_print(). If 'h' or 'help' is allready used then it is not added for that option.

void popts2_parse int  argc,
char **  argv
 

Parameters:
argc The 'argc' argument passed to main().
argv The 'argv' argument passed to main().
Description:
The main parseing function for the command options. This is called after all the options and descriptions are added and attached.


Generated on Fri Jun 4 18:35:20 2004 for cuf by doxygen 1.3.6