summaryrefslogtreecommitdiffstats
path: root/battlestar/getcom.c
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>1997-10-11 02:06:55 +0000
committerlukem <lukem@NetBSD.org>1997-10-11 02:06:55 +0000
commit61a235f9c8a332df14e8fe40b7b1fcaa98ecc548 (patch)
tree50f20c42070d381297a96acd027002bc10e84095 /battlestar/getcom.c
parent098ef9272dbfc3deff7afcd768ea90836e72a163 (diff)
downloadbsdgames-darwin-61a235f9c8a332df14e8fe40b7b1fcaa98ecc548.tar.gz
bsdgames-darwin-61a235f9c8a332df14e8fe40b7b1fcaa98ecc548.tar.zst
bsdgames-darwin-61a235f9c8a332df14e8fe40b7b1fcaa98ecc548.zip
KNFify (with indent)
Diffstat (limited to 'battlestar/getcom.c')
-rw-r--r--battlestar/getcom.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/battlestar/getcom.c b/battlestar/getcom.c
index 1631935d..841d376a 100644
--- a/battlestar/getcom.c
+++ b/battlestar/getcom.c
@@ -1,4 +1,4 @@
-/* $NetBSD: getcom.c,v 1.4 1997/10/10 11:39:53 lukem Exp $ */
+/* $NetBSD: getcom.c,v 1.5 1997/10/11 02:07:21 lukem Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,20 +38,20 @@
#if 0
static char sccsid[] = "@(#)getcom.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: getcom.c,v 1.4 1997/10/10 11:39:53 lukem Exp $");
+__RCSID("$NetBSD: getcom.c,v 1.5 1997/10/11 02:07:21 lukem Exp $");
#endif
-#endif /* not lint */
+#endif /* not lint */
#include "extern.h"
-char *
+char *
getcom(buf, size, prompt, error)
- char *buf;
- int size;
- char *prompt, *error;
+ char *buf;
+ int size;
+ char *prompt, *error;
{
for (;;) {
- fputs(prompt, stdout);
+ fputs(prompt, stdout);
if (fgets(buf, size, stdin) == 0) {
clearerr(stdin);
continue;
@@ -71,10 +71,10 @@ getcom(buf, size, prompt, error)
* shifts to UPPERCASE if flag > 0, lowercase if flag < 0,
* and leaves it unchanged if flag = 0
*/
-char *
+char *
getword(buf1, buf2, flag)
- char *buf1, *buf2;
- int flag;
+ char *buf1, *buf2;
+ int flag;
{
while (isspace(*buf1))
buf1++;
@@ -89,13 +89,14 @@ getword(buf1, buf2, flag)
*buf2++ = tolower(*buf1++);
else
*buf2++ = *buf1++;
- else if (flag > 0)
- if (islower(*buf1))
- *buf2++ = toupper(*buf1++);
+ else
+ if (flag > 0)
+ if (islower(*buf1))
+ *buf2++ = toupper(*buf1++);
+ else
+ *buf2++ = *buf1++;
else
*buf2++ = *buf1++;
- else
- *buf2++ = *buf1++;
} else
*buf2++ = *buf1++;
*buf2 = 0;