Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern - Fix more and more white space nits.
details: https://anonhg.NetBSD.org/src/rev/c1afa52960d8
branches: trunk
changeset: 526316:c1afa52960d8
user: enami <enami%NetBSD.org@localhost>
date: Thu May 02 13:38:57 2002 +0000
description:
- Fix more and more white space nits.
- ANSIfy the last K&R function definition in this file.
diffstat:
sys/kern/tty.c | 87 ++++++++++++++++++++++++++++------------------------------
1 files changed, 42 insertions(+), 45 deletions(-)
diffs (244 lines):
diff -r 6e14c6085cfb -r c1afa52960d8 sys/kern/tty.c
--- a/sys/kern/tty.c Thu May 02 13:31:43 2002 +0000
+++ b/sys/kern/tty.c Thu May 02 13:38:57 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.137 2002/04/20 06:04:35 simonb Exp $ */
+/* $NetBSD: tty.c,v 1.138 2002/05/02 13:38:57 enami Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1991, 1993
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.137 2002/04/20 06:04:35 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.138 2002/05/02 13:38:57 enami Exp $");
#include "opt_uconsole.h"
@@ -117,20 +117,20 @@
char const char_type[] = {
E|CC, O|CC, O|CC, E|CC, O|CC, E|CC, E|CC, O|CC, /* nul - bel */
O|BS, E|TB, E|NL, O|CC, E|VT, O|CR, O|CC, E|CC, /* bs - si */
- O|CC, E|CC, E|CC, O|CC, E|CC, O|CC, O|CC, E|CC, /* dle - etb */
- E|CC, O|CC, O|CC, E|CC, O|CC, E|CC, E|CC, O|CC, /* can - us */
- O|NO, E|NO, E|NO, O|NO, E|NO, O|NO, O|NO, E|NO, /* sp - ' */
- E|NO, O|NO, O|NO, E|NO, O|NO, E|NO, E|NO, O|NO, /* ( - / */
- E|NA, O|NA, O|NA, E|NA, O|NA, E|NA, E|NA, O|NA, /* 0 - 7 */
- O|NA, E|NA, E|NO, O|NO, E|NO, O|NO, O|NO, E|NO, /* 8 - ? */
- O|NO, E|NA, E|NA, O|NA, E|NA, O|NA, O|NA, E|NA, /* @ - G */
- E|NA, O|NA, O|NA, E|NA, O|NA, E|NA, E|NA, O|NA, /* H - O */
- E|NA, O|NA, O|NA, E|NA, O|NA, E|NA, E|NA, O|NA, /* P - W */
- O|NA, E|NA, E|NA, O|NO, E|NO, O|NO, O|NO, O|NA, /* X - _ */
- E|NO, O|NA, O|NA, E|NA, O|NA, E|NA, E|NA, O|NA, /* ` - g */
- O|NA, E|NA, E|NA, O|NA, E|NA, O|NA, O|NA, E|NA, /* h - o */
- O|NA, E|NA, E|NA, O|NA, E|NA, O|NA, O|NA, E|NA, /* p - w */
- E|NA, O|NA, O|NA, E|NO, O|NO, E|NO, E|NO, O|CC, /* x - del */
+ O|CC, E|CC, E|CC, O|CC, E|CC, O|CC, O|CC, E|CC, /* dle - etb */
+ E|CC, O|CC, O|CC, E|CC, O|CC, E|CC, E|CC, O|CC, /* can - us */
+ O|NO, E|NO, E|NO, O|NO, E|NO, O|NO, O|NO, E|NO, /* sp - ' */
+ E|NO, O|NO, O|NO, E|NO, O|NO, E|NO, E|NO, O|NO, /* ( - / */
+ E|NA, O|NA, O|NA, E|NA, O|NA, E|NA, E|NA, O|NA, /* 0 - 7 */
+ O|NA, E|NA, E|NO, O|NO, E|NO, O|NO, O|NO, E|NO, /* 8 - ? */
+ O|NO, E|NA, E|NA, O|NA, E|NA, O|NA, O|NA, E|NA, /* @ - G */
+ E|NA, O|NA, O|NA, E|NA, O|NA, E|NA, E|NA, O|NA, /* H - O */
+ E|NA, O|NA, O|NA, E|NA, O|NA, E|NA, E|NA, O|NA, /* P - W */
+ O|NA, E|NA, E|NA, O|NO, E|NO, O|NO, O|NO, O|NA, /* X - _ */
+ E|NO, O|NA, O|NA, E|NA, O|NA, E|NA, E|NA, O|NA, /* ` - g */
+ O|NA, E|NA, E|NA, O|NA, E|NA, O|NA, O|NA, E|NA, /* h - o */
+ O|NA, E|NA, E|NA, O|NA, E|NA, O|NA, O|NA, E|NA, /* p - w */
+ E|NA, O|NA, O|NA, E|NO, O|NO, E|NO, E|NO, O|CC, /* x - del */
/*
* Meta chars; should be settable per character set;
* for now, treat them all as normal characters.
@@ -202,8 +202,8 @@
* processes to close the tty first.
*/
while (ISSET(tp->t_state, TS_DIALOUT) ||
- (!ISSET(tp->t_state, TS_CARR_ON) &&
- !ISSET(tp->t_cflag, CLOCAL | MDMBUF))) {
+ (!ISSET(tp->t_state, TS_CARR_ON) &&
+ !ISSET(tp->t_cflag, CLOCAL | MDMBUF))) {
tp->t_wopen++;
error = ttysleep(tp, &tp->t_rawq,
TTIPRI | PCATCH, ttopen, 0);
@@ -218,7 +218,7 @@
* Don't allow a non-blocking non-dialout open if the
* device is already open for dialout.
*/
- if (ISSET(tp->t_state, TS_DIALOUT)) {
+ if (ISSET(tp->t_state, TS_DIALOUT)) {
splx(s);
return (EBUSY);
}
@@ -340,11 +340,9 @@
ttyflush(tp, FREAD | FWRITE);
pgsignal(tp->t_pgrp, SIGINT, 1);
return (0);
- }
- else if (ISSET(iflag, PARMRK))
+ } else if (ISSET(iflag, PARMRK))
goto parmrk;
- }
- else if ((ISSET(error, TTY_PE) && ISSET(iflag, INPCK)) ||
+ } else if ((ISSET(error, TTY_PE) && ISSET(iflag, INPCK)) ||
ISSET(error, TTY_FE)) {
if (ISSET(iflag, IGNPAR))
return (0);
@@ -353,12 +351,10 @@
(void)putc(0 | TTY_QUOTE, &tp->t_rawq);
(void)putc(c | TTY_QUOTE, &tp->t_rawq);
return (0);
- }
- else
+ } else
c = 0;
}
- }
- else if (c == 0377 &&
+ } else if (c == 0377 &&
ISSET(iflag, ISTRIP|IGNPAR|INPCK|PARMRK) == (INPCK|PARMRK)) {
/* "Escape" a valid character of '\377'. */
(void)putc(0377 | TTY_QUOTE, &tp->t_rawq);
@@ -518,7 +514,7 @@
* erase whitespace
*/
while ((c = unputc(&tp->t_rawq)) == ' ' ||
- c == '\t')
+ c == '\t')
ttyrub(c, tp);
if (c == -1)
goto endcase;
@@ -544,7 +540,7 @@
if (c == -1)
goto endcase;
} while (c != ' ' && c != '\t' &&
- (alt == 0 || ISALPHA(c) == ctype));
+ (alt == 0 || ISALPHA(c) == ctype));
(void)putc(c, &tp->t_rawq);
goto endcase;
}
@@ -831,7 +827,7 @@
*(int *)data = tp->t_linesw->l_no;
break;
case TIOCGLINED:
- (void)strncpy((char *)data, tp->t_linesw->l_name,
+ (void)strncpy((char *)data, tp->t_linesw->l_name,
TTLINEDNAMELEN - 1);
break;
case TIOCGWINSZ: /* get window size */
@@ -938,7 +934,7 @@
dev_t device;
/* Null terminate to prevent buffer overflow */
- name[TTLINEDNAMELEN - 1] = '\0';
+ name[TTLINEDNAMELEN - 1] = '\0';
lp = ttyldisc_lookup(name);
setldisc:
@@ -989,7 +985,7 @@
/* Session ctty vnode pointer set in vnode layer. */
if (!SESS_LEADER(p) ||
((p->p_session->s_ttyvp || tp->t_session) &&
- (tp->t_session != p->p_session)))
+ (tp->t_session != p->p_session)))
return (EPERM);
SESSHOLD(p->p_session);
tp->t_session = p->p_session;
@@ -1080,8 +1076,7 @@
* Wait for output to drain.
*/
int
-ttywait(tp)
- struct tty *tp;
+ttywait(struct tty *tp)
{
int error, s;
@@ -1241,7 +1236,8 @@
CLR(tp->t_state, TS_CARR_ON);
if (ISSET(tp->t_state, TS_ISOPEN) && !CONNECTED(tp)) {
if (tp->t_session && tp->t_session->s_leader)
- psignal(tp->t_session->s_leader, SIGHUP);
+ psignal(tp->t_session->s_leader,
+ SIGHUP);
ttyflush(tp, FREAD | FWRITE);
return (0);
}
@@ -1452,7 +1448,7 @@
pgsignal(tp->t_pgrp, SIGTSTP, 1);
if (first) {
error = ttysleep(tp, &lbolt,
- TTIPRI | PCATCH, ttybg, 0);
+ TTIPRI | PCATCH, ttybg, 0);
if (error)
break;
goto loop;
@@ -1485,7 +1481,7 @@
* the input queue has gone down.
*/
s = spltty();
- if (ISSET(tp->t_state, TS_TBLOCK) && tp->t_rawq.c_cc < TTYHOG/5) {
+ if (ISSET(tp->t_state, TS_TBLOCK) && tp->t_rawq.c_cc < TTYHOG / 5) {
if (ISSET(tp->t_iflag, IXOFF) &&
cc[VSTART] != _POSIX_VDISABLE &&
putc(cc[VSTART], &tp->t_outq) == 0) {
@@ -1851,7 +1847,7 @@
ISSET(tp->t_lflag, EXTPROC))
return;
if (((ISSET(tp->t_lflag, ECHOCTL) &&
- (ISSET(c, TTY_CHARMASK) <= 037 && c != '\t' && c != '\n')) ||
+ (ISSET(c, TTY_CHARMASK) <= 037 && c != '\t' && c != '\n')) ||
ISSET(c, TTY_CHARMASK) == 0177)) {
(void)ttyoutput('^', tp);
CLR(c, ~TTY_CHARMASK);
@@ -1884,7 +1880,7 @@
ttspeedtab(int speed, struct speedtab *table)
{
- for ( ; table->sp_speed != -1; table++)
+ for (; table->sp_speed != -1; table++)
if (table->sp_speed == speed)
return (table->sp_code);
return (-1);
@@ -1997,10 +1993,10 @@
*/
#define ISRUN(p) (((p)->p_stat == SRUN) || ((p)->p_stat == SIDL) || \
((p)->p_stat == SONPROC))
-#define TESTAB(a, b) ((a)<<1 | (b))
-#define ONLYA 2
-#define ONLYB 1
-#define BOTH 3
+#define TESTAB(a, b) ((a)<<1 | (b))
+#define ONLYA 2
+#define ONLYB 1
+#define BOTH 3
static int
proc_compare(struct proc *p1, struct proc *p2)
@@ -2035,7 +2031,7 @@
case ONLYB:
return (0);
case BOTH:
- return (p2->p_pid > p1->p_pid); /* tie - return highest pid */
+ return (p2->p_pid > p1->p_pid); /* tie - return highest pid */
}
/*
* pick the one with the smallest sleep time
@@ -2100,6 +2096,7 @@
void
tty_init(void)
{
+
ttyldisc_init();
TAILQ_INIT(&ttylist);
@@ -2163,7 +2160,7 @@
clalloc(&tp->t_outq, 1024, 0);
/* Set default line discipline. */
tp->t_linesw = linesw[0];
- return(tp);
+ return (tp);
}
/*
Home |
Main Index |
Thread Index |
Old Index