summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pcvt
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>2001-07-26 11:02:39 +0000
committersheldonh <sheldonh@FreeBSD.org>2001-07-26 11:02:39 +0000
commit9bfb9eedcddf3ab4e79532e863cf16c5ff381090 (patch)
treebd2ac2627dbeab7d3427432bb98d2c73085b61c1 /usr.sbin/pcvt
parent505859f37d54f23b1ebc688851be182d4e1332c8 (diff)
downloadFreeBSD-src-9bfb9eedcddf3ab4e79532e863cf16c5ff381090.zip
FreeBSD-src-9bfb9eedcddf3ab4e79532e863cf16c5ff381090.tar.gz
Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. The
definitions are more readable, and it's possible that they're more portable to pathalogical platforms. Submitted by: David Hill <david@phobia.ms>
Diffstat (limited to 'usr.sbin/pcvt')
-rw-r--r--usr.sbin/pcvt/keycap/keycap.c14
-rw-r--r--usr.sbin/pcvt/vttest/esc.c20
-rw-r--r--usr.sbin/pcvt/vttest/main.c10
3 files changed, 28 insertions, 16 deletions
diff --git a/usr.sbin/pcvt/keycap/keycap.c b/usr.sbin/pcvt/keycap/keycap.c
index 9bbb7e5..9c276a3 100644
--- a/usr.sbin/pcvt/keycap/keycap.c
+++ b/usr.sbin/pcvt/keycap/keycap.c
@@ -35,6 +35,11 @@
*
*/
+#ifndef lint
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif
+
static char *id =
"@(#)keycap.c, 3.20, Last Edit-Date: [Tue Dec 20 14:51:50 1994]";
@@ -64,6 +69,7 @@ static char *id =
#include <stdio.h>
#include <ctype.h>
+#include <unistd.h>
#include "keycap.h"
@@ -137,7 +143,7 @@ char *bp, *name;
break;
}
if (cp >= bp+KEYCAP_BUFSIZ) {
- write(2,"Keycap entry too long\n", 23);
+ write(STDERR_FILENO, "Keycap entry too long\n", 23);
break;
} else
*cp++ = c;
@@ -170,7 +176,7 @@ static int knchktc()
p = tbuf + strlen(tbuf) - 2; /* before the last colon */
while (*--p != ':')
if (p<tbuf) {
- write(2, "Bad keycap entry\n", 18);
+ write(STDERR_FILENO, "Bad keycap entry\n", 18);
return (0);
}
p++;
@@ -183,7 +189,7 @@ static int knchktc()
q++;
*q = 0;
if (++hopcount > MAXHOP) {
- write(2, "Infinite tc= loop\n", 18);
+ write(STDERR_FILENO, "Infinite tc= loop\n", 18);
return (0);
}
if (kgetent(tcbuf, tcname) != 1)
@@ -192,7 +198,7 @@ static int knchktc()
;
l = p - holdtbuf + strlen(q);
if (l > KEYCAP_BUFSIZ) {
- write(2, "Keycap entry too long\n", 23);
+ write(STDERR_FILENO, "Keycap entry too long\n", 23);
q[KEYCAP_BUFSIZ - (p-tbuf)] = 0;
}
strcpy(p, q+1);
diff --git a/usr.sbin/pcvt/vttest/esc.c b/usr.sbin/pcvt/vttest/esc.c
index b2bce92..e52cef2 100644
--- a/usr.sbin/pcvt/vttest/esc.c
+++ b/usr.sbin/pcvt/vttest/esc.c
@@ -1,5 +1,11 @@
+#include <unistd.h>
#include "header.h"
+#ifndef lint
+static const char rcsid[] =
+ "$FreeBSD$";
+#endif
+
println(s) char *s; {
printf("%s\n", s);
}
@@ -144,7 +150,7 @@ char inchar() {
lval = val;
brkrd = 0;
reading = 1;
- read(0,&ch,1);
+ read(STDIN_FILENO,&ch,1);
reading = 0;
if (brkrd)
val = 0177;
@@ -204,17 +210,17 @@ char *instr() {
fflush(stdout);
#ifdef XENIX
while(rdchk(0)) {
- read(0,result+i,1);
+ read(STDIN_FILENO,result+i,1);
if (i++ == 78) break;
}
#else
#ifdef SIII
- while(read(2,result+i,1) == 1)
+ while(read(STDERR_FILENO,result+i,1) == 1)
if (i++ == 78) break;
#else
while(ioctl(0,FIONREAD,&l1), l1 > 0L) {
while(l1-- > 0L) {
- read(0,result+i,1);
+ read(STDIN_FILENO,result+i,1);
if (i++ == 78) goto out1;
}
}
@@ -358,14 +364,14 @@ inflush() {
#ifdef UNIX
#ifdef XENIX
- while(rdchk(0)) read(0,&val,1);
+ while(rdchk(0)) read(STDIN_FILENO,&val,1);
#else
#ifdef SIII
- while(read(2,&val,1));
+ while(read(STDERR_FILENO,&val,1));
#else
long l1;
ioctl (0, FIONREAD, &l1);
- while(l1-- > 0L) read(0,&val,1);
+ while(l1-- > 0L) read(STDIN_FILENO,&val,1);
#endif
#endif
#endif
diff --git a/usr.sbin/pcvt/vttest/main.c b/usr.sbin/pcvt/vttest/main.c
index 341de73..4093c57 100644
--- a/usr.sbin/pcvt/vttest/main.c
+++ b/usr.sbin/pcvt/vttest/main.c
@@ -93,8 +93,8 @@ main() {
#ifdef UNIX
initterminal(setjmp(intrenv));
- signal(SIGINT, onbrk);
- signal(SIGTERM, onterm);
+ signal(SIGINT, (void *)onbrk);
+ signal(SIGTERM, (void *)onterm);
reading = 0;
#else
initterminal(0);
@@ -1914,7 +1914,7 @@ bye () {
#ifdef UNIX
onbrk() {
- signal(SIGINT, onbrk);
+ signal(SIGINT, (void *)onbrk);
if (reading)
brkrd = 1;
else
@@ -1922,7 +1922,7 @@ onbrk() {
}
onterm() {
- signal(SIGTERM, onterm);
+ signal(SIGTERM, (void *)onterm);
longjmp(intrenv, 1);
}
#endif
@@ -1939,7 +1939,7 @@ readnl() {
fflush(stdout);
brkrd = 0;
reading = 1;
- do { read(0,&ch,1); } while(ch != '\n' && !brkrd);
+ do { read(STDIN_FILENO,&ch,1); } while(ch != '\n' && !brkrd);
if (brkrd)
kill(getpid(), SIGTERM);
reading = 0;
OpenPOWER on IntegriCloud