From db76b683f1311d6dce61feed21eb1487dce6bd74 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Thu, 19 Mar 2020 19:37:39 -0400 Subject: [PATCH] Remove unused util/ss files Delete the old C/yacc/lex sources for mk_cmds. --- src/util/ss/Makefile.in | 14 +---- src/util/ss/cmd_tbl.lex.l | 81 ---------------------------- src/util/ss/ct.y | 81 ---------------------------- src/util/ss/deps | 13 ----- src/util/ss/mk_cmds.c | 100 ---------------------------------- src/util/ss/options.c | 33 ------------ src/util/ss/utils.c | 110 -------------------------------------- 7 files changed, 1 insertion(+), 431 deletions(-) delete mode 100644 src/util/ss/cmd_tbl.lex.l delete mode 100644 src/util/ss/ct.y delete mode 100644 src/util/ss/mk_cmds.c delete mode 100644 src/util/ss/options.c delete mode 100644 src/util/ss/utils.c diff --git a/src/util/ss/Makefile.in b/src/util/ss/Makefile.in index a7da5fcaa8..0d99e87417 100644 --- a/src/util/ss/Makefile.in +++ b/src/util/ss/Makefile.in @@ -40,11 +40,7 @@ SRCS= $(srcdir)/invocation.c $(srcdir)/help.c \ $(srcdir)/error.c $(srcdir)/prompt.c \ $(srcdir)/request_tbl.c $(srcdir)/list_rqs.c $(srcdir)/pager.c \ $(srcdir)/requests.c $(srcdir)/data.c -EXTRADEPSRCS= \ - $(srcdir)/mk_cmds.c $(srcdir)/utils.c $(srcdir)/options.c \ - cmd_tbl.lex.c ct.tab.c \ - ss_err.c \ - std_rqs.c +EXTRADEPSRCS= ss_err.c std_rqs.c depend-dependencies: ss_err.h includes std_rqs.o: std_rqs.c ss_err.h @@ -106,14 +102,6 @@ ct.tab.c ct.tab.h: ct.y # install_library_target(ss,$(OBJS),$(SRCS),) -#mk_cmds: $(MKCMDSOBJS) -# $(CC) $(ALL_CFLAGS) -o $@ $(MKCMDSOBJS) $(LEXLIB) $(BSDLIB) -# -#mk_cmds.o: ss_err.h -# -#install: -# $(INSTALLPROG) mk_cmds ${DESTDIR}$(PROGDIR)/mk_cmds - mk_cmds: $(srcdir)/mk_cmds.sh $(srcdir)/config_script $(SHELL) $(srcdir)/config_script $(srcdir)/mk_cmds.sh . $(AWK) $(SED) > mk_cmds chmod 755 mk_cmds diff --git a/src/util/ss/cmd_tbl.lex.l b/src/util/ss/cmd_tbl.lex.l deleted file mode 100644 index af01328426..0000000000 --- a/src/util/ss/cmd_tbl.lex.l +++ /dev/null @@ -1,81 +0,0 @@ -N [0-9] -PC [^\"] -AN [A-Z_a-z0-9] -%% - -command_table return l_command_table(); -request return l_request(); -unimplemented return l_unimplemented(); -end return l_end(); - -[\t\n ] ; - -\"{PC}*\" return l_quoted_string(); - -{AN}* return l_string(); - -#.*\n ; - -. return (*yytext); -%% -/* - * User-subroutines section. - * - * Have to put all this stuff here so that the include file - * from YACC output can be included, since LEX doesn't allow - * an include file before the code it generates for the above - * rules. - * - * Copyright 1987 by MIT Student Information Processing Board. - * - * For copyright info, see mit-sipb-copyright.h. - */ -#include -#include "ct.tab.h" - -#ifndef HAS_STRDUP -extern char *strdup(); -#endif - -extern char *last_token; - -static l_command_table() -{ - last_token = "command_table"; - return COMMAND_TABLE; -} - -static l_request() -{ - last_token = "request"; - return REQUEST; -} - -static l_unimplemented() -{ - last_token = "unimplemented"; - return UNIMPLEMENTED; -} - -static l_end() -{ - last_token = "end"; - return END; -} - -static l_quoted_string() -{ - char *p; - yylval.dynstr = strdup(yytext+1); - if (p=strrchr(yylval.dynstr, '"')) - *p='\0'; - last_token = strdup(yylval.dynstr); - return STRING; -} - -static l_string() -{ - yylval.dynstr = strdup(yytext); - last_token = strdup(yylval.dynstr); - return STRING; -} diff --git a/src/util/ss/ct.y b/src/util/ss/ct.y deleted file mode 100644 index 0727492cff..0000000000 --- a/src/util/ss/ct.y +++ /dev/null @@ -1,81 +0,0 @@ -%{ -/* - * Copyright 1987 by MIT Student Information Processing Board - * - * For copyright info, see mit-sipb-copyright.h. - */ -#include -#include - -#ifndef HAS_STRDUP -extern char *strdup(); -#endif - -char *str_concat3(), *generate_rqte(), *quote(); -long flag_value(); -char *last_token = (char *)NULL; -FILE *output_file; -long gensym_n = 0; - -%} -%union { - char *dynstr; - long flags; -} - -%token COMMAND_TABLE REQUEST UNKNOWN UNIMPLEMENTED END -%token STRING -%token FLAGNAME -%type namelist header request_list -%type request_entry -%type flag_list options -%left OPTIONS -%{ -#include "ss.h" -%} -%start command_table -%% -command_table : header request_list END ';' - { write_ct($1, $2); } - ; - -header : COMMAND_TABLE STRING ';' - { $$ = $2; } - ; - -request_list : request_list request_entry - { $$ = str_concat3($1, $2, ""); } - | - { $$ = ""; } - ; - -request_entry : REQUEST STRING ',' STRING ',' namelist ',' options ';' - { $$ = generate_rqte($2, quote($4), $6, $8); } - | REQUEST STRING ',' STRING ',' namelist ';' - { $$ = generate_rqte($2, quote($4), $6, 0); } - | UNKNOWN namelist ';' - { $$ = generate_rqte("ss_unknown_request", - (char *)NULL, $2, 0); } - | UNIMPLEMENTED STRING ',' STRING ',' namelist ';' - { $$ = generate_rqte("ss_unimplemented", quote($4), $6, 3); } - ; - -options : '(' flag_list ')' - { $$ = $2; } - | '(' ')' - { $$ = 0; } - ; - -flag_list : flag_list ',' STRING - { $$ = $1 | flag_val($3); } - | STRING - { $$ = flag_val($1); } - ; - -namelist: STRING - { $$ = quote(strdup($1)); } - | namelist ',' STRING - { $$ = str_concat3($1, quote($3), ",\n "); } - ; - -%% diff --git a/src/util/ss/deps b/src/util/ss/deps index 7705e25c38..573ea85597 100644 --- a/src/util/ss/deps +++ b/src/util/ss/deps @@ -53,19 +53,6 @@ data.so data.po $(OUTPRE)data.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \ $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS) $(top_srcdir)/include/k5-platform.h \ $(top_srcdir)/include/k5-thread.h copyright.h data.c \ ss.h ss_internal.h -mk_cmds.so mk_cmds.po $(OUTPRE)mk_cmds.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \ - $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS) $(top_srcdir)/include/k5-platform.h \ - $(top_srcdir)/include/k5-thread.h copyright.h mk_cmds.c \ - ss.h ss_internal.h -utils.so utils.po $(OUTPRE)utils.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \ - $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS) $(top_srcdir)/include/k5-platform.h \ - $(top_srcdir)/include/k5-thread.h copyright.h ss.h \ - ss_internal.h utils.c -options.so options.po $(OUTPRE)options.$(OBJEXT): $(BUILDTOP)/include/ss/ss_err.h \ - $(COM_ERR_DEPS) copyright.h options.c ss.h -cmd_tbl.lex.o: cmd_tbl.lex.c -ct.tab.o: $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS) \ - ct.tab.c ss.h ss_err.so ss_err.po $(OUTPRE)ss_err.$(OBJEXT): $(COM_ERR_DEPS) \ ss_err.c std_rqs.so std_rqs.po $(OUTPRE)std_rqs.$(OBJEXT): $(COM_ERR_DEPS) \ diff --git a/src/util/ss/mk_cmds.c b/src/util/ss/mk_cmds.c deleted file mode 100644 index 3ed37794db..0000000000 --- a/src/util/ss/mk_cmds.c +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* util/ss/mk_cmds.c */ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#include "copyright.h" -#include -#include -#include -#include -#include -#include "ss_internal.h" - -static const char copyright[] = - "Copyright 1987 by MIT Student Information Processing Board"; - -extern pointer malloc (unsigned); -extern char *last_token; -extern FILE *output_file; - -extern FILE *yyin, *yyout; -#ifndef NO_YYLINENO -extern int yylineno; -#endif - -int main(argc, argv) - int argc; - char **argv; -{ - char c_file[MAXPATHLEN]; - int result; - char *path, *p, *q; - - if (argc != 2) { - fputs("Usage: ", stderr); - fputs(argv[0], stderr); - fputs("cmdtbl.ct\n", stderr); - exit(1); - } - - path = malloc(strlen(argv[1])+4); /* extra space to add ".ct" */ - strcpy(path, argv[1]); - p = strrchr(path, '/'); - if (p == (char *)NULL) - p = path; - else - p++; - p = strrchr(p, '.'); - if (p == (char *)NULL || strcmp(p, ".ct")) - strcat(path, ".ct"); - yyin = fopen(path, "r"); - if (!yyin) { - perror(path); - exit(1); - } - - p = strrchr(path, '.'); - *p = '\0'; - q = rindex(path, '/'); - strncpy(c_file, (q) ? q + 1 : path, sizeof(c_file) - 1); - c_file[sizeof(c_file) - 1] = '\0'; - strncat(c_file, ".c", sizeof(c_file) - 1 - strlen(c_file)); - *p = '.'; - - output_file = fopen(c_file, "w+"); - if (!output_file) { - perror(c_file); - exit(1); - } - - fputs("/* ", output_file); - fputs(c_file, output_file); - fputs(" - automatically generated from ", output_file); - fputs(path, output_file); - fputs(" */\n", output_file); - fputs("#include \n\n", output_file); - fputs("#ifndef __STDC__\n#define const\n#endif\n\n", output_file); - /* parse it */ - result = yyparse(); - /* put file descriptors back where they belong */ - fclose(yyin); /* bye bye input file */ - fclose(output_file); /* bye bye output file */ - - return result; -} - -yyerror(s) -char *s; -{ - fputs(s, stderr); -#ifdef NO_YYLINENO - fprintf(stderr, "\nLast token was '%s'\n", last_token); -#else - fprintf(stderr, "\nLine %d; last token was '%s'\n", - yylineno, last_token); -#endif -} diff --git a/src/util/ss/options.c b/src/util/ss/options.c deleted file mode 100644 index 807f8e670a..0000000000 --- a/src/util/ss/options.c +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ -#include "copyright.h" -#include -#include "ss.h" - -struct option { - char *text; - long value; -}; - -static struct option options[] = { - { "dont_list", SS_OPT_DONT_LIST }, - { "^list", SS_OPT_DONT_LIST }, - { "dont_summarize", SS_OPT_DONT_SUMMARIZE }, - { "^summarize", SS_OPT_DONT_SUMMARIZE }, - { (char *)NULL, 0 } -}; - -long -flag_val(string) - char *string; -{ - struct option *opt; - for (opt = options; opt->text; opt++) - if (!strcmp(opt->text, string)) - return(opt->value); - return(0); -} diff --git a/src/util/ss/utils.c b/src/util/ss/utils.c deleted file mode 100644 index 675de7cb1b..0000000000 --- a/src/util/ss/utils.c +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#include -#include "copyright.h" -#include "ss_internal.h" /* includes stdio and string */ - -extern FILE *output_file; - -char *gensym(), *str_concat3(), *quote(); -extern long gensym_n; - -void write_ct(hdr, rql) - char const *hdr, *rql; -{ - char *sym; - sym = gensym("ssu"); - fputs("static ss_request_entry ", output_file); - fputs(sym, output_file); - fputs("[] = {\n", output_file); - fputs(rql, output_file); - fputs(" { 0, 0, 0, 0 }\n", output_file); - fputs("};\n\nss_request_table ", output_file); - fputs(hdr, output_file); - fprintf(output_file, " = { %d, ", SS_RQT_TBL_V2); - fputs(sym, output_file); - fputs(" };\n", output_file); -} - -char * generate_cmds_string(cmds) - char const *cmds; -{ - char * var_name = gensym("ssu"); - fputs("static char const * const ", output_file); - fputs(var_name, output_file); - fputs("[] = {\n", output_file); - fputs(cmds, output_file); - fputs(",\n (char const *)0\n};\n", output_file); - return(var_name); -} - -void generate_function_definition(func) - char const *func; -{ - fputs("extern void ", output_file); - fputs(func, output_file); - fputs(" __SS_PROTO;\n", output_file); -} - -char * generate_rqte(func_name, info_string, cmds, options) - char const *func_name; - char const *info_string; - char const *cmds; - int options; -{ - char *string, *var_name; - var_name = generate_cmds_string(cmds); - generate_function_definition(func_name); - asprintf(&string, " { %s,\n %s,\n %s,\n %d },\n", - var_name, func_name, info_string, options); - return(string); -} - -char * -gensym(name) - char *name; -{ - char *symbol; - - gensym_n++; - asprintf(&symbol, "%s%05ld", name, gensym_n); - return(symbol); -} - -/* concatenate three strings and return the result */ -char *str_concat3(a, b, c) - char *a, *b, *c; -{ - char *result; - - asprintf(&result, "%s%s%s", a, c, b); - return(result); -} - -/* return copy of string enclosed in double-quotes */ -char *quote(string) - char *string; -{ - char *result; - - asprintf(&result, "\"%s\"", string); - return(result); -} - -#ifndef HAVE_STRDUP -/* make duplicate of string and return pointer */ -char *strdup(s) - char *s; -{ - int len = strlen(s) + 1; - char *new; - new = malloc(len); - strncpy(new, s, len); - return(new); -} -#endif -- 2.47.2