* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char *sccsid
= "@(#)ex_get.c 7.7 (Berkeley) %G%";
* Input routines for command mode.
* Since we translate the end of reads into the implied ^D's
* we have different flavors of routines which do/don't return such.
while (!globp
&& c
== CTRL(d
));
if (!globp
&& c
== CTRL(d
))
static char inline[BUFSIZ
];
c
= read(0, inline, sizeof inline - 4);
if (c
== 0 || inline[c
-1] != '\n')
c
= read(0, inline, sizeof inline - 1);
* Input routine for insert/append/change in command mode.
* Most work here is in handling autoindent.
register char *cp
= genbuf
;
int offset
= Pline
== numbline
? 8 : 0;
if (intty
&& !inglobal
) {
ex_printf(" %4d ", lineDOT() + 1);
if (value(AUTOINDENT
) ^ aiflag
) {
lastin
= lindent(dot
+ 1);
while ((c
= getcd()) == CTRL(d
)) {
if (lastin
== 0 && isatty(0) == -1) {
lastin
= backtab(lastin
);
ex_putchar('\b' | QUOTE
);
ex_putchar('\b' | QUOTE
);
if (peekchar() == '\n') {
while (c
!= EOF
&& c
!= '\n') {
if (cp
> &genbuf
[LBSIZE
- 2])
error("Input line too long");
if ((value(AUTOINDENT
) ^ aiflag
) && hadup
== 0 && intty
&& !inglobal
) {
lastin
= c
= smunch(lastin
, genbuf
);
for (c
= lastin
; c
>= value(TABSTOP
); c
-= value(TABSTOP
))
if (linebuf
[0] == '.' && linebuf
[1] == 0)
* Hard thing here is that in command mode some of the indent
* is only implicit, so we must seed the column counter.
* This should really be done differently so as to use the whitecnt routine
* and also to hack indenting for LISP.
col
+= value(TABSTOP
) - (col
% value(TABSTOP
));
char *cntrlhm
= "^H discarded\n";
if (junkbs
== 0 && c
== '\b') {
getline(*addr
), lastin
= smunch(0, linebuf
);