-/* Copyright (c) 1979 Regents of the University of California */
+/* Copyright (c) 1980 Regents of the University of California */
+static char *sccsid = "@(#)ex_put.c 6.4 %G%";
#include "ex.h"
#include "ex_tty.h"
#include "ex_vis.h"
{
putpad(VS);
putpad(KS);
- if (!value(MESG))
- chmod(ttynbuf, 0611); /* 11 = urgent only allowed */
+ if (!value(MESG)) {
+ if (ttynbuf[0] == 0) {
+ register char *tn;
+ if ((tn=ttyname(2)) == NULL &&
+ (tn=ttyname(1)) == NULL &&
+ (tn=ttyname(0)) == NULL)
+ ttynbuf[0] = 1;
+ else
+ strcpy(ttynbuf, tn);
+ }
+ if (ttynbuf[0] != 1) {
+ struct stat sbuf;
+ stat(ttynbuf, &sbuf);
+ ttymesg = sbuf.st_mode & 0777;
+ chmod(ttynbuf,
+#ifdef UCBV7
+ /*
+ * This applies to the UCB V7 Pdp-11 system with the
+ * -u write option only.
+ */
+ 0611 /* 11 = urgent only allowed */
+#else
+ 0600
+#endif
+ );
+ }
+ }
}
/*
gTTY(i)
int i;
{
- char *tn;
- struct stat sbuf;
#ifndef USG3TTY
ignore(gtty(i, &tty));
ioctl(i, TIOCGETC, &ottyc);
nttyc = ottyc;
# endif
-# ifdef TIOCLGET
+# ifdef TIOCGLTC
ioctl(i, TIOCGLTC, &olttyc);
nlttyc = olttyc;
# endif
#else
ioctl(i, TCGETA, &tty);
#endif
- if ((tn=ttyname(0)) == NULL && (tn=ttyname(1)) == NULL && (tn=ttyname(2)) == NULL)
- tn = "/dev/tty";
- strcpy(ttynbuf, tn);
- stat(ttynbuf, &sbuf);
- ttymesg = sbuf.st_mode & 0777;
}
/*
/* Update the other random chars while we're at it. */
ioctl(i, TIOCSETC, &nttyc);
# endif
-# ifdef TIOCLGET
+# ifdef TIOCSLTC
ioctl(i, TIOCSLTC, &nlttyc);
# endif
putchar(Outchar != termchar ? ' ' : '\n');
}
-
-#ifdef TIOCLGET
-/*
- * We have just gotten a susp. Suspend and prepare to resume.
- */
-onsusp()
-{
- ttymode f;
-
- f = setty(normf);
- vnfl();
- putpad(TE);
- flush();
-
- signal(SIGTSTP, SIG_DFL);
- kill(0, SIGTSTP);
-
- /* the pc stops here */
-
- signal(SIGTSTP, onsusp);
- vcontin(0);
- setty(f);
- if (!inopen)
- error(0);
- else {
- if (vcnt < 0) {
- vcnt = -vcnt;
- if (state == VISUAL)
- vclear();
- else if (state == CRTOPEN)
- vcnt = 0;
- }
- vdirty(0, LINES);
- vrepaint(cursor);
- }
-}