modified kill.c so doesn't use getopt (which in this case

was a complete overkill). Also a warning if nothing given.
This commit is contained in:
qorg11 2020-08-02 22:05:55 +02:00
parent 0d9b8f2551
commit 61a4887fb1
No known key found for this signature in database
GPG Key ID: 343FC20A4ACA62B9
1 changed files with 6 additions and 3 deletions

View File

@ -1,7 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <getopt.h>
void
list_signals(void)
@ -27,8 +26,12 @@ main(int argc, char *argv[])
int sig = 0;
pid_t pid;
int c = getopt(argc, argv,"l");
if(c == 'l')
if(argc == 1)
{
fprintf(stderr,"expected something\n");
return 1;
}
if(argv[1][1] == 'l')
{
list_signals();
return 0;