Import nvi 2.1.3
Approved by: peter
This commit is contained in:
parent
1abe484249
commit
5a709d61a3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/nvi/dist/; revision=281368 svn path=/vendor/nvi/2.1.3/; revision=281370; tag=vendor/nvi/2.1.3
4
README
4
README
@ -1,6 +1,6 @@
|
||||
# $Id: README,v 9.1 2013/11/02 02:50:23 zy Exp $
|
||||
# $Id: README,v 9.2 2015/04/08 17:18:56 zy Exp $
|
||||
|
||||
This is version 2.1.2 (2012-11-02) of nex/nvi, a reimplementation of the ex/vi
|
||||
This is version 2.1.3 (2015-04-08) of nex/nvi, a reimplementation of the ex/vi
|
||||
text editors originally distributed as part of the Fourth Berkeley
|
||||
Software Distribution (4BSD), by the University of California, Berkeley.
|
||||
|
||||
|
@ -10,11 +10,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
@ -31,12 +27,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1992, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "$Id: dump.c,v 8.2 2011/07/14 00:05:25 zy Exp $";
|
||||
#endif /* not lint */
|
||||
@ -45,8 +35,7 @@ static char sccsid[] = "$Id: dump.c,v 8.2 2011/07/14 00:05:25 zy Exp $";
|
||||
#include <stdio.h>
|
||||
|
||||
static void
|
||||
parse(fp)
|
||||
FILE *fp;
|
||||
parse(FILE *fp)
|
||||
{
|
||||
int ch, s1, s2, s3;
|
||||
|
||||
@ -96,9 +85,7 @@ parse(fp)
|
||||
}
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
ARGMAX
|
||||
LC
|
||||
NL
|
||||
XXXX
|
||||
arg1
|
||||
arg2
|
||||
chys
|
||||
english
|
||||
english.base
|
||||
german.base
|
||||
langauge
|
||||
msg
|
||||
msg.c
|
||||
msgcat
|
||||
msgq
|
||||
nvi
|
||||
nvi's
|
||||
pathname
|
||||
sp
|
12
cl/cl.h
12
cl/cl.h
@ -80,16 +80,4 @@ typedef enum { INP_OK=0, INP_EOF, INP_ERR, INP_INTR, INP_TIMEOUT } input_t;
|
||||
#define RCNO(sp, cno) (cno)
|
||||
#define RLNO(sp, lno) (lno)
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* Some implementations of curses.h don't define these for us. Used for
|
||||
* compatibility only.
|
||||
*/
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#include "extern.h"
|
||||
|
@ -33,7 +33,7 @@ static const char sccsid[] = "$Id: cl_funcs.c,v 10.74 2012/10/11 10:30:16 zy Exp
|
||||
#include "../vi/vi.h"
|
||||
#include "cl.h"
|
||||
|
||||
static void cl_rdiv __P((SCR *));
|
||||
static void cl_rdiv(SCR *);
|
||||
|
||||
static int
|
||||
addstr4(SCR *sp, void *str, size_t len, int wide)
|
||||
@ -76,31 +76,31 @@ addstr4(SCR *sp, void *str, size_t len, int wide)
|
||||
* cl_waddstr --
|
||||
* Add len bytes from the string at the cursor, advancing the cursor.
|
||||
*
|
||||
* PUBLIC: int cl_waddstr __P((SCR *, const CHAR_T *, size_t));
|
||||
* PUBLIC: int cl_waddstr(SCR *, const CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
cl_waddstr(SCR *sp, const CHAR_T *str, size_t len)
|
||||
{
|
||||
return addstr4(sp, (void *)str, len, 1);
|
||||
return addstr4(sp, (void *)str, len, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* cl_addstr --
|
||||
* Add len bytes from the string at the cursor, advancing the cursor.
|
||||
*
|
||||
* PUBLIC: int cl_addstr __P((SCR *, const char *, size_t));
|
||||
* PUBLIC: int cl_addstr(SCR *, const char *, size_t);
|
||||
*/
|
||||
int
|
||||
cl_addstr(SCR *sp, const char *str, size_t len)
|
||||
{
|
||||
return addstr4(sp, (void *)str, len, 0);
|
||||
return addstr4(sp, (void *)str, len, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* cl_attr --
|
||||
* Toggle a screen attribute on/off.
|
||||
*
|
||||
* PUBLIC: int cl_attr __P((SCR *, scr_attr_t, int));
|
||||
* PUBLIC: int cl_attr(SCR *, scr_attr_t, int);
|
||||
*/
|
||||
int
|
||||
cl_attr(SCR *sp, scr_attr_t attribute, int on)
|
||||
@ -187,7 +187,7 @@ cl_attr(SCR *sp, scr_attr_t attribute, int on)
|
||||
* cl_baud --
|
||||
* Return the baud rate.
|
||||
*
|
||||
* PUBLIC: int cl_baud __P((SCR *, u_long *));
|
||||
* PUBLIC: int cl_baud(SCR *, u_long *);
|
||||
*/
|
||||
int
|
||||
cl_baud(SCR *sp, u_long *ratep)
|
||||
@ -228,7 +228,7 @@ cl_baud(SCR *sp, u_long *ratep)
|
||||
* cl_bell --
|
||||
* Ring the bell/flash the screen.
|
||||
*
|
||||
* PUBLIC: int cl_bell __P((SCR *));
|
||||
* PUBLIC: int cl_bell(SCR *);
|
||||
*/
|
||||
int
|
||||
cl_bell(SCR *sp)
|
||||
@ -252,7 +252,7 @@ cl_bell(SCR *sp)
|
||||
* cl_clrtoeol --
|
||||
* Clear from the current cursor to the end of the line.
|
||||
*
|
||||
* PUBLIC: int cl_clrtoeol __P((SCR *));
|
||||
* PUBLIC: int cl_clrtoeol(SCR *);
|
||||
*/
|
||||
int
|
||||
cl_clrtoeol(SCR *sp)
|
||||
@ -281,7 +281,7 @@ cl_clrtoeol(SCR *sp)
|
||||
* cl_cursor --
|
||||
* Return the current cursor position.
|
||||
*
|
||||
* PUBLIC: int cl_cursor __P((SCR *, size_t *, size_t *));
|
||||
* PUBLIC: int cl_cursor(SCR *, size_t *, size_t *);
|
||||
*/
|
||||
int
|
||||
cl_cursor(SCR *sp, size_t *yp, size_t *xp)
|
||||
@ -307,7 +307,7 @@ cl_cursor(SCR *sp, size_t *yp, size_t *xp)
|
||||
* cl_deleteln --
|
||||
* Delete the current line, scrolling all lines below it.
|
||||
*
|
||||
* PUBLIC: int cl_deleteln __P((SCR *));
|
||||
* PUBLIC: int cl_deleteln(SCR *);
|
||||
*/
|
||||
int
|
||||
cl_deleteln(SCR *sp)
|
||||
@ -344,7 +344,7 @@ cl_deleteln(SCR *sp)
|
||||
* cl_discard --
|
||||
* Discard a screen.
|
||||
*
|
||||
* PUBLIC: int cl_discard __P((SCR *, SCR **));
|
||||
* PUBLIC: int cl_discard(SCR *, SCR **);
|
||||
*/
|
||||
int
|
||||
cl_discard(SCR *discardp, SCR **acquirep)
|
||||
@ -385,7 +385,7 @@ cl_discard(SCR *discardp, SCR **acquirep)
|
||||
* Adjust the screen for ex. This routine is purely for standalone
|
||||
* ex programs. All special purpose, all special case.
|
||||
*
|
||||
* PUBLIC: int cl_ex_adjust __P((SCR *, exadj_t));
|
||||
* PUBLIC: int cl_ex_adjust(SCR *, exadj_t);
|
||||
*/
|
||||
int
|
||||
cl_ex_adjust(SCR *sp, exadj_t action)
|
||||
@ -440,7 +440,7 @@ cl_ex_adjust(SCR *sp, exadj_t action)
|
||||
* cl_insertln --
|
||||
* Push down the current line, discarding the bottom line.
|
||||
*
|
||||
* PUBLIC: int cl_insertln __P((SCR *));
|
||||
* PUBLIC: int cl_insertln(SCR *);
|
||||
*/
|
||||
int
|
||||
cl_insertln(SCR *sp)
|
||||
@ -458,7 +458,7 @@ cl_insertln(SCR *sp)
|
||||
* cl_keyval --
|
||||
* Return the value for a special key.
|
||||
*
|
||||
* PUBLIC: int cl_keyval __P((SCR *, scr_keyval_t, CHAR_T *, int *));
|
||||
* PUBLIC: int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *);
|
||||
*/
|
||||
int
|
||||
cl_keyval(SCR *sp, scr_keyval_t val, CHAR_T *chp, int *dnep)
|
||||
@ -496,7 +496,7 @@ cl_keyval(SCR *sp, scr_keyval_t val, CHAR_T *chp, int *dnep)
|
||||
* cl_move --
|
||||
* Move the cursor.
|
||||
*
|
||||
* PUBLIC: int cl_move __P((SCR *, size_t, size_t));
|
||||
* PUBLIC: int cl_move(SCR *, size_t, size_t);
|
||||
*/
|
||||
int
|
||||
cl_move(SCR *sp, size_t lno, size_t cno)
|
||||
@ -516,7 +516,7 @@ cl_move(SCR *sp, size_t lno, size_t cno)
|
||||
* cl_refresh --
|
||||
* Refresh the screen.
|
||||
*
|
||||
* PUBLIC: int cl_refresh __P((SCR *, int));
|
||||
* PUBLIC: int cl_refresh(SCR *, int);
|
||||
*/
|
||||
int
|
||||
cl_refresh(SCR *sp, int repaint)
|
||||
@ -599,7 +599,7 @@ cl_rdiv(SCR *sp)
|
||||
* cl_rename --
|
||||
* Rename the file.
|
||||
*
|
||||
* PUBLIC: int cl_rename __P((SCR *, char *, int));
|
||||
* PUBLIC: int cl_rename(SCR *, char *, int);
|
||||
*/
|
||||
int
|
||||
cl_rename(SCR *sp, char *name, int on)
|
||||
@ -621,7 +621,7 @@ cl_rename(SCR *sp, char *name, int on)
|
||||
if (on) {
|
||||
clp->focus = sp;
|
||||
if (!F_ISSET(clp, CL_RENAME_OK) ||
|
||||
strncmp(OG_STR(gp, GO_TERM), "xterm", 5))
|
||||
strncmp(OG_STR(gp, GO_TERM), "xterm", 5))
|
||||
return (0);
|
||||
|
||||
if (clp->oname == NULL && (wid = getenv("WINDOWID"))) {
|
||||
@ -654,7 +654,7 @@ rename: cl_setname(gp, name);
|
||||
* cl_setname --
|
||||
* Set a X11 icon/window name.
|
||||
*
|
||||
* PUBLIC: void cl_setname __P((GS *, char *));
|
||||
* PUBLIC: void cl_setname(GS *, char *);
|
||||
*/
|
||||
void
|
||||
cl_setname(GS *gp, char *name)
|
||||
@ -671,7 +671,7 @@ cl_setname(GS *gp, char *name)
|
||||
* cl_split --
|
||||
* Split a screen.
|
||||
*
|
||||
* PUBLIC: int cl_split __P((SCR *, SCR *));
|
||||
* PUBLIC: int cl_split(SCR *, SCR *);
|
||||
*/
|
||||
int
|
||||
cl_split(SCR *origp, SCR *newp)
|
||||
@ -697,7 +697,7 @@ cl_split(SCR *origp, SCR *newp)
|
||||
* cl_suspend --
|
||||
* Suspend a screen.
|
||||
*
|
||||
* PUBLIC: int cl_suspend __P((SCR *, int *));
|
||||
* PUBLIC: int cl_suspend(SCR *, int *);
|
||||
*/
|
||||
int
|
||||
cl_suspend(SCR *sp, int *allowedp)
|
||||
@ -825,7 +825,7 @@ cl_suspend(SCR *sp, int *allowedp)
|
||||
* cl_usage --
|
||||
* Print out the curses usage messages.
|
||||
*
|
||||
* PUBLIC: void cl_usage __P((void));
|
||||
* PUBLIC: void cl_usage(void);
|
||||
*/
|
||||
void
|
||||
cl_usage(void)
|
||||
|
37
cl/cl_main.c
37
cl/cl_main.c
@ -10,7 +10,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "$Id: cl_main.c,v 10.55 2011/08/15 19:52:28 zy Exp $";
|
||||
static const char sccsid[] = "$Id: cl_main.c,v 10.56 2015/04/05 06:20:53 zy Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -36,20 +36,20 @@ static const char sccsid[] = "$Id: cl_main.c,v 10.55 2011/08/15 19:52:28 zy Exp
|
||||
GS *__global_list; /* GLOBAL: List of screens. */
|
||||
sigset_t __sigblockset; /* GLOBAL: Blocked signals. */
|
||||
|
||||
static void cl_func_std __P((GS *));
|
||||
static CL_PRIVATE *cl_init __P((GS *));
|
||||
static GS *gs_init __P((char *));
|
||||
static void perr __P((char *, char *));
|
||||
static int setsig __P((int, struct sigaction *, void (*)(int)));
|
||||
static void sig_end __P((GS *));
|
||||
static void term_init __P((char *, char *));
|
||||
static void cl_func_std(GS *);
|
||||
static CL_PRIVATE *cl_init(GS *);
|
||||
static GS *gs_init(char *);
|
||||
static void perr(char *, char *);
|
||||
static int setsig(int, struct sigaction *, void (*)(int));
|
||||
static void sig_end(GS *);
|
||||
static void term_init(char *, char *);
|
||||
|
||||
/*
|
||||
* main --
|
||||
* This is the main loop for the standalone curses editor.
|
||||
*/
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
static int reenter;
|
||||
CL_PRIVATE *clp;
|
||||
@ -92,7 +92,7 @@ main(int argc, char **argv)
|
||||
* have to use termcap/terminfo to find out how big the screen is.
|
||||
*/
|
||||
if ((ttype = getenv("TERM")) == NULL)
|
||||
ttype = "unknown";
|
||||
ttype = "ansi";
|
||||
term_init(gp->progname, ttype);
|
||||
|
||||
/* Add the terminal type to the global structure. */
|
||||
@ -146,7 +146,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Free the global and CL private areas. */
|
||||
#if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY)
|
||||
#if defined(DEBUG) || defined(PURIFY)
|
||||
if (clp->oname != NULL)
|
||||
free(clp->oname);
|
||||
free(clp);
|
||||
@ -292,7 +292,7 @@ h_winch(int signo)
|
||||
* sig_init --
|
||||
* Initialize signals.
|
||||
*
|
||||
* PUBLIC: int sig_init __P((GS *, SCR *));
|
||||
* PUBLIC: int sig_init(GS *, SCR *);
|
||||
*/
|
||||
int
|
||||
sig_init(GS *gp, SCR *sp)
|
||||
@ -337,7 +337,7 @@ sig_init(GS *gp, SCR *sp)
|
||||
* Set a signal handler.
|
||||
*/
|
||||
static int
|
||||
setsig(int signo, struct sigaction *oactp, void (*handler) (int))
|
||||
setsig(int signo, struct sigaction *oactp, void (*handler)(int))
|
||||
{
|
||||
struct sigaction act;
|
||||
|
||||
@ -345,21 +345,12 @@ setsig(int signo, struct sigaction *oactp, void (*handler) (int))
|
||||
* Use sigaction(2), not signal(3), since we don't always want to
|
||||
* restart system calls. The example is when waiting for a command
|
||||
* mode keystroke and SIGWINCH arrives. Besides, you can't portably
|
||||
* restart system calls (thanks, POSIX!). On the other hand, you
|
||||
* can't portably NOT restart system calls (thanks, Sun!). SunOS
|
||||
* used SA_INTERRUPT as their extension to NOT restart read calls.
|
||||
* We sure hope nobody else used it for anything else. Mom told me
|
||||
* there'd be days like this. She just never told me that there'd
|
||||
* be so many.
|
||||
* restart system calls (thanks, POSIX!).
|
||||
*/
|
||||
act.sa_handler = handler;
|
||||
sigemptyset(&act.sa_mask);
|
||||
|
||||
#ifdef SA_INTERRUPT
|
||||
act.sa_flags = SA_INTERRUPT;
|
||||
#else
|
||||
act.sa_flags = 0;
|
||||
#endif
|
||||
return (sigaction(signo, &act, oactp));
|
||||
}
|
||||
|
||||
|
11
cl/cl_read.c
11
cl/cl_read.c
@ -35,15 +35,15 @@ static const char sccsid[] = "$Id: cl_read.c,v 10.30 2012/07/12 18:28:58 zy Exp
|
||||
#undef columns
|
||||
#undef lines
|
||||
|
||||
static input_t cl_read __P((SCR *,
|
||||
u_int32_t, char *, size_t, int *, struct timeval *));
|
||||
static int cl_resize __P((SCR *, size_t, size_t));
|
||||
static input_t cl_read(SCR *,
|
||||
u_int32_t, char *, size_t, int *, struct timeval *);
|
||||
static int cl_resize(SCR *, size_t, size_t);
|
||||
|
||||
/*
|
||||
* cl_event --
|
||||
* Return a single event.
|
||||
*
|
||||
* PUBLIC: int cl_event __P((SCR *, EVENT *, u_int32_t, int));
|
||||
* PUBLIC: int cl_event(SCR *, EVENT *, u_int32_t, int);
|
||||
*/
|
||||
int
|
||||
cl_event(SCR *sp, EVENT *evp, u_int32_t flags, int ms)
|
||||
@ -143,7 +143,8 @@ retest: if (LF_ISSET(EC_INTERRUPT) || F_ISSET(clp, CL_SIGINT)) {
|
||||
* Read characters from the input.
|
||||
*/
|
||||
static input_t
|
||||
cl_read(SCR *sp, u_int32_t flags, char *bp, size_t blen, int *nrp, struct timeval *tp)
|
||||
cl_read(SCR *sp, u_int32_t flags, char *bp, size_t blen, int *nrp,
|
||||
struct timeval *tp)
|
||||
{
|
||||
struct termios term1, term2;
|
||||
CL_PRIVATE *clp;
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "$Id: cl_screen.c,v 10.56 2002/05/03 19:59:44 skimo Exp $";
|
||||
static const char sccsid[] = "$Id: cl_screen.c,v 10.58 2015/04/08 02:12:11 zy Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -32,18 +32,18 @@ static const char sccsid[] = "$Id: cl_screen.c,v 10.56 2002/05/03 19:59:44 skimo
|
||||
#include "../common/common.h"
|
||||
#include "cl.h"
|
||||
|
||||
static int cl_ex_end __P((GS *));
|
||||
static int cl_ex_init __P((SCR *));
|
||||
static void cl_freecap __P((CL_PRIVATE *));
|
||||
static int cl_vi_end __P((GS *));
|
||||
static int cl_vi_init __P((SCR *));
|
||||
static int cl_putenv __P((char *, char *, u_long));
|
||||
static int cl_ex_end(GS *);
|
||||
static int cl_ex_init(SCR *);
|
||||
static void cl_freecap(CL_PRIVATE *);
|
||||
static int cl_vi_end(GS *);
|
||||
static int cl_vi_init(SCR *);
|
||||
static int cl_putenv(char *, char *, u_long);
|
||||
|
||||
/*
|
||||
* cl_screen --
|
||||
* Switch screen types.
|
||||
*
|
||||
* PUBLIC: int cl_screen __P((SCR *, u_int32_t));
|
||||
* PUBLIC: int cl_screen(SCR *, u_int32_t);
|
||||
*/
|
||||
int
|
||||
cl_screen(SCR *sp, u_int32_t flags)
|
||||
@ -58,11 +58,9 @@ cl_screen(SCR *sp, u_int32_t flags)
|
||||
|
||||
/* See if the current information is incorrect. */
|
||||
if (F_ISSET(gp, G_SRESTART)) {
|
||||
if (CLSP(sp)) {
|
||||
delwin(CLSP(sp));
|
||||
sp->cl_private = NULL;
|
||||
}
|
||||
if (cl_quit(gp))
|
||||
if ((!F_ISSET(sp, SC_SCR_EX | SC_SCR_VI) ||
|
||||
resizeterm(O_VAL(sp, O_LINES), O_VAL(sp, O_COLUMNS))) &&
|
||||
cl_quit(gp))
|
||||
return (1);
|
||||
F_CLR(gp, G_SRESTART);
|
||||
}
|
||||
@ -131,7 +129,7 @@ cl_screen(SCR *sp, u_int32_t flags)
|
||||
* cl_quit --
|
||||
* Shutdown the screens.
|
||||
*
|
||||
* PUBLIC: int cl_quit __P((GS *));
|
||||
* PUBLIC: int cl_quit(GS *);
|
||||
*/
|
||||
int
|
||||
cl_quit(GS *gp)
|
||||
@ -234,20 +232,15 @@ cl_vi_init(SCR *sp)
|
||||
cl_putenv("COLUMNS", NULL, (u_long)O_VAL(sp, O_COLUMNS));
|
||||
|
||||
/*
|
||||
* We don't care about the SCREEN reference returned by newterm, we
|
||||
* never have more than one SCREEN at a time.
|
||||
*
|
||||
* XXX
|
||||
* The SunOS initscr() can't be called twice. Don't even think about
|
||||
* using it. It fails in subtle ways (e.g. select(2) on fileno(stdin)
|
||||
* stops working). (The SVID notes that applications should only call
|
||||
* initscr() once.)
|
||||
*
|
||||
* XXX
|
||||
* The HP/UX newterm doesn't support the NULL first argument, so we
|
||||
* have to specify the terminal type.
|
||||
* The terminal is aways initialized, either in `main`, or by a
|
||||
* previous call to newterm(3X).
|
||||
*/
|
||||
(void)del_curterm(cur_term);
|
||||
|
||||
/*
|
||||
* We never have more than one SCREEN at a time, so set_term(NULL) will
|
||||
* give us the last SCREEN.
|
||||
*/
|
||||
errno = 0;
|
||||
if (newterm(ttype, stdout, stdin) == NULL) {
|
||||
if (errno)
|
||||
@ -416,6 +409,9 @@ cl_vi_end(GS *gp)
|
||||
/* End curses window. */
|
||||
(void)endwin();
|
||||
|
||||
/* Free the SCREEN created by newterm(3X). */
|
||||
delscreen(set_term(NULL));
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* The screen TE sequence just got sent. See the comment in
|
||||
@ -520,7 +516,7 @@ cl_ex_end(GS *gp)
|
||||
* cl_getcap --
|
||||
* Retrieve termcap/terminfo strings.
|
||||
*
|
||||
* PUBLIC: int cl_getcap __P((SCR *, char *, char **));
|
||||
* PUBLIC: int cl_getcap(SCR *, char *, char **);
|
||||
*/
|
||||
int
|
||||
cl_getcap(SCR *sp, char *name, char **elementp)
|
||||
|
27
cl/cl_term.c
27
cl/cl_term.c
@ -10,7 +10,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "$Id: cl_term.c,v 10.34 2013/12/07 16:21:14 wjenkner Exp $";
|
||||
static const char sccsid[] = "$Id: cl_term.c,v 10.35 2015/04/08 02:12:11 zy Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -34,7 +34,7 @@ static const char sccsid[] = "$Id: cl_term.c,v 10.34 2013/12/07 16:21:14 wjenkne
|
||||
#include "../common/common.h"
|
||||
#include "cl.h"
|
||||
|
||||
static int cl_pfmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
|
||||
static int cl_pfmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
|
||||
|
||||
/*
|
||||
* XXX
|
||||
@ -81,7 +81,7 @@ static TKLIST const m2_tklist[] = { /* Input mappings (set or delete). */
|
||||
* cl_term_init --
|
||||
* Initialize the special keys defined by the termcap/terminfo entry.
|
||||
*
|
||||
* PUBLIC: int cl_term_init __P((SCR *));
|
||||
* PUBLIC: int cl_term_init(SCR *);
|
||||
*/
|
||||
int
|
||||
cl_term_init(SCR *sp)
|
||||
@ -182,7 +182,7 @@ cl_term_init(SCR *sp)
|
||||
* cl_term_end --
|
||||
* End the special keys defined by the termcap/terminfo entry.
|
||||
*
|
||||
* PUBLIC: int cl_term_end __P((GS *));
|
||||
* PUBLIC: int cl_term_end(GS *);
|
||||
*/
|
||||
int
|
||||
cl_term_end(GS *gp)
|
||||
@ -206,7 +206,7 @@ cl_term_end(GS *gp)
|
||||
* cl_fmap --
|
||||
* Map a function key.
|
||||
*
|
||||
* PUBLIC: int cl_fmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
|
||||
* PUBLIC: int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
cl_fmap(SCR *sp, seq_t stype, CHAR_T *from, size_t flen, CHAR_T *to, size_t tlen)
|
||||
@ -258,7 +258,7 @@ cl_pfmap(SCR *sp, seq_t stype, CHAR_T *from, size_t flen, CHAR_T *to, size_t tle
|
||||
* cl_optchange --
|
||||
* Curses screen specific "option changed" routine.
|
||||
*
|
||||
* PUBLIC: int cl_optchange __P((SCR *, int, char *, u_long *));
|
||||
* PUBLIC: int cl_optchange(SCR *, int, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
cl_optchange(SCR *sp, int opt, char *str, u_long *valp)
|
||||
@ -268,15 +268,16 @@ cl_optchange(SCR *sp, int opt, char *str, u_long *valp)
|
||||
clp = CLP(sp);
|
||||
|
||||
switch (opt) {
|
||||
case O_TERM:
|
||||
F_CLR(sp, SC_SCR_EX | SC_SCR_VI);
|
||||
/* FALLTHROUGH */
|
||||
case O_COLUMNS:
|
||||
case O_LINES:
|
||||
case O_TERM:
|
||||
/*
|
||||
* Changing the columns, lines or terminal require that
|
||||
* we restart the screen.
|
||||
* Changing the terminal type requires that we reinitialize
|
||||
* curses, while resizing does not.
|
||||
*/
|
||||
F_SET(sp->gp, G_SRESTART);
|
||||
F_CLR(sp, SC_SCR_EX | SC_SCR_VI);
|
||||
break;
|
||||
case O_MESG:
|
||||
(void)cl_omesg(sp, clp, *valp);
|
||||
@ -305,7 +306,7 @@ cl_optchange(SCR *sp, int opt, char *str, u_long *valp)
|
||||
* cl_omesg --
|
||||
* Turn the tty write permission on or off.
|
||||
*
|
||||
* PUBLIC: int cl_omesg __P((SCR *, CL_PRIVATE *, int));
|
||||
* PUBLIC: int cl_omesg(SCR *, CL_PRIVATE *, int);
|
||||
*/
|
||||
int
|
||||
cl_omesg(SCR *sp, CL_PRIVATE *clp, int on)
|
||||
@ -351,7 +352,7 @@ cl_omesg(SCR *sp, CL_PRIVATE *clp, int on)
|
||||
* cl_ssize --
|
||||
* Return the terminal size.
|
||||
*
|
||||
* PUBLIC: int cl_ssize __P((SCR *, int, size_t *, size_t *, int *));
|
||||
* PUBLIC: int cl_ssize(SCR *, int, size_t *, size_t *, int *);
|
||||
*/
|
||||
int
|
||||
cl_ssize(SCR *sp, int sigwinch, size_t *rowp, size_t *colp, int *changedp)
|
||||
@ -467,7 +468,7 @@ noterm: if (row == 0)
|
||||
* cl_putchar --
|
||||
* Function version of putchar, for tputs.
|
||||
*
|
||||
* PUBLIC: int cl_putchar __P((int));
|
||||
* PUBLIC: int cl_putchar(int);
|
||||
*/
|
||||
int
|
||||
cl_putchar(int ch)
|
||||
|
62
cl/extern.h
62
cl/extern.h
@ -1,31 +1,31 @@
|
||||
int cl_waddstr __P((SCR *, const CHAR_T *, size_t));
|
||||
int cl_addstr __P((SCR *, const char *, size_t));
|
||||
int cl_attr __P((SCR *, scr_attr_t, int));
|
||||
int cl_baud __P((SCR *, u_long *));
|
||||
int cl_bell __P((SCR *));
|
||||
int cl_clrtoeol __P((SCR *));
|
||||
int cl_cursor __P((SCR *, size_t *, size_t *));
|
||||
int cl_deleteln __P((SCR *));
|
||||
int cl_discard __P((SCR *, SCR **));
|
||||
int cl_ex_adjust __P((SCR *, exadj_t));
|
||||
int cl_insertln __P((SCR *));
|
||||
int cl_keyval __P((SCR *, scr_keyval_t, CHAR_T *, int *));
|
||||
int cl_move __P((SCR *, size_t, size_t));
|
||||
int cl_refresh __P((SCR *, int));
|
||||
int cl_rename __P((SCR *, char *, int));
|
||||
void cl_setname __P((GS *, char *));
|
||||
int cl_split __P((SCR *, SCR *));
|
||||
int cl_suspend __P((SCR *, int *));
|
||||
void cl_usage __P((void));
|
||||
int sig_init __P((GS *, SCR *));
|
||||
int cl_event __P((SCR *, EVENT *, u_int32_t, int));
|
||||
int cl_screen __P((SCR *, u_int32_t));
|
||||
int cl_quit __P((GS *));
|
||||
int cl_getcap __P((SCR *, char *, char **));
|
||||
int cl_term_init __P((SCR *));
|
||||
int cl_term_end __P((GS *));
|
||||
int cl_fmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
|
||||
int cl_optchange __P((SCR *, int, char *, u_long *));
|
||||
int cl_omesg __P((SCR *, CL_PRIVATE *, int));
|
||||
int cl_ssize __P((SCR *, int, size_t *, size_t *, int *));
|
||||
int cl_putchar __P((int));
|
||||
int cl_waddstr(SCR *, const CHAR_T *, size_t);
|
||||
int cl_addstr(SCR *, const char *, size_t);
|
||||
int cl_attr(SCR *, scr_attr_t, int);
|
||||
int cl_baud(SCR *, u_long *);
|
||||
int cl_bell(SCR *);
|
||||
int cl_clrtoeol(SCR *);
|
||||
int cl_cursor(SCR *, size_t *, size_t *);
|
||||
int cl_deleteln(SCR *);
|
||||
int cl_discard(SCR *, SCR **);
|
||||
int cl_ex_adjust(SCR *, exadj_t);
|
||||
int cl_insertln(SCR *);
|
||||
int cl_keyval(SCR *, scr_keyval_t, CHAR_T *, int *);
|
||||
int cl_move(SCR *, size_t, size_t);
|
||||
int cl_refresh(SCR *, int);
|
||||
int cl_rename(SCR *, char *, int);
|
||||
void cl_setname(GS *, char *);
|
||||
int cl_split(SCR *, SCR *);
|
||||
int cl_suspend(SCR *, int *);
|
||||
void cl_usage(void);
|
||||
int sig_init(GS *, SCR *);
|
||||
int cl_event(SCR *, EVENT *, u_int32_t, int);
|
||||
int cl_screen(SCR *, u_int32_t);
|
||||
int cl_quit(GS *);
|
||||
int cl_getcap(SCR *, char *, char **);
|
||||
int cl_term_init(SCR *);
|
||||
int cl_term_end(GS *);
|
||||
int cl_fmap(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
|
||||
int cl_optchange(SCR *, int, char *, u_long *);
|
||||
int cl_omesg(SCR *, CL_PRIVATE *, int);
|
||||
int cl_ssize(SCR *, int, size_t *, size_t *, int *);
|
||||
int cl_putchar(int);
|
||||
|
@ -23,8 +23,8 @@
|
||||
*/
|
||||
typedef struct _cb CB;
|
||||
typedef struct _csc CSC;
|
||||
typedef struct _conv CONV;
|
||||
typedef struct _conv_win CONVWIN;
|
||||
typedef struct _conv CONV;
|
||||
typedef struct _conv_win CONVWIN;
|
||||
typedef struct _event EVENT;
|
||||
typedef struct _excmd EXCMD;
|
||||
typedef struct _exf EXF;
|
||||
|
536
common/conv.c
536
common/conv.c
@ -12,7 +12,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "$Id: conv.c,v 2.39 2013/07/01 23:28:13 zy Exp $";
|
||||
static const char sccsid[] = "$Id: conv.c,v 2.40 2014/02/27 16:25:29 zy Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -36,35 +36,37 @@ static const char sccsid[] = "$Id: conv.c,v 2.39 2013/07/01 23:28:13 zy Exp $";
|
||||
* codeset --
|
||||
* Get the locale encoding.
|
||||
*
|
||||
* PUBLIC: char * codeset __P((void));
|
||||
* PUBLIC: char * codeset(void);
|
||||
*/
|
||||
char *
|
||||
codeset(void) {
|
||||
static char *cs;
|
||||
codeset(void)
|
||||
{
|
||||
static char *cs;
|
||||
|
||||
if (cs == NULL)
|
||||
cs = nl_langinfo(CODESET);
|
||||
return cs;
|
||||
if (cs == NULL)
|
||||
cs = nl_langinfo(CODESET);
|
||||
|
||||
return cs;
|
||||
}
|
||||
|
||||
#ifdef USE_WIDECHAR
|
||||
static int
|
||||
raw2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
|
||||
size_t *tolen, CHAR_T **dst)
|
||||
raw2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
|
||||
CHAR_T **dst)
|
||||
{
|
||||
int i;
|
||||
CHAR_T **tostr = &cw->bp1.wc;
|
||||
size_t *blen = &cw->blen1;
|
||||
int i;
|
||||
CHAR_T **tostr = &cw->bp1.wc;
|
||||
size_t *blen = &cw->blen1;
|
||||
|
||||
BINC_RETW(NULL, *tostr, *blen, len);
|
||||
BINC_RETW(NULL, *tostr, *blen, len);
|
||||
|
||||
*tolen = len;
|
||||
for (i = 0; i < len; ++i)
|
||||
(*tostr)[i] = (u_char) str[i];
|
||||
*tolen = len;
|
||||
for (i = 0; i < len; ++i)
|
||||
(*tostr)[i] = (u_char) str[i];
|
||||
|
||||
*dst = cw->bp1.wc;
|
||||
*dst = cw->bp1.wc;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define CONV_BUFFER_SIZE 512
|
||||
@ -73,27 +75,27 @@ raw2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
|
||||
* len contains the number of bytes put in the buffer
|
||||
*/
|
||||
#ifdef USE_ICONV
|
||||
#define CONVERT(str, left, src, len) \
|
||||
do { \
|
||||
size_t outleft; \
|
||||
char *bp = buffer; \
|
||||
outleft = CONV_BUFFER_SIZE; \
|
||||
errno = 0; \
|
||||
if (iconv(id, (iconv_src_t)&str, &left, &bp, &outleft) == -1 && \
|
||||
errno != E2BIG) \
|
||||
goto err; \
|
||||
if ((len = CONV_BUFFER_SIZE - outleft) == 0) { \
|
||||
error = -left; \
|
||||
goto err; \
|
||||
} \
|
||||
src = buffer; \
|
||||
} while (0)
|
||||
#define CONVERT(str, left, src, len) \
|
||||
do { \
|
||||
size_t outleft; \
|
||||
char *bp = buffer; \
|
||||
outleft = CONV_BUFFER_SIZE; \
|
||||
errno = 0; \
|
||||
if (iconv(id, (iconv_src_t)&str, &left, &bp, &outleft) \
|
||||
== -1 && errno != E2BIG) \
|
||||
goto err; \
|
||||
if ((len = CONV_BUFFER_SIZE - outleft) == 0) { \
|
||||
error = -left; \
|
||||
goto err; \
|
||||
} \
|
||||
src = buffer; \
|
||||
} while (0)
|
||||
|
||||
#define IC_RESET() \
|
||||
do { \
|
||||
if (id != (iconv_t)-1) \
|
||||
iconv(id, NULL, NULL, NULL, NULL); \
|
||||
} while(0)
|
||||
do { \
|
||||
if (id != (iconv_t)-1) \
|
||||
iconv(id, NULL, NULL, NULL, NULL); \
|
||||
} while(0)
|
||||
#else
|
||||
#define CONVERT(str, left, src, len)
|
||||
#define IC_RESET()
|
||||
@ -101,114 +103,116 @@ raw2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
|
||||
|
||||
static int
|
||||
default_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
|
||||
size_t *tolen, CHAR_T **dst, iconv_t id)
|
||||
size_t *tolen, CHAR_T **dst, iconv_t id)
|
||||
{
|
||||
size_t i = 0, j;
|
||||
CHAR_T **tostr = &cw->bp1.wc;
|
||||
size_t *blen = &cw->blen1;
|
||||
mbstate_t mbs;
|
||||
size_t n;
|
||||
ssize_t nlen = len;
|
||||
char *src = (char *)str;
|
||||
size_t i = 0, j;
|
||||
CHAR_T **tostr = &cw->bp1.wc;
|
||||
size_t *blen = &cw->blen1;
|
||||
mbstate_t mbs;
|
||||
size_t n;
|
||||
ssize_t nlen = len;
|
||||
char *src = (char *)str;
|
||||
#ifdef USE_ICONV
|
||||
char buffer[CONV_BUFFER_SIZE];
|
||||
char buffer[CONV_BUFFER_SIZE];
|
||||
#endif
|
||||
size_t left = len;
|
||||
int error = 1;
|
||||
size_t left = len;
|
||||
int error = 1;
|
||||
|
||||
BZERO(&mbs, 1);
|
||||
BINC_RETW(NULL, *tostr, *blen, nlen);
|
||||
BZERO(&mbs, 1);
|
||||
BINC_RETW(NULL, *tostr, *blen, nlen);
|
||||
|
||||
#ifdef USE_ICONV
|
||||
if (id != (iconv_t)-1)
|
||||
CONVERT(str, left, src, len);
|
||||
if (id != (iconv_t)-1)
|
||||
CONVERT(str, left, src, len);
|
||||
#endif
|
||||
|
||||
for (i = 0, j = 0; j < len; ) {
|
||||
n = mbrtowc((*tostr)+i, src+j, len-j, &mbs);
|
||||
/* NULL character converted */
|
||||
if (n == -2) error = -(len-j);
|
||||
if (n == -1 || n == -2) goto err;
|
||||
if (n == 0) n = 1;
|
||||
j += n;
|
||||
if (++i >= *blen) {
|
||||
nlen += 256;
|
||||
BINC_RETW(NULL, *tostr, *blen, nlen);
|
||||
for (i = 0, j = 0; j < len; ) {
|
||||
n = mbrtowc((*tostr)+i, src+j, len-j, &mbs);
|
||||
/* NULL character converted */
|
||||
if (n == -2)
|
||||
error = -(len-j);
|
||||
if (n == -1 || n == -2)
|
||||
goto err;
|
||||
if (n == 0)
|
||||
n = 1;
|
||||
j += n;
|
||||
if (++i >= *blen) {
|
||||
nlen += 256;
|
||||
BINC_RETW(NULL, *tostr, *blen, nlen);
|
||||
}
|
||||
if (id != (iconv_t)-1 && j == len && left) {
|
||||
CONVERT(str, left, src, len);
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
if (id != (iconv_t)-1 && j == len && left) {
|
||||
CONVERT(str, left, src, len);
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
|
||||
error = 0;
|
||||
error = 0;
|
||||
err:
|
||||
*tolen = i;
|
||||
*dst = cw->bp1.wc;
|
||||
IC_RESET();
|
||||
*tolen = i;
|
||||
*dst = cw->bp1.wc;
|
||||
IC_RESET();
|
||||
|
||||
return error;
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
fe_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
|
||||
size_t *tolen, CHAR_T **dst)
|
||||
fe_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
|
||||
CHAR_T **dst)
|
||||
{
|
||||
return default_char2int(sp, str, len, cw, tolen, dst,
|
||||
sp->conv.id[IC_FE_CHAR2INT]);
|
||||
return default_char2int(sp, str, len, cw, tolen, dst,
|
||||
sp->conv.id[IC_FE_CHAR2INT]);
|
||||
}
|
||||
|
||||
static int
|
||||
ie_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
|
||||
size_t *tolen, CHAR_T **dst)
|
||||
ie_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
|
||||
CHAR_T **dst)
|
||||
{
|
||||
return default_char2int(sp, str, len, cw, tolen, dst,
|
||||
sp->conv.id[IC_IE_CHAR2INT]);
|
||||
return default_char2int(sp, str, len, cw, tolen, dst,
|
||||
sp->conv.id[IC_IE_CHAR2INT]);
|
||||
}
|
||||
|
||||
static int
|
||||
cs_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
|
||||
size_t *tolen, CHAR_T **dst)
|
||||
cs_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
|
||||
CHAR_T **dst)
|
||||
{
|
||||
return default_char2int(sp, str, len, cw, tolen, dst,
|
||||
(iconv_t)-1);
|
||||
return default_char2int(sp, str, len, cw, tolen, dst, (iconv_t)-1);
|
||||
}
|
||||
|
||||
static int
|
||||
int2raw(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
|
||||
size_t *tolen, char **dst)
|
||||
int2raw(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw, size_t *tolen,
|
||||
char **dst)
|
||||
{
|
||||
int i;
|
||||
char **tostr = &cw->bp1.c;
|
||||
size_t *blen = &cw->blen1;
|
||||
int i;
|
||||
char **tostr = &cw->bp1.c;
|
||||
size_t *blen = &cw->blen1;
|
||||
|
||||
BINC_RETC(NULL, *tostr, *blen, len);
|
||||
BINC_RETC(NULL, *tostr, *blen, len);
|
||||
|
||||
*tolen = len;
|
||||
for (i = 0; i < len; ++i)
|
||||
(*tostr)[i] = str[i];
|
||||
*tolen = len;
|
||||
for (i = 0; i < len; ++i)
|
||||
(*tostr)[i] = str[i];
|
||||
|
||||
*dst = cw->bp1.c;
|
||||
*dst = cw->bp1.c;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
default_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
|
||||
size_t *tolen, char **pdst, iconv_t id)
|
||||
size_t *tolen, char **pdst, iconv_t id)
|
||||
{
|
||||
size_t i, j, offset = 0;
|
||||
char **tostr = &cw->bp1.c;
|
||||
size_t *blen = &cw->blen1;
|
||||
mbstate_t mbs;
|
||||
size_t n;
|
||||
ssize_t nlen = len + MB_CUR_MAX;
|
||||
char *dst;
|
||||
size_t buflen;
|
||||
size_t i, j, offset = 0;
|
||||
char **tostr = &cw->bp1.c;
|
||||
size_t *blen = &cw->blen1;
|
||||
mbstate_t mbs;
|
||||
size_t n;
|
||||
ssize_t nlen = len + MB_CUR_MAX;
|
||||
char *dst;
|
||||
size_t buflen;
|
||||
#ifdef USE_ICONV
|
||||
char buffer[CONV_BUFFER_SIZE];
|
||||
char buffer[CONV_BUFFER_SIZE];
|
||||
#endif
|
||||
int error = 1;
|
||||
int error = 1;
|
||||
|
||||
/* convert first len bytes of buffer and append it to cw->bp
|
||||
* len is adjusted => 0
|
||||
@ -217,87 +221,90 @@ default_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
|
||||
*/
|
||||
#ifdef USE_ICONV
|
||||
#define CONVERT2(_buffer, lenp, cw, offset) \
|
||||
do { \
|
||||
char *bp = _buffer; \
|
||||
int ret; \
|
||||
do { \
|
||||
size_t outleft = cw->blen1 - offset; \
|
||||
char *obp = cw->bp1.c + offset; \
|
||||
if (cw->blen1 < offset + MB_CUR_MAX) { \
|
||||
nlen += 256; \
|
||||
BINC_RETC(NULL, cw->bp1.c, cw->blen1, nlen); \
|
||||
} \
|
||||
errno = 0; \
|
||||
ret = iconv(id, (iconv_src_t)&bp, lenp, &obp, &outleft); \
|
||||
if (ret == -1 && errno != E2BIG) \
|
||||
goto err; \
|
||||
offset = cw->blen1 - outleft; \
|
||||
} while (ret != 0); \
|
||||
} while (0)
|
||||
char *bp = _buffer; \
|
||||
int ret; \
|
||||
do { \
|
||||
size_t outleft = cw->blen1 - offset; \
|
||||
char *obp = cw->bp1.c + offset; \
|
||||
if (cw->blen1 < offset + MB_CUR_MAX) { \
|
||||
nlen += 256; \
|
||||
BINC_RETC(NULL, cw->bp1.c, cw->blen1, \
|
||||
nlen); \
|
||||
} \
|
||||
errno = 0; \
|
||||
ret = iconv(id, (iconv_src_t)&bp, lenp, &obp, \
|
||||
&outleft); \
|
||||
if (ret == -1 && errno != E2BIG) \
|
||||
goto err; \
|
||||
offset = cw->blen1 - outleft; \
|
||||
} while (ret != 0); \
|
||||
} while (0)
|
||||
#else
|
||||
#define CONVERT2(_buffer, lenp, cw, offset)
|
||||
#endif
|
||||
|
||||
|
||||
BZERO(&mbs, 1);
|
||||
BINC_RETC(NULL, *tostr, *blen, nlen);
|
||||
dst = *tostr; buflen = *blen;
|
||||
BZERO(&mbs, 1);
|
||||
BINC_RETC(NULL, *tostr, *blen, nlen);
|
||||
dst = *tostr; buflen = *blen;
|
||||
|
||||
#ifdef USE_ICONV
|
||||
if (id != (iconv_t)-1) {
|
||||
dst = buffer; buflen = CONV_BUFFER_SIZE;
|
||||
}
|
||||
if (id != (iconv_t)-1) {
|
||||
dst = buffer; buflen = CONV_BUFFER_SIZE;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0, j = 0; i < len; ++i) {
|
||||
n = wcrtomb(dst+j, str[i], &mbs);
|
||||
if (n == -1) goto err;
|
||||
j += n;
|
||||
if (buflen < j + MB_CUR_MAX) {
|
||||
if (id != (iconv_t)-1) {
|
||||
CONVERT2(buffer, &j, cw, offset);
|
||||
} else {
|
||||
nlen += 256;
|
||||
BINC_RETC(NULL, *tostr, *blen, nlen);
|
||||
dst = *tostr; buflen = *blen;
|
||||
}
|
||||
for (i = 0, j = 0; i < len; ++i) {
|
||||
n = wcrtomb(dst+j, str[i], &mbs);
|
||||
if (n == -1)
|
||||
goto err;
|
||||
j += n;
|
||||
if (buflen < j + MB_CUR_MAX) {
|
||||
if (id != (iconv_t)-1) {
|
||||
CONVERT2(buffer, &j, cw, offset);
|
||||
} else {
|
||||
nlen += 256;
|
||||
BINC_RETC(NULL, *tostr, *blen, nlen);
|
||||
dst = *tostr; buflen = *blen;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
n = wcrtomb(dst+j, L'\0', &mbs);
|
||||
j += n - 1; /* don't count NUL at the end */
|
||||
*tolen = j;
|
||||
|
||||
if (id != (iconv_t)-1) {
|
||||
CONVERT2(buffer, &j, cw, offset);
|
||||
CONVERT2(NULL, NULL, cw, offset); /* back to the initial state */
|
||||
*tolen = offset;
|
||||
}
|
||||
|
||||
error = 0;
|
||||
err:
|
||||
if (error)
|
||||
n = wcrtomb(dst+j, L'\0', &mbs);
|
||||
j += n - 1; /* don't count NUL at the end */
|
||||
*tolen = j;
|
||||
*pdst = cw->bp1.c;
|
||||
IC_RESET();
|
||||
|
||||
return error;
|
||||
if (id != (iconv_t)-1) {
|
||||
CONVERT2(buffer, &j, cw, offset);
|
||||
/* back to the initial state */
|
||||
CONVERT2(NULL, NULL, cw, offset);
|
||||
*tolen = offset;
|
||||
}
|
||||
|
||||
error = 0;
|
||||
err:
|
||||
if (error)
|
||||
*tolen = j;
|
||||
*pdst = cw->bp1.c;
|
||||
IC_RESET();
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
fe_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
|
||||
size_t *tolen, char **dst)
|
||||
size_t *tolen, char **dst)
|
||||
{
|
||||
return default_int2char(sp, str, len, cw, tolen, dst,
|
||||
sp->conv.id[IC_FE_INT2CHAR]);
|
||||
return default_int2char(sp, str, len, cw, tolen, dst,
|
||||
sp->conv.id[IC_FE_INT2CHAR]);
|
||||
}
|
||||
|
||||
static int
|
||||
cs_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
|
||||
size_t *tolen, char **dst)
|
||||
size_t *tolen, char **dst)
|
||||
{
|
||||
return default_int2char(sp, str, len, cw, tolen, dst,
|
||||
(iconv_t)-1);
|
||||
return default_int2char(sp, str, len, cw, tolen, dst, (iconv_t)-1);
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -306,58 +313,58 @@ cs_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
|
||||
* conv_init --
|
||||
* Initialize the iconv environment.
|
||||
*
|
||||
* PUBLIC: void conv_init __P((SCR *, SCR *));
|
||||
* PUBLIC: void conv_init(SCR *, SCR *);
|
||||
*/
|
||||
void
|
||||
conv_init(SCR *orig, SCR *sp)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (orig == NULL)
|
||||
setlocale(LC_ALL, "");
|
||||
if (orig != NULL)
|
||||
BCOPY(&orig->conv, &sp->conv, 1);
|
||||
if (orig == NULL)
|
||||
setlocale(LC_ALL, "");
|
||||
if (orig != NULL)
|
||||
BCOPY(&orig->conv, &sp->conv, 1);
|
||||
#ifdef USE_WIDECHAR
|
||||
else {
|
||||
char *ctype = setlocale(LC_CTYPE, NULL);
|
||||
else {
|
||||
char *ctype = setlocale(LC_CTYPE, NULL);
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* This hack fixes the libncursesw issue on FreeBSD.
|
||||
*/
|
||||
if (!strcmp(ctype, "ko_KR.CP949"))
|
||||
setlocale(LC_CTYPE, "ko_KR.eucKR");
|
||||
else if (!strcmp(ctype, "zh_CN.GB2312"))
|
||||
setlocale(LC_CTYPE, "zh_CN.eucCN");
|
||||
else if (!strcmp(ctype, "zh_CN.GBK"))
|
||||
setlocale(LC_CTYPE, "zh_CN.GB18030");
|
||||
/*
|
||||
* XXX
|
||||
* This hack fixes the libncursesw issue on FreeBSD.
|
||||
*/
|
||||
if (!strcmp(ctype, "ko_KR.CP949"))
|
||||
setlocale(LC_CTYPE, "ko_KR.eucKR");
|
||||
else if (!strcmp(ctype, "zh_CN.GB2312"))
|
||||
setlocale(LC_CTYPE, "zh_CN.eucCN");
|
||||
else if (!strcmp(ctype, "zh_CN.GBK"))
|
||||
setlocale(LC_CTYPE, "zh_CN.GB18030");
|
||||
|
||||
/*
|
||||
* Switch to 8bit mode if locale is C;
|
||||
* LC_CTYPE should be reseted to C if unmatched.
|
||||
*/
|
||||
if (!strcmp(ctype, "C") || !strcmp(ctype, "POSIX")) {
|
||||
sp->conv.sys2int = sp->conv.file2int = raw2int;
|
||||
sp->conv.int2sys = sp->conv.int2file = int2raw;
|
||||
sp->conv.input2int = raw2int;
|
||||
} else {
|
||||
sp->conv.sys2int = cs_char2int;
|
||||
sp->conv.int2sys = cs_int2char;
|
||||
sp->conv.file2int = fe_char2int;
|
||||
sp->conv.int2file = fe_int2char;
|
||||
sp->conv.input2int = ie_char2int;
|
||||
/*
|
||||
* Switch to 8bit mode if locale is C;
|
||||
* LC_CTYPE should be reseted to C if unmatched.
|
||||
*/
|
||||
if (!strcmp(ctype, "C") || !strcmp(ctype, "POSIX")) {
|
||||
sp->conv.sys2int = sp->conv.file2int = raw2int;
|
||||
sp->conv.int2sys = sp->conv.int2file = int2raw;
|
||||
sp->conv.input2int = raw2int;
|
||||
} else {
|
||||
sp->conv.sys2int = cs_char2int;
|
||||
sp->conv.int2sys = cs_int2char;
|
||||
sp->conv.file2int = fe_char2int;
|
||||
sp->conv.int2file = fe_int2char;
|
||||
sp->conv.input2int = ie_char2int;
|
||||
}
|
||||
#ifdef USE_ICONV
|
||||
o_set(sp, O_INPUTENCODING, OS_STRDUP, codeset(), 0);
|
||||
#endif
|
||||
}
|
||||
#ifdef USE_ICONV
|
||||
o_set(sp, O_INPUTENCODING, OS_STRDUP, codeset(), 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* iconv descriptors must be distinct to screens. */
|
||||
for (i = 0; i <= IC_IE_TO_UTF16; ++i)
|
||||
sp->conv.id[i] = (iconv_t)-1;
|
||||
/* iconv descriptors must be distinct to screens. */
|
||||
for (i = 0; i <= IC_IE_TO_UTF16; ++i)
|
||||
sp->conv.id[i] = (iconv_t)-1;
|
||||
#ifdef USE_ICONV
|
||||
conv_enc(sp, O_INPUTENCODING, 0);
|
||||
conv_enc(sp, O_INPUTENCODING, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -365,82 +372,99 @@ conv_init(SCR *orig, SCR *sp)
|
||||
* conv_enc --
|
||||
* Convert file/input encoding.
|
||||
*
|
||||
* PUBLIC: int conv_enc __P((SCR *, int, char *));
|
||||
* PUBLIC: int conv_enc(SCR *, int, char *);
|
||||
*/
|
||||
int
|
||||
conv_enc(SCR *sp, int option, char *enc)
|
||||
{
|
||||
#if defined(USE_WIDECHAR) && defined(USE_ICONV)
|
||||
iconv_t *c2w, *w2c;
|
||||
iconv_t *c2w, *w2c;
|
||||
iconv_t id_c2w, id_w2c;
|
||||
|
||||
switch (option) {
|
||||
case O_FILEENCODING:
|
||||
c2w = sp->conv.id + IC_FE_CHAR2INT;
|
||||
w2c = sp->conv.id + IC_FE_INT2CHAR;
|
||||
if (!enc)
|
||||
enc = O_STR(sp, O_FILEENCODING);
|
||||
|
||||
if (strcasecmp(codeset(), enc)) {
|
||||
if ((id_c2w = iconv_open(codeset(), enc)) ==
|
||||
(iconv_t)-1)
|
||||
goto err;
|
||||
if ((id_w2c = iconv_open(enc, codeset())) ==
|
||||
(iconv_t)-1)
|
||||
goto err;
|
||||
} else {
|
||||
id_c2w = (iconv_t)-1;
|
||||
id_w2c = (iconv_t)-1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case O_INPUTENCODING:
|
||||
c2w = sp->conv.id + IC_IE_CHAR2INT;
|
||||
w2c = sp->conv.id + IC_IE_TO_UTF16;
|
||||
if (!enc)
|
||||
enc = O_STR(sp, O_INPUTENCODING);
|
||||
|
||||
if (strcasecmp(codeset(), enc)) {
|
||||
if ((id_c2w = iconv_open(codeset(), enc)) ==
|
||||
(iconv_t)-1)
|
||||
goto err;
|
||||
} else
|
||||
id_c2w = (iconv_t)-1;
|
||||
|
||||
/* UTF-16 can not be locale and can not be inputed. */
|
||||
if ((id_w2c = iconv_open("utf-16be", enc)) == (iconv_t)-1)
|
||||
goto err;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
switch (option) {
|
||||
case O_FILEENCODING:
|
||||
c2w = sp->conv.id + IC_FE_CHAR2INT;
|
||||
w2c = sp->conv.id + IC_FE_INT2CHAR;
|
||||
if (!enc) enc = O_STR(sp, O_FILEENCODING);
|
||||
if (*c2w != (iconv_t)-1)
|
||||
iconv_close(*c2w);
|
||||
iconv_close(*c2w);
|
||||
if (*w2c != (iconv_t)-1)
|
||||
iconv_close(*w2c);
|
||||
if (strcasecmp(codeset(), enc)) {
|
||||
if ((*c2w = iconv_open(codeset(), enc)) == (iconv_t)-1)
|
||||
goto err;
|
||||
if ((*w2c = iconv_open(enc, codeset())) == (iconv_t)-1)
|
||||
goto err;
|
||||
} else *c2w = *w2c = (iconv_t)-1;
|
||||
break;
|
||||
case O_INPUTENCODING:
|
||||
c2w = sp->conv.id + IC_IE_CHAR2INT;
|
||||
w2c = sp->conv.id + IC_IE_TO_UTF16;
|
||||
if (!enc) enc = O_STR(sp, O_INPUTENCODING);
|
||||
if (*c2w != (iconv_t)-1)
|
||||
iconv_close(*c2w);
|
||||
if (*w2c != (iconv_t)-1)
|
||||
iconv_close(*w2c);
|
||||
if (strcasecmp(codeset(), enc)) {
|
||||
if ((*c2w = iconv_open(codeset(), enc)) == (iconv_t)-1)
|
||||
goto err;
|
||||
} else *c2w = (iconv_t)-1;
|
||||
/* UTF-16 can not be locale and can not be inputed. */
|
||||
if ((*w2c = iconv_open("utf-16be", enc)) == (iconv_t)-1)
|
||||
goto err;
|
||||
break;
|
||||
}
|
||||
iconv_close(*w2c);
|
||||
|
||||
F_CLR(sp, SC_CONV_ERROR);
|
||||
F_SET(sp, SC_SCR_REFORMAT);
|
||||
*c2w = id_c2w;
|
||||
*w2c = id_w2c;
|
||||
|
||||
return 0;
|
||||
F_CLR(sp, SC_CONV_ERROR);
|
||||
F_SET(sp, SC_SCR_REFORMAT);
|
||||
|
||||
return 0;
|
||||
err:
|
||||
#endif
|
||||
switch (option) {
|
||||
case O_FILEENCODING:
|
||||
msgq(sp, M_ERR,
|
||||
"321|File encoding conversion not supported");
|
||||
break;
|
||||
case O_INPUTENCODING:
|
||||
msgq(sp, M_ERR,
|
||||
"322|Input encoding conversion not supported");
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
switch (option) {
|
||||
case O_FILEENCODING:
|
||||
msgq(sp, M_ERR, "321|File encoding conversion not supported");
|
||||
break;
|
||||
case O_INPUTENCODING:
|
||||
msgq(sp, M_ERR, "322|Input encoding conversion not supported");
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* conv_end --
|
||||
* Close the iconv descriptors, release the buffer.
|
||||
*
|
||||
* PUBLIC: void conv_end __P((SCR *));
|
||||
* PUBLIC: void conv_end(SCR *);
|
||||
*/
|
||||
void
|
||||
conv_end(SCR *sp)
|
||||
{
|
||||
#if defined(USE_WIDECHAR) && defined(USE_ICONV)
|
||||
int i;
|
||||
for (i = 0; i <= IC_IE_TO_UTF16; ++i)
|
||||
if (sp->conv.id[i] != (iconv_t)-1)
|
||||
iconv_close(sp->conv.id[i]);
|
||||
int i;
|
||||
for (i = 0; i <= IC_IE_TO_UTF16; ++i)
|
||||
if (sp->conv.id[i] != (iconv_t)-1)
|
||||
iconv_close(sp->conv.id[i]);
|
||||
if (sp->cw.bp1.c != NULL)
|
||||
free(sp->cw.bp1.c);
|
||||
free(sp->cw.bp1.c);
|
||||
#endif
|
||||
}
|
||||
|
14
common/cut.c
14
common/cut.c
@ -27,7 +27,7 @@ static const char sccsid[] = "$Id: cut.c,v 10.12 2012/02/11 15:52:33 zy Exp $";
|
||||
|
||||
#include "common.h"
|
||||
|
||||
static void cb_rotate __P((SCR *));
|
||||
static void cb_rotate(SCR *);
|
||||
|
||||
/*
|
||||
* cut --
|
||||
@ -61,7 +61,7 @@ static void cb_rotate __P((SCR *));
|
||||
* replacing the contents. Hopefully it's not worth getting right, and here
|
||||
* we just treat the numeric buffers like any other named buffer.
|
||||
*
|
||||
* PUBLIC: int cut __P((SCR *, CHAR_T *, MARK *, MARK *, int));
|
||||
* PUBLIC: int cut(SCR *, CHAR_T *, MARK *, MARK *, int);
|
||||
*/
|
||||
int
|
||||
cut(
|
||||
@ -222,7 +222,7 @@ cb_rotate(SCR *sp)
|
||||
* cut_line --
|
||||
* Cut a portion of a single line.
|
||||
*
|
||||
* PUBLIC: int cut_line __P((SCR *, recno_t, size_t, size_t, CB *));
|
||||
* PUBLIC: int cut_line(SCR *, recno_t, size_t, size_t, CB *);
|
||||
*/
|
||||
int
|
||||
cut_line(
|
||||
@ -266,7 +266,7 @@ cut_line(
|
||||
* cut_close --
|
||||
* Discard all cut buffers.
|
||||
*
|
||||
* PUBLIC: void cut_close __P((GS *));
|
||||
* PUBLIC: void cut_close(GS *);
|
||||
*/
|
||||
void
|
||||
cut_close(GS *gp)
|
||||
@ -291,7 +291,7 @@ cut_close(GS *gp)
|
||||
* text_init --
|
||||
* Allocate a new TEXT structure.
|
||||
*
|
||||
* PUBLIC: TEXT *text_init __P((SCR *, const CHAR_T *, size_t, size_t));
|
||||
* PUBLIC: TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t);
|
||||
*/
|
||||
TEXT *
|
||||
text_init(
|
||||
@ -323,7 +323,7 @@ text_init(
|
||||
* text_lfree --
|
||||
* Free a chain of text structures.
|
||||
*
|
||||
* PUBLIC: void text_lfree __P((TEXTH *));
|
||||
* PUBLIC: void text_lfree(TEXTH *);
|
||||
*/
|
||||
void
|
||||
text_lfree(TEXTH *headp)
|
||||
@ -340,7 +340,7 @@ text_lfree(TEXTH *headp)
|
||||
* text_free --
|
||||
* Free a text structure.
|
||||
*
|
||||
* PUBLIC: void text_free __P((TEXT *));
|
||||
* PUBLIC: void text_free(TEXT *);
|
||||
*/
|
||||
void
|
||||
text_free(TEXT *tp)
|
||||
|
@ -30,7 +30,7 @@ static const char sccsid[] = "$Id: delete.c,v 10.18 2012/02/11 15:52:33 zy Exp $
|
||||
* del --
|
||||
* Delete a range of text.
|
||||
*
|
||||
* PUBLIC: int del __P((SCR *, MARK *, MARK *, int));
|
||||
* PUBLIC: int del(SCR *, MARK *, MARK *, int);
|
||||
*/
|
||||
int
|
||||
del(
|
||||
|
@ -11,10 +11,10 @@ static const char sccsid[] = "$Id: encoding.c,v 1.4 2011/12/13 19:40:52 zy Exp $
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
int looks_utf8 __P((const char *, size_t));
|
||||
int looks_utf16 __P((const char *, size_t));
|
||||
int decode_utf8 __P((const char *));
|
||||
int decode_utf16 __P((const char *, int));
|
||||
int looks_utf8(const char *, size_t);
|
||||
int looks_utf16(const char *, size_t);
|
||||
int decode_utf8(const char *);
|
||||
int decode_utf16(const char *, int);
|
||||
|
||||
#define F 0 /* character never appears in text */
|
||||
#define T 1 /* character appears in plain ASCII text */
|
||||
@ -54,7 +54,7 @@ static char text_chars[256] = {
|
||||
*
|
||||
* Based on RFC 3629. UTF-8 with BOM is not accepted.
|
||||
*
|
||||
* PUBLIC: int looks_utf8 __P((const char *, size_t));
|
||||
* PUBLIC: int looks_utf8(const char *, size_t);
|
||||
*/
|
||||
int
|
||||
looks_utf8(const char *ibuf, size_t nbytes)
|
||||
@ -115,7 +115,7 @@ looks_utf8(const char *ibuf, size_t nbytes)
|
||||
* 1: Little-endian UTF-16
|
||||
* 2: Big-endian UTF-16
|
||||
*
|
||||
* PUBLIC: int looks_utf16 __P((const char *, size_t));
|
||||
* PUBLIC: int looks_utf16(const char *, size_t);
|
||||
*/
|
||||
int
|
||||
looks_utf16(const char *ibuf, size_t nbytes)
|
||||
@ -175,9 +175,11 @@ looks_utf16(const char *ibuf, size_t nbytes)
|
||||
*
|
||||
* Based on RFC 3629, but without error detection.
|
||||
*
|
||||
* PUBLIC: int decode_utf8 __P((const char *));
|
||||
* PUBLIC: int decode_utf8(const char *);
|
||||
*/
|
||||
int decode_utf8(const char *ibuf) {
|
||||
int
|
||||
decode_utf8(const char *ibuf)
|
||||
{
|
||||
const u_char *buf = (u_char *)ibuf;
|
||||
int u = -1;
|
||||
|
||||
@ -194,6 +196,7 @@ int decode_utf8(const char *ibuf) {
|
||||
u = (buf[0] ^ 0xF0) << 18 ^ (buf[1] ^ 0x80) << 12
|
||||
^ (buf[2] ^ 0x80) << 6 ^ (buf[3] ^ 0x80);
|
||||
}
|
||||
|
||||
return u;
|
||||
}
|
||||
|
||||
@ -204,9 +207,11 @@ int decode_utf8(const char *ibuf) {
|
||||
*
|
||||
* No error detection on supplementary bytes.
|
||||
*
|
||||
* PUBLIC: int decode_utf16 __P((const char *, int));
|
||||
* PUBLIC: int decode_utf16(const char *, int);
|
||||
*/
|
||||
int decode_utf16(const char* ibuf, int bigend) {
|
||||
int
|
||||
decode_utf16(const char* ibuf, int bigend)
|
||||
{
|
||||
const u_char *buf = (u_char *)ibuf;
|
||||
int u = -1;
|
||||
unsigned int w1, w2;
|
||||
@ -226,5 +231,6 @@ int decode_utf16(const char* ibuf, int bigend) {
|
||||
w2 = buf[2] ^ buf[3] << 8;
|
||||
u = ((w1 ^ 0xD800) << 10 ^ (w2 ^ 0xDC00)) + 0x10000;
|
||||
}
|
||||
|
||||
return u;
|
||||
}
|
||||
|
41
common/exf.c
41
common/exf.c
@ -10,7 +10,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "$Id: exf.c,v 10.62 2013/07/01 23:28:13 zy Exp $";
|
||||
static const char sccsid[] = "$Id: exf.c,v 10.64 2015/04/05 15:21:55 zy Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -37,11 +37,11 @@ static const char sccsid[] = "$Id: exf.c,v 10.62 2013/07/01 23:28:13 zy Exp $";
|
||||
|
||||
#include "common.h"
|
||||
|
||||
static int file_backup __P((SCR *, char *, char *));
|
||||
static void file_cinit __P((SCR *));
|
||||
static void file_encinit __P((SCR *));
|
||||
static void file_comment __P((SCR *));
|
||||
static int file_spath __P((SCR *, FREF *, struct stat *, int *));
|
||||
static int file_backup(SCR *, char *, char *);
|
||||
static void file_cinit(SCR *);
|
||||
static void file_encinit(SCR *);
|
||||
static void file_comment(SCR *);
|
||||
static int file_spath(SCR *, FREF *, struct stat *, int *);
|
||||
|
||||
/*
|
||||
* file_add --
|
||||
@ -56,7 +56,7 @@ static int file_spath __P((SCR *, FREF *, struct stat *, int *));
|
||||
* vi now remembers the last location in any file that it has ever edited,
|
||||
* not just the previously edited file.
|
||||
*
|
||||
* PUBLIC: FREF *file_add __P((SCR *, char *));
|
||||
* PUBLIC: FREF *file_add(SCR *, char *);
|
||||
*/
|
||||
FREF *
|
||||
file_add(
|
||||
@ -118,7 +118,7 @@ file_add(
|
||||
* let go of any previous file. Don't release the previous file until
|
||||
* absolutely sure we have the new one.
|
||||
*
|
||||
* PUBLIC: int file_init __P((SCR *, FREF *, char *, int));
|
||||
* PUBLIC: int file_init(SCR *, FREF *, char *, int);
|
||||
*/
|
||||
int
|
||||
file_init(
|
||||
@ -259,6 +259,8 @@ file_init(
|
||||
DB_RECNO, &oinfo)) == NULL) {
|
||||
msgq_str(sp,
|
||||
M_SYSERR, rcv_name == NULL ? oname : rcv_name, "%s");
|
||||
if (F_ISSET(frp, FR_NEWFILE))
|
||||
goto err;
|
||||
/*
|
||||
* !!!
|
||||
* Historically, vi permitted users to edit files that couldn't
|
||||
@ -340,6 +342,8 @@ file_init(
|
||||
break;
|
||||
case LOCK_UNAVAIL:
|
||||
readonly = 1;
|
||||
if (F_ISSET(sp, SC_READONLY))
|
||||
break;
|
||||
msgq_str(sp, M_INFO, oname,
|
||||
"239|%s already locked, session is read-only");
|
||||
break;
|
||||
@ -625,7 +629,7 @@ file_cinit(SCR *sp)
|
||||
* file_end --
|
||||
* Stop editing a file.
|
||||
*
|
||||
* PUBLIC: int file_end __P((SCR *, EXF *, int));
|
||||
* PUBLIC: int file_end(SCR *, EXF *, int);
|
||||
*/
|
||||
int
|
||||
file_end(
|
||||
@ -737,7 +741,7 @@ file_end(
|
||||
* semantics for whether or not writes would happen. That's
|
||||
* why all the flags.
|
||||
*
|
||||
* PUBLIC: int file_write __P((SCR *, MARK *, MARK *, char *, int));
|
||||
* PUBLIC: int file_write(SCR *, MARK *, MARK *, char *, int);
|
||||
*/
|
||||
int
|
||||
file_write(
|
||||
@ -841,7 +845,6 @@ file_write(
|
||||
return (1);
|
||||
|
||||
/* Open the file. */
|
||||
SIGBLOCK;
|
||||
if ((fd = open(name, oflags,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) < 0) {
|
||||
if (errno == EACCES && LF_ISSET(FS_FORCE)) {
|
||||
@ -873,11 +876,9 @@ file_write(
|
||||
errno = EACCES;
|
||||
}
|
||||
msgq_str(sp, M_SYSERR, name, "%s");
|
||||
SIGUNBLOCK;
|
||||
return (1);
|
||||
}
|
||||
success_open:
|
||||
SIGUNBLOCK;
|
||||
|
||||
/* Try and get a lock. */
|
||||
if (!noname && file_lock(sp, NULL, fd, 0) == LOCK_UNAVAIL)
|
||||
@ -1246,7 +1247,7 @@ file_encinit(SCR *sp)
|
||||
if (looks_utf8(buf, blen) > 1)
|
||||
o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0);
|
||||
else if (!O_ISSET(sp, O_FILEENCODING) ||
|
||||
!strncasecmp(O_STR(sp, O_FILEENCODING), "utf-8", 5))
|
||||
!strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8"))
|
||||
o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0);
|
||||
|
||||
conv_enc(sp, O_FILEENCODING, 0);
|
||||
@ -1302,7 +1303,7 @@ file_comment(SCR *sp)
|
||||
* First modification check routine. The :next, :prev, :rewind, :tag,
|
||||
* :tagpush, :tagpop, ^^ modifications check.
|
||||
*
|
||||
* PUBLIC: int file_m1 __P((SCR *, int, int));
|
||||
* PUBLIC: int file_m1(SCR *, int, int);
|
||||
*/
|
||||
int
|
||||
file_m1(
|
||||
@ -1343,7 +1344,7 @@ file_m1(
|
||||
* Second modification check routine. The :edit, :quit, :recover
|
||||
* modifications check.
|
||||
*
|
||||
* PUBLIC: int file_m2 __P((SCR *, int));
|
||||
* PUBLIC: int file_m2(SCR *, int);
|
||||
*/
|
||||
int
|
||||
file_m2(
|
||||
@ -1375,7 +1376,7 @@ file_m2(
|
||||
* file_m3 --
|
||||
* Third modification check routine.
|
||||
*
|
||||
* PUBLIC: int file_m3 __P((SCR *, int));
|
||||
* PUBLIC: int file_m3(SCR *, int);
|
||||
*/
|
||||
int
|
||||
file_m3(
|
||||
@ -1411,7 +1412,7 @@ file_m3(
|
||||
* is not set, write the file. A routine so there's a place to put the
|
||||
* comment.
|
||||
*
|
||||
* PUBLIC: int file_aw __P((SCR *, int));
|
||||
* PUBLIC: int file_aw(SCR *, int);
|
||||
*/
|
||||
int
|
||||
file_aw(
|
||||
@ -1472,7 +1473,7 @@ file_aw(
|
||||
* If the user edits a temporary file, there may be times when there is no
|
||||
* alternative file name. A name argument of NULL turns it off.
|
||||
*
|
||||
* PUBLIC: void set_alt_name __P((SCR *, char *));
|
||||
* PUBLIC: void set_alt_name(SCR *, char *);
|
||||
*/
|
||||
void
|
||||
set_alt_name(
|
||||
@ -1491,7 +1492,7 @@ set_alt_name(
|
||||
* file_lock --
|
||||
* Get an exclusive lock on a file.
|
||||
*
|
||||
* PUBLIC: lockr_t file_lock __P((SCR *, char *, int, int));
|
||||
* PUBLIC: lockr_t file_lock(SCR *, char *, int, int);
|
||||
*/
|
||||
lockr_t
|
||||
file_lock(
|
||||
|
262
common/extern.h
262
common/extern.h
@ -1,132 +1,132 @@
|
||||
char * codeset __P((void));
|
||||
void conv_init __P((SCR *, SCR *));
|
||||
int conv_enc __P((SCR *, int, char *));
|
||||
void conv_end __P((SCR *));
|
||||
int cut __P((SCR *, CHAR_T *, MARK *, MARK *, int));
|
||||
int cut_line __P((SCR *, recno_t, size_t, size_t, CB *));
|
||||
void cut_close __P((GS *));
|
||||
TEXT *text_init __P((SCR *, const CHAR_T *, size_t, size_t));
|
||||
void text_lfree __P((TEXTH *));
|
||||
void text_free __P((TEXT *));
|
||||
int del __P((SCR *, MARK *, MARK *, int));
|
||||
int looks_utf8 __P((const char *, size_t));
|
||||
int looks_utf16 __P((const char *, size_t));
|
||||
int decode_utf8 __P((const char *));
|
||||
int decode_utf16 __P((const char *, int));
|
||||
FREF *file_add __P((SCR *, char *));
|
||||
int file_init __P((SCR *, FREF *, char *, int));
|
||||
int file_end __P((SCR *, EXF *, int));
|
||||
int file_write __P((SCR *, MARK *, MARK *, char *, int));
|
||||
int file_m1 __P((SCR *, int, int));
|
||||
int file_m2 __P((SCR *, int));
|
||||
int file_m3 __P((SCR *, int));
|
||||
int file_aw __P((SCR *, int));
|
||||
void set_alt_name __P((SCR *, char *));
|
||||
lockr_t file_lock __P((SCR *, char *, int, int));
|
||||
int v_key_init __P((SCR *));
|
||||
void v_key_ilookup __P((SCR *));
|
||||
size_t v_key_len __P((SCR *, ARG_CHAR_T));
|
||||
char *v_key_name __P((SCR *, ARG_CHAR_T));
|
||||
e_key_t v_key_val __P((SCR *, ARG_CHAR_T));
|
||||
int v_event_push __P((SCR *, EVENT *, CHAR_T *, size_t, u_int));
|
||||
int v_event_get __P((SCR *, EVENT *, int, u_int32_t));
|
||||
void v_event_err __P((SCR *, EVENT *));
|
||||
int v_event_flush __P((SCR *, u_int));
|
||||
int db_eget __P((SCR *, recno_t, CHAR_T **, size_t *, int *));
|
||||
int db_get __P((SCR *, recno_t, u_int32_t, CHAR_T **, size_t *));
|
||||
int db_delete __P((SCR *, recno_t));
|
||||
int db_append __P((SCR *, int, recno_t, CHAR_T *, size_t));
|
||||
int db_insert __P((SCR *, recno_t, CHAR_T *, size_t));
|
||||
int db_set __P((SCR *, recno_t, CHAR_T *, size_t));
|
||||
int db_exist __P((SCR *, recno_t));
|
||||
int db_last __P((SCR *, recno_t *));
|
||||
int db_rget __P((SCR *, recno_t, char **, size_t *));
|
||||
int db_rset __P((SCR *, recno_t, char *, size_t));
|
||||
void db_err __P((SCR *, recno_t));
|
||||
int log_init __P((SCR *, EXF *));
|
||||
int log_end __P((SCR *, EXF *));
|
||||
int log_cursor __P((SCR *));
|
||||
int log_line __P((SCR *, recno_t, u_int));
|
||||
int log_mark __P((SCR *, LMARK *));
|
||||
int log_backward __P((SCR *, MARK *));
|
||||
int log_setline __P((SCR *));
|
||||
int log_forward __P((SCR *, MARK *));
|
||||
int editor __P((GS *, int, char *[]));
|
||||
void v_end __P((GS *));
|
||||
int mark_init __P((SCR *, EXF *));
|
||||
int mark_end __P((SCR *, EXF *));
|
||||
int mark_get __P((SCR *, ARG_CHAR_T, MARK *, mtype_t));
|
||||
int mark_set __P((SCR *, ARG_CHAR_T, MARK *, int));
|
||||
int mark_insdel __P((SCR *, lnop_t, recno_t));
|
||||
void msgq __P((SCR *, mtype_t, const char *, ...));
|
||||
void msgq_wstr __P((SCR *, mtype_t, const CHAR_T *, const char *));
|
||||
void msgq_str __P((SCR *, mtype_t, const char *, const char *));
|
||||
void mod_rpt __P((SCR *));
|
||||
void msgq_status __P((SCR *, recno_t, u_int));
|
||||
int msg_open __P((SCR *, char *));
|
||||
void msg_close __P((GS *));
|
||||
const char *msg_cmsg __P((SCR *, cmsg_t, size_t *));
|
||||
const char *msg_cat __P((SCR *, const char *, size_t *));
|
||||
char *msg_print __P((SCR *, const char *, int *));
|
||||
int opts_init __P((SCR *, int *));
|
||||
int opts_set __P((SCR *, ARGS *[], char *));
|
||||
int o_set __P((SCR *, int, u_int, char *, u_long));
|
||||
int opts_empty __P((SCR *, int, int));
|
||||
void opts_dump __P((SCR *, enum optdisp));
|
||||
int opts_save __P((SCR *, FILE *));
|
||||
OPTLIST const *opts_search __P((CHAR_T *));
|
||||
void opts_nomatch __P((SCR *, CHAR_T *));
|
||||
int opts_copy __P((SCR *, SCR *));
|
||||
void opts_free __P((SCR *));
|
||||
int f_altwerase __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_columns __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_lines __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_lisp __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_msgcat __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_print __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_readonly __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_recompile __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_reformat __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_ttywerase __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_w300 __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_w1200 __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_w9600 __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_window __P((SCR *, OPTION *, char *, u_long *));
|
||||
int f_encoding __P((SCR *, OPTION *, char *, u_long *));
|
||||
int put __P((SCR *, CB *, CHAR_T *, MARK *, MARK *, int));
|
||||
int rcv_tmp __P((SCR *, EXF *, char *));
|
||||
int rcv_init __P((SCR *));
|
||||
int rcv_sync __P((SCR *, u_int));
|
||||
int rcv_list __P((SCR *));
|
||||
int rcv_read __P((SCR *, FREF *));
|
||||
int screen_init __P((GS *, SCR *, SCR **));
|
||||
int screen_end __P((SCR *));
|
||||
SCR *screen_next __P((SCR *));
|
||||
int f_search __P((SCR *,
|
||||
MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int));
|
||||
int b_search __P((SCR *,
|
||||
MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int));
|
||||
void search_busy __P((SCR *, busy_t));
|
||||
int seq_set __P((SCR *, CHAR_T *,
|
||||
size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int));
|
||||
int seq_delete __P((SCR *, CHAR_T *, size_t, seq_t));
|
||||
int seq_free __P((SEQ *));
|
||||
char * codeset(void);
|
||||
void conv_init(SCR *, SCR *);
|
||||
int conv_enc(SCR *, int, char *);
|
||||
void conv_end(SCR *);
|
||||
int cut(SCR *, CHAR_T *, MARK *, MARK *, int);
|
||||
int cut_line(SCR *, recno_t, size_t, size_t, CB *);
|
||||
void cut_close(GS *);
|
||||
TEXT *text_init(SCR *, const CHAR_T *, size_t, size_t);
|
||||
void text_lfree(TEXTH *);
|
||||
void text_free(TEXT *);
|
||||
int del(SCR *, MARK *, MARK *, int);
|
||||
int looks_utf8(const char *, size_t);
|
||||
int looks_utf16(const char *, size_t);
|
||||
int decode_utf8(const char *);
|
||||
int decode_utf16(const char *, int);
|
||||
FREF *file_add(SCR *, char *);
|
||||
int file_init(SCR *, FREF *, char *, int);
|
||||
int file_end(SCR *, EXF *, int);
|
||||
int file_write(SCR *, MARK *, MARK *, char *, int);
|
||||
int file_m1(SCR *, int, int);
|
||||
int file_m2(SCR *, int);
|
||||
int file_m3(SCR *, int);
|
||||
int file_aw(SCR *, int);
|
||||
void set_alt_name(SCR *, char *);
|
||||
lockr_t file_lock(SCR *, char *, int, int);
|
||||
int v_key_init(SCR *);
|
||||
void v_key_ilookup(SCR *);
|
||||
size_t v_key_len(SCR *, ARG_CHAR_T);
|
||||
char *v_key_name(SCR *, ARG_CHAR_T);
|
||||
e_key_t v_key_val(SCR *, ARG_CHAR_T);
|
||||
int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int);
|
||||
int v_event_get(SCR *, EVENT *, int, u_int32_t);
|
||||
void v_event_err(SCR *, EVENT *);
|
||||
int v_event_flush(SCR *, u_int);
|
||||
int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *);
|
||||
int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *);
|
||||
int db_delete(SCR *, recno_t);
|
||||
int db_append(SCR *, int, recno_t, CHAR_T *, size_t);
|
||||
int db_insert(SCR *, recno_t, CHAR_T *, size_t);
|
||||
int db_set(SCR *, recno_t, CHAR_T *, size_t);
|
||||
int db_exist(SCR *, recno_t);
|
||||
int db_last(SCR *, recno_t *);
|
||||
int db_rget(SCR *, recno_t, char **, size_t *);
|
||||
int db_rset(SCR *, recno_t, char *, size_t);
|
||||
void db_err(SCR *, recno_t);
|
||||
int log_init(SCR *, EXF *);
|
||||
int log_end(SCR *, EXF *);
|
||||
int log_cursor(SCR *);
|
||||
int log_line(SCR *, recno_t, u_int);
|
||||
int log_mark(SCR *, LMARK *);
|
||||
int log_backward(SCR *, MARK *);
|
||||
int log_setline(SCR *);
|
||||
int log_forward(SCR *, MARK *);
|
||||
int editor(GS *, int, char *[]);
|
||||
void v_end(GS *);
|
||||
int mark_init(SCR *, EXF *);
|
||||
int mark_end(SCR *, EXF *);
|
||||
int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t);
|
||||
int mark_set(SCR *, ARG_CHAR_T, MARK *, int);
|
||||
int mark_insdel(SCR *, lnop_t, recno_t);
|
||||
void msgq(SCR *, mtype_t, const char *, ...);
|
||||
void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *);
|
||||
void msgq_str(SCR *, mtype_t, const char *, const char *);
|
||||
void mod_rpt(SCR *);
|
||||
void msgq_status(SCR *, recno_t, u_int);
|
||||
int msg_open(SCR *, char *);
|
||||
void msg_close(GS *);
|
||||
const char *msg_cmsg(SCR *, cmsg_t, size_t *);
|
||||
const char *msg_cat(SCR *, const char *, size_t *);
|
||||
char *msg_print(SCR *, const char *, int *);
|
||||
int opts_init(SCR *, int *);
|
||||
int opts_set(SCR *, ARGS *[], char *);
|
||||
int o_set(SCR *, int, u_int, char *, u_long);
|
||||
int opts_empty(SCR *, int, int);
|
||||
void opts_dump(SCR *, enum optdisp);
|
||||
int opts_save(SCR *, FILE *);
|
||||
OPTLIST const *opts_search(CHAR_T *);
|
||||
void opts_nomatch(SCR *, CHAR_T *);
|
||||
int opts_copy(SCR *, SCR *);
|
||||
void opts_free(SCR *);
|
||||
int f_altwerase(SCR *, OPTION *, char *, u_long *);
|
||||
int f_columns(SCR *, OPTION *, char *, u_long *);
|
||||
int f_lines(SCR *, OPTION *, char *, u_long *);
|
||||
int f_lisp(SCR *, OPTION *, char *, u_long *);
|
||||
int f_msgcat(SCR *, OPTION *, char *, u_long *);
|
||||
int f_print(SCR *, OPTION *, char *, u_long *);
|
||||
int f_readonly(SCR *, OPTION *, char *, u_long *);
|
||||
int f_recompile(SCR *, OPTION *, char *, u_long *);
|
||||
int f_reformat(SCR *, OPTION *, char *, u_long *);
|
||||
int f_ttywerase(SCR *, OPTION *, char *, u_long *);
|
||||
int f_w300(SCR *, OPTION *, char *, u_long *);
|
||||
int f_w1200(SCR *, OPTION *, char *, u_long *);
|
||||
int f_w9600(SCR *, OPTION *, char *, u_long *);
|
||||
int f_window(SCR *, OPTION *, char *, u_long *);
|
||||
int f_encoding(SCR *, OPTION *, char *, u_long *);
|
||||
int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int);
|
||||
int rcv_tmp(SCR *, EXF *, char *);
|
||||
int rcv_init(SCR *);
|
||||
int rcv_sync(SCR *, u_int);
|
||||
int rcv_list(SCR *);
|
||||
int rcv_read(SCR *, FREF *);
|
||||
int screen_init(GS *, SCR *, SCR **);
|
||||
int screen_end(SCR *);
|
||||
SCR *screen_next(SCR *);
|
||||
int f_search(SCR *,
|
||||
MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
|
||||
int b_search(SCR *,
|
||||
MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
|
||||
void search_busy(SCR *, busy_t);
|
||||
int seq_set(SCR *, CHAR_T *,
|
||||
size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int);
|
||||
int seq_delete(SCR *, CHAR_T *, size_t, seq_t);
|
||||
int seq_free(SEQ *);
|
||||
SEQ *seq_find
|
||||
__P((SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *));
|
||||
void seq_close __P((GS *));
|
||||
int seq_dump __P((SCR *, seq_t, int));
|
||||
int seq_save __P((SCR *, FILE *, char *, seq_t));
|
||||
int e_memcmp __P((CHAR_T *, EVENT *, size_t));
|
||||
void *binc __P((SCR *, void *, size_t *, size_t));
|
||||
int nonblank __P((SCR *, recno_t, size_t *));
|
||||
char *tail __P((char *));
|
||||
char *join __P((char *, char *));
|
||||
char *expanduser __P((char *));
|
||||
char *quote __P((char *));
|
||||
char *v_strdup __P((SCR *, const char *, size_t));
|
||||
CHAR_T *v_wstrdup __P((SCR *, const CHAR_T *, size_t));
|
||||
enum nresult nget_uslong __P((u_long *, const CHAR_T *, CHAR_T **, int));
|
||||
enum nresult nget_slong __P((long *, const CHAR_T *, CHAR_T **, int));
|
||||
void timepoint_steady __P((struct timespec *));
|
||||
void timepoint_system __P((struct timespec *));
|
||||
void TRACE __P((SCR *, const char *, ...));
|
||||
(SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *);
|
||||
void seq_close(GS *);
|
||||
int seq_dump(SCR *, seq_t, int);
|
||||
int seq_save(SCR *, FILE *, char *, seq_t);
|
||||
int e_memcmp(CHAR_T *, EVENT *, size_t);
|
||||
void *binc(SCR *, void *, size_t *, size_t);
|
||||
int nonblank(SCR *, recno_t, size_t *);
|
||||
char *tail(char *);
|
||||
char *join(char *, char *);
|
||||
char *expanduser(char *);
|
||||
char *quote(char *);
|
||||
char *v_strdup(SCR *, const char *, size_t);
|
||||
CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t);
|
||||
enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int);
|
||||
enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int);
|
||||
void timepoint_steady(struct timespec *);
|
||||
void timepoint_system(struct timespec *);
|
||||
void TRACE(SCR *, const char *, ...);
|
||||
|
70
common/gs.h
70
common/gs.h
@ -144,73 +144,55 @@ struct _gs {
|
||||
|
||||
/* Screen interface functions. */
|
||||
/* Add a string to the screen. */
|
||||
int (*scr_addstr) __P((SCR *, const char *, size_t));
|
||||
int (*scr_addstr)(SCR *, const char *, size_t);
|
||||
/* Add a string to the screen. */
|
||||
int (*scr_waddstr) __P((SCR *, const CHAR_T *, size_t));
|
||||
int (*scr_waddstr)(SCR *, const CHAR_T *, size_t);
|
||||
/* Toggle a screen attribute. */
|
||||
int (*scr_attr) __P((SCR *, scr_attr_t, int));
|
||||
int (*scr_attr)(SCR *, scr_attr_t, int);
|
||||
/* Terminal baud rate. */
|
||||
int (*scr_baud) __P((SCR *, u_long *));
|
||||
int (*scr_baud)(SCR *, u_long *);
|
||||
/* Beep/bell/flash the terminal. */
|
||||
int (*scr_bell) __P((SCR *));
|
||||
int (*scr_bell)(SCR *);
|
||||
/* Display a busy message. */
|
||||
void (*scr_busy) __P((SCR *, const char *, busy_t));
|
||||
void (*scr_busy)(SCR *, const char *, busy_t);
|
||||
/* Prepare child. */
|
||||
int (*scr_child) __P((SCR *));
|
||||
int (*scr_child)(SCR *);
|
||||
/* Clear to the end of the line. */
|
||||
int (*scr_clrtoeol) __P((SCR *));
|
||||
int (*scr_clrtoeol)(SCR *);
|
||||
/* Return the cursor location. */
|
||||
int (*scr_cursor) __P((SCR *, size_t *, size_t *));
|
||||
int (*scr_cursor)(SCR *, size_t *, size_t *);
|
||||
/* Delete a line. */
|
||||
int (*scr_deleteln) __P((SCR *));
|
||||
int (*scr_deleteln)(SCR *);
|
||||
/* Discard a screen. */
|
||||
int (*scr_discard) __P((SCR *, SCR **));
|
||||
int (*scr_discard)(SCR *, SCR **);
|
||||
/* Get a keyboard event. */
|
||||
int (*scr_event) __P((SCR *, EVENT *, u_int32_t, int));
|
||||
int (*scr_event)(SCR *, EVENT *, u_int32_t, int);
|
||||
/* Ex: screen adjustment routine. */
|
||||
int (*scr_ex_adjust) __P((SCR *, exadj_t));
|
||||
int (*scr_ex_adjust)(SCR *, exadj_t);
|
||||
int (*scr_fmap) /* Set a function key. */
|
||||
__P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
|
||||
(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t);
|
||||
/* Get terminal key value. */
|
||||
int (*scr_keyval) __P((SCR *, scr_keyval_t, CHAR_T *, int *));
|
||||
int (*scr_keyval)(SCR *, scr_keyval_t, CHAR_T *, int *);
|
||||
/* Insert a line. */
|
||||
int (*scr_insertln) __P((SCR *));
|
||||
int (*scr_insertln)(SCR *);
|
||||
/* Handle an option change. */
|
||||
int (*scr_optchange) __P((SCR *, int, char *, u_long *));
|
||||
int (*scr_optchange)(SCR *, int, char *, u_long *);
|
||||
/* Move the cursor. */
|
||||
int (*scr_move) __P((SCR *, size_t, size_t));
|
||||
int (*scr_move)(SCR *, size_t, size_t);
|
||||
/* Message or ex output. */
|
||||
void (*scr_msg) __P((SCR *, mtype_t, char *, size_t));
|
||||
void (*scr_msg)(SCR *, mtype_t, char *, size_t);
|
||||
/* Refresh the screen. */
|
||||
int (*scr_refresh) __P((SCR *, int));
|
||||
int (*scr_refresh)(SCR *, int);
|
||||
/* Rename the file. */
|
||||
int (*scr_rename) __P((SCR *, char *, int));
|
||||
int (*scr_rename)(SCR *, char *, int);
|
||||
/* Reply to an event. */
|
||||
int (*scr_reply) __P((SCR *, int, char *));
|
||||
int (*scr_reply)(SCR *, int, char *);
|
||||
/* Set the screen type. */
|
||||
int (*scr_screen) __P((SCR *, u_int32_t));
|
||||
int (*scr_screen)(SCR *, u_int32_t);
|
||||
/* Split the screen. */
|
||||
int (*scr_split) __P((SCR *, SCR *));
|
||||
int (*scr_split)(SCR *, SCR *);
|
||||
/* Suspend the editor. */
|
||||
int (*scr_suspend) __P((SCR *, int *));
|
||||
int (*scr_suspend)(SCR *, int *);
|
||||
/* Print usage message. */
|
||||
void (*scr_usage) __P((void));
|
||||
void (*scr_usage)(void);
|
||||
};
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* Block signals if there are asynchronous events. Used to keep DB system calls
|
||||
* from being interrupted and not restarted, as that will result in consistency
|
||||
* problems. This should be handled by DB.
|
||||
*/
|
||||
#ifdef BLOCK_SIGNALS
|
||||
#include <signal.h>
|
||||
extern sigset_t __sigblockset;
|
||||
#define SIGBLOCK \
|
||||
(void)sigprocmask(SIG_BLOCK, &__sigblockset, NULL)
|
||||
#define SIGUNBLOCK \
|
||||
(void)sigprocmask(SIG_UNBLOCK, &__sigblockset, NULL);
|
||||
#else
|
||||
#define SIGBLOCK
|
||||
#define SIGUNBLOCK
|
||||
#endif
|
||||
|
28
common/key.c
28
common/key.c
@ -30,11 +30,11 @@ static const char sccsid[] = "$Id: key.c,v 10.54 2013/11/13 12:15:27 zy Exp $";
|
||||
#include "common.h"
|
||||
#include "../vi/vi.h"
|
||||
|
||||
static int v_event_append __P((SCR *, EVENT *));
|
||||
static int v_event_grow __P((SCR *, int));
|
||||
static int v_key_cmp __P((const void *, const void *));
|
||||
static void v_keyval __P((SCR *, int, scr_keyval_t));
|
||||
static void v_sync __P((SCR *, int));
|
||||
static int v_event_append(SCR *, EVENT *);
|
||||
static int v_event_grow(SCR *, int);
|
||||
static int v_key_cmp(const void *, const void *);
|
||||
static void v_keyval(SCR *, int, scr_keyval_t);
|
||||
static void v_sync(SCR *, int);
|
||||
|
||||
/*
|
||||
* !!!
|
||||
@ -97,7 +97,7 @@ static int nkeylist =
|
||||
* v_key_init --
|
||||
* Initialize the special key lookup table.
|
||||
*
|
||||
* PUBLIC: int v_key_init __P((SCR *));
|
||||
* PUBLIC: int v_key_init(SCR *);
|
||||
*/
|
||||
int
|
||||
v_key_init(SCR *sp)
|
||||
@ -179,7 +179,7 @@ v_keyval(
|
||||
* v_key_ilookup --
|
||||
* Build the fast-lookup key display array.
|
||||
*
|
||||
* PUBLIC: void v_key_ilookup __P((SCR *));
|
||||
* PUBLIC: void v_key_ilookup(SCR *);
|
||||
*/
|
||||
void
|
||||
v_key_ilookup(SCR *sp)
|
||||
@ -203,7 +203,7 @@ v_key_ilookup(SCR *sp)
|
||||
* Return the length of the string that will display the key.
|
||||
* This routine is the backup for the KEY_LEN() macro.
|
||||
*
|
||||
* PUBLIC: size_t v_key_len __P((SCR *, ARG_CHAR_T));
|
||||
* PUBLIC: size_t v_key_len(SCR *, ARG_CHAR_T);
|
||||
*/
|
||||
size_t
|
||||
v_key_len(
|
||||
@ -219,7 +219,7 @@ v_key_len(
|
||||
* Return the string that will display the key. This routine
|
||||
* is the backup for the KEY_NAME() macro.
|
||||
*
|
||||
* PUBLIC: char *v_key_name __P((SCR *, ARG_CHAR_T));
|
||||
* PUBLIC: char *v_key_name(SCR *, ARG_CHAR_T);
|
||||
*/
|
||||
char *
|
||||
v_key_name(
|
||||
@ -327,7 +327,7 @@ done: sp->cname[sp->clen = len] = '\0';
|
||||
* Fill in the value for a key. This routine is the backup
|
||||
* for the KEY_VAL() macro.
|
||||
*
|
||||
* PUBLIC: e_key_t v_key_val __P((SCR *, ARG_CHAR_T));
|
||||
* PUBLIC: e_key_t v_key_val(SCR *, ARG_CHAR_T);
|
||||
*/
|
||||
e_key_t
|
||||
v_key_val(
|
||||
@ -351,7 +351,7 @@ v_key_val(
|
||||
* an associated flag value, which indicates if it has already been quoted,
|
||||
* and if it is the result of a mapping or an abbreviation.
|
||||
*
|
||||
* PUBLIC: int v_event_push __P((SCR *, EVENT *, CHAR_T *, size_t, u_int));
|
||||
* PUBLIC: int v_event_push(SCR *, EVENT *, CHAR_T *, size_t, u_int);
|
||||
*/
|
||||
int
|
||||
v_event_push(
|
||||
@ -532,7 +532,7 @@ v_event_append(
|
||||
* point. Given that this might make the log grow unacceptably (consider that
|
||||
* cursor keys are done with maps), for now we leave any changes made in place.
|
||||
*
|
||||
* PUBLIC: int v_event_get __P((SCR *, EVENT *, int, u_int32_t));
|
||||
* PUBLIC: int v_event_get(SCR *, EVENT *, int, u_int32_t);
|
||||
*/
|
||||
int
|
||||
v_event_get(
|
||||
@ -771,7 +771,7 @@ v_sync(
|
||||
* v_event_err --
|
||||
* Unexpected event.
|
||||
*
|
||||
* PUBLIC: void v_event_err __P((SCR *, EVENT *));
|
||||
* PUBLIC: void v_event_err(SCR *, EVENT *);
|
||||
*/
|
||||
void
|
||||
v_event_err(
|
||||
@ -821,7 +821,7 @@ v_event_err(
|
||||
* v_event_flush --
|
||||
* Flush any flagged keys, returning if any keys were flushed.
|
||||
*
|
||||
* PUBLIC: int v_event_flush __P((SCR *, u_int));
|
||||
* PUBLIC: int v_event_flush(SCR *, u_int);
|
||||
*/
|
||||
int
|
||||
v_event_flush(
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "$Id: line.c,v 10.26 2011/08/12 12:36:41 zy Exp $";
|
||||
static const char sccsid[] = "$Id: line.c,v 10.27 2015/04/03 14:17:21 zy Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -26,13 +26,13 @@ static const char sccsid[] = "$Id: line.c,v 10.26 2011/08/12 12:36:41 zy Exp $";
|
||||
#include "common.h"
|
||||
#include "../vi/vi.h"
|
||||
|
||||
static int scr_update __P((SCR *, recno_t, lnop_t, int));
|
||||
static int scr_update(SCR *, recno_t, lnop_t, int);
|
||||
|
||||
/*
|
||||
* db_eget --
|
||||
* Front-end to db_get, special case handling for empty files.
|
||||
*
|
||||
* PUBLIC: int db_eget __P((SCR *, recno_t, CHAR_T **, size_t *, int *));
|
||||
* PUBLIC: int db_eget(SCR *, recno_t, CHAR_T **, size_t *, int *);
|
||||
*/
|
||||
int
|
||||
db_eget(
|
||||
@ -76,7 +76,7 @@ db_eget(
|
||||
* Look in the text buffers for a line, followed by the cache, followed
|
||||
* by the database.
|
||||
*
|
||||
* PUBLIC: int db_get __P((SCR *, recno_t, u_int32_t, CHAR_T **, size_t *));
|
||||
* PUBLIC: int db_get(SCR *, recno_t, u_int32_t, CHAR_T **, size_t *);
|
||||
*/
|
||||
int
|
||||
db_get(
|
||||
@ -92,7 +92,6 @@ db_get(
|
||||
recno_t l1, l2;
|
||||
CHAR_T *wp;
|
||||
size_t wlen;
|
||||
size_t nlen;
|
||||
|
||||
/*
|
||||
* The underlying recno stuff handles zero by returning NULL, but
|
||||
@ -152,8 +151,6 @@ db_get(
|
||||
ep->c_lno = OOBLNO;
|
||||
|
||||
nocache:
|
||||
nlen = 1024;
|
||||
retry:
|
||||
/* Get the line from the underlying database. */
|
||||
key.data = &lno;
|
||||
key.size = sizeof(lno);
|
||||
@ -169,11 +166,6 @@ err3: if (lenp != NULL)
|
||||
if (pp != NULL)
|
||||
*pp = NULL;
|
||||
return (1);
|
||||
case 0:
|
||||
if (data.size > nlen) {
|
||||
nlen = data.size;
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
||||
if (FILE2INT(sp, data.data, data.size, wp, wlen)) {
|
||||
@ -207,7 +199,7 @@ err3: if (lenp != NULL)
|
||||
* db_delete --
|
||||
* Delete a line from the file.
|
||||
*
|
||||
* PUBLIC: int db_delete __P((SCR *, recno_t));
|
||||
* PUBLIC: int db_delete(SCR *, recno_t);
|
||||
*/
|
||||
int
|
||||
db_delete(
|
||||
@ -238,13 +230,11 @@ db_delete(
|
||||
/* Update file. */
|
||||
key.data = &lno;
|
||||
key.size = sizeof(lno);
|
||||
SIGBLOCK;
|
||||
if (ep->db->del(ep->db, &key, 0) == 1) {
|
||||
msgq(sp, M_SYSERR,
|
||||
"003|unable to delete line %lu", (u_long)lno);
|
||||
return (1);
|
||||
}
|
||||
SIGUNBLOCK;
|
||||
|
||||
/* Flush the cache, update line count, before screen update. */
|
||||
if (lno <= ep->c_lno)
|
||||
@ -265,7 +255,7 @@ db_delete(
|
||||
* db_append --
|
||||
* Append a line into the file.
|
||||
*
|
||||
* PUBLIC: int db_append __P((SCR *, int, recno_t, CHAR_T *, size_t));
|
||||
* PUBLIC: int db_append(SCR *, int, recno_t, CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
db_append(
|
||||
@ -297,13 +287,11 @@ db_append(
|
||||
key.size = sizeof(lno);
|
||||
data.data = fp;
|
||||
data.size = flen;
|
||||
SIGBLOCK;
|
||||
if (ep->db->put(ep->db, &key, &data, R_IAFTER) == -1) {
|
||||
msgq(sp, M_SYSERR,
|
||||
"004|unable to append to line %lu", (u_long)lno);
|
||||
return (1);
|
||||
}
|
||||
SIGUNBLOCK;
|
||||
|
||||
/* Flush the cache, update line count, before screen update. */
|
||||
if (lno < ep->c_lno)
|
||||
@ -343,7 +331,7 @@ db_append(
|
||||
* db_insert --
|
||||
* Insert a line into the file.
|
||||
*
|
||||
* PUBLIC: int db_insert __P((SCR *, recno_t, CHAR_T *, size_t));
|
||||
* PUBLIC: int db_insert(SCR *, recno_t, CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
db_insert(
|
||||
@ -375,13 +363,11 @@ db_insert(
|
||||
key.size = sizeof(lno);
|
||||
data.data = fp;
|
||||
data.size = flen;
|
||||
SIGBLOCK;
|
||||
if (ep->db->put(ep->db, &key, &data, R_IBEFORE) == -1) {
|
||||
msgq(sp, M_SYSERR,
|
||||
"005|unable to insert at line %lu", (u_long)lno);
|
||||
return (1);
|
||||
}
|
||||
SIGUNBLOCK;
|
||||
|
||||
/* Flush the cache, update line count, before screen update. */
|
||||
if (lno >= ep->c_lno)
|
||||
@ -412,7 +398,7 @@ db_insert(
|
||||
* db_set --
|
||||
* Store a line in the file.
|
||||
*
|
||||
* PUBLIC: int db_set __P((SCR *, recno_t, CHAR_T *, size_t));
|
||||
* PUBLIC: int db_set(SCR *, recno_t, CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
db_set(
|
||||
@ -446,13 +432,11 @@ db_set(
|
||||
key.size = sizeof(lno);
|
||||
data.data = fp;
|
||||
data.size = flen;
|
||||
SIGBLOCK;
|
||||
if (ep->db->put(ep->db, &key, &data, 0) == -1) {
|
||||
msgq(sp, M_SYSERR,
|
||||
"006|unable to store line %lu", (u_long)lno);
|
||||
return (1);
|
||||
}
|
||||
SIGUNBLOCK;
|
||||
|
||||
/* Flush the cache, before logging or screen update. */
|
||||
if (lno == ep->c_lno)
|
||||
@ -474,7 +458,7 @@ db_set(
|
||||
* db_exist --
|
||||
* Return if a line exists.
|
||||
*
|
||||
* PUBLIC: int db_exist __P((SCR *, recno_t));
|
||||
* PUBLIC: int db_exist(SCR *, recno_t);
|
||||
*/
|
||||
int
|
||||
db_exist(
|
||||
@ -509,7 +493,7 @@ db_exist(
|
||||
* db_last --
|
||||
* Return the number of lines in the file.
|
||||
*
|
||||
* PUBLIC: int db_last __P((SCR *, recno_t *));
|
||||
* PUBLIC: int db_last(SCR *, recno_t *);
|
||||
*/
|
||||
int
|
||||
db_last(
|
||||
@ -552,8 +536,6 @@ db_last(
|
||||
case 1:
|
||||
*lnop = 0;
|
||||
return (0);
|
||||
case 0:
|
||||
;
|
||||
}
|
||||
|
||||
memcpy(&lno, key.data, sizeof(lno));
|
||||
@ -581,9 +563,9 @@ db_last(
|
||||
|
||||
/*
|
||||
* db_rget --
|
||||
* Retrieve a raw line from database. No cache, no conversion.
|
||||
* Retrieve a raw line from the database.
|
||||
*
|
||||
* PUBLIC: int db_rget __P((SCR *, recno_t, char **, size_t *));
|
||||
* PUBLIC: int db_rget(SCR *, recno_t, char **, size_t *);
|
||||
*/
|
||||
int
|
||||
db_rget(
|
||||
@ -593,31 +575,26 @@ db_rget(
|
||||
size_t *lenp) /* Length store. */
|
||||
{
|
||||
DBT data, key;
|
||||
EXF *ep;
|
||||
|
||||
/* Check for no underlying file. */
|
||||
if ((ep = sp->ep) == NULL)
|
||||
return (1);
|
||||
EXF *ep = sp->ep;
|
||||
int rval;
|
||||
|
||||
/* Get the line from the underlying database. */
|
||||
key.data = &lno;
|
||||
key.size = sizeof(lno);
|
||||
if (ep->db->get(ep->db, &key, &data, 0))
|
||||
/* We do not report error, and do not ensure the size! */
|
||||
return (1);
|
||||
|
||||
if (lenp != NULL)
|
||||
if ((rval = ep->db->get(ep->db, &key, &data, 0)) == 0)
|
||||
{
|
||||
*lenp = data.size;
|
||||
if (pp != NULL)
|
||||
*pp = data.data;
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (rval);
|
||||
}
|
||||
|
||||
/*
|
||||
* db_rset --
|
||||
* Store a line in the file. No log, no conversion.
|
||||
* Store a raw line into the database.
|
||||
*
|
||||
* PUBLIC: int db_rset __P((SCR *, recno_t, char *, size_t));
|
||||
* PUBLIC: int db_rset(SCR *, recno_t, char *, size_t);
|
||||
*/
|
||||
int
|
||||
db_rset(
|
||||
@ -627,29 +604,21 @@ db_rset(
|
||||
size_t len)
|
||||
{
|
||||
DBT data, key;
|
||||
EXF *ep;
|
||||
EXF *ep = sp->ep;
|
||||
|
||||
/* Check for no underlying file. */
|
||||
if ((ep = sp->ep) == NULL)
|
||||
return (1);
|
||||
|
||||
/* Update file. */
|
||||
key.data = &lno;
|
||||
key.size = sizeof(lno);
|
||||
data.data = p;
|
||||
data.size = len;
|
||||
if (ep->db->put(ep->db, &key, &data, 0) == -1)
|
||||
/* We do not report error, and do not ensure the size! */
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
return ep->db->put(ep->db, &key, &data, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* db_err --
|
||||
* Report a line error.
|
||||
*
|
||||
* PUBLIC: void db_err __P((SCR *, recno_t));
|
||||
* PUBLIC: void db_err(SCR *, recno_t);
|
||||
*/
|
||||
void
|
||||
db_err(
|
||||
|
30
common/log.c
30
common/log.c
@ -63,13 +63,13 @@ static const char sccsid[] = "$Id: log.c,v 10.27 2011/07/13 06:25:50 zy Exp $";
|
||||
* behaved that way.
|
||||
*/
|
||||
|
||||
static int log_cursor1 __P((SCR *, int));
|
||||
static void log_err __P((SCR *, char *, int));
|
||||
static int log_cursor1(SCR *, int);
|
||||
static void log_err(SCR *, char *, int);
|
||||
#if defined(DEBUG) && 0
|
||||
static void log_trace __P((SCR *, char *, recno_t, u_char *));
|
||||
static void log_trace(SCR *, char *, recno_t, u_char *);
|
||||
#endif
|
||||
static int apply_with __P((int (*)(SCR *, recno_t, CHAR_T *, size_t),
|
||||
SCR *, recno_t, u_char *, size_t));
|
||||
static int apply_with(int (*)(SCR *, recno_t, CHAR_T *, size_t),
|
||||
SCR *, recno_t, u_char *, size_t);
|
||||
|
||||
/* Try and restart the log on failure, i.e. if we run out of memory. */
|
||||
#define LOG_ERR { \
|
||||
@ -81,8 +81,8 @@ static int apply_with __P((int (*)(SCR *, recno_t, CHAR_T *, size_t),
|
||||
* because it is passed to db_set as a string
|
||||
*/
|
||||
typedef struct {
|
||||
char data[sizeof(u_char) /* type */ + sizeof(recno_t)];
|
||||
CHAR_T str[1];
|
||||
char data[sizeof(u_char) /* type */ + sizeof(recno_t)];
|
||||
CHAR_T str[1];
|
||||
} log_t;
|
||||
#define CHAR_T_OFFSET ((char *)(((log_t*)0)->str) - (char *)0)
|
||||
|
||||
@ -90,7 +90,7 @@ typedef struct {
|
||||
* log_init --
|
||||
* Initialize the logging subsystem.
|
||||
*
|
||||
* PUBLIC: int log_init __P((SCR *, EXF *));
|
||||
* PUBLIC: int log_init(SCR *, EXF *);
|
||||
*/
|
||||
int
|
||||
log_init(
|
||||
@ -126,7 +126,7 @@ log_init(
|
||||
* log_end --
|
||||
* Close the logging subsystem.
|
||||
*
|
||||
* PUBLIC: int log_end __P((SCR *, EXF *));
|
||||
* PUBLIC: int log_end(SCR *, EXF *);
|
||||
*/
|
||||
int
|
||||
log_end(
|
||||
@ -156,7 +156,7 @@ log_end(
|
||||
* log_cursor --
|
||||
* Log the current cursor position, starting an event.
|
||||
*
|
||||
* PUBLIC: int log_cursor __P((SCR *));
|
||||
* PUBLIC: int log_cursor(SCR *);
|
||||
*/
|
||||
int
|
||||
log_cursor(SCR *sp)
|
||||
@ -221,7 +221,7 @@ log_cursor1(
|
||||
* log_line --
|
||||
* Log a line change.
|
||||
*
|
||||
* PUBLIC: int log_line __P((SCR *, recno_t, u_int));
|
||||
* PUBLIC: int log_line(SCR *, recno_t, u_int);
|
||||
*/
|
||||
int
|
||||
log_line(
|
||||
@ -324,7 +324,7 @@ log_line(
|
||||
* would mean that undo operations would only reset marks, and not
|
||||
* cause any other change.
|
||||
*
|
||||
* PUBLIC: int log_mark __P((SCR *, LMARK *));
|
||||
* PUBLIC: int log_mark(SCR *, LMARK *);
|
||||
*/
|
||||
int
|
||||
log_mark(
|
||||
@ -370,7 +370,7 @@ log_mark(
|
||||
* Log_backward --
|
||||
* Roll the log backward one operation.
|
||||
*
|
||||
* PUBLIC: int log_backward __P((SCR *, MARK *));
|
||||
* PUBLIC: int log_backward(SCR *, MARK *);
|
||||
*/
|
||||
int
|
||||
log_backward(
|
||||
@ -474,7 +474,7 @@ err: F_CLR(ep, F_NOLOG);
|
||||
* then move back on and do a 'U', the line will be restored to the way
|
||||
* it was before the original change.
|
||||
*
|
||||
* PUBLIC: int log_setline __P((SCR *));
|
||||
* PUBLIC: int log_setline(SCR *);
|
||||
*/
|
||||
int
|
||||
log_setline(SCR *sp)
|
||||
@ -558,7 +558,7 @@ err: F_CLR(ep, F_NOLOG);
|
||||
* Log_forward --
|
||||
* Roll the log forward one operation.
|
||||
*
|
||||
* PUBLIC: int log_forward __P((SCR *, MARK *));
|
||||
* PUBLIC: int log_forward(SCR *, MARK *);
|
||||
*/
|
||||
int
|
||||
log_forward(
|
||||
|
@ -9,14 +9,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char copyright[] =
|
||||
"@(#) Copyright (c) 1992, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n\
|
||||
@(#) Copyright (c) 1992, 1993, 1994, 1995, 1996\n\
|
||||
Keith Bostic. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "$Id: main.c,v 11.0 2012/10/17 06:34:37 zy Exp $";
|
||||
#endif /* not lint */
|
||||
@ -38,15 +30,15 @@ static const char sccsid[] = "$Id: main.c,v 11.0 2012/10/17 06:34:37 zy Exp $";
|
||||
#include "../vi/vi.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
static void attach __P((GS *));
|
||||
static void v_estr __P((char *, int, char *));
|
||||
static int v_obsolete __P((char *, char *[]));
|
||||
static void attach(GS *);
|
||||
static void v_estr(char *, int, char *);
|
||||
static int v_obsolete(char *, char *[]);
|
||||
|
||||
/*
|
||||
* editor --
|
||||
* Main editor routine.
|
||||
*
|
||||
* PUBLIC: int editor __P((GS *, int, char *[]));
|
||||
* PUBLIC: int editor(GS *, int, char *[]);
|
||||
*/
|
||||
int
|
||||
editor(
|
||||
@ -436,7 +428,7 @@ err: rval = 1;
|
||||
* v_end --
|
||||
* End the program, discarding screens and most of the global area.
|
||||
*
|
||||
* PUBLIC: void v_end __P((GS *));
|
||||
* PUBLIC: void v_end(GS *);
|
||||
*/
|
||||
void
|
||||
v_end(gp)
|
||||
@ -455,7 +447,7 @@ v_end(gp)
|
||||
while ((sp = TAILQ_FIRST(gp->hq)) != NULL)
|
||||
(void)screen_end(sp);
|
||||
|
||||
#if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY)
|
||||
#if defined(DEBUG) || defined(PURIFY)
|
||||
{ FREF *frp;
|
||||
/* Free FREF's. */
|
||||
while ((frp = TAILQ_FIRST(gp->frefq)) != NULL) {
|
||||
@ -499,13 +491,13 @@ v_end(gp)
|
||||
(void)fprintf(stderr, "%s%.*s",
|
||||
mp->mtype == M_ERR ? "ex/vi: " : "", (int)mp->len, mp->buf);
|
||||
SLIST_REMOVE_HEAD(gp->msgq, q);
|
||||
#if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY)
|
||||
#if defined(DEBUG) || defined(PURIFY)
|
||||
free(mp->buf);
|
||||
free(mp);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY)
|
||||
#if defined(DEBUG) || defined(PURIFY)
|
||||
/* Free any temporary space. */
|
||||
if (gp->tmp_bp != NULL)
|
||||
free(gp->tmp_bp);
|
||||
|
@ -26,7 +26,7 @@ static const char sccsid[] = "$Id: mark.c,v 10.14 2011/07/04 14:42:58 zy Exp $";
|
||||
|
||||
#include "common.h"
|
||||
|
||||
static LMARK *mark_find __P((SCR *, ARG_CHAR_T));
|
||||
static LMARK *mark_find(SCR *, ARG_CHAR_T);
|
||||
|
||||
/*
|
||||
* Marks are maintained in a key sorted singly linked list. We can't
|
||||
@ -63,7 +63,7 @@ static LMARK *mark_find __P((SCR *, ARG_CHAR_T));
|
||||
* mark_init --
|
||||
* Set up the marks.
|
||||
*
|
||||
* PUBLIC: int mark_init __P((SCR *, EXF *));
|
||||
* PUBLIC: int mark_init(SCR *, EXF *);
|
||||
*/
|
||||
int
|
||||
mark_init(
|
||||
@ -84,7 +84,7 @@ mark_init(
|
||||
* mark_end --
|
||||
* Free up the marks.
|
||||
*
|
||||
* PUBLIC: int mark_end __P((SCR *, EXF *));
|
||||
* PUBLIC: int mark_end(SCR *, EXF *);
|
||||
*/
|
||||
int
|
||||
mark_end(
|
||||
@ -108,7 +108,7 @@ mark_end(
|
||||
* mark_get --
|
||||
* Get the location referenced by a mark.
|
||||
*
|
||||
* PUBLIC: int mark_get __P((SCR *, ARG_CHAR_T, MARK *, mtype_t));
|
||||
* PUBLIC: int mark_get(SCR *, ARG_CHAR_T, MARK *, mtype_t);
|
||||
*/
|
||||
int
|
||||
mark_get(
|
||||
@ -125,12 +125,12 @@ mark_get(
|
||||
lmp = mark_find(sp, key);
|
||||
if (lmp == NULL || lmp->name != key) {
|
||||
msgq(sp, mtype, "017|Mark %s: not set", KEY_NAME(sp, key));
|
||||
return (1);
|
||||
return (1);
|
||||
}
|
||||
if (F_ISSET(lmp, MARK_DELETED)) {
|
||||
msgq(sp, mtype,
|
||||
"018|Mark %s: the line was deleted", KEY_NAME(sp, key));
|
||||
return (1);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -153,7 +153,7 @@ mark_get(
|
||||
* mark_set --
|
||||
* Set the location referenced by a mark.
|
||||
*
|
||||
* PUBLIC: int mark_set __P((SCR *, ARG_CHAR_T, MARK *, int));
|
||||
* PUBLIC: int mark_set(SCR *, ARG_CHAR_T, MARK *, int);
|
||||
*/
|
||||
int
|
||||
mark_set(
|
||||
@ -220,7 +220,7 @@ mark_find(
|
||||
* mark_insdel --
|
||||
* Update the marks based on an insertion or deletion.
|
||||
*
|
||||
* PUBLIC: int mark_insdel __P((SCR *, lnop_t, recno_t));
|
||||
* PUBLIC: int mark_insdel(SCR *, lnop_t, recno_t);
|
||||
*/
|
||||
int
|
||||
mark_insdel(
|
||||
|
28
common/msg.c
28
common/msg.c
@ -10,7 +10,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "$Id: msg.c,v 11.0 2012/10/17 06:34:37 zy Exp $";
|
||||
static const char sccsid[] = "$Id: msg.c,v 11.1 2015/02/09 11:12:44 marc Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -36,7 +36,7 @@ static const char sccsid[] = "$Id: msg.c,v 11.0 2012/10/17 06:34:37 zy Exp $";
|
||||
* msgq --
|
||||
* Display a message.
|
||||
*
|
||||
* PUBLIC: void msgq __P((SCR *, mtype_t, const char *, ...));
|
||||
* PUBLIC: void msgq(SCR *, mtype_t, const char *, ...);
|
||||
*/
|
||||
void
|
||||
msgq(
|
||||
@ -60,7 +60,7 @@ msgq(
|
||||
size_t blen, len, mlen, nlen;
|
||||
const char *p;
|
||||
char *bp, *mp;
|
||||
va_list ap;
|
||||
va_list ap;
|
||||
#ifndef NL_ARGMAX
|
||||
int ch;
|
||||
char *rbp, *s_rbp;
|
||||
@ -274,7 +274,7 @@ retry: FREE_SPACE(sp, bp, blen);
|
||||
#ifndef NL_ARGMAX
|
||||
format: /* Format the arguments into the string. */
|
||||
#endif
|
||||
va_start(ap, fmt);
|
||||
va_start(ap, fmt);
|
||||
len = vsnprintf(mp, REM, fmt, ap);
|
||||
va_end(ap);
|
||||
if (len >= nlen)
|
||||
@ -356,7 +356,7 @@ nofmt: mp += len;
|
||||
* msgq_wstr --
|
||||
* Display a message with an embedded string.
|
||||
*
|
||||
* PUBLIC: void msgq_wstr __P((SCR *, mtype_t, const CHAR_T *, const char *));
|
||||
* PUBLIC: void msgq_wstr(SCR *, mtype_t, const CHAR_T *, const char *);
|
||||
*/
|
||||
void
|
||||
msgq_wstr(
|
||||
@ -380,7 +380,7 @@ msgq_wstr(
|
||||
* msgq_str --
|
||||
* Display a message with an embedded string.
|
||||
*
|
||||
* PUBLIC: void msgq_str __P((SCR *, mtype_t, const char *, const char *));
|
||||
* PUBLIC: void msgq_str(SCR *, mtype_t, const char *, const char *);
|
||||
*/
|
||||
void
|
||||
msgq_str(
|
||||
@ -423,7 +423,7 @@ msgq_str(
|
||||
* the command 2d}, from the 'b' would report that two lines were deleted,
|
||||
* not one.
|
||||
*
|
||||
* PUBLIC: void mod_rpt __P((SCR *));
|
||||
* PUBLIC: void mod_rpt(SCR *);
|
||||
*/
|
||||
void
|
||||
mod_rpt(SCR *sp)
|
||||
@ -533,7 +533,7 @@ mod_rpt(SCR *sp)
|
||||
* msgq_status --
|
||||
* Report on the file's status.
|
||||
*
|
||||
* PUBLIC: void msgq_status __P((SCR *, recno_t, u_int));
|
||||
* PUBLIC: void msgq_status(SCR *, recno_t, u_int);
|
||||
*/
|
||||
void
|
||||
msgq_status(
|
||||
@ -647,7 +647,7 @@ msgq_status(
|
||||
p += len;
|
||||
} else {
|
||||
t = msg_cat(sp, "027|line %lu of %lu [%ld%%]", &len);
|
||||
(void)snprintf(p, ep - p, t, lno, last,
|
||||
(void)snprintf(p, ep - p, t, (u_long)lno, (u_long)last,
|
||||
((u_long)lno * 100) / last);
|
||||
p += strlen(p);
|
||||
}
|
||||
@ -705,7 +705,7 @@ msgq_status(
|
||||
* msg_open --
|
||||
* Open the message catalogs.
|
||||
*
|
||||
* PUBLIC: int msg_open __P((SCR *, char *));
|
||||
* PUBLIC: int msg_open(SCR *, char *);
|
||||
*/
|
||||
int
|
||||
msg_open(
|
||||
@ -772,7 +772,7 @@ ret: free(p);
|
||||
* msg_close --
|
||||
* Close the message catalogs.
|
||||
*
|
||||
* PUBLIC: void msg_close __P((GS *));
|
||||
* PUBLIC: void msg_close(GS *);
|
||||
*/
|
||||
void
|
||||
msg_close(GS *gp)
|
||||
@ -785,7 +785,7 @@ msg_close(GS *gp)
|
||||
* msg_cont --
|
||||
* Return common continuation messages.
|
||||
*
|
||||
* PUBLIC: const char *msg_cmsg __P((SCR *, cmsg_t, size_t *));
|
||||
* PUBLIC: const char *msg_cmsg(SCR *, cmsg_t, size_t *);
|
||||
*/
|
||||
const char *
|
||||
msg_cmsg(
|
||||
@ -823,7 +823,7 @@ msg_cmsg(
|
||||
* Only a single catalog message can be accessed at a time, if multiple
|
||||
* ones are needed, they must be copied into local memory.
|
||||
*
|
||||
* PUBLIC: const char *msg_cat __P((SCR *, const char *, size_t *));
|
||||
* PUBLIC: const char *msg_cat(SCR *, const char *, size_t *);
|
||||
*/
|
||||
const char *
|
||||
msg_cat(
|
||||
@ -861,7 +861,7 @@ msg_cat(
|
||||
* msg_print --
|
||||
* Return a printable version of a string, in allocated memory.
|
||||
*
|
||||
* PUBLIC: char *msg_print __P((SCR *, const char *, int *));
|
||||
* PUBLIC: char *msg_print(SCR *, const char *, int *);
|
||||
*/
|
||||
char *
|
||||
msg_print(
|
||||
|
@ -30,9 +30,9 @@ static const char sccsid[] = "$Id: options.c,v 10.73 2012/10/09 06:14:07 zy Exp
|
||||
#include "../vi/vi.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
static int opts_abbcmp __P((const void *, const void *));
|
||||
static int opts_cmp __P((const void *, const void *));
|
||||
static int opts_print __P((SCR *, OPTLIST const *));
|
||||
static int opts_abbcmp(const void *, const void *);
|
||||
static int opts_cmp(const void *, const void *);
|
||||
static int opts_print(SCR *, OPTLIST const *);
|
||||
|
||||
#ifdef USE_WIDECHAR
|
||||
#define OPT_WC 0
|
||||
@ -243,8 +243,8 @@ OPTLIST const optlist[] = {
|
||||
};
|
||||
|
||||
typedef struct abbrev {
|
||||
CHAR_T *name;
|
||||
int offset;
|
||||
CHAR_T *name;
|
||||
int offset;
|
||||
} OABBREV;
|
||||
|
||||
static OABBREV const abbrev[] = {
|
||||
@ -294,7 +294,7 @@ static OABBREV const abbrev[] = {
|
||||
* opts_init --
|
||||
* Initialize some of the options.
|
||||
*
|
||||
* PUBLIC: int opts_init __P((SCR *, int *));
|
||||
* PUBLIC: int opts_init(SCR *, int *);
|
||||
*/
|
||||
int
|
||||
opts_init(
|
||||
@ -460,7 +460,7 @@ err: msgq_wstr(sp, M_ERR, optlist[optindx].name,
|
||||
* opts_set --
|
||||
* Change the values of one or more options.
|
||||
*
|
||||
* PUBLIC: int opts_set __P((SCR *, ARGS *[], char *));
|
||||
* PUBLIC: int opts_set(SCR *, ARGS *[], char *);
|
||||
*/
|
||||
int
|
||||
opts_set(
|
||||
@ -754,7 +754,7 @@ badnum: INT2CHAR(sp, name, STRLEN(name) + 1,
|
||||
* o_set --
|
||||
* Set an option's value.
|
||||
*
|
||||
* PUBLIC: int o_set __P((SCR *, int, u_int, char *, u_long));
|
||||
* PUBLIC: int o_set(SCR *, int, u_int, char *, u_long);
|
||||
*/
|
||||
int
|
||||
o_set(
|
||||
@ -798,7 +798,7 @@ o_set(
|
||||
* opts_empty --
|
||||
* Return 1 if the string option is invalid, 0 if it's OK.
|
||||
*
|
||||
* PUBLIC: int opts_empty __P((SCR *, int, int));
|
||||
* PUBLIC: int opts_empty(SCR *, int, int);
|
||||
*/
|
||||
int
|
||||
opts_empty(
|
||||
@ -821,7 +821,7 @@ opts_empty(
|
||||
* opts_dump --
|
||||
* List the current values of selected options.
|
||||
*
|
||||
* PUBLIC: void opts_dump __P((SCR *, enum optdisp));
|
||||
* PUBLIC: void opts_dump(SCR *, enum optdisp);
|
||||
*/
|
||||
void
|
||||
opts_dump(
|
||||
@ -987,7 +987,7 @@ opts_print(
|
||||
* opts_save --
|
||||
* Write the current configuration to a file.
|
||||
*
|
||||
* PUBLIC: int opts_save __P((SCR *, FILE *));
|
||||
* PUBLIC: int opts_save(SCR *, FILE *);
|
||||
*/
|
||||
int
|
||||
opts_save(
|
||||
@ -1045,7 +1045,7 @@ opts_save(
|
||||
* opts_search --
|
||||
* Search for an option.
|
||||
*
|
||||
* PUBLIC: OPTLIST const *opts_search __P((CHAR_T *));
|
||||
* PUBLIC: OPTLIST const *opts_search(CHAR_T *);
|
||||
*/
|
||||
OPTLIST const *
|
||||
opts_search(CHAR_T *name)
|
||||
@ -1090,7 +1090,7 @@ opts_search(CHAR_T *name)
|
||||
* opts_nomatch --
|
||||
* Standard nomatch error message for options.
|
||||
*
|
||||
* PUBLIC: void opts_nomatch __P((SCR *, CHAR_T *));
|
||||
* PUBLIC: void opts_nomatch(SCR *, CHAR_T *);
|
||||
*/
|
||||
void
|
||||
opts_nomatch(
|
||||
@ -1103,25 +1103,25 @@ opts_nomatch(
|
||||
|
||||
static int
|
||||
opts_abbcmp(
|
||||
const void *a,
|
||||
const void *b)
|
||||
const void *a,
|
||||
const void *b)
|
||||
{
|
||||
return(STRCMP(((OABBREV *)a)->name, ((OABBREV *)b)->name));
|
||||
return(STRCMP(((OABBREV *)a)->name, ((OABBREV *)b)->name));
|
||||
}
|
||||
|
||||
static int
|
||||
opts_cmp(
|
||||
const void *a,
|
||||
const void *b)
|
||||
const void *a,
|
||||
const void *b)
|
||||
{
|
||||
return(STRCMP(((OPTLIST *)a)->name, ((OPTLIST *)b)->name));
|
||||
return(STRCMP(((OPTLIST *)a)->name, ((OPTLIST *)b)->name));
|
||||
}
|
||||
|
||||
/*
|
||||
* opts_copy --
|
||||
* Copy a screen's OPTION array.
|
||||
*
|
||||
* PUBLIC: int opts_copy __P((SCR *, SCR *));
|
||||
* PUBLIC: int opts_copy(SCR *, SCR *);
|
||||
*/
|
||||
int
|
||||
opts_copy(
|
||||
@ -1169,7 +1169,7 @@ nomem: msgq(orig, M_SYSERR, NULL);
|
||||
* opts_free --
|
||||
* Free all option strings
|
||||
*
|
||||
* PUBLIC: void opts_free __P((SCR *));
|
||||
* PUBLIC: void opts_free(SCR *);
|
||||
*/
|
||||
void
|
||||
opts_free(SCR *sp)
|
||||
|
@ -78,7 +78,7 @@ struct _option {
|
||||
struct _optlist {
|
||||
CHAR_T *name; /* Name. */
|
||||
/* Change function. */
|
||||
int (*func) __P((SCR *, OPTION *, char *, u_long *));
|
||||
int (*func)(SCR *, OPTION *, char *, u_long *);
|
||||
/* Type of object. */
|
||||
enum { OPT_0BOOL, OPT_1BOOL, OPT_NUM, OPT_STR } type;
|
||||
|
||||
|
@ -29,7 +29,7 @@ static const char sccsid[] = "$Id: options_f.c,v 10.34 04/07/11 16:06:29 zy Exp
|
||||
#include "common.h"
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_altwerase __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_altwerase(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_altwerase(
|
||||
@ -44,7 +44,7 @@ f_altwerase(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_columns __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_columns(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_columns(
|
||||
@ -78,7 +78,7 @@ f_columns(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_lines __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_lines(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_lines(
|
||||
@ -135,7 +135,7 @@ f_lines(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_lisp __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_lisp(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_lisp(
|
||||
@ -149,7 +149,7 @@ f_lisp(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_msgcat __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_msgcat(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_msgcat(
|
||||
@ -163,7 +163,7 @@ f_msgcat(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_print __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_print(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_print(
|
||||
@ -192,7 +192,7 @@ f_print(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_readonly __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_readonly(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_readonly(
|
||||
@ -213,7 +213,7 @@ f_readonly(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_recompile __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_recompile(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_recompile(
|
||||
@ -234,7 +234,7 @@ f_recompile(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_reformat __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_reformat(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_reformat(
|
||||
@ -248,7 +248,7 @@ f_reformat(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_ttywerase __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_ttywerase(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_ttywerase(
|
||||
@ -263,7 +263,7 @@ f_ttywerase(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_w300 __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_w300(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_w300(
|
||||
@ -284,7 +284,7 @@ f_w300(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_w1200 __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_w1200(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_w1200(
|
||||
@ -305,7 +305,7 @@ f_w1200(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_w9600 __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_w9600(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_w9600(
|
||||
@ -326,7 +326,7 @@ f_w9600(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_window __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_window(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_window(
|
||||
@ -342,7 +342,7 @@ f_window(
|
||||
}
|
||||
|
||||
/*
|
||||
* PUBLIC: int f_encoding __P((SCR *, OPTION *, char *, u_long *));
|
||||
* PUBLIC: int f_encoding(SCR *, OPTION *, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
f_encoding(
|
||||
|
@ -30,7 +30,7 @@ static const char sccsid[] = "$Id: put.c,v 10.19 04/07/11 17:00:24 zy Exp $";
|
||||
* put --
|
||||
* Put text buffer contents into the file.
|
||||
*
|
||||
* PUBLIC: int put __P((SCR *, CB *, CHAR_T *, MARK *, MARK *, int));
|
||||
* PUBLIC: int put(SCR *, CB *, CHAR_T *, MARK *, MARK *, int);
|
||||
*/
|
||||
int
|
||||
put(
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "$Id: recover.c,v 11.2 2012/10/09 08:06:58 zy Exp $";
|
||||
static const char sccsid[] = "$Id: recover.c,v 11.3 2015/04/04 03:50:42 zy Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -102,18 +102,18 @@ static const char sccsid[] = "$Id: recover.c,v 11.2 2012/10/09 08:06:58 zy Exp $
|
||||
|
||||
#define VI_DHEADER "X-vi-data:"
|
||||
|
||||
static int rcv_copy __P((SCR *, int, char *));
|
||||
static void rcv_email __P((SCR *, char *));
|
||||
static int rcv_mailfile __P((SCR *, int, char *));
|
||||
static int rcv_mktemp __P((SCR *, char *, char *));
|
||||
static int rcv_dlnwrite __P((SCR *, const char *, const char *, FILE *));
|
||||
static int rcv_dlnread __P((SCR *, char **, char **, FILE *));
|
||||
static int rcv_copy(SCR *, int, char *);
|
||||
static void rcv_email(SCR *, char *);
|
||||
static int rcv_mailfile(SCR *, int, char *);
|
||||
static int rcv_mktemp(SCR *, char *, char *);
|
||||
static int rcv_dlnwrite(SCR *, const char *, const char *, FILE *);
|
||||
static int rcv_dlnread(SCR *, char **, char **, FILE *);
|
||||
|
||||
/*
|
||||
* rcv_tmp --
|
||||
* Build a file name that will be used as the recovery file.
|
||||
*
|
||||
* PUBLIC: int rcv_tmp __P((SCR *, EXF *, char *));
|
||||
* PUBLIC: int rcv_tmp(SCR *, EXF *, char *);
|
||||
*/
|
||||
int
|
||||
rcv_tmp(
|
||||
@ -172,7 +172,7 @@ err: msgq(sp, M_ERR,
|
||||
* rcv_init --
|
||||
* Force the file to be snapshotted for recovery.
|
||||
*
|
||||
* PUBLIC: int rcv_init __P((SCR *));
|
||||
* PUBLIC: int rcv_init(SCR *);
|
||||
*/
|
||||
int
|
||||
rcv_init(SCR *sp)
|
||||
@ -234,7 +234,7 @@ err: msgq(sp, M_ERR,
|
||||
* sending email to the user if the file was modified
|
||||
* ending the file session
|
||||
*
|
||||
* PUBLIC: int rcv_sync __P((SCR *, u_int));
|
||||
* PUBLIC: int rcv_sync(SCR *, u_int);
|
||||
*/
|
||||
int
|
||||
rcv_sync(
|
||||
@ -252,15 +252,12 @@ rcv_sync(
|
||||
|
||||
/* Sync the file if it's been modified. */
|
||||
if (F_ISSET(ep, F_MODIFIED)) {
|
||||
SIGBLOCK;
|
||||
if (ep->db->sync(ep->db, R_RECNOSYNC)) {
|
||||
F_CLR(ep, F_RCV_ON | F_RCV_NORM);
|
||||
msgq_str(sp, M_SYSERR,
|
||||
ep->rcv_path, "060|File backup failed: %s");
|
||||
SIGUNBLOCK;
|
||||
return (1);
|
||||
}
|
||||
SIGUNBLOCK;
|
||||
|
||||
/* REQUEST: don't remove backing file on exit. */
|
||||
if (LF_ISSET(RCV_PRESERVE))
|
||||
@ -505,7 +502,7 @@ err: if (!issync)
|
||||
* rcv_list --
|
||||
* List the files that can be recovered by this user.
|
||||
*
|
||||
* PUBLIC: int rcv_list __P((SCR *));
|
||||
* PUBLIC: int rcv_list(SCR *);
|
||||
*/
|
||||
int
|
||||
rcv_list(SCR *sp)
|
||||
@ -612,7 +609,7 @@ next: (void)fclose(fp);
|
||||
* rcv_read --
|
||||
* Start a recovered file as the file to edit.
|
||||
*
|
||||
* PUBLIC: int rcv_read __P((SCR *, FREF *));
|
||||
* PUBLIC: int rcv_read(SCR *, FREF *);
|
||||
*/
|
||||
int
|
||||
rcv_read(
|
||||
@ -635,7 +632,7 @@ rcv_read(
|
||||
return (1);
|
||||
rp = O_STR(sp, O_RECDIR);
|
||||
if ((dirp = opendir(rp)) == NULL) {
|
||||
msgq_str(sp, M_ERR, rp, "%s");
|
||||
msgq_str(sp, M_SYSERR, rp, "%s");
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ static const char sccsid[] = "$Id: screen.c,v 10.25 2011/12/04 04:06:45 zy Exp $
|
||||
* screen_init --
|
||||
* Do the default initialization of an SCR structure.
|
||||
*
|
||||
* PUBLIC: int screen_init __P((GS *, SCR *, SCR **));
|
||||
* PUBLIC: int screen_init(GS *, SCR *, SCR **);
|
||||
*/
|
||||
int
|
||||
screen_init(
|
||||
@ -129,7 +129,7 @@ err: screen_end(sp);
|
||||
* Release a screen, no matter what had (and had not) been
|
||||
* initialized.
|
||||
*
|
||||
* PUBLIC: int screen_end __P((SCR *));
|
||||
* PUBLIC: int screen_end(SCR *);
|
||||
*/
|
||||
int
|
||||
screen_end(SCR *sp)
|
||||
@ -205,7 +205,7 @@ screen_end(SCR *sp)
|
||||
* screen_next --
|
||||
* Return the next screen in the queue.
|
||||
*
|
||||
* PUBLIC: SCR *screen_next __P((SCR *));
|
||||
* PUBLIC: SCR *screen_next(SCR *);
|
||||
*/
|
||||
SCR *
|
||||
screen_next(SCR *sp)
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "$Id: search.c,v 10.26 2011/07/04 20:16:26 zy Exp $";
|
||||
static const char sccsid[] = "$Id: search.c,v 10.27 2015/03/13 18:41:35 zy Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -30,8 +30,8 @@ static const char sccsid[] = "$Id: search.c,v 10.26 2011/07/04 20:16:26 zy Exp $
|
||||
|
||||
typedef enum { S_EMPTY, S_EOF, S_NOPREV, S_NOTFOUND, S_SOF, S_WRAP } smsg_t;
|
||||
|
||||
static void search_msg __P((SCR *, smsg_t));
|
||||
static int search_init __P((SCR *, dir_t, CHAR_T *, size_t, CHAR_T **, u_int));
|
||||
static void search_msg(SCR *, smsg_t);
|
||||
static int search_init(SCR *, dir_t, CHAR_T *, size_t, CHAR_T **, u_int);
|
||||
|
||||
/*
|
||||
* search_init --
|
||||
@ -142,8 +142,8 @@ prev: if (sp->re == NULL) {
|
||||
* f_search --
|
||||
* Do a forward search.
|
||||
*
|
||||
* PUBLIC: int f_search __P((SCR *,
|
||||
* PUBLIC: MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int));
|
||||
* PUBLIC: int f_search(SCR *,
|
||||
* PUBLIC: MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
|
||||
*/
|
||||
int
|
||||
f_search(
|
||||
@ -159,7 +159,7 @@ f_search(
|
||||
recno_t lno;
|
||||
regmatch_t match[1];
|
||||
size_t coff, len;
|
||||
int cnt, eval, rval, wrapped;
|
||||
int cnt, eval, rval, wrapped = 0;
|
||||
CHAR_T *l;
|
||||
|
||||
if (search_init(sp, FORWARD, ptrn, plen, eptrn, flags))
|
||||
@ -198,13 +198,14 @@ f_search(
|
||||
return (1);
|
||||
}
|
||||
lno = 1;
|
||||
wrapped = 1;
|
||||
}
|
||||
} else
|
||||
coff = fm->cno + 1;
|
||||
}
|
||||
|
||||
btype = BUSY_ON;
|
||||
for (cnt = INTERRUPT_CHECK, rval = 1, wrapped = 0;; ++lno, coff = 0) {
|
||||
for (cnt = INTERRUPT_CHECK, rval = 1;; ++lno, coff = 0) {
|
||||
if (cnt-- == 0) {
|
||||
if (INTERRUPTED(sp))
|
||||
break;
|
||||
@ -288,8 +289,8 @@ f_search(
|
||||
* b_search --
|
||||
* Do a backward search.
|
||||
*
|
||||
* PUBLIC: int b_search __P((SCR *,
|
||||
* PUBLIC: MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int));
|
||||
* PUBLIC: int b_search(SCR *,
|
||||
* PUBLIC: MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
|
||||
*/
|
||||
int
|
||||
b_search(
|
||||
@ -487,7 +488,7 @@ search_msg(
|
||||
* search_busy --
|
||||
* Put up the busy searching message.
|
||||
*
|
||||
* PUBLIC: void search_busy __P((SCR *, busy_t));
|
||||
* PUBLIC: void search_busy(SCR *, busy_t);
|
||||
*/
|
||||
void
|
||||
search_busy(
|
||||
|
30
common/seq.c
30
common/seq.c
@ -31,8 +31,8 @@ static const char sccsid[] = "$Id: seq.c,v 10.18 2011/12/11 23:13:00 zy Exp $";
|
||||
* seq_set --
|
||||
* Internal version to enter a sequence.
|
||||
*
|
||||
* PUBLIC: int seq_set __P((SCR *, CHAR_T *,
|
||||
* PUBLIC: size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int));
|
||||
* PUBLIC: int seq_set(SCR *, CHAR_T *,
|
||||
* PUBLIC: size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int);
|
||||
*/
|
||||
int
|
||||
seq_set(
|
||||
@ -136,7 +136,7 @@ mem1: errno = sv_errno;
|
||||
* seq_delete --
|
||||
* Delete a sequence.
|
||||
*
|
||||
* PUBLIC: int seq_delete __P((SCR *, CHAR_T *, size_t, seq_t));
|
||||
* PUBLIC: int seq_delete(SCR *, CHAR_T *, size_t, seq_t);
|
||||
*/
|
||||
int
|
||||
seq_delete(
|
||||
@ -172,7 +172,7 @@ seq_delete(
|
||||
* seq_free --
|
||||
* Free a map entry.
|
||||
*
|
||||
* PUBLIC: int seq_free __P((SEQ *));
|
||||
* PUBLIC: int seq_free(SEQ *);
|
||||
*/
|
||||
int
|
||||
seq_free(SEQ *qp)
|
||||
@ -193,7 +193,7 @@ seq_free(SEQ *qp)
|
||||
* isn't NULL, partial matches count.
|
||||
*
|
||||
* PUBLIC: SEQ *seq_find
|
||||
* PUBLIC: __P((SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *));
|
||||
* PUBLIC: (SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *);
|
||||
*/
|
||||
SEQ *
|
||||
seq_find(
|
||||
@ -278,7 +278,7 @@ seq_find(
|
||||
* seq_close --
|
||||
* Discard all sequences.
|
||||
*
|
||||
* PUBLIC: void seq_close __P((GS *));
|
||||
* PUBLIC: void seq_close(GS *);
|
||||
*/
|
||||
void
|
||||
seq_close(GS *gp)
|
||||
@ -295,7 +295,7 @@ seq_close(GS *gp)
|
||||
* seq_dump --
|
||||
* Display the sequence entries of a specified type.
|
||||
*
|
||||
* PUBLIC: int seq_dump __P((SCR *, seq_t, int));
|
||||
* PUBLIC: int seq_dump(SCR *, seq_t, int);
|
||||
*/
|
||||
int
|
||||
seq_dump(
|
||||
@ -343,7 +343,7 @@ seq_dump(
|
||||
* seq_save --
|
||||
* Save the sequence entries to a file.
|
||||
*
|
||||
* PUBLIC: int seq_save __P((SCR *, FILE *, char *, seq_t));
|
||||
* PUBLIC: int seq_save(SCR *, FILE *, char *, seq_t);
|
||||
*/
|
||||
int
|
||||
seq_save(
|
||||
@ -389,7 +389,7 @@ seq_save(
|
||||
* e_memcmp --
|
||||
* Compare a string of EVENT's to a string of CHAR_T's.
|
||||
*
|
||||
* PUBLIC: int e_memcmp __P((CHAR_T *, EVENT *, size_t));
|
||||
* PUBLIC: int e_memcmp(CHAR_T *, EVENT *, size_t);
|
||||
*/
|
||||
int
|
||||
e_memcmp(
|
||||
@ -398,11 +398,11 @@ e_memcmp(
|
||||
size_t n)
|
||||
{
|
||||
if (n != 0) {
|
||||
do {
|
||||
if (*p1++ != ep->e_c)
|
||||
return (*--p1 - ep->e_c);
|
||||
do {
|
||||
if (*p1++ != ep->e_c)
|
||||
return (*--p1 - ep->e_c);
|
||||
++ep;
|
||||
} while (--n != 0);
|
||||
}
|
||||
return (0);
|
||||
} while (--n != 0);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ static const char sccsid[] = "$Id: util.c,v 10.30 2013/03/19 10:00:27 yamt Exp $
|
||||
* binc --
|
||||
* Increase the size of a buffer.
|
||||
*
|
||||
* PUBLIC: void *binc __P((SCR *, void *, size_t *, size_t));
|
||||
* PUBLIC: void *binc(SCR *, void *, size_t *, size_t);
|
||||
*/
|
||||
void *
|
||||
binc(
|
||||
@ -76,7 +76,7 @@ binc(
|
||||
* including or after the starting column. On error, set
|
||||
* the column to 0, it's safest.
|
||||
*
|
||||
* PUBLIC: int nonblank __P((SCR *, recno_t, size_t *));
|
||||
* PUBLIC: int nonblank(SCR *, recno_t, size_t *);
|
||||
*/
|
||||
int
|
||||
nonblank(
|
||||
@ -112,7 +112,7 @@ nonblank(
|
||||
* tail --
|
||||
* Return tail of a path.
|
||||
*
|
||||
* PUBLIC: char *tail __P((char *));
|
||||
* PUBLIC: char *tail(char *);
|
||||
*/
|
||||
char *
|
||||
tail(char *path)
|
||||
@ -128,12 +128,12 @@ tail(char *path)
|
||||
* join --
|
||||
* Join two paths; need free.
|
||||
*
|
||||
* PUBLIC: char *join __P((char *, char *));
|
||||
* PUBLIC: char *join(char *, char *);
|
||||
*/
|
||||
char *
|
||||
join(
|
||||
char *path1,
|
||||
char *path2)
|
||||
char *path1,
|
||||
char *path2)
|
||||
{
|
||||
char *p;
|
||||
|
||||
@ -148,7 +148,7 @@ join(
|
||||
* expanduser --
|
||||
* Return a "~" or "~user" expanded path; need free.
|
||||
*
|
||||
* PUBLIC: char *expanduser __P((char *));
|
||||
* PUBLIC: char *expanduser(char *);
|
||||
*/
|
||||
char *
|
||||
expanduser(char *str)
|
||||
@ -198,7 +198,7 @@ expanduser(char *str)
|
||||
* quote --
|
||||
* Return a escaped string for /bin/sh; need free.
|
||||
*
|
||||
* PUBLIC: char *quote __P((char *));
|
||||
* PUBLIC: char *quote(char *);
|
||||
*/
|
||||
char *
|
||||
quote(char *str)
|
||||
@ -245,7 +245,7 @@ quote(char *str)
|
||||
* v_strdup --
|
||||
* Strdup for 8-bit character strings with an associated length.
|
||||
*
|
||||
* PUBLIC: char *v_strdup __P((SCR *, const char *, size_t));
|
||||
* PUBLIC: char *v_strdup(SCR *, const char *, size_t);
|
||||
*/
|
||||
char *
|
||||
v_strdup(
|
||||
@ -267,7 +267,7 @@ v_strdup(
|
||||
* v_wstrdup --
|
||||
* Strdup for wide character strings with an associated length.
|
||||
*
|
||||
* PUBLIC: CHAR_T *v_wstrdup __P((SCR *, const CHAR_T *, size_t));
|
||||
* PUBLIC: CHAR_T *v_wstrdup(SCR *, const CHAR_T *, size_t);
|
||||
*/
|
||||
CHAR_T *
|
||||
v_wstrdup(SCR *sp,
|
||||
@ -288,7 +288,7 @@ v_wstrdup(SCR *sp,
|
||||
* nget_uslong --
|
||||
* Get an unsigned long, checking for overflow.
|
||||
*
|
||||
* PUBLIC: enum nresult nget_uslong __P((u_long *, const CHAR_T *, CHAR_T **, int));
|
||||
* PUBLIC: enum nresult nget_uslong(u_long *, const CHAR_T *, CHAR_T **, int);
|
||||
*/
|
||||
enum nresult
|
||||
nget_uslong(
|
||||
@ -310,7 +310,7 @@ nget_uslong(
|
||||
* nget_slong --
|
||||
* Convert a signed long, checking for overflow and underflow.
|
||||
*
|
||||
* PUBLIC: enum nresult nget_slong __P((long *, const CHAR_T *, CHAR_T **, int));
|
||||
* PUBLIC: enum nresult nget_slong(long *, const CHAR_T *, CHAR_T **, int);
|
||||
*/
|
||||
enum nresult
|
||||
nget_slong(
|
||||
@ -336,7 +336,7 @@ nget_slong(
|
||||
* timepoint_steady --
|
||||
* Get a timestamp from a monotonic clock.
|
||||
*
|
||||
* PUBLIC: void timepoint_steady __P((struct timespec *));
|
||||
* PUBLIC: void timepoint_steady(struct timespec *);
|
||||
*/
|
||||
void
|
||||
timepoint_steady(
|
||||
@ -367,7 +367,7 @@ timepoint_steady(
|
||||
* timepoint_system --
|
||||
* Get the current calendar time.
|
||||
*
|
||||
* PUBLIC: void timepoint_system __P((struct timespec *));
|
||||
* PUBLIC: void timepoint_system(struct timespec *);
|
||||
*/
|
||||
void
|
||||
timepoint_system(
|
||||
@ -401,7 +401,7 @@ timepoint_system(
|
||||
* TRACE --
|
||||
* debugging trace routine.
|
||||
*
|
||||
* PUBLIC: void TRACE __P((SCR *, const char *, ...));
|
||||
* PUBLIC: void TRACE(SCR *, const char *, ...);
|
||||
*/
|
||||
void
|
||||
TRACE(
|
||||
|
147
docs/TODO
147
docs/TODO
@ -1,147 +0,0 @@
|
||||
CL: In single-line screens, have to press 'q' twice when quitting out
|
||||
of a ":set all" display.
|
||||
|
||||
COMMON: There's a serious problem with error returns -- we need to separate
|
||||
command failure from fatal error, consistently, over the entire source
|
||||
tree.
|
||||
|
||||
We need to rework all of vi to have three return values:
|
||||
|
||||
0: success
|
||||
1: vi error, continue
|
||||
2: fatal error, die
|
||||
|
||||
Right now we don't recognize fatal errors for what they are.
|
||||
|
||||
VI: Change the screen scrolling to not eat user characters... i.e.
|
||||
g/pattern/foo should not eat already entered chars.
|
||||
|
||||
COMMON: It's known that it's possible to sync the backing files in the
|
||||
wrong manner, leaving backup files that aren't recoverable. This
|
||||
is going to be left alone until we have a logging version of DB,
|
||||
which will hopefully fix this (or at least make it possible to
|
||||
easily do so).
|
||||
|
||||
COMMON: The complete list of POSIX.1 calls that can return EINTR are:
|
||||
|
||||
wait, waitpid, sleep, dup2, close, read, write,
|
||||
fcntl(SETLCKW) tcsetattr, tcdrain
|
||||
|
||||
The problem is that technically, any system/library call can
|
||||
return EINTR, so, while nvi blocks (most of?) the obvious ones,
|
||||
someone may have to do a complete pass and block signals
|
||||
everywhere.
|
||||
|
||||
COMMON: The vi main command loop should use the general-purpose overflow
|
||||
and underflow routines. In addition, the vi command loop uses
|
||||
unsigned longs -- should probably be fixed as a 32-bit unsigned
|
||||
type, and then check to make sure it's never used as as variable
|
||||
type again.
|
||||
|
||||
DB: When nvi edits files that don't have trailing newlines, it appends
|
||||
one, regardless. This is required, by default, from POSIX.2.
|
||||
|
||||
COMMON: Open mode is not yet implemented.
|
||||
|
||||
COMMON: ^C isn't passed to the shell in the script windows as an interrupt
|
||||
character.
|
||||
|
||||
COMMON: The options:
|
||||
|
||||
hardtabs, lisp, optimize, redraw, slowopen
|
||||
|
||||
are recognized, but not implemented. These options are unlikely
|
||||
to be implemented, so if you want them you might want to say
|
||||
something! I will implement lisp if anyone ever documents how it
|
||||
worked.
|
||||
|
||||
COMMON: If you run out of space in the recovery directory, the recovery
|
||||
file is left in place.
|
||||
|
||||
COMMON: Should "view" set a lock on the file?
|
||||
|
||||
COMMON: Field editing shouldn't be hard to add to nvi:
|
||||
|
||||
Field editing file template:
|
||||
|
||||
version #
|
||||
field # row/column start row/column stop
|
||||
label field # Label string
|
||||
re field # Matching re string.
|
||||
field # row/column start row/column stop
|
||||
label field # Label string
|
||||
re field # Matching re string.
|
||||
|
||||
<tab> moves to the next field
|
||||
<bs> in column 0 moves to the previous field
|
||||
|
||||
COMMON: Let's rethink using an IPC mechanism:
|
||||
|
||||
Two way channel, with events passing in both directions.
|
||||
|
||||
Load into the same address space (else, how do file permissions) forks
|
||||
in v_init -- screens get events from vi, vi gets events queued up from
|
||||
screens.
|
||||
|
||||
Vi:
|
||||
E_CHARACTER, /* Input character: e_c set. */
|
||||
E_EOF, /* End of input (NOT ^D). */
|
||||
E_ERR, /* Input error. */
|
||||
E_INTERRUPT, /* Interrupt. */
|
||||
E_REPAINT, /* Repaint: e_flno, e_tlno set. */
|
||||
E_RESIZE, /* SIGWINCH: e_lno, e_cno set. */
|
||||
E_SIGCONT, /* SIGCONT arrived. */
|
||||
E_SIGFATAL, /* fatal signal arrived.
|
||||
E_START, /* Start ex/vi. */
|
||||
E_STOP, /* Stop ex/vi. */
|
||||
E_STRING, /* Input string: e_csp, e_len set. */
|
||||
|
||||
Screen:
|
||||
E_ADDSTR /* Add a string to the screen. */
|
||||
E_ATTRIBUTE /* Screen attribute. */
|
||||
E_BELL /* Beep/bell/flash the terminal. */
|
||||
E_BUSY /* Display a busy message. */
|
||||
E_CANONICAL /* Enter tty canonical mode. */
|
||||
E_CLRTOEOL /* Clear to the end of the line. */
|
||||
E_CURSOR /* Return the cursor location. */
|
||||
E_DELETELN /* Delete a line. */
|
||||
E_DISCARD /* Discard a screen. */
|
||||
E_EXADJUST /* Ex: screen adjustment routine. */
|
||||
E_FMAP /* Set a function key. */
|
||||
E_GETKEY /* Get a key event. */
|
||||
E_INSERTLN /* Insert a line. */
|
||||
E_MOVE /* Move the cursor. */
|
||||
E_MESSAGE /* Message or ex output. */
|
||||
E_REFRESH /* Refresh the screen. */
|
||||
E_RESIZE /* Resize two screens. */
|
||||
E_SPLIT /* Split the screen. */
|
||||
E_SUSPEND /* Suspend the editor. */
|
||||
|
||||
EX: It would be nice to inverse video the replaced text during
|
||||
interactive substitute.
|
||||
|
||||
EX: The :args command should put the current file name out in reverse
|
||||
video. This isn't going to be easy, currently only full lines can
|
||||
be in reverse video, not just parts.
|
||||
|
||||
TK: We currently permit the user to change the lines, columns and term
|
||||
edit options. Shouldn't that be illegal in tknvi?
|
||||
|
||||
VI: The strings found by searches should be highlighted until the next
|
||||
character is entered.
|
||||
|
||||
VI: Display a split vi screen for the :help command.
|
||||
|
||||
VI: When getting a key for a continue screen, we should always read from
|
||||
the terminal, not from a mapped key.
|
||||
|
||||
VI: The sentence, paragraph and section movement commands don't match
|
||||
historic practice in some boundary cases. This should be left
|
||||
alone until POSIX 1003.2 makes up its mind.
|
||||
|
||||
VI: The vs_sm_fill routine should scroll if possible, not always redraw.
|
||||
|
||||
VI: Think about setting a dirty/inuse bits on the lines of the SMAP
|
||||
structure. That way the message routines could steal lines and
|
||||
refresh would continue to work, because it would know not to touch
|
||||
the lines that were in use.
|
@ -1,11 +0,0 @@
|
||||
# @(#)Makefile 8.4 (Berkeley) 8/18/96
|
||||
|
||||
ROFF= groff
|
||||
TBL= tbl
|
||||
|
||||
edittut.ps: edittut.ms
|
||||
${TBL} edittut.ms | ${ROFF} -ms > $@
|
||||
chmod 444 $@
|
||||
|
||||
clean:
|
||||
rm -f edittut.ps
|
@ -1,115 +0,0 @@
|
||||
.\" Copyright (c) 1980, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)edit.vindex 8.1 (Berkeley) 6/8/93
|
||||
.\"
|
||||
.bd I
|
||||
.ND
|
||||
.TL
|
||||
Index
|
||||
.sp 3
|
||||
.2C
|
||||
.nf
|
||||
addressing, \fIsee\fR line numbers
|
||||
append mode, 4
|
||||
backslash (\\), 18
|
||||
buffer, 2
|
||||
command mode, 4
|
||||
context search, 8, 10, 13, 18
|
||||
control characters (``^'' notation), 8
|
||||
control-d, 6
|
||||
current filename, 19, 20
|
||||
current line (.), 9, 15
|
||||
diagnostic messages, 4
|
||||
disk, 2
|
||||
documentation, 21
|
||||
edit (to begin editing session), 3, 7
|
||||
editing commands:
|
||||
.in +2
|
||||
append (a), 4, 7
|
||||
change (c), 16
|
||||
copy (co), 13
|
||||
delete (d), 13-14
|
||||
edit (e), 12
|
||||
file (f), 19
|
||||
global (g), 18-19
|
||||
move (m), 12-13
|
||||
number (nu), 9
|
||||
preserve (pre), 20-21
|
||||
print (p), 8
|
||||
quit (q), 5, 11
|
||||
quit! (q!), 11
|
||||
read (r), 20
|
||||
recover (rec), 20
|
||||
substitute (s), 9-10, 17, 18
|
||||
undo (u), 14, 17
|
||||
write (w), 5-6, 11, 19-20
|
||||
z, 11
|
||||
.sp 10i
|
||||
! (shell escape), 19
|
||||
$= , 15
|
||||
+, 15
|
||||
\-, 15
|
||||
//, 8, 18
|
||||
??, 18
|
||||
\&\fB.\fR, 9, 15
|
||||
\&\fB.\fR=, 9, 15
|
||||
.in -2
|
||||
erasing
|
||||
.ti +2
|
||||
characters (#), 8
|
||||
.ti +2
|
||||
lines (@), 8
|
||||
ex (text editor), 21
|
||||
\fIEx Reference Manual\fR, 21
|
||||
file, 1
|
||||
file recovery, 20
|
||||
filename, 2
|
||||
Interrupt (message), 7
|
||||
line numbers, \fIsee also\fR current line
|
||||
.ti +2
|
||||
dollar sign ($), 8, 12-13, 15
|
||||
.ti +2
|
||||
dot (.), 9, 15
|
||||
.ti +2
|
||||
relative (+ and \-), 15, 16
|
||||
logging out, 6
|
||||
login procedure, 2
|
||||
``magic'' characters, 21
|
||||
non-printing characters, 8
|
||||
``not found'' (message), 3
|
||||
program, 1
|
||||
recovery \fIsee\fR file recovery
|
||||
shell, 18
|
||||
shell escape (!), 19
|
||||
special characters (^, $, \e), 18
|
||||
text input mode, 4
|
||||
UNIX, 1
|
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
||||
# @(#)Makefile 8.8 (Berkeley) 10/10/96
|
||||
|
||||
ROFF= groff
|
||||
TBL= tbl
|
||||
|
||||
all: exref.ps summary.ps
|
||||
|
||||
exref.ps: ex.rm
|
||||
${TBL} ex.rm | ${ROFF} -ms > $@
|
||||
chmod 444 $@
|
||||
|
||||
summary.ps: ex.summary
|
||||
${TBL} ex.summary | ${ROFF} -ms > $@
|
||||
chmod 444 $@
|
||||
|
||||
clean:
|
||||
rm -f exref.ps summary.ps
|
File diff suppressed because it is too large
Load Diff
@ -1,730 +0,0 @@
|
||||
.\" Copyright (c) 1980, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)ex.summary 8.3 (Berkeley) 8/18/96
|
||||
.\"
|
||||
.ds p \v'-0.2'.\v'+0.2'
|
||||
.ds U \s-2UNIX\s+2
|
||||
.ds c \v'-0.2':\v'+0.2'
|
||||
.nr LL 6.5i
|
||||
.lt 6.5i
|
||||
.ll 6.5i
|
||||
.ds CH
|
||||
.ds LF Computing Services, U.C. Berkeley
|
||||
.ds RF April 3, 1979
|
||||
.de SP
|
||||
.sp 1v
|
||||
..
|
||||
.nr PI 3n
|
||||
.nr PD 0
|
||||
.ND
|
||||
.ps 12
|
||||
.ft B
|
||||
.ce 1
|
||||
Ex/Edit Command Summary (Version 2.0)
|
||||
.sp 1
|
||||
.ft R
|
||||
.nr VS 11
|
||||
.nr PS 9
|
||||
.2C
|
||||
.PP
|
||||
.I Ex
|
||||
and
|
||||
.I edit
|
||||
are text editors, used for creating
|
||||
and modifying files of text on the \*U
|
||||
computer system.
|
||||
.I Edit
|
||||
is a variant of
|
||||
.I ex
|
||||
with features designed to
|
||||
make it less complicated
|
||||
to learn and use.
|
||||
In terms of command syntax and effect
|
||||
the editors are essentially identical,
|
||||
and this command summary applies to both.
|
||||
.PP
|
||||
The summary is meant as a quick reference
|
||||
for users already acquainted
|
||||
with
|
||||
.I edit
|
||||
or \fIex\fP.
|
||||
Fuller explanations of the editors are available
|
||||
in the documents
|
||||
.I
|
||||
Edit: A Tutorial
|
||||
.R
|
||||
(a self-teaching introduction) and the
|
||||
.I
|
||||
Ex Reference Manual
|
||||
.R
|
||||
(the comprehensive reference source for
|
||||
both \fIedit\fP and \fIex\fP).
|
||||
Both of these writeups are available in the
|
||||
Computing Services Library.
|
||||
.PP
|
||||
In the examples included with the
|
||||
summary, commands and text entered by
|
||||
the user are printed in \fBboldface\fR to
|
||||
distinguish them from responses printed
|
||||
by the computer.
|
||||
.sp 0.45v
|
||||
.LP
|
||||
.B
|
||||
The Editor Buffer
|
||||
.PP
|
||||
In order to perform its tasks
|
||||
the editor sets aside a temporary
|
||||
work space,
|
||||
called a \fIbuffer\fR,
|
||||
separate from the user's permanent
|
||||
file.
|
||||
Before starting to work on an existing
|
||||
file the editor makes a copy of it in the
|
||||
buffer, leaving the original untouched.
|
||||
All editing changes are made to the
|
||||
buffer copy, which must then
|
||||
be written back to the permanent
|
||||
file in order to update the
|
||||
old version.
|
||||
The buffer disappears
|
||||
at the end of the editing session.
|
||||
.sp 0.45v
|
||||
.LP
|
||||
.B
|
||||
Editing: Command and Text Input Modes
|
||||
.PP
|
||||
.R
|
||||
During an editing session there are
|
||||
two usual modes of operation:
|
||||
\fIcommand\fP mode and \fItext input\fP
|
||||
mode.
|
||||
(This disregards, for the moment,
|
||||
.I open
|
||||
and
|
||||
.I visual
|
||||
modes, discussed below.)
|
||||
In command mode, the editor issues a
|
||||
colon prompt (:)
|
||||
to show that it is ready to
|
||||
accept and execute a command.
|
||||
In text input mode, on the other hand, there is
|
||||
no prompt and the editor merely accepts text to
|
||||
be added to the buffer.
|
||||
Text input mode is initiated by the commands
|
||||
\fIappend\fP, \fIinsert\fP, and \fIchange\fP,
|
||||
and is terminated by typing a period as the
|
||||
first and only character on a line.
|
||||
.sp 0.45v
|
||||
.LP
|
||||
.B
|
||||
Line Numbers and Command Syntax
|
||||
.PP
|
||||
.R
|
||||
The editor keeps track of lines of text
|
||||
in the buffer by numbering them consecutively
|
||||
starting with 1 and renumbering
|
||||
as lines are added or deleted.
|
||||
At any given time the editor is positioned
|
||||
at one of these lines; this position is
|
||||
called the \fIcurrent line\fP.
|
||||
Generally, commands that change the
|
||||
contents of the buffer print the
|
||||
new current line at the end of their
|
||||
execution.
|
||||
.PP
|
||||
Most commands can be preceded by one or two
|
||||
line-number addresses which indicate the lines
|
||||
to be affected.
|
||||
If one number is given the command operates on
|
||||
that line only; if two, on an inclusive range
|
||||
of lines.
|
||||
Commands that can take line-number prefixes also
|
||||
assume default prefixes if none are given.
|
||||
The default assumed by each command is designed
|
||||
to make it convenient to use in many instances
|
||||
without any line-number prefix.
|
||||
For the most part, a command used without a
|
||||
prefix operates on the current line,
|
||||
though exceptions to this rule should be noted.
|
||||
The \fIprint\fP command
|
||||
by itself, for instance, causes
|
||||
one line, the current line, to be
|
||||
printed at the terminal.
|
||||
.PP
|
||||
The summary shows the number of line addresses
|
||||
that can be
|
||||
prefixed to each command as well as
|
||||
the defaults assumed if they are omitted.
|
||||
For example,
|
||||
.I (.,.)
|
||||
means that up to 2 line-numbers may be given,
|
||||
and that if none is given the
|
||||
command operates on the current line.
|
||||
(In the address prefix notation, ``.'' stands
|
||||
for the current line and ``$'' stands for
|
||||
the last line of the buffer.)
|
||||
If no such notation appears, no
|
||||
line-number prefix may be used.
|
||||
.PP
|
||||
Some commands take trailing
|
||||
information;
|
||||
only
|
||||
the more important instances of this
|
||||
are mentioned in the summary.
|
||||
.sp 0.25v
|
||||
.LP
|
||||
.B
|
||||
Open and Visual Modes
|
||||
.PP
|
||||
.R
|
||||
Besides command and text input modes,
|
||||
.I ex
|
||||
and
|
||||
.I edit
|
||||
provide on some CRT terminals other modes of editing,
|
||||
.I open
|
||||
and
|
||||
.I visual .
|
||||
In these modes the cursor can
|
||||
be moved to individual words
|
||||
or characters in a line.
|
||||
The commands then given are very different
|
||||
from the standard editor commands; most do not appear on the screen when
|
||||
typed.
|
||||
.I
|
||||
An Introduction to Display Editing with Vi
|
||||
.R
|
||||
provides a full discussion.
|
||||
.sp 0.25v
|
||||
.LP
|
||||
.B
|
||||
Special Characters
|
||||
.PP
|
||||
.R
|
||||
.fi
|
||||
Some characters take on special meanings
|
||||
when used in context searches
|
||||
and in patterns given to the \fIsubstitute\fP command.
|
||||
For \fIedit\fR, these are ``^'' and ``$'',
|
||||
meaning the beginning and end of a line,
|
||||
respectively.
|
||||
.I Ex
|
||||
has the following additional special characters:
|
||||
.B
|
||||
.ce 1
|
||||
\&. & * [ ] ~
|
||||
.R
|
||||
To use one of the special characters as its
|
||||
simple graphic representation
|
||||
rather than with its special meaning,
|
||||
precede it by a backslash (\\).
|
||||
The backslash always has a special meaning.
|
||||
.1C
|
||||
.TS
|
||||
cp10 cp10 cp10 cp10
|
||||
ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
|
||||
Name Abbr Description Examples
|
||||
.sp 1.75
|
||||
(.)\fBappend a T{
|
||||
Begins text input mode,
|
||||
adding lines to the buffer after
|
||||
the line specified. Appending continues
|
||||
until ``.'' is typed alone at the
|
||||
beginning of a new line, followed by
|
||||
a carriage return. \fI0a\fR places
|
||||
lines at the beginning of the buffer.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fBa
|
||||
Three lines of text
|
||||
are added to the buffer
|
||||
after the current line.
|
||||
\*p
|
||||
.R
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fR(.,.)\fBchange c T{
|
||||
Deletes indicated line(s) and
|
||||
initiates text input mode to
|
||||
replace them with new text which follows.
|
||||
New text is terminated the same way
|
||||
as with \fIappend\fR.
|
||||
T} T{
|
||||
.nf
|
||||
:\fB5,6c
|
||||
Lines 5 and 6 are
|
||||
deleted and replaced by
|
||||
these three lines.
|
||||
\*p
|
||||
.R
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fR(.,.)\fBcopy \fIaddr co T{
|
||||
Places a copy of the specified lines
|
||||
after the line indicated by \fIaddr\fR.
|
||||
The example places a copy of lines 8 through
|
||||
12, inclusive, after line 25.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fB8,12co 25
|
||||
\fRLast line copied is printed
|
||||
\fR\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fR(.,.)\fBdelete d T{
|
||||
Removes lines from the buffer
|
||||
and prints the current line after the deletion.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fB13,15d
|
||||
\fRNew current line is printed
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.TE
|
||||
.sp 0.5v
|
||||
.TS
|
||||
ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
|
||||
T{
|
||||
\fBedit \fIfile\fP
|
||||
.br
|
||||
\fBedit! \fIfile\fP
|
||||
T} T{
|
||||
e
|
||||
.br
|
||||
e!
|
||||
T} T{
|
||||
.fi
|
||||
\fRClears the editor buffer and then
|
||||
copies into it the named \fIfile\fR,
|
||||
which becomes the current file.
|
||||
This is a way of shifting to a different
|
||||
file
|
||||
without leaving the editor.
|
||||
The editor issues a warning
|
||||
message if this command is used before
|
||||
saving changes
|
||||
made to the file already in the buffer;
|
||||
using the form \fBe!\fR overrides this protective mechanism.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fBe ch10\fR
|
||||
No write since last change
|
||||
:\fBe! ch10\fR
|
||||
"ch10" 3 lines, 62 characters
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fBfile \fIname\fR f T{
|
||||
\fRIf followed by a \fIname\fR, renames
|
||||
the current file to \fIname\fR.
|
||||
If used without \fIname\fR, prints
|
||||
the name of the current file.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fBf ch9
|
||||
\fR"ch9" [Modified] 3 lines ...
|
||||
:\fBf
|
||||
\fR"ch9" [Modified] 3 lines ...
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
(1,$)\fBglobal g \fBglobal/\fIpattern\fB/\fIcommands T{
|
||||
.nf
|
||||
:\fBg/nonsense/d
|
||||
\fR\*c
|
||||
.fi
|
||||
T}
|
||||
\fR(1,$)\fBglobal! g!\fR or \fBv T{
|
||||
Searches the entire buffer (unless a smaller
|
||||
range is specified by line-number prefixes) and
|
||||
executes \fIcommands\fR on every line with
|
||||
an expression matching \fIpattern\fR.
|
||||
The second form, abbreviated
|
||||
either \fBg!\fR or \fBv\fR,
|
||||
executes \fIcommands\fR on lines that \fIdo
|
||||
not\fR contain the expression \fIpattern\fR.
|
||||
T} \^
|
||||
.SP
|
||||
\fR(.)\fBinsert i T{
|
||||
Inserts new lines of text immediately before the specified line.
|
||||
Differs from
|
||||
.I append
|
||||
only in that text is placed before, rather than after, the indicated line.
|
||||
In other words, \fB1i\fR has the same effect as \fB0a\fR.
|
||||
T} T{
|
||||
.nf
|
||||
:\fB1i
|
||||
These lines of text will
|
||||
be added prior to line 1.
|
||||
\&.
|
||||
\fR:
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fR(.,.+1)\fBjoin j T{
|
||||
Join lines together, adjusting white space (spaces
|
||||
and tabs) as necessary.
|
||||
T} T{
|
||||
.nf
|
||||
:\fB2,5j\fR
|
||||
Resulting line is printed
|
||||
:
|
||||
.fi
|
||||
T}
|
||||
.TE
|
||||
.bp
|
||||
.TS
|
||||
cp10 cp10 cp10 cp10
|
||||
ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
|
||||
Name Abbr Description Examples
|
||||
.sp 1.75
|
||||
\fR(.,.)\fBlist l T{
|
||||
\fRPrints lines in a more
|
||||
unambiguous way than the \fIprint\fR
|
||||
command does. The end of a line,
|
||||
for example, is marked with a ``$'',
|
||||
and tabs printed as ``^I''.
|
||||
T} T{
|
||||
.nf
|
||||
:\fB9l
|
||||
\fRThis is line 9$
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.TE
|
||||
.sp 0.5v
|
||||
.TS
|
||||
ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
|
||||
\fR(.,.)\fBmove \fIaddr\fB m T{
|
||||
\fRMoves the specified lines
|
||||
to a position after the line
|
||||
indicated by \fIaddr\fR.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fB12,15m 25\fR
|
||||
New current line is printed
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fR(.,.)\fBnumber nu T{
|
||||
Prints each line preceded
|
||||
by its buffer line number.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fBnu
|
||||
\0\0\fR10\0 This is line 10
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fR(.)\fBopen o T{
|
||||
Too involved to discuss here,
|
||||
but if you enter open mode
|
||||
accidentally, press
|
||||
the \s-2ESC\s0 key followed by
|
||||
\fBq\fR to
|
||||
get back into normal editor
|
||||
command mode.
|
||||
\fIEdit\fP is designed to
|
||||
prevent accidental use of
|
||||
the open command.
|
||||
T}
|
||||
.SP
|
||||
\fBpreserve pre T{
|
||||
Saves a copy of the current buffer contents as though the system had
|
||||
just crashed. This is for use in an emergency when a
|
||||
.I write
|
||||
command has failed and you don't know how else to save your work.\(dg
|
||||
T} T{
|
||||
.nf
|
||||
:\fBpreserve\fR
|
||||
File preserved.
|
||||
:
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fR(.,.)\fBprint p Prints the text of line(s). T{
|
||||
.nf
|
||||
:\fB+2,+3p\fR
|
||||
The second and third lines
|
||||
after the current line
|
||||
:
|
||||
.fi
|
||||
T}
|
||||
.TE
|
||||
.FS
|
||||
.ll 6.5i
|
||||
\(dg You should seek assistance from a system administrator as soon as
|
||||
possible after saving a file with the
|
||||
.I preserve
|
||||
command, because the preserved copy of the file is saved in a
|
||||
directory used to store temporary files, and thus, the preserved
|
||||
copy may only be available for a short period of time.
|
||||
.FE
|
||||
.SP
|
||||
.nf
|
||||
.TS
|
||||
ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
|
||||
T{
|
||||
.nf
|
||||
\fBquit
|
||||
quit!
|
||||
.fi
|
||||
T} T{
|
||||
.nf
|
||||
q
|
||||
q!
|
||||
T} T{
|
||||
.fi
|
||||
\fREnds the editing session.
|
||||
You will receive a
|
||||
warning if you have changed the buffer
|
||||
since last writing its contents
|
||||
to the file. In this event you
|
||||
must either type \fBw\fR to write,
|
||||
or type \fBq!\fR to exit from
|
||||
the editor without saving your changes.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fBq
|
||||
\fRNo write since last change
|
||||
:\fBq!
|
||||
\fR%
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fR(.)\fBread \fIfile\fP r T{
|
||||
.fi
|
||||
\fRPlaces a copy of \fIfile\fR in the
|
||||
buffer after the specified line.
|
||||
Address 0 is permissible and causes
|
||||
the copy of \fIfile\fR to be placed
|
||||
at the beginning of the buffer.
|
||||
The \fIread\fP command does not
|
||||
erase any text already in the buffer.
|
||||
If no line number is specified,
|
||||
\fIfile\fR is placed after the
|
||||
current line.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fB0r newfile
|
||||
\fR"newfile" 5 lines, 86 characters
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fBrecover \fIfile\fP rec T{
|
||||
.fi
|
||||
Retrieves a copy of the editor buffer
|
||||
after a system crash, editor crash,
|
||||
phone line disconnection, or
|
||||
\fIpreserve\fR command.
|
||||
T}
|
||||
.SP
|
||||
\fR(.,.)\fBsubstitute s T{
|
||||
.nf
|
||||
\fBsubstitute/\fIpattern\fB/\fIreplacement\fB/
|
||||
substitute/\fIpattern\fB/\fIreplacement\fB/gc
|
||||
.fi
|
||||
\fRReplaces the first occurrence of \fIpattern\fR
|
||||
on a line
|
||||
with \fIreplacement\fP.
|
||||
Including a \fBg\fR after the command
|
||||
changes all occurrences of \fIpattern\fP
|
||||
on the line.
|
||||
The \fBc\fR option allows the user to
|
||||
confirm each substitution before it is
|
||||
made; see the manual for details.
|
||||
T} T{
|
||||
.nf
|
||||
:\fB3p
|
||||
\fRLine 3 contains a misstake
|
||||
:\fBs/misstake/mistake/
|
||||
\fRLine 3 contains a mistake
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.TE
|
||||
.bp
|
||||
.TS
|
||||
cp10 cp10 cp10 cp10
|
||||
ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
|
||||
Name Abbr Description Examples
|
||||
.sp 1.75
|
||||
\fBundo u T{
|
||||
.fi
|
||||
\fRReverses the changes made in
|
||||
the buffer by the last buffer-editing
|
||||
command.
|
||||
Note that this example contains
|
||||
a notification about the number of
|
||||
lines affected.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fB1,15d
|
||||
\fR15 lines deleted
|
||||
new line number 1 is printed
|
||||
:\fBu
|
||||
\fR15 more lines in file ...
|
||||
old line number 1 is printed
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fR(1,$)\fBwrite \fIfile\fR w T{
|
||||
.fi
|
||||
\fRCopies data from the buffer onto
|
||||
a permanent file. If no \fIfile\fR
|
||||
is named, the current filename
|
||||
is used.
|
||||
The file is automatically created
|
||||
if it does not yet exist.
|
||||
A response containing the number of
|
||||
lines and characters in the file
|
||||
indicates that the write
|
||||
has been completed successfully.
|
||||
The editor's built-in protections
|
||||
against overwriting existing files
|
||||
will in some circumstances
|
||||
inhibit a write.
|
||||
The form \fBw!\fR forces the
|
||||
write, confirming that
|
||||
an existing file is to be overwritten.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fBw
|
||||
\fR"file7" 64 lines, 1122 characters
|
||||
:\fBw file8
|
||||
\fR"file8" File exists ...
|
||||
:\fBw! file8
|
||||
\fR"file8" 64 lines, 1122 characters
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
\fR(1,$)\fBwrite! \fIfile\fP w! \^ \^
|
||||
.TE
|
||||
.sp 0.5v
|
||||
.TS
|
||||
ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
|
||||
\fR(.)\fBz \fIcount\fP z T{
|
||||
.fi
|
||||
\fRPrints a screen full of text starting
|
||||
with the line indicated;
|
||||
or, if \fIcount\fR is specified,
|
||||
prints that number of lines.
|
||||
Variants of the \fIz\fR command
|
||||
are described in the manual.
|
||||
T}
|
||||
.SP
|
||||
\fB!\fIcommand T{
|
||||
.fi
|
||||
Executes the remainder of the line
|
||||
after \fB!\fR as a \*U command.
|
||||
The buffer is unchanged by this, and
|
||||
control is returned to the editor when
|
||||
the execution of \fIcommand\fR is complete.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fB!date
|
||||
\fRFri Jun 9 12:15:11 PDT 1978
|
||||
!
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fRcontrol-d T{
|
||||
.fi
|
||||
Prints the next \fIscroll\fR of text,
|
||||
normally half of a screen. See the
|
||||
manual for details of the \fIscroll\fR
|
||||
option.
|
||||
T}
|
||||
.SP
|
||||
\fR(.+1)<cr> T{
|
||||
.fi
|
||||
An address alone followed by a carriage
|
||||
return causes the line to be printed.
|
||||
A carriage return by itself prints the
|
||||
line following the current line.
|
||||
T} T{
|
||||
.nf
|
||||
:\fR<cr>
|
||||
the line after the current line
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.TE
|
||||
.sp 0.5v
|
||||
.TS
|
||||
ltw(1.0i) lt2w(0.40i)fB ltw(3.0i) ltw(1.8i).
|
||||
\fB/\fIpattern\fB/ T{
|
||||
.fi
|
||||
\fRSearches for the next line in which
|
||||
\fIpattern\fR occurs and prints it.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fB/This pattern/
|
||||
\fRThis pattern next occurs here.
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fB// T{
|
||||
Repeats the most recent search.
|
||||
T} T{
|
||||
.nf
|
||||
\fR:\fB//
|
||||
\fRThis pattern also occurs here.
|
||||
\*c
|
||||
.fi
|
||||
T}
|
||||
.SP
|
||||
\fB?\fIpattern\fB? T{
|
||||
Searches in the reverse direction
|
||||
for \fIpattern\fP.
|
||||
T}
|
||||
.SP
|
||||
\fB?? T{
|
||||
Repeats the most recent search,
|
||||
moving in the reverse direction
|
||||
through the buffer.
|
||||
T}
|
||||
.TE
|
@ -1,179 +0,0 @@
|
||||
Ar
|
||||
Bostic
|
||||
CDPATH
|
||||
COLUMNSXX
|
||||
Cscope
|
||||
Ds
|
||||
EXINIT
|
||||
Ee
|
||||
Ev
|
||||
Fa
|
||||
Ff
|
||||
Fl
|
||||
HUnhsh
|
||||
IPLPPPQPP
|
||||
LIpplpipbp
|
||||
Li
|
||||
Lite
|
||||
NEXINIT
|
||||
NHSHH
|
||||
Nex
|
||||
Nn
|
||||
POSIX
|
||||
Pp
|
||||
QQ
|
||||
SIGWINCHXX
|
||||
Std
|
||||
Sy
|
||||
TMPDIR
|
||||
Tt
|
||||
USD
|
||||
Unmap
|
||||
VI
|
||||
Vi
|
||||
XXXX
|
||||
ZZ
|
||||
ags
|
||||
ai
|
||||
altwerase
|
||||
ap
|
||||
autoindent
|
||||
autoprint
|
||||
autowrite
|
||||
aw
|
||||
bf
|
||||
bigwords
|
||||
cd
|
||||
cdpath
|
||||
cedit
|
||||
cmd
|
||||
co
|
||||
creens
|
||||
cs
|
||||
ctags
|
||||
db
|
||||
dbopen
|
||||
dd
|
||||
di
|
||||
dir
|
||||
dit
|
||||
doc
|
||||
docs
|
||||
eFRrsv
|
||||
eFRrv
|
||||
eFlRrv
|
||||
ead
|
||||
eb
|
||||
edcompatible
|
||||
egrep
|
||||
elete
|
||||
errorbells
|
||||
esc
|
||||
exrc
|
||||
exu
|
||||
fg
|
||||
filec
|
||||
hange
|
||||
hardtabs
|
||||
ht
|
||||
ic
|
||||
iclower
|
||||
ignorecase
|
||||
ile
|
||||
ind
|
||||
ious
|
||||
ist
|
||||
ize
|
||||
keytime
|
||||
leftright
|
||||
lhs
|
||||
li
|
||||
libc
|
||||
lobal
|
||||
lp
|
||||
matchtime
|
||||
mber
|
||||
mesg
|
||||
mk
|
||||
modeful
|
||||
modeline
|
||||
modelines
|
||||
nex
|
||||
nexrc
|
||||
nk
|
||||
nonblank
|
||||
nooption
|
||||
noprint
|
||||
nsert
|
||||
nul
|
||||
nvi
|
||||
oin
|
||||
onnections
|
||||
ove
|
||||
ppend
|
||||
prev
|
||||
pu
|
||||
readonly
|
||||
rec
|
||||
recdir
|
||||
redist
|
||||
rhs
|
||||
rint
|
||||
rk
|
||||
ro
|
||||
rsion
|
||||
sccs
|
||||
scr
|
||||
se
|
||||
searchincr
|
||||
sh
|
||||
shareware
|
||||
shellmeta
|
||||
shiftwidth
|
||||
showmatch
|
||||
showmode
|
||||
sidescroll
|
||||
slowopen
|
||||
sm
|
||||
smd
|
||||
sourceany
|
||||
su
|
||||
sual
|
||||
sw
|
||||
ta
|
||||
tabstop
|
||||
taglength
|
||||
tagn
|
||||
tagp
|
||||
tagstring
|
||||
th's
|
||||
tildeop
|
||||
tl
|
||||
tmp
|
||||
tr
|
||||
ts
|
||||
ttytype
|
||||
ttywerase
|
||||
ubstitute
|
||||
uffers
|
||||
uit
|
||||
unm
|
||||
urce
|
||||
var
|
||||
ve
|
||||
vi
|
||||
viu
|
||||
wa
|
||||
wi
|
||||
windowname
|
||||
wl
|
||||
wm
|
||||
wn
|
||||
wq
|
||||
wraplen
|
||||
wrapmargin
|
||||
wrapscan
|
||||
writeany
|
||||
ws
|
||||
ya
|
||||
yy
|
@ -1,32 +0,0 @@
|
||||
# @(#)Makefile 8.20 (Berkeley) 8/18/96
|
||||
|
||||
MACROS= -me
|
||||
ROFF= groff
|
||||
TBL= tbl
|
||||
|
||||
all: vi.ref.txt vi.ref.ps
|
||||
|
||||
vi.ref.txt: vi.ref index.so
|
||||
soelim vi.ref | ${TBL} | groff ${MACROS} -Tascii > $@
|
||||
rm -f index
|
||||
chmod 444 $@
|
||||
|
||||
vi.ref.ps: vi.ref index.so
|
||||
soelim vi.ref | ${TBL} | ${ROFF} ${MACROS} > $@
|
||||
rm -f index
|
||||
chmod 444 $@
|
||||
|
||||
index.so: vi.ref
|
||||
# Build index.so, side-effect of building the paper.
|
||||
soelim vi.ref | ${TBL} | ${ROFF} ${MACROS} > /dev/null
|
||||
sed -e 's/MINUSSIGN/\\-/' \
|
||||
-e 's/DOUBLEQUOTE/""/' \
|
||||
-e "s/SQUOTE/'/" \
|
||||
-e 's/ /__SPACE/g' < index | \
|
||||
sort -u '-t ' +0 -1 +1n | awk -f merge.awk | \
|
||||
sed -e 's/__SPACE/ /g' > $@
|
||||
rm -f index
|
||||
chmod 444 $@
|
||||
|
||||
clean:
|
||||
rm -f vi.ref.ps vi.ref.txt index index.so
|
File diff suppressed because it is too large
Load Diff
@ -1,260 +0,0 @@
|
||||
! 21, 42
|
||||
"" 42
|
||||
# 22, 43
|
||||
$ 22
|
||||
% 22
|
||||
& 23, 51
|
||||
'<character> 23
|
||||
( 23
|
||||
) 24
|
||||
* 43
|
||||
+ 19
|
||||
, 24
|
||||
. 24
|
||||
/RE/ 25
|
||||
0 25
|
||||
0<control-D> 38
|
||||
: 26
|
||||
; 26
|
||||
< 26, 43
|
||||
<carriage-return> 14
|
||||
<control-A> 17
|
||||
<control-B> 17
|
||||
<control-D> 17, 38, 42
|
||||
<control-E> 18
|
||||
<control-F> 18
|
||||
<control-G> 18
|
||||
<control-H> 18, 39
|
||||
<control-J> 19
|
||||
<control-L> 19
|
||||
<control-M> 19
|
||||
<control-N> 19
|
||||
<control-P> 19
|
||||
<control-R> 19
|
||||
<control-T> 19, 38
|
||||
<control-U> 20
|
||||
<control-W> 20, 39
|
||||
<control-X> 39
|
||||
<control-Y> 20
|
||||
<control-Z> 20, 52
|
||||
<control-]> 20
|
||||
<control-^> 21
|
||||
<end-of-file> 40, 42
|
||||
<erase> 39
|
||||
<escape> 20, 39
|
||||
<interrupt> 12, 37, 39
|
||||
<line erase> 39
|
||||
<literal-next> 12, 39
|
||||
<newline> 14
|
||||
<nul> 38
|
||||
<space> 21
|
||||
<word erase> 39
|
||||
= 43
|
||||
> 26, 43
|
||||
?RE? 25
|
||||
@ 26, 43
|
||||
A 27
|
||||
B 27
|
||||
C 27
|
||||
D 27
|
||||
E 28
|
||||
F 28
|
||||
G 28
|
||||
H 28
|
||||
I 28
|
||||
J 29
|
||||
L 29
|
||||
M 29
|
||||
N 25
|
||||
O 29
|
||||
P 29
|
||||
Q 30
|
||||
R 30
|
||||
S 30
|
||||
T 30
|
||||
U 30
|
||||
W 31
|
||||
X 31
|
||||
Y 31
|
||||
ZZ 31
|
||||
[[ 31
|
||||
\- 24
|
||||
]] 32
|
||||
^ 32
|
||||
^<control-D> 38
|
||||
_ 32
|
||||
`<character> 23
|
||||
a 32
|
||||
abbrev 43
|
||||
alternate pathname 13
|
||||
altwerase 56
|
||||
append 44
|
||||
args 44
|
||||
autoindent 56
|
||||
autoprint 56
|
||||
autowrite 57
|
||||
b 32
|
||||
backup 57
|
||||
beautify 57
|
||||
bg 44
|
||||
bigword 16
|
||||
buffer 13
|
||||
c 33
|
||||
cd 45
|
||||
cdpath 57
|
||||
cedit 57
|
||||
change 45
|
||||
chdir 45
|
||||
columns 58
|
||||
comment 58
|
||||
copy 45
|
||||
count 16, 41
|
||||
cscope 45
|
||||
current pathname 12
|
||||
d 33
|
||||
delete 45
|
||||
directory 58
|
||||
display 45
|
||||
e 33
|
||||
edcompatible 58
|
||||
edit 46
|
||||
errorbells 58
|
||||
escapetime 58
|
||||
exrc 58
|
||||
extended 58
|
||||
exusage 46
|
||||
f 33
|
||||
fg 46
|
||||
file 41, 46
|
||||
filec 58
|
||||
flags 41
|
||||
flash 59
|
||||
global 47
|
||||
hardtabs 59
|
||||
help 47
|
||||
i 33
|
||||
iclower 59
|
||||
ignorecase 59
|
||||
insert 47
|
||||
j 19
|
||||
join 47
|
||||
k 19, 48
|
||||
keytime 59
|
||||
l 21
|
||||
leftright 59
|
||||
line 41
|
||||
lines 59
|
||||
lisp 59
|
||||
list 48, 59
|
||||
lock 59
|
||||
m 34
|
||||
magic 60
|
||||
map 48
|
||||
mark 48
|
||||
matchtime 60
|
||||
mesg 60
|
||||
mkexrc 49
|
||||
modelines 60
|
||||
motion 15
|
||||
move 48
|
||||
msgcat 60
|
||||
n 25
|
||||
next 49
|
||||
noprint 60
|
||||
number 43, 61
|
||||
o 34
|
||||
octal 61
|
||||
open 49, 61
|
||||
optimize 61
|
||||
p 34
|
||||
paragraph 16
|
||||
paragraphs 61
|
||||
path 61
|
||||
preserve 49
|
||||
previous 49
|
||||
previous context 15
|
||||
print 50, 61
|
||||
prompt 61
|
||||
put 50
|
||||
quit 50
|
||||
r 34
|
||||
range 41
|
||||
read 50
|
||||
readonly 61
|
||||
recdir 62
|
||||
recover 50
|
||||
redraw 62
|
||||
remap 62
|
||||
report 62
|
||||
resize 50
|
||||
rewind 51
|
||||
ruler 62
|
||||
s 34
|
||||
scroll 62
|
||||
searchincr 62
|
||||
section 17
|
||||
sections 63
|
||||
secure 63
|
||||
sentence 17
|
||||
set 51
|
||||
shell 51, 63
|
||||
shellmeta 63
|
||||
shiftwidth 63
|
||||
showmatch 63
|
||||
showmode 63
|
||||
sidescroll 63
|
||||
slowopen 63
|
||||
source 51
|
||||
sourceany 64
|
||||
stop 52
|
||||
substitute 51
|
||||
suspend 52
|
||||
t 35, 45
|
||||
tabstop 64
|
||||
tag 52
|
||||
taglength 64
|
||||
tagnext 52
|
||||
tagpop 53
|
||||
tagprev 53
|
||||
tags 64
|
||||
tagtop 53
|
||||
term 64
|
||||
terse 64
|
||||
tildeop 64
|
||||
timeout 64
|
||||
ttywerase 64
|
||||
u 35
|
||||
unabbrev 53
|
||||
undo 53
|
||||
unmap 54
|
||||
unnamed buffer 14
|
||||
v 47
|
||||
verbose 64
|
||||
version 54
|
||||
visual 54
|
||||
viusage 54
|
||||
w 35
|
||||
w1200 64
|
||||
w300 64
|
||||
w9600 64
|
||||
warn 65
|
||||
whitespace 14
|
||||
window 65
|
||||
windowname 65
|
||||
wn 54
|
||||
word 16
|
||||
wq 54
|
||||
wraplen 65
|
||||
wrapmargin 65
|
||||
wrapscan 65
|
||||
write 54
|
||||
writeany 66
|
||||
x 35
|
||||
xit 55
|
||||
y 35
|
||||
yank 55
|
||||
z 36, 55
|
||||
{ 36
|
||||
| 36
|
||||
} 37
|
||||
~ 37, 51
|
@ -1,16 +0,0 @@
|
||||
# @(#)merge.awk 8.3 (Berkeley) 5/25/94
|
||||
#
|
||||
# merge index entries into one line per label
|
||||
$1 == prev {
|
||||
printf ", %s", $2;
|
||||
next;
|
||||
}
|
||||
{
|
||||
if (NR != 1)
|
||||
printf "\n";
|
||||
printf "%s \t%s", $1, $2;
|
||||
prev = $1;
|
||||
}
|
||||
END {
|
||||
printf "\n"
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
.\" Copyright (c) 1994
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\" Copyright (c) 1994, 1995, 1996
|
||||
.\" Keith Bostic. All rights reserved.
|
||||
.\"
|
||||
.\" See the LICENSE file for redistribution information.
|
||||
.\"
|
||||
.\" @(#)ref.so 8.9 (Berkeley) 8/17/96
|
||||
.\"
|
||||
.\"
|
||||
.\" indented paragraph, with spaces between the items, bold font
|
||||
.de IP
|
||||
.\".tm arg 1 \\$1 arg 2 \\$2 arg 3 \\$3
|
||||
.sp 1
|
||||
.nr PS \\n(ps
|
||||
.nr ps 0
|
||||
.ip "\fB\\$1\fP" \\$2
|
||||
.nr ps \\n(PS
|
||||
.br
|
||||
..
|
||||
.\" indented paragraph, no spaces between the items, bold font
|
||||
.de Ip
|
||||
.\".tm arg 1 \\$1 arg 2 \\$2 arg 3 \\$3
|
||||
.nr PS \\n(ps
|
||||
.nr ps 0
|
||||
.ns
|
||||
.ip "\fB\\$1\fP" \\$2
|
||||
.nr ps \\n(PS
|
||||
.br
|
||||
..
|
||||
.\" start nested .IP
|
||||
.de SS
|
||||
.sp
|
||||
.ba +5n
|
||||
..
|
||||
.\" end nested .IP
|
||||
.de SE
|
||||
.ba -5n
|
||||
..
|
||||
.\" nested .IP, no spaces, normal font
|
||||
.de SP
|
||||
.\".tm arg 1 \\$1 arg 2 \\$2 arg 3 \\$3
|
||||
.nr PS \\n(ps
|
||||
.nr ps 0
|
||||
.ns
|
||||
.ip "\\$1" 9n
|
||||
.nr ps \\n(PS
|
||||
..
|
||||
.\" typewriter font
|
||||
.de LI
|
||||
\&\fC\\$1\fP\\$2
|
||||
..
|
||||
.\" ex/vi names in command font
|
||||
.de EV
|
||||
\&\fB\\$1\fP/\fB\\$2\fP\\$3
|
||||
..
|
||||
.\" command names
|
||||
.de CO
|
||||
\&\fB\\$1\fP\\$2
|
||||
..
|
||||
.\" key words for index
|
||||
.de KY
|
||||
.sy echo >>index '\\$1 \\n%'
|
||||
..
|
||||
.\" option names
|
||||
.de OP
|
||||
\&\fB\\$1\fP\\$2
|
||||
..
|
||||
.\" paren quoted (typewriter font)
|
||||
.de PQ
|
||||
(\*(lq\fC\\$1\fP\*(rq)\\$2
|
||||
..
|
||||
.\" quoted bold
|
||||
.de QB
|
||||
\*(lq\fB\\$1\fP\*(rq\\$2
|
||||
..
|
||||
.\" quoted command
|
||||
.de QC
|
||||
\*(lq\fB\\$1\fP\*(rq\\$2
|
||||
..
|
||||
.\" quoted option
|
||||
.de QO
|
||||
\*(lq\fB\\$1\fP\*(rq\\$2
|
||||
..
|
||||
.\" quoted (no font change)
|
||||
.de QQ
|
||||
\*(lq\\$1\*(rq\\$2
|
||||
..
|
||||
.\" quoted (typewriter font)
|
||||
.de QT
|
||||
\*(lq\fC\\$1\fP\*(rq\\$2
|
||||
..
|
||||
.\" section macro to build TOC
|
||||
.de SH
|
||||
.(x
|
||||
\\$2
|
||||
.)x
|
||||
.sh \\$1 "\\$2"
|
||||
..
|
||||
.\" manual section
|
||||
.de XR
|
||||
\&\fI\\$1\fP(\\$2)\\$3
|
||||
..
|
File diff suppressed because it is too large
Load Diff
@ -1,414 +0,0 @@
|
||||
ABC
|
||||
Amir
|
||||
Autoindent
|
||||
Autoprint
|
||||
BRE's
|
||||
Bostic
|
||||
Bourne
|
||||
CDPATH
|
||||
CSCOPE
|
||||
Cscope
|
||||
DIRS
|
||||
DOUBLEQUOTE
|
||||
Dq
|
||||
Ds
|
||||
ERE's
|
||||
EXINIT
|
||||
Englar
|
||||
Ev
|
||||
FF
|
||||
Fa
|
||||
Fg
|
||||
FindScreen
|
||||
Fl
|
||||
Foregrounding
|
||||
HUnhsh
|
||||
IPLPPPQPP
|
||||
Kirkendall
|
||||
Korn
|
||||
LC
|
||||
LIpplpipbp
|
||||
LaA
|
||||
Li
|
||||
Lowercase
|
||||
MINUSSIGN
|
||||
Makefiles
|
||||
Mayoff
|
||||
NEX
|
||||
NEXINIT
|
||||
NHSHH
|
||||
NVI
|
||||
Neville
|
||||
Nex
|
||||
Nvi
|
||||
OS
|
||||
POSIX
|
||||
Perl
|
||||
PostScript
|
||||
QQ
|
||||
RE's
|
||||
README
|
||||
RECDIR
|
||||
Reference''USD:13
|
||||
SENDMAIL
|
||||
SIGHUP
|
||||
SIGWINCH
|
||||
SQUOTE
|
||||
Se
|
||||
Std
|
||||
Std1003.2
|
||||
Sven
|
||||
Sy
|
||||
TANDARDS
|
||||
TIOCGWINSZ
|
||||
TMPDIR
|
||||
TOC
|
||||
Tagnext
|
||||
Tagprev
|
||||
Tcl
|
||||
Tk
|
||||
Todo
|
||||
USD
|
||||
USD.doc
|
||||
USD:13
|
||||
UUNET
|
||||
Unmap
|
||||
VI
|
||||
Verdoolaege
|
||||
Vi
|
||||
Vx
|
||||
Whitespace
|
||||
XOFF
|
||||
XON
|
||||
XOptions
|
||||
XXCOLUMNS
|
||||
XXXX
|
||||
XXXXXX
|
||||
XXb
|
||||
ZZ
|
||||
ab
|
||||
abbrev
|
||||
abc
|
||||
ags
|
||||
ai
|
||||
al
|
||||
altwerase
|
||||
ap
|
||||
api
|
||||
ar
|
||||
arg
|
||||
args
|
||||
att
|
||||
autoindent
|
||||
autoprint
|
||||
autowrite
|
||||
aw
|
||||
backgrounded
|
||||
backgrounding
|
||||
bbrev
|
||||
berkeley
|
||||
bf
|
||||
bg
|
||||
bigword
|
||||
bigwords
|
||||
bostic
|
||||
bp
|
||||
brev
|
||||
bsd
|
||||
bugs.current
|
||||
c2w
|
||||
carat
|
||||
cd
|
||||
cdpath
|
||||
cdy
|
||||
cedit
|
||||
changelog
|
||||
chd
|
||||
chdir
|
||||
cmd
|
||||
co
|
||||
count1
|
||||
count2
|
||||
creens
|
||||
cs
|
||||
cs.berkeley.edu
|
||||
cscope
|
||||
ctags
|
||||
cw
|
||||
db
|
||||
dbopen
|
||||
dd
|
||||
def
|
||||
di
|
||||
dir
|
||||
dit
|
||||
docs
|
||||
eE
|
||||
eFlRsv
|
||||
eFlRv
|
||||
eL
|
||||
eU
|
||||
ead
|
||||
eb
|
||||
edcompatible
|
||||
edu
|
||||
ee
|
||||
egrep
|
||||
elete
|
||||
elp
|
||||
elvis
|
||||
email
|
||||
enum
|
||||
eof
|
||||
errorbells
|
||||
esc
|
||||
escapetime
|
||||
eset
|
||||
eu
|
||||
ex.cmd.roff
|
||||
exrc
|
||||
ext
|
||||
exu
|
||||
exusage
|
||||
fcntl
|
||||
fg
|
||||
fi
|
||||
filec
|
||||
filesystem
|
||||
filesystems
|
||||
foo
|
||||
foregrounded
|
||||
foregrounding
|
||||
ftp.cs.berkeley.edu
|
||||
ftp.uu.net
|
||||
gdb
|
||||
gdb.script
|
||||
getpwent
|
||||
gs
|
||||
gzip'd
|
||||
halfbyte
|
||||
hange
|
||||
hangup
|
||||
hardtabs
|
||||
ht
|
||||
html
|
||||
http
|
||||
ic
|
||||
iclower
|
||||
ifdef
|
||||
ignorecase
|
||||
ile
|
||||
ind
|
||||
initially
|
||||
ious
|
||||
ir
|
||||
iscntrl
|
||||
isprint
|
||||
ist
|
||||
ize
|
||||
keystroke
|
||||
keystrokes
|
||||
keytime
|
||||
leftright
|
||||
lhs
|
||||
li
|
||||
lib
|
||||
libc
|
||||
libc.tags
|
||||
lineNum
|
||||
lineNumber
|
||||
lobal
|
||||
lowercase
|
||||
lp
|
||||
luR
|
||||
matchtime
|
||||
mber
|
||||
mesg
|
||||
meta
|
||||
mk
|
||||
mkexrc
|
||||
modeful
|
||||
modeline
|
||||
modelines
|
||||
ms
|
||||
msgcat
|
||||
ndo
|
||||
nex
|
||||
nexrc
|
||||
nk
|
||||
nomagic
|
||||
nonblank
|
||||
nonoverlapping
|
||||
nooption
|
||||
noprint
|
||||
nsert
|
||||
nul
|
||||
nvi
|
||||
nvi.tar.Z
|
||||
nvi.tar.z
|
||||
nz
|
||||
oin
|
||||
onnections
|
||||
op
|
||||
ove
|
||||
para
|
||||
pathname
|
||||
pathnames
|
||||
pe
|
||||
perl
|
||||
perld
|
||||
ppend
|
||||
prev
|
||||
pu
|
||||
py
|
||||
rc
|
||||
rc.local
|
||||
readonly
|
||||
rec
|
||||
recdir
|
||||
recfile
|
||||
recover.XXXX
|
||||
recover.XXXXXX
|
||||
recover.c
|
||||
recover.script
|
||||
redist
|
||||
redistributable
|
||||
reimplementations
|
||||
remapmax
|
||||
remapped
|
||||
repl
|
||||
res
|
||||
rew
|
||||
rhs
|
||||
rint
|
||||
ript
|
||||
rk
|
||||
rl
|
||||
ro
|
||||
roff
|
||||
rsion
|
||||
sc
|
||||
sccs
|
||||
scr
|
||||
screeen
|
||||
screenId
|
||||
se
|
||||
searchincr
|
||||
sendmail
|
||||
set.opt.roff
|
||||
settable
|
||||
setuid
|
||||
sh
|
||||
shareware
|
||||
shellmeta
|
||||
shiftwidth
|
||||
showmatch
|
||||
showmode
|
||||
sidescroll
|
||||
slowopen
|
||||
sm
|
||||
smd
|
||||
sourceany
|
||||
sp
|
||||
spell.ok
|
||||
ssg
|
||||
st
|
||||
su
|
||||
sual
|
||||
svi
|
||||
sw
|
||||
ta
|
||||
tabstop
|
||||
taglength
|
||||
tagn
|
||||
tagnext
|
||||
tagp
|
||||
tagpop
|
||||
tagprev
|
||||
tagstring
|
||||
tagt
|
||||
tagtop
|
||||
tc
|
||||
tcl
|
||||
tclproc
|
||||
terminfo
|
||||
th
|
||||
th's
|
||||
tildeop
|
||||
tl
|
||||
tmp
|
||||
toolchest
|
||||
tpath
|
||||
tr
|
||||
ts
|
||||
ttytype
|
||||
ttywerase
|
||||
uR
|
||||
ubstitute
|
||||
ucb
|
||||
uffers
|
||||
uit
|
||||
una
|
||||
unabbrev
|
||||
unescaped
|
||||
unm
|
||||
unmap
|
||||
unsets
|
||||
uppercase
|
||||
urce
|
||||
usr
|
||||
uunet
|
||||
v
|
||||
var
|
||||
ve
|
||||
vi
|
||||
vi.0.ps
|
||||
vi.0.txt
|
||||
vi.1
|
||||
vi.XXXX
|
||||
vi.XXXXXX
|
||||
vi.cmd.roff
|
||||
vi.exrc
|
||||
vi.recover
|
||||
viAppendLine
|
||||
viDelLine
|
||||
viEndScreen
|
||||
viFindScreen
|
||||
viGetCursor
|
||||
viGetLine
|
||||
viGetMark
|
||||
viGetOpt
|
||||
viInsertLine
|
||||
viLastLine
|
||||
viMapKey
|
||||
viMsg
|
||||
viNewScreen
|
||||
viSetCursor
|
||||
viSetLine
|
||||
viSetMark
|
||||
viSetOpt
|
||||
viSwitchScreen
|
||||
viUnmMapKey
|
||||
vibackup
|
||||
virecovery
|
||||
viu
|
||||
viusage
|
||||
wa
|
||||
whitespace
|
||||
wi
|
||||
windowname
|
||||
wl
|
||||
wm
|
||||
wn
|
||||
wq
|
||||
wraplen
|
||||
wrapmargin
|
||||
wrapscan
|
||||
writeany
|
||||
ws
|
||||
www
|
||||
xaw
|
||||
xit
|
||||
xterm
|
||||
ya
|
||||
yy
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,22 +0,0 @@
|
||||
# @(#)Makefile 8.7 (Berkeley) 8/18/96
|
||||
|
||||
MACROS= -ms
|
||||
ROFF= groff
|
||||
TBL= tbl
|
||||
|
||||
all: vitut.ps summary.ps viapwh.ps
|
||||
|
||||
vitut.ps: vi.in vi.chars
|
||||
${TBL} vi.in vi.chars | ${ROFF} ${MACROS} > $@
|
||||
chmod 444 $@
|
||||
|
||||
summary.ps: vi.summary
|
||||
${TBL} vi.summary | ${ROFF} ${MACROS} > $@
|
||||
chmod 444 $@
|
||||
|
||||
viapwh.ps: vi.apwh.ms
|
||||
${TBL} vi.apwh.ms | ${ROFF} ${MACROS} > $@
|
||||
chmod 444 $@
|
||||
|
||||
clean:
|
||||
rm -f vitut.ps summary.ps viapwh.ps
|
File diff suppressed because it is too large
Load Diff
@ -1,645 +0,0 @@
|
||||
.\" Copyright (c) 1980, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)vi.chars 8.3 (Berkeley) 6/27/96
|
||||
.\"
|
||||
.bd S 3
|
||||
.pn 21
|
||||
.de iP
|
||||
.IP "\fB\\$1\fR" \\$2
|
||||
..
|
||||
.SH
|
||||
Appendix: character functions
|
||||
.PP
|
||||
This appendix gives the uses the editor makes of each character. The
|
||||
characters are presented in their order in the \s-2ASCII\s0 character
|
||||
set: Control characters come first, then most special characters, then
|
||||
the digits, upper and then lower case characters.
|
||||
.PP
|
||||
For each character we tell a meaning it has as a command and any meaning it
|
||||
has during an insert.
|
||||
If it has only meaning as a command, then only this is discussed.
|
||||
Section numbers in parentheses indicate where the character is discussed;
|
||||
a `f' after the section number means that the character is mentioned
|
||||
in a footnote.
|
||||
.iP "^@" 15
|
||||
Not a command character.
|
||||
If typed as the first character of an insertion it is replaced with the
|
||||
last text inserted, and the insert terminates. Only 128 characters are
|
||||
saved from the last insert; if more characters were inserted the mechanism
|
||||
is not available.
|
||||
A \fB^@\fR cannot be part of the file due to the editor implementation
|
||||
(7.5f).
|
||||
.iP "^A" 15
|
||||
Unused.
|
||||
.iP "^B" 15
|
||||
Backward window.
|
||||
A count specifies repetition.
|
||||
Two lines of continuity are kept if possible (2.1, 6.1, 7.2).
|
||||
.iP "^C" 15
|
||||
Unused.
|
||||
.iP "^D" 15
|
||||
As a command, scrolls down a half-window of text.
|
||||
A count gives the number of (logical) lines to scroll, and is remembered
|
||||
for future \fB^D\fR and \fB^U\fR commands (2.1, 7.2).
|
||||
During an insert, backtabs over \fIautoindent\fR white space at the beginning
|
||||
of a line (6.6, 7.5); this white space cannot be backspaced over.
|
||||
.iP "^E" 15
|
||||
Exposes one more line below the current screen in the file, leaving
|
||||
the cursor where it is if possible.
|
||||
(Version 3 only.)
|
||||
.iP "^F" 15
|
||||
Forward window. A count specifies repetition.
|
||||
Two lines of continuity are kept if possible (2.1, 6.1, 7.2).
|
||||
.iP "^G" 15
|
||||
Equivalent to \fB:f\fR\s-2CR\s0, printing the current file, whether
|
||||
it has been modified, the current line number and the number of lines
|
||||
in the file, and the percentage of the way through the file that you
|
||||
are.
|
||||
.iP "^H (\fR\s-2BS\s0\fP)" 15
|
||||
Same as
|
||||
.B "left arrow" .
|
||||
(See
|
||||
.B h ).
|
||||
During an insert, eliminates the last input character, backing over it
|
||||
but not erasing it; it remains so you can see what you typed if you
|
||||
wish to type something only slightly different (3.1, 7.5).
|
||||
.iP "^I\ (\fR\s-2TAB\s0\fP)" 15
|
||||
Not a command character.
|
||||
When inserted it prints as some
|
||||
number of spaces.
|
||||
When the cursor is at a tab character it rests at the last of the spaces
|
||||
which represent the tab.
|
||||
The spacing of tabstops is controlled by the \fItabstop\fR option (4.1, 6.6).
|
||||
.iP "^J\ (\fR\s-2LF\s0\fP)" 15
|
||||
Same as
|
||||
.B "down arrow"
|
||||
(see
|
||||
.B j ).
|
||||
.iP "^K" 15
|
||||
Unused.
|
||||
.iP "^L" 15
|
||||
The \s-2ASCII\s0 formfeed character, this causes the screen to be cleared
|
||||
and redrawn. This is useful after a transmission error, if characters
|
||||
typed by a program other than the editor scramble the screen,
|
||||
or after output is stopped by an interrupt (5.4, 7.2f).
|
||||
.ne 1i
|
||||
.iP "^M\ (\fR\s-2CR\s0\fP)" 15
|
||||
A carriage return advances to the next line, at the first non-white position
|
||||
in the line. Given a count, it advances that many lines (2.3).
|
||||
During an insert, a \s-2CR\s0 causes the insert to continue onto
|
||||
another line (3.1).
|
||||
.iP "^N" 15
|
||||
Same as
|
||||
.B "down arrow"
|
||||
(see
|
||||
.B j ).
|
||||
.iP "^O" 15
|
||||
Unused.
|
||||
.iP "^P" 15
|
||||
Same as
|
||||
.B "up arrow"
|
||||
(see
|
||||
.B k ).
|
||||
.iP "^Q" 15
|
||||
Not a command character.
|
||||
In input mode,
|
||||
.B ^Q
|
||||
quotes the next character, the same as
|
||||
.B ^V ,
|
||||
except that some teletype drivers will eat the
|
||||
.B ^Q
|
||||
so that the editor never sees it.
|
||||
.iP "^R" 15
|
||||
Redraws the current screen, eliminating logical lines not corresponding
|
||||
to physical lines (lines with only a single @ character on them).
|
||||
On hardcopy terminals in \fIopen\fR mode, retypes the current line
|
||||
(5.4, 7.2, 7.8).
|
||||
.iP "^S" 15
|
||||
Unused. Some teletype drivers use
|
||||
.B ^S
|
||||
to suspend output until
|
||||
.B ^Q is pressed.
|
||||
.iP "^T" 15
|
||||
Not a command character.
|
||||
During an insert, with \fIautoindent\fR set and at the beginning of the
|
||||
line, inserts \fIshiftwidth\fR white space.
|
||||
.iP "^U" 15
|
||||
Scrolls the screen up, inverting \fB^D\fR which scrolls down. Counts work as
|
||||
they do for \fB^D\fR, and the previous scroll amount is common to both.
|
||||
On a dumb terminal, \fB^U\fR will often necessitate clearing and redrawing
|
||||
the screen further back in the file (2.1, 7.2).
|
||||
.iP "^V" 15
|
||||
Not a command character.
|
||||
In input mode, quotes the next character so that it is possible
|
||||
to insert non-printing and special characters into the file (4.2, 7.5).
|
||||
.iP "^W" 15
|
||||
Not a command character.
|
||||
During an insert, backs up as \fBb\fR would in command mode; the deleted
|
||||
characters remain on the display (see \fB^H\fR) (7.5).
|
||||
.iP "^X" 15
|
||||
Unused.
|
||||
.iP "^Y" 15
|
||||
Exposes one more line above the current screen, leaving the cursor where
|
||||
it is if possible. (No mnemonic value for this key; however, it is next
|
||||
to \fB^U\fR which scrolls up a bunch.)
|
||||
(Version 3 only.)
|
||||
.iP "^Z" 15
|
||||
If supported by the Unix system,
|
||||
stops the editor, exiting to the top level shell.
|
||||
Same as \fB:stop\fP\s-2CR\s0.
|
||||
Otherwise, unused.
|
||||
.iP "^[\ (\fR\s-2ESC\s0\fP)" 15
|
||||
Cancels a partially formed command, such as a \fBz\fR when no following
|
||||
character has yet been given; terminates inputs on the last line (read
|
||||
by commands such as \fB: /\fR and \fB?\fR); ends insertions of new text
|
||||
into the buffer.
|
||||
If an \s-2ESC\s0 is given when quiescent in command state, the editor
|
||||
rings the bell or flashes the screen. You can thus hit \s-2ESC\s0 if
|
||||
you don't know what is happening till the editor rings the bell.
|
||||
If you don't know if you are in insert mode you can type \s-2ESC\s0\fBa\fR,
|
||||
and then material to be input; the material will be inserted correctly
|
||||
whether or not you were in insert mode when you started (1.5, 3.1, 7.5).
|
||||
.iP "^\e" 15
|
||||
Unused.
|
||||
.iP "^]" 15
|
||||
Searches for the word which is after the cursor as a tag. Equivalent
|
||||
to typing \fB:ta\fR, this word, and then a \s-2CR\s0.
|
||||
Mnemonically, this command is ``go right to'' (7.3).
|
||||
.iP "^\(ua" 15
|
||||
Equivalent to \fB:e #\fR\s-2CR\s0, returning to the previous position
|
||||
in the last edited file, or editing a file which you specified if you
|
||||
got a `No write since last change diagnostic' and do not want to have
|
||||
to type the file name again (7.3).
|
||||
(You have to do a \fB:w\fR before \fB^\(ua\fR
|
||||
will work in this case. If you do not wish to write the file you should
|
||||
do \fB:e!\ #\fR\s-2CR\s0 instead.)
|
||||
.iP "^_" 15
|
||||
Unused.
|
||||
Reserved as the command character for the
|
||||
Tektronix 4025 and 4027 terminal.
|
||||
.iP "\fR\s-2SPACE\s0\fP" 15
|
||||
Same as
|
||||
.B "right arrow"
|
||||
(see
|
||||
.B l ).
|
||||
.iP "!" 15
|
||||
An operator, which processes lines from the buffer with reformatting commands.
|
||||
Follow \fB!\fR with the object to be processed, and then the command name
|
||||
terminated by \s-2CR\s0. Doubling \fB!\fR and preceding it by a count
|
||||
causes count lines to be filtered; otherwise the count
|
||||
is passed on to the object after the \fB!\fR. Thus \fB2!}\fR\fIfmt\fR\s-2CR\s0
|
||||
reformats the next two paragraphs by running them through the program
|
||||
\fIfmt\fR. If you are working on \s-2LISP\s0,
|
||||
the command \fB!%\fR\fIgrind\fR\s-2CR\s0,*
|
||||
.FS
|
||||
*Both
|
||||
.I fmt
|
||||
and
|
||||
.I grind
|
||||
are Berkeley programs and may not be present at all installations.
|
||||
.FE
|
||||
given at the beginning of a
|
||||
function, will run the text of the function through the \s-2LISP\s0 grinder
|
||||
(6.7, 7.3).
|
||||
To read a file or the output of a command into the buffer use \fB:r\fR (7.3).
|
||||
To simply execute a command use \fB:!\fR (7.3).
|
||||
.tr "
|
||||
.iP 15
|
||||
Precedes a named buffer specification. There are named buffers \fB1\-9\fR
|
||||
used for saving deleted text and named buffers \fBa\-z\fR into which you can
|
||||
place text (4.3, 6.3)
|
||||
.tr
|
||||
.iP "#" 15
|
||||
The macro character which, when followed by a number, will substitute
|
||||
for a function key on terminals without function keys (6.9).
|
||||
In input mode,
|
||||
if this is your erase character, it will delete the last character
|
||||
you typed in input mode, and must be preceded with a \fB\e\fR to insert
|
||||
it, since it normally backs over the last input character you gave.
|
||||
.iP "$" 15
|
||||
Moves to the end of the current line. If you \fB:se list\fR\s-2CR\s0,
|
||||
then the end of each line will be shown by printing a \fB$\fR after the
|
||||
end of the displayed text in the line. Given a count, advances to the
|
||||
count'th following end of line; thus \fB2$\fR advances to the end of the
|
||||
following line.
|
||||
.iP "%" 15
|
||||
Moves to the parenthesis or brace \fB{ }\fR which balances the parenthesis
|
||||
or brace at the current cursor position.
|
||||
.iP "&" 15
|
||||
A synonym for \fB:&\fR\s-2CR\s0, by analogy with the
|
||||
.I ex
|
||||
.B &
|
||||
command.
|
||||
.iP "\(aa" 15
|
||||
When followed by a \fB\(aa\fR returns to the previous context at the
|
||||
beginning of a line. The previous context is set whenever the current
|
||||
line is moved in a non-relative way.
|
||||
When followed by a letter \fBa\fR\-\fBz\fR, returns to the line which
|
||||
was marked with this letter with a \fBm\fR command, at the first non-white
|
||||
character in the line. (2.2, 5.3).
|
||||
When used with an operator such as \fBd\fR, the operation takes place
|
||||
over complete lines; if you use \fB\(ga\fR, the operation takes place
|
||||
from the exact marked place to the current cursor position within the
|
||||
line.
|
||||
.iP "(" 15
|
||||
Retreats to the beginning of a
|
||||
sentence, or to the beginning of a \s-2LISP\s0 s-expression
|
||||
if the \fIlisp\fR option is set.
|
||||
A sentence ends at a \fB. !\fR or \fB?\fR which is followed by either
|
||||
the end of a line or by two spaces. Any number of closing \fB) ] "\fR
|
||||
and \fB\(aa\fR characters may appear after the \fB. !\fR or \fB?\fR,
|
||||
and before the spaces or end of line. Sentences also begin
|
||||
at paragraph and section boundaries
|
||||
(see \fB{\fR and \fB[[\fR below).
|
||||
A count advances that many sentences (4.2, 6.8).
|
||||
.iP ")" 15
|
||||
Advances to the beginning of a sentence.
|
||||
A count repeats the effect.
|
||||
See \fB(\fR above for the definition of a sentence (4.2, 6.8).
|
||||
.iP "*" 15
|
||||
Unused.
|
||||
.iP "+" 15
|
||||
Same as \s-2CR\s0 when used as a command.
|
||||
.iP "," 15
|
||||
Reverse of the last \fBf F t\fR or \fBT\fR command, looking the other way
|
||||
in the current line. Especially useful after hitting too many \fB;\fR
|
||||
characters. A count repeats the search.
|
||||
.iP "\-" 15
|
||||
Retreats to the previous line at the first non-white character.
|
||||
This is the inverse of \fB+\fR and \s-2RETURN\s0.
|
||||
If the line moved to is not on the screen, the screen is scrolled, or
|
||||
cleared and redrawn if this is not possible.
|
||||
If a large amount of scrolling would be required the screen is also cleared
|
||||
and redrawn, with the current line at the center (2.3).
|
||||
.iP "\&." 15
|
||||
Repeats the last command which changed the buffer. Especially useful
|
||||
when deleting words or lines; you can delete some words/lines and then
|
||||
hit \fB.\fR to delete more and more words/lines.
|
||||
Given a count, it passes it on to the command being repeated. Thus after
|
||||
a \fB2dw\fR, \fB3.\fR deletes three words (3.3, 6.3, 7.2, 7.4).
|
||||
.iP "/" 15
|
||||
Reads a string from the last line on the screen, and scans forward for
|
||||
the next occurrence of this string. The normal input editing sequences may
|
||||
be used during the input on the bottom line; an returns to command state
|
||||
without ever searching.
|
||||
The search begins when you hit \s-2CR\s0 to terminate the pattern;
|
||||
the cursor moves to the beginning of the last line to indicate that the search
|
||||
is in progress; the search may then
|
||||
be terminated with a \s-2DEL\s0 or \s-2RUB\s0, or by backspacing when
|
||||
at the beginning of the bottom line, returning the cursor to
|
||||
its initial position.
|
||||
Searches normally wrap end-around to find a string
|
||||
anywhere in the buffer.
|
||||
.IP
|
||||
When used with an operator the enclosed region is normally affected.
|
||||
By mentioning an
|
||||
offset from the line matched by the pattern you can force whole lines
|
||||
to be affected. To do this give a pattern with a closing
|
||||
a closing \fB/\fR and then an offset \fB+\fR\fIn\fR or \fB\-\fR\fIn\fR.
|
||||
.IP
|
||||
To include the character \fB/\fR in the search string, you must escape
|
||||
it with a preceding \fB\e\fR.
|
||||
A \fB\(ua\fR at the beginning of the pattern forces the match to occur
|
||||
at the beginning of a line only; this speeds the search. A \fB$\fR at
|
||||
the end of the pattern forces the match to occur at the end of a line
|
||||
only.
|
||||
More extended pattern matching is available, see section 7.4;
|
||||
unless you set \fBnomagic\fR in your \fI\&.exrc\fR file you will have
|
||||
to preceed the characters \fB. [ *\fR and \fB~\fR in the search pattern
|
||||
with a \fB\e\fR to get them to work as you would naively expect (1.5, 2,2,
|
||||
6.1, 7.2, 7.4).
|
||||
.iP "0" 15
|
||||
Moves to the first character on the current line.
|
||||
Also used, in forming numbers, after an initial \fB1\fR\-\fB9\fR.
|
||||
.iP "1\-9" 15
|
||||
Used to form numeric arguments to commands (2.3, 7.2).
|
||||
.iP ":" 15
|
||||
A prefix to a set of commands for file and option manipulation and escapes
|
||||
to the system. Input is given on the bottom line and terminated with
|
||||
an \s-2CR\s0, and the command then executed. You can return to where
|
||||
you were by hitting \s-2DEL\s0 or \s-2RUB\s0 if you hit \fB:\fR accidentally
|
||||
(see primarily 6.2 and 7.3).
|
||||
.iP ";" 15
|
||||
Repeats the last single character find which used \fBf F t\fR or \fBT\fR.
|
||||
A count iterates the basic scan (4.1).
|
||||
.iP "<" 15
|
||||
An operator which shifts lines left one \fIshiftwidth\fR, normally 8
|
||||
spaces. Like all operators, affects lines when repeated, as in
|
||||
\fB<<\fR. Counts are passed through to the basic object, thus \fB3<<\fR
|
||||
shifts three lines (6.6, 7.2).
|
||||
.iP "=" 15
|
||||
Reindents line for \s-2LISP\s0, as though they were typed in with \fIlisp\fR
|
||||
and \fIautoindent\fR set (6.8).
|
||||
.iP ">" 15
|
||||
An operator which shifts lines right one \fIshiftwidth\fR, normally 8
|
||||
spaces. Affects lines when repeated as in \fB>>\fR. Counts repeat the
|
||||
basic object (6.6, 7.2).
|
||||
.iP "?" 15
|
||||
Scans backwards, the opposite of \fB/\fR. See the \fB/\fR description
|
||||
above for details on scanning (2.2, 6.1, 7.4).
|
||||
.iP "@" 15
|
||||
A macro character (6.9). If this is your kill character, you must escape it with a \e
|
||||
to type it in during input mode, as it normally backs over the input you
|
||||
have given on the current line (3.1, 3.4, 7.5).
|
||||
.iP "A" 15
|
||||
Appends at the end of line, a synonym for \fB$a\fR (7.2).
|
||||
.iP "B" 15
|
||||
Backs up a word, where words are composed of non-blank sequences, placing
|
||||
the cursor at the beginning of the word. A count repeats the effect
|
||||
(2.4).
|
||||
.iP "C" 15
|
||||
Changes the rest of the text on the current line; a synonym for \fBc$\fR.
|
||||
.iP "D" 15
|
||||
Deletes the rest of the text on the current line; a synonym for \fBd$\fR.
|
||||
.iP "E" 15
|
||||
Moves forward to the end of a word, defined as blanks and non-blanks,
|
||||
like \fBB\fR and \fBW\fR. A count repeats the effect.
|
||||
.iP "F" 15
|
||||
Finds a single following character, backwards in the current line.
|
||||
A count repeats this search that many times (4.1).
|
||||
.iP "G" 15
|
||||
Goes to the line number given as preceding argument, or the end of the
|
||||
file if no preceding count is given. The screen is redrawn with the
|
||||
new current line in the center if necessary (7.2).
|
||||
.iP "H" 15
|
||||
.B "Home arrow" .
|
||||
Homes the cursor to the top line on the screen. If a count is given,
|
||||
then the cursor is moved to the count'th line on the screen.
|
||||
In any case the cursor is moved to the first non-white character on the
|
||||
line. If used as the target of an operator, full lines are affected
|
||||
(2.3, 3.2).
|
||||
.iP "I" 15
|
||||
Inserts at the beginning of a line; a synonym for \fB\(uai\fR.
|
||||
.iP "J" 15
|
||||
Joins together lines, supplying appropriate white space: one space between
|
||||
words, two spaces after a \fB.\fR, and no spaces at all if the first
|
||||
character of the joined on line is \fB)\fR. A count causes that many
|
||||
lines to be joined rather than the default two (6.5, 7.1f).
|
||||
.iP "K" 15
|
||||
Unused.
|
||||
.iP "L" 15
|
||||
Moves the cursor to the first non-white character of the last line on
|
||||
the screen. With a count, to the first non-white of the count'th line
|
||||
from the bottom. Operators affect whole lines when used with \fBL\fR
|
||||
(2.3).
|
||||
.iP "M" 15
|
||||
Moves the cursor to the middle line on the screen, at the first non-white
|
||||
position on the line (2.3).
|
||||
.iP "N" 15
|
||||
Scans for the next match of the last pattern given to
|
||||
\fB/\fR or \fB?\fR, but in the reverse direction; this is the reverse
|
||||
of \fBn\fR.
|
||||
.iP "O" 15
|
||||
Opens a new line above the current line and inputs text there up to an
|
||||
\s-2ESC\s0. A count can be used on dumb terminals to specify a number
|
||||
of lines to be opened; this is generally obsolete, as the \fIslowopen\fR
|
||||
option works better (3.1).
|
||||
.iP "P" 15
|
||||
Puts the last deleted text back before/above the cursor. The text goes
|
||||
back as whole lines above the cursor if it was deleted as whole lines.
|
||||
Otherwise the text is inserted between the characters before and at the
|
||||
cursor. May be preceded by a named buffer specification \fB"\fR\fIx\fR
|
||||
to retrieve the contents of the buffer; buffers \fB1\fR\-\fB9\fR contain
|
||||
deleted material, buffers \fBa\fR\-\fBz\fR are available for general
|
||||
use (6.3).
|
||||
.iP "Q" 15
|
||||
Quits from \fIvi\fR to \fIex\fR command mode. In this mode, whole lines
|
||||
form commands, ending with a \s-2RETURN\s0. You can give all the \fB:\fR
|
||||
commands; the editor supplies the \fB:\fR as a prompt (7.7).
|
||||
.iP "R" 15
|
||||
Replaces characters on the screen with characters you type (overlay fashion).
|
||||
Terminates with an \s-2ESC\s0.
|
||||
.iP "S" 15
|
||||
Changes whole lines, a synonym for \fBcc\fR. A count substitutes for
|
||||
that many lines. The lines are saved in the numeric buffers, and erased
|
||||
on the screen before the substitution begins.
|
||||
.iP "T" 15
|
||||
Takes a single following character, locates the character before the
|
||||
cursor in the current line, and places the cursor just after that character.
|
||||
A count repeats the effect. Most useful with operators such as \fBd\fR
|
||||
(4.1).
|
||||
.iP "U" 15
|
||||
Restores the current line to its state before you started changing it
|
||||
(3.5).
|
||||
.iP "V" 15
|
||||
Unused.
|
||||
.iP "W" 15
|
||||
Moves forward to the beginning of a word in the current line,
|
||||
where words are defined as sequences of blank/non-blank characters.
|
||||
A count repeats the effect (2.4).
|
||||
.iP "X" 15
|
||||
Deletes the character before the cursor. A count repeats the effect,
|
||||
but only characters on the current line are deleted.
|
||||
.iP "Y" 15
|
||||
Yanks a copy of the current line into the unnamed buffer, to be put back
|
||||
by a later \fBp\fR or \fBP\fR; a very useful synonym for \fByy\fR.
|
||||
A count yanks that many lines. May be preceded by a buffer name to put
|
||||
lines in that buffer (7.4).
|
||||
.iP "ZZ" 15
|
||||
Exits the editor.
|
||||
(Same as \fB:x\fP\s-2CR\s0.)
|
||||
If any changes have been made, the buffer is written out to the current file.
|
||||
Then the editor quits.
|
||||
.iP "[[" 15
|
||||
Backs up to the previous section boundary. A section begins at each
|
||||
macro in the \fIsections\fR option,
|
||||
normally a `.NH' or `.SH' and also at lines which which start
|
||||
with a formfeed \fB^L\fR. Lines beginning with \fB{\fR also stop \fB[[\fR;
|
||||
this makes it useful for looking backwards, a function at a time, in C
|
||||
programs. If the option \fIlisp\fR is set, stops at each \fB(\fR at the
|
||||
beginning of a line, and is thus useful for moving backwards at the top
|
||||
level \s-2LISP\s0 objects. (4.2, 6.1, 6.6, 7.2).
|
||||
.iP "\e" 15
|
||||
Unused.
|
||||
.iP "]]" 15
|
||||
Forward to a section boundary, see \fB[[\fR for a definition (4.2, 6.1,
|
||||
6.6, 7.2).
|
||||
.iP "\(ua" 15
|
||||
Moves to the first non-white position on the current line (4.4).
|
||||
.iP "_" 15
|
||||
Unused.
|
||||
.iP "\(ga" 15
|
||||
When followed by a \fB\(ga\fR returns to the previous context.
|
||||
The previous context is set whenever the current
|
||||
line is moved in a non-relative way.
|
||||
When followed by a letter \fBa\fR\-\fBz\fR, returns to the position which
|
||||
was marked with this letter with a \fBm\fR command.
|
||||
When used with an operator such as \fBd\fR, the operation takes place
|
||||
from the exact marked place to the current position within the line;
|
||||
if you use \fB\(aa\fR, the operation takes place over complete lines
|
||||
(2.2, 5.3).
|
||||
.iP "a" 15
|
||||
Appends arbitrary text after the current cursor position; the insert
|
||||
can continue onto multiple lines by using \s-2RETURN\s0 within the insert.
|
||||
A count causes the inserted text to be replicated, but only if the inserted
|
||||
text is all on one line.
|
||||
The insertion terminates with an \s-2ESC\s0 (3.1, 7.2).
|
||||
.iP "b" 15
|
||||
Backs up to the beginning of a word in the current line. A word is a
|
||||
sequence of alphanumerics, or a sequence of special characters.
|
||||
A count repeats the effect (2.4).
|
||||
.iP "c" 15
|
||||
An operator which changes the following object, replacing it with the
|
||||
following input text up to an \s-2ESC\s0. If more than part of a single
|
||||
line is affected, the text which is changed away is saved in the numeric named
|
||||
buffers. If only part of the current line is affected, then the last
|
||||
character to be changed away is marked with a \fB$\fR.
|
||||
A count causes that many objects to be affected, thus both
|
||||
\fB3c)\fR and \fBc3)\fR change the following three sentences (7.4).
|
||||
.iP "d" 15
|
||||
An operator which deletes the following object. If more than part of
|
||||
a line is affected, the text is saved in the numeric buffers.
|
||||
A count causes that many objects to be affected; thus \fB3dw\fR is the
|
||||
same as \fBd3w\fR (3.3, 3.4, 4.1, 7.4).
|
||||
.iP "e" 15
|
||||
Advances to the end of the next word, defined as for \fBb\fR and \fBw\fR.
|
||||
A count repeats the effect (2.4, 3.1).
|
||||
.iP "f" 15
|
||||
Finds the first instance of the next character following the cursor on
|
||||
the current line. A count repeats the find (4.1).
|
||||
.iP "g" 15
|
||||
Unused.
|
||||
.sp
|
||||
Arrow keys
|
||||
.B h ,
|
||||
.B j ,
|
||||
.B k ,
|
||||
.B l ,
|
||||
and
|
||||
.B H .
|
||||
.iP "h" 15
|
||||
.B "Left arrow" .
|
||||
Moves the cursor one character to the left.
|
||||
Like the other arrow keys, either
|
||||
.B h ,
|
||||
the
|
||||
.B "left arrow"
|
||||
key, or one of the synonyms (\fB^H\fP) has the same effect.
|
||||
On v2 editors, arrow keys on certain kinds of terminals
|
||||
(those which send escape sequences, such as vt52, c100, or hp)
|
||||
cannot be used.
|
||||
A count repeats the effect (3.1, 7.5).
|
||||
.iP "i" 15
|
||||
Inserts text before the cursor, otherwise like \fBa\fR (7.2).
|
||||
.iP "j" 15
|
||||
.B "Down arrow" .
|
||||
Moves the cursor one line down in the same column.
|
||||
If the position does not exist,
|
||||
.I vi
|
||||
comes as close as possible to the same column.
|
||||
Synonyms include
|
||||
.B ^J
|
||||
(linefeed) and
|
||||
.B ^N .
|
||||
.iP "k" 15
|
||||
.B "Up arrow" .
|
||||
Moves the cursor one line up.
|
||||
.B ^P
|
||||
is a synonym.
|
||||
.iP "l" 15
|
||||
.B "Right arrow" .
|
||||
Moves the cursor one character to the right.
|
||||
\s-2SPACE\s0 is a synonym.
|
||||
.iP "m" 15
|
||||
Marks the current position of the cursor in the mark register which is
|
||||
specified by the next character \fBa\fR\-\fBz\fR. Return to this position
|
||||
or use with an operator using \fB\(ga\fR or \fB\(aa\fR (5.3).
|
||||
.iP "n" 15
|
||||
Repeats the last \fB/\fR or \fB?\fR scanning commands (2.2).
|
||||
.iP "o" 15
|
||||
Opens new lines below the current line; otherwise like \fBO\fR (3.1).
|
||||
.iP "p" 15
|
||||
Puts text after/below the cursor; otherwise like \fBP\fR (6.3).
|
||||
.iP "q" 15
|
||||
Unused.
|
||||
.iP "r" 15
|
||||
Replaces the single character at the cursor with a single character you
|
||||
type. The new character may be a \s-2RETURN\s0; this is the easiest
|
||||
way to split lines. A count replaces each of the following count characters
|
||||
with the single character given; see \fBR\fR above which is the more
|
||||
usually useful iteration of \fBr\fR (3.2).
|
||||
.iP "s" 15
|
||||
Changes the single character under the cursor to the text which follows
|
||||
up to an \s-2ESC\s0; given a count, that many characters from the current
|
||||
line are changed. The last character to be changed is marked with \fB$\fR
|
||||
as in \fBc\fR (3.2).
|
||||
.iP "t" 15
|
||||
Advances the cursor upto the character before the next character typed.
|
||||
Most useful with operators such as \fBd\fR and \fBc\fR to delete the
|
||||
characters up to a following character. You can use \fB.\fR to delete
|
||||
more if this doesn't delete enough the first time (4.1).
|
||||
.iP "u" 15
|
||||
Undoes the last change made to the current buffer. If repeated, will
|
||||
alternate between these two states, thus is its own inverse. When used
|
||||
after an insert which inserted text on more than one line, the lines are
|
||||
saved in the numeric named buffers (3.5).
|
||||
.iP "v" 15
|
||||
Unused.
|
||||
.iP "w" 15
|
||||
Advances to the beginning of the next word, as defined by \fBb\fR (2.4).
|
||||
.iP "x" 15
|
||||
Deletes the single character under the cursor. With a count deletes
|
||||
deletes that many characters forward from the cursor position, but only
|
||||
on the current line (6.5).
|
||||
.iP "y" 15
|
||||
An operator, yanks the following object into the unnamed temporary buffer.
|
||||
If preceded by a named buffer specification, \fB"\fR\fIx\fR, the text
|
||||
is placed in that buffer also. Text can be recovered by a later \fBp\fR
|
||||
or \fBP\fR (7.4).
|
||||
.iP "z" 15
|
||||
Redraws the screen with the current line placed as specified by the following
|
||||
character: \s-2RETURN\s0 specifies the top of the screen, \fB.\fR the
|
||||
center of the screen, and \fB\-\fR at the bottom of the screen.
|
||||
A count may be given after the \fBz\fR and before the following character
|
||||
to specify the new screen size for the redraw.
|
||||
A count before the \fBz\fR gives the number of the line to place in the
|
||||
center of the screen instead of the default current line. (5.4)
|
||||
.iP "{" 15
|
||||
Retreats to the beginning of the beginning of the preceding paragraph.
|
||||
A paragraph begins at each macro in the \fIparagraphs\fR option, normally
|
||||
`.IP', `.LP', `.PP', `.QP' and `.bp'.
|
||||
A paragraph also begins after a completely
|
||||
empty line, and at each section boundary (see \fB[[\fR above) (4.2, 6.8,
|
||||
7.6).
|
||||
.iP "|" 15
|
||||
Places the cursor on the character in the column specified
|
||||
by the count (7.1, 7.2).
|
||||
.iP "}" 15
|
||||
Advances to the beginning of the next paragraph. See \fB{\fR for the
|
||||
definition of paragraph (4.2, 6.8, 7.6).
|
||||
.iP "~" 15
|
||||
Unused.
|
||||
.iP "^?\ (\s-2\fRDEL\fP\s0)" 15
|
||||
Interrupts the editor, returning it to command accepting state (1.5,
|
||||
7.5)
|
||||
.bp
|
||||
\&.
|
File diff suppressed because it is too large
Load Diff
@ -1,468 +0,0 @@
|
||||
.\" Copyright (c) 1980, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by the University of
|
||||
.\" California, Berkeley and its contributors.
|
||||
.\" 4. Neither the name of the University nor the names of its contributors
|
||||
.\" may be used to endorse or promote products derived from this software
|
||||
.\" without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)vi.summary 8.3 (Berkeley) 8/18/96
|
||||
.\"
|
||||
.ds CH
|
||||
.ds CF
|
||||
.de TS
|
||||
.br
|
||||
.if !\\n(1T .RT
|
||||
.ul 0
|
||||
.ti \\n(.iu
|
||||
.if t .sp 0.25
|
||||
.if n .sp
|
||||
.if \\$1H .TQ
|
||||
.nr IX 1
|
||||
..
|
||||
.nr PS 9
|
||||
.ps 9
|
||||
.nr VS 11
|
||||
.vs 11
|
||||
.nr HM .50i
|
||||
.nr FM .25i
|
||||
.nr PO 1.0i
|
||||
.po 1.0i
|
||||
.nr LL 4.5i
|
||||
.ll 4.5i
|
||||
.de nc
|
||||
.bp
|
||||
..
|
||||
.de h
|
||||
.LG
|
||||
.B
|
||||
\\$1
|
||||
.R
|
||||
.NL
|
||||
..
|
||||
.LG
|
||||
.LG
|
||||
.B
|
||||
.ce
|
||||
Ex Quick Reference
|
||||
.R
|
||||
.NL
|
||||
.LP
|
||||
.LP
|
||||
.h "Entering/leaving ex"
|
||||
.TS
|
||||
aw(1.4i)b aw(1.8i).
|
||||
% ex \fIname\fP edit \fIname\fP, start at end
|
||||
% ex +\fIn\fP \fIname\fP ... at line \fIn\fP
|
||||
% ex \-t \fItag\fP start at \fItag\fP
|
||||
% ex \-r list saved files
|
||||
% ex \-r \fIname\fP recover file \fIname\fP
|
||||
% ex \fIname\fP ... edit first; rest via \fB:n\fP
|
||||
% ex \-R \fIname\fP read only mode
|
||||
: x exit, saving changes
|
||||
: q! exit, discarding changes
|
||||
.TE
|
||||
.h "Ex states"
|
||||
.TS
|
||||
lw(1i) lw(2.0i).
|
||||
Command T{
|
||||
Normal and initial state. Input prompted for by \fB:\fP.
|
||||
Your kill character cancels partial command.
|
||||
T}
|
||||
Insert T{
|
||||
Entered by \fBa\fP \fBi\fP and \fBc\fP.
|
||||
Arbitrary text then terminates with line having only \fB.\fP
|
||||
character on it or abnormally with interrupt.
|
||||
T}
|
||||
Open/visual T{
|
||||
Entered by \fBopen\fP or \fBvi\fP, terminates with \fBQ\fP
|
||||
or ^\e.
|
||||
T}
|
||||
.TE
|
||||
.h "Ex commands"
|
||||
.TS
|
||||
lw(.45i) lw(.08i)b lw(.45i) lw(.08i)b lw(.45i) lw(.08i)b.
|
||||
abbrev ab next n unabbrev una
|
||||
append a number nu undo u
|
||||
args ar open o unmap unm
|
||||
change c preserve pre version ve
|
||||
copy co print p visual vi
|
||||
delete d put pu write w
|
||||
edit e quit q xit x
|
||||
file f read re yank ya
|
||||
global g recover rec \fIwindow\fP z
|
||||
insert i rewind rew \fIescape\fP !
|
||||
join j set se \fIlshift\fP <
|
||||
list l shell sh \fIprint next\fP \fRCR\fP
|
||||
map source so \fIresubst\fP &
|
||||
mark ma stop st \fIrshift\fP >
|
||||
move m substitute s \fIscroll\fP ^D
|
||||
.TE
|
||||
.h "Ex command addresses"
|
||||
.TS
|
||||
lw(.3i)b lw(0.8i) lw(.3i)b lw(0.8i).
|
||||
\fIn\fP line \fIn\fP /\fIpat\fP next with \fIpat\fP
|
||||
\&. current ?\fIpat\fP previous with \fIpat\fP
|
||||
$ last \fIx\fP-\fIn\fP \fIn\fP before \fIx\fP
|
||||
+ next \fIx\fP,\fIy\fP \fIx\fP through \fIy\fP
|
||||
\- previous \(aa\fIx\fP marked with \fIx\fP
|
||||
+\fIn\fP \fIn\fP forward \(aa\(aa previous context
|
||||
% 1,$
|
||||
.TE
|
||||
.nc
|
||||
.h "Specifying terminal type"
|
||||
.TS
|
||||
aw(1.7i)b aw(1.5i).
|
||||
% setenv TERM \fItype\fP \fIcsh\fP and all version 6
|
||||
$ TERM=\fItype\fP; export TERM \fIsh\fP in Version 7
|
||||
See also \fItset\fR(1)
|
||||
.TE
|
||||
.h "Some terminal types"
|
||||
.TS
|
||||
lw(.4i) lw(.4i) lw(.4i) lw(.4i) lw(.4i).
|
||||
2621 43 adm31 dw1 h19
|
||||
2645 733 adm3a dw2 i100
|
||||
300s 745 c100 gt40 mime
|
||||
33 act4 dm1520 gt42 owl
|
||||
37 act5 dm2500 h1500 t1061
|
||||
4014 adm3 dm3025 h1510 vt52
|
||||
.TE
|
||||
.h "Initializing options"
|
||||
.TS
|
||||
lw(.9i)b aw(1.5i).
|
||||
EXINIT place \fBset\fP's here in environment var.
|
||||
set \fIx\fP enable option
|
||||
set no\fIx\fP disable option
|
||||
set \fIx\fP=\fIval\fP give value \fIval\fP
|
||||
set show changed options
|
||||
set all show all options
|
||||
set \fIx\fP? show value of option \fIx\fP
|
||||
.TE
|
||||
.h "Useful options"
|
||||
.TS
|
||||
lw(.9i)b lw(.3i) lw(1.0i).
|
||||
autoindent ai supply indent
|
||||
autowrite aw write before changing files
|
||||
ignorecase ic in scanning
|
||||
lisp \fB( ) { }\fP are s-exp's
|
||||
list print ^I for tab, $ at end
|
||||
magic \fB. [ *\fP special in patterns
|
||||
number nu number lines
|
||||
paragraphs para macro names which start ...
|
||||
redraw simulate smart terminal
|
||||
scroll command mode lines
|
||||
sections sect macro names ...
|
||||
shiftwidth sw for \fB< >\fP, and input \fB^D\fP
|
||||
showmatch sm to \fB)\fP and \fB}\fP as typed
|
||||
slowopen slow choke updates during insert
|
||||
window visual mode lines
|
||||
wrapscan ws around end of buffer?
|
||||
wrapmargin wm automatic line splitting
|
||||
.TE
|
||||
.LP
|
||||
.h "Scanning pattern formation"
|
||||
.TS
|
||||
aw(.9i)b aw(1.0i).
|
||||
\(ua beginning of line
|
||||
$ end of line
|
||||
\fB.\fR any character
|
||||
\e< beginning of word
|
||||
\e> end of word
|
||||
[\fIstr\fP] any char in \fIstr\fP
|
||||
[\(ua\fIstr\fP] ... not in \fIstr\fP
|
||||
[\fIx\-y\fP] ... between \fIx\fP and \fIy\fP
|
||||
* any number of preceding
|
||||
.TE
|
||||
.nc
|
||||
.LP
|
||||
.LG
|
||||
.LG
|
||||
.B
|
||||
.ce
|
||||
Vi Quick Reference
|
||||
.NL
|
||||
.R
|
||||
.LP
|
||||
.LP
|
||||
.h "Entering/leaving vi"
|
||||
.TS
|
||||
aw(1.4i)b aw(1.8i).
|
||||
% vi \fIname\fP edit \fIname\fP at top
|
||||
% vi +\fIn\fP \fIname\fP ... at line \fIn\fP
|
||||
% vi + \fIname\fP ... at end
|
||||
% vi \-r list saved files
|
||||
% vi \-r \fIname\fP recover file \fIname\fP
|
||||
% vi \fIname\fP ... edit first; rest via \fB:n\fP
|
||||
% vi \-t \fItag\fP start at \fItag\fP
|
||||
% vi +/\fIpat\fP \fIname\fP search for \fIpat\fP
|
||||
% view \fIname\fP read only mode
|
||||
ZZ exit from vi, saving changes
|
||||
^Z stop vi for later resumption
|
||||
.TE
|
||||
.h "The display"
|
||||
.TS
|
||||
lw(.75i) lw(2.2i).
|
||||
Last line T{
|
||||
Error messages, echoing input to \fB: / ?\fP and \fB!\fR,
|
||||
feedback about i/o and large changes.
|
||||
T}
|
||||
@ lines On screen only, not in file.
|
||||
~ lines Lines past end of file.
|
||||
^\fIx\fP Control characters, ^? is delete.
|
||||
tabs Expand to spaces, cursor at last.
|
||||
.TE
|
||||
.LP
|
||||
.h "Vi states"
|
||||
.TS
|
||||
lw(.75i) lw(2.2i).
|
||||
Command T{
|
||||
Normal and initial state. Others return here.
|
||||
ESC (escape) cancels partial command.
|
||||
T}
|
||||
Insert T{
|
||||
Entered by \fBa i A I o O c C s S\fP \fBR\fP.
|
||||
Arbitrary text then terminates with ESC character,
|
||||
or abnormally with interrupt.
|
||||
T}
|
||||
Last line T{
|
||||
Reading input for \fB: / ?\fP or \fB!\fP; terminate
|
||||
with ESC or CR to execute, interrupt to cancel.
|
||||
T}
|
||||
.TE
|
||||
.h "Counts before vi commands"
|
||||
.TS
|
||||
lw(1.5i) lw(1.7i)b.
|
||||
line/column number z G |
|
||||
scroll amount ^D ^U
|
||||
replicate insert a i A I
|
||||
repeat effect \fRmost rest\fP
|
||||
.TE
|
||||
.h "Simple commands"
|
||||
.TS
|
||||
lw(1.5i)b lw(1.7i).
|
||||
dw delete a word
|
||||
de ... leaving punctuation
|
||||
dd delete a line
|
||||
3dd ... 3 lines
|
||||
i\fItext\fP\fRESC\fP insert text \fIabc\fP
|
||||
cw\fInew\fP\fRESC\fP change word to \fInew\fP
|
||||
ea\fIs\fP\fRESC\fP pluralize word
|
||||
xp transpose characters
|
||||
.TE
|
||||
.nc
|
||||
.h "Interrupting, cancelling"
|
||||
.TS
|
||||
aw(0.75i)b aw(1.6i).
|
||||
ESC end insert or incomplete cmd
|
||||
^? (delete or rubout) interrupts
|
||||
^L reprint screen if \fB^?\fR scrambles it
|
||||
.TE
|
||||
.h "File manipulation"
|
||||
.TS
|
||||
aw(0.75i)b aw(1.6i).
|
||||
:w write back changes
|
||||
:wq write and quit
|
||||
:q quit
|
||||
:q! quit, discard changes
|
||||
:e \fIname\fP edit file \fIname\fP
|
||||
:e! reedit, discard changes
|
||||
:e + \fIname\fP edit, starting at end
|
||||
:e +\fIn\fR edit starting at line \fIn\fR
|
||||
:e # edit alternate file
|
||||
^\(ua synonym for \fB:e #\fP
|
||||
:w \fIname\fP write file \fIname\fP
|
||||
:w! \fIname\fP overwrite file \fIname\fP
|
||||
:sh run shell, then return
|
||||
:!\fIcmd\fP run \fIcmd\fR, then return
|
||||
:n edit next file in arglist
|
||||
:n \fIargs\fP specify new arglist
|
||||
:f show current file and line
|
||||
^G synonym for \fB:f\fP
|
||||
:ta \fItag\fP to tag file entry \fItag\fP
|
||||
^] \fB:ta\fP, following word is \fItag\fP
|
||||
.TE
|
||||
.h "Positioning within file"
|
||||
.TS
|
||||
aw(0.75i)b aw(1.6i).
|
||||
^F forward screenfull
|
||||
^B backward screenfull
|
||||
^D scroll down half screen
|
||||
^U scroll up half screen
|
||||
G goto line (end default)
|
||||
/\fIpat\fR next line matching \fIpat\fR
|
||||
?\fIpat\fR prev line matching \fIpat\fR
|
||||
n repeat last \fB/\fR or \fB?\fR
|
||||
N reverse last \fB/\fR or \fB?\fR
|
||||
/\fIpat\fP/+\fIn\fP n'th line after \fIpat\fR
|
||||
?\fIpat\fP?\-\fIn\fP n'th line before \fIpat\fR
|
||||
]] next section/function
|
||||
[[ previous section/function
|
||||
% find matching \fB( ) {\fP or \fB}\fP
|
||||
.TE
|
||||
.h "Adjusting the screen"
|
||||
.TS
|
||||
aw(0.75i)b aw(1.6i).
|
||||
^L clear and redraw
|
||||
^R retype, eliminate @ lines
|
||||
z\fRCR\fP redraw, current at window top
|
||||
z\- ... at bottom
|
||||
z\|. ... at center
|
||||
/\fIpat\fP/z\- \fIpat\fP line at bottom
|
||||
z\fIn\fP\|. use \fIn\fP line window
|
||||
^E scroll window down 1 line
|
||||
^Y scroll window up 1 line
|
||||
.TE
|
||||
.nc
|
||||
.h "Marking and returning
|
||||
.TS
|
||||
aw(0.5i)b aw(2.0i).
|
||||
\(ga\(ga previous context
|
||||
\(aa\(aa ... at first non-white in line
|
||||
m\fIx\fP mark position with letter \fIx\fP
|
||||
\(ga\fIx\fP to mark \fIx\fP
|
||||
\(aa\fIx\fP ... at first non-white in line
|
||||
.TE
|
||||
.h "Line positioning"
|
||||
.TS
|
||||
aw(0.5i)b aw(2.0i).
|
||||
H home window line
|
||||
L last window line
|
||||
M middle window line
|
||||
+ next line, at first non-white
|
||||
\- previous line, at first non-white
|
||||
\fRCR\fP return, same as +
|
||||
\(da \fRor\fP j next line, same column
|
||||
\(ua \fRor\fP k previous line, same column
|
||||
.TE
|
||||
.h "Character positioning"
|
||||
.TS
|
||||
aw(0.5i)b aw(2.0i).
|
||||
\(ua first non white
|
||||
0 beginning of line
|
||||
$ end of line
|
||||
h \fRor\fP \(-> forward
|
||||
l \fRor\fP \(<- backwards
|
||||
^H same as \fB\(<-\fP
|
||||
\fRspace\fP same as \fB\(->\fP
|
||||
f\fIx\fP find \fIx\fP forward
|
||||
F\fIx\fP \fBf\fR backward
|
||||
t\fIx\fP upto \fIx\fP forward
|
||||
T\fIx\fP back upto \fIx\fP
|
||||
; repeat last \fBf F t\fP or \fBT\fP
|
||||
, inverse of \fB;\fP
|
||||
| to specified column
|
||||
% find matching \fB( { )\fP or \fB}\fR
|
||||
.TE
|
||||
.h "Words, sentences, paragraphs"
|
||||
.TS
|
||||
aw(0.5i)b aw(2.0i).
|
||||
w word forward
|
||||
b back word
|
||||
e end of word
|
||||
) to next sentence
|
||||
} to next paragraph
|
||||
( back sentence
|
||||
{ back paragraph
|
||||
W blank delimited word
|
||||
B back \fBW\fP
|
||||
E to end of \fBW\fP
|
||||
.TE
|
||||
.h "Commands for \s-2LISP\s0"
|
||||
.TS
|
||||
aw(0.5i)b aw(2.0i).
|
||||
) Forward s-expression
|
||||
} ... but don't stop at atoms
|
||||
( Back s-expression
|
||||
{ ... but don't stop at atoms
|
||||
.TE
|
||||
.nc
|
||||
.h "Corrections during insert"
|
||||
.TS
|
||||
aw(.5i)b aw(2.0i).
|
||||
^H erase last character
|
||||
^W erases last word
|
||||
\fRerase\fP your erase, same as \fB^H\fP
|
||||
\fRkill\fP your kill, erase input this line
|
||||
\e escapes \fB^H\fR, your erase and kill
|
||||
\fRESC\fP ends insertion, back to command
|
||||
^? interrupt, terminates insert
|
||||
^D backtab over \fIautoindent\fP
|
||||
\(ua^D kill \fIautoindent\fP, save for next
|
||||
0^D ... but at margin next also
|
||||
^V quote non-printing character
|
||||
.TE
|
||||
.h "Insert and replace"
|
||||
.TS
|
||||
aw(.5i)b aw(2.0i).
|
||||
a append after cursor
|
||||
i insert before
|
||||
A append at end of line
|
||||
I insert before first non-blank
|
||||
o open line below
|
||||
O open above
|
||||
r\fIx\fP replace single char with \fIx\fP
|
||||
R replace characters
|
||||
.TE
|
||||
.h "Operators (double to affect lines)"
|
||||
.TS
|
||||
aw(0.5i)b aw(2.0i).
|
||||
d delete
|
||||
c change
|
||||
< left shift
|
||||
> right shift
|
||||
! filter through command
|
||||
\&= indent for \s-2LISP\s0
|
||||
y yank lines to buffer
|
||||
.TE
|
||||
.h "Miscellaneous operations"
|
||||
.TS
|
||||
aw(0.5i)b aw(2.0i).
|
||||
C change rest of line
|
||||
D delete rest of line
|
||||
s substitute chars
|
||||
S substitute lines
|
||||
J join lines
|
||||
x delete characters
|
||||
X ... before cursor
|
||||
Y yank lines
|
||||
.TE
|
||||
.h "Yank and put"
|
||||
.TS
|
||||
aw(0.5i)b aw(2.0i).
|
||||
p put back lines
|
||||
P put before
|
||||
"\fIx\fPp put from buffer \fIx\fP
|
||||
"\fIx\fPy yank to buffer \fIx\fP
|
||||
"\fIx\fPd delete into buffer \fIx\fP
|
||||
.TE
|
||||
.h "Undo, redo, retrieve"
|
||||
.TS
|
||||
aw(0.5i)b aw(2.0i).
|
||||
u undo last change
|
||||
U restore current line
|
||||
\fB.\fP repeat last change
|
||||
"\fId\fP\|p retrieve \fId\fP'th last delete
|
||||
.TE
|
1102
docs/changelog
1102
docs/changelog
File diff suppressed because it is too large
Load Diff
55
docs/ev
55
docs/ev
@ -1,55 +0,0 @@
|
||||
# @(#)ev 8.4 (Berkeley) 4/29/94
|
||||
|
||||
Ev: Vi: Result:
|
||||
<CK> <CK> (Cursor keys). Move around the file.
|
||||
|
||||
Meta key commands:
|
||||
^A<#> <#>G Goto line #.
|
||||
^A$ G Goto the end of the file.
|
||||
^A/ / Prompt and execute a forward search.
|
||||
^A: : Prompt and execute an ex command.
|
||||
^A? ? Prompt and execute a backward search.
|
||||
^Ac y'<c> Copy to mark in line mode (or copy the current line).
|
||||
^AC y`<c> Copy to mark in character mode.
|
||||
^Ad d'<c> Delete to mark in line mode (or delete the current line).
|
||||
^AD d`<c> Delete to mark in character mode.
|
||||
^Aj J Join lines.
|
||||
^Am m<c> Mark the current cursor position.
|
||||
^AN N Repeat search in the reverse direction.
|
||||
^An ^A Search for the word under the cursor.
|
||||
^Ar u Redo a command.
|
||||
^Au u Undo a command.
|
||||
|
||||
Single key commands:
|
||||
^B ^B Page up a screen.
|
||||
^C ^C Interrupt long-running commands.
|
||||
^D ^D Page down a half-screen.
|
||||
^E $ End of line.
|
||||
^F ^F Page down a screen.
|
||||
^G ^G File status/information.
|
||||
^H X Delete the character to the left of the cursor.
|
||||
^I (TAB)
|
||||
^J j Cursor down one line.
|
||||
^K k Cursor up one line.
|
||||
^L ^L Redraw the screen.
|
||||
^M (CR) ^M In insert mode, split the line at the current cursor,
|
||||
creating a new line.
|
||||
In overwrite mode, cursor down one line.
|
||||
^N n Repeat previous search, in previous direction.
|
||||
^O (UNUSED)
|
||||
^P p Paste the cut text at the cursor position.
|
||||
^Q (XON/XOFF)
|
||||
^R (UNUSED)
|
||||
^S (XON/XOFF)
|
||||
^T D Truncate the line at the cursor position.
|
||||
^U ^U Page up a half-screen.
|
||||
^V<c> ^V<c> Insert/overwrite with a literal next character.
|
||||
^W w Move forward one whitespace separated word.
|
||||
^X x Delete the current character.
|
||||
^Y (UNUSED)
|
||||
^Z ^Z Suspend.
|
||||
|
||||
New ex mode commands:
|
||||
|
||||
^A:set ov[erwrite] Toggle "insert" mode, so that input keys overwrite
|
||||
the existing characters.
|
@ -1,83 +0,0 @@
|
||||
List of things that should be added:
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
+ X11 (Tk, Motif, Xaw) interface.
|
||||
+ Interpreted language (Perl, Scheme, Tcl/Rush, Python)
|
||||
+ Additional ports: Windows, Windows NT, MSDOS
|
||||
+ Forms editing package; use RE's to verify field contents.
|
||||
+ Internationalization, including wide character and multibyte support.
|
||||
+ Support for single line window editing, including full editing
|
||||
capability on the vi colon command line.
|
||||
+ Rob Pike's sam style RE's.
|
||||
+ Right-to-left and bottom to top text support.
|
||||
+ Quitall command, to leave all windows. A ! will force the quit.
|
||||
|
||||
List of suggested features:
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
+ It would be nice to have the completion mechanism found in tcsh versions
|
||||
>= 6.03. For instance, the completion for the `:cd' command will be
|
||||
directories only. The completion for the `:set' command will be all
|
||||
options not set at that moment, and for `:set un' will be all options
|
||||
that are set at that moment. The completion for `:< count' will be the
|
||||
flags.
|
||||
|
||||
+ Add an command-line option to initially split the screen based on the
|
||||
number of file arguments, e.g., "nvi -a file1 file2" would initialize
|
||||
a two edit-buffer display.
|
||||
|
||||
+ Add a "push" command that would push a file on the tags stack.
|
||||
(Essentially make tags a special case of the stack, and make
|
||||
the stack more general purpose.)
|
||||
|
||||
+ Make :script just run a command and edit the output, and :interactive,
|
||||
which allows interactive shell session, instead of just the current
|
||||
:script.
|
||||
|
||||
+ Add tagging information to the man page so that users can display
|
||||
the part of the man page that discusses the command in which they're
|
||||
interested.
|
||||
|
||||
+ Add a zone option so that you can declare that top/bottom few lines
|
||||
of the screen aren't filled except by accident, so that the text
|
||||
you ask for is always concentrated in the center of the screen.
|
||||
|
||||
+ Change
|
||||
:di[splay] tags -> :tags
|
||||
:di[splay] screens -> :screens
|
||||
:di[splay] buffers -> :buffers
|
||||
|
||||
+ A macro record function. Add the ability to record a sequence
|
||||
of keystrokes into a named buffer for later use. Handy when
|
||||
you're trying to build a semi-complex macro.
|
||||
|
||||
+ The semantics of :split, :bg, and :fg aren't right. Someone needs to
|
||||
rethink how they should interact. The main problem arises when users
|
||||
want to get a window into a new file. Currently, the necessary sequence
|
||||
is ":split newfile|^W|:bg". It would be nice if you could simply
|
||||
background the current screen and edit a new one.
|
||||
|
||||
+ An option to turn on a ``quarter plane'' model so that you can
|
||||
go as far to the right or down as you wish. The File or the
|
||||
current line is only extended if you actually put down a char at
|
||||
the new location. Very handy for ascii graphics and tables.
|
||||
|
||||
+ Some way of replacing the command bindings. For this to work
|
||||
cleanly the notion of a command must be separate from that of a
|
||||
key. (Simulate the Rand editor?)
|
||||
|
||||
+ Vertical splitting, so you can see files side by side.
|
||||
|
||||
+ Tracking. Two or more files are associated so that when one file
|
||||
is scrolled up/down/left/right other files track by the same amount.
|
||||
Tracking may be constrained such that two files only track vertically
|
||||
or horizontally. This is relatively easy to implement.
|
||||
|
||||
+ A status file so that the next time invocation of the editor returns
|
||||
to the same place, with the same number of windows etc. In case of
|
||||
change of the screen size, reasonable defaults are used. For each
|
||||
window size and location of the window, name of the file and position
|
||||
in it, any tab settings, any other settings for the window (such as
|
||||
insert/overwrite mode, auto indent etc). Last search RE and maybe
|
||||
direction. If a file does not exist the next time you invoke the
|
||||
editor, its window is left in the same place but with some default
|
||||
message.
|
229
docs/help
229
docs/help
@ -1,229 +0,0 @@
|
||||
MOVING THE CURSOR:
|
||||
k - cursor up ^F - page forward /<pattern><CR> - search forward
|
||||
j - cursor down ^B - page backward ?<pattern><CR> - search backward
|
||||
h - cursor left w - move forward a "word" n - repeat the last search
|
||||
l - cursor right b - move backward a "word"
|
||||
|
||||
ENTERING TEXT:
|
||||
a - append after the cursor. Use the <escape> key to return to
|
||||
i - insert before the cursor. command mode.
|
||||
o - open a new line below the cursor.
|
||||
O - open new line above the cursor.
|
||||
|
||||
WRITING AND EXITING:
|
||||
:w<Enter> - write the file
|
||||
:q<Enter> - exit the file
|
||||
:q!<Enter> - exit without writing the file
|
||||
:#<Enter> - move to a line (e.g., :35<Enter> moves to line 35)
|
||||
|
||||
MISCELLANEOUS:
|
||||
^G - display the file name
|
||||
J - join two lines (use i<Enter><escape> to split a line)
|
||||
u - undo the last change (enter . after a 'u' to undo more than one change)
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
VI COMMANDS:
|
||||
^A search forward for cursor word
|
||||
^B scroll up by screens
|
||||
^C interrupt an operation (e.g. read, write, search)
|
||||
^D scroll down by half screens (setting count)
|
||||
^E scroll down by lines
|
||||
^F scroll down by screens
|
||||
^G file status
|
||||
^H move left by characters
|
||||
^J move down by lines
|
||||
^L redraw screen
|
||||
^M move down by lines (to first non-blank)
|
||||
^N move down by lines
|
||||
^P move up by lines
|
||||
^R redraw screen
|
||||
^T tag pop
|
||||
^U half page up (set count)
|
||||
^V input a literal character
|
||||
^W move to next screen
|
||||
^Y page up by lines
|
||||
^Z suspend editor
|
||||
^[ <escape> exit input mode, cancel partial commands
|
||||
^\ switch to ex mode
|
||||
^] tag push cursor word
|
||||
^^ switch to previous file
|
||||
<space> move right by columns
|
||||
! filter through command(s) to motion
|
||||
# number increment/decrement
|
||||
$ move to last column
|
||||
% move to match
|
||||
& repeat substitution
|
||||
' move to mark (to first non-blank)
|
||||
( move back sentence
|
||||
) move forward sentence
|
||||
+ move down by lines (to first non-blank)
|
||||
, reverse last F, f, T or t search
|
||||
- move up by lines (to first non-blank)
|
||||
. repeat the last command
|
||||
/ search forward
|
||||
0 move to first character
|
||||
: ex command
|
||||
; repeat last F, f, T or t search
|
||||
< shift lines left to motion
|
||||
> shift lines right to motion
|
||||
? search backward
|
||||
@ execute buffer
|
||||
A append to the line
|
||||
B move back bigword
|
||||
C change to end-of-line
|
||||
D delete to end-of-line
|
||||
E move to end of bigword
|
||||
F character in line backward search
|
||||
G move to line
|
||||
H move to count lines from screen top
|
||||
I insert before first nonblank
|
||||
J join lines
|
||||
L move to screen bottom
|
||||
M move to screen middle
|
||||
N reverse last search
|
||||
O insert above line
|
||||
P insert before cursor from buffer
|
||||
Q switch to ex mode
|
||||
R replace characters
|
||||
S substitute for the line(s)
|
||||
T before character in line backward search
|
||||
U Restore the current line
|
||||
W move to next bigword
|
||||
X delete character before cursor
|
||||
Y copy line
|
||||
ZZ save file and exit
|
||||
[[ move back section
|
||||
]] move forward section
|
||||
^ move to first non-blank
|
||||
_ move to first non-blank
|
||||
` move to mark
|
||||
a append after cursor
|
||||
b move back word
|
||||
c change to motion
|
||||
d delete to motion
|
||||
e move to end of word
|
||||
f character in line forward search
|
||||
h move left by columns
|
||||
i insert before cursor
|
||||
j move down by lines
|
||||
k move up by lines
|
||||
l move right by columns
|
||||
m set mark
|
||||
n repeat last search
|
||||
o append after line
|
||||
p insert after cursor from buffer
|
||||
r replace character
|
||||
s substitute character
|
||||
t before character in line forward search
|
||||
u undo last change
|
||||
w move to next word
|
||||
x delete character
|
||||
y copy text to motion into a cut buffer
|
||||
z reposition the screen
|
||||
{ move back paragraph
|
||||
| move to column
|
||||
} move forward paragraph
|
||||
~ reverse case
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
EX COMMANDS:
|
||||
^D: scroll lines
|
||||
!: filter lines through commands or run commands
|
||||
#: display numbered lines
|
||||
&: repeat the last substitution
|
||||
*: execute a buffer
|
||||
<: shift lines left
|
||||
=: display line number
|
||||
>: shift lines right
|
||||
@: execute a buffer
|
||||
append: append input to a line
|
||||
abbreviate: specify an input abbreviation
|
||||
args: display file argument list
|
||||
bg: background the current screen
|
||||
change: change lines to input
|
||||
cd: change the current directory
|
||||
chdir: change the current directory
|
||||
copy: copy lines elsewhere in the file
|
||||
cscope: create a set of tags using a cscope command
|
||||
delete: delete lines from the file
|
||||
display: display buffers, screens or tags
|
||||
[Ee]dit: begin editing another file
|
||||
[Ee]x: begin editing another file
|
||||
exusage: display ex command usage statement
|
||||
file: display (and optionally set) file name
|
||||
fg: switch the current screen and a backgrounded screen
|
||||
global: execute a global command on lines matching an RE
|
||||
help: display help statement
|
||||
insert: insert input before a line
|
||||
join: join lines into a single line
|
||||
k: mark a line position
|
||||
list: display lines in an unambiguous form
|
||||
move: move lines elsewhere in the file
|
||||
mark: mark a line position
|
||||
map: map input or commands to one or more keys
|
||||
mkexrc: write a .exrc file
|
||||
[Nn]ext: edit (and optionally specify) the next file
|
||||
number: change display to number lines
|
||||
open: enter "open" mode (not implemented)
|
||||
print: display lines
|
||||
perl: run the perl interpreter with the command
|
||||
perldo: run the perl interpreter with the command, on each line
|
||||
preserve: preserve an edit session for recovery
|
||||
[Pp]revious: edit the previous file in the file argument list
|
||||
put: append a cut buffer to the line
|
||||
quit: exit ex/vi
|
||||
read: append input from a command or file to the line
|
||||
recover: recover a saved file
|
||||
resize: grow or shrink the current screen
|
||||
rewind: re-edit all the files in the file argument list
|
||||
s: substitute on lines matching an RE
|
||||
script: run a shell in a screen
|
||||
set: set options (use ":set all" to see all options)
|
||||
shell: suspend editing and run a shell
|
||||
source: read a file of ex commands
|
||||
stop: suspend the edit session
|
||||
suspend: suspend the edit session
|
||||
t: copy lines elsewhere in the file
|
||||
[Tt]ag: edit the file containing the tag
|
||||
tagnext: move to the next tag
|
||||
tagpop: return to the previous group of tags
|
||||
tagprev: move to the previous tag
|
||||
tagtop: discard all tags
|
||||
tcl: run the tcl interpreter with the command
|
||||
undo: undo the most recent change
|
||||
unabbreviate: delete an abbreviation
|
||||
unmap: delete an input or command map
|
||||
v: execute a global command on lines NOT matching an RE
|
||||
version: display the program version information
|
||||
visual: enter visual (vi) mode from ex mode
|
||||
[Vv]isual: edit another file (from vi mode only)
|
||||
viusage: display vi key usage statement
|
||||
write: write the file
|
||||
wn: write the file and switch to the next file
|
||||
wq: write the file and exit
|
||||
xit: exit
|
||||
yank: copy lines to a cut buffer
|
||||
z: display different screens of the file
|
||||
~: replace previous RE with previous replacement string,
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Edit options:
|
||||
noaltwerase filec="" nomodeline scroll=17 notildeop
|
||||
autoindent flash msgcat="./" nosearchincr timeout
|
||||
autoprint hardtabs=0 noprint="" nosecure nottywerase
|
||||
noautowrite noiclower nonumber shiftwidth=8 noverbose
|
||||
backup="" noignorecase nooctal noshowmatch warn
|
||||
nobeautify keytime=6 open noshowmode window=35
|
||||
cedit="" noleftright optimize sidescroll=16 nowindowname
|
||||
columns=80 lines=36 print="" noslowopen wraplen=0
|
||||
comment nolisp prompt nosourceany wrapmargin=0
|
||||
noedcompatible nolist readonly tabstop=8 wrapscan
|
||||
escapetime=1 lock noredraw taglength=0 nowriteany
|
||||
noerrorbells magic remap tags="tags"
|
||||
exrc matchtime=7 report=5 term="xterm"
|
||||
noextended mesg ruler noterse
|
||||
cdpath="/usr/src/local/nvi:/tmp"
|
||||
directory="/tmp"
|
||||
paragraphs="IPLPPPQPP LIpplpipbp"
|
||||
recdir="/var/tmp/vi.recover"
|
||||
sections="NHSHH HUnhsh"
|
||||
shell="/bin/csh"
|
||||
shellmeta="~{[*?$`'"\"
|
@ -1,88 +0,0 @@
|
||||
# @(#)autowrite 8.3 (Berkeley) 2/17/95
|
||||
|
||||
Vi autowrite behavior, the fields with *'s are "don't cares".
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Commands that are affected only by autowrite:
|
||||
|
||||
Command File Autowrite? Action:
|
||||
modified?
|
||||
-----------------------------------------------
|
||||
^Z Y Y Write file and suspend.
|
||||
^Z Y N Suspend.
|
||||
^Z N * Suspend.
|
||||
|
||||
# This behavior is NOT identical to :edit.
|
||||
^^ Y Y Write file and jump.
|
||||
^^ Y N Error.
|
||||
^^ N * Jump.
|
||||
|
||||
# The new nvi command ^T (:tagpop) behaves identically to ^].
|
||||
# This behavior is identical to :tag, :tagpop, and :tagpush with
|
||||
# force always set to N.
|
||||
^] Y Y Write file and jump.
|
||||
^] Y N Error.
|
||||
^] N * Jump.
|
||||
|
||||
# There's no way to specify a force flag to the '!' command.
|
||||
:! Y Y Write file and execute.
|
||||
:! Y N Warn (if warn option) and execute.
|
||||
:! N * Execute.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Commands that are affected by both autowrite and force:
|
||||
|
||||
NOTE: the "force" flag is never passed on, i.e. the write
|
||||
to the file caused by the autowrite flag is never forced.
|
||||
|
||||
Command File Autowrite? Force? Action:
|
||||
modified? (!)
|
||||
-------------------------------------------------------
|
||||
# The first rule (YYY) is historic practice, but seems wrong.
|
||||
# In nvi, :next and :prev commands behave identically to :rewind.
|
||||
:next Y Y Y Write changes and jump.
|
||||
:next Y Y N Write changes and jump.
|
||||
:next Y N Y Abandon changes and jump.
|
||||
:next Y N N Error.
|
||||
:next N * * Jump.
|
||||
|
||||
:rewind Y Y Y Abandon changes and jump.
|
||||
:rewind Y Y N Write changes and jump.
|
||||
:rewind Y N Y Abandon changes and jump.
|
||||
:rewind Y N N Error.
|
||||
:rewind N * * Jump.
|
||||
|
||||
# The new nvi commands, :tagpop and :tagtop, behave identically to :tag.
|
||||
# Note, this behavior is the same as :rewind and friends, as well.
|
||||
:tag Y Y Y Abandon changes and jump.
|
||||
:tag Y Y N Write changes and jump.
|
||||
:tag Y N Y Abandon changes and jump.
|
||||
:tag Y N N Error.
|
||||
:tag N * * Jump.
|
||||
|
||||
# The command :suspend behaves identically to :stop.
|
||||
:stop Y Y Y Suspend.
|
||||
:stop Y Y N Write changes and suspend.
|
||||
:stop Y N Y Suspend.
|
||||
:stop Y N N Suspend.
|
||||
:stop N * * Suspend.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Commands that might be affected by autowrite, but aren't:
|
||||
|
||||
Command File Autowrite? Force? Action:
|
||||
modified? (!)
|
||||
-------------------------------------------------------
|
||||
#:ex, and :vi (executed while in vi mode) behave identically to :edit.
|
||||
:edit Y * Y Abandon changes and jump.
|
||||
:edit Y * N Error.
|
||||
:edit N * * Jump.
|
||||
|
||||
:quit Y * Y Quit.
|
||||
:quit Y * N Error.
|
||||
:quit N * * Quit.
|
||||
|
||||
:shell * * * Execute shell.
|
||||
|
||||
:xit Y * * Write changes and exit.
|
||||
:xit N * * Exit.
|
@ -1,32 +0,0 @@
|
||||
# @(#)context 8.6 (Berkeley) 10/14/94
|
||||
|
||||
In historic vi, the previous context mark was always set:
|
||||
|
||||
ex address:
|
||||
any number, <question-mark>, <slash>, <dollar-sign>,
|
||||
<single-quote>, <backslash>
|
||||
|
||||
ex commands: undo, "z.", global, v
|
||||
|
||||
vi commands: (, ), {, }, %, [[, ]], ^]
|
||||
|
||||
nvi adds the vi command ^T to this list.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
In historic vi, the previous context mark was set if the
|
||||
line changed:
|
||||
|
||||
vi commands: '<mark>, G, H, L, M, z
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
In historic vi, the previous context mark was set if the
|
||||
line or column changed:
|
||||
|
||||
vi commands: `<mark>, /, ?, N, n
|
||||
|
||||
nvi adds the vi command ^A to this list.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
In historic vi, the previous context mark was set in non-visual
|
||||
mode for ^R and ^L if the line changed, but I have yet to figure
|
||||
out how the line could change.
|
@ -1,142 +0,0 @@
|
||||
Cscope Notes:
|
||||
|
||||
The nvi tags structure has been reworked to handle the notion of multiple
|
||||
locations per tag. This supports cscope, which returns multiple locations
|
||||
per query. It will hopefully support ctags programs that create databases
|
||||
with multiple locations per tag as well.
|
||||
|
||||
There is now a list of "tag queues" chained from each screen. Each tag
|
||||
queue has one or more "tag locations".
|
||||
|
||||
+----+ +----+ +----+ +----+
|
||||
| EP | -> | Q1 | <-- | T1 | <-- | T2 |
|
||||
+----+ +----+ --> +----+ --> +----+
|
||||
|
|
||||
+----+ +----+
|
||||
| Q2 | <-- | T1 |
|
||||
+----+ --> +----+
|
||||
|
|
||||
+----+ +----+
|
||||
| Q3 | <-- | T1 |
|
||||
+----+ --> +----+
|
||||
|
||||
In the above diagram, each "Q" is a "tag queue", and each "T" is a
|
||||
tag location. Generally, the commands:
|
||||
|
||||
:tag create a new Q
|
||||
^[ create a new Q
|
||||
:cscope find create a new Q
|
||||
:tagnext move to the next T
|
||||
:tagprev move to the previous T
|
||||
:tagpop discard one or more Q's
|
||||
^T discard the most recent Q
|
||||
:tagtop discard all Q's
|
||||
|
||||
More specifically:
|
||||
|
||||
:cs[cope] a[dd] cscope-dir
|
||||
|
||||
Attach to the cscope database in cscope-dir.
|
||||
|
||||
:cs[cope] f[ind] c|d|e|f|g|i|s|t buffer|pattern
|
||||
|
||||
Query all attached cscopes for the pattern. The pattern is a
|
||||
regular expression. If the pattern is a double-quote character
|
||||
followed by a valid buffer name (e.g., "t), then the contents
|
||||
of the named buffer are used as the pattern.
|
||||
|
||||
c: find callers of name
|
||||
d: find all function calls made from name
|
||||
e: find pattern
|
||||
f: find files with name as substring
|
||||
g: find definition of name
|
||||
i: find files #including name
|
||||
s: find all uses of name
|
||||
t: find assignments to name
|
||||
|
||||
The find command pushes the current location onto the tags stack,
|
||||
and switches to the first location resulting from the query, if
|
||||
the query returned at least one result.
|
||||
|
||||
:cs[cope] h[elp] [command]
|
||||
|
||||
List the cscope commands, or usage help on one command.
|
||||
|
||||
:display c[onnections]
|
||||
|
||||
Display the list of cscope connections
|
||||
|
||||
:display t[ags]
|
||||
|
||||
The tags display has been enhanced to display multiple tag
|
||||
locations per tag query.
|
||||
|
||||
:cs[cope] k[ill] #
|
||||
|
||||
Kill cscope connection number #.
|
||||
|
||||
:cs[cope] r[eset]
|
||||
Kill all attached cscopes. Useful if one got hung but you don't
|
||||
know which one.
|
||||
|
||||
:tagn[ext][!]
|
||||
|
||||
Move to the next tag resulting from a query.
|
||||
|
||||
:tagpr[ev][!]
|
||||
|
||||
Return to the previous tag resulting from a query.
|
||||
|
||||
:tagp[op], ^T
|
||||
|
||||
Return to the previous tag group (no change).
|
||||
|
||||
:tagt[op]
|
||||
|
||||
Discard all tag groups (no change).
|
||||
|
||||
Suggested maps:
|
||||
|
||||
" ^N: move to the next tag
|
||||
map ^N :tagnext^M
|
||||
" ^P: move to the previous tag
|
||||
map ^P :tagprev^M
|
||||
|
||||
" Tab+letter performs a C-Scope query on the current word.
|
||||
" C-Scope 12.9 has a text-string query (type t).
|
||||
" C-Scope 13.3 replaces it with an assignment query; hence a==t.
|
||||
map <tab>a "tye:csc find t"t
|
||||
map <tab>c "tye:csc find c"t
|
||||
map <tab>d "tye:csc find d"t
|
||||
map <tab>e "tye:csc find e"t
|
||||
map <tab>f "tye:csc find f"t
|
||||
map <tab>g "tye:csc find g"t
|
||||
map <tab>i "tye:csc find i"t
|
||||
map <tab>s "tye:csc find s"t
|
||||
map <tab>t "tye:csc find t"t
|
||||
|
||||
To start nvi with an initial set of cscope directories, use the environment
|
||||
variable CSCOPE_DIRS. This variable should contain a <blank>-separated
|
||||
list of directories containing cscope databases. (This MAY be changed to
|
||||
be an edit option, I haven't really decided, yet.)
|
||||
|
||||
Each cscope directory must contain a file named "cscope.out" which is the
|
||||
main cscope database, or nvi will not attempt to connect to a cscope to
|
||||
handle requests for that database.
|
||||
|
||||
The file "cscope.tpath" may contain a colon-separated directory search
|
||||
path which will be used to find the files reported by cscope. If this
|
||||
cscope.tpath does not exist, then the paths are assumed to be relative to
|
||||
the cscope directory itself. This is an extension to the standard cscope,
|
||||
but seems important enough to keep.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
Cscope Availability:
|
||||
|
||||
UNIXWare System V Release 4.0 variants such as Sun Solaris 2.x
|
||||
(/opt/SUNWspro/bin) have version 11.5, and UNIXWare System V
|
||||
Release 4.1 has version 12.10 with an option for much faster
|
||||
searching.
|
||||
|
||||
You can buy version 13.3 source with an unrestricted license
|
||||
for $400 from AT&T Software Solutions by calling +1-800-462-8146.
|
@ -1,76 +0,0 @@
|
||||
# @(#)gdb.script 8.5 (Berkeley) 5/4/96
|
||||
|
||||
# display the VI screen map
|
||||
# usage dmap(sp)
|
||||
define dmap
|
||||
set $h = ((VI_PRIVATE *)$arg0->vi_private)->h_smap
|
||||
set $t = ((VI_PRIVATE *)$arg0->vi_private)->t_smap
|
||||
while ($h <= $t)
|
||||
printf "lno: %2d; soff %d coff %d ", \
|
||||
(int)$h->lno, (int)$h->soff, (int)$h->coff
|
||||
if ($h->c_ecsize == 0)
|
||||
printf "flushed\n"
|
||||
else
|
||||
printf "\n\tsboff %d; scoff %d\n", \
|
||||
(int)$h->c_sboff, (int)$h->c_scoff
|
||||
printf "\teboff %d; eclen %d; ecsize %d\n", \
|
||||
(int)$h->c_eboff, (int)$h->c_eclen, \
|
||||
(int)$h->c_ecsize
|
||||
end
|
||||
set $h = $h + 1
|
||||
end
|
||||
end
|
||||
|
||||
# display the tail of the VI screen map
|
||||
define tmap
|
||||
set $h = ((VI_PRIVATE *)$arg0->vi_private)->h_smap
|
||||
set $t = ((VI_PRIVATE *)$arg0->vi_private)->t_smap
|
||||
while ($t >= $h)
|
||||
printf "lno: %2d; soff %d coff %d ", \
|
||||
(int)$t->lno, (int)$t->soff, (int)$t->coff
|
||||
if ($t->c_ecsize == 0)
|
||||
printf "flushed\n"
|
||||
else
|
||||
printf "\n\tsboff %d; scoff %d\n", \
|
||||
(int)$t->c_sboff, (int)$t->c_scoff
|
||||
printf "\teboff %d; eclen %d; ecsize %d\n", \
|
||||
(int)$t->c_eboff, (int)$t->c_eclen, \
|
||||
(int)$t->c_ecsize
|
||||
end
|
||||
set $t = $t - 1
|
||||
end
|
||||
end
|
||||
|
||||
# display the private structures
|
||||
define clp
|
||||
print *((CL_PRIVATE *)sp->gp->cl_private)
|
||||
end
|
||||
define vip
|
||||
print *((VI_PRIVATE *)sp->vi_private)
|
||||
end
|
||||
define exp
|
||||
print *((EX_PRIVATE *)sp->ex_private)
|
||||
end
|
||||
|
||||
# display the marks
|
||||
define markp
|
||||
set $h = sp->ep->marks.next
|
||||
set $t = &sp->ep->marks
|
||||
while ($h != 0 && $h != $t)
|
||||
printf "key %c lno: %d cno: %d flags: %x\n", \
|
||||
((MARK *)$h)->name, ((MARK *)$h)->lno, \
|
||||
((MARK *)$h)->cno, ((MARK *)$h)->flags
|
||||
set $h = ((MARK *)$h)->next
|
||||
end
|
||||
end
|
||||
|
||||
# display the tags
|
||||
define tagp
|
||||
set $h = sp->taghdr.next
|
||||
set $t = &sp->taghdr
|
||||
while ($h != 0 && $h != $t)
|
||||
printf "tag: %s lno %d cno %d\n", ((TAG *)$h)->frp->fname, \
|
||||
((TAG *)$h)->lno, ((TAG *)$h)->cno
|
||||
set $h= ((TAG *)$h)->next
|
||||
end
|
||||
end
|
@ -1,350 +0,0 @@
|
||||
# @(#)input 5.5 (Berkeley) 7/2/94
|
||||
|
||||
MAPS, EXECUTABLE BUFFERS AND INPUT IN EX/VI:
|
||||
|
||||
The basic rule is that input in ex/vi is a stack. Every time a key which
|
||||
gets expanded is encountered, it is expanded and the expansion is treated
|
||||
as if it were input from the user. So, maps and executable buffers are
|
||||
simply pushed onto the stack from which keys are returned. The exception
|
||||
is that if the "remap" option is turned off, only a single map expansion
|
||||
is done. I intend to be fully backward compatible with this.
|
||||
|
||||
Historically, if the mode of the editor changed (ex to vi or vice versa),
|
||||
any queued input was silently discarded. I don't see any reason to either
|
||||
support or not support this semantic. I intend to retain the queued input,
|
||||
mostly because it's simpler than throwing it away.
|
||||
|
||||
Historically, neither the initial command on the command line (the + flag)
|
||||
or the +cmd associated with the ex and edit commands was subject to mapping.
|
||||
Also, while the +cmd appears to be subject to "@buffer" expansion, once
|
||||
expanded it doesn't appear to work correctly. I don't see any reason to
|
||||
either support or not support these semantics, so, for consistency, I intend
|
||||
to pass both the initial command and the command associated with ex and edit
|
||||
commands through the standard mapping and @ buffer expansion.
|
||||
|
||||
One other difference between the historic ex/vi and nex/nvi is that nex
|
||||
displays the executed buffers as it executes them. This means that if
|
||||
the file is:
|
||||
|
||||
set term=xterm
|
||||
set term=yterm
|
||||
set term=yterm
|
||||
|
||||
the user will see the following during a typical edit session:
|
||||
|
||||
nex testfile
|
||||
testfile: unmodified: line 3
|
||||
:1,$yank a
|
||||
:@a
|
||||
:set term=zterm
|
||||
:set term=yterm
|
||||
:set term=xterm
|
||||
:q!
|
||||
|
||||
This seems like a feature and unlikely to break anything, so I don't
|
||||
intend to match historic practice in this area.
|
||||
|
||||
The rest of this document is a set of conclusions as to how I believe
|
||||
the historic maps and @ buffers work. The summary is as follows:
|
||||
|
||||
1: For buffers that are cut in "line mode", or buffers that are not cut
|
||||
in line mode but which contain portions of more than a single line, a
|
||||
trailing <newline> character appears in the input for each line in the
|
||||
buffer when it is executed. For buffers not cut in line mode and which
|
||||
contain portions of only a single line, no additional characters
|
||||
appear in the input.
|
||||
2: Executable buffers that execute other buffers don't load their
|
||||
contents until they execute them.
|
||||
3: Maps and executable buffers are copied when they are executed --
|
||||
they can be modified by the command but that does not change their
|
||||
actions.
|
||||
4: Historically, executable buffers are discarded if the editor
|
||||
switches between ex and vi modes.
|
||||
5: Executable buffers inside of map commands are expanded normally.
|
||||
Maps inside of executable buffers are expanded normally.
|
||||
6: If an error is encountered while executing a mapped command or buffer,
|
||||
the rest of the mapped command/buffer is discarded. No user input
|
||||
characters are discarded.
|
||||
7: Characters in executable buffers are remapped.
|
||||
8: Characters in executable buffers are not quoted.
|
||||
|
||||
Individual test cases follow. Note, in the test cases, control characters
|
||||
are not literal and will have to be replaced to make the test cases work.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
1: For buffers that are cut in "line mode", or buffers that are not cut
|
||||
in line mode but which contain portions of more than a single line, a
|
||||
trailing <newline> character appears in the input for each line in the
|
||||
buffer when it is executed. For buffers not cut in line mode and which
|
||||
contain portions of only a single line, no additional characters
|
||||
appear in the input.
|
||||
|
||||
=== test file ===
|
||||
3Gw
|
||||
w
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
=== end test file ===
|
||||
|
||||
If the first line is loaded into 'a' and executed:
|
||||
|
||||
1G"ayy@a
|
||||
|
||||
The cursor ends up on the '2', a result of pushing "3Gw^J" onto
|
||||
the stack.
|
||||
|
||||
If the first two lines are loaded into 'a' and executed:
|
||||
|
||||
1G2"ayy@a
|
||||
|
||||
The cursor ends up on the 'f' in "foo" in the fifth line of the
|
||||
file, a result of pushing "3Gw^Jw^J" onto the stack.
|
||||
|
||||
If the first line is loaded into 'a', but not using line mode,
|
||||
and executed:
|
||||
|
||||
1G"ay$@a
|
||||
|
||||
The cursor ends up on the '1', a result of pushing "3Gw" onto
|
||||
the stack
|
||||
|
||||
If the first two lines are loaded into 'a', but not using line mode,
|
||||
and executed:
|
||||
|
||||
1G2"ay$@a
|
||||
|
||||
The cursor ends up on the 'f' in "foo" in the fifth line of the
|
||||
file, a result of pushing "3Gw^Jw^J" onto the stack.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
2: Executable buffers that execute other buffers don't load their
|
||||
contents until they execute them.
|
||||
|
||||
=== test file ===
|
||||
cwLOAD B^[
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
@a@b
|
||||
"byy
|
||||
=== end test file ===
|
||||
|
||||
The command is loaded into 'e', and then executed. 'e' executes
|
||||
'a', which loads 'b', then 'e' executes 'b'.
|
||||
|
||||
5G"eyy6G"ayy1G@e
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
cwLOAD B^[
|
||||
LOAD B 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
@a@b
|
||||
"byy
|
||||
=== end output file ===
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
3: Maps and executable buffers are copied when they are executed --
|
||||
they can be modified by the command but that does not change their
|
||||
actions.
|
||||
|
||||
Executable buffers:
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
@a@b
|
||||
"eyy
|
||||
cwEXECUTE B^[
|
||||
=== end test file ===
|
||||
|
||||
4G"eyy5G"ayy6G"byy1G@eG"ep
|
||||
|
||||
The command is loaded into 'e', and then executed. 'e' executes
|
||||
'a', which loads 'e', then 'e' executes 'b' anyway.
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
line 1 foo bar baz
|
||||
EXECUTE B 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
@a@b
|
||||
"eyy
|
||||
cwEXECUTE B^[
|
||||
line 1 foo bar baz
|
||||
=== end output file ===
|
||||
|
||||
Maps:
|
||||
|
||||
=== test file ===
|
||||
Cine 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
=== end test file ===
|
||||
|
||||
Entering the command ':map = :map = rB^V^MrA^M1G==' shows that
|
||||
the first time the '=' is entered the '=' map is set and the
|
||||
character is changed to 'A', the second time the character is
|
||||
changed to 'B'.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
4: Historically, executable buffers are discarded if the editor
|
||||
switches between ex and vi modes.
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
cwCHANGE^[Q:set
|
||||
set|visual|1Gwww
|
||||
=== end test file ===
|
||||
|
||||
vi testfile
|
||||
4G"ayy@a
|
||||
|
||||
ex testfile
|
||||
$p
|
||||
yank a
|
||||
@a
|
||||
|
||||
In vi, the command is loaded into 'a' and then executed. The command
|
||||
subsequent to the 'Q' is (historically, silently) discarded.
|
||||
|
||||
In ex, the command is loaded into 'a' and then executed. The command
|
||||
subsequent to the 'visual' is (historically, silently) discarded. The
|
||||
first set command is output by ex, although refreshing the screen usually
|
||||
causes it not to be seen.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
5: Executable buffers inside of map commands are expanded normally.
|
||||
Maps inside of executable buffers are expanded normally.
|
||||
|
||||
Buffers inside of map commands:
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
cwREPLACE BY A^[
|
||||
=== end test file ===
|
||||
|
||||
4G"ay$:map x @a
|
||||
1Gx
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
REPLACE BY A 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
cwREPLACE BY A^[
|
||||
=== end output file ===
|
||||
|
||||
Maps commands inside of executable buffers:
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
X
|
||||
=== end test file ===
|
||||
|
||||
:map X cwREPLACE BY XMAP^[
|
||||
4G"ay$1G@a
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
REPLACE BY XMAP 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
X
|
||||
=== end output file ===
|
||||
|
||||
Here's a test that does both, repeatedly.
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
X
|
||||
Y
|
||||
cwREPLACED BY C^[
|
||||
blank line
|
||||
=== end test file ===
|
||||
|
||||
:map x @a
|
||||
4G"ay$
|
||||
:map X @b
|
||||
5G"by$
|
||||
:map Y @c
|
||||
6G"cy$
|
||||
1Gx
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
REPLACED BY C 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
X
|
||||
Y
|
||||
cwREPLACED BY C^[
|
||||
blank line
|
||||
=== end output file ===
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
6: If an error is encountered while executing a mapped command or
|
||||
a buffer, the rest of the mapped command/buffer is discarded. No
|
||||
user input characters are discarded.
|
||||
|
||||
=== test file ===
|
||||
line 1 foo bar baz
|
||||
line 2 foo bar baz
|
||||
line 3 foo bar baz
|
||||
:map = 10GcwREPLACMENT^V^[^[
|
||||
=== end test file ===
|
||||
|
||||
The above mapping fails, however, if the 10G is changed to 1, 2,
|
||||
or 3G, it will succeed.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
7: Characters in executable buffers are remapped.
|
||||
|
||||
=== test file ===
|
||||
abcdefghijklmnnop
|
||||
ggg
|
||||
=== end test file ===
|
||||
|
||||
:map g x
|
||||
2G"ay$1G@a
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
defghijklmnnop
|
||||
ggg
|
||||
=== end output file ===
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
8: Characters in executable buffers are not quoted.
|
||||
|
||||
=== test file ===
|
||||
iFOO^[
|
||||
|
||||
=== end test file ===
|
||||
|
||||
1G"ay$2G@a
|
||||
|
||||
The output should be:
|
||||
|
||||
=== output file ===
|
||||
iFOO^[
|
||||
FOO
|
||||
=== end output file ===
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
@ -1,36 +0,0 @@
|
||||
@(#)openmode 8.1 (Berkeley) 10/29/94
|
||||
|
||||
Open mode has the following special behaviors:
|
||||
|
||||
z, ^F, ^B:
|
||||
If count is not specified, it shall default to the window
|
||||
edit option - 2.
|
||||
|
||||
Write lines from the edit buffer starting at:
|
||||
|
||||
(the current line) - ((count - 2) / 2)
|
||||
|
||||
until:
|
||||
|
||||
(((count + 1) / 2) * 2) - 1
|
||||
|
||||
lines, or the last line in the edit buffer has been written. A
|
||||
line consisting of the smaller of the number of columns in the
|
||||
display divided by two or 40 ``-'' characters shall be written
|
||||
immediately before and after the specified is written. These two
|
||||
lines shall count against the total number of lines to be written.
|
||||
A blank line shall be written after the last line is written.
|
||||
|
||||
z, ^F and ^B all behave identically.
|
||||
|
||||
^D: Display the next scroll value lines, change the current line.
|
||||
|
||||
^U: Change the current line, do nothing else.
|
||||
|
||||
^E, ^Y: Do nothing.
|
||||
|
||||
^L: Clear the screen and redisplay the current line.
|
||||
|
||||
H, L, M:
|
||||
Move to the first nonblank of the current line and do nothing
|
||||
else.
|
@ -1,208 +0,0 @@
|
||||
# @(#)quoting 5.5 (Berkeley) 11/12/94
|
||||
|
||||
QUOTING IN EX/VI:
|
||||
|
||||
There are four escape characters in historic ex/vi:
|
||||
|
||||
\ (backslashes)
|
||||
^V
|
||||
^Q (assuming it wasn't used for IXON/IXOFF)
|
||||
The terminal literal next character.
|
||||
|
||||
Vi did not use the lnext character, it always used ^V (or ^Q).
|
||||
^V and ^Q were equivalent in all cases for vi.
|
||||
|
||||
There are four different areas in ex/vi where escaping characters
|
||||
is interesting:
|
||||
|
||||
1: In vi text input mode.
|
||||
2: In vi command mode.
|
||||
3: In ex command and text input modes.
|
||||
4: In the ex commands themselves.
|
||||
|
||||
1: Vi text input mode (a, i, o, :colon commands, etc.):
|
||||
|
||||
The set of characters that users might want to escape are as follows.
|
||||
As ^L and ^Z were not special in input mode, they are not listed.
|
||||
|
||||
carriage return (^M)
|
||||
escape (^[)
|
||||
autoindents (^D, 0, ^, ^T)
|
||||
erase (^H)
|
||||
word erase (^W)
|
||||
line erase (^U)
|
||||
newline (^J) (not historic practice)
|
||||
|
||||
Historic practice was that ^V was the only way to escape any
|
||||
of these characters, and that whatever character followed
|
||||
the ^V was taken literally, e.g. ^V^V is a single ^V. I
|
||||
don't see any strong reason to make it possible to escape
|
||||
^J, so I'm going to leave that alone.
|
||||
|
||||
One comment regarding the autoindent characters. In historic
|
||||
vi, if you entered "^V0^D" autoindent erasure was still
|
||||
triggered, although it wasn't if you entered "0^V^D". In
|
||||
nvi, if you escape either character, autoindent erasure is
|
||||
not triggered.
|
||||
|
||||
Abbreviations were not performed if the non-word character
|
||||
that triggered the abbreviation was escaped by a ^V. Input
|
||||
maps were not triggered if any part of the map was escaped
|
||||
by a ^V.
|
||||
|
||||
The historic vi implementation for the 'r' command requires
|
||||
two leading ^V's to replace a character with a literal
|
||||
character. This is obviously a bug, and should be fixed.
|
||||
|
||||
2: Vi command mode
|
||||
|
||||
Command maps were not triggered if the second or later
|
||||
character of a map was escaped by a ^V.
|
||||
|
||||
The obvious extension is that ^V should keep the next command
|
||||
character from being mapped, so you can do ":map x xxx" and
|
||||
then enter ^Vx to delete a single character.
|
||||
|
||||
3: Ex command and text input modes.
|
||||
|
||||
As ex ran in canonical mode, there was little work that it
|
||||
needed to do for quoting. The notable differences between
|
||||
ex and vi are that it was possible to escape a <newline> in
|
||||
the ex command and text input modes, and ex used the "literal
|
||||
next" character, not control-V/control-Q.
|
||||
|
||||
4: The ex commands:
|
||||
|
||||
Ex commands are delimited by '|' or newline characters.
|
||||
Within the commands, whitespace characters delimit the
|
||||
arguments. Backslash will generally escape any following
|
||||
character. In the abbreviate, unabbreviate, map and unmap
|
||||
commands, control-V escapes the next character, instead.
|
||||
|
||||
This is historic behavior in vi, although there are special
|
||||
cases where it's impossible to escape a character, generally
|
||||
a whitespace character.
|
||||
|
||||
Escaping characters in file names in ex commands:
|
||||
|
||||
:cd [directory] (directory)
|
||||
:chdir [directory] (directory)
|
||||
:edit [+cmd] [file] (file)
|
||||
:ex [+cmd] [file] (file)
|
||||
:file [file] (file)
|
||||
:next [file ...] (file ...)
|
||||
:read [!cmd | file] (file)
|
||||
:source [file] (file)
|
||||
:write [!cmd | file] (file)
|
||||
:wq [file] (file)
|
||||
:xit [file] (file)
|
||||
|
||||
Since file names are also subject to word expansion, the
|
||||
underlying shell had better be doing the correct backslash
|
||||
escaping. This is NOT historic behavior in vi, making it
|
||||
impossible to insert a whitespace, newline or carriage return
|
||||
character into a file name.
|
||||
|
||||
4: Escaping characters in non-file arguments in ex commands:
|
||||
|
||||
:abbreviate word string (word, string)
|
||||
* :edit [+cmd] [file] (+cmd)
|
||||
* :ex [+cmd] [file] (+cmd)
|
||||
:map word string (word, string)
|
||||
* :set [option ...] (option)
|
||||
* :tag string (string)
|
||||
:unabbreviate word (word)
|
||||
:unmap word (word)
|
||||
|
||||
These commands use whitespace to delimit their arguments, and use
|
||||
^V to escape those characters. The exceptions are starred in the
|
||||
above list, and are discussed below.
|
||||
|
||||
In general, I intend to treat a ^V in any argument, followed by
|
||||
any character, as that literal character. This will permit
|
||||
editing of files name "foo|", for example, by using the string
|
||||
"foo\^V|", where the literal next character protects the pipe
|
||||
from the ex command parser and the backslash protects it from the
|
||||
shell expansion.
|
||||
|
||||
This is backward compatible with historical vi, although there
|
||||
were a number of special cases where vi wasn't consistent.
|
||||
|
||||
4.1: The edit/ex commands:
|
||||
|
||||
The edit/ex commands are a special case because | symbols may
|
||||
occur in the "+cmd" field, for example:
|
||||
|
||||
:edit +10|s/abc/ABC/ file.c
|
||||
|
||||
In addition, the edit and ex commands have historically
|
||||
ignored literal next characters in the +cmd string, so that
|
||||
the following command won't work.
|
||||
|
||||
:edit +10|s/X/^V / file.c
|
||||
|
||||
I intend to handle the literal next character in edit/ex consistently
|
||||
with how it is handled in other commands.
|
||||
|
||||
More fun facts to know and tell:
|
||||
The acid test for the ex/edit commands:
|
||||
|
||||
date > file1; date > file2
|
||||
vi
|
||||
:edit +1|s/./XXX/|w file1| e file2|1 | s/./XXX/|wq
|
||||
|
||||
No version of vi, of which I'm aware, handles it.
|
||||
|
||||
4.2: The set command:
|
||||
|
||||
The set command treats ^V's as literal characters, so the
|
||||
following command won't work. Backslashes do work in this
|
||||
case, though, so the second version of the command does work.
|
||||
|
||||
set tags=tags_file1^V tags_file2
|
||||
set tags=tags_file1\ tags_file2
|
||||
|
||||
I intend to continue permitting backslashes in set commands,
|
||||
but to also permit literal next characters to work as well.
|
||||
This is backward compatible, but will also make set
|
||||
consistent with the other commands. I think it's unlikely
|
||||
to break any historic .exrc's, given that there are probably
|
||||
very few files with ^V's in their name.
|
||||
|
||||
4.3: The tag command:
|
||||
|
||||
The tag command ignores ^V's and backslashes; there's no way to
|
||||
get a space into a tag name.
|
||||
|
||||
I think this is a don't care, and I don't intend to fix it.
|
||||
|
||||
5: Regular expressions:
|
||||
|
||||
:global /pattern/ command
|
||||
:substitute /pattern/replace/
|
||||
:vglobal /pattern/ command
|
||||
|
||||
I intend to treat a backslash in the pattern, followed by the
|
||||
delimiter character or a backslash, as that literal character.
|
||||
|
||||
This is historic behavior in vi. It would get rid of a fairly
|
||||
hard-to-explain special case if we could just use the character
|
||||
immediately following the backslash in all cases, or, if we
|
||||
changed nvi to permit using the literal next character as a
|
||||
pattern escape character, but that would probably break historic
|
||||
scripts.
|
||||
|
||||
There is an additional escaping issue for regular expressions.
|
||||
Within the pattern and replacement, the '|' character did not
|
||||
delimit ex commands. For example, the following is legal.
|
||||
|
||||
:substitute /|/PIPE/|s/P/XXX/
|
||||
|
||||
This is a special case that I will support.
|
||||
|
||||
6: Ending anything with an escape character:
|
||||
|
||||
In all of the above rules, an escape character (either ^V or a
|
||||
backslash) at the end of an argument or file name is not handled
|
||||
specially, but used as a literal character.
|
||||
|
@ -1,68 +0,0 @@
|
||||
# @(#)structures 5.4 (Berkeley) 10/4/95
|
||||
|
||||
There are three major data structures in this package, plus a single data
|
||||
structure per screen type. The first is a single global structure (GS)
|
||||
which contains information common to all files and screens. It hold
|
||||
global things like the input key queues, and functions as a single place
|
||||
to hang things. For example, interrupt routines have to be able to find
|
||||
screen structures, and they can only do this if they have a starting
|
||||
point. The number of globals in nvi is dependent on the screen type, but
|
||||
every screen type will have at least one global, __global_list, which
|
||||
references the GS structure.
|
||||
|
||||
The GS structure contains linked lists of screen (SCR) structures.
|
||||
Each SCR structure normally references a file (EXF) structure.
|
||||
|
||||
The GS structure has a set of functions which update the screen and/or
|
||||
return information about the screen from the underlying screen package.
|
||||
The GS structure never goes away. The SCR structure persists over
|
||||
instances of screens, and the EXF structure persists over references to
|
||||
files.
|
||||
|
||||
File names have different properties than files themselves, so the name
|
||||
information for a file is held in an FREF structure which is chained from
|
||||
the SCR structure.
|
||||
|
||||
In general, functions are always passed an SCR structure, which usually
|
||||
references an underlying EXF structure. The SCR structure is necessary
|
||||
for any routine that wishes to talk to the screen, the EXF structure is
|
||||
necessary for any routine that wants to modify the file. The relationship
|
||||
between an SCR structure and its underlying EXF structure is not fixed,
|
||||
and various ex commands will substitute a new EXF in place of the current
|
||||
one, and there's no way to detect this.
|
||||
|
||||
The naming of the structures is consistent across the program. (Macros
|
||||
even depend on it, so don't try and change it!) The global structure is
|
||||
"gp", the screen structure is "sp", and the file structure is "ep".
|
||||
|
||||
A few other data structures:
|
||||
|
||||
TEXT In nvi/cut.h. This structure describes a portion of a line,
|
||||
and is used by the input routines and as the "line" part of a
|
||||
cut buffer.
|
||||
|
||||
CB In nvi/cut.h. A cut buffer. A cut buffer is a place to
|
||||
hang a list of TEXT structures.
|
||||
|
||||
CL The curses screen private data structure. Everything to
|
||||
do standalone curses screens.
|
||||
|
||||
MARK In nvi/mark.h. A cursor position, consisting of a line number
|
||||
and a column number.
|
||||
|
||||
MSG In nvi/msg.h. A chain of messages for the user.
|
||||
|
||||
SEQ In nvi/seq.h. An abbreviation or a map entry.
|
||||
|
||||
TK The Tcl/Tk screen private data structure. Everything to
|
||||
do standalone Tcl/Tk screens.
|
||||
|
||||
EXCMD In nvi/ex/ex.h. The structure that gets passed around to the
|
||||
functions that implement the ex commands. (The main ex command
|
||||
loop (see nvi/ex/ex.c) builds this up and then passes it to the
|
||||
ex functions.)
|
||||
|
||||
VICMD In nvi/vi/vi.h. The structure that gets passed around to the
|
||||
functions that implement the vi commands. (The main vi command
|
||||
loop (see nvi/vi/vi.c) builds this up and then passes it to the
|
||||
vi functions.)
|
@ -1,190 +0,0 @@
|
||||
# @(#)interp 8.5 (Berkeley) 10/19/96
|
||||
Nvi Interpreter API
|
||||
|
||||
Introduction:
|
||||
The intention is to provide a way to graft a fairly generic extension
|
||||
language into nvi. I think that the obvious candidates are Tcl/Rush,
|
||||
Scheme, Python and Perl. Since the interpretation language chosen
|
||||
is often a religious issue, the method should be as flexible as
|
||||
possible. I don't expect to rewrite the editor in the interpreted
|
||||
language, so that isn't a consideration.
|
||||
|
||||
Q: Is there any reason for nvi to support multiple interpreters in
|
||||
a single executable?
|
||||
|
||||
Interpreter functions in nvi:
|
||||
|
||||
1: Function to get the current screen pointer.
|
||||
|
||||
SCR *inter_screen();
|
||||
|
||||
Return a pointer to the current screen.
|
||||
|
||||
2: Functions to execute both ex and vi commands. The return value of the
|
||||
function will be success/failure. The editor itself will continue to
|
||||
handle the display of all messages and text for the foreseeable future.
|
||||
|
||||
int inter_vicmd(SCR *, char *cmds, size_t len);
|
||||
int inter_excmd(SCR *, char *cmds, size_t len);
|
||||
|
||||
The byte string cmds, of length len, is entered into the standard
|
||||
vi or ex parser, as if typed by the user. The characters are not
|
||||
mapped in any way, i.e. the user's vi mappings don't apply. If
|
||||
any error occurs, an error value is returned, and the rest of the
|
||||
characters are discarded.
|
||||
|
||||
3: Functions to handle lines of text in the file.
|
||||
|
||||
int inter_gline(SCR *, recno_t lno, char **lp, size_t *lenp);
|
||||
|
||||
Return a pointer to the text of the line lno, into the location
|
||||
referenced by lp, and its length into the location referenced by
|
||||
lenp.
|
||||
|
||||
int inter_dline(SCR *, recno_t lno);
|
||||
|
||||
Delete the line lno from the file.
|
||||
|
||||
int inter_aline(SCR *, recno_t lno, char *lp, size_t len);
|
||||
|
||||
Append a line consisting of the len bytes of text referenced by
|
||||
lp to the line lno.
|
||||
|
||||
int inter_iline(SCR *, recno_t lno, char *lp, size_t len);
|
||||
|
||||
Insert a line consisting of the len bytes of text referenced by
|
||||
lp before the line lno.
|
||||
|
||||
int inter_sline(SCR *, recno_t lno, char *lp, size_t len);
|
||||
|
||||
Replace line lno with the len bytes of text referenced by lp.
|
||||
|
||||
int inter_lline(SCR *, recno_t *lnop);
|
||||
|
||||
Return the number of the last line in the file in the location
|
||||
referenced by lnop.
|
||||
|
||||
4: Function to post an error message to the user.
|
||||
|
||||
int inter_msgq(SCR *, enum msgtype, char *fmt, ...);
|
||||
|
||||
Display the message for the user. Valid message types are:
|
||||
|
||||
M_BERR Error: M_ERR if verbose, else bell.
|
||||
M_ERR Error: Display in inverse video.
|
||||
M_INFO Info: Display in normal video.
|
||||
M_SYSERR Error: M_ERR, using strerror(3) message.
|
||||
M_VINFO Info: M_INFO if verbose, else ignore.
|
||||
|
||||
5: Function to manipulate cut buffers.
|
||||
|
||||
int inter_setbuf(SCR *, CHAR_T buffer);
|
||||
|
||||
Create the specified buffer if it does not exist (the
|
||||
buffer will have no contents).
|
||||
|
||||
int inter_getbuf(SCR *, CHAR_T buffer, TEXT **textp);
|
||||
|
||||
Return a pointer to the specified buffer in the location
|
||||
referenced by textp. (Since a pointer to the real item
|
||||
is being returned, it can be manipulated in any way the
|
||||
interpreter chooses.)
|
||||
|
||||
6: Functions to manipulate marks.
|
||||
|
||||
int inter_setmark(SCR *, CHAR_T name);
|
||||
|
||||
Create the specified mark if it does not exist (the
|
||||
mark will have no contents).
|
||||
|
||||
int inter_getmark(SCR *, CHAR_T name, MARK **markp);
|
||||
|
||||
Return a pointer to the specified mark in the location
|
||||
referenced by markp. (Since a pointer to the real item
|
||||
is being returned, it can be manipulated in any way the
|
||||
interpreter chooses.)
|
||||
|
||||
7: Function to manipulate screens.
|
||||
|
||||
SCR *inter_iscreen();
|
||||
|
||||
Create a new screen, and return a pointer to it.
|
||||
|
||||
int inter_escreen(SCR *);
|
||||
|
||||
End a screen.
|
||||
|
||||
8: Functions to get input from the user.
|
||||
|
||||
int inter_getchar(CHAR_T *chp,
|
||||
enum maptype {NONE, INPUT, COMMAND} mapt);
|
||||
|
||||
Return a character from the keyboard into the location referenced
|
||||
by chp. Mapt can be set to INPUT, COMMAND or NONE, depending on
|
||||
what vi mappings should be applied to the character.
|
||||
|
||||
int inter_getline(SCR *, char *prompt, CHAR_T **linep,
|
||||
size_t *lenp, enum maptype {NONE, INPUT, COMMAND} mapt);
|
||||
|
||||
Return a pointer to a line entered by the user, and its length,
|
||||
into the locations linep and lenp. A prompt may be specified
|
||||
by prompt, and mappings by mapt.
|
||||
|
||||
int inter_freeline(CHAR_T *linep);
|
||||
|
||||
Free the memory that was allocated by inter_getline();
|
||||
|
||||
9: Function to retrieve and set the cursor.
|
||||
|
||||
int inter_getcursor(SCR *, MARK *mark);
|
||||
|
||||
Store the current cursor position in mark.
|
||||
|
||||
int inter_setcursor(SCR *, MARK *mark);
|
||||
|
||||
Set the current cursor position to mark.
|
||||
|
||||
10: Function to return a motion command from the user.
|
||||
|
||||
int inter_getmotion(SCR *,
|
||||
MARK *start, MARK *end, enum movetype {LINE, CHAR} *mt);
|
||||
|
||||
Nvi gets a motion command from the user and returns the starting
|
||||
and stopping points of the movement, reordered from the beginning
|
||||
to the end of the file. The standard rules for line/character
|
||||
motions are applied, and returned to the interpreter through the
|
||||
mt argument.
|
||||
|
||||
11: Functions to return pathnames.
|
||||
|
||||
12: Functions to return edit options.
|
||||
|
||||
13: Nvi commands which will send text to the interpreter.
|
||||
|
||||
Nvi will have a new ex command "inter", which will pipe the rest of
|
||||
the line up to the first unescaped <newline> to the interpreter, of
|
||||
the following form:
|
||||
|
||||
:[address[,address]] inter [count] command
|
||||
|
||||
The interface from the ex command to the interpreter is a function:
|
||||
|
||||
int inter_ex(
|
||||
SCR *, /* Current screen. */
|
||||
char *cmd; /* The command. */
|
||||
size_t len; /* The command length. */
|
||||
MARK *start, /* Starting address for INTER_EX */
|
||||
MARK *end, /* Ending address for INTER_EX */
|
||||
int count); /* Count. */
|
||||
|
||||
Nvi will have a new vi command "*<buffer>" which will pipe the contents
|
||||
of the named buffer to the interpreter, of the following form:
|
||||
|
||||
[count]*<buffer>
|
||||
|
||||
The interface from the vi command to the interpreter is a function:
|
||||
|
||||
int inter_vi(
|
||||
SCR *, /* Current screen. */
|
||||
CHAR_T buffer, /* Buffer. */
|
||||
int count); /* Count. */
|
@ -1,46 +0,0 @@
|
||||
API
|
||||
BERR
|
||||
Mapt
|
||||
Nvi
|
||||
Perl
|
||||
SCR
|
||||
SYSERR
|
||||
Tcl
|
||||
VINFO
|
||||
aline
|
||||
callback
|
||||
chp
|
||||
cmd
|
||||
cmds
|
||||
dline
|
||||
enum
|
||||
escreen
|
||||
excmd
|
||||
freeline
|
||||
getbuf
|
||||
getcursor
|
||||
getline
|
||||
getmotion
|
||||
gline
|
||||
iline
|
||||
int
|
||||
interp
|
||||
iscreen
|
||||
lenp
|
||||
linep
|
||||
lline
|
||||
lno
|
||||
lnop
|
||||
lp
|
||||
mapt
|
||||
maptype
|
||||
movetype
|
||||
msgq
|
||||
msgtype
|
||||
nvi
|
||||
recno
|
||||
setcursor
|
||||
sline
|
||||
strerror
|
||||
textp
|
||||
vicmd
|
@ -197,7 +197,8 @@ and that is the
|
||||
.Aq escape
|
||||
key.
|
||||
.Pp
|
||||
Key names are written using less-than and greater-than signs, e.g.,
|
||||
In this manual,
|
||||
key names are denoted with \(la and \(ra, e.g.,
|
||||
.Aq escape
|
||||
means the
|
||||
.Dq escape
|
||||
@ -238,9 +239,9 @@ Move the cursor up one line.
|
||||
Move the cursor right one character.
|
||||
.It Aq Cm cursor-arrows
|
||||
The cursor arrow keys should work, too.
|
||||
.It Cm / Ns text
|
||||
.It Cm / Ns Ar text
|
||||
Search for the string
|
||||
.Dq text
|
||||
.Dq Ar text
|
||||
in the file,
|
||||
and move the cursor to its first character.
|
||||
.El
|
||||
@ -346,10 +347,10 @@ version of regular expressions:
|
||||
.It
|
||||
An empty regular expression is equivalent to the last regular expression used.
|
||||
.It
|
||||
.Sq \e\(la
|
||||
.Sq \e<
|
||||
matches the beginning of the word.
|
||||
.It
|
||||
.Sq \e\(ra
|
||||
.Sq \e>
|
||||
matches the end of the word.
|
||||
.It
|
||||
.Sq \(a~
|
||||
@ -363,7 +364,7 @@ for later use.
|
||||
.Nm vi
|
||||
buffers are named with a single character preceded by a double quote,
|
||||
for example
|
||||
.Pf \&" Ns Aq c ;
|
||||
.Cm \&" Ns Aq Ar c ;
|
||||
.Nm ex
|
||||
buffers are the same,
|
||||
but without the double quote.
|
||||
@ -413,7 +414,7 @@ make the destination buffer character-oriented.
|
||||
.Cm j ,
|
||||
.Aq Cm control-M ,
|
||||
.Cm k ,
|
||||
.Cm ' ,
|
||||
.Cm \(aq ,
|
||||
.Cm - ,
|
||||
.Cm G ,
|
||||
.Cm H ,
|
||||
@ -426,7 +427,7 @@ make the destination buffer line-oriented.
|
||||
.It
|
||||
.Cm $ ,
|
||||
.Cm % ,
|
||||
.Cm ` ,
|
||||
.Cm \` ,
|
||||
.Cm (\& ,
|
||||
.Cm )\& ,
|
||||
.Cm / ,
|
||||
@ -476,7 +477,7 @@ It is specified using a line-oriented motion.
|
||||
.It
|
||||
It is specified using one of the following motion commands:
|
||||
.Aq Cm control-A ,
|
||||
.Cm ` Ns Aq Cm character ,
|
||||
.Cm \` Ns Aq Ar character ,
|
||||
.Cm n ,
|
||||
.Cm N ,
|
||||
.Cm % ,
|
||||
@ -803,7 +804,7 @@ If
|
||||
.Ar count
|
||||
is specified, additionally move the cursor down
|
||||
.Ar count
|
||||
\- 1 lines.
|
||||
\(mi 1 lines.
|
||||
.Pp
|
||||
.It Cm %
|
||||
Move to the
|
||||
@ -815,26 +816,26 @@ the one found at the cursor position or the closest to the right of it.
|
||||
Repeat the previous substitution command on the current line.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Cm ' Ns Aq Ar character
|
||||
.Cm \(aq Ns Aq Ar character
|
||||
.Xc
|
||||
.It Xo
|
||||
.Cm ` Ns Aq Ar character
|
||||
.Cm \` Ns Aq Ar character
|
||||
.Xc
|
||||
Return to the cursor position marked by the character
|
||||
.Ar character ,
|
||||
or, if
|
||||
.Ar character
|
||||
is
|
||||
.Sq '
|
||||
.Sq \(aq
|
||||
or
|
||||
.Sq ` ,
|
||||
.Sq \` ,
|
||||
to the position of the cursor before the last of the following commands:
|
||||
.Aq Cm control-A ,
|
||||
.Aq Cm control-T ,
|
||||
.Aq Cm control-] ,
|
||||
.Cm % ,
|
||||
.Cm ' ,
|
||||
.Cm ` ,
|
||||
.Cm \(aq ,
|
||||
.Cm \` ,
|
||||
.Cm (\& ,
|
||||
.Cm )\& ,
|
||||
.Cm / ,
|
||||
@ -1027,7 +1028,7 @@ If a
|
||||
.Ar count
|
||||
argument is given, the characters input are repeated
|
||||
.Ar count
|
||||
\- 1 times after input mode is exited.
|
||||
\(mi 1 times after input mode is exited.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Op Ar count
|
||||
@ -1094,7 +1095,7 @@ is not specified.
|
||||
.Xc
|
||||
Move to the screen line
|
||||
.Ar count
|
||||
\- 1 lines below the top of the screen.
|
||||
\(mi 1 lines below the top of the screen.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Op Ar count
|
||||
@ -1106,7 +1107,7 @@ If a
|
||||
argument is given,
|
||||
the characters input are repeated
|
||||
.Ar count
|
||||
\- 1 more times.
|
||||
\(mi 1 more times.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Op Ar count
|
||||
@ -1125,7 +1126,7 @@ It is set to one whitespace character otherwise.
|
||||
.Xc
|
||||
Move to the screen line
|
||||
.Ar count
|
||||
\- 1 lines above the bottom of the screen.
|
||||
\(mi 1 lines above the bottom of the screen.
|
||||
.Pp
|
||||
.It Cm M
|
||||
Move to the screen line in the middle of the screen.
|
||||
@ -1140,7 +1141,7 @@ If a
|
||||
argument is given,
|
||||
the characters input are repeated
|
||||
.Ar count
|
||||
\- 1 more times.
|
||||
\(mi 1 more times.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Op Ar buffer
|
||||
@ -1170,7 +1171,7 @@ If a
|
||||
argument is given,
|
||||
the characters input are repeated
|
||||
.Ar count
|
||||
\- 1 more times upon exit from insert mode.
|
||||
\(mi 1 more times upon exit from insert mode.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Op Ar buffer
|
||||
@ -1267,7 +1268,7 @@ Move to the first non-blank character on the current line.
|
||||
.Xc
|
||||
Move down
|
||||
.Ar count
|
||||
\- 1 lines, to the first non-blank character.
|
||||
\(mi 1 lines, to the first non-blank character.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Op Ar count
|
||||
@ -1371,7 +1372,7 @@ If a
|
||||
argument is given,
|
||||
the characters input are repeated
|
||||
.Ar count
|
||||
\- 1 more times.
|
||||
\(mi 1 more times.
|
||||
.Pp
|
||||
.It Xo
|
||||
.Op Ar buffer
|
||||
@ -2050,10 +2051,11 @@ If this is the entire
|
||||
pattern, the replacement part of the previous
|
||||
.Cm substitute
|
||||
command.
|
||||
.It Sq \e\(sh
|
||||
.It Sq \e Ns Ar \(sh
|
||||
Where
|
||||
.Sq \(sh
|
||||
is an integer from 1 to 9, the text matched by the #'th subexpression in
|
||||
.Sq Ar \(sh
|
||||
is an integer from 1 to 9, the text matched by the
|
||||
.Ar # Ns 'th subexpression in
|
||||
.Ar pattern .
|
||||
.It Sq \eL
|
||||
Causes the characters up to the end of the line of the next occurrence of
|
||||
@ -2264,7 +2266,7 @@ session.
|
||||
Back up files before they are overwritten.
|
||||
.It Cm beautify , bf Bq off
|
||||
Discard control characters.
|
||||
.It Cm cdpath Bq "environment variable CDPATH, or current directory"
|
||||
.It Cm cdpath Bo environment variable Ev CDPATH , or current directory Bc
|
||||
The directory paths used as path prefixes for the
|
||||
.Cm cd
|
||||
command.
|
||||
@ -2276,7 +2278,7 @@ Set the number of columns in the screen.
|
||||
.Nm vi
|
||||
only.
|
||||
Skip leading comments in shell, C and C++ language files.
|
||||
.It Cm directory , dir Bq "environment variable TMPDIR, or /tmp"
|
||||
.It Cm directory , dir Bo environment variable Ev TMPDIR , or Pa /tmp Bc
|
||||
The directory where temporary files are created.
|
||||
.It Cm edcompatible , ed Bq off
|
||||
Remember the values of the
|
||||
@ -2445,9 +2447,9 @@ and
|
||||
commands.
|
||||
.It Cm secure Bq off
|
||||
Turns off all access to external programs.
|
||||
.It Cm shell , sh Bq "environment variable SHELL, or /bin/sh"
|
||||
.It Cm shell , sh Bo environment variable Ev SHELL , or Pa /bin/sh Bc
|
||||
Select the shell used by the editor.
|
||||
.It Cm shellmeta Bq ~{[*?$`'\&"\e
|
||||
.It Cm shellmeta Bq ~{[*?$\`\(aq\&"\e
|
||||
Set the meta characters checked to determine if file name expansion
|
||||
is necessary.
|
||||
.It Cm shiftwidth , sw Bq 8
|
||||
@ -2480,7 +2482,7 @@ Set the number of significant characters in tag names.
|
||||
Set the list of tags files.
|
||||
.It Xo
|
||||
.Cm term , ttytype , tty
|
||||
.Bq "environment variable TERM"
|
||||
.Bq environment variable Ev TERM
|
||||
.Xc
|
||||
Set the terminal type.
|
||||
.It Cm terse Bq off
|
||||
@ -2521,7 +2523,7 @@ if the file has been modified since it was last written, before a
|
||||
command.
|
||||
.It Xo
|
||||
.Cm window , w , wi
|
||||
.Bq "environment variable LINES \- 1"
|
||||
.Bq environment variable Ev LINES No \(mi 1
|
||||
.Xc
|
||||
Set the window size for the screen.
|
||||
.It Cm windowname Bq off
|
173
docs/spell.ok
173
docs/spell.ok
@ -1,173 +0,0 @@
|
||||
API's
|
||||
Amiga
|
||||
Amir
|
||||
Bostic
|
||||
CFLAGS
|
||||
CR
|
||||
CTYPE
|
||||
Cscope
|
||||
Ctags
|
||||
DB
|
||||
DPURIFY
|
||||
Darren
|
||||
Ds
|
||||
Dw
|
||||
EXINIT
|
||||
Englar
|
||||
FreeBSD
|
||||
GDB
|
||||
Hiebert
|
||||
Kirkendall
|
||||
LC
|
||||
LN
|
||||
Linux
|
||||
Lite
|
||||
MSDOS
|
||||
Makefile
|
||||
Mayoff
|
||||
NEXINIT
|
||||
NVI
|
||||
NetBSD
|
||||
Neville
|
||||
Nvi
|
||||
Nvi's
|
||||
OS
|
||||
POSIX
|
||||
POSIX.2
|
||||
Perl
|
||||
PostScript
|
||||
README
|
||||
Roff
|
||||
Solaris
|
||||
SunOS
|
||||
Sven
|
||||
Tcl
|
||||
Tk
|
||||
Todo
|
||||
USD
|
||||
USD.doc
|
||||
USD:14
|
||||
USD:15
|
||||
USD:16
|
||||
UUNET
|
||||
UX
|
||||
Verdoolaege
|
||||
Vi
|
||||
Vi's
|
||||
WindowsNT
|
||||
ags
|
||||
al
|
||||
american
|
||||
api
|
||||
autowrite
|
||||
berkeley
|
||||
bitstring
|
||||
bitstring.h
|
||||
bostic
|
||||
bsd
|
||||
bugs.current
|
||||
ccil
|
||||
changelog
|
||||
cl
|
||||
clib
|
||||
cont
|
||||
cs
|
||||
cs.berkeley.edu
|
||||
cscope
|
||||
csh
|
||||
cshrc
|
||||
ctags
|
||||
darren
|
||||
db
|
||||
dbopen
|
||||
devel
|
||||
doc
|
||||
docs
|
||||
edu
|
||||
elvis
|
||||
email
|
||||
enum
|
||||
escapetime
|
||||
esr
|
||||
execl
|
||||
exrc
|
||||
exref
|
||||
fcntl
|
||||
filesystem
|
||||
free's
|
||||
ftp.cs.berkeley.edu
|
||||
gdb
|
||||
gdb.script
|
||||
gvr
|
||||
gz
|
||||
gzip'd
|
||||
hardtabs
|
||||
hiwaay
|
||||
html
|
||||
http
|
||||
ic
|
||||
iclower
|
||||
ignorecase
|
||||
il
|
||||
init
|
||||
init.tcl
|
||||
iso
|
||||
isprint
|
||||
kB
|
||||
keystrokes
|
||||
ksh
|
||||
lang
|
||||
ld
|
||||
lt
|
||||
lu
|
||||
mmap
|
||||
ncurses
|
||||
nex
|
||||
nexrc
|
||||
nul's
|
||||
nvi
|
||||
nvi's
|
||||
nvi.ALPHA.tar.gz
|
||||
nvi.tar.Z
|
||||
nvi.tar.gz
|
||||
openmode
|
||||
org
|
||||
perl
|
||||
preformatted
|
||||
ps
|
||||
queue.h
|
||||
readonly
|
||||
recover.script
|
||||
redistributable
|
||||
regex
|
||||
remapped
|
||||
setenv
|
||||
settable
|
||||
shiftwidth
|
||||
sirsi
|
||||
slowopen
|
||||
sourced
|
||||
struct
|
||||
sunsite
|
||||
svi
|
||||
tcl
|
||||
tclapi
|
||||
terminfo
|
||||
tk
|
||||
tknvi
|
||||
txt
|
||||
ucb
|
||||
unc
|
||||
uunet
|
||||
version's
|
||||
vi
|
||||
vi's
|
||||
vi.man
|
||||
vi.ref
|
||||
vi.ref.ps
|
||||
vi.ref.txt
|
||||
vitut
|
||||
writeable
|
||||
www
|
||||
xaw
|
||||
ynq
|
File diff suppressed because it is too large
Load Diff
@ -1,741 +0,0 @@
|
||||
Section 1: {^F} {ZZ}
|
||||
|
||||
To get out of this tutorial, type: ZZ (two capital Z's).
|
||||
|
||||
Learning a new computer system implies learning a new text editor. These
|
||||
tutorial lessons were created by Dain Samples to help you come to grips with
|
||||
UC Berkeley's screen oriented editor called vi (for VIsual). This tutorial
|
||||
uses the vi editor itself as the means of presentation.
|
||||
|
||||
For best use of this tutorial, read all of a screen before performing any of
|
||||
the indicated actions. This tutorial (or, at least, the first half of it) has
|
||||
been designed to systematically present the vi commands IF THE INSTRUCTIONS
|
||||
ARE FOLLOWED! If you are too adventuresome, you may find yourself lost. If
|
||||
you ever find yourself stuck, remember the first line of this section.
|
||||
|
||||
OK, now find the control key on your keyboard; it usually has CTL or CTRL
|
||||
written on its upper surface. Your first assignment is to hold the control
|
||||
key down while you press the 'F' key on your keyboard. Please do so now.
|
||||
|
||||
|
||||
|
||||
Section 2: {^F} {^B}
|
||||
Many of vi's commands use the control key and some other key in combination,
|
||||
as with the control and the 'F' key above. This is abbreviated CTL-F, or ^F.
|
||||
|
||||
As you have probably guessed by now, ^F (CTL-F) moves you forward a fixed
|
||||
number of lines in the file. Throughout the remainder of the tutorial when
|
||||
you are ready to advance to the next section of text, hit ^F.
|
||||
|
||||
The opposite command is ^B. Just for fun, you might want to try a ^B to see
|
||||
the previous section again. Be sure to do a ^F to return you here.
|
||||
|
||||
Determine what the cursor looks like on your screen. Whatever it is (a box,
|
||||
an underscore, blinking, flashing, inverse, etc.) it should now be positioned
|
||||
in the upper left-hand corner of your screen under or on the S of Section.
|
||||
Become familiar with your cursor: to use vi correctly it is important to
|
||||
always know where the cursor is.
|
||||
|
||||
Did you notice that when you do a ^F the cursor is left at the top of the
|
||||
screen, and a ^B leaves the cursor near the bottom of the screen? Try the two
|
||||
commands ^B^F again. And now do another ^F to see the next section.
|
||||
|
||||
Section 3: {^F} {^B}
|
||||
You now have two basic commands for examining a file, both forwards (^F) and
|
||||
backwards (^B).
|
||||
|
||||
Note that these are vi text editing commands: they are not commands for the
|
||||
tutorial. Indeed, this tutorial is nothing but a text file which you are now
|
||||
editing. Everything you do and learn in this tutorial will be applicable to
|
||||
editing text files.
|
||||
|
||||
Therefore, when you are editing a file and are ready to see more of the text,
|
||||
entering ^F will get you to the next section of the file. Entering ^B will
|
||||
show you the previous section.
|
||||
|
||||
Time for you to do another ^F.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Section 4: {^F} {^B} {^M} (return key)
|
||||
We will adopt the notation of putting commands in curly braces so we can write
|
||||
them unambiguously. For example, if you are to type the command sequence
|
||||
"control B control F" (as we asked you to do above) it would appear as {^B^F}.
|
||||
This allows clear delineation of the command strings from the text. Remember
|
||||
that the curly braces are NOT part of the command string you are to type. Do
|
||||
NOT type the curly braces.
|
||||
|
||||
Sometimes, the command string in the curly braces will be rather long, and may
|
||||
be such that the first couple of characters of the command will erase from
|
||||
the screen the string you are trying to read and type. It is suggested that
|
||||
you write down the longer commands BEFORE you type them so you won't forget
|
||||
them once they disappear.
|
||||
|
||||
Now locate the return key on your keyboard: it is usually marked 'RETURN',
|
||||
indicate hitting the return key. In fact, the control-M key sequence is
|
||||
exactly the same as if you hit the return key, and vice versa.
|
||||
|
||||
Now type {^F}.
|
||||
|
||||
|
||||
Section 5: {:q!} {ZZ} {^M} (return key)
|
||||
Recognize that this tutorial is nothing more than a text file that you
|
||||
are editing. This means that if you do something wrong, it is possible
|
||||
for you to destroy the information in this file. Don't worry. If this
|
||||
happens, type {ZZ} (two capital Z's) or {:q!^M} to leave the tutorial.
|
||||
Restart the tutorial. Once in the tutorial, you can then page forward
|
||||
with {^F} until you are back to where you want to be. (There are
|
||||
easier ways to do this, some of which will be discussed later, but this
|
||||
is the most straightforward.)
|
||||
|
||||
You may want to write these commands down in a convenient place for quick
|
||||
reference: {:q!^M} and {ZZ}
|
||||
|
||||
We will assume that you now know to do a {^F} to advance the file
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Section 6: {m} {G} {'} {z}
|
||||
Now that you know how to get around in the file via ^F and ^B let's look at
|
||||
other ways of examining a text file. Sometimes it is necessary, in the midst
|
||||
of editing a file, to examine another part of the file. You are then faced
|
||||
with the problem of remembering your place in the file, looking at the other
|
||||
text, and then getting back to your original location. Vi has a 'mark'
|
||||
command, m. Type {mp}. You have just 'marked' your current location in the
|
||||
file and given it the name 'p'. The command string below will do three
|
||||
things: position you at the beginning of the file (line 1), then return you to
|
||||
the location 'p' that you just marked with the 'm' command, and, since the
|
||||
screen will not look exactly the same as it does right now, the 'z' command
|
||||
will reposition the screen. (You may want to write the string down before
|
||||
typing it: once you type {1G} it will no longer be on the screen.)
|
||||
|
||||
So now type {1G'pz^M} - a one followed by a capital G, followed by the quote
|
||||
mark, followed by a lower case 'p', then a lower case 'z', then a return
|
||||
(which is the same as a ^M). The {1G} moves you to line 1, i.e. the beginning
|
||||
of the file. The {'p} moves you to the location you marked with {mp}. The
|
||||
{z^M} command will repaint the screen putting the cursor at the top of the
|
||||
screen. (Now {^F}.)
|
||||
|
||||
Section 7: {m} {G} {'} {z}
|
||||
Let's look at some variations on those commands. If you wanted to look at
|
||||
line 22 in the file and return to this location you could type {mp22G'p}. Do
|
||||
so now, observing that {22G} puts your cursor at the beginning of section 2 in
|
||||
the middle of the screen.
|
||||
|
||||
Also note that, without the {z^M} command, the line with 'Section 7' on it is
|
||||
now in the MIDDLE of the screen, and not at the top. Our cursor is on the
|
||||
correct line (where we did the {mp} command) but the line is not where we
|
||||
might like it to be on the screen. That is the function of the {z^M} command.
|
||||
(Remember, ^M is the same as the 'return' key on your keyboard.) Type {z^M}
|
||||
now and observe the effect.
|
||||
|
||||
As you can see, the 'Section 7' line is now at the top of the screen with the
|
||||
cursor happily under the capital S. If you would like the cursor line (i.e.
|
||||
the line which the cursor is on) in the middle of the screen again, you would
|
||||
type {z.}. If you wanted the cursor line to be at the BOTTOM of the screen,
|
||||
type {z-}. Try typing {z-z.z^M} and watch what happens.
|
||||
|
||||
{^F}
|
||||
|
||||
Section 8: {z} {m} {'}
|
||||
|
||||
Note that the z command does not change the position of our cursor in the file
|
||||
itself, it simply moves the cursor around on the screen by moving the contents
|
||||
of the file around on the screen. The cursor stays on the same line of the
|
||||
file when using the z command.
|
||||
|
||||
This brings up an important point. There are two questions that the users of
|
||||
vi continually need to know the answer to: "Where am I in the file?" and
|
||||
"Where am I on the screen?" The cursor on your terminal shows the answer to
|
||||
both questions. Some commands will move you around in the file, usually
|
||||
changing the location of the cursor on the screen as well. Other commands
|
||||
move the cursor around on the screen without changing your location in the
|
||||
file.
|
||||
|
||||
Now type {ma}. Your location in the file has been given the name 'a'. If you
|
||||
type {'p'a} you will see the previous location we marked in section 7, and
|
||||
then will be returned to the current location. (You will want to do a {z^M}
|
||||
to repaint the screen afterwards.) Try it.
|
||||
{^F}
|
||||
|
||||
Section 9: {m} {''}
|
||||
Now we can move about in our file pretty freely. By using the {m} command we
|
||||
can give the current cursor position a lower-case-character name, like 'p',
|
||||
'a', 'e', 'm', or 'b'. Using the {G} command preceded by a line number we can
|
||||
look at any line in the file we like. Using the single quote command {'}
|
||||
followed by a character used in an {m} command, we can return to any location
|
||||
in the file we have marked.
|
||||
|
||||
However, try {m3}, or {mM}. You should hear a beep, or bell. Only lower-case
|
||||
letters are acceptable to the {m} and {'} commands: numbers, upper-case
|
||||
letters, and special characters are not acceptable.
|
||||
|
||||
If you type the {'} command with a character that is lower-case alphabetic but
|
||||
that has not been used in an {m} command, or for which the 'marked' text has
|
||||
been deleted, you will also get a beep. Try {'i}. You should get a beep
|
||||
because the command {mi} has never been issued. (Unless you've been
|
||||
experimenting.)
|
||||
|
||||
The command {''} attempts to return you to the location at which you last
|
||||
modified some part of your file. However, my experience has been that it is
|
||||
difficult to predict exactly where you will end up.
|
||||
Section 10: {^M} {-}
|
||||
Now do {ma}, marking your position at the top of the screen. Now hit {^M} (or
|
||||
return) until the cursor is right ...
|
||||
* <- here, over/under the asterisk. Now
|
||||
type {mb'a'b} and watch the cursor move from the asterisk to the top of the
|
||||
screen and back again.
|
||||
|
||||
The {^M} command moves the cursor to the beginning of the next line. Now type
|
||||
{^M} until the cursor is right ...
|
||||
* <- here. The command to move the cursor to the beginning of the
|
||||
previous line is {-}. Practice moving the cursor around on the screen by using
|
||||
{^M} and {-}. BE CAREFUL to not move the cursor OFF the screen just yet. If
|
||||
you do, type {'az^M}.
|
||||
|
||||
Now we can move to any line within the screen. Practice moving around in the
|
||||
file using the {^F}, {^B}, {-}, {^M}, {z}, and {'} commands. When you are
|
||||
fairly confident that you can get to where you need to be in the file, and
|
||||
position the cursor on the screen where you want it type {'az^M^F} (which, of
|
||||
course, moves you back to the beginning of this section, repositions the
|
||||
cursor at the top of the screen, and advances you to the next section).
|
||||
|
||||
Section 11: scrolling: {^M}
|
||||
The cursor should now be on the S of 'Section 11', and this should be on the
|
||||
first line of the screen. If it is not, do {^M} or {-} as appropriate to put
|
||||
the cursor on the section line, and type {z^M}.
|
||||
|
||||
Type {mc} to mark your place.
|
||||
|
||||
Now type {^M} until the cursor is on the last line of this screen. Now do one
|
||||
more {^M} and observe the result. This is called scrolling. When you
|
||||
attempted to move to a line not displayed on the screen, the line at the top of
|
||||
the screen was 'scrolled off', and a line at the bottom of the screen was
|
||||
'scrolled on'. The top line with 'Section 11' should no longer be visible.
|
||||
|
||||
Now type {'cz^M} to reset the screen and type {^F} for the next section.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Section 12: {-} {z}
|
||||
|
||||
The {-} command moves the cursor to the previous line in the file. Now type
|
||||
{-}, which attempts to move the cursor to the previous line in this file.
|
||||
However, that line is not on the screen. The resulting action will depend on
|
||||
your terminal. (Do a {^Mz^M} to reposition the file). On intelligent
|
||||
terminals (e.g. VT100s, Z19s, Concept 100s), a top line is 'scrolled on' and
|
||||
the bottom line is 'scrolled off'. Other terminals, however, may not have
|
||||
this 'reverse scrolling' feature. They will simply repaint the screen with
|
||||
the cursor line in the middle of the screen. On such terminals it is
|
||||
necessary to type {z^M} to get the cursor line back to the top of the screen.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Section 13:
|
||||
Up until this point, the tutorial has always tried to make sure that the first
|
||||
line of each screen has on it the section number and a list of the commands
|
||||
covered in that section. This will no longer be strictly maintained. If you
|
||||
want the section line at the top of the screen, you now know enough commands to
|
||||
do it easily: do {^M} or {-} until the cursor is on the section line and
|
||||
then {z^M}. Also, from this point on, it may not be the case that a {^F} will
|
||||
put you at the beginning of the next section. Therefore, be aware of where you
|
||||
are in the file as we look at other commands. You may have to find your way
|
||||
back to a particular section without any help from the tutorial. If you do not
|
||||
feel comfortable with this, then it is suggested that you practice moving from
|
||||
section 1 to section 13, back and forth, using {^M}, {-}, {^F}, and {^B}
|
||||
commands for a while.
|
||||
|
||||
Also make liberal use of the mark command {m}: if, for example, you make a
|
||||
habit of using {mz} to mark your current location in the file, then you will
|
||||
always be able to return to that location with {'z} if the editor does
|
||||
something strange and you have no idea where you are or what happened.
|
||||
|
||||
And finally, the proscription against experimentation is hereby lifted: play
|
||||
with the editor. Feel free to try out variations on the commands and move
|
||||
around in the file. By this time you should be able to recover from any gross
|
||||
errors.
|
||||
|
||||
Section 14: {^E} {^Y} {^D} {^U}
|
||||
Let us now look at a few other commands for moving around in the file, and
|
||||
moving the file around on the screen. Note that the commands we have already
|
||||
looked at are sufficient: you really don't need any more commands for looking
|
||||
in a file. The following commands are not absolutely necessary. However,
|
||||
they can make editing more convenient, and you should take note of their
|
||||
existence. But it would be perfectly valid to decide to ignore them on this
|
||||
first pass: you can learn them later when you see a need for them, if you ever
|
||||
do.
|
||||
|
||||
First, let's clear up some potentially confusing language. In at least one
|
||||
place in the official document ('An Introduction to Display Editing with Vi'
|
||||
by William Joy, and Mark Horton, September 1980), the expression "to scroll
|
||||
down text" means that the cursor is moved down in your file. However, note
|
||||
that this may result in the text on the screen moving UP. This use of the
|
||||
word 'scroll' refers to the action of the cursor within the file. However,
|
||||
another legitimate use of the word refers to the action of the text on the
|
||||
screen. That is, if the lines on your screen move up toward the top of the
|
||||
screen, this would be 'scrolling the screen up'. If the lines move down
|
||||
toward the bottom of the screen, this would be refered to as scrolling down.
|
||||
|
||||
I have tried to maintain the following jargon: 'scrolling' refers to what the
|
||||
text does on the screen, not to what the cursor does within the file. For the
|
||||
latter I will refer to the cursor 'moving', or to 'moving the cursor'. I
|
||||
realize that this is not necessarily consistent with Joy and Horton, but they
|
||||
were wrong.
|
||||
|
||||
{^E} scrolls the whole screen up one line, keeping the cursor on the same line,
|
||||
if possible. However, if the cursor line is the first line on the screen, then
|
||||
the cursor is moved to the next line in the file. Try typing {^E}.
|
||||
|
||||
{^Y} scrolls the screen down one line, keeping the cursor on the same line, if
|
||||
possible. However, if the cursor line is the last line on the screen, then the
|
||||
cursor is moved to the previous line in the file. Try it.
|
||||
|
||||
{^D} moves the cursor down into the file, scrolling the screen up.
|
||||
|
||||
{^U} moves the cursor up into the file, also scrolling the screen if the
|
||||
terminal you are on has the reverse scroll capability. Otherwise the
|
||||
screen is repainted.
|
||||
|
||||
Note that {^E} and {^Y} move the cursor on the screen while trying to keep the
|
||||
cursor at the same place in the file (if possible: however, the cursor can
|
||||
never move off screen), while {^D} and {^U} keep the cursor at the same place
|
||||
on the screen while moving the cursor within the file.
|
||||
|
||||
Section 15: {/ .. /^M}
|
||||
|
||||
Another way to position yourself in the file is by giving the editor a string
|
||||
to search for. Type the following: {/Here 1/^M} and the cursor should end up
|
||||
right ...........................here ^. Now type {/Section 15:/^M} and the
|
||||
cursor will end up over/on .....................here ^. Now type {//^M} and
|
||||
observe that the cursor is now over the capital S five lines above this line.
|
||||
Typing {//^M} several more times will bounce the cursor back and forth between
|
||||
the two occurrences of the string. In other words, when you type a string
|
||||
between the two slashes, it is searched for. Typing the slashes with nothing
|
||||
between them acts as if you had typed the previous string again.
|
||||
|
||||
Observe that the string you type between the two slashes is entered on the
|
||||
bottom line of the screen. Now type {/Search for x /^M} except replace the 'x'
|
||||
in the string with some other character, say 'b'. The message "Pattern not
|
||||
found" should appear on the bottom of the screen. If you hadn't replaced the
|
||||
'x', then you would have found the string. Try it.
|
||||
|
||||
Section 16: {? .. ?^M} {n} (search strings: ^ $)
|
||||
|
||||
When you surround the sought-for string with slashes as in {/Search/}, the
|
||||
file is searched beginning from your current position in the file. If the
|
||||
string is not found by the end of the file, searching is restarted at the
|
||||
beginning of the file. However, if you do want the search to find the
|
||||
PREVIOUS rather than the NEXT occurrence of the string, surround the string
|
||||
with question marks instead of slash marks.
|
||||
|
||||
Below are several occurrences of the same string.
|
||||
Here 2 Here 2 Here 2
|
||||
Here 2 Here 2.
|
||||
Observe the effect of the following search commands (try them in the
|
||||
sequence shown):
|
||||
{/Here 2/^M} {//^M} {??^M}
|
||||
{/^Here 2/^M} {//^M} {??^M}
|
||||
{/Here 2$/^M} {//^M} {??^M}
|
||||
|
||||
The first command looks for the next occurrence of the string 'Here 2'.
|
||||
However the second line of commands looks for an occurrence of 'Here 2' that
|
||||
is at the beginning of the line. When the up-arrow is the first character of
|
||||
a search string it stands for the beginning of the line. When the dollar-sign
|
||||
is the last character of the search string it stands for the end of the line.
|
||||
Therefore, the third line of commands searches for the string only when it is
|
||||
at the end of the line. Since there is only one place the string begins a
|
||||
line, and only one place the string ends the line, subsequent {//^M} and
|
||||
{??^M} will find those same strings over and over.
|
||||
|
||||
The {n} command will find the next occurrence of the / or ? search
|
||||
string. Try {/Here 2/^M} followed by several {n} and observe the
|
||||
effect. Then try {??^M} followed by several {n}. The {n} command
|
||||
remembers the direction of the last search. It is just a way to save a
|
||||
few keystrokes.
|
||||
|
||||
Section 17: \ and magic-characters in search strings
|
||||
|
||||
Now type {/Here 3$/^M}. You might expect the cursor to end up
|
||||
right......^ here. However, you will get "Pattern not found" at the bottom of
|
||||
the screen. Remember that the dollar-sign stands for the end of the line.
|
||||
Somehow, you must tell vi that you do not want the end of the line, but a
|
||||
dollar-sign. In other words, you must take away the special meaning that the
|
||||
dollar-sign has for the search mechanism. You do this (for any special
|
||||
character, including the up-arrow ^) by putting a back-slash ('\', not '/') in
|
||||
front of the character.
|
||||
|
||||
Now try {/Here 3\$/^M} and you should end up nine lines above this one. Try
|
||||
{//^M} and note that it returns you to the same place, and not to the first
|
||||
line of this paragraph: the back-slash character is not part of the search
|
||||
string and will not be found. To find the string in the first line of this
|
||||
paragraph, type {/Here 3\\\$/^M}. There are three back-slashes: the first takes
|
||||
away the special meaning from the second, and the third takes away the special
|
||||
meaning from the dollar-sign.
|
||||
|
||||
Following is a list of the characters that have special meanings in search
|
||||
strings. If you wish to find a string containing one of these characters, you
|
||||
will have to be precede the character with a backslash. These characters are
|
||||
called magic characters because of the fun and games you can have with them
|
||||
and they can have with you, if you aren't aware of what they do.
|
||||
|
||||
^ - (up-arrow) beginning of a line
|
||||
$ - (dollar-sign) end of a line
|
||||
. - (period) matches any character
|
||||
\ - (backslant) the escape character itself
|
||||
[ - (square bracket) for finding patterns (see section #SEARCH)
|
||||
] - (square bracket) ditto
|
||||
* - (asterisk) ditto
|
||||
|
||||
Without trying to explain it here, note that {:set nomagic^M} turns off the
|
||||
special meanings of all but the ^ up-arrow, $ dollar-sign, and backslash
|
||||
characters.
|
||||
|
||||
Section 18: {: (colon commands)} {ZZ}
|
||||
|
||||
In this section we will discuss getting into and out of the editor in more
|
||||
detail. If you are editing a file and wish to save the results the command
|
||||
sequence {:w^M} writes the current contents of the file out to disk, using the
|
||||
file name you used when you invoked the editor. That is, if you are at the
|
||||
command level in Unix, and you invoke vi with {vi foo} where foo is the name
|
||||
of the file you wish to edit, then foo is the name of the file used by the
|
||||
{:w^M} command.
|
||||
|
||||
If you are done, the write and quit commands can be combined into a single
|
||||
command {:wq^M}. An even simpler way is the command {ZZ} (two capital Z's).
|
||||
|
||||
If, for some reason, you wish to exit without saving any changes you have made,
|
||||
{:q!^M} does the trick. If you have not made any changes, the exclamation
|
||||
point is not necessary: {:q^M}. Vi is pretty good about not letting you
|
||||
get out without warning you that you haven't saved your file.
|
||||
|
||||
We have mentioned before that you are currently in the vi editor, editing a
|
||||
file. If you wish to start the tutorial over from the very beginning, you
|
||||
could {ZZ}, and then type {vi.tut beginner} in response to the Unix prompt.
|
||||
This will create a fresh copy of this file for you, which might be necessary
|
||||
if you accidentally destroyed the copy you were working with. Just do a
|
||||
search for the last section you were in: e.g. {/Section 18:/^Mz^M}.
|
||||
|
||||
Section 19: {H} {M} {L}
|
||||
|
||||
Here are a few more commands that will move you around on the screen. Again,
|
||||
they are not absolutely necessary, but they can make screen positioning easier:
|
||||
|
||||
{H} - puts the cursor at the top of the screen (the 'home' position)
|
||||
|
||||
{M} - puts the cursor in the middle of the screen
|
||||
|
||||
{L} - puts the cursor at the bottom of the screen.
|
||||
|
||||
Try typing {HML} and watch the cursor.
|
||||
|
||||
Try typing {5HM5L} and note that 5H puts you five lines from the top of the
|
||||
screen, and 5L puts you five lines from the bottom of the screen.
|
||||
|
||||
Section 20: {w} {b} {0} {W} {B} {e} {E} {'} {`}
|
||||
|
||||
Up to this point we have concentrated on positioning in the file, and
|
||||
positioning on the screen. Now let's look at positioning in a line. Put the
|
||||
cursor at the beginning of the following line and type {z^M}:
|
||||
|
||||
This is a test line: your cursor should initially be at its beginning.
|
||||
|
||||
The test line should now be at the top of your screen. Type {w} several times.
|
||||
Note that it moves you forward to the beginning of the next word. Now type
|
||||
{b} (back to the beginning of the word) several times till you are at the
|
||||
beginning of the line. (If you accidentally type too many {b}, type {w} until
|
||||
you are on the beginning of the line again.) Type {wwwww} (five w's) and note
|
||||
that the cursor is now on the colon in the sentence. The lower-case w command
|
||||
moves you forward one word, paying attention to certain characters such as
|
||||
colon and period as delimiters and counting them as words themselves. Now
|
||||
type {0} (zero, not o 'oh'): this moves you to the beginning of the current
|
||||
line. Now type {5w} and notice that this has the effect of repeating {w} five
|
||||
times and that you are now back on the colon. Type {0} (zero) again. To
|
||||
ignore the delimiters and to move to the beginning of the next word using only
|
||||
blanks, tabs and carriage-returns (these are called white-space characters) to
|
||||
delimit the words, use the {W} command: upper-case W. {B} takes you back a
|
||||
word using white-space characters as word delimiters.
|
||||
|
||||
Note that the commands {wbWB} do not stop at the beginning or end of a line:
|
||||
they will continue to the next word on the next line in the direction specified
|
||||
(a blank line counts as a word).
|
||||
|
||||
If you are interested in the END of the word, and not the BEGINNING, then use
|
||||
the {e} and {E} commands. These commands only move forward and there are no
|
||||
corresponding 'reverse search' commands for the end of a word.
|
||||
|
||||
Also, we have been using the {'} command to move the cursor to a position that
|
||||
we have previously marked with the {m} command. However, position the cursor
|
||||
in the middle of a line (any line, just pick one) and type {mk}, marking that
|
||||
position with the letter k. Now type a few returns {^M} and type {'k}.
|
||||
Observe that the cursor is now at the beginning of the line that you marked.
|
||||
Now try {`k}: note that this is the reverse apostrophe, or back-quote, or grave
|
||||
accent, or whatever you want to call it. Also note that it moves you to the
|
||||
character that was marked, not just to the line that was marked.
|
||||
|
||||
In addition, the {``} command works just like the {''} command except that you
|
||||
are taken to the exact character, not just to the line. (I'm still not
|
||||
sure which exact character, just as I'm still not sure which line.)
|
||||
|
||||
Section 21: {l} {k} {j} {h}
|
||||
|
||||
There are several commands to move around on the screen on a character by
|
||||
character basis:
|
||||
|
||||
l - moves the cursor one character to the RIGHT
|
||||
k - moves the cursor UP one line
|
||||
j - moves the cursor DOWN one line
|
||||
h - moves the cursor one character to the LEFT
|
||||
|
||||
Section 22: {i} {a} {I} {A} {o} {O} ^[ (escape key)
|
||||
|
||||
For this and following sections you will need to use the ESCAPE key on your
|
||||
terminal. It is usually marked ESC. Since the escape key is the same as
|
||||
typing {^[} we will use ^[ for the escape key.
|
||||
|
||||
Probably the most often used command in an editor is the insert command. Below
|
||||
are two lines of text, the first correct, the second incorrect. Position your
|
||||
cursor at the beginning of Line 1 and type {z^M}.
|
||||
|
||||
Line 1: This is an example of the insert command.
|
||||
Line 2: This is an of the insert command.
|
||||
|
||||
To make line 2 look like line 1, we are going to insert the characters
|
||||
'example ' before the word 'of'. So, now move the cursor so that it is
|
||||
positioned on the 'o' of 'of'. (You can do this by typing {^M} to move
|
||||
to the beginning of line 2, followed by {6w} or {wwwwww} to position the cursor
|
||||
on the word 'of'.)
|
||||
|
||||
Now carefully type the following string and observe the effects:
|
||||
{iexample ^[} (remember: ^[ is the escape key)}
|
||||
The {i} begins the insert mode, and 'example ' is inserted into the line:
|
||||
be sure to notice the blank in 'example '. The ^[ ends insertion mode,
|
||||
and the line is updated to include the new string. Line 1 should look exactly
|
||||
like Line 2.
|
||||
|
||||
Move the cursor to the beginning of Line 3 below and type {z^M}:
|
||||
|
||||
Line 3: These lines are examples for the 'a' command.
|
||||
Line 4: These line are examples for the '
|
||||
|
||||
We will change line four to look like line three by using the append command.
|
||||
We need to append an 's' to the word 'line'. Position the cursor on the 'e'
|
||||
of 'line'. You can do this in several ways, one way is the following:
|
||||
First, type {/line /^M}. This puts us on the word 'line' in Line 4
|
||||
(the blank in the search string is important!). Next, type {e}. The 'e' puts
|
||||
us at the end of the word. Now, type {as^[ (^[ is the escape character)}.
|
||||
The 'a' puts us in insert mode, AFTER the current character. We appended the
|
||||
's', and the escape ^[ ended the insert mode.
|
||||
|
||||
The difference between {i} (insert) and {a} (append) is that {i} begins
|
||||
inserting text BEFORE the cursor, and {a} begins inserting AFTER the cursor.
|
||||
|
||||
Now type {Aa' command.^[}. The cursor is moved to the end of the line and the
|
||||
string following {A} is inserted into the text. Line 4 should now look like
|
||||
line 3.
|
||||
|
||||
Just as {A} moves you to the end of the line to begin inserting, {I} would
|
||||
begin inserting at the FRONT of the line.
|
||||
|
||||
To begin the insertion of a line after the cursor line, type {o}. To insert a
|
||||
line before the cursor line, type {O}. In other words {o123^[} is equivalent
|
||||
to {A^M123^[}, and {O123^[} is equivalent to {I123^M^[}. The text after the
|
||||
{o} or {O} is ended with an escape ^[.
|
||||
|
||||
This paragraph contains information that is terminal dependent: you will just
|
||||
have to experiment to discover what your terminal does. Once in the insert
|
||||
mode, if you make a mistake in the typing, ^H will delete the previous
|
||||
character up to the beginning of the current insertion. ^W will delete the
|
||||
previous word, and one of ^U, @, or ^X will delete the current line (up to the
|
||||
beginning of the current insertion). You will need to experiment with ^U, @,
|
||||
and ^X to determine which works for your terminal.
|
||||
|
||||
Section 23: {f} {x} {X} {w} {l} {r} {R} {s} {S} {J}
|
||||
|
||||
Position the cursor at the beginning of line 5 and {z^M}:
|
||||
|
||||
Line 5: The line as it should be.
|
||||
Line 6: The line as it shouldn't be.
|
||||
|
||||
To make Line 6 like Line 5, we have to delete the 'n', the apostrophe, and the
|
||||
't'. There are several ways to position ourselves at the 'n'. Choose
|
||||
whichever one suits your fancy:
|
||||
|
||||
{/n't/^M}
|
||||
{^M7w6l} or {^M7w6 } (note the space)
|
||||
{^M3fn} (finds the 3rd 'n' on the line)
|
||||
|
||||
Now {xxx} will delete the three characters, as will {3x}.
|
||||
|
||||
Note that {X} deletes the character just BEFORE the cursor, as opposed
|
||||
to the character AT the cursor.
|
||||
|
||||
Position the cursor at line 7 and {z^M}:
|
||||
|
||||
Line 7: The line as it would be.
|
||||
Line 8: The line as it could be.
|
||||
|
||||
To change line 8 into line 7 we need to change the 'c' in 'could' into a 'w'.
|
||||
The 'r' (replace) command was designed for this. Typing {rc} is the same as
|
||||
typing {xic^[} (i.e. delete the 'bad' character and insert the correct
|
||||
new character). Therefore, assuming that you have positioned the cursor on the
|
||||
'c' of 'could', the easiest way to change 'could' into 'would' is {rw}.
|
||||
|
||||
If you would like to now change the 'would' into 'should', use the substitute
|
||||
command, 's': {ssh^[}. The difference between 'r' and 's' is that 'r'
|
||||
(replace) replaces the current character with another character, while 's'
|
||||
(substitute) substitutes the current character with a string, ended with an
|
||||
escape.
|
||||
|
||||
The capital letter version of replace {R} replaces each character by a
|
||||
character one at a time until you type an escape, ^[. The 'S' command
|
||||
substitutes the whole line.
|
||||
|
||||
Position your cursor at the beginning of line 9 and {z^M}.
|
||||
|
||||
Line 9: Love is a many splendored thing.
|
||||
Line 10: Love is a most splendored thing.
|
||||
|
||||
To change line 10 into line 9, position the cursor at the beginning of 'most',
|
||||
and type {Rmany^[}.
|
||||
|
||||
You may have noticed that, when inserting text, a new line is formed by typing
|
||||
{^M}. When changing, replacing, or substituting text you can make a new line
|
||||
by typing {^M}. However, neither {x} nor {X} will remove ^M to make two lines
|
||||
into one line. To do this, position the cursor on the first of the two lines
|
||||
you wish to make into a single line and type {J} (uppercase J for 'Join').
|
||||
|
||||
Section 24: {u} {U}
|
||||
|
||||
Finally, before we review, let's look at the undo command. Position
|
||||
your cursor on line 11 below and {z^M}.
|
||||
|
||||
Line 11: The quick brown fox jumped over the lazy hound dog.
|
||||
Line 12: the qwick black dog dumped over the laxy poune fox.
|
||||
|
||||
Type the following set of commands, and observe carefully the effect of each
|
||||
of the commands:
|
||||
|
||||
{/^Line 12:/^M} {ft} {rT} {fw} {ru} {w} {Rbrown fox^[} {w} {rj}
|
||||
{fx} {rz} {w} {Rhound dog^[}
|
||||
|
||||
Line 12 now matches line 11. Now type {U} - capital 'U'. And line 12 now
|
||||
looks like it did before you typed in the command strings. Now type:
|
||||
|
||||
{ft} {rT} {fw} {ru} {^M} {^M}
|
||||
|
||||
and then type {u}: the cursor jumps back to the line containing the second
|
||||
change you made and 'undoes' it. That is, {U} 'undoes' all the changes on the
|
||||
line, and {u} 'undoes' only the last change. Type {u} several times and
|
||||
observe what happens: {u} can undo a previous {u}!
|
||||
|
||||
Caveat: {U} only works as long as the cursor is still on the line. Move the
|
||||
cursor off the line and {U} will have no effect, except to possibly beep at
|
||||
you. However, {u} will undo the last change, no matter where it occurred.
|
||||
|
||||
Section 25: review
|
||||
|
||||
At this point, you have all the commands you need in order to make use of vi.
|
||||
The remainder of this tutorial will discuss variations on these commands as
|
||||
well as introduce new commands that make the job of editing more efficient.
|
||||
Here is a brief review of the basic commands we have covered. They are listed
|
||||
in the order of increasing complexity and/or decreasing necessity (to say that
|
||||
a command is less necessary is not to say that it is less useful!). These
|
||||
commands allow you to comfortably edit any text file. There are other
|
||||
commands that will make life easier but will require extra time to learn,
|
||||
obviously. You may want to consider setting this tutorial aside for several
|
||||
weeks and returning to it later after gaining experience with vi and getting
|
||||
comfortable with it. The convenience of some of the more exotic commands may
|
||||
then be apparent and worth the extra investment of time and effort
|
||||
required to master them.
|
||||
|
||||
to get into the editor from Unix: {vi filename}
|
||||
to exit the editor
|
||||
saving all changes {ZZ} or {:wq^M}
|
||||
throwing away all changes {:q!^M}
|
||||
when no changes have been made {:q^M}
|
||||
save a file without exiting the editor {:w^M}
|
||||
write the file into another file {:w filename^M}
|
||||
insert text
|
||||
before the cursor {i ...text... ^[}
|
||||
at the beginning of the line {I ...text... ^[}
|
||||
after the cursor (append) {a ...text... ^[}
|
||||
at the end of the line {A ...text... ^[}
|
||||
after the current line {o ...text... ^[}
|
||||
before the current line {O ...text... ^[}
|
||||
delete the character ...
|
||||
under the cursor {x}
|
||||
to the left of the cursor {X}
|
||||
delete n characters {nx} or {nX} (for n a number)
|
||||
make two lines into one line (Join) {J}
|
||||
find a string in the file ...
|
||||
searching forward {/ ...string... /^M}
|
||||
searching backwards {? ...string... ?^M}
|
||||
repeat the last search command {n}
|
||||
repeat the last search command in the
|
||||
opposite direction {N}
|
||||
find the character c on this line ...
|
||||
searching forward {fc}
|
||||
searching backward {Fc}
|
||||
repeat the last 'find character' command {;}
|
||||
replace a character with character x {rx}
|
||||
substitute a single character with text {s ...text... ^[}
|
||||
substitute n characters with text {ns ...text... ^[}
|
||||
replace characters one-by-one with text {R ...text... ^[}
|
||||
undo all changes to the current line {U}
|
||||
undo the last single change {u}
|
||||
move forward in the file a "screenful" {^F}
|
||||
move back in the file a "screenful" {^B}
|
||||
move forward in the file one line {^M} or {+}
|
||||
move backward in the file one line {-}
|
||||
move to the beginning of the line {0}
|
||||
move to the end of the line {$}
|
||||
move forward one word {w}
|
||||
move forward one word, ignoring punctuation {W}
|
||||
move forward to the end of the next word {e}
|
||||
to the end of the word, ignoring punctuation{E}
|
||||
move backward one word {b}
|
||||
move back one word, ignoring punctuation {B}
|
||||
return to the last line modified {''}
|
||||
scroll a line onto the top of the screen {^Y}
|
||||
scroll a line onto the bottom of the screen {^E}
|
||||
move "up" in the file a half-screen {^U}
|
||||
move "down" in the file a half-screen {^D}
|
||||
move the cursor to the top screen line {H}
|
||||
move the cursor to the bottom screen line {L}
|
||||
move the cursor to the middle line {M}
|
||||
move LEFT one character position {h} or {^H}
|
||||
move RIGHT one character position {l} or { }
|
||||
move UP in the same column {k} or {^P}
|
||||
move DOWN in the same column {j} or {^N}
|
||||
mark the current position, name it x {mx}
|
||||
move to the line marked/named x {'x}
|
||||
move to the character position named x {`x}
|
||||
move to the beginning of the file {1G}
|
||||
move to the end of the file {G}
|
||||
move to line 23 in the file {23G}
|
||||
repaint the screen with the cursor line
|
||||
at the top of the screen {z^M}
|
||||
in the middle of the screen {z.}
|
||||
at the bottom of the screen {z-}
|
||||
|
||||
More information on vi can be found in the file vi.advanced, which you can
|
||||
peruse at your leisure. From UNIX, type {vi.tut advanced^M}.
|
@ -1,24 +0,0 @@
|
||||
#!/bin/csh -f
|
||||
#
|
||||
# This makes the user's EXINIT variable set to the 'correct' things.
|
||||
# I don't know what will happen if they also have a .exrc file!
|
||||
#
|
||||
# XXX
|
||||
# Make sure that user is using a 24 line window!!!
|
||||
#
|
||||
if ($1 != "beginner" && $1 != "advanced") then
|
||||
echo Usage: $0 beginner or $0 advanced
|
||||
exit
|
||||
endif
|
||||
|
||||
if ($?EXINIT) then
|
||||
set oexinit="$EXINIT"
|
||||
setenv EXINIT 'se ts=4 wm=8 sw=4'
|
||||
endif
|
||||
|
||||
vi vi.{$1}
|
||||
|
||||
onintr:
|
||||
if ($?oexinit) then
|
||||
setenv EXINIT "$oexinit"
|
||||
endif
|
30
ex/ex.c
30
ex/ex.c
@ -31,20 +31,20 @@ static const char sccsid[] = "$Id: ex.c,v 10.80 2012/10/03 16:24:40 zy Exp $";
|
||||
#include "../vi/vi.h"
|
||||
|
||||
#if defined(DEBUG) && defined(COMLOG)
|
||||
static void ex_comlog __P((SCR *, EXCMD *));
|
||||
static void ex_comlog(SCR *, EXCMD *);
|
||||
#endif
|
||||
static EXCMDLIST const *
|
||||
ex_comm_search __P((CHAR_T *, size_t));
|
||||
static int ex_discard __P((SCR *));
|
||||
static int ex_line __P((SCR *, EXCMD *, MARK *, int *, int *));
|
||||
static int ex_load __P((SCR *));
|
||||
static void ex_unknown __P((SCR *, CHAR_T *, size_t));
|
||||
ex_comm_search(CHAR_T *, size_t);
|
||||
static int ex_discard(SCR *);
|
||||
static int ex_line(SCR *, EXCMD *, MARK *, int *, int *);
|
||||
static int ex_load(SCR *);
|
||||
static void ex_unknown(SCR *, CHAR_T *, size_t);
|
||||
|
||||
/*
|
||||
* ex --
|
||||
* Main ex loop.
|
||||
*
|
||||
* PUBLIC: int ex __P((SCR **));
|
||||
* PUBLIC: int ex(SCR **);
|
||||
*/
|
||||
int
|
||||
ex(SCR **spp)
|
||||
@ -187,7 +187,7 @@ ex(SCR **spp)
|
||||
*
|
||||
* For extra credit, try them in a startup .exrc file.
|
||||
*
|
||||
* PUBLIC: int ex_cmd __P((SCR *));
|
||||
* PUBLIC: int ex_cmd(SCR *);
|
||||
*/
|
||||
int
|
||||
ex_cmd(SCR *sp)
|
||||
@ -1616,7 +1616,7 @@ rsuccess: tmp = 0;
|
||||
* ex_range --
|
||||
* Get a line range for ex commands, or perform a vi ex address search.
|
||||
*
|
||||
* PUBLIC: int ex_range __P((SCR *, EXCMD *, int *));
|
||||
* PUBLIC: int ex_range(SCR *, EXCMD *, int *);
|
||||
*/
|
||||
int
|
||||
ex_range(SCR *sp, EXCMD *ecp, int *errp)
|
||||
@ -1689,12 +1689,12 @@ ex_range(SCR *sp, EXCMD *ecp, int *errp)
|
||||
++ecp->cp;
|
||||
--ecp->clen;
|
||||
break;
|
||||
case ',': /* Comma delimiter. */
|
||||
case ',': /* Comma delimiter. */
|
||||
/* Vi ex address searches didn't permit commas. */
|
||||
if (F_ISSET(ecp, E_VISEARCH))
|
||||
goto ret;
|
||||
/* FALLTHROUGH */
|
||||
case ';': /* Semi-colon delimiter. */
|
||||
case ';': /* Semi-colon delimiter. */
|
||||
if (sp->ep == NULL) {
|
||||
ex_badaddr(sp, NULL, A_EMPTY, NUM_OK);
|
||||
*errp = 1;
|
||||
@ -1825,7 +1825,7 @@ ex_line(SCR *sp, EXCMD *ecp, MARK *mp, int *isaddrp, int *errp)
|
||||
GS *gp;
|
||||
long total, val;
|
||||
int isneg;
|
||||
int (*sf) __P((SCR *, MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int));
|
||||
int (*sf)(SCR *, MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int);
|
||||
CHAR_T *endp;
|
||||
|
||||
gp = sp->gp;
|
||||
@ -2219,7 +2219,7 @@ ex_unknown(SCR *sp, CHAR_T *cmd, size_t len)
|
||||
* [un]abbreviate command, so it can turn off abbreviations. See
|
||||
* the usual ranting in the vi/v_txt_ev.c:txt_abbrev() routine.
|
||||
*
|
||||
* PUBLIC: int ex_is_abbrev __P((CHAR_T *, size_t));
|
||||
* PUBLIC: int ex_is_abbrev(CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
ex_is_abbrev(CHAR_T *name, size_t len)
|
||||
@ -2236,7 +2236,7 @@ ex_is_abbrev(CHAR_T *name, size_t len)
|
||||
* unmap command, so it can turn off input mapping. See the usual
|
||||
* ranting in the vi/v_txt_ev.c:txt_unmap() routine.
|
||||
*
|
||||
* PUBLIC: int ex_is_unmap __P((CHAR_T *, size_t));
|
||||
* PUBLIC: int ex_is_unmap(CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
ex_is_unmap(CHAR_T *name, size_t len)
|
||||
@ -2279,7 +2279,7 @@ ex_comm_search(CHAR_T *name, size_t len)
|
||||
* Display a bad address message.
|
||||
*
|
||||
* PUBLIC: void ex_badaddr
|
||||
* PUBLIC: __P((SCR *, EXCMDLIST const *, enum badaddr, enum nresult));
|
||||
* PUBLIC: (SCR *, EXCMDLIST const *, enum badaddr, enum nresult);
|
||||
*/
|
||||
void
|
||||
ex_badaddr(SCR *sp, const EXCMDLIST *cp, enum badaddr ba, enum nresult nret)
|
||||
|
4
ex/ex.h
4
ex/ex.h
@ -13,7 +13,7 @@
|
||||
|
||||
typedef struct _excmdlist { /* Ex command table structure. */
|
||||
CHAR_T *name; /* Command name, underlying function. */
|
||||
int (*fn) __P((SCR *, EXCMD *));
|
||||
int (*fn)(SCR *, EXCMD *);
|
||||
|
||||
#define E_ADDR1 0x00000001 /* One address. */
|
||||
#define E_ADDR2 0x00000002 /* Two addresses. */
|
||||
@ -222,7 +222,7 @@ typedef enum {
|
||||
/* Ex address error types. */
|
||||
enum badaddr { A_COMBO, A_EMPTY, A_EOF, A_NOTSET, A_ZERO };
|
||||
|
||||
/* Ex common tag error messages. */
|
||||
/* Ex common tag error messages. */
|
||||
typedef enum {
|
||||
TAG_BADLNO, /* Tag line doesn't exist. */
|
||||
TAG_EMPTY, /* Tags stack is empty. */
|
||||
|
@ -31,7 +31,7 @@ static const char sccsid[] = "$Id: ex_abbrev.c,v 10.10 2001/12/16 18:18:54 skimo
|
||||
* ex_abbr -- :abbreviate [key replacement]
|
||||
* Create an abbreviation or display abbreviations.
|
||||
*
|
||||
* PUBLIC: int ex_abbr __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_abbr(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_abbr(SCR *sp, EXCMD *cmdp)
|
||||
@ -95,7 +95,7 @@ ex_abbr(SCR *sp, EXCMD *cmdp)
|
||||
* ex_unabbr -- :unabbreviate key
|
||||
* Delete an abbreviation.
|
||||
*
|
||||
* PUBLIC: int ex_unabbr __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_unabbr(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_unabbr(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -27,14 +27,14 @@ static const char sccsid[] = "$Id: ex_append.c,v 10.34 2001/06/25 15:19:14 skimo
|
||||
|
||||
enum which {APPEND, CHANGE, INSERT};
|
||||
|
||||
static int ex_aci __P((SCR *, EXCMD *, enum which));
|
||||
static int ex_aci(SCR *, EXCMD *, enum which);
|
||||
|
||||
/*
|
||||
* ex_append -- :[line] a[ppend][!]
|
||||
* Append one or more lines of new text after the specified line,
|
||||
* or the current line if no address is specified.
|
||||
*
|
||||
* PUBLIC: int ex_append __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_append(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_append(SCR *sp, EXCMD *cmdp)
|
||||
@ -46,7 +46,7 @@ ex_append(SCR *sp, EXCMD *cmdp)
|
||||
* ex_change -- :[line[,line]] c[hange][!] [count]
|
||||
* Change one or more lines to the input text.
|
||||
*
|
||||
* PUBLIC: int ex_change __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_change(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_change(SCR *sp, EXCMD *cmdp)
|
||||
@ -59,7 +59,7 @@ ex_change(SCR *sp, EXCMD *cmdp)
|
||||
* Insert one or more lines of new text before the specified line,
|
||||
* or the current line if no address is specified.
|
||||
*
|
||||
* PUBLIC: int ex_insert __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_insert(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_insert(SCR *sp, EXCMD *cmdp)
|
||||
|
12
ex/ex_args.c
12
ex/ex_args.c
@ -27,7 +27,7 @@ static const char sccsid[] = "$Id: ex_args.c,v 10.19 2011/12/16 16:18:10 zy Exp
|
||||
#include "../common/common.h"
|
||||
#include "../vi/vi.h"
|
||||
|
||||
static int ex_N_next __P((SCR *, EXCMD *));
|
||||
static int ex_N_next(SCR *, EXCMD *);
|
||||
|
||||
/*
|
||||
* ex_next -- :next [+cmd] [files]
|
||||
@ -39,7 +39,7 @@ static int ex_N_next __P((SCR *, EXCMD *));
|
||||
* idea was that it ignored the force flag if the autowrite flag was
|
||||
* set. This implementation handles them all identically.
|
||||
*
|
||||
* PUBLIC: int ex_next __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_next(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_next(SCR *sp, EXCMD *cmdp)
|
||||
@ -171,7 +171,7 @@ ex_N_next(SCR *sp, EXCMD *cmdp)
|
||||
* ex_prev -- :prev
|
||||
* Edit the previous file.
|
||||
*
|
||||
* PUBLIC: int ex_prev __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_prev(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_prev(SCR *sp, EXCMD *cmdp)
|
||||
@ -220,7 +220,7 @@ ex_prev(SCR *sp, EXCMD *cmdp)
|
||||
* anyone noticing, but if they do, we'll have to put information into the SCR
|
||||
* structure so we can keep track of it.
|
||||
*
|
||||
* PUBLIC: int ex_rew __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_rew(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_rew(SCR *sp, EXCMD *cmdp)
|
||||
@ -258,7 +258,7 @@ ex_rew(SCR *sp, EXCMD *cmdp)
|
||||
* ex_args -- :args
|
||||
* Display the list of files.
|
||||
*
|
||||
* PUBLIC: int ex_args __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_args(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_args(SCR *sp, EXCMD *cmdp)
|
||||
@ -299,7 +299,7 @@ ex_args(SCR *sp, EXCMD *cmdp)
|
||||
* ex_buildargv --
|
||||
* Build a new file argument list.
|
||||
*
|
||||
* PUBLIC: char **ex_buildargv __P((SCR *, EXCMD *, char *));
|
||||
* PUBLIC: char **ex_buildargv(SCR *, EXCMD *, char *);
|
||||
*/
|
||||
char **
|
||||
ex_buildargv(SCR *sp, EXCMD *cmdp, char *name)
|
||||
|
32
ex/ex_argv.c
32
ex/ex_argv.c
@ -30,18 +30,18 @@ static const char sccsid[] = "$Id: ex_argv.c,v 11.2 2012/10/09 23:00:29 zy Exp $
|
||||
|
||||
#include "../common/common.h"
|
||||
|
||||
static int argv_alloc __P((SCR *, size_t));
|
||||
static int argv_comp __P((const void *, const void *));
|
||||
static int argv_fexp __P((SCR *, EXCMD *,
|
||||
CHAR_T *, size_t, CHAR_T *, size_t *, CHAR_T **, size_t *, int));
|
||||
static int argv_sexp __P((SCR *, CHAR_T **, size_t *, size_t *));
|
||||
static int argv_flt_user __P((SCR *, EXCMD *, CHAR_T *, size_t));
|
||||
static int argv_alloc(SCR *, size_t);
|
||||
static int argv_comp(const void *, const void *);
|
||||
static int argv_fexp(SCR *, EXCMD *,
|
||||
CHAR_T *, size_t, CHAR_T *, size_t *, CHAR_T **, size_t *, int);
|
||||
static int argv_sexp(SCR *, CHAR_T **, size_t *, size_t *);
|
||||
static int argv_flt_user(SCR *, EXCMD *, CHAR_T *, size_t);
|
||||
|
||||
/*
|
||||
* argv_init --
|
||||
* Build a prototype arguments list.
|
||||
*
|
||||
* PUBLIC: int argv_init __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int argv_init(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
argv_init(SCR *sp, EXCMD *excp)
|
||||
@ -61,7 +61,7 @@ argv_init(SCR *sp, EXCMD *excp)
|
||||
* argv_exp0 --
|
||||
* Append a string to the argument list.
|
||||
*
|
||||
* PUBLIC: int argv_exp0 __P((SCR *, EXCMD *, CHAR_T *, size_t));
|
||||
* PUBLIC: int argv_exp0(SCR *, EXCMD *, CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
argv_exp0(SCR *sp, EXCMD *excp, CHAR_T *cmd, size_t cmdlen)
|
||||
@ -84,7 +84,7 @@ argv_exp0(SCR *sp, EXCMD *excp, CHAR_T *cmd, size_t cmdlen)
|
||||
* Do file name expansion on a string, and append it to the
|
||||
* argument list.
|
||||
*
|
||||
* PUBLIC: int argv_exp1 __P((SCR *, EXCMD *, CHAR_T *, size_t, int));
|
||||
* PUBLIC: int argv_exp1(SCR *, EXCMD *, CHAR_T *, size_t, int);
|
||||
*/
|
||||
int
|
||||
argv_exp1(SCR *sp, EXCMD *excp, CHAR_T *cmd, size_t cmdlen, int is_bang)
|
||||
@ -123,7 +123,7 @@ ret: FREE_SPACEW(sp, bp, blen);
|
||||
* Do file name and shell expansion on a string, and append it to
|
||||
* the argument list.
|
||||
*
|
||||
* PUBLIC: int argv_exp2 __P((SCR *, EXCMD *, CHAR_T *, size_t));
|
||||
* PUBLIC: int argv_exp2(SCR *, EXCMD *, CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
argv_exp2(SCR *sp, EXCMD *excp, CHAR_T *cmd, size_t cmdlen)
|
||||
@ -209,7 +209,7 @@ err: FREE_SPACEW(sp, bp, blen);
|
||||
* Take a string and break it up into an argv, which is appended
|
||||
* to the argument list.
|
||||
*
|
||||
* PUBLIC: int argv_exp3 __P((SCR *, EXCMD *, CHAR_T *, size_t));
|
||||
* PUBLIC: int argv_exp3(SCR *, EXCMD *, CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
argv_exp3(SCR *sp, EXCMD *excp, CHAR_T *cmd, size_t cmdlen)
|
||||
@ -277,7 +277,7 @@ argv_exp3(SCR *sp, EXCMD *excp, CHAR_T *cmd, size_t cmdlen)
|
||||
* Filter the ex commands with a prefix, and append the results to
|
||||
* the argument list.
|
||||
*
|
||||
* PUBLIC: int argv_flt_ex __P((SCR *, EXCMD *, CHAR_T *, size_t));
|
||||
* PUBLIC: int argv_flt_ex(SCR *, EXCMD *, CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
argv_flt_ex(SCR *sp, EXCMD *excp, CHAR_T *cmd, size_t cmdlen)
|
||||
@ -520,7 +520,7 @@ mem: msgq(sp, M_SYSERR, NULL);
|
||||
* argv_free --
|
||||
* Free up argument structures.
|
||||
*
|
||||
* PUBLIC: int argv_free __P((SCR *));
|
||||
* PUBLIC: int argv_free(SCR *);
|
||||
*/
|
||||
int
|
||||
argv_free(SCR *sp)
|
||||
@ -550,7 +550,7 @@ argv_free(SCR *sp)
|
||||
* Find all file names matching the prefix and append them to the
|
||||
* argument list.
|
||||
*
|
||||
* PUBLIC: int argv_flt_path __P((SCR *, EXCMD *, CHAR_T *, size_t));
|
||||
* PUBLIC: int argv_flt_path(SCR *, EXCMD *, CHAR_T *, size_t);
|
||||
*/
|
||||
int
|
||||
argv_flt_path(SCR *sp, EXCMD *excp, CHAR_T *path, size_t plen)
|
||||
@ -812,7 +812,7 @@ alloc_err: rval = SEXP_ERR;
|
||||
* argv_esc --
|
||||
* Escape a string into an ex and shell argument.
|
||||
*
|
||||
* PUBLIC: CHAR_T *argv_esc __P((SCR *, EXCMD *, CHAR_T *, size_t));
|
||||
* PUBLIC: CHAR_T *argv_esc(SCR *, EXCMD *, CHAR_T *, size_t);
|
||||
*/
|
||||
CHAR_T *
|
||||
argv_esc(SCR *sp, EXCMD *excp, CHAR_T *str, size_t len)
|
||||
@ -875,7 +875,7 @@ argv_esc(SCR *sp, EXCMD *excp, CHAR_T *str, size_t len)
|
||||
* argv_uesc --
|
||||
* Unescape an escaped ex and shell argument.
|
||||
*
|
||||
* PUBLIC: CHAR_T *argv_uesc __P((SCR *, EXCMD *, CHAR_T *, size_t));
|
||||
* PUBLIC: CHAR_T *argv_uesc(SCR *, EXCMD *, CHAR_T *, size_t);
|
||||
*/
|
||||
CHAR_T *
|
||||
argv_uesc(SCR *sp, EXCMD *excp, CHAR_T *str, size_t len)
|
||||
|
@ -32,7 +32,7 @@ static const char sccsid[] = "$Id: ex_at.c,v 10.16 2001/06/25 15:19:14 skimo Exp
|
||||
*
|
||||
* Execute the contents of the buffer.
|
||||
*
|
||||
* PUBLIC: int ex_at __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_at(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_at(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -44,7 +44,7 @@ static const char sccsid[] = "$Id: ex_bang.c,v 10.36 2001/06/25 15:19:14 skimo E
|
||||
* ways of getting here display the right things. It took a long time to
|
||||
* get it right (wrong?), so be careful.
|
||||
*
|
||||
* PUBLIC: int ex_bang __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_bang(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_bang(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -31,7 +31,7 @@ static const char sccsid[] = "$Id: ex_cd.c,v 10.13 2012/04/12 06:28:27 zy Exp $"
|
||||
* ex_cd -- :cd[!] [directory]
|
||||
* Change directories.
|
||||
*
|
||||
* PUBLIC: int ex_cd __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_cd(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_cd(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -61,15 +61,15 @@ find c|d|e|f|g|i|s|t buffer|pattern\n\
|
||||
s: find all uses of name\n\
|
||||
t: find assignments to name"
|
||||
|
||||
static int cscope_add __P((SCR *, EXCMD *, CHAR_T *));
|
||||
static int cscope_find __P((SCR *, EXCMD*, CHAR_T *));
|
||||
static int cscope_help __P((SCR *, EXCMD *, CHAR_T *));
|
||||
static int cscope_kill __P((SCR *, EXCMD *, CHAR_T *));
|
||||
static int cscope_reset __P((SCR *, EXCMD *, CHAR_T *));
|
||||
static int cscope_add(SCR *, EXCMD *, CHAR_T *);
|
||||
static int cscope_find(SCR *, EXCMD*, CHAR_T *);
|
||||
static int cscope_help(SCR *, EXCMD *, CHAR_T *);
|
||||
static int cscope_kill(SCR *, EXCMD *, CHAR_T *);
|
||||
static int cscope_reset(SCR *, EXCMD *, CHAR_T *);
|
||||
|
||||
typedef struct _cc {
|
||||
char *name;
|
||||
int (*function) __P((SCR *, EXCMD *, CHAR_T *));
|
||||
int (*function)(SCR *, EXCMD *, CHAR_T *);
|
||||
char *help_msg;
|
||||
char *usage_msg;
|
||||
} CC;
|
||||
@ -88,23 +88,23 @@ static CC const cscope_cmds[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static TAGQ *create_cs_cmd __P((SCR *, char *, size_t *));
|
||||
static int csc_help __P((SCR *, char *));
|
||||
static void csc_file __P((SCR *,
|
||||
CSC *, char *, char **, size_t *, int *));
|
||||
static int get_paths __P((SCR *, CSC *));
|
||||
static CC const *lookup_ccmd __P((char *));
|
||||
static int parse __P((SCR *, CSC *, TAGQ *, int *));
|
||||
static int read_prompt __P((SCR *, CSC *));
|
||||
static int run_cscope __P((SCR *, CSC *, char *));
|
||||
static int start_cscopes __P((SCR *, EXCMD *));
|
||||
static int terminate __P((SCR *, CSC *, int));
|
||||
static TAGQ *create_cs_cmd(SCR *, char *, size_t *);
|
||||
static int csc_help(SCR *, char *);
|
||||
static void csc_file(SCR *,
|
||||
CSC *, char *, char **, size_t *, int *);
|
||||
static int get_paths(SCR *, CSC *);
|
||||
static CC const *lookup_ccmd(char *);
|
||||
static int parse(SCR *, CSC *, TAGQ *, int *);
|
||||
static int read_prompt(SCR *, CSC *);
|
||||
static int run_cscope(SCR *, CSC *, char *);
|
||||
static int start_cscopes(SCR *, EXCMD *);
|
||||
static int terminate(SCR *, CSC *, int);
|
||||
|
||||
/*
|
||||
* ex_cscope --
|
||||
* Perform an ex cscope.
|
||||
*
|
||||
* PUBLIC: int ex_cscope __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_cscope(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_cscope(SCR *sp, EXCMD *cmdp)
|
||||
@ -861,7 +861,7 @@ csc_help(SCR *sp, char *cmd)
|
||||
return (1);
|
||||
} else {
|
||||
ex_printf(sp,
|
||||
"Command: %s (%s)\n", ccp->name, ccp->help_msg);
|
||||
"Command: %s (%s)\n", ccp->name, ccp->help_msg);
|
||||
ex_printf(sp, " Usage: %s\n", ccp->usage_msg);
|
||||
return (0);
|
||||
}
|
||||
@ -965,7 +965,7 @@ cscope_reset(SCR *sp, EXCMD *cmdp, CHAR_T *notusedp)
|
||||
* cscope_end --
|
||||
* End all cscope connections.
|
||||
*
|
||||
* PUBLIC: int cscope_end __P((SCR *));
|
||||
* PUBLIC: int cscope_end(SCR *);
|
||||
*/
|
||||
int
|
||||
cscope_end(SCR *sp)
|
||||
@ -982,7 +982,7 @@ cscope_end(SCR *sp)
|
||||
* cscope_display --
|
||||
* Display current connections.
|
||||
*
|
||||
* PUBLIC: int cscope_display __P((SCR *));
|
||||
* PUBLIC: int cscope_display(SCR *);
|
||||
*/
|
||||
int
|
||||
cscope_display(SCR *sp)
|
||||
@ -1006,7 +1006,7 @@ cscope_display(SCR *sp)
|
||||
* cscope_search --
|
||||
* Search a file for a cscope entry.
|
||||
*
|
||||
* PUBLIC: int cscope_search __P((SCR *, TAGQ *, TAG *));
|
||||
* PUBLIC: int cscope_search(SCR *, TAGQ *, TAG *);
|
||||
*/
|
||||
int
|
||||
cscope_search(SCR *sp, TAGQ *tqp, TAG *tp)
|
||||
|
@ -28,7 +28,7 @@ static const char sccsid[] = "$Id: ex_delete.c,v 10.11 2001/06/25 15:19:15 skimo
|
||||
*
|
||||
* Delete lines from the file.
|
||||
*
|
||||
* PUBLIC: int ex_delete __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_delete(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_delete(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -26,16 +26,16 @@ static const char sccsid[] = "$Id: ex_display.c,v 10.15 2001/06/25 15:19:15 skim
|
||||
#include "../common/common.h"
|
||||
#include "tag.h"
|
||||
|
||||
static int is_prefix __P((ARGS *, CHAR_T *));
|
||||
static int bdisplay __P((SCR *));
|
||||
static void db __P((SCR *, CB *, const char *));
|
||||
static int is_prefix(ARGS *, CHAR_T *);
|
||||
static int bdisplay(SCR *);
|
||||
static void db(SCR *, CB *, const char *);
|
||||
|
||||
/*
|
||||
* ex_display -- :display b[uffers] | c[onnections] | s[creens] | t[ags]
|
||||
*
|
||||
* Display cscope connections, buffers, tags or screens.
|
||||
*
|
||||
* PUBLIC: int ex_display __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_display(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_display(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -27,7 +27,7 @@ static const char sccsid[] = "$Id: ex_edit.c,v 10.15 2011/12/22 23:26:50 zy Exp
|
||||
#include "../common/common.h"
|
||||
#include "../vi/vi.h"
|
||||
|
||||
static int ex_N_edit __P((SCR *, EXCMD *, FREF *, int));
|
||||
static int ex_N_edit(SCR *, EXCMD *, FREF *, int);
|
||||
|
||||
/*
|
||||
* ex_edit -- :e[dit][!] [+cmd] [file]
|
||||
@ -43,7 +43,7 @@ static int ex_N_edit __P((SCR *, EXCMD *, FREF *, int));
|
||||
* a file name as well. This seems unreasonable, so we support it
|
||||
* regardless.
|
||||
*
|
||||
* PUBLIC: int ex_edit __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_edit(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_edit(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -26,7 +26,7 @@ static const char sccsid[] = "$Id: ex_equal.c,v 10.12 2001/06/25 15:19:15 skimo
|
||||
/*
|
||||
* ex_equal -- :address =
|
||||
*
|
||||
* PUBLIC: int ex_equal __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_equal(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_equal(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -30,7 +30,7 @@ static const char sccsid[] = "$Id: ex_file.c,v 10.14 2001/06/25 15:19:16 skimo E
|
||||
* ex_file -- :f[ile] [name]
|
||||
* Change the file's name and display the status line.
|
||||
*
|
||||
* PUBLIC: int ex_file __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_file(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_file(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -27,7 +27,7 @@ static const char sccsid[] = "$Id: ex_filter.c,v 10.44 2003/11/05 17:11:54 skimo
|
||||
|
||||
#include "../common/common.h"
|
||||
|
||||
static int filter_ldisplay __P((SCR *, FILE *));
|
||||
static int filter_ldisplay(SCR *, FILE *);
|
||||
|
||||
/*
|
||||
* ex_filter --
|
||||
@ -35,8 +35,8 @@ static int filter_ldisplay __P((SCR *, FILE *));
|
||||
* replace the original text with the stdout/stderr output of
|
||||
* the utility.
|
||||
*
|
||||
* PUBLIC: int ex_filter __P((SCR *,
|
||||
* PUBLIC: EXCMD *, MARK *, MARK *, MARK *, CHAR_T *, enum filtertype));
|
||||
* PUBLIC: int ex_filter(SCR *,
|
||||
* PUBLIC: EXCMD *, MARK *, MARK *, MARK *, CHAR_T *, enum filtertype);
|
||||
*/
|
||||
int
|
||||
ex_filter(SCR *sp, EXCMD *cmdp, MARK *fm, MARK *tm, MARK *rp, CHAR_T *cmd, enum filtertype ftype)
|
||||
|
@ -30,13 +30,13 @@ static const char sccsid[] = "$Id: ex_global.c,v 10.32 2011/12/26 23:37:01 zy Ex
|
||||
|
||||
enum which {GLOBAL, V};
|
||||
|
||||
static int ex_g_setup __P((SCR *, EXCMD *, enum which));
|
||||
static int ex_g_setup(SCR *, EXCMD *, enum which);
|
||||
|
||||
/*
|
||||
* ex_global -- [line [,line]] g[lobal][!] /pattern/ [commands]
|
||||
* Exec on lines matching a pattern.
|
||||
*
|
||||
* PUBLIC: int ex_global __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_global(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_global(SCR *sp, EXCMD *cmdp)
|
||||
@ -49,7 +49,7 @@ ex_global(SCR *sp, EXCMD *cmdp)
|
||||
* ex_v -- [line [,line]] v /pattern/ [commands]
|
||||
* Exec on lines not matching a pattern.
|
||||
*
|
||||
* PUBLIC: int ex_v __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_v(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_v(SCR *sp, EXCMD *cmdp)
|
||||
@ -248,7 +248,7 @@ usage: ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
|
||||
* ex_g_insdel --
|
||||
* Update the ranges based on an insertion or deletion.
|
||||
*
|
||||
* PUBLIC: int ex_g_insdel __P((SCR *, lnop_t, recno_t));
|
||||
* PUBLIC: int ex_g_insdel(SCR *, lnop_t, recno_t);
|
||||
*/
|
||||
int
|
||||
ex_g_insdel(SCR *sp, lnop_t op, recno_t lno)
|
||||
|
14
ex/ex_init.c
14
ex/ex_init.c
@ -30,15 +30,15 @@ static const char sccsid[] = "$Id: ex_init.c,v 10.33 2012/04/11 19:12:34 zy Exp
|
||||
#include "pathnames.h"
|
||||
|
||||
enum rc { NOEXIST, NOPERM, RCOK };
|
||||
static enum rc exrc_isok __P((SCR *, struct stat *, char *, int, int));
|
||||
static enum rc exrc_isok(SCR *, struct stat *, char *, int, int);
|
||||
|
||||
static int ex_run_file __P((SCR *, char *));
|
||||
static int ex_run_file(SCR *, char *);
|
||||
|
||||
/*
|
||||
* ex_screen_copy --
|
||||
* Copy ex screen.
|
||||
*
|
||||
* PUBLIC: int ex_screen_copy __P((SCR *, SCR *));
|
||||
* PUBLIC: int ex_screen_copy(SCR *, SCR *);
|
||||
*/
|
||||
int
|
||||
ex_screen_copy(SCR *orig, SCR *sp)
|
||||
@ -74,7 +74,7 @@ ex_screen_copy(SCR *orig, SCR *sp)
|
||||
* ex_screen_end --
|
||||
* End a vi screen.
|
||||
*
|
||||
* PUBLIC: int ex_screen_end __P((SCR *));
|
||||
* PUBLIC: int ex_screen_end(SCR *);
|
||||
*/
|
||||
int
|
||||
ex_screen_end(SCR *sp)
|
||||
@ -120,7 +120,7 @@ ex_screen_end(SCR *sp)
|
||||
* ex_optchange --
|
||||
* Handle change of options for ex.
|
||||
*
|
||||
* PUBLIC: int ex_optchange __P((SCR *, int, char *, u_long *));
|
||||
* PUBLIC: int ex_optchange(SCR *, int, char *, u_long *);
|
||||
*/
|
||||
int
|
||||
ex_optchange(SCR *sp, int offset, char *str, u_long *valp)
|
||||
@ -137,7 +137,7 @@ ex_optchange(SCR *sp, int offset, char *str, u_long *valp)
|
||||
* Read the EXINIT environment variable and the startup exrc files,
|
||||
* and execute their commands.
|
||||
*
|
||||
* PUBLIC: int ex_exrc __P((SCR *));
|
||||
* PUBLIC: int ex_exrc(SCR *);
|
||||
*/
|
||||
int
|
||||
ex_exrc(SCR *sp)
|
||||
@ -281,7 +281,7 @@ ex_run_file(SCR *sp, char *name)
|
||||
* ex_run_str --
|
||||
* Set up a string of ex commands to run.
|
||||
*
|
||||
* PUBLIC: int ex_run_str __P((SCR *, char *, CHAR_T *, size_t, int, int));
|
||||
* PUBLIC: int ex_run_str(SCR *, char *, CHAR_T *, size_t, int, int);
|
||||
*/
|
||||
int
|
||||
ex_run_str(SCR *sp, char *name, CHAR_T *str, size_t len, int ex_flags, int nocopy)
|
||||
|
@ -30,7 +30,7 @@ static const char sccsid[] = "$Id: ex_join.c,v 10.17 2004/03/16 14:14:04 skimo E
|
||||
* ex_join -- :[line [,line]] j[oin][!] [count] [flags]
|
||||
* Join lines.
|
||||
*
|
||||
* PUBLIC: int ex_join __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_join(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_join(SCR *sp, EXCMD *cmdp)
|
||||
@ -62,7 +62,7 @@ ex_join(SCR *sp, EXCMD *cmdp)
|
||||
++cmdp->addr2.lno;
|
||||
|
||||
clen = tlen = 0;
|
||||
for (first = 1,
|
||||
for (first = 1,
|
||||
from = cmdp->addr1.lno, to = cmdp->addr2.lno; from <= to; ++from) {
|
||||
/*
|
||||
* Get next line. Historic versions of vi allowed "10J" while
|
||||
@ -154,7 +154,7 @@ ex_join(SCR *sp, EXCMD *cmdp)
|
||||
sp->lno = cmdp->addr1.lno;
|
||||
|
||||
/* Delete the joined lines. */
|
||||
for (from = cmdp->addr1.lno, to = cmdp->addr2.lno; to > from; --to)
|
||||
for (from = cmdp->addr1.lno, to = cmdp->addr2.lno; to > from; --to)
|
||||
if (db_delete(sp, to))
|
||||
goto err;
|
||||
|
||||
|
@ -40,7 +40,7 @@ static const char sccsid[] = "$Id: ex_map.c,v 10.11 2001/06/25 15:19:17 skimo Ex
|
||||
* put the map in a .exrc file, things would often work much better.
|
||||
* No clue why.
|
||||
*
|
||||
* PUBLIC: int ex_map __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_map(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_map(SCR *sp, EXCMD *cmdp)
|
||||
@ -103,7 +103,7 @@ nofunc: if (stype == SEQ_COMMAND && input[1] == '\0')
|
||||
* ex_unmap -- (:unmap[!] key)
|
||||
* Unmap a key.
|
||||
*
|
||||
* PUBLIC: int ex_unmap __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_unmap(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_unmap(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -29,7 +29,7 @@ static const char sccsid[] = "$Id: ex_mark.c,v 10.9 2001/06/25 15:19:17 skimo Ex
|
||||
* Mark lines.
|
||||
*
|
||||
*
|
||||
* PUBLIC: int ex_mark __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_mark(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_mark(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -34,7 +34,7 @@ static const char sccsid[] = "$Id: ex_mkexrc.c,v 10.13 2001/06/25 15:19:17 skimo
|
||||
*
|
||||
* Create (or overwrite) a .exrc file with the current info.
|
||||
*
|
||||
* PUBLIC: int ex_mkexrc __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_mkexrc(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_mkexrc(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -29,7 +29,7 @@ static const char sccsid[] = "$Id: ex_move.c,v 10.16 2012/02/11 15:52:33 zy Exp
|
||||
* ex_copy -- :[line [,line]] co[py] line [flags]
|
||||
* Copy selected lines.
|
||||
*
|
||||
* PUBLIC: int ex_copy __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_copy(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_copy(SCR *sp, EXCMD *cmdp)
|
||||
@ -81,7 +81,7 @@ err: text_lfree(cb.textq);
|
||||
* ex_move -- :[line [,line]] mo[ve] line
|
||||
* Move selected lines.
|
||||
*
|
||||
* PUBLIC: int ex_move __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_move(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_move(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -28,7 +28,7 @@ static const char sccsid[] = "$Id: ex_open.c,v 10.8 2001/06/25 15:19:17 skimo Ex
|
||||
*
|
||||
* Switch to single line "open" mode.
|
||||
*
|
||||
* PUBLIC: int ex_open __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_open(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_open(SCR *sp, EXCMD *cmdp)
|
||||
|
@ -29,7 +29,7 @@ static const char sccsid[] = "$Id: ex_preserve.c,v 10.15 2001/06/25 15:19:18 ski
|
||||
* ex_preserve -- :pre[serve]
|
||||
* Push the file to recovery.
|
||||
*
|
||||
* PUBLIC: int ex_preserve __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_preserve(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_preserve(SCR *sp, EXCMD *cmdp)
|
||||
@ -63,7 +63,7 @@ ex_preserve(SCR *sp, EXCMD *cmdp)
|
||||
* ex_recover -- :rec[over][!] file
|
||||
* Recover the file.
|
||||
*
|
||||
* PUBLIC: int ex_recover __P((SCR *, EXCMD *));
|
||||
* PUBLIC: int ex_recover(SCR *, EXCMD *);
|
||||
*/
|
||||
int
|
||||
ex_recover(SCR *sp, EXCMD *cmdp)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user