Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sup/source Remove unused ci.c.
details: https://anonhg.NetBSD.org/src/rev/4e08f8a43544
branches: trunk
changeset: 533896:4e08f8a43544
user: wiz <wiz%NetBSD.org@localhost>
date: Wed Jul 10 18:55:34 2002 +0000
description:
Remove unused ci.c.
diffstat:
usr.sbin/sup/source/ci.c | 848 ----------------------------------------
usr.sbin/sup/source/supextern.h | 7 +-
2 files changed, 1 insertions(+), 854 deletions(-)
diffs (truncated from 872 to 300 lines):
diff -r e37ccfbb0201 -r 4e08f8a43544 usr.sbin/sup/source/ci.c
--- a/usr.sbin/sup/source/ci.c Wed Jul 10 18:55:20 2002 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,848 +0,0 @@
-/* $NetBSD: ci.c,v 1.4 2001/06/19 12:59:18 wiz Exp $ */
-/*
- * Copyright (c) 1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution%CS.CMU.EDU@localhost
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the rights
- * to redistribute these changes.
- */
-/* ci -- command interpreter
- *
- * Usage (etc.)
- *
- * HISTORY
- * 22-Nov-85 Glenn Marcy (gm0w) at Carnegie-Mellon University
- * Removed checks for VIRTUE window manager. If they don't like
- * it then they can fix the more program.
- *
- * 08-May-85 Steven Shafer (sas) at Carnegie-Mellon University
- * Increased MAXENTRIES and MAXHELPS from 200 to 400.
- *
- * 30-Apr-85 Steven Shafer (sas) at Carnegie-Mellon University
- * Adapted for 4.2 UNIX. Added calls to check for
- * using window manager of VIRTUE.
- *
- * 29-Apr-85 Steven Shafer (sas) at Carnegie-Mellon University
- * Added two small bug fixes (courtesy of Richard Cohn).
- *
- * 14-Aug-84 Steven Shafer (sas) at Carnegie-Mellon University
- * Added fflush(stdout) after printing prompt, before asking for input line.
- *
- * 01-Jul-83 Steven Shafer (sas) at Carnegie-Mellon University
- * Bug fix: whitespace now required before ">filename" and not permitted
- * within or after filename.
- *
- * 06-Jun-83 Steven Shafer (sas) at Carnegie-Mellon University
- * Bug fix: added line to initialize "redirected" to 0.
- *
- * 20-May-83 Steven Shafer (sas) at Carnegie-Mellon University
- * Added quiet bits CINOSEM, CINOFILE, CIFIRSTEQUAL to allow user to
- * have special characters ; > = treated as normal data (except =
- * after first argument, which still means "variable assignment").
- * Also added output redirection via >filename on input line.
- *
- * 07-Mar-83 Dave McKeown (dmm) at Carnegie-Mellon University
- * (Slight alterations by Steve Shafer.)
- * Made cidepth a global, used for recursive and nested calls to
- * ci(), and accessible to the user. Added '@x' command, similar
- * to '^x' except that the previous command interpreter name is
- * remembered and after 'x' is executed, the previous command
- * interpreter is reinvoked. Users who plan to use this feature
- * must save the name of the previous ci in global variable
- * 'ciprev' after exit from the ci(). ie.
- * ci(.........);
- * strcpy(ciprev,"ci-name");
- * Added ci state CICMDNOINDENT to allow for no indentation of the
- * command line prompt based on cidepth.
- * Reduced amount of indentation on source code.
- * Bug: the "depth" argument is now a no-op, retained for backward
- * compatibility. Cidepth is initialized to zero, and incremented
- * upon invocation of a ci(). If cidepth is <1 then you are not
- * in a ci() instantiation.
- *
- * 21-Feb-83 Steven Shafer (sas) at Carnegie-Mellon University
- * Added up-arrow (^) command (and variable cinext). ^x is used when
- * you have a ci program in which one command invokes ci with a
- * new set of commands (i.e. a subsystem of the program). Inside the
- * subsystem, ^x will exit the subsystem, and cause the main level
- * to execute the command line "x" before reading more input lines.
- * The cinext variable is used to implement this. Cinext can also be
- * used by any user code which desires to force ci to execute a
- * specific command before reading more input from the current file.
- *
- * 16-Jul-82 Steven Shafer (sas) at Carnegie-Mellon University
- * Added extra code in _ci_help to eliminate duplicate help file
- * names. This way, if several directories are specified and there
- * is are files with the same name in more than one directory, only
- * the first of each file will be included in the help list.
- *
- * It would have been nice to do this after the qsort instead of
- * before (in ci_help). However, qsort does not ensure that
- * "equivalent" entries are kept in the same relative
- * order; thus there would be no way to ensure that the
- * file being used was the first such file found.
- *
- * 07-Jul-82 William Chiles (wpc) at Carnegie-Mellon University
- * Modified so that "!" invokes shell commands from the type of
- * shell specified by the environment variable SHELL. If SHELL
- * is not defined the standard shell is used.
- *
- * 21-Sep-81 Steven Shafer (sas) at Carnegie-Mellon University
- * Increased LINELENGTH (input buffer length) to 1100 to satisfy
- * voracious requirements of a certain user whose name I won't mention
- * but whose initials are "faa".
- *
- * 08-Oct-80 Steven Shafer (sas) at Carnegie-Mellon University
- * Added class variables: ci_tclass cases in ci_show and ci_set.
- * Also added CICMDFPEEK in addition to existing CISETPEEK.
- *
- * 22-May-80 Steven Shafer (sas) at Carnegie-Mellon University
- * Ci now sorts help topics into alphabetical order. Some interrupt
- * handling has been added, but there are bugs, for example, when
- * you interrupt "*" (the listing of command names). The right thing
- * happens, but bogus messages are printed.
- *
- * 16-Apr-80 Steven Shafer (sas) at Carnegie-Mellon University
- * Ci now prints lists of names with prstab(). This uses multiple
- * columns when appropriate.
- *
- * 12-Mar-80 Steven Shafer (sas) at Carnegie-Mellon University
- * Added code to skip over leading blanks and tabs in the argument list
- * when executing commands, and setting and displaying variables.
- * Also fixed meta-help, which mysteriously disappeared.
- *
- * 19-Feb-80 Steven Shafer (sas) at Carnegie-Mellon University
- * Added "if (0) del();" to force del() routine to be loaded. This is
- * the safest way I know of to define the external int "_del_". If you
- * don't believe it, think again about separately compiled files.
- *
- * 28-Jan-80 Steven Shafer (sas) at Carnegie-Mellon University
- * Created. Patterned (somewhat) after ci() on PDP-11.
- *
- */
-
-
-#include <string.h>
-#include <libc.h>
-#include <ci.h>
-#include <del.h>
-
-char *index(),*getenv(),*rindex();
-extern char _argbreak;
-long atol();
-double atof();
-static int ci_help(), ci_show();
-static int _ci_sho(), _ci_set(), ci_set();
-
-/*************************
- *** M A C R O S ***
- *************************/
-
-#define LINELENGTH 1100 /* max length of input line */
-#define MAXENTRIES 400 /* max entries in entry list */
-#define MAXHELPS 400 /* max help files available */
-#define METAHELP "/usr/lib/ci.help" /* standard help file */
-
-/*********************************************
- *** G L O B A L V A R I A B L E S ***
- *********************************************/
-
-int ciquiet = 0; /* init globals */
-int ciexit = 0;
-int cidepth = 0;
-int ciback = 0; /* for use in '@' command */
-FILE *ciinput;
-
-char cinext[LINELENGTH] = "";
-char ciprev[LINELENGTH] = "";
-
-static char *delchoice[] = { /* breakpoint choices */
- "abort abort command file",
- "breakpoint break to tty, then resume command file",
- 0};
-
-/*************************************
- *** M A I N R O U T I N E ***
- *************************************/
-
-ci (prompt,fil,depth,list,helppath,cmdfpath)
-char *prompt; /* prompt message */
-FILE *fil; /* input file */
-int depth; /* recursion depth */
-CIENTRY *list; /* entry list */
-char *helppath; /* search list for help files */
-char *cmdfpath; /* search list for command files */
-
-{
-
- FILE *savfile; /* input file for calling instance of ci */
- int savquiet, savexit; /* globals for calling instance of ci */
- char *p,*q,*cmd,*arg; /* temps for parsing input */
- int i; /* temp */
- char line[LINELENGTH]; /* input line buffer */
- int firststmt; /* temp */
- char *equals,*star; /* index of = and * in input line */
- char cfnam[200]; /* name of command file */
- char *name[MAXENTRIES]; /* name list for entries */
- char *vname[MAXENTRIES]; /* name list for just variables */
- int vnum[MAXENTRIES]; /* correspondence list for variables */
- int nv; /* number of variables */
- int helpcmd; /* "help" command index */
- FILE *newfile; /* command file just opened */
- char bprompt[100]; /* breakpoint prompt */
- char *tname[MAXENTRIES]; /* temp name list */
- int tnum; /* # entries in tname */
- char *Shell; /* holds SHELL value from .login */
- int redirected; /* 1 iff currently redirected output */
- FILE savestdout; /* place to save normal std. output */
- FILE *outfile; /* current output file */
- char *outname; /* output file name */
-
-
- /* force del() routine to be declared */
- if (0) del();
- /* save globals on stack */
- cidepth++; /* bump the global depth, first CI() is 1 */
- savquiet = ciquiet;
- savexit = ciexit;
- savfile = ciinput;
- ciexit = 0; /* don't exit until this is set */
- ciinput = (fil ? fil : stdin); /* new input file */
-
- /* construct name lists for stablk */
-
- nv = 0;
- for (i=0; list[i].ci_etyp != ci_tend; i++) {
- name[i] = list[i].ci_enam;
- if (list[i].ci_etyp != ci_tcmd) { /* is variable */
- vname[nv] = name[i];
- vnum[nv] = i;
- nv++;
- }
- }
- helpcmd = i++; /* force-feed "help" onto list */
- name[helpcmd] = "help";
- name[i] = 0;
- vname[nv] = 0;
-
- /* loop for input lines */
-
- redirected = 0;
- while (!ciexit) {
-
- if (*cinext) { /* get line from ^ command */
- if (ciback) {
- sprintf(line,"%s;%s",cinext,ciprev);
- ciback = 0;
- }
- else {
- strcpy (line,cinext);
- }
- strcpy (cinext,"");
- p = line;
- }
- else { /* else read file */
- if ((ciinput == stderr) || (ciinput == stdin) || (!(ciquiet&CICMDFPROMPT))) {
- if (!(ciquiet &CICMDNOINDENT)) {
- for (i=1; i<cidepth; i++) {
- printf (" ");
- }
- }
- printf ("%s ",prompt);
- if ((ciinput == stderr) || (ciinput == stdin)) fflush (stdout);
- }
- p = fgets (line,LINELENGTH,ciinput); /* read input line */
- if (p == 0) { /* EOF */
- if (_del_) {
- DELCLEAR;
- strcpy (line,"");
- p = line;
- }
- else {
- ciexit = 1;
- if ((ciinput==stdin) || (ciinput==stderr) ||
- (!(ciquiet&CICMDFECHO))) printf ("\n");
- }
- }
- else {
- if ((ciinput != stderr) && (ciinput != stdin) &&
- (!(ciquiet&CICMDFECHO))) printf ("%s",line);
-
- for (p=line; (*p) && (*p != '\n'); p++) ;
- *p = 0; /* kill trailing newline */
- p = line; /* points to start of line */
- }
- }
-
- /* check for redirection of output */
-
- if (!ciexit) {
Home |
Main Index |
Thread Index |
Old Index