Created error.h and error.c for syserror()

This commit is contained in:
qorg11 2020-06-04 01:22:06 +02:00
parent aff3c77b37
commit 0ff31634d9
Signed by: qorg11
GPG Key ID: 343FC20A4ACA62B9
3 changed files with 16 additions and 1 deletions

View File

@ -2,6 +2,8 @@
#include <stdlib.h>
#include <signal.h>
#include "lib/error.h"
int
main(int argc, char *argv[])
{
@ -21,6 +23,10 @@ main(int argc, char *argv[])
fprintf(stderr, "Specify who to kill\n");
return 1;
}
kill(pid,sig);
int fd = kill(pid,sig);
if(fd == -1)
syserror("Could not kill process\n");
return 0;
}

8
src/lib/error.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
#include "error.h"
int syserror(char *msg)
{
fprintf(stderr,"%s",msg);
return 1;
}

1
src/lib/error.h Normal file
View File

@ -0,0 +1 @@
int syserror(char *msg);