-/* $NetBSD: rain.c,v 1.17 2004/05/02 21:31:23 christos Exp $ */
+/* $NetBSD: rain.c,v 1.21 2008/08/08 16:10:47 drochner Exp $ */
/*
* Copyright (c) 1980, 1993
#include <sys/cdefs.h>
#ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
- The Regents of the University of California. All rights reserved.\n");
+__COPYRIGHT("@(#) Copyright (c) 1980, 1993\
+ The Regents of the University of California. All rights reserved.");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)rain.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: rain.c,v 1.17 2004/05/02 21:31:23 christos Exp $");
+__RCSID("$NetBSD: rain.c,v 1.21 2008/08/08 16:10:47 drochner Exp $");
#endif
#endif /* not lint */
return 1;
}
- initscr();
+ if (!initscr())
+ errx(0, "couldn't initialize screen");
cols = COLS - 4;
lines = LINES - 4;
(void)signal(SIGINT, onsig);
(void)signal(SIGTERM, onsig);
- curs_set(0);
+ (void)curs_set(0);
for (j = 4; j >= 0; --j) {
xpos[j] = random() % cols + 2;
ypos[j] = random() % lines + 2;
}
for (j = 0;;) {
if (sig_caught) {
- endwin();
+ (void)endwin();
exit(0);
}
x = random() % cols + 2;
y = random() % lines + 2;
- mvaddch(y, x, '.');
- mvaddch(ypos[j], xpos[j], 'o');
+ (void)mvaddch(y, x, '.');
+ (void)mvaddch(ypos[j], xpos[j], 'o');
if (!j--)
j = 4;
- mvaddch(ypos[j], xpos[j], 'O');
+ (void)mvaddch(ypos[j], xpos[j], 'O');
if (!j--)
j = 4;
- mvaddch(ypos[j] - 1, xpos[j], '-');
- mvaddstr(ypos[j], xpos[j] - 1, "|.|");
- mvaddch(ypos[j] + 1, xpos[j], '-');
+ (void)mvaddch(ypos[j] - 1, xpos[j], '-');
+ (void)mvaddstr(ypos[j], xpos[j] - 1, "|.|");
+ (void)mvaddch(ypos[j] + 1, xpos[j], '-');
if (!j--)
j = 4;
- mvaddch(ypos[j] - 2, xpos[j], '-');
- mvaddstr(ypos[j] - 1, xpos[j] - 1, "/ \\");
- mvaddstr(ypos[j], xpos[j] - 2, "| O |");
- mvaddstr(ypos[j] + 1, xpos[j] - 1, "\\ /");
- mvaddch(ypos[j] + 2, xpos[j], '-');
+ (void)mvaddch(ypos[j] - 2, xpos[j], '-');
+ (void)mvaddstr(ypos[j] - 1, xpos[j] - 1, "/ \\");
+ (void)mvaddstr(ypos[j], xpos[j] - 2, "| O |");
+ (void)mvaddstr(ypos[j] + 1, xpos[j] - 1, "\\ /");
+ (void)mvaddch(ypos[j] + 2, xpos[j], '-');
if (!j--)
j = 4;
- mvaddch(ypos[j] - 2, xpos[j], ' ');
- mvaddstr(ypos[j] - 1, xpos[j] - 1, " ");
- mvaddstr(ypos[j], xpos[j] - 2, " ");
- mvaddstr(ypos[j] + 1, xpos[j] - 1, " ");
- mvaddch(ypos[j] + 2, xpos[j], ' ');
+ (void)mvaddch(ypos[j] - 2, xpos[j], ' ');
+ (void)mvaddstr(ypos[j] - 1, xpos[j] - 1, " ");
+ (void)mvaddstr(ypos[j], xpos[j] - 2, " ");
+ (void)mvaddstr(ypos[j] + 1, xpos[j] - 1, " ");
+ (void)mvaddch(ypos[j] + 2, xpos[j], ' ');
xpos[j] = x;
ypos[j] = y;
- refresh();
- if (delay) usleep(delay);
+ (void)refresh();
+ if (delay) (void)usleep(delay);
}
}
+/* ARGSUSED */
static void
-onsig(int dummy __attribute__((__unused__)))
+onsig(int dummy __unused)
{
sig_caught = 1;
}