-/* $NetBSD: pig.c,v 1.8 1999/09/18 19:38:53 jsm Exp $ */
+/* $NetBSD: pig.c,v 1.15 2012/06/19 05:46:09 dholland Exp $ */
/*-
* Copyright (c) 1992, 1993
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
#include <sys/cdefs.h>
#ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
- The Regents of the University of California. All rights reserved.\n");
+__COPYRIGHT("@(#) Copyright (c) 1992, 1993\
+ The Regents of the University of California. All rights reserved.");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)pig.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: pig.c,v 1.8 1999/09/18 19:38:53 jsm Exp $");
+__RCSID("$NetBSD: pig.c,v 1.15 2012/06/19 05:46:09 dholland Exp $");
#endif
#endif /* not lint */
#include <string.h>
#include <unistd.h>
-int main __P((int, char *[]));
-void pigout __P((char *, int));
-void usage __P((void)) __attribute__((__noreturn__));
+int main(int, char *[]);
+static void pigout(char *, int);
+static void usage(void) __dead;
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
int len;
int ch;
exit(0);
}
-void
-pigout(buf, len)
- char *buf;
- int len;
+static void
+pigout(char *buf, int len)
{
int ch, start, i;
int olen, allupper, firstupper;
/* See if the word is all upper case */
- allupper = firstupper = isupper(buf[0]);
+ allupper = firstupper = isupper((unsigned char)buf[0]);
for (i = 1; i < len && allupper; i++)
- allupper = allupper && isupper(buf[i]);
+ allupper = allupper && isupper((unsigned char)buf[i]);
/*
* If the word starts with a vowel, append "way". Don't treat 'y'
* isn't treated as a vowel.
*/
if (!allupper)
- buf[0] = tolower(buf[0]);
+ buf[0] = tolower((unsigned char)buf[0]);
for (start = 0, olen = len;
!strchr("aeiouyAEIOUY", buf[start]) && start < olen;) {
ch = buf[len++] = buf[start++];
buf[len++] = buf[start++];
}
if (firstupper)
- buf[start] = toupper(buf[start]);
+ buf[start] = toupper((unsigned char)buf[start]);
(void)printf("%.*s%s", olen, buf + start, allupper ? "AY" : "ay");
}
-void
-usage()
+static void
+usage(void)
{
(void)fprintf(stderr, "usage: pig\n");
exit(1);