Skip to content
Snippets Groups Projects
Commit aca78d3b authored by ballen4705's avatar ballen4705
Browse files

Modified error message for incorrect option

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@119 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 5fa46eeb
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@
#include "scsiprint.h"
extern const char *CVSid1, *CVSid2, *CVSid4, *CVSid5;
const char* CVSid6="$Id: smartctl.c,v 1.19 2002/10/24 13:36:37 ballen4705 Exp $"
const char* CVSid6="$Id: smartctl.c,v 1.20 2002/10/25 08:50:21 ballen4705 Exp $"
CVSID1 CVSID2 CVSID4 CVSID5 CVSID6;
unsigned char driveinfo = FALSE;
......@@ -206,7 +206,7 @@ void ParseOpts (int argc, char** argv){
extern char *optarg;
extern int optopt, optind, opterr;
opterr=1;
opterr=optopt=0;
while (-1 != (optchar = getopt(argc, argv, opts))) {
switch (optchar){
case QUIETMODE:
......@@ -291,18 +291,17 @@ void ParseOpts (int argc, char** argv){
break;
case 'h':
case '?':
veryquietmode=FALSE;
printslogan();
Usage();
exit(0);
break;
default:
veryquietmode=FALSE;
pout("\n");
printslogan();
if (optopt){
pout("=======> UNRECOGNIZED OPTION: %c <=======\n\n",optopt);
Usage();
exit(FAILCMD);
}
Usage();
exit(0);
}
}
// Do this here, so results are independent of argument order
if (quietmode)
......
......@@ -38,7 +38,7 @@
#include "scsiprint.h"
extern const char *CVSid1, *CVSid2, *CVSid4, *CVSid5;
const char* CVSid6="$Id: smartctl.cpp,v 1.19 2002/10/24 13:36:37 ballen4705 Exp $"
const char* CVSid6="$Id: smartctl.cpp,v 1.20 2002/10/25 08:50:21 ballen4705 Exp $"
CVSID1 CVSID2 CVSID4 CVSID5 CVSID6;
unsigned char driveinfo = FALSE;
......@@ -206,7 +206,7 @@ void ParseOpts (int argc, char** argv){
extern char *optarg;
extern int optopt, optind, opterr;
opterr=1;
opterr=optopt=0;
while (-1 != (optchar = getopt(argc, argv, opts))) {
switch (optchar){
case QUIETMODE:
......@@ -291,18 +291,17 @@ void ParseOpts (int argc, char** argv){
break;
case 'h':
case '?':
veryquietmode=FALSE;
printslogan();
Usage();
exit(0);
break;
default:
veryquietmode=FALSE;
pout("\n");
printslogan();
if (optopt){
pout("=======> UNRECOGNIZED OPTION: %c <=======\n\n",optopt);
Usage();
exit(FAILCMD);
}
Usage();
exit(0);
}
}
// Do this here, so results are independent of argument order
if (quietmode)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment