Fixed help message
This commit is contained in:
parent
529b7bc5dc
commit
84814d4ba7
@ -8,7 +8,7 @@ of other businesses, but for me it's more than enough.
|
|||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
Usage: ./on-stock [-l] [-s [name]] [-m [name (a/s)quantity]]
|
Usage: ./on-stock [-l] [-s [name]] [-m [name (a/s)quantity]]
|
||||||
[-d [name]] [-n] [-f filename]
|
[-d [name]] [-n] [-h] [-f filename]
|
||||||
-l = list the articles in the database
|
-l = list the articles in the database
|
||||||
-s = search for an article in the database
|
-s = search for an article in the database
|
||||||
If no name is given as argument, you will be prompted for a name.
|
If no name is given as argument, you will be prompted for a name.
|
||||||
@ -24,6 +24,7 @@ of other businesses, but for me it's more than enough.
|
|||||||
If a name is given as argument, no confirmation will be required to
|
If a name is given as argument, no confirmation will be required to
|
||||||
delete the article from the database.
|
delete the article from the database.
|
||||||
-n = create new articles (interactive mode only)
|
-n = create new articles (interactive mode only)
|
||||||
|
-h = display this help message
|
||||||
-f = specifiy a filename for the database
|
-f = specifiy a filename for the database
|
||||||
|
|
||||||
|
|
||||||
|
21
on-stock.c
21
on-stock.c
@ -46,7 +46,7 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Process command line arugments */
|
/* Process command line arugments */
|
||||||
while ((opt = getopt(argc, argv, "lsmdnf:")) != -1)
|
while ((opt = getopt(argc, argv, "hlsmdnf:")) != -1)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
@ -68,6 +68,9 @@ int main(int argc, char* argv[])
|
|||||||
case 'f':
|
case 'f':
|
||||||
strncpy(filename, optarg, FILEMAXLENGTH-1);
|
strncpy(filename, optarg, FILEMAXLENGTH-1);
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
printUsage(argv[0]);
|
||||||
|
return 0;
|
||||||
default:
|
default:
|
||||||
printUsage(argv[0]);
|
printUsage(argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
@ -357,12 +360,24 @@ int new(struct myData *datap, int numRec)
|
|||||||
|
|
||||||
void printUsage(char *arg)
|
void printUsage(char *arg)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: %s [-l] [-s] [-m [-d [-n] [-f filename]\n"
|
fprintf(stderr, "Usage: %s [-l] [-s [name]] [-m [name (a/s)quantity]]\n"
|
||||||
|
"[-d [name]] [-n] [-h] [-f filename]\n\n"
|
||||||
"-l = list the articles in the database\n"
|
"-l = list the articles in the database\n"
|
||||||
"-s = search for an article in the database\n"
|
"-s = search for an article in the database\n"
|
||||||
|
" If no name is given as argument, you will be prompted for a name.\n"
|
||||||
"-m = modify a article\n"
|
"-m = modify a article\n"
|
||||||
|
" If no name is given as argument, you will be prompted for a\n"
|
||||||
|
" name. You'll then have the choice to change name, quantity and price.\n"
|
||||||
|
" If a name is given as argument, the quantity can be changed from the\n"
|
||||||
|
" command line, such as subtracting the stock by three:\n"
|
||||||
|
" ./on-stock -m 'Nailgun' s3\n"
|
||||||
"-d = delete a article\n"
|
"-d = delete a article\n"
|
||||||
"-n = create a new article\n"
|
" If no name is given as argument, you will be prompted for an article\n"
|
||||||
|
" to delete.\n"
|
||||||
|
" If a name is given as argument, no confirmation will be required to\n"
|
||||||
|
" delete the article from the database.\n"
|
||||||
|
"-n = create new articles (interactive mode only)\n"
|
||||||
|
"-h = display this help message\n"
|
||||||
"-f = specifiy a filename for the database\n", arg);
|
"-f = specifiy a filename for the database\n", arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user