/* Options.c - stuff to handle command line options. * This is smaller and more flexible than the cgiSpoof * routines we used to use - though cgiSpoof is still the * method of choice for actual CGI routine. */ #include "common.h" #include "hash.h" #include "options.h" struct hash *optionParseIntoHash(int *pArgc, char *argv[], boolean justFirst) /* Read options in command line (only up to first real argument) into * options hash. Options come in three forms: * -option words starting with dash * option=val words with = in the middle * -option=val combining the two. * The resulting hash will be keyed by the option name with the val * string for value. For '-option' types the value is 'on'. */ { int i, origArgc, curArgc; char **rdPt = argv+1, **wrPt = argv+1; boolean gotReal = FALSE; struct hash *hash = newHash(6); origArgc = curArgc = *pArgc; for (i=1; i