003 File Manager
Current Path:
/usr/src/contrib/nvi/ex
usr
/
src
/
contrib
/
nvi
/
ex
/
📁
..
📄
ex.awk
(115 B)
📄
ex.c
(61.91 KB)
📄
ex.h
(8.63 KB)
📄
ex_abbrev.c
(2.63 KB)
📄
ex_append.c
(7.05 KB)
📄
ex_args.c
(7.03 KB)
📄
ex_argv.c
(20.06 KB)
📄
ex_at.c
(3.14 KB)
📄
ex_bang.c
(5.25 KB)
📄
ex_cd.c
(2.84 KB)
📄
ex_cmd.c
(11.69 KB)
📄
ex_cscope.c
(24.32 KB)
📄
ex_def.h
(1.4 KB)
📄
ex_delete.c
(1.3 KB)
📄
ex_display.c
(2.71 KB)
📄
ex_edit.c
(3.5 KB)
📄
ex_equal.c
(1.17 KB)
📄
ex_file.c
(1.56 KB)
📄
ex_filter.c
(8.38 KB)
📄
ex_global.c
(7.17 KB)
📄
ex_init.c
(9.93 KB)
📄
ex_join.c
(4.36 KB)
📄
ex_map.c
(3.01 KB)
📄
ex_mark.c
(787 B)
📄
ex_mkexrc.c
(1.96 KB)
📄
ex_move.c
(4.16 KB)
📄
ex_open.c
(867 B)
📄
ex_preserve.c
(1.92 KB)
📄
ex_print.c
(6.43 KB)
📄
ex_put.c
(880 B)
📄
ex_quit.c
(801 B)
📄
ex_read.c
(8 KB)
📄
ex_screen.c
(2.22 KB)
📄
ex_script.c
(12.76 KB)
📄
ex_set.c
(737 B)
📄
ex_shell.c
(4.95 KB)
📄
ex_shift.c
(4.59 KB)
📄
ex_source.c
(2.01 KB)
📄
ex_stop.c
(928 B)
📄
ex_subst.c
(34.22 KB)
📄
ex_tag.c
(28.84 KB)
📄
ex_txt.c
(10.91 KB)
📄
ex_undo.c
(1.33 KB)
📄
ex_usage.c
(4.15 KB)
📄
ex_util.c
(4.18 KB)
📄
ex_version.c
(721 B)
📄
ex_visual.c
(3.68 KB)
📄
ex_write.c
(8 KB)
📄
ex_yank.c
(882 B)
📄
ex_z.c
(3.56 KB)
📄
extern.h
(4.37 KB)
📄
script.h
(588 B)
📄
tag.h
(3.09 KB)
📄
version.h
(40 B)
Editing: ex_usage.c
/*- * Copyright (c) 1992, 1993, 1994 * The Regents of the University of California. All rights reserved. * Copyright (c) 1992, 1993, 1994, 1995, 1996 * Keith Bostic. All rights reserved. * * See the LICENSE file for redistribution information. */ #include "config.h" #include <sys/types.h> #include <sys/queue.h> #include <sys/time.h> #include <bitstring.h> #include <ctype.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "../common/common.h" #include "../vi/vi.h" /* * ex_help -- :help * Display help message. * * PUBLIC: int ex_help(SCR *, EXCMD *); */ int ex_help(SCR *sp, EXCMD *cmdp) { (void)ex_puts(sp, "To see the list of vi commands, enter \":viusage<CR>\"\n"); (void)ex_puts(sp, "To see the list of ex commands, enter \":exusage<CR>\"\n"); (void)ex_puts(sp, "For an ex command usage statement enter \":exusage [cmd]<CR>\"\n"); (void)ex_puts(sp, "For a vi key usage statement enter \":viusage [key]<CR>\"\n"); (void)ex_puts(sp, "To exit, enter \":q!\"\n"); return (0); } /* * ex_usage -- :exusage [cmd] * Display ex usage strings. * * PUBLIC: int ex_usage(SCR *, EXCMD *); */ int ex_usage(SCR *sp, EXCMD *cmdp) { ARGS *ap; EXCMDLIST const *cp; int newscreen; CHAR_T *name, *p, nb[MAXCMDNAMELEN + 5]; switch (cmdp->argc) { case 1: ap = cmdp->argv[0]; if (ISUPPER(ap->bp[0])) { newscreen = 1; ap->bp[0] = TOLOWER(ap->bp[0]); } else newscreen = 0; for (cp = cmds; cp->name != NULL && MEMCMP(ap->bp, cp->name, ap->len); ++cp); if (cp->name == NULL || (newscreen && !F_ISSET(cp, E_NEWSCREEN))) { if (newscreen) ap->bp[0] = TOUPPER(ap->bp[0]); (void)ex_printf(sp, "The "WVS" command is unknown\n", (int)ap->len, ap->bp); } else { (void)ex_printf(sp, "Command: %s\n Usage: %s\n", cp->help, cp->usage); /* * !!! * The "visual" command has two modes, one from ex, * one from the vi colon line. Don't ask. */ if (cp != &cmds[C_VISUAL_EX] && cp != &cmds[C_VISUAL_VI]) break; if (cp == &cmds[C_VISUAL_EX]) cp = &cmds[C_VISUAL_VI]; else cp = &cmds[C_VISUAL_EX]; (void)ex_printf(sp, "Command: %s\n Usage: %s\n", cp->help, cp->usage); } break; case 0: for (cp = cmds; cp->name != NULL && !INTERRUPTED(sp); ++cp) { /* * The ^D command has an unprintable name. * * XXX * We display both capital and lower-case versions of * the appropriate commands -- no need to add in extra * room, they're all short names. */ if (cp == &cmds[C_SCROLL]) name = L("^D"); else if (F_ISSET(cp, E_NEWSCREEN)) { nb[0] = '['; nb[1] = TOUPPER(cp->name[0]); nb[2] = cp->name[0]; nb[3] = ']'; for (name = cp->name + 1, p = nb + 4; (*p++ = *name++) != '\0';); name = nb; } else name = cp->name; (void)ex_printf(sp, WVS": %s\n", MAXCMDNAMELEN, name, cp->help); } break; default: abort(); } return (0); } /* * ex_viusage -- :viusage [key] * Display vi usage strings. * * PUBLIC: int ex_viusage(SCR *, EXCMD *); */ int ex_viusage(SCR *sp, EXCMD *cmdp) { GS *gp; VIKEYS const *kp; int key; gp = sp->gp; switch (cmdp->argc) { case 1: if (cmdp->argv[0]->len != 1) { ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE); return (1); } key = cmdp->argv[0]->bp[0]; if (key > MAXVIKEY) goto nokey; /* Special case: '[' and ']' commands. */ if ((key == '[' || key == ']') && cmdp->argv[0]->bp[1] != key) goto nokey; /* Special case: ~ command. */ if (key == '~' && O_ISSET(sp, O_TILDEOP)) kp = &tmotion; else kp = &vikeys[key]; if (kp->usage == NULL) nokey: (void)ex_printf(sp, "The %s key has no current meaning\n", KEY_NAME(sp, key)); else (void)ex_printf(sp, " Key:%s%s\nUsage: %s\n", isblank((u_char)*kp->help) ? "" : " ", kp->help, kp->usage); break; case 0: for (key = 0; key <= MAXVIKEY && !INTERRUPTED(sp); ++key) { /* Special case: ~ command. */ if (key == '~' && O_ISSET(sp, O_TILDEOP)) kp = &tmotion; else kp = &vikeys[key]; if (kp->help != NULL) (void)ex_printf(sp, "%s\n", kp->help); } break; default: abort(); } return (0); }
Upload File
Create Folder