Annotation of 43BSDReno/usr.bin/window/lcmd.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1983 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * This code is derived from software contributed to Berkeley by
                      6:  * Edward Wang at The University of California, Berkeley.
                      7:  *
                      8:  * Redistribution and use in source and binary forms are permitted provided
                      9:  * that: (1) source distributions retain this entire copyright notice and
                     10:  * comment, and (2) distributions including binaries display the following
                     11:  * acknowledgement:  ``This product includes software developed by the
                     12:  * University of California, Berkeley and its contributors'' in the
                     13:  * documentation or other materials provided with the distribution and in
                     14:  * all advertising materials mentioning features or use of this software.
                     15:  * Neither the name of the University nor the names of its contributors may
                     16:  * be used to endorse or promote products derived from this software without
                     17:  * specific prior written permission.
                     18:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     19:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     20:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     21:  */
                     22: 
                     23: #ifndef lint
                     24: static char sccsid[] = "@(#)lcmd.c     3.34 (Berkeley) 6/6/90";
                     25: #endif /* not lint */
                     26: 
                     27: #include "defs.h"
                     28: #include "value.h"
                     29: #include "lcmd.h"
                     30: 
                     31: int l_alias();
                     32: int l_close();
                     33: int l_cursormodes();
                     34: int l_debug();
                     35: int l_def_nline();
                     36: int l_def_shell();
                     37: int l_def_smooth();
                     38: int l_echo();
                     39: int l_escape();
                     40: int l_foreground();
                     41: int l_iostat();
                     42: int l_label();
                     43: int l_list();
                     44: int l_select();
                     45: int l_smooth();
                     46: int l_source();
                     47: int l_terse();
                     48: int l_time();
                     49: int l_unalias();
                     50: int l_unset();
                     51: int l_variable();
                     52: int l_window();
                     53: int l_write();
                     54: 
                     55: extern struct lcmd_arg arg_alias[];
                     56: extern struct lcmd_arg arg_cursormodes[];
                     57: extern struct lcmd_arg arg_debug[];
                     58: extern struct lcmd_arg arg_echo[];
                     59: extern struct lcmd_arg arg_escape[];
                     60: extern struct lcmd_arg arg_foreground[];
                     61: extern struct lcmd_arg arg_label[];
                     62: extern struct lcmd_arg arg_def_nline[];
                     63: extern struct lcmd_arg arg_def_shell[];
                     64: extern struct lcmd_arg arg_def_smooth[];
                     65: extern struct lcmd_arg arg_close[];
                     66: extern struct lcmd_arg arg_select[];
                     67: extern struct lcmd_arg arg_smooth[];
                     68: extern struct lcmd_arg arg_source[];
                     69: extern struct lcmd_arg arg_terse[];
                     70: extern struct lcmd_arg arg_time[];
                     71: extern struct lcmd_arg arg_unalias[];
                     72: extern struct lcmd_arg arg_unset[];
                     73: extern struct lcmd_arg arg_window[];
                     74: extern struct lcmd_arg arg_write[];
                     75: struct lcmd_arg arg_null[1] = { { 0 } };
                     76: 
                     77: struct lcmd_tab lcmd_tab[] = {
                     78:        "alias",                1,      l_alias,        arg_alias,
                     79:        "close",                2,      l_close,        arg_close,
                     80:        "cursormodes",          2,      l_cursormodes,  arg_cursormodes,
                     81:        "debug",                1,      l_debug,        arg_debug,
                     82:        "default_nlines",       9,      l_def_nline,    arg_def_nline,
                     83:        "default_shell",        10,     l_def_shell,    arg_def_shell,
                     84:        "default_smooth",       10,     l_def_smooth,   arg_def_smooth,
                     85:        "echo",                 2,      l_echo,         arg_echo,
                     86:        "escape",               2,      l_escape,       arg_escape,
                     87:        "foreground",           1,      l_foreground,   arg_foreground,
                     88:        "iostat",               1,      l_iostat,       arg_null,
                     89:        "label",                2,      l_label,        arg_label,
                     90:        "list",                 2,      l_list,         arg_null,
                     91:        "nlines",               1,      l_def_nline,    arg_def_nline,
                     92:        "select",               2,      l_select,       arg_select,
                     93:        "shell",                2,      l_def_shell,    arg_def_shell,
                     94:        "smooth",               2,      l_smooth,       arg_smooth,
                     95:        "source",               2,      l_source,       arg_source,
                     96:        "terse",                2,      l_terse,        arg_terse,
                     97:        "time",                 2,      l_time,         arg_time,
                     98:        "unalias",              3,      l_unalias,      arg_unalias,
                     99:        "unset",                3,      l_unset,        arg_unset,
                    100:        "variable",             1,      l_variable,     arg_null,
                    101:        "window",               2,      l_window,       arg_window,
                    102:        "write",                2,      l_write,        arg_write,
                    103:        0
                    104: };
                    105: 
                    106: struct lcmd_tab *
                    107: lcmd_lookup(name)
                    108: char *name;
                    109: {
                    110:        register struct lcmd_tab *p;
                    111: 
                    112:        for (p = lcmd_tab; p->lc_name != 0; p++)
                    113:                if (str_match(name, p->lc_name, p->lc_minlen))
                    114:                        return p;
                    115:        return 0;
                    116: }
                    117: 
                    118: dosource(filename)
                    119: char *filename;
                    120: {
                    121:        if (cx_beginfile(filename) < 0)
                    122:                return -1;
                    123:        p_start();
                    124:        err_end();
                    125:        cx_end();
                    126:        return 0;
                    127: }
                    128: 
                    129: dolongcmd(buffer, arg, narg)
                    130: char *buffer;
                    131: struct value *arg;
                    132: int narg;
                    133: {
                    134:        if (cx_beginbuf(buffer, arg, narg) < 0)
                    135:                return -1;
                    136:        p_start();
                    137:        err_end();
                    138:        cx_end();
                    139:        return 0;
                    140: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.