diff options
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/cursor/cursor.c | 23 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/demo/playvt.c | 10 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c | 9 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/kcon/kcon.c | 57 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/loadfont/loadfont.c | 45 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/scon/scon.c | 66 | ||||
-rw-r--r-- | sys/arch/i386/isa/pcvt/Util/set2061/main.c | 7 |
7 files changed, 44 insertions, 173 deletions
diff --git a/sys/arch/i386/isa/pcvt/Util/cursor/cursor.c b/sys/arch/i386/isa/pcvt/Util/cursor/cursor.c index 8921949d927..3498117ac63 100644 --- a/sys/arch/i386/isa/pcvt/Util/cursor/cursor.c +++ b/sys/arch/i386/isa/pcvt/Util/cursor/cursor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cursor.c,v 1.6 1999/05/24 15:15:32 aaron Exp $ */ +/* $OpenBSD: cursor.c,v 1.7 2000/12/07 18:19:10 deraadt Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis @@ -114,13 +114,7 @@ char *argv[]; else { if((fd = open(device, O_RDWR)) == -1) - { - char buffer[80]; - strcpy(buffer,"ERROR opening "); - strncat(buffer,device,sizeof(buffer) - strlen(buffer)); - perror(buffer); - exit(1); - } + err(1, "ERROR opening %s", device); } if(screen == -1) @@ -128,13 +122,7 @@ char *argv[]; struct stat stat; if((fstat(fd, &stat)) == -1) - { - char buffer[80]; - strcpy(buffer,"ERROR opening "); - strncat(buffer,device,sizeof(buffer) - strlen(buffer)); - perror(buffer); - exit(1); - } + err(1, "ERROR opening %s", device); screen = minor(stat.st_rdev); } @@ -144,10 +132,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); } diff --git a/sys/arch/i386/isa/pcvt/Util/demo/playvt.c b/sys/arch/i386/isa/pcvt/Util/demo/playvt.c index d9a1c9f0bc0..4f19695033f 100644 --- a/sys/arch/i386/isa/pcvt/Util/demo/playvt.c +++ b/sys/arch/i386/isa/pcvt/Util/demo/playvt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: playvt.c,v 1.4 1999/05/24 15:37:43 aaron Exp $ */ +/* $OpenBSD: playvt.c,v 1.5 2000/12/07 18:19:11 deraadt Exp $ */ /* * Copyright (c) 1995 Hellmuth Michaelis @@ -84,13 +84,7 @@ char *argv[]; if(fflag == 1) { if((fp = fopen(filename, "r")) == NULL) - { - char buffer[80]; - strcpy(buffer,"ERROR opening file "); - strncat(buffer,filename,sizeof(buffer) - strlen(buffer)); - perror(buffer); - exit(1); - } + err(1, "ERROR opening file %s", filename); } while((c = getc(fp)) != EOF) diff --git a/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c b/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c index d3c78e4d9f1..4ffef7f5f56 100644 --- a/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c +++ b/sys/arch/i386/isa/pcvt/Util/ispcvt/ispcvt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ispcvt.c,v 1.9 2000/01/19 15:51:54 aaron Exp $ */ +/* $OpenBSD: ispcvt.c,v 1.10 2000/12/07 18:19:11 deraadt Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis @@ -116,12 +116,7 @@ char *argv[]; if((fd = open(device, O_RDWR)) == -1) { if(verbose) - { - char buffer[80]; - strcpy(buffer,"ERROR opening "); - strncat(buffer,device,sizeof(buffer) - strlen(buffer)); - perror(buffer); - } + err(1, "ERROR opening %s", device); exit(1); } } diff --git a/sys/arch/i386/isa/pcvt/Util/kcon/kcon.c b/sys/arch/i386/isa/pcvt/Util/kcon/kcon.c index e344b68c8ba..a56862c9545 100644 --- a/sys/arch/i386/isa/pcvt/Util/kcon/kcon.c +++ b/sys/arch/i386/isa/pcvt/Util/kcon/kcon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kcon.c,v 1.6 1999/01/13 07:26:05 niklas Exp $ */ +/* $OpenBSD: kcon.c,v 1.7 2000/12/07 18:19:11 deraadt Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis @@ -181,10 +181,7 @@ char *argv[]; } if((kbfd = open(KEYB_DEVICE, 0)) < 0) - { - perror("kcon: keyboard open failure"); - exit(1); - } + err(1, "kcon: keyboard open failure"); if(sf) { @@ -331,10 +328,7 @@ int kbfd; kbmapp->keynum = i; if(ioctl(kbfd, KBDGCKEY, kbmapp) < 0) - { - perror("kcon: ioctl KBDGCKEY failed"); - exit(1); - } + err(1, "kcon: ioctl KBDGCKEY failed"); if((kbmapp->type & KBD_MASK) == KBD_ALTGR) altgr_defined = i; @@ -459,10 +453,7 @@ int kbfd; int delay, rate; if((ioctl(kbfd, KBDGTPMAT, &cur_typemat_val)) < 0) - { - perror("kcon: ioctl KBDGTPMAT failed"); - exit(1); - } + err(1, "kcon: ioctl KBDGTPMAT failed"); delay = ((cur_typemat_val & 0x60) >> 5); rate = cur_typemat_val & 0x1f; @@ -488,10 +479,7 @@ int tf; srepsw_val = KBD_REPEATOFF; if(ioctl(kbfd, KBDSREPSW, &srepsw_val) < 0) - { - perror("kcon: ioctl KBDREPSW failed"); - exit(1); - } + err(1, "kcon: ioctl KBDREPSW failed"); } /*---------------------------------------------------------------------------* @@ -507,10 +495,7 @@ int rate; int new_typemat_val; if((ioctl(kbfd, KBDGTPMAT, &cur_typemat_val)) < 0) - { - perror("kcon: ioctl KBDGTPMAT failed"); - exit(1); - } + err(1, "kcon: ioctl KBDGTPMAT failed"); if(delay == -1) delay = (cur_typemat_val & 0x60); @@ -525,10 +510,7 @@ int rate; new_typemat_val = delay | rate; if((ioctl(kbfd, KBDSTPMAT, &new_typemat_val)) < 0) - { - perror("kcon: ioctl KBDSTPMAT failed"); - exit(1); - } + err(1, "kcon: ioctl KBDSTPMAT failed"); } /*---------------------------------------------------------------------------* @@ -562,10 +544,7 @@ char *map; /* set default mapping */ if((ioctl(kbfd, KBDDEFAULT)) < 0) - { - perror("kcon: ioctl KBDDEFAULT failed"); - exit(1); - } + err(1, "kcon: ioctl KBDDEFAULT failed"); /* DE flag present? */ @@ -627,10 +606,7 @@ int kbfd; entry.type = lock[i].typ; if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) - { - perror("kcon: ioctl KBDSCKEY failed"); - exit(1); - } + err(1, "kcon: ioctl KBDSCKEY failed"); } } } @@ -680,10 +656,7 @@ int kbfd; entry.keynum = n; entry.type = shift[i].typ; if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) - { - perror("kcon: ioctl KBDSCKEY failed"); - exit(1); - } + err(1, "kcon: ioctl KBDSCKEY failed"); } } } @@ -722,10 +695,7 @@ int kbfd; entry.keynum = i; if((ioctl(kbfd, KBDGOKEY, &entry)) < 0) - { - perror("kcon: ioctl KBDGOKEY failed"); - exit(1); - } + err(1, "kcon: ioctl KBDGOKEY failed"); entry.type = KBD_ASCII; @@ -767,10 +737,7 @@ setit: if (setflag) keyflag[i] = 1; if((ioctl(kbfd, KBDSCKEY, &entry)) < 0) - { - perror("kcon: ioctl KBDSCKEY failed"); - exit(1); - } + err(1, "kcon: ioctl KBDSCKEY failed"); } } } diff --git a/sys/arch/i386/isa/pcvt/Util/loadfont/loadfont.c b/sys/arch/i386/isa/pcvt/Util/loadfont/loadfont.c index e1dfb28568f..8f0acf09209 100644 --- a/sys/arch/i386/isa/pcvt/Util/loadfont/loadfont.c +++ b/sys/arch/i386/isa/pcvt/Util/loadfont/loadfont.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loadfont.c,v 1.5 1999/05/24 15:37:44 aaron Exp $ */ +/* $OpenBSD: loadfont.c,v 1.6 2000/12/07 18:19:12 deraadt Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis @@ -138,13 +138,7 @@ main(int argc, char **argv) if(dflag) { if((fd = open(device, O_RDWR)) == -1) - { - char buffer[80]; - strcpy(buffer,"ERROR opening "); - strncat(buffer,device,sizeof(buffer) - strlen(buffer)); - perror(buffer); - exit(1); - } + err(1, "ERROR opening %s", device); } else { @@ -152,10 +146,7 @@ main(int argc, char **argv) } if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) - { - perror("ioctl VGAGETSCREEN failed"); - exit(1); - } + err(1, "ioctl VGAGETSCREEN failed"); if(info == 1) { @@ -224,20 +215,10 @@ main(int argc, char **argv) sbp = &sbuf; if((in = fopen(filename, "r")) == NULL) - { - char buffer[80]; - snprintf(buffer, sizeof(buffer), "cannot open file %s for reading", filename); - perror(buffer); - exit(1); - } + err(1, "cannot open file %s for reading", filename); if((fstat(fileno(in), sbp)) != 0) - { - char buffer[80]; - snprintf(buffer, sizeof(buffer), "cannot fstat file %s", filename); - perror(buffer); - exit(1); - } + err(1, "cannot fstat file %s", filename); chr_height = sbp->st_size / 256; /* 256 chars per font */ @@ -306,10 +287,7 @@ setfont(int charset, int fontloaded, int charscan, int scrscan, int scrrow) vfattr.screen_size = scrrow; if(ioctl(fd, VGASETFONTATTR, &vfattr) == -1) - { - perror("loadfont - ioctl VGASETFONTATTR failed, error"); - exit(1); - } + err(1, "loadfont - ioctl VGASETFONTATTR failed, error"); } static void @@ -330,10 +308,7 @@ loadfont(int fontset, int charscanlines, unsigned char *font_table) } font_table += charscanlines; if(ioctl(fd, VGALOADCHAR, &vlc) == -1) - { - perror("loadfont - ioctl VGALOADCHAR failed, error"); - exit(1); - } + err(1, "loadfont - ioctl VGALOADCHAR failed, error"); } } @@ -345,10 +320,8 @@ printvgafontattr(int charset) vfattr.character_set = charset; if(ioctl(fd, VGAGETFONTATTR, &vfattr) == -1) - { - perror("loadfont - ioctl VGAGETFONTATTR failed, error"); - exit(1); - } + err(1, "loadfont - ioctl VGAGETFONTATTR failed, error"); + printf(" %d ",charset); if(vfattr.font_loaded) { diff --git a/sys/arch/i386/isa/pcvt/Util/scon/scon.c b/sys/arch/i386/isa/pcvt/Util/scon/scon.c index d9149bb38f9..5de9aceafae 100644 --- a/sys/arch/i386/isa/pcvt/Util/scon/scon.c +++ b/sys/arch/i386/isa/pcvt/Util/scon/scon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scon.c,v 1.18 2000/01/16 12:39:55 maja Exp $ */ +/* $OpenBSD: scon.c,v 1.19 2000/12/07 18:19:12 deraadt Exp $ */ /* * Copyright (c) 1992, 1995 Hellmuth Michaelis and Joerg Wunsch @@ -349,13 +349,7 @@ char *argv[]; else { if((fd = open(device, O_RDWR)) == -1) - { - char buffer[80]; - strcpy(buffer,"ERROR opening "); - strncat(buffer,device,sizeof(buffer) - strlen(buffer)); - perror(buffer); - exit(1); - } + err(1, "ERROR opening %s", device); if(vflag) printf("using device %s\n",device); } @@ -374,20 +368,14 @@ char *argv[]; } if(ioctl(fd, SETSCROLLSIZE, &scrollback_pages) < 0) - { - perror("ioctl(SETSCROLLSIZE)"); - exit(2); - } + err(2, "ioctl(SETSCROLLSIZE)"); exit(0); } if (oflag == 1) { if (ioctl(fd, TOGGLEPCDISP, &oflag) < 0) - { - perror("ioctl(TOGGLEPCDISP)"); - exit(2); - } + err(2, "ioctl(TOGGLEPCDISP)"); exit(0); } @@ -419,11 +407,7 @@ char *argv[]; } if(ioctl(fd, VGASCREENSAVER, &timeout) < 0) - { - perror("ioctl(VGASCREENSAVER)"); - fprintf(stderr, "Check the driver, the screensaver is probably not compiled in!\n"); - exit(2); - } + err(2, "ioctl(VGASCREENSAVER)"); goto success; } @@ -432,10 +416,7 @@ char *argv[]; if(vflag) printf("Setting number of columns to %d\n", colms); if(ioctl(fd, VGASETCOLMS, &colms) < 0) - { - perror("ioctl(VGASETCOLMS)"); - exit(2); - } + err(2, "ioctl(VGASETCOLMS)"); goto success; } @@ -468,10 +449,7 @@ char *argv[]; p.g = palette[idx].g; p.b = palette[idx].b; if(ioctl(fd, VGAWRITEPEL, (caddr_t)&p) < 0) - { - perror("ioctl(fd, VGAWRITEPEL)"); - return 2; - } + err(2, "ioctl(fd, VGAWRITEPEL)"); } goto success; } @@ -488,10 +466,7 @@ char *argv[]; printf("processing option -c, setting current screen to %d\n",current); if(ioctl(fd, VGASETSCREEN, &screeninfo) == -1) - { - perror("ioctl VGASETSCREEN failed"); - exit(1); - } + err(1, "ioctl VGASETSCREEN failed"); exit(0); } @@ -532,10 +507,7 @@ char *argv[]; screeninfo.force_24lines = fflag; if(ioctl(fd, VGASETSCREEN, &screeninfo) == -1) - { - perror("ioctl VGASETSCREEN failed"); - exit(1); - } + err(1, "ioctl VGASETSCREEN failed"); success: if(vflag) printf("successful execution of ioctl VGASETSCREEN!\n"); @@ -569,10 +541,7 @@ void printadaptor(fd) int fd; { if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) - { - perror("ioctl VGAGETSCREEN failed"); - exit(1); - } + err(1, "ioctl VGAGETSCREEN failed"); switch(screeninfo.adaptor_type) { default: @@ -602,10 +571,7 @@ void printmonitor(fd) int fd; { if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) - { - perror("ioctl VGAGETSCREEN failed"); - exit(1); - } + err(1, "ioctl VGAGETSCREEN failed"); switch(screeninfo.monitor_type) { default: @@ -697,10 +663,7 @@ void printinfo(fd) int fd; { if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) - { - perror("ioctl VGAGETSCREEN failed"); - exit(1); - } + err(1, "ioctl VGAGETSCREEN failed"); printf( "Video Adaptor Type = "); @@ -822,10 +785,7 @@ static void printpalette(int fd) struct vgapel p; p.idx = idx; if(ioctl(fd, VGAREADPEL, &p) < 0) - { - perror("ioctl(VGAREADPEL)"); - exit(2); - } + err(2, "ioctl(VGAREADPEL)"); palette[idx].r = p.r; palette[idx].g = p.g; palette[idx].b = p.b; diff --git a/sys/arch/i386/isa/pcvt/Util/set2061/main.c b/sys/arch/i386/isa/pcvt/Util/set2061/main.c index 366e653e927..76d3aa1415b 100644 --- a/sys/arch/i386/isa/pcvt/Util/set2061/main.c +++ b/sys/arch/i386/isa/pcvt/Util/set2061/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.3 1999/01/13 07:26:07 niklas Exp $ */ +/* $OpenBSD: main.c,v 1.4 2000/12/07 18:19:12 deraadt Exp $ */ /* * Copyright (c) 1994 Hellmuth Michaelis @@ -91,10 +91,7 @@ char *argv[]; fd = DEFAULTFD; if(ioctl(fd, KDENABIO, 0) < 0) - { - perror("ioctl(KDENABIO)"); - return 1; - } + err(1, "ioctl(KDENABIO)"); AltICD2061SetClock(freq, no); |