diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 1998-07-07 18:01:48 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 1998-07-07 18:01:48 +0000 |
commit | d4de693af1086191ff335d68bcd612ffa7d4a7ef (patch) | |
tree | f82fad375e21596b8513653f8efb89988250b08e | |
parent | dc6956ba9b5fd55fcd5154262d4585a0a6399e1f (diff) |
mk_cmds is not used by anything. bye bye
-rw-r--r-- | usr.bin/mk_cmds/Makefile | 13 | ||||
-rw-r--r-- | usr.bin/mk_cmds/cmd_tbl.l | 112 | ||||
-rw-r--r-- | usr.bin/mk_cmds/ct.y | 92 | ||||
-rw-r--r-- | usr.bin/mk_cmds/mk_cmds.c | 106 | ||||
-rw-r--r-- | usr.bin/mk_cmds/mk_cmds_defs.h | 40 | ||||
-rw-r--r-- | usr.bin/mk_cmds/options.c | 46 | ||||
-rw-r--r-- | usr.bin/mk_cmds/utils.c | 142 |
7 files changed, 0 insertions, 551 deletions
diff --git a/usr.bin/mk_cmds/Makefile b/usr.bin/mk_cmds/Makefile deleted file mode 100644 index e4ed68b9dfb..00000000000 --- a/usr.bin/mk_cmds/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 1996/11/15 09:26:03 downsj Exp $ - -PROG= mk_cmds -SRCS= mk_cmds.c options.c utils.c ct.c cmd_tbl.c -CFLAGS+=-I. -I${.CURDIR}/../../lib/libss -LFLAGS= -l -LDADD+= -ll -DPADD+= ${LIBL} -CLEANFILES+= y.tab.c y.tab.h lex.yy.c cmd_tbl.c ct.c -BINDIR= /usr/bin -NOMAN= noman - -.include <bsd.prog.mk> diff --git a/usr.bin/mk_cmds/cmd_tbl.l b/usr.bin/mk_cmds/cmd_tbl.l deleted file mode 100644 index 4cca2493d98..00000000000 --- a/usr.bin/mk_cmds/cmd_tbl.l +++ /dev/null @@ -1,112 +0,0 @@ -%{ -/* $OpenBSD: cmd_tbl.l,v 1.1 1996/11/15 09:26:04 downsj Exp $ */ - -/*- - * Copyright 1987, 1988 by the Student Information Processing Board - * of the Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the names of M.I.T. and the M.I.T. S.I.P.B. not be - * used in advertising or publicity pertaining to distribution - * of the software without specific, written prior permission. - * M.I.T. and the M.I.T. S.I.P.B. make no representations about - * the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - */ -%} - -N [0-9] -PC [^\"] -AN [A-Z_a-z0-9] - -%{ -unsigned lineno = 1; - -static l_command_table(), l_request(), l_unimplemented(), l_end(), - l_quoted_string(), l_string(); -%} - -%% - -%{ -/* emptied */ -%} - -command_table return l_command_table(); -request return l_request(); -unimplemented return l_unimplemented(); -end return l_end(); - -[\t ] ; - -\n ++lineno; - -\"{PC}*\" return l_quoted_string(); - -{AN}* return l_string(); - -#.*\n ++lineno; - -. 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. - */ - -#include <string.h> -#include "y.tab.h" -/* #include "copyright.h" */ - -extern char *last_token, *ds(); - -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() -{ - register char *p; - yylval.dynstr = ds(yytext+1); - if (p=strrchr(yylval.dynstr, '"')) - *p='\0'; - last_token = ds(yylval.dynstr); - return STRING; -} - -static l_string() -{ - yylval.dynstr = ds(yytext); - last_token = ds(yylval.dynstr); - return STRING; -} diff --git a/usr.bin/mk_cmds/ct.y b/usr.bin/mk_cmds/ct.y deleted file mode 100644 index a0a28e0289b..00000000000 --- a/usr.bin/mk_cmds/ct.y +++ /dev/null @@ -1,92 +0,0 @@ -%{ -/* $OpenBSD: ct.y,v 1.1 1996/11/15 09:26:05 downsj Exp $ */ - -/*- - * Copyright 1987, 1988 by the Student Information Processing Board - * of the Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the names of M.I.T. and the M.I.T. S.I.P.B. not be - * used in advertising or publicity pertaining to distribution - * of the software without specific, written prior permission. - * M.I.T. and the M.I.T. S.I.P.B. make no representations about - * the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - */ - -#include <stdio.h> -#include <stdlib.h> - -char *str_concat3(), *ds(), *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 <dynstr> STRING -%token <dynstr> FLAGNAME -%type <dynstr> namelist header request_list -%type <dynstr> request_entry -%type <flags> flag_list options -%left OPTIONS -%{ -#define NO_SS_ERR_H -#include <ss/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(ds($1)); } - | namelist ',' STRING - { $$ = str_concat3($1, quote($3), ",\n "); } - ; - -%% diff --git a/usr.bin/mk_cmds/mk_cmds.c b/usr.bin/mk_cmds/mk_cmds.c deleted file mode 100644 index 8455cca07cd..00000000000 --- a/usr.bin/mk_cmds/mk_cmds.c +++ /dev/null @@ -1,106 +0,0 @@ -/* $OpenBSD: mk_cmds.c,v 1.2 1996/12/11 13:44:20 deraadt Exp $ */ - -/*- - * Copyright 1987, 1988 by the Student Information Processing Board - * of the Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the names of M.I.T. and the M.I.T. S.I.P.B. not be - * used in advertising or publicity pertaining to distribution - * of the software without specific, written prior permission. - * M.I.T. and the M.I.T. S.I.P.B. make no representations about - * the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - */ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/param.h> -#include <sys/file.h> -#ifndef NPOSIX -#include <string.h> -#else -#include <strings.h> -#endif -#include "mk_cmds_defs.h" - -static const char copyright[] = - "Copyright 1987 by MIT Student Information Processing Board"; - -extern pointer malloc PROTOTYPE((unsigned)); -extern char *last_token; -extern FILE *output_file; - -extern FILE *yyin, *yyout; -extern unsigned lineno; - -main(argc, argv) - int argc; - char **argv; -{ - char c_file[MAXPATHLEN]; - int result; - char *path, *p; - - 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'; - strcpy(c_file, path); - strcat(c_file, ".c"); - *p = '.'; - - output_file = fopen(c_file, "w+"); - if (!output_file) { - perror(c_file); - exit(1); - } - - fputs("/* ", output_file); /* emacs fix -> */ - fputs(c_file, output_file); - fputs(" - automatically generated from ", output_file); - fputs(path, output_file); - fputs(" */\n", output_file); - fputs("#include <ss/ss.h>\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); - fprintf(stderr, "\nLine %d; last token was '%s'\n", - lineno, last_token); -} diff --git a/usr.bin/mk_cmds/mk_cmds_defs.h b/usr.bin/mk_cmds/mk_cmds_defs.h deleted file mode 100644 index 4efe2d62753..00000000000 --- a/usr.bin/mk_cmds/mk_cmds_defs.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $OpenBSD: mk_cmds_defs.h,v 1.1 1996/11/15 09:26:08 downsj Exp $ */ - -#include <stdio.h> -#include <string.h> - -#ifdef __STDC__ - -#define PROTOTYPE(p) p -typedef void * pointer; - -#else - -#define const -#define volatile -#define PROTOTYPE(p) () -typedef char * pointer; - -#endif /* not __STDC__ */ - -#if defined(__GNUC__) -#define LOCAL_ALLOC(x) __builtin_alloca(x) -#define LOCAL_FREE(x) -#else -#if defined(vax) -#define LOCAL_ALLOC(x) alloca(x) -#define LOCAL_FREE(x) -extern pointer alloca PROTOTYPE((unsigned)); -#else -#if defined(__HIGHC__) /* Barf! */ -pragma on(alloca); -#define LOCAL_ALLOC(x) alloca(x) -#define LOCAL_FREE(x) -extern pointer alloca PROTOTYPE((unsigned)); -#else -/* no alloca? */ -#define LOCAL_ALLOC(x) malloc(x) -#define LOCAL_FREE(x) free(x) -#endif -#endif -#endif /* LOCAL_ALLOC stuff */ diff --git a/usr.bin/mk_cmds/options.c b/usr.bin/mk_cmds/options.c deleted file mode 100644 index 5f712aaf171..00000000000 --- a/usr.bin/mk_cmds/options.c +++ /dev/null @@ -1,46 +0,0 @@ -/* $OpenBSD: options.c,v 1.1 1996/11/15 09:26:09 downsj Exp $ */ - -/*- - * Copyright 1987, 1988 by the Student Information Processing Board - * of the Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software - * and its documentation for any purpose and without fee is - * hereby granted, provided that the above copyright notice - * appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, - * and that the names of M.I.T. and the M.I.T. S.I.P.B. not be - * used in advertising or publicity pertaining to distribution - * of the software without specific, written prior permission. - * M.I.T. and the M.I.T. S.I.P.B. make no representations about - * the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - */ - -#include <stdio.h> -#define NO_SS_ERR_H -#include <ss/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) - register char *string; -{ - register struct option *opt; - for (opt = options; opt->text; opt++) - if (!strcmp(opt->text, string)) - return(opt->value); - return(0); -} diff --git a/usr.bin/mk_cmds/utils.c b/usr.bin/mk_cmds/utils.c deleted file mode 100644 index 80aeb4e0eb8..00000000000 --- a/usr.bin/mk_cmds/utils.c +++ /dev/null @@ -1,142 +0,0 @@ -/* $OpenBSD: utils.c,v 1.1 1996/11/15 09:26:10 downsj Exp $ */ - -/*- - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#include <stdlib.h> -#ifndef NPOSIX -#include <string.h> -#else -#include <strings.h> -#define memcpy(a, b, c) bcopy(b, a, c) -#endif -#define NO_SS_ERR_H -#include "ss_internal.h" /* includes stdio and string */ - -extern FILE *output_file; -char *gensym(), *str_concat3(), *quote(), *ds(); -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(" __P((int, const char * const *, int, void *));\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; -{ - int size; - char *string, *var_name, numbuf[16]; - var_name = generate_cmds_string(cmds); - generate_function_definition(func_name); - size = 6; /* " { " */ - size += strlen(var_name)+7; /* "quux, " */ - size += strlen(func_name)+7; /* "foo, " */ - size += strlen(info_string)+9; /* "\"Info!\", " */ - snprintf(numbuf, sizeof(numbuf), "%d", options); - size += strlen(numbuf); - size += 4; /* " }," + NL */ - string = malloc(size * sizeof(char *)); - strcpy(string, " { "); - strcat(string, var_name); - strcat(string, ",\n "); - strcat(string, func_name); - strcat(string, ",\n "); - strcat(string, info_string); - strcat(string, ",\n "); - strcat(string, numbuf); - strcat(string, " },\n"); - return(string); -} - -char * -gensym(name) - char *name; -{ - char *symbol; - - symbol = malloc((strlen(name)+6) * sizeof(char)); - gensym_n++; - sprintf(symbol, "%s%05ld", name, gensym_n); - return(symbol); -} - -/* concatenate three strings and return the result */ -char *str_concat3(a, b, c) - register char *a, *b, *c; -{ - char *result; - int size_a = strlen(a); - int size_b = strlen(b); - int size_c = strlen(c); - - result = malloc((size_a + size_b + size_c + 2)*sizeof(char)); - strcpy(result, a); - strcpy(&result[size_a], c); - strcpy(&result[size_a+size_c], b); - return(result); -} - -/* return copy of string enclosed in double-quotes */ -char *quote(string) - register char *string; -{ - register char *result; - int len; - len = strlen(string)+1; - result = malloc(len+2); - result[0] = '"'; - memcpy(&result[1], string, len-1); - result[len] = '"'; - result[len+1] = '\0'; - return(result); -} - -/* make duplicate of string and return pointer */ -char *ds(s) - register char *s; -{ - register int len = strlen(s) + 1; - register char *new; - new = malloc(len); - memcpy(new, s, len); - return(new); -} |