Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/libexec/getty Pull up following revision(s) (requested by...
details: https://anonhg.NetBSD.org/src/rev/81db88452aa0
branches: netbsd-6
changeset: 774303:81db88452aa0
user: riz <riz%NetBSD.org@localhost>
date: Thu Jul 05 17:22:02 2012 +0000
description:
Pull up following revision(s) (requested by roy in ticket #391):
libexec/getty/main.c: revision 1.59
Don't attempt to parse a termcap/terminfo string ourselves;
always use tputs(3).
diffstat:
libexec/getty/main.c | 53 ++++++++-------------------------------------------
1 files changed, 9 insertions(+), 44 deletions(-)
diffs (98 lines):
diff -r 109f1220f2a4 -r 81db88452aa0 libexec/getty/main.c
--- a/libexec/getty/main.c Thu Jul 05 17:20:06 2012 +0000
+++ b/libexec/getty/main.c Thu Jul 05 17:22:02 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.58 2010/02/03 15:34:43 roy Exp $ */
+/* $NetBSD: main.c,v 1.58.8.1 2012/07/05 17:22:02 riz Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "from: @(#)main.c 8.1 (Berkeley) 6/20/93";
#else
-__RCSID("$NetBSD: main.c,v 1.58 2010/02/03 15:34:43 roy Exp $");
+__RCSID("$NetBSD: main.c,v 1.58.8.1 2012/07/05 17:22:02 riz Exp $");
#endif
#endif /* not lint */
@@ -173,11 +173,12 @@
static int getname(void);
static void oflush(void);
static void prompt(void);
-static void putchr(int);
+static int putchr(int);
static void putf(const char *);
-static void putpad(const char *);
static void xputs(const char *);
+#define putpad(s) tputs(s, 1, putchr)
+
int
main(int argc, char *argv[], char *envp[])
{
@@ -566,43 +567,6 @@
}
static void
-putpad(const char *s)
-{
- int pad = 0;
- speed_t ospd = cfgetospeed(&tmode);
-
- if (isdigit((unsigned char)*s)) {
- while (isdigit((unsigned char)*s)) {
- pad *= 10;
- pad += *s++ - '0';
- }
- pad *= 10;
- if (*s == '.' && isdigit((unsigned char)s[1])) {
- pad += s[1] - '0';
- s += 2;
- }
- }
-
- xputs(s);
- /*
- * If no delay needed, or output speed is
- * not comprehensible, then don't try to delay.
- */
- if (pad == 0)
- return;
-
- /*
- * Round up by a half a character frame, and then do the delay.
- * Too bad there are no user program accessible programmed delays.
- * Transmitting pad characters slows many terminals down and also
- * loads the system.
- */
- pad = (pad * ospd + 50000) / 100000;
- while (pad--)
- putchr(*PC);
-}
-
-static void
xputs(const char *s)
{
while (*s)
@@ -612,7 +576,7 @@
char outbuf[OBUFSIZ];
size_t obufcnt = 0;
-static void
+static int
putchr(int cc)
{
unsigned char c;
@@ -627,8 +591,9 @@
outbuf[obufcnt++] = c;
if (obufcnt >= OBUFSIZ)
oflush();
- } else
- (void)write(STDOUT_FILENO, &c, 1);
+ return 1;
+ }
+ return write(STDOUT_FILENO, &c, 1);
}
static void
- Prev by Date:
[src/netbsd-6]: src/doc Tickets 384, 385, 386, 387, 388, 389.
- Next by Date:
[src/netbsd-6]: src/lib Pull up following revision(s) (requested by manu in t...
- Previous by Thread:
[src/netbsd-6]: src/doc Tickets 384, 385, 386, 387, 388, 389.
- Next by Thread:
[src/netbsd-6]: src/lib Pull up following revision(s) (requested by manu in t...
- Indexes:
Home |
Main Index |
Thread Index |
Old Index