1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
/**************************************************************************
**************************************************************************
** **
** arglist.h Argument list functions **
** ========= **
** **
** Purpose: Simplifies handling of argument lists that may **
** appear in argv, and environment variable, or else- **
** where. **
** **
** Author: Garrett D'Amore <garrett@sciences.sdsu.edu> **
** **
** Copyright: 1994, Garrett E. D'Amore **
** **
** NO WARRANTY: This program is provided entirely without warranty. **
** The user assumes full responsibility for the use of **
** this program, and agrees to indemnify the author and **
** the copyright holder from any damage or loss that **
** may result from the use of or inability to use this **
** program. In simple language: YOU USE THIS PROGRAM **
** AT YOUR OWN RISK! **
** **
** Warning: None. **
** **
** Restrictions: None. **
** **
** Algorithm: None. **
** **
** References: None. **
** **
** File formats: None. **
** **
** Rev. History: June 2, 1994 Garrett D'Amore **
** -- Initial coding. **
** **
** Notes: None. **
** **
**************************************************************************
**************************************************************************/
#ifndef ARGLIST_H
#define ARGLIST_H
/* >>>>>>>>>> Headers <<<<<<<<<< */
/* >>>>>>>>>> Defines <<<<<<<<<< */
#define ARGLISTINC (40)
/* >>>>>>>>>> Types <<<<<<<<<< */
typedef struct alist /* The actual argument list */
{
int alloc; /* amount of memory allocated to an arglist */
int argc; /* analogous to the global argc */
char **argv; /* analogous to the global argv[] */
} arglist;
/* >>>>>>>>>> Variables <<<<<<<<<< */
/* >>>>>>>>>> Prototypes <<<<<<<<<< */
/***************************************
*
* string2arglist Convert a string to an arglist.
*
* Purpose Used to split a string up into an
* argv-like arglist.
*
* Parameters string: the string to convert from
* args: pointer to struct to hold result
*
* Returns zero on success,
* non-zero on error (ENOMEM).
*
*/
int string2arglist (char *string, arglist *args);
/***************************************
*
* argv2arglist Fill an arglist from argv array.
*
* Purpose Converts argv[] array to arglist structure.
*
* Parameters argc: number of entries in argv[]
* argv: argv argument to main()
*
* Returns zero on success,
* nonzero on error (ENOMEM).
*
*/
int argv2arglist (int argc, char *argv[], arglist *args);
/* >>>>>>>>>> Functions <<<<<<<<<< */
#endif /* ARGLIST_H */
|