17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate * with the License.
87c478bd9Sstevel@tonic-gate *
97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate * and limitations under the License.
137c478bd9Sstevel@tonic-gate *
147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate *
207c478bd9Sstevel@tonic-gate * CDDL HEADER END
217c478bd9Sstevel@tonic-gate */
22*f6db9f27Scf46844 /*
23*f6db9f27Scf46844 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24*f6db9f27Scf46844 * Use is subject to license terms.
25*f6db9f27Scf46844 */
26*f6db9f27Scf46844
277c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
287c478bd9Sstevel@tonic-gate /* All Rights Reserved */
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gate /* Copyright (c) 1981 Regents of the University of California */
327c478bd9Sstevel@tonic-gate
33*f6db9f27Scf46844 #pragma ident "%Z%%M% %I% %E% SMI"
347c478bd9Sstevel@tonic-gate #include "ex.h"
357c478bd9Sstevel@tonic-gate #include "ex_re.h"
367c478bd9Sstevel@tonic-gate
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate * Routines for address parsing and assignment and checking of address bounds
397c478bd9Sstevel@tonic-gate * in command mode. The routine address is called from ex_cmds.c
407c478bd9Sstevel@tonic-gate * to parse each component of a command (terminated by , ; or the beginning
417c478bd9Sstevel@tonic-gate * of the command itself. It is also called by the scanning routine
427c478bd9Sstevel@tonic-gate * in ex_voperate.c from within open/visual.
437c478bd9Sstevel@tonic-gate *
447c478bd9Sstevel@tonic-gate * Other routines here manipulate the externals addr1 and addr2.
457c478bd9Sstevel@tonic-gate * These are the first and last lines for the current command.
467c478bd9Sstevel@tonic-gate *
477c478bd9Sstevel@tonic-gate * The variable bigmove remembers whether a non-local glitch of . was
487c478bd9Sstevel@tonic-gate * involved in an address expression, so we can set the previous context
497c478bd9Sstevel@tonic-gate * mark '' when such a motion occurs.
507c478bd9Sstevel@tonic-gate */
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gate static bool bigmove;
537c478bd9Sstevel@tonic-gate
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate * Set up addr1 and addr2 for commands whose default address is dot.
567c478bd9Sstevel@tonic-gate */
57*f6db9f27Scf46844 void
setdot(void)58*f6db9f27Scf46844 setdot(void)
597c478bd9Sstevel@tonic-gate {
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate setdot1();
627c478bd9Sstevel@tonic-gate if (bigmove)
637c478bd9Sstevel@tonic-gate markDOT();
647c478bd9Sstevel@tonic-gate }
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gate /*
677c478bd9Sstevel@tonic-gate * Call setdot1 to set up default addresses without ever
687c478bd9Sstevel@tonic-gate * setting the previous context mark.
697c478bd9Sstevel@tonic-gate */
70*f6db9f27Scf46844 void
setdot1(void)71*f6db9f27Scf46844 setdot1(void)
727c478bd9Sstevel@tonic-gate {
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate if (addr2 == 0)
757c478bd9Sstevel@tonic-gate addr1 = addr2 = dot;
767c478bd9Sstevel@tonic-gate if (addr1 > addr2) {
777c478bd9Sstevel@tonic-gate notempty();
787c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
797c478bd9Sstevel@tonic-gate gettext("Addr1 > addr2") :
807c478bd9Sstevel@tonic-gate gettext("First address exceeds second"));
817c478bd9Sstevel@tonic-gate }
827c478bd9Sstevel@tonic-gate }
837c478bd9Sstevel@tonic-gate
847c478bd9Sstevel@tonic-gate /*
857c478bd9Sstevel@tonic-gate * Ex allows you to say
867c478bd9Sstevel@tonic-gate * delete 5
877c478bd9Sstevel@tonic-gate * to delete 5 lines, etc.
887c478bd9Sstevel@tonic-gate * Such nonsense is implemented by setcount.
897c478bd9Sstevel@tonic-gate */
90*f6db9f27Scf46844 void
setcount(void)91*f6db9f27Scf46844 setcount(void)
927c478bd9Sstevel@tonic-gate {
93*f6db9f27Scf46844 int cnt;
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gate pastwh();
967c478bd9Sstevel@tonic-gate if (!isdigit(peekchar())) {
977c478bd9Sstevel@tonic-gate setdot();
987c478bd9Sstevel@tonic-gate return;
997c478bd9Sstevel@tonic-gate }
1007c478bd9Sstevel@tonic-gate addr1 = addr2;
1017c478bd9Sstevel@tonic-gate setdot();
1027c478bd9Sstevel@tonic-gate cnt = getnum();
1037c478bd9Sstevel@tonic-gate if (cnt <= 0)
1047c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
1057c478bd9Sstevel@tonic-gate gettext("Bad count") :
1067c478bd9Sstevel@tonic-gate gettext("Nonzero count required"));
1077c478bd9Sstevel@tonic-gate addr2 += cnt - 1;
1087c478bd9Sstevel@tonic-gate if (addr2 > dol)
1097c478bd9Sstevel@tonic-gate addr2 = dol;
1107c478bd9Sstevel@tonic-gate nonzero();
1117c478bd9Sstevel@tonic-gate }
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gate #ifdef XPG4
1147c478bd9Sstevel@tonic-gate /*
1157c478bd9Sstevel@tonic-gate * setcount2(): a version of setcount() which sets addr2 based on addr1 + cnt.
1167c478bd9Sstevel@tonic-gate * description:
1177c478bd9Sstevel@tonic-gate * this routine is responsible for setting addr1 (possibly) and addr2
1187c478bd9Sstevel@tonic-gate * (always); using the [count] to compute addr2.
1197c478bd9Sstevel@tonic-gate *
1207c478bd9Sstevel@tonic-gate * this is similar setcount(), but it differs in that setcount() sets
1217c478bd9Sstevel@tonic-gate * addr1 based upon addr2; here we set addr2 based upon addr1 and the
1227c478bd9Sstevel@tonic-gate * [count].
1237c478bd9Sstevel@tonic-gate *
1247c478bd9Sstevel@tonic-gate * the reason for this is because some commands, of the form:
1257c478bd9Sstevel@tonic-gate * [range] command [count]
1267c478bd9Sstevel@tonic-gate * will use [count] to modify the range. E.g.:
1277c478bd9Sstevel@tonic-gate * change, delete, join, list, yank.
1287c478bd9Sstevel@tonic-gate */
129*f6db9f27Scf46844 void
setcount2(void)130*f6db9f27Scf46844 setcount2(void)
1317c478bd9Sstevel@tonic-gate {
132*f6db9f27Scf46844 int cnt;
1337c478bd9Sstevel@tonic-gate
1347c478bd9Sstevel@tonic-gate pastwh();
1357c478bd9Sstevel@tonic-gate if (!isdigit(peekchar())) {
1367c478bd9Sstevel@tonic-gate setdot();
1377c478bd9Sstevel@tonic-gate return;
1387c478bd9Sstevel@tonic-gate }
1397c478bd9Sstevel@tonic-gate setdot();
1407c478bd9Sstevel@tonic-gate cnt = getnum();
1417c478bd9Sstevel@tonic-gate if (cnt <= 0)
1427c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
1437c478bd9Sstevel@tonic-gate gettext("Bad count") :
1447c478bd9Sstevel@tonic-gate gettext("Nonzero count required"));
1457c478bd9Sstevel@tonic-gate addr2 = addr1 + (cnt - 1);
1467c478bd9Sstevel@tonic-gate if (addr2 > dol)
1477c478bd9Sstevel@tonic-gate addr2 = dol;
1487c478bd9Sstevel@tonic-gate if (addr2 < zero) {
1497c478bd9Sstevel@tonic-gate addr1 = addr2 = zero;
1507c478bd9Sstevel@tonic-gate }
1517c478bd9Sstevel@tonic-gate nonzero();
1527c478bd9Sstevel@tonic-gate }
1537c478bd9Sstevel@tonic-gate
1547c478bd9Sstevel@tonic-gate #endif /* XPG4 */
1557c478bd9Sstevel@tonic-gate
1567c478bd9Sstevel@tonic-gate /*
1577c478bd9Sstevel@tonic-gate * Parse a number out of the command input stream.
1587c478bd9Sstevel@tonic-gate */
159*f6db9f27Scf46844 int
getnum(void)160*f6db9f27Scf46844 getnum(void)
1617c478bd9Sstevel@tonic-gate {
162*f6db9f27Scf46844 int cnt;
1637c478bd9Sstevel@tonic-gate
1647c478bd9Sstevel@tonic-gate /*CSTYLED*/
1657c478bd9Sstevel@tonic-gate for (cnt = 0; isdigit(peekcd());)
1667c478bd9Sstevel@tonic-gate cnt = cnt * 10 + getchar() - '0';
1677c478bd9Sstevel@tonic-gate return (cnt);
1687c478bd9Sstevel@tonic-gate }
1697c478bd9Sstevel@tonic-gate
1707c478bd9Sstevel@tonic-gate /*
1717c478bd9Sstevel@tonic-gate * Set the default addresses for commands which use the whole
1727c478bd9Sstevel@tonic-gate * buffer as default, notably write.
1737c478bd9Sstevel@tonic-gate */
174*f6db9f27Scf46844 void
setall(void)175*f6db9f27Scf46844 setall(void)
1767c478bd9Sstevel@tonic-gate {
1777c478bd9Sstevel@tonic-gate
1787c478bd9Sstevel@tonic-gate if (addr2 == 0) {
1797c478bd9Sstevel@tonic-gate addr1 = one;
1807c478bd9Sstevel@tonic-gate addr2 = dol;
1817c478bd9Sstevel@tonic-gate if (dol == zero) {
1827c478bd9Sstevel@tonic-gate dot = zero;
1837c478bd9Sstevel@tonic-gate return;
1847c478bd9Sstevel@tonic-gate }
1857c478bd9Sstevel@tonic-gate }
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate * Don't want to set previous context mark so use setdot1().
1887c478bd9Sstevel@tonic-gate */
1897c478bd9Sstevel@tonic-gate setdot1();
1907c478bd9Sstevel@tonic-gate }
1917c478bd9Sstevel@tonic-gate
1927c478bd9Sstevel@tonic-gate /*
1937c478bd9Sstevel@tonic-gate * No address allowed on, e.g. the file command.
1947c478bd9Sstevel@tonic-gate */
195*f6db9f27Scf46844 void
setnoaddr(void)196*f6db9f27Scf46844 setnoaddr(void)
1977c478bd9Sstevel@tonic-gate {
1987c478bd9Sstevel@tonic-gate
1997c478bd9Sstevel@tonic-gate if (addr2 != 0)
2007c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
2017c478bd9Sstevel@tonic-gate gettext("No address allowed") :
2027c478bd9Sstevel@tonic-gate gettext("No address allowed on this command"));
2037c478bd9Sstevel@tonic-gate }
2047c478bd9Sstevel@tonic-gate
2057c478bd9Sstevel@tonic-gate /*
2067c478bd9Sstevel@tonic-gate * Parse an address.
2077c478bd9Sstevel@tonic-gate * Just about any sequence of address characters is legal.
2087c478bd9Sstevel@tonic-gate *
2097c478bd9Sstevel@tonic-gate * If you are tricky you can use this routine and the = command
2107c478bd9Sstevel@tonic-gate * to do simple addition and subtraction of cardinals less
2117c478bd9Sstevel@tonic-gate * than the number of lines in the file.
2127c478bd9Sstevel@tonic-gate */
2137c478bd9Sstevel@tonic-gate line *
address(inputline)2147c478bd9Sstevel@tonic-gate address(inputline)
2157c478bd9Sstevel@tonic-gate unsigned char *inputline;
2167c478bd9Sstevel@tonic-gate {
217*f6db9f27Scf46844 line *addr;
218*f6db9f27Scf46844 int offset, c;
2197c478bd9Sstevel@tonic-gate short lastsign;
2207c478bd9Sstevel@tonic-gate
2217c478bd9Sstevel@tonic-gate bigmove = 0;
2227c478bd9Sstevel@tonic-gate lastsign = 0;
2237c478bd9Sstevel@tonic-gate offset = 0;
2247c478bd9Sstevel@tonic-gate addr = 0;
2257c478bd9Sstevel@tonic-gate for (;;) {
2267c478bd9Sstevel@tonic-gate if (isdigit(peekcd())) {
2277c478bd9Sstevel@tonic-gate if (addr == 0) {
2287c478bd9Sstevel@tonic-gate addr = zero;
2297c478bd9Sstevel@tonic-gate bigmove = 1;
2307c478bd9Sstevel@tonic-gate }
2317c478bd9Sstevel@tonic-gate loc1 = 0;
2327c478bd9Sstevel@tonic-gate addr += offset;
2337c478bd9Sstevel@tonic-gate offset = getnum();
2347c478bd9Sstevel@tonic-gate if (lastsign >= 0)
2357c478bd9Sstevel@tonic-gate addr += offset;
2367c478bd9Sstevel@tonic-gate else
2377c478bd9Sstevel@tonic-gate addr -= offset;
2387c478bd9Sstevel@tonic-gate lastsign = 0;
2397c478bd9Sstevel@tonic-gate offset = 0;
2407c478bd9Sstevel@tonic-gate }
2417c478bd9Sstevel@tonic-gate switch (c = getcd()) {
2427c478bd9Sstevel@tonic-gate
2437c478bd9Sstevel@tonic-gate case '?':
2447c478bd9Sstevel@tonic-gate case '/':
2457c478bd9Sstevel@tonic-gate case '$':
2467c478bd9Sstevel@tonic-gate case '\'':
2477c478bd9Sstevel@tonic-gate case '\\':
2487c478bd9Sstevel@tonic-gate bigmove++;
2497c478bd9Sstevel@tonic-gate case '.':
2507c478bd9Sstevel@tonic-gate if (addr || offset)
2517c478bd9Sstevel@tonic-gate error(gettext("Badly formed address"));
2527c478bd9Sstevel@tonic-gate }
2537c478bd9Sstevel@tonic-gate offset += lastsign;
2547c478bd9Sstevel@tonic-gate lastsign = 0;
2557c478bd9Sstevel@tonic-gate switch (c) {
2567c478bd9Sstevel@tonic-gate
2577c478bd9Sstevel@tonic-gate case ' ':
2587c478bd9Sstevel@tonic-gate case '\t':
2597c478bd9Sstevel@tonic-gate continue;
2607c478bd9Sstevel@tonic-gate case ':':
2617c478bd9Sstevel@tonic-gate while (peekchar() == ':')
2627c478bd9Sstevel@tonic-gate ignchar();
2637c478bd9Sstevel@tonic-gate continue;
2647c478bd9Sstevel@tonic-gate case '+':
2657c478bd9Sstevel@tonic-gate lastsign = 1;
2667c478bd9Sstevel@tonic-gate if (addr == 0)
2677c478bd9Sstevel@tonic-gate addr = dot;
2687c478bd9Sstevel@tonic-gate continue;
2697c478bd9Sstevel@tonic-gate
2707c478bd9Sstevel@tonic-gate case '^':
2717c478bd9Sstevel@tonic-gate case '-':
2727c478bd9Sstevel@tonic-gate lastsign = -1;
2737c478bd9Sstevel@tonic-gate if (addr == 0)
2747c478bd9Sstevel@tonic-gate addr = dot;
2757c478bd9Sstevel@tonic-gate continue;
2767c478bd9Sstevel@tonic-gate
2777c478bd9Sstevel@tonic-gate case '\\':
2787c478bd9Sstevel@tonic-gate case '?':
2797c478bd9Sstevel@tonic-gate case '/':
2807c478bd9Sstevel@tonic-gate c = vi_compile(c, 1);
2817c478bd9Sstevel@tonic-gate notempty();
2827c478bd9Sstevel@tonic-gate savere(&scanre);
2837c478bd9Sstevel@tonic-gate addr = dot;
2847c478bd9Sstevel@tonic-gate if (inputline && execute(0, dot)) {
2857c478bd9Sstevel@tonic-gate if (c == '/') {
2867c478bd9Sstevel@tonic-gate while (loc1 <= (char *)inputline) {
2877c478bd9Sstevel@tonic-gate if (loc1 == loc2)
2887c478bd9Sstevel@tonic-gate loc2++;
2897c478bd9Sstevel@tonic-gate if (!execute(1))
2907c478bd9Sstevel@tonic-gate goto nope;
2917c478bd9Sstevel@tonic-gate }
2927c478bd9Sstevel@tonic-gate break;
2937c478bd9Sstevel@tonic-gate } else if (loc1 < (char *)inputline) {
2947c478bd9Sstevel@tonic-gate unsigned char *last;
2957c478bd9Sstevel@tonic-gate doques:
2967c478bd9Sstevel@tonic-gate
2977c478bd9Sstevel@tonic-gate do {
2987c478bd9Sstevel@tonic-gate last = (unsigned char *)loc1;
2997c478bd9Sstevel@tonic-gate if (loc1 == loc2)
3007c478bd9Sstevel@tonic-gate loc2++;
3017c478bd9Sstevel@tonic-gate if (!execute(1))
3027c478bd9Sstevel@tonic-gate break;
3037c478bd9Sstevel@tonic-gate } while (loc1 < (char *)inputline);
3047c478bd9Sstevel@tonic-gate loc1 = (char *)last;
3057c478bd9Sstevel@tonic-gate break;
3067c478bd9Sstevel@tonic-gate }
3077c478bd9Sstevel@tonic-gate }
3087c478bd9Sstevel@tonic-gate nope:
3097c478bd9Sstevel@tonic-gate for (;;) {
3107c478bd9Sstevel@tonic-gate if (c == '/') {
3117c478bd9Sstevel@tonic-gate addr++;
3127c478bd9Sstevel@tonic-gate if (addr > dol) {
3137c478bd9Sstevel@tonic-gate if (value(vi_WRAPSCAN) == 0)
3147c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
3157c478bd9Sstevel@tonic-gate gettext("No match to BOTTOM") :
3167c478bd9Sstevel@tonic-gate gettext("Address search hit BOTTOM without matching pattern"));
3177c478bd9Sstevel@tonic-gate addr = zero;
3187c478bd9Sstevel@tonic-gate }
3197c478bd9Sstevel@tonic-gate } else {
3207c478bd9Sstevel@tonic-gate addr--;
3217c478bd9Sstevel@tonic-gate if (addr < zero) {
3227c478bd9Sstevel@tonic-gate if (value(vi_WRAPSCAN) == 0)
3237c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
3247c478bd9Sstevel@tonic-gate gettext("No match to TOP") :
3257c478bd9Sstevel@tonic-gate gettext("Address search hit TOP without matching pattern"));
3267c478bd9Sstevel@tonic-gate addr = dol;
3277c478bd9Sstevel@tonic-gate }
3287c478bd9Sstevel@tonic-gate }
3297c478bd9Sstevel@tonic-gate if (execute(0, addr)) {
3307c478bd9Sstevel@tonic-gate if (inputline && c == '?') {
3317c478bd9Sstevel@tonic-gate inputline = &linebuf[LBSIZE];
3327c478bd9Sstevel@tonic-gate goto doques;
3337c478bd9Sstevel@tonic-gate }
3347c478bd9Sstevel@tonic-gate break;
3357c478bd9Sstevel@tonic-gate }
3367c478bd9Sstevel@tonic-gate if (addr == dot)
3377c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
3387c478bd9Sstevel@tonic-gate gettext("Fail") :
3397c478bd9Sstevel@tonic-gate gettext("Pattern not found"));
3407c478bd9Sstevel@tonic-gate }
3417c478bd9Sstevel@tonic-gate continue;
3427c478bd9Sstevel@tonic-gate
3437c478bd9Sstevel@tonic-gate case '$':
3447c478bd9Sstevel@tonic-gate addr = dol;
3457c478bd9Sstevel@tonic-gate continue;
3467c478bd9Sstevel@tonic-gate
3477c478bd9Sstevel@tonic-gate case '.':
3487c478bd9Sstevel@tonic-gate addr = dot;
3497c478bd9Sstevel@tonic-gate continue;
3507c478bd9Sstevel@tonic-gate
3517c478bd9Sstevel@tonic-gate case '\'':
3527c478bd9Sstevel@tonic-gate c = markreg(getchar());
3537c478bd9Sstevel@tonic-gate if (c == 0)
3547c478bd9Sstevel@tonic-gate error(gettext("Marks are ' and a-z"));
3557c478bd9Sstevel@tonic-gate addr = getmark(c);
3567c478bd9Sstevel@tonic-gate if (addr == 0)
3577c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
3587c478bd9Sstevel@tonic-gate gettext("Undefined mark") :
3597c478bd9Sstevel@tonic-gate gettext("Undefined mark referenced"));
3607c478bd9Sstevel@tonic-gate break;
3617c478bd9Sstevel@tonic-gate
3627c478bd9Sstevel@tonic-gate default:
3637c478bd9Sstevel@tonic-gate ungetchar(c);
3647c478bd9Sstevel@tonic-gate if (offset) {
3657c478bd9Sstevel@tonic-gate if (addr == 0)
3667c478bd9Sstevel@tonic-gate addr = dot;
3677c478bd9Sstevel@tonic-gate addr += offset;
3687c478bd9Sstevel@tonic-gate loc1 = 0;
3697c478bd9Sstevel@tonic-gate }
3707c478bd9Sstevel@tonic-gate if (addr == 0) {
3717c478bd9Sstevel@tonic-gate bigmove = 0;
3727c478bd9Sstevel@tonic-gate return (0);
3737c478bd9Sstevel@tonic-gate }
3747c478bd9Sstevel@tonic-gate if (addr != zero)
3757c478bd9Sstevel@tonic-gate notempty();
3767c478bd9Sstevel@tonic-gate addr += lastsign;
3777c478bd9Sstevel@tonic-gate if (addr < zero)
3787c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
3797c478bd9Sstevel@tonic-gate gettext("Negative address") :
3807c478bd9Sstevel@tonic-gate gettext("Negative address - "
3817c478bd9Sstevel@tonic-gate "first buffer line is 1"));
3827c478bd9Sstevel@tonic-gate if (addr > dol)
3837c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
3847c478bd9Sstevel@tonic-gate gettext("Not that many lines") :
3857c478bd9Sstevel@tonic-gate gettext("Not that many lines in buffer"));
3867c478bd9Sstevel@tonic-gate return (addr);
3877c478bd9Sstevel@tonic-gate }
3887c478bd9Sstevel@tonic-gate }
3897c478bd9Sstevel@tonic-gate }
3907c478bd9Sstevel@tonic-gate
3917c478bd9Sstevel@tonic-gate /*
3927c478bd9Sstevel@tonic-gate * Abbreviations to make code smaller
3937c478bd9Sstevel@tonic-gate * Left over from squashing ex version 1.1 into
3947c478bd9Sstevel@tonic-gate * 11/34's and 11/40's.
3957c478bd9Sstevel@tonic-gate */
396*f6db9f27Scf46844 void
setCNL(void)397*f6db9f27Scf46844 setCNL(void)
3987c478bd9Sstevel@tonic-gate {
3997c478bd9Sstevel@tonic-gate
4007c478bd9Sstevel@tonic-gate setcount();
4017c478bd9Sstevel@tonic-gate donewline();
4027c478bd9Sstevel@tonic-gate }
4037c478bd9Sstevel@tonic-gate
404*f6db9f27Scf46844 void
setNAEOL(void)405*f6db9f27Scf46844 setNAEOL(void)
4067c478bd9Sstevel@tonic-gate {
4077c478bd9Sstevel@tonic-gate
4087c478bd9Sstevel@tonic-gate setnoaddr();
4097c478bd9Sstevel@tonic-gate eol();
4107c478bd9Sstevel@tonic-gate }
411