diff options
author | kris <kris@FreeBSD.org> | 2001-08-20 06:23:35 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2001-08-20 06:23:35 +0000 |
commit | a6b313f27f0b30eba1571f0b28b80b4d8d70453b (patch) | |
tree | fb86867e67c49af4fcef06aa3caba412787c1ada /usr.bin | |
parent | 6c2a2fde206736669c4bdc5edb7fe596f2ce35a6 (diff) | |
download | FreeBSD-src-a6b313f27f0b30eba1571f0b28b80b4d8d70453b.zip FreeBSD-src-a6b313f27f0b30eba1571f0b28b80b4d8d70453b.tar.gz |
Part II of libss retirement: zap mk_cmds too.
Pointy hat to: kris
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/Makefile | 1 | ||||
-rw-r--r-- | usr.bin/mk_cmds/Makefile | 11 | ||||
-rw-r--r-- | usr.bin/mk_cmds/cmd_tbl.l | 79 | ||||
-rw-r--r-- | usr.bin/mk_cmds/copyright.h | 19 | ||||
-rw-r--r-- | usr.bin/mk_cmds/ct.y | 77 | ||||
-rw-r--r-- | usr.bin/mk_cmds/mk_cmds.1 | 99 | ||||
-rw-r--r-- | usr.bin/mk_cmds/mk_cmds.c | 99 | ||||
-rw-r--r-- | usr.bin/mk_cmds/options.c | 32 | ||||
-rw-r--r-- | usr.bin/mk_cmds/utils.c | 135 |
9 files changed, 0 insertions, 552 deletions
diff --git a/usr.bin/Makefile b/usr.bin/Makefile index 35cf74c..34d9ab1 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -94,7 +94,6 @@ SUBDIR= apply \ make \ mesg \ minigzip \ - mk_cmds \ mkdep \ mkfifo \ mklocale \ diff --git a/usr.bin/mk_cmds/Makefile b/usr.bin/mk_cmds/Makefile deleted file mode 100644 index 4cbbbb9..0000000 --- a/usr.bin/mk_cmds/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ - -PROG= mk_cmds -SRCS= mk_cmds.c options.c utils.c ct.y cmd_tbl.l y.tab.h -CFLAGS+= -I. -I${.CURDIR}/../../lib/libss -DIN_MK_CMDS -LFLAGS= -l - -LDADD+= -ll -DPADD+= ${LIBL} - -.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 0c615ce..0000000 --- a/usr.bin/mk_cmds/cmd_tbl.l +++ /dev/null @@ -1,79 +0,0 @@ -%{ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board. - * - * For copyright info, see copyright.h. - */ - -#include <string.h> -#include "y.tab.h" -#include "copyright.h" - -extern char *last_token, *ds(); - -static int l_command_table() -{ - last_token = "command_table"; - return COMMAND_TABLE; -} - -static int l_request() -{ - last_token = "request"; - return REQUEST; -} - -static int l_unimplemented() -{ - last_token = "unimplemented"; - return UNIMPLEMENTED; -} - -static int l_end() -{ - last_token = "end"; - return END; -} - -static int l_quoted_string() -{ - register char *p; - yylval.dynstr = ds(yytext+1); - if ( (p=rindex(yylval.dynstr, '"')) ) - *p='\0'; - last_token = ds(yylval.dynstr); - return STRING; -} - -static int l_string() -{ - yylval.dynstr = ds(yytext); - last_token = ds(yylval.dynstr); - return STRING; -} - - -%} - -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); - -%% - diff --git a/usr.bin/mk_cmds/copyright.h b/usr.bin/mk_cmds/copyright.h deleted file mode 100644 index e0d1572..0000000 --- a/usr.bin/mk_cmds/copyright.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - -Copyright 1987, 1989 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. - -*/ - diff --git a/usr.bin/mk_cmds/ct.y b/usr.bin/mk_cmds/ct.y deleted file mode 100644 index c1b0d2f..0000000 --- a/usr.bin/mk_cmds/ct.y +++ /dev/null @@ -1,77 +0,0 @@ -%{ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright info, see copyright.h. - */ -#include <stdio.h> -#include "copyright.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 -%{ -#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(ds($1)); } - | namelist ',' STRING - { $$ = str_concat3($1, quote($3), ",\n "); } - ; - -%% diff --git a/usr.bin/mk_cmds/mk_cmds.1 b/usr.bin/mk_cmds/mk_cmds.1 deleted file mode 100644 index abf439f..0000000 --- a/usr.bin/mk_cmds/mk_cmds.1 +++ /dev/null @@ -1,99 +0,0 @@ -.\" Copyright (c) 1999 Jeroen Ruigrok van der Werven -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.Dd November 14, 1999 -.Dt MK_CMDS 1 -.Os -.Sh NAME -.Nm mk_cmds -.Nd generate commands from table file -.Sh SYNOPSIS -.Nm -.Ar cmdtbl.ct -.Sh DESCRIPTION -The -.Nm -utility takes a command table file as input and produces a C source file -as output which is intended to be used with the subsystem library, libss. -This source file automatically includes -.Aq Pa ss/ss.h . -.Pp -The format of the table file to be specified is as follows: -.Pp -command_table name_of_table -.Pp -keyword ss_command_name, -.Qq description_of_command , -command_binding -.Op ,command_binding ; -.Pp -keyword ss_command_name, -.Qq description_of_command , -command_name, -(dont_option -.Op , dont_option ) ; -.Pp -end; -.Pp -Keyword is one of the following: -.Pp -.Bl -tag -width "unimplemented" -compact -.It request -A command that can be requested -.It unimplemented -An unimplemented command -.El -.Pp -Dont_option is one of the following: -.Pp -.Bl -tag -width "dont_summarize" -compact -.It dont_list -Do not list the command -.It dont_summarize -Do not list the command in the command summary -.El -.Sh EXAMPLES -request ss_testfunction, -.Qq This is the explanation for testfunction , -testfunction, tf; -.Pp -request ss_anothertest, -.Qq This is the explanation for anothertest , -anothertest, (dont_list, dont_summarize); -.Pp -unimplemented ss_lasttest, -.Qq This is the explanation for lasttest , -lasttest, lt; -.Sh HISTORY -The -.Nm -utility -was written by the MIT Student Information Processing Board and -appeared before -.Fx 2.0.5 . -.Sh AUTHORS -This manual page was written by -.An Jeroen Ruigrok van der Werven -.Aq asmodai@wxs.nl diff --git a/usr.bin/mk_cmds/mk_cmds.c b/usr.bin/mk_cmds/mk_cmds.c deleted file mode 100644 index 80411b3..0000000 --- a/usr.bin/mk_cmds/mk_cmds.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * make_commands.c - * - * Header: mk_cmds.c,v 1.6 89/01/25 07:47:26 raeburn Exp - * - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#include "copyright.h" -#include <stdio.h> -#include <sys/param.h> -#include <sys/file.h> -#include <strings.h> -#include "ss_internal.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 int yylineno; - -static void -usage(void) -{ - fprintf(stderr, "usage: mk_cmds cmdtbl.ct\n"); - exit(1); -} - -int -main(argc, argv) - int argc; - char **argv; -{ - char c_file[MAXPATHLEN]; - int result; - char *path, *p; - - if (argc != 2) - usage(); - - path = malloc(strlen(argv[1])+4); /* extra space to add ".ct" */ - strcpy(path, argv[1]); - p = rindex(path, '/'); - if (p == (char *)NULL) - p = path; - else - p++; - p = rindex(p, '.'); - if (p == (char *)NULL || strcmp(p, ".ct")) - strcat(path, ".ct"); - yyin = fopen(path, "r"); - if (!yyin) { - perror(path); - exit(1); - } - - p = rindex(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); - 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; -} - -int -yyerror(s) - char *s; -{ - fputs(s, stderr); - fprintf(stderr, "\nLine %d; last token was '%s'\n", - yylineno, last_token); - return 0; -} diff --git a/usr.bin/mk_cmds/options.c b/usr.bin/mk_cmds/options.c deleted file mode 100644 index dd648b0..0000000 --- a/usr.bin/mk_cmds/options.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ -#include "copyright.h" -#include <stdio.h> -#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) - 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 e46afce..0000000 --- a/usr.bin/mk_cmds/utils.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 1987, 1988 by MIT Student Information Processing Board - * - * For copyright information, see copyright.h. - */ - -#include <stdlib.h> -#include "copyright.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(" __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; -{ - 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!\", " */ - sprintf(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] = '"'; - bcopy(string, &result[1], 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); - bcopy(s, new, len); - return(new); -} |