SCCS-vsn: usr.bin/ex/ex.h 7.9
SCCS-vsn: usr.bin/ex/ex_cmds.c 7.12
SCCS-vsn: usr.bin/ex/ex_cmds2.c 7.6
SCCS-vsn: usr.bin/ex/ex_cmdsub.c 7.9
SCCS-vsn: usr.bin/ex/ex_get.c 7.8
SCCS-vsn: usr.bin/ex/ex_put.c 7.11
SCCS-vsn: usr.bin/ex/ex_tty.c 7.12
SCCS-vsn: usr.bin/ex/ex_vget.c 6.10
SCCS-vsn: usr.bin/ex/ex_vmain.c 7.9
SCCS-vsn: usr.bin/ex/ex_voper.c 7.6
SCCS-vsn: usr.bin/ex/ex_vops2.c 6.10
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)ex.h 7.8 (Berkeley) %G%
+ * @(#)ex.h 7.9 (Berkeley) %G%
#ifndef vms
#undef CTRL
#endif
#ifndef vms
#undef CTRL
#endif
-#define CTRL(c) ('c' & 037)
-#define NL CTRL(j)
-#define CR CTRL(m)
+#define CTRL(c) (c & 037)
+#define NL CTRL('j')
+#define CR CTRL('m')
#define DELETE 0177 /* See also ATTN, QUIT in ex_tune.h */
#define ESCAPE 033
#define DELETE 0177 /* See also ATTN, QUIT in ex_tune.h */
#define ESCAPE 033
-static char *sccsid = "@(#)ex_cmds.c 7.11 (Berkeley) %G%";
+static char *sccsid = "@(#)ex_cmds.c 7.12 (Berkeley) %G%";
#endif not lint
#include "ex.h"
#endif not lint
#include "ex.h"
* the set of available commands here to save work below.
*/
if (inopen) {
* the set of available commands here to save work below.
*/
if (inopen) {
- if (c=='\n' || c=='\r' || c==CTRL(d) || c==EOF) {
+ if (c=='\n' || c=='\r' || c==CTRL('d') || c==EOF) {
if (addr2)
dot = addr2;
if (c == EOF)
if (addr2)
dot = addr2;
if (c == EOF)
notempty();
if (addr2 == 0) {
if (UP != NOSTR && c == '\n' && !inglobal)
notempty();
if (addr2 == 0) {
if (UP != NOSTR && c == '\n' && !inglobal)
if (inglobal)
addr1 = addr2 = dot;
else {
if (inglobal)
addr1 = addr2 = dot;
else {
if (seensemi)
addr1 = addr2;
getline(*addr1);
if (seensemi)
addr1 = addr2;
getline(*addr1);
flush1();
destline--;
if (hadpr)
flush1();
destline--;
if (hadpr)
case EOF:
if (exitoneof) {
if (addr2 != 0)
case EOF:
if (exitoneof) {
if (addr2 != 0)
-static char *sccsid = "@(#)ex_cmds2.c 7.5 (Berkeley) %G%";
+static char *sccsid = "@(#)ex_cmds2.c 7.6 (Berkeley) %G%";
#endif not lint
#include "ex.h"
#endif not lint
#include "ex.h"
* Gobble ^Q/^S since the tty driver should be eating
* them (as far as the user can see)
*/
* Gobble ^Q/^S since the tty driver should be eating
* them (as far as the user can see)
*/
- while (peekkey() == CTRL(Q) || peekkey() == CTRL(S))
+ while (peekkey() == CTRL('Q') || peekkey() == CTRL('S'))
ignore(getkey());
#endif
if(getkey() == ':') {
ignore(getkey());
#endif
if(getkey() == ':') {
-static char *sccsid = "@(#)ex_cmdsub.c 7.8 (Berkeley) %G%";
+static char *sccsid = "@(#)ex_cmdsub.c 7.9 (Berkeley) %G%";
#endif not lint
#include "ex.h"
#endif not lint
#include "ex.h"
ignore(skipwh());
for (p=lhs; ; ) {
c = ex_getchar();
ignore(skipwh());
for (p=lhs; ; ) {
c = ex_getchar();
c = ex_getchar();
} else if (!un && any(c, " \t")) {
/* End of lhs */
c = ex_getchar();
} else if (!un && any(c, " \t")) {
/* End of lhs */
error("Missing rhs");
for (p=rhs; ; ) {
c = ex_getchar();
error("Missing rhs");
for (p=rhs; ; ) {
c = ex_getchar();
c = ex_getchar();
} else if (endcmd(c) && c!='"') {
ungetchar(c);
c = ex_getchar();
} else if (endcmd(c) && c!='"') {
ungetchar(c);
-static char *sccsid = "@(#)ex_get.c 7.7 (Berkeley) %G%";
+static char *sccsid = "@(#)ex_get.c 7.8 (Berkeley) %G%";
#endif not lint
#include "ex.h"
#endif not lint
#include "ex.h"
- while (!globp && c == CTRL(d));
+ while (!globp && c == CTRL('d'));
return (c);
c &= TRIM;
if (!inopen)
return (c);
c &= TRIM;
if (!inopen)
- if (!globp && c == CTRL(d))
+ if (!globp && c == CTRL('d'))
setlastchar('\n');
else if (junk(c)) {
checkjunk(c);
setlastchar('\n');
else if (junk(c)) {
checkjunk(c);
if (c < 0)
return (lastc = EOF);
if (c == 0 || inline[c-1] != '\n')
if (c < 0)
return (lastc = EOF);
if (c == 0 || inline[c-1] != '\n')
+ inline[c++] = CTRL('d');
if (inline[c-1] == '\n')
noteinp();
inline[c] = 0;
if (inline[c-1] == '\n')
noteinp();
inline[c] = 0;
lastin = lindent(dot + 1);
#endif
tab(lastin + offset);
lastin = lindent(dot + 1);
#endif
tab(lastin + offset);
- while ((c = getcd()) == CTRL(d)) {
+ while ((c = getcd()) == CTRL('d')) {
if (lastin == 0 && isatty(0) == -1) {
holdcm = 0;
return (EOF);
if (lastin == 0 && isatty(0) == -1) {
holdcm = 0;
return (EOF);
case '^':
case '0':
ch = getcd();
case '^':
case '0':
ch = getcd();
if (c == '0')
lastin = 0;
if (!OS) {
if (c == '0')
lastin = 0;
if (!OS) {
-static char *sccsid = "@(#)ex_put.c 7.10 (Berkeley) %G%";
+static char *sccsid = "@(#)ex_put.c 7.11 (Berkeley) %G%";
#endif not lint
#include "ex.h"
#endif not lint
#include "ex.h"
ttcharoff()
{
nttyc.t_quitc = '\377';
ttcharoff()
{
nttyc.t_quitc = '\377';
- if (nttyc.t_startc != CTRL(q))
+ if (nttyc.t_startc != CTRL('q'))
- if (nttyc.t_stopc != CTRL(s))
+ if (nttyc.t_stopc != CTRL('s'))
nttyc.t_stopc = '\377';
# ifdef TIOCLGET
nlttyc.t_suspc = '\377'; /* ^Z */
nttyc.t_stopc = '\377';
# ifdef TIOCLGET
nlttyc.t_suspc = '\377'; /* ^Z */
* their start/stop chars. As long as they can't we can't get
* into trouble so we just leave them alone.
*/
* their start/stop chars. As long as they can't we can't get
* into trouble so we just leave them alone.
*/
- if (tty.c_cc[VSTART] != CTRL(q))
+ if (tty.c_cc[VSTART] != CTRL('q'))
tty.c_cc[VSTART] = '\377';
tty.c_cc[VSTART] = '\377';
- if (tty.c_cc[VSTOP] != CTRL(s))
+ if (tty.c_cc[VSTOP] != CTRL('s'))
tty.c_cc[VSTOP] = '\377';
# endif
}
tty.c_cc[VSTOP] = '\377';
# endif
}
-static char *sccsid = "@(#)ex_tty.c 7.11 (Berkeley) %G%";
+static char *sccsid = "@(#)ex_tty.c 7.12 (Berkeley) %G%";
#endif not lint
#include "ex.h"
#endif not lint
#include "ex.h"
if (ldisc == NTTYDISC) {
sc[0] = olttyc.t_suspc;
sc[1] = 0;
if (ldisc == NTTYDISC) {
sc[0] = olttyc.t_suspc;
sc[1] = 0;
- if (olttyc.t_suspc == CTRL(z)) {
+ if (olttyc.t_suspc == CTRL('z')) {
for (i=0; i<=4; i++)
if (arrows[i].cap &&
for (i=0; i<=4; i++)
if (arrows[i].cap &&
- arrows[i].cap[0] == CTRL(z))
+ arrows[i].cap[0] == CTRL('z'))
addmac(sc, (char *) NULL,
(char *) NULL, arrows);
} else
addmac(sc, (char *) NULL,
(char *) NULL, arrows);
} else
-static char sccsid[] = "@(#)ex_vget.c 6.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)ex_vget.c 6.10 (Berkeley) %G%";
#endif not lint
#include "ex.h"
#endif not lint
#include "ex.h"
Peek2key = 0;
break;
case 'q': /* f2 -> ^C */
Peek2key = 0;
break;
case 'q': /* f2 -> ^C */
Peek2key = 0;
break;
case 'p': /* f1 -> esc */
Peek2key = 0;
break;
case 'p': /* f1 -> esc */
c = getkey();
switch (c) {
c = getkey();
switch (c) {
- case CTRL(v):
- case CTRL(q):
+ case CTRL('v'):
+ case CTRL('q'):
c = getkey();
return (c);
c = getkey();
return (c);
ex_putchar('\n');
vscrap();
Pline = OP;
ex_putchar('\n');
vscrap();
Pline = OP;
- if (Peek_key != ATTN && Peek_key != QUIT && Peek_key != CTRL(h)) {
+ if (Peek_key != ATTN && Peek_key != QUIT && Peek_key != CTRL('h')) {
cursor = sc;
vclreol();
return (0);
}
blewit:
cursor = sc;
vclreol();
return (0);
}
blewit:
- OPeek = Peek_key==CTRL(h) ? 0 : Peek_key; Peek_key = 0;
+ OPeek = Peek_key==CTRL('h') ? 0 : Peek_key; Peek_key = 0;
splitw = 0;
vclean();
vshow(dot, NOLINE);
splitw = 0;
vclean();
vshow(dot, NOLINE);
if (VB)
vputp(VB, 0);
else
if (VB)
vputp(VB, 0);
else
-static char *sccsid = "@(#)ex_vmain.c 7.8 (Berkeley) %G%";
+static char *sccsid = "@(#)ex_vmain.c 7.9 (Berkeley) %G%";
#endif not lint
#include "ex.h"
#endif not lint
#include "ex.h"
* will probably foul this up, but nobody has
* one of them.
*/
* will probably foul this up, but nobody has
* one of them.
*/
- case CTRL(l):
- case CTRL(r):
- if (c == CTRL(l) || (KR && *KR==CTRL(l))) {
+ case CTRL('l'):
+ case CTRL('r'):
+ if (c == CTRL('l') || (KR && *KR==CTRL('l'))) {
vclear();
vdirty(0, vcnt);
}
vclear();
vdirty(0, vcnt);
}
* redrawn almost as it was. In this case
* one should simply move the cursor.
*/
* redrawn almost as it was. In this case
* one should simply move the cursor.
*/
if (hadcnt)
ex_vSCROLL = cnt;
cnt = ex_vSCROLL;
if (hadcnt)
ex_vSCROLL = cnt;
cnt = ex_vSCROLL;
/*
* ^D Scroll down. Like scroll up.
*/
/*
* ^D Scroll down. Like scroll up.
*/
#ifdef TRACE
if (trace)
fprintf(trace, "before vdown in ^D, dot=%d, wdot=%d, dol=%d\n", lineno(dot), lineno(wdot), lineno(dol));
#ifdef TRACE
if (trace)
fprintf(trace, "before vdown in ^D, dot=%d, wdot=%d, dol=%d\n", lineno(dot), lineno(wdot), lineno(dol));
* ^E Glitch the screen down (one) line.
* Cursor left on same line in file.
*/
* ^E Glitch the screen down (one) line.
* Cursor left on same line in file.
*/
if (state != VISUAL)
continue;
if (!hadcnt)
if (state != VISUAL)
continue;
if (!hadcnt)
/*
* ^Y Like ^E but up
*/
/*
* ^Y Like ^E but up
*/
if (state != VISUAL)
continue;
if (!hadcnt)
if (state != VISUAL)
continue;
if (!hadcnt)
* ^F Window forwards, with 2 lines of continuity.
* Count repeats.
*/
* ^F Window forwards, with 2 lines of continuity.
* Count repeats.
*/
vsave();
if (vcnt > 2) {
addr = dot + (vcnt - vcline) - 2 + (cnt-1)*basWLINES;
vsave();
if (vcnt > 2) {
addr = dot + (vcnt - vcline) - 2 + (cnt-1)*basWLINES;
* ^B Window backwards, with 2 lines of continuity.
* Inverse of ^F.
*/
* ^B Window backwards, with 2 lines of continuity.
* Inverse of ^F.
*/
vsave();
if (one + vcline != dot && vcnt > 2) {
addr = dot - vcline + 2 - (cnt-1)*basWLINES;
vsave();
if (one + vcline != dot && vcnt > 2) {
addr = dot - vcline + 2 - (cnt-1)*basWLINES;
* Like a :e #, and thus can be used after a
* "No Write" diagnostic.
*/
* Like a :e #, and thus can be used after a
* "No Write" diagnostic.
*/
forbid (hadcnt);
vsave();
ckaw();
forbid (hadcnt);
vsave();
ckaw();
* ^] Takes word after cursor as tag, and then does
* tag command. Read ``go right to''.
*/
* ^] Takes word after cursor as tag, and then does
* tag command. Read ``go right to''.
*/
grabtag();
oglobp = globp;
globp = "tag";
grabtag();
oglobp = globp;
globp = "tag";
*
* BUG: Was ^S but doesn't work in cbreak mode
*/
*
* BUG: Was ^S but doesn't work in cbreak mode
*/
oglobp = globp;
globp = "file";
gogo:
oglobp = globp;
globp = "file";
gogo:
* to shell. Only works with Berkeley/IIASA process
* control in kernel.
*/
* to shell. Only works with Berkeley/IIASA process
* control in kernel.
*/
forbid(dosusp == 0 || !ldisc);
vsave();
oglobp = globp;
forbid(dosusp == 0 || !ldisc);
vsave();
oglobp = globp;
-static char *sccsid = "@(#)ex_voper.c 7.5 (Berkeley) %G%";
+static char *sccsid = "@(#)ex_voper.c 7.6 (Berkeley) %G%";
#endif not lint
#include "ex.h"
#endif not lint
#include "ex.h"
* ^H Back a character.
*/
case 'h':
* ^H Back a character.
*/
case 'h':
dir = -1;
/* fall into ... */
dir = -1;
/* fall into ... */
* console of the VAX since it puts console in LSI mode.
*/
case 'k':
* console of the VAX since it puts console in LSI mode.
*/
case 'k':
wdot = dot - cnt;
if (vmoving == 0)
vmoving = 1, vmovcol = column(cursor);
wdot = dot - cnt;
if (vmoving == 0)
vmoving = 1, vmovcol = column(cursor);
*
* LF Linefeed is a convenient synonym for ^N.
*/
*
* LF Linefeed is a convenient synonym for ^N.
*/
case 'j':
case NL:
wdot = dot + cnt;
case 'j':
case NL:
wdot = dot + cnt;
-static char sccsid[] = "@(#)ex_vops2.c 6.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)ex_vops2.c 6.10 (Berkeley) %G%";
#endif not lint
#include "ex.h"
#endif not lint
#include "ex.h"
*/
#ifndef USG3TTY
if (c == tty.sg_erase)
*/
#ifndef USG3TTY
if (c == tty.sg_erase)
else if (c == tty.sg_kill)
c = -1;
#else
if (c == tty.c_cc[VERASE])
else if (c == tty.sg_kill)
c = -1;
#else
if (c == tty.c_cc[VERASE])
else if (c == tty.c_cc[VKILL])
c = -1;
#endif
else if (c == tty.c_cc[VKILL])
c = -1;
#endif
* This is hard because stuff has
* already been saved for repeat.
*/
* This is hard because stuff has
* already been saved for repeat.
*/
bakchar:
cp = gcursor - 1;
if (cp < ogcursor) {
bakchar:
cp = gcursor - 1;
if (cp < ogcursor) {
/*
* ^W Back up a white/non-white word.
*/
/*
* ^W Back up a white/non-white word.
*/
wdkind = 1;
for (cp = gcursor; cp > ogcursor && isspace(cp[-1]); cp--)
continue;
wdkind = 1;
for (cp = gcursor; cp > ogcursor && isspace(cp[-1]); cp--)
continue;
- case CTRL(q):
- case CTRL(v):
+ case CTRL('q'):
+ case CTRL('v'):
x = destcol, y = destline;
ex_putchar('^');
vgoto(y, x);
x = destcol, y = destline;
ex_putchar('^');
vgoto(y, x);
* Unless in repeat where this means these
* were superquoted in.
*/
* Unless in repeat where this means these
* were superquoted in.
*/
- case CTRL(d):
- case CTRL(t):
+ case CTRL('d'):
+ case CTRL('t'):
if (vglobp)
goto def;
/* fall into ... */
if (vglobp)
goto def;
/* fall into ... */
/*
* ^D|QUOTE Is a backtab (in a repeated command).
*/
/*
* ^D|QUOTE Is a backtab (in a repeated command).
*/
+ case CTRL('d') | QUOTE:
*gcursor = 0;
cp = vpastwh(genbuf);
c = whitecnt(genbuf);
*gcursor = 0;
cp = vpastwh(genbuf);
c = whitecnt(genbuf);
/*
* ^t just generates new indent replacing
* current white space rounded up to soft
/*
* ^t just generates new indent replacing
* current white space rounded up to soft