@@ -683,7 +683,7 @@ void parse_options(int argc, char **argv) {
683
683
684
684
/* OK, lets parse these args! */
685
685
optind = 1 ; /* so it can be called multiple times */
686
- while ((arg = getopt_long_only (argc, argv, " 46Ab:D:d::e:Ffg:hIi:M:m:nO::o:P:p:qRrS:s:T:Vv::" , long_options, &option_index)) != EOF) {
686
+ while ((arg = getopt_long_only (argc, argv, " 46Ab:D:d::e:Ffg:hIi:M:m:nO::o:P:: p:qRrS:s: :T:Vv::" , long_options, &option_index)) != EOF) {
687
687
switch (arg) {
688
688
case 0 :
689
689
#ifndef NOLUA
@@ -1145,8 +1145,18 @@ void parse_options(int argc, char **argv) {
1145
1145
delayed_options.normalfilename = logfilename (optarg , local_time);
1146
1146
break ;
1147
1147
case ' P' :
1148
- if (*optarg == ' \0 ' || *optarg == ' I' || *optarg == ' E' )
1148
+ if (!optarg ) {
1149
+ delayed_options.warn_deprecated (" P" , " PE" );
1150
+ o.pingtype |= PINGTYPE_ICMP_PING;
1151
+ }
1152
+ else if (*optarg == ' \0 ' || *optarg == ' I' || *optarg == ' E' ) {
1153
+ if (*optarg != ' E' ) {
1154
+ char buf[4 ];
1155
+ Snprintf (buf, 3 , " P%c" , *optarg );
1156
+ delayed_options.warn_deprecated (buf, " PE" );
1157
+ }
1149
1158
o.pingtype |= PINGTYPE_ICMP_PING;
1159
+ }
1150
1160
else if (*optarg == ' M' )
1151
1161
o.pingtype |= PINGTYPE_ICMP_MASK;
1152
1162
else if (*optarg == ' P' )
@@ -1259,7 +1269,7 @@ void parse_options(int argc, char **argv) {
1259
1269
o.spoofsource = true ;
1260
1270
break ;
1261
1271
case ' s' :
1262
- if (!*optarg ) {
1272
+ if (!optarg || ! *optarg ) {
1263
1273
printusage ();
1264
1274
error (" An option is required for -s, most common are -sT (tcp scan), -sS (SYN scan), -sF (FIN scan), -sU (UDP scan) and -sn (Ping scan)" );
1265
1275
exit (-1 );
0 commit comments