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 */
22f6db9f27Scf /*
23f6db9f27Scf * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24f6db9f27Scf * Use is subject to license terms.
25f6db9f27Scf */
26f6db9f27Scf
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
337c478bd9Sstevel@tonic-gate #include "ex.h"
347c478bd9Sstevel@tonic-gate #include "ex_re.h"
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gate /*
377c478bd9Sstevel@tonic-gate * Routines for address parsing and assignment and checking of address bounds
387c478bd9Sstevel@tonic-gate * in command mode. The routine address is called from ex_cmds.c
397c478bd9Sstevel@tonic-gate * to parse each component of a command (terminated by , ; or the beginning
407c478bd9Sstevel@tonic-gate * of the command itself. It is also called by the scanning routine
417c478bd9Sstevel@tonic-gate * in ex_voperate.c from within open/visual.
427c478bd9Sstevel@tonic-gate *
437c478bd9Sstevel@tonic-gate * Other routines here manipulate the externals addr1 and addr2.
447c478bd9Sstevel@tonic-gate * These are the first and last lines for the current command.
457c478bd9Sstevel@tonic-gate *
467c478bd9Sstevel@tonic-gate * The variable bigmove remembers whether a non-local glitch of . was
477c478bd9Sstevel@tonic-gate * involved in an address expression, so we can set the previous context
487c478bd9Sstevel@tonic-gate * mark '' when such a motion occurs.
497c478bd9Sstevel@tonic-gate */
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gate static bool bigmove;
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate * Set up addr1 and addr2 for commands whose default address is dot.
557c478bd9Sstevel@tonic-gate */
56f6db9f27Scf void
setdot(void)57f6db9f27Scf setdot(void)
587c478bd9Sstevel@tonic-gate {
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gate setdot1();
617c478bd9Sstevel@tonic-gate if (bigmove)
627c478bd9Sstevel@tonic-gate markDOT();
637c478bd9Sstevel@tonic-gate }
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gate /*
667c478bd9Sstevel@tonic-gate * Call setdot1 to set up default addresses without ever
677c478bd9Sstevel@tonic-gate * setting the previous context mark.
687c478bd9Sstevel@tonic-gate */
69f6db9f27Scf void
setdot1(void)70f6db9f27Scf setdot1(void)
717c478bd9Sstevel@tonic-gate {
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gate if (addr2 == 0)
747c478bd9Sstevel@tonic-gate addr1 = addr2 = dot;
757c478bd9Sstevel@tonic-gate if (addr1 > addr2) {
767c478bd9Sstevel@tonic-gate notempty();
777c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
787c478bd9Sstevel@tonic-gate gettext("Addr1 > addr2") :
797c478bd9Sstevel@tonic-gate gettext("First address exceeds second"));
807c478bd9Sstevel@tonic-gate }
817c478bd9Sstevel@tonic-gate }
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate /*
847c478bd9Sstevel@tonic-gate * Ex allows you to say
857c478bd9Sstevel@tonic-gate * delete 5
867c478bd9Sstevel@tonic-gate * to delete 5 lines, etc.
877c478bd9Sstevel@tonic-gate * Such nonsense is implemented by setcount.
887c478bd9Sstevel@tonic-gate */
89f6db9f27Scf void
setcount(void)90f6db9f27Scf setcount(void)
917c478bd9Sstevel@tonic-gate {
92f6db9f27Scf int cnt;
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate pastwh();
957c478bd9Sstevel@tonic-gate if (!isdigit(peekchar())) {
967c478bd9Sstevel@tonic-gate setdot();
977c478bd9Sstevel@tonic-gate return;
987c478bd9Sstevel@tonic-gate }
997c478bd9Sstevel@tonic-gate addr1 = addr2;
1007c478bd9Sstevel@tonic-gate setdot();
1017c478bd9Sstevel@tonic-gate cnt = getnum();
1027c478bd9Sstevel@tonic-gate if (cnt <= 0)
1037c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
1047c478bd9Sstevel@tonic-gate gettext("Bad count") :
1057c478bd9Sstevel@tonic-gate gettext("Nonzero count required"));
1067c478bd9Sstevel@tonic-gate addr2 += cnt - 1;
1077c478bd9Sstevel@tonic-gate if (addr2 > dol)
1087c478bd9Sstevel@tonic-gate addr2 = dol;
1097c478bd9Sstevel@tonic-gate nonzero();
1107c478bd9Sstevel@tonic-gate }
1117c478bd9Sstevel@tonic-gate
1127c478bd9Sstevel@tonic-gate #ifdef XPG4
1137c478bd9Sstevel@tonic-gate /*
1147c478bd9Sstevel@tonic-gate * setcount2(): a version of setcount() which sets addr2 based on addr1 + cnt.
1157c478bd9Sstevel@tonic-gate * description:
1167c478bd9Sstevel@tonic-gate * this routine is responsible for setting addr1 (possibly) and addr2
1177c478bd9Sstevel@tonic-gate * (always); using the [count] to compute addr2.
1187c478bd9Sstevel@tonic-gate *
1197c478bd9Sstevel@tonic-gate * this is similar setcount(), but it differs in that setcount() sets
1207c478bd9Sstevel@tonic-gate * addr1 based upon addr2; here we set addr2 based upon addr1 and the
1217c478bd9Sstevel@tonic-gate * [count].
1227c478bd9Sstevel@tonic-gate *
1237c478bd9Sstevel@tonic-gate * the reason for this is because some commands, of the form:
1247c478bd9Sstevel@tonic-gate * [range] command [count]
1257c478bd9Sstevel@tonic-gate * will use [count] to modify the range. E.g.:
1267c478bd9Sstevel@tonic-gate * change, delete, join, list, yank.
1277c478bd9Sstevel@tonic-gate */
128f6db9f27Scf void
setcount2(void)129f6db9f27Scf setcount2(void)
1307c478bd9Sstevel@tonic-gate {
131f6db9f27Scf int cnt;
1327c478bd9Sstevel@tonic-gate
1337c478bd9Sstevel@tonic-gate pastwh();
1347c478bd9Sstevel@tonic-gate if (!isdigit(peekchar())) {
1357c478bd9Sstevel@tonic-gate setdot();
1367c478bd9Sstevel@tonic-gate return;
1377c478bd9Sstevel@tonic-gate }
1387c478bd9Sstevel@tonic-gate setdot();
1397c478bd9Sstevel@tonic-gate cnt = getnum();
1407c478bd9Sstevel@tonic-gate if (cnt <= 0)
1417c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
1427c478bd9Sstevel@tonic-gate gettext("Bad count") :
1437c478bd9Sstevel@tonic-gate gettext("Nonzero count required"));
1447c478bd9Sstevel@tonic-gate addr2 = addr1 + (cnt - 1);
1457c478bd9Sstevel@tonic-gate if (addr2 > dol)
1467c478bd9Sstevel@tonic-gate addr2 = dol;
1477c478bd9Sstevel@tonic-gate if (addr2 < zero) {
1487c478bd9Sstevel@tonic-gate addr1 = addr2 = zero;
1497c478bd9Sstevel@tonic-gate }
1507c478bd9Sstevel@tonic-gate nonzero();
1517c478bd9Sstevel@tonic-gate }
1527c478bd9Sstevel@tonic-gate
1537c478bd9Sstevel@tonic-gate #endif /* XPG4 */
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gate /*
1567c478bd9Sstevel@tonic-gate * Parse a number out of the command input stream.
1577c478bd9Sstevel@tonic-gate */
158f6db9f27Scf int
getnum(void)159f6db9f27Scf getnum(void)
1607c478bd9Sstevel@tonic-gate {
161f6db9f27Scf int cnt;
1627c478bd9Sstevel@tonic-gate
1637c478bd9Sstevel@tonic-gate /*CSTYLED*/
1647c478bd9Sstevel@tonic-gate for (cnt = 0; isdigit(peekcd());)
1657c478bd9Sstevel@tonic-gate cnt = cnt * 10 + getchar() - '0';
1667c478bd9Sstevel@tonic-gate return (cnt);
1677c478bd9Sstevel@tonic-gate }
1687c478bd9Sstevel@tonic-gate
1697c478bd9Sstevel@tonic-gate /*
1707c478bd9Sstevel@tonic-gate * Set the default addresses for commands which use the whole
1717c478bd9Sstevel@tonic-gate * buffer as default, notably write.
1727c478bd9Sstevel@tonic-gate */
173f6db9f27Scf void
setall(void)174f6db9f27Scf setall(void)
1757c478bd9Sstevel@tonic-gate {
1767c478bd9Sstevel@tonic-gate
1777c478bd9Sstevel@tonic-gate if (addr2 == 0) {
1787c478bd9Sstevel@tonic-gate addr1 = one;
1797c478bd9Sstevel@tonic-gate addr2 = dol;
1807c478bd9Sstevel@tonic-gate if (dol == zero) {
1817c478bd9Sstevel@tonic-gate dot = zero;
1827c478bd9Sstevel@tonic-gate return;
1837c478bd9Sstevel@tonic-gate }
1847c478bd9Sstevel@tonic-gate }
1857c478bd9Sstevel@tonic-gate /*
1867c478bd9Sstevel@tonic-gate * Don't want to set previous context mark so use setdot1().
1877c478bd9Sstevel@tonic-gate */
1887c478bd9Sstevel@tonic-gate setdot1();
1897c478bd9Sstevel@tonic-gate }
1907c478bd9Sstevel@tonic-gate
1917c478bd9Sstevel@tonic-gate /*
1927c478bd9Sstevel@tonic-gate * No address allowed on, e.g. the file command.
1937c478bd9Sstevel@tonic-gate */
194f6db9f27Scf void
setnoaddr(void)195f6db9f27Scf setnoaddr(void)
1967c478bd9Sstevel@tonic-gate {
1977c478bd9Sstevel@tonic-gate
1987c478bd9Sstevel@tonic-gate if (addr2 != 0)
1997c478bd9Sstevel@tonic-gate error(value(vi_TERSE) ?
2007c478bd9Sstevel@tonic-gate gettext("No address allowed") :
2017c478bd9Sstevel@tonic-gate gettext("No address allowed on this command"));
2027c478bd9Sstevel@tonic-gate }
2037c478bd9Sstevel@tonic-gate
2047c478bd9Sstevel@tonic-gate /*
2057c478bd9Sstevel@tonic-gate * Parse an address.
2067c478bd9Sstevel@tonic-gate * Just about any sequence of address characters is legal.
2077c478bd9Sstevel@tonic-gate *
2087c478bd9Sstevel@tonic-gate * If you are tricky you can use this routine and the = command
2097c478bd9Sstevel@tonic-gate * to do simple addition and subtraction of cardinals less
2107c478bd9Sstevel@tonic-gate * than the number of lines in the file.
2117c478bd9Sstevel@tonic-gate */
2127c478bd9Sstevel@tonic-gate line *
address(inputline)2137c478bd9Sstevel@tonic-gate address(inputline)
2147c478bd9Sstevel@tonic-gate unsigned char *inputline;
2157c478bd9Sstevel@tonic-gate {
216f6db9f27Scf line *addr;
217f6db9f27Scf int offset, c;
2187c478bd9Sstevel@tonic-gate short lastsign;
2197c478bd9Sstevel@tonic-gate
2207c478bd9Sstevel@tonic-gate bigmove = 0;
2217c478bd9Sstevel@tonic-gate lastsign = 0;
2227c478bd9Sstevel@tonic-gate offset = 0;
2237c478bd9Sstevel@tonic-gate addr = 0;
2247c478bd9Sstevel@tonic-gate for (;;) {
2257c478bd9Sstevel@tonic-gate if (isdigit(peekcd())) {
2267c478bd9Sstevel@tonic-gate if (addr == 0) {
2277c478bd9Sstevel@tonic-gate addr = zero;
2287c478bd9Sstevel@tonic-gate bigmove = 1;
2297c478bd9Sstevel@tonic-gate }
2307c478bd9Sstevel@tonic-gate loc1 = 0;
2317c478bd9Sstevel@tonic-gate addr += offset;
2327c478bd9Sstevel@tonic-gate offset = getnum();
2337c478bd9Sstevel@tonic-gate if (lastsign >= 0)
2347c478bd9Sstevel@tonic-gate addr += offset;
2357c478bd9Sstevel@tonic-gate else
2367c478bd9Sstevel@tonic-gate addr -= offset;
2377c478bd9Sstevel@tonic-gate lastsign = 0;
2387c478bd9Sstevel@tonic-gate offset = 0;
2397c478bd9Sstevel@tonic-gate }
2407c478bd9Sstevel@tonic-gate switch (c = getcd()) {
2417c478bd9Sstevel@tonic-gate
2427c478bd9Sstevel@tonic-gate case '?':
2437c478bd9Sstevel@tonic-gate case '/':
2447c478bd9Sstevel@tonic-gate case '$':
2457c478bd9Sstevel@tonic-gate case '\'':
2467c478bd9Sstevel@tonic-gate case '\\':
2477c478bd9Sstevel@tonic-gate bigmove++;
248*9097ca5cSToomas Soome /* FALLTHROUGH */
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 */
396f6db9f27Scf void
setCNL(void)397f6db9f27Scf setCNL(void)
3987c478bd9Sstevel@tonic-gate {
3997c478bd9Sstevel@tonic-gate
4007c478bd9Sstevel@tonic-gate setcount();
4017c478bd9Sstevel@tonic-gate donewline();
4027c478bd9Sstevel@tonic-gate }
4037c478bd9Sstevel@tonic-gate
404f6db9f27Scf void
setNAEOL(void)405f6db9f27Scf setNAEOL(void)
4067c478bd9Sstevel@tonic-gate {
4077c478bd9Sstevel@tonic-gate
4087c478bd9Sstevel@tonic-gate setnoaddr();
4097c478bd9Sstevel@tonic-gate eol();
4107c478bd9Sstevel@tonic-gate }
411