Skip to content

Commit

Permalink
Eliminate warnings for ignored fprintf() result when printing message…
Browse files Browse the repository at this point in the history
…s to stderr
  • Loading branch information
nbriggs committed Apr 24, 2024
1 parent 38862dd commit c391641
Show file tree
Hide file tree
Showing 15 changed files with 86 additions and 86 deletions.
6 changes: 3 additions & 3 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ LispPTR Uraid_mess = NIL;
int error(const char *cp) {
char *ptr;
if (device_before_raid() < 0) {
fprintf(stderr, "Can't Enter URAID.\n");
(void)fprintf(stderr, "Can't Enter URAID.\n");
exit(-1);
}
/* comm read */
URaid_errmess = cp;
fprintf(stderr, "\n*Error* %s\n", cp);
(void)fprintf(stderr, "\n*Error* %s\n", cp);
fflush(stdin);
fprintf(stderr, "Enter the URaid\n");
(void)fprintf(stderr, "Enter the URaid\n");
print(Uraid_mess);
putchar('\n');
/* XXX: make sure output is flushed so we can see where we are */
Expand Down
14 changes: 7 additions & 7 deletions src/dlpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ int setup_dlpi_dev(char *device)
dlbindreq(fd, 0x0600, 0, DL_CLDLS, 0, 0);

if (dlbindack(fd, buf) < 0) {
fprintf(stderr, "%s: dlbindack failed.\n", pname);
(void)fprintf(stderr, "%s: dlbindack failed.\n", pname);
return (-1);
}

Expand All @@ -202,14 +202,14 @@ int setup_dlpi_dev(char *device)
dlpromisconreq(fd, DL_PROMISC_SAP);

if (dlokack(fd, buf) < 0) {
fprintf(stderr, "%s: DL_PROMISC_SAP failed.\n", pname);
(void)fprintf(stderr, "%s: DL_PROMISC_SAP failed.\n", pname);
return (-1);
}

dlpromisconreq(fd, DL_PROMISC_MULTI);

if (dlokack(fd, buf) < 0) {
fprintf(stderr, "%s: DL_PROMISC_MULTI failed.\n", pname);
(void)fprintf(stderr, "%s: DL_PROMISC_MULTI failed.\n", pname);
return (-1);
}

Expand Down Expand Up @@ -329,8 +329,8 @@ int dlpi_devtype(int fd)
case DL_FDDI: return (DLT_FDDI);
#endif
default:
fprintf(stderr, "%s: DLPI MACtype %ld unknown, ", pname, (long)dlp->info_ack.dl_mac_type);
fprintf(stderr, "assuming ethernet.\n");
(void)fprintf(stderr, "%s: DLPI MACtype %ld unknown, ", pname, (long)dlp->info_ack.dl_mac_type);
(void)fprintf(stderr, "assuming ethernet.\n");
return (DLT_EN10MB);
}
}
Expand Down Expand Up @@ -585,7 +585,7 @@ static int strgetmsg(int fd, struct strbuf *ctlp, struct strbuf *datap, int *fla
/*
* sigalrm - handle alarms.
*/
static void sigalrm(int sig) { (void)fprintf(stderr, "dlpi: timeout\n"); }
static void sigalrm(int sig) { (void)(void)fprintf(stderr, "dlpi: timeout\n"); }

/*
* savestr - save string in dynamic memory.
Expand All @@ -595,7 +595,7 @@ static char *savestr(char *s)
char *t;

if ((t = malloc(strlen(s) + 1)) == NULL) {
(void)fprintf(stderr, "%s: out of memory.\n", pname);
(void)(void)fprintf(stderr, "%s: out of memory.\n", pname);
(void)exit(1);
}

Expand Down
8 changes: 4 additions & 4 deletions src/dspif.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int h
} else if (VGA_p()) {
VGA_init(dsp, 0, 0, 0, depth_hint);
} else { /* Can't set *ANY* video mode! */
(void)fprintf(stderr, "No portable graphics mode supported by this host.\n");
(void)fprintf(stderr, "\n-Expected VESA or VGA.\n");
(void)(void)fprintf(stderr, "No portable graphics mode supported by this host.\n");
(void)(void)fprintf(stderr, "\n-Expected VESA or VGA.\n");
exit(1);
}
break;
Expand All @@ -69,7 +69,7 @@ void make_dsp_instance(DspInterface dsp, char *lispbitmap, int width_hint, int h
#elif XWINDOW
/* lispbitmap is 0 when we call X_init the first time. */
if (X_init(dsp, 0, LispDisplayRequestedWidth, LispDisplayRequestedHeight, depth_hint) == NULL) {
fprintf(stderr, "Can't open display.");
(void)fprintf(stderr, "Can't open display.");
exit(-1);
}
#endif /* DOS | XWINDOW */
Expand All @@ -87,7 +87,7 @@ void GenericReturnVoid(void *d) {(void)d; return; }
void GenericPanic(void *d) {
(void)d;
TPRINT(("Enter GenericPanic\n"));
fprintf(stderr, "Panic! Call to uninitialized display slot!");
(void)fprintf(stderr, "Panic! Call to uninitialized display slot!");
exit(0);
}

Expand Down
2 changes: 1 addition & 1 deletion src/initsout.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void init_ifpage(unsigned sysout_size) {
new_lastvmem = (sysout_size * PAGES_IN_MBYTE) - 1;

if ((!Storage_expanded) && (InterfacePage->dllastvmempage != new_lastvmem)) {
fprintf(stderr, "You can't expand VMEM\n");
(void)fprintf(stderr, "You can't expand VMEM\n");
exit(-1);
} else { /* Set value which will be set to \\LASTVMEMFILEPAGE in LISP */
InterfacePage->dllastvmempage = new_lastvmem;
Expand Down
8 changes: 4 additions & 4 deletions src/ldeboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) {
for (i = 1; i < argc; i++) {
if ((strcmp(argv[i], "-d") == 0) || (strcmp(argv[i], "-display") == 0)) {
if (i == argc - 1) {
fprintf(stderr, "Missing argument to -display option.\n");
(void)fprintf(stderr, "Missing argument to -display option.\n");
exit(1);
}
displayName = argv[++i];
Expand Down Expand Up @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) {
filetorun = LDEX;
goto run;
} else {
fprintf(stderr, "Unable to open X11 display %s\n",
(void)fprintf(stderr, "Unable to open X11 display %s\n",
displayName ? displayName : "from DISPLAY");
exit(1);
}
Expand All @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) {

#ifdef USESUNSCREEN
if ((FrameBufferFd = open("/dev/fb", O_RDWR)) < 0) {
fprintf(stderr, "lde: can't open FrameBuffer\n");
(void)fprintf(stderr, "lde: can't open FrameBuffer\n");
exit(1);
}
if (ioctl(FrameBufferFd, FBIOGTYPE, &my_screen) < 0) {
Expand Down Expand Up @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) {

run:
if (filetorun == NULL) {
fprintf(stderr, "Unable to determine what display program to run.\n");
(void)fprintf(stderr, "Unable to determine what display program to run.\n");
exit(1);
}

Expand Down
16 changes: 8 additions & 8 deletions src/ldsout.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ unsigned sysout_loader(const char *sysout_file_name, unsigned sys_size) {
*/
#ifndef NOVERSION
if (ifpage.lversion < LVERSION) {
fprintf(stderr, "Lisp VM is too old for this emulator.\n");
fprintf(stderr, "(version is %d, must be at least %d.)\n", ifpage.lversion, LVERSION);
(void)fprintf(stderr, "Lisp VM is too old for this emulator.\n");
(void)fprintf(stderr, "(version is %d, must be at least %d.)\n", ifpage.lversion, LVERSION);
exit(-1);
}

if (ifpage.minbversion > MINBVERSION) {
fprintf(stderr, "Emulator is too old for this Lisp VM.\n");
fprintf(stderr, "(version is %d, must be at least %d.)\n", MINBVERSION, ifpage.minbversion);
(void)fprintf(stderr, "Emulator is too old for this Lisp VM.\n");
(void)fprintf(stderr, "(version is %d, must be at least %d.)\n", MINBVERSION, ifpage.minbversion);
exit(-1);
}
#endif /* NOVERSION */
Expand Down Expand Up @@ -157,9 +157,9 @@ unsigned sysout_loader(const char *sysout_file_name, unsigned sys_size) {
/* Hence we have to observe the display protocol. */
VESA_errorexit(tmp);
#else
fprintf(stderr, "sysout_loader: You can't specify the process size.\n");
fprintf(stderr, "Because, secondary space is already used.\n");
fprintf(stderr, "(size is %d, you specified %d.)\n", ifpage.process_size, sys_size);
(void)fprintf(stderr, "sysout_loader: You can't specify the process size.\n");
(void)fprintf(stderr, "Because, secondary space is already used.\n");
(void)fprintf(stderr, "(size is %d, you specified %d.)\n", ifpage.process_size, sys_size);
exit(-1);
#endif /* DOS */
}
Expand All @@ -176,7 +176,7 @@ unsigned sysout_loader(const char *sysout_file_name, unsigned sys_size) {

lispworld_scratch = mmap(0, sys_size * MBYTE, PROT_READ|PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
if (lispworld_scratch == MAP_FAILED) {
fprintf(stderr, "sysout_loader: can't allocate Lisp %dMBytes VM \n", sys_size);
(void)fprintf(stderr, "sysout_loader: can't allocate Lisp %dMBytes VM \n", sys_size);
exit(-1);
}

Expand Down
54 changes: 27 additions & 27 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ int main(int argc, char *argv[])
}

if (argv[i] && ((strcmp(argv[i], "-help") == 0) || (strcmp(argv[i], "-HELP") == 0))) {
fprintf(stderr, "%s%s", helpstring, nethubHelpstring);
(void)fprintf(stderr, "%s%s", helpstring, nethubHelpstring);
exit(0);
}

Expand All @@ -387,7 +387,7 @@ int main(int argc, char *argv[])
}
if (access(sysout_name, R_OK)) {
perror("Couldn't find a sysout to run");
fprintf(stderr, "%s%s", helpstring, nethubHelpstring);
(void)fprintf(stderr, "%s%s", helpstring, nethubHelpstring);
exit(1);
}
/* OK, sysout name is now in sysout_name, and i is moved past a supplied name */
Expand All @@ -403,11 +403,11 @@ int main(int argc, char *argv[])
if (errno == 0 && tmpint > 0) {
TIMER_INTERVAL = tmpint;
} else {
fprintf(stderr, "Bad value for -t (integer > 0)\n");
(void)fprintf(stderr, "Bad value for -t (integer > 0)\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -t\n");
(void)fprintf(stderr, "Missing argument after -t\n");
exit(1);
}
}
Expand All @@ -419,11 +419,11 @@ int main(int argc, char *argv[])
if (errno == 0 && tmpint > 0) {
sysout_size = (unsigned)tmpint;
} else {
fprintf(stderr, "Bad value for -m (integer > 0)\n");
(void)fprintf(stderr, "Bad value for -m (integer > 0)\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -m\n");
(void)fprintf(stderr, "Missing argument after -m\n");
exit(1);
}
}
Expand Down Expand Up @@ -462,30 +462,30 @@ int main(int argc, char *argv[])
if (argc > ++i) {
int read = sscanf(argv[i], "%dx%d", &width, &height);
if(read != 2) {
fprintf(stderr, "Could not parse -sc argument %s\n", argv[i]);
(void)fprintf(stderr, "Could not parse -sc argument %s\n", argv[i]);
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -sc\n");
(void)fprintf(stderr, "Missing argument after -sc\n");
exit(1);
}
} else if ((strcmp(argv[i], "-pixelscale") == 0) || (strcmp(argv[i], "-PIXELSCALE") == 0)) {
if (argc > ++i) {
int read = sscanf(argv[i], "%d", &pixelscale);
if(read != 1) {
fprintf(stderr, "Could not parse -pixelscale argument %s\n", argv[i]);
(void)fprintf(stderr, "Could not parse -pixelscale argument %s\n", argv[i]);
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -pixelscale\n");
(void)fprintf(stderr, "Missing argument after -pixelscale\n");
exit(1);
}
} else if ((strcmp(argv[i], "-t") == 0) || (strcmp(argv[i], "-T") == 0)
|| (strcmp(argv[i], "-title") == 0) || (strcmp(argv[i], "-TITLE") == 0)) {
if (argc > ++i) {
windowtitle = argv[i];
} else {
fprintf(stderr, "Missing argument after -title\n");
(void)fprintf(stderr, "Missing argument after -title\n");
exit(1);
}
}
Expand All @@ -511,7 +511,7 @@ int main(int argc, char *argv[])
ether_host[4] = b4;
ether_host[5] = b5;
} else {
fprintf(stderr, "Missing or bogus -E argument\n");
(void)fprintf(stderr, "Missing or bogus -E argument\n");
ether_fd = -1;
exit(1);
}
Expand All @@ -524,7 +524,7 @@ int main(int argc, char *argv[])
if (argc > ++i) {
setNethubHost(argv[i]);
} else {
fprintf(stderr, "Missing argument after -nh-host\n");
(void)fprintf(stderr, "Missing argument after -nh-host\n");
exit(1);
}
}
Expand All @@ -535,11 +535,11 @@ int main(int argc, char *argv[])
if (errno == 0 && tmpint > 0) {
setNethubPort(tmpint);
} else {
fprintf(stderr, "Bad value for -nh-port\n");
(void)fprintf(stderr, "Bad value for -nh-port\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -nh-port\n");
(void)fprintf(stderr, "Missing argument after -nh-port\n");
exit(1);
}
}
Expand All @@ -549,11 +549,11 @@ int main(int argc, char *argv[])
if (sscanf(argv[i], "%x-%x-%x-%x-%x-%x", &b0, &b1, &b2, &b3, &b4, &b5) == 6) {
setNethubMac(b0, b1, b2, b3, b4, b5);
} else {
fprintf(stderr, "Invalid argument for -nh-mac\n");
(void)fprintf(stderr, "Invalid argument for -nh-mac\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -nh-mac\n");
(void)fprintf(stderr, "Missing argument after -nh-mac\n");
exit(1);
}
}
Expand All @@ -564,11 +564,11 @@ int main(int argc, char *argv[])
if (errno == 0 && tmpint >= 0) {
setNethubLogLevel(tmpint);
} else {
fprintf(stderr, "Bad value for -nh-loglevel\n");
(void)fprintf(stderr, "Bad value for -nh-loglevel\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -nh-loglevel\n");
(void)fprintf(stderr, "Missing argument after -nh-loglevel\n");
exit(1);
}
}
Expand All @@ -582,11 +582,11 @@ int main(int argc, char *argv[])
if (errno == 0 && tmpint > 1000) {
insnsCountdownForTimerAsyncEmulation = tmpint;
} else {
fprintf(stderr, "Bad value for -intr-emu-insns (integer > 1000)\n");
(void)fprintf(stderr, "Bad value for -intr-emu-insns (integer > 1000)\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -intr-emu-insns\n");
(void)fprintf(stderr, "Missing argument after -intr-emu-insns\n");
exit(1);
}
}
Expand All @@ -600,11 +600,11 @@ int main(int argc, char *argv[])
if (errno == 0 && tmpint > 0) {
maxpages = (unsigned)tmpint;
} else {
fprintf(stderr, "Bad value for -xpages (integer > 0)\n");
(void)fprintf(stderr, "Bad value for -xpages (integer > 0)\n");
exit(1);
}
} else {
fprintf(stderr, "Missing argument after -xpages\n");
(void)fprintf(stderr, "Missing argument after -xpages\n");
exit(1);
}
}
Expand All @@ -615,9 +615,9 @@ int main(int argc, char *argv[])
probemouse(); /* See if the mouse is connected. */
#else
if (getuid() != geteuid()) {
fprintf(stderr, "Effective user is not real user. Resetting uid\n");
(void)fprintf(stderr, "Effective user is not real user. Resetting uid\n");
if (setuid(getuid()) == -1) {
fprintf(stderr, "Unable to reset user id to real user id\n");
(void)fprintf(stderr, "Unable to reset user id to real user id\n");
exit(1);
}
}
Expand All @@ -641,7 +641,7 @@ int main(int argc, char *argv[])

if (FindUnixPipes()) /* must call the routine to allocate storage, */
{ /* in case we're re-starting a savevm w/open ptys */
if (please_fork) fprintf(stderr, "Failed to find UNIXCOMM file handles; no processes\n");
if (please_fork) (void)fprintf(stderr, "Failed to find UNIXCOMM file handles; no processes\n");
}
#endif /* DOS */

Expand All @@ -665,7 +665,7 @@ int main(int argc, char *argv[])

/* file system directory enumeration stuff */
if (!init_finfo()) {
fprintf(stderr, "Cannot allocate internal data.\n");
(void)fprintf(stderr, "Cannot allocate internal data.\n");
exit(1);
}
#ifdef RS232
Expand Down
Loading

0 comments on commit c391641

Please sign in to comment.