summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pig/pig.c15
-rw-r--r--pom/pom.c11
2 files changed, 12 insertions, 14 deletions
diff --git a/pig/pig.c b/pig/pig.c
index c7bb3397..a6a32739 100644
--- a/pig/pig.c
+++ b/pig/pig.c
@@ -1,4 +1,4 @@
-/* $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
@@ -43,13 +43,14 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#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>
@@ -79,10 +80,8 @@ main(argc, argv)
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;
}
@@ -112,7 +111,7 @@ pigout(buf, len)
* 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;
@@ -125,7 +124,7 @@ pigout(buf, len)
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'))
diff --git a/pom/pom.c b/pom/pom.c
index 7102f9ba..510750c7 100644
--- a/pom/pom.c
+++ b/pom/pom.c
@@ -1,4 +1,4 @@
-/* $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
@@ -45,7 +45,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#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 */
@@ -60,6 +60,7 @@ __RCSID("$NetBSD: pom.c,v 1.7 1997/10/10 16:47:05 lukem Exp $");
*/
#include <sys/time.h>
+#include <err.h>
#include <errno.h>
#include <math.h>
#include <stdio.h>
@@ -92,10 +93,8 @@ main(argc, argv)
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 +