Use errorMsg rather than fprintf.
This commit is contained in:
@@ -39,14 +39,12 @@ int deallocvt_main(int argc, char *argv[])
|
||||
for (i = 1; i < argc; i++) {
|
||||
num = atoi(argv[i]);
|
||||
if (num == 0)
|
||||
fprintf(stderr, "%s: 0: illegal VT number\n", applet_name);
|
||||
errorMsg("0: illegal VT number\n");
|
||||
else if (num == 1)
|
||||
fprintf(stderr, "%s: VT 1 cannot be deallocated\n",
|
||||
applet_name);
|
||||
errorMsg("VT 1 cannot be deallocated\n");
|
||||
else if (ioctl(fd, VT_DISALLOCATE, num)) {
|
||||
perror("VT_DISALLOCATE");
|
||||
fprintf(stderr, "%s: could not deallocate console %d\n",
|
||||
applet_name, num);
|
||||
errorMsg("could not deallocate console %d\n", num);
|
||||
exit( FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ int dumpkmap_main(int argc, char **argv)
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
|
||||
errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ int dumpkmap_main(int argc, char **argv)
|
||||
ke.kb_table = i;
|
||||
if (ioctl(fd, KDGKBENT, &ke) < 0) {
|
||||
|
||||
fprintf(stderr, "ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
|
||||
errorMsg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
|
||||
}
|
||||
else {
|
||||
write(1,&ke.kb_value,2);
|
||||
|
||||
@@ -46,12 +46,12 @@ int loadacm_main(int argc, char **argv)
|
||||
|
||||
fd = open("/dev/tty", O_RDWR);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Error opening /dev/tty1: %s\n", strerror(errno));
|
||||
errorMsg("Error opening /dev/tty1: %s\n", strerror(errno));
|
||||
return( FALSE);
|
||||
}
|
||||
|
||||
if (screen_map_load(fd, stdin)) {
|
||||
fprintf(stderr, "Error loading acm: %s\n", strerror(errno));
|
||||
errorMsg("Error loading acm: %s\n", strerror(errno));
|
||||
return( FALSE);
|
||||
}
|
||||
|
||||
@@ -79,8 +79,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
if (parse_failed) {
|
||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||
if (errno == ESPIPE)
|
||||
fprintf(stderr,
|
||||
"16bit screen-map MUST be a regular file.\n"),
|
||||
errorMsg("16bit screen-map MUST be a regular file.\n"),
|
||||
exit(1);
|
||||
else
|
||||
perror("fseek failed reading binary 16bit screen-map"),
|
||||
@@ -91,7 +90,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
perror("Cannot read [new] map from file"), exit(1);
|
||||
#if 0
|
||||
else
|
||||
fprintf(stderr, "Input screen-map is binary.\n");
|
||||
errorMsg("Input screen-map is binary.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -108,8 +107,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
/* rewind... */
|
||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||
if (errno == ESPIPE)
|
||||
fprintf(stderr,
|
||||
"Assuming 8bit screen-map - MUST be a regular file.\n"),
|
||||
errorMsg("Assuming 8bit screen-map - MUST be a regular file.\n"),
|
||||
exit(1);
|
||||
else
|
||||
perror("fseek failed assuming 8bit screen-map"), exit(1);
|
||||
@@ -122,7 +120,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||
if (errno == ESPIPE)
|
||||
/* should not - it succedeed above */
|
||||
fprintf(stderr, "fseek() returned ESPIPE !\n"),
|
||||
errorMsg("fseek() returned ESPIPE !\n"),
|
||||
exit(1);
|
||||
else
|
||||
perror("fseek for binary 8bit screen-map"), exit(1);
|
||||
@@ -132,7 +130,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
perror("Cannot read [old] map from file"), exit(1);
|
||||
#if 0
|
||||
else
|
||||
fprintf(stderr, "Input screen-map is binary.\n");
|
||||
errorMsg("Input screen-map is binary.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -141,7 +139,7 @@ int screen_map_load(int fd, FILE * fp)
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, "Error parsing symbolic map\n");
|
||||
errorMsg("Error parsing symbolic map\n");
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ extern int loadfont_main(int argc, char **argv)
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
|
||||
errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
|
||||
return( FALSE);
|
||||
}
|
||||
loadnewfont(fd);
|
||||
@@ -72,7 +72,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
||||
if (unit < 1 || unit > 32) {
|
||||
fprintf(stderr, "Bad character size %d\n", unit);
|
||||
errorMsg("Bad character size %d\n", unit);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
|
||||
up = (struct unipair *) malloc(maxct * sizeof(struct unipair));
|
||||
|
||||
if (!up) {
|
||||
fprintf(stderr, "Out of memory?\n");
|
||||
errorMsg("Out of memory?\n");
|
||||
exit(1);
|
||||
}
|
||||
for (glyph = 0; glyph < fontsize; glyph++) {
|
||||
@@ -137,8 +137,8 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
|
||||
if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
|
||||
#ifdef ENOIOCTLCMD
|
||||
if (errno == ENOIOCTLCMD) {
|
||||
fprintf(stderr, "It seems this kernel is older than 1.1.92\n");
|
||||
fprintf(stderr, "No Unicode mapping table loaded.\n");
|
||||
errorMsg("It seems this kernel is older than 1.1.92\n");
|
||||
errorMsg("No Unicode mapping table loaded.\n");
|
||||
} else
|
||||
#endif
|
||||
perror("PIO_UNIMAPCLR");
|
||||
@@ -198,13 +198,13 @@ static void loadnewfont(int fd)
|
||||
goto no_psf;
|
||||
|
||||
if (psfhdr.mode > PSF_MAXMODE) {
|
||||
fprintf(stderr, "Unsupported psf file mode\n");
|
||||
errorMsg("Unsupported psf file mode\n");
|
||||
exit(1);
|
||||
}
|
||||
fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
|
||||
#if !defined( PIO_FONTX ) || defined( __sparc__ )
|
||||
if (fontsize != 256) {
|
||||
fprintf(stderr, "Only fontsize 256 supported\n");
|
||||
errorMsg("Only fontsize 256 supported\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
@@ -214,7 +214,7 @@ static void loadnewfont(int fd)
|
||||
|
||||
head = head0 + fontsize * unit;
|
||||
if (head > inputlth || (!hastable && head != inputlth)) {
|
||||
fprintf(stderr, "Input file: bad length\n");
|
||||
errorMsg("Input file: bad length\n");
|
||||
exit(1);
|
||||
}
|
||||
do_loadfont(fd, inbuf + head0, unit, fontsize);
|
||||
@@ -231,7 +231,7 @@ static void loadnewfont(int fd)
|
||||
} else {
|
||||
/* bare font */
|
||||
if (inputlth & 0377) {
|
||||
fprintf(stderr, "Bad input file size\n");
|
||||
errorMsg("Bad input file size\n");
|
||||
exit(1);
|
||||
}
|
||||
offset = 0;
|
||||
|
||||
@@ -59,25 +59,25 @@ int loadkmap_main(int argc, char **argv)
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
|
||||
errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
|
||||
exit(FALSE);
|
||||
}
|
||||
|
||||
read(0, buff, 7);
|
||||
if (0 != strncmp(buff, magic, 7)) {
|
||||
fprintf(stderr, "This is not a valid binary keymap.\n");
|
||||
errorMsg("This is not a valid binary keymap.\n");
|
||||
exit(FALSE);
|
||||
}
|
||||
|
||||
if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) {
|
||||
fprintf(stderr, "Error reading keymap flags: %s\n",
|
||||
errorMsg("Error reading keymap flags: %s\n",
|
||||
strerror(errno));
|
||||
exit(FALSE);
|
||||
}
|
||||
|
||||
ibuff = (u_short *) malloc(ibuffsz);
|
||||
if (!ibuff) {
|
||||
fprintf(stderr, "Out of memory.\n");
|
||||
errorMsg("Out of memory.\n");
|
||||
exit(FALSE);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ int loadkmap_main(int argc, char **argv)
|
||||
while (pos < ibuffsz) {
|
||||
if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos))
|
||||
< 0) {
|
||||
fprintf(stderr, "Error reading keymap: %s\n",
|
||||
errorMsg("Error reading keymap: %s\n",
|
||||
strerror(errno));
|
||||
exit(FALSE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user