-/* $NetBSD: pig.c,v 1.5 1997/10/10 16:43:37 lukem Exp $ */
+/* $NetBSD: pig.c,v 1.6 1997/10/12 01:00:27 lukem Exp $ */
/*-
* Copyright (c) 1992, 1993
#if 0
static char sccsid[] = "@(#)pig.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: pig.c,v 1.5 1997/10/10 16:43:37 lukem Exp $");
+__RCSID("$NetBSD: pig.c,v 1.6 1997/10/12 01:00:27 lukem Exp $");
#endif
#endif /* not lint */
#include <sys/types.h>
#include <ctype.h>
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
for (len = 0; (ch = getchar()) != EOF;) {
if (isalpha(ch)) {
- if (len >= sizeof(buf)) {
- (void)fprintf(stderr, "pig: ate too much!\n");
- exit(1);
- }
+ if (len >= sizeof(buf))
+ errx(1, "ate too much!");
buf[len++] = ch;
continue;
}
* If the word starts with a vowel, append "way". Don't treat 'y'
* as a vowel if it appears first.
*/
- if (index("aeiouAEIOU", buf[0]) != NULL) {
+ if (strchr("aeiouAEIOU", buf[0]) != NULL) {
(void)printf("%.*s%s", len, buf,
allupper ? "WAY" : "way");
return;
if (!allupper)
buf[0] = tolower(buf[0]);
for (start = 0, olen = len;
- !index("aeiouyAEIOUY", buf[start]) && start < olen;) {
+ !strchr("aeiouyAEIOUY", buf[start]) && start < olen;) {
ch = buf[len++] = buf[start++];
if ((ch == 'q' || ch == 'Q') && start < olen &&
(buf[start] == 'u' || buf[start] == 'U'))
-/* $NetBSD: pom.c,v 1.7 1997/10/10 16:47:05 lukem Exp $ */
+/* $NetBSD: pom.c,v 1.8 1997/10/12 01:01:39 lukem Exp $ */
/*
* Copyright (c) 1989, 1993
#if 0
static char sccsid[] = "@(#)pom.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: pom.c,v 1.7 1997/10/10 16:47:05 lukem Exp $");
+__RCSID("$NetBSD: pom.c,v 1.8 1997/10/12 01:01:39 lukem Exp $");
#endif
#endif /* not lint */
*/
#include <sys/time.h>
+#include <err.h>
#include <errno.h>
#include <math.h>
#include <stdio.h>
double days, today, tomorrow;
int cnt;
- if (gettimeofday(&tp,&tzp)) {
- (void)fprintf(stderr, "pom: %s\n", strerror(errno));
- exit(1);
- }
+ if (gettimeofday(&tp,&tzp))
+ err(1, "gettimeofday");
tmpt = tp.tv_sec;
GMT = gmtime(&tmpt);
days = (GMT->tm_yday + 1) + ((GMT->tm_hour +