diff options
-rw-r--r-- | usr.sbin/pcvt/cursor/cursor.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/usr.sbin/pcvt/cursor/cursor.c b/usr.sbin/pcvt/cursor/cursor.c index 2798f57..01bdd10 100644 --- a/usr.sbin/pcvt/cursor/cursor.c +++ b/usr.sbin/pcvt/cursor/cursor.c @@ -45,6 +45,7 @@ static char *id = *---------------------------------------------------------------------------*/ #include <stdio.h> +#include <err.h> #include <fcntl.h> #include <sys/stat.h> #include <machine/pcvt_ioctl.h> @@ -101,31 +102,15 @@ char *argv[]; { fd = DEFAULTFD; } - else - { - if((fd = open(device, O_RDWR)) == -1) - { - char buffer[80]; - strcpy(buffer,"ERROR opening "); - strcat(buffer,device); - perror(buffer); - exit(1); - } - } + else if((fd = open(device, O_RDWR)) == -1) + err(1, "ERROR opening %s", device); if(screen == -1) { struct stat stat; if((fstat(fd, &stat)) == -1) - { - char buffer[80]; - strcpy(buffer,"ERROR opening "); - strcat(buffer,device); - perror(buffer); - exit(1); - } - + err(1, "ERROR opening %s", device); screen = minor(stat.st_rdev); } @@ -134,10 +119,7 @@ char *argv[]; cursorshape.screen_no = screen; if(ioctl(fd, VGACURSOR, &cursorshape) == -1) - { - perror("cursor - ioctl VGACURSOR failed, error"); - exit(1); - } + err(1, "cursor - ioctl VGACURSOR failed, error"); else exit(0); } |