Skip to content

Commit 864d648

Browse files
committed
fix unknown options or missing arguments
1 parent e062406 commit 864d648

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

kirc.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -166,24 +166,20 @@ pars(int sl, char *buf)
166166
int
167167
main(int argc, char **argv)
168168
{
169-
int fd[2], cval;
169+
int fd[2], cval;
170170

171171
while ((cval = getopt(argc, argv, "s:p:n:k:c:vV")) != -1)
172172
{
173173
switch (cval)
174174
{
175-
case 'v' : printf("kirc 0.0.1\n"); break;
176-
case 'V' : verb = 1; break;
177-
case 's' : host = optarg; break;
178-
case 'p' : port = optarg; break;
179-
case 'n' : nick = optarg; break;
180-
case 'c' : chan = optarg; break;
181-
case '?' :
182-
fprintf(stderr, "Unrecognized option: -%c\n", optopt);
183-
break;
184-
case ':' :
185-
fprintf(stderr, "-%c requires and operand\n", optopt);
186-
break;
175+
case 'v' : printf("kirc 0.0.1\n"); break;
176+
case 'V' : verb = 1; break;
177+
case 's' : host = optarg; break;
178+
case 'p' : port = optarg; break;
179+
case 'n' : nick = optarg; break;
180+
case 'c' : chan = optarg; break;
181+
case '?' : return 1;
182+
case ':' : return 1;
187183
}
188184
}
189185

0 commit comments

Comments
 (0)