projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add define for Kirk Smith's USR Courier driver. Change default baud
[unix-history]
/
usr
/
src
/
usr.bin
/
window
/
wwpty.c
diff --git
a/usr/src/usr.bin/window/wwpty.c
b/usr/src/usr.bin/window/wwpty.c
index
81bd6f3
..
0919d52
100644
(file)
--- a/
usr/src/usr.bin/window/wwpty.c
+++ b/
usr/src/usr.bin/window/wwpty.c
@@
-1,9
+1,20
@@
#ifndef lint
#ifndef lint
-static char
*sccsid = "@(#)wwpty.c 3.7 84/03/02
";
+static char
sccsid[] = "@(#)wwpty.c 3.11 %G%
";
#endif
#endif
+/*
+ * Copyright (c) 1983 Regents of the University of California,
+ * All rights reserved. Redistribution permitted subject to
+ * the terms of the Berkeley Software License Agreement.
+ */
+
#include "ww.h"
#include "ww.h"
+/*
+ * To satisfy Chris, we allocate pty's backwards, and if
+ * there are more than the ptyp's (i.e. the ptyq's)
+ * on the machine, we don't use the p's.
+ */
wwgetpty(w)
register struct ww *w;
{
wwgetpty(w)
register struct ww *w;
{
@@
-11,19
+22,24
@@
register struct ww *w;
register int i;
int tty;
int on = 1;
register int i;
int tty;
int on = 1;
+ char hasq = 0;
#define PTY "/dev/XtyXX"
#define _PT 5
#define _PQRS 8
#define _0_9 9
(void) strcpy(w->ww_ttyname, PTY);
#define PTY "/dev/XtyXX"
#define _PT 5
#define _PQRS 8
#define _0_9 9
(void) strcpy(w->ww_ttyname, PTY);
- for (c = '
p'; c <= 's'; c++
) {
+ for (c = '
s'; c >= 'p'; c--
) {
w->ww_ttyname[_PT] = 'p';
w->ww_ttyname[_PQRS] = c;
w->ww_ttyname[_0_9] = '0';
if (access(w->ww_ttyname, 0) < 0)
w->ww_ttyname[_PT] = 'p';
w->ww_ttyname[_PQRS] = c;
w->ww_ttyname[_0_9] = '0';
if (access(w->ww_ttyname, 0) < 0)
+ continue;
+ if (c != 'p')
+ hasq = 1;
+ else if (hasq)
break;
break;
- for (i =
0; i < 16; i++
) {
+ for (i =
15; i >= 0; i--
) {
w->ww_ttyname[_PT] = 'p';
w->ww_ttyname[_0_9] = "0123456789abcdef"[i];
if ((w->ww_pty = open(w->ww_ttyname, 2)) < 0)
w->ww_ttyname[_PT] = 'p';
w->ww_ttyname[_0_9] = "0123456789abcdef"[i];
if ((w->ww_pty = open(w->ww_ttyname, 2)) < 0)