From 966b47e499faefe16dc615ac4df920f95131db6d Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 28 Jun 1995 18:28:11 +0000 Subject: Rename ct_c.* to ct_c.*.in. ct_c.sed.in is now processed by sed to remove comment lines beginning with '#', since some sed programs can't handle that. Change config_script so that the directory where the ct_c.* files can be specified, since those are in the build directory, instead of the source directory. (This is all for the sake of System V sed. Sigh.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6186 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/ss/ChangeLog | 10 +++ src/util/ss/Makefile.in | 14 ++-- src/util/ss/config_script | 17 +++-- src/util/ss/ct_c.awk | 77 ---------------------- src/util/ss/ct_c.awk.in | 77 ++++++++++++++++++++++ src/util/ss/ct_c.sed | 161 ---------------------------------------------- src/util/ss/ct_c.sed.in | 161 ++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 265 insertions(+), 252 deletions(-) delete mode 100644 src/util/ss/ct_c.awk create mode 100644 src/util/ss/ct_c.awk.in delete mode 100644 src/util/ss/ct_c.sed create mode 100644 src/util/ss/ct_c.sed.in diff --git a/src/util/ss/ChangeLog b/src/util/ss/ChangeLog index e49b5d3d1..d9aecc980 100644 --- a/src/util/ss/ChangeLog +++ b/src/util/ss/ChangeLog @@ -1,3 +1,13 @@ +Wed Jun 28 11:24:20 1995 + + * Makefile.in, ct_c.sed.in, ct_c.awk.in, config_script: Rename + ct_c.* to ct_c.*.in. ct_c.sed.in is now processed by sed + to remove comment lines beginning with '#', since some sed + programs can't handle that. Change config_script so that + the directory where the ct_c.* files can be specified, + since those are in the build directory, instead of the + source directory. (This is all for the sake of System V + sed's. Sigh.) Tue Jun 27 15:46:06 EDT 1995 Paul Park (pjpark@mit.edu) * listen.c(listen_int_handler) - Add argument to conform to signal diff --git a/src/util/ss/Makefile.in b/src/util/ss/Makefile.in index 0e47112ed..2290a3635 100644 --- a/src/util/ss/Makefile.in +++ b/src/util/ss/Makefile.in @@ -125,7 +125,7 @@ libss.o: $(OBJS) $(CHMOD) -x $@ # program(mk_cmds,$(MKCMDSOBJS), , LEXLIB BSDLIB,$(PROGDIR)) -all:: mk_cmds +all:: mk_cmds ct_c.awk ct_c.sed #mk_cmds: $(MKCMDSOBJS) # $(CC) $(CFLAGS) -o $@ $(MKCMDSOBJS) $(LEXLIB) $(BSDLIB) @@ -135,15 +135,15 @@ all:: mk_cmds #install:: # $(INSTALLPROG) mk_cmds ${DESTDIR}$(PROGDIR)/mk_cmds -mk_cmds: $(srcdir)/mk_cmds.sh $(srcdir)/config_script - $(srcdir)/config_script $(srcdir)/mk_cmds.sh $(AWK) $(SED) > mk_cmds +mk_cmds: $(srcdir)/mk_cmds.sh $(srcdir)/config_script + $(srcdir)/config_script $(srcdir)/mk_cmds.sh . $(AWK) $(SED) > mk_cmds chmod 755 mk_cmds -ct_c.awk: $(srcdir)/ct_c.awk - $(CP) $(srcdir)/ct_c.awk ct_c.awk +ct_c.awk: $(srcdir)/ct_c.awk.in + $(CP) $(srcdir)/ct_c.awk.in ct_c.awk -ct_c.sed: $(srcdir)/ct_c.sed - $(CP) $(srcdir)/ct_c.sed ct_c.sed +ct_c.sed: $(srcdir)/ct_c.sed.in + $(SED) -e '/^#/d' $(srcdir)/ct_c.sed.in > ct_c.sed clean:: $(RM) mk_cmds $(MKCMDSOBJS) diff --git a/src/util/ss/config_script b/src/util/ss/config_script index e3de35c87..5add600ed 100644 --- a/src/util/ss/config_script +++ b/src/util/ss/config_script @@ -5,21 +5,24 @@ # @AWK@ # @SED@ # -# Usage: config_script [] [] +# Usage: config_script [] [] [] # FILE=$1 -AWK=$2 -SED=$3 - -# Grr.... not all Unix's have the dirname command -TMP=`echo $1 | sed -e 's;[^/]*$;;' -e 's/^$/./'` -DIR=`cd ${TMP}; pwd` +DIR=$2 +AWK=$3 +SED=$4 +if test "${DIR}x" = "x" ; then + DIR=. +fi +DIR=`cd ${DIR}; pwd` if test "${AWK}x" = "x" ; then AWK=awk fi if test "${SED}x" = "x" ; then SED=sed fi + + sed -e "s;@DIR@;${DIR};" -e "s;@AWK@;${AWK};" -e "s;@SED@;${SED};" $FILE diff --git a/src/util/ss/ct_c.awk b/src/util/ss/ct_c.awk deleted file mode 100644 index 872f6e007..000000000 --- a/src/util/ss/ct_c.awk +++ /dev/null @@ -1,77 +0,0 @@ -/^command_table / { - cmdtbl = $2; - printf "/* %s.c - automatically generated from %s.ct */\n", \ - rootname, rootname > outfile - print "#include " > outfile - print "" >outfile - print "#ifndef __STDC__" > outfile - print "#define const" > outfile - print "#endif" > outfile - print "" > outfile -} - -/^BOR$/ { - cmdnum++ - options = 0 - cmdtab = "" - printf "static char const * const ssu%05d[] = {\n", cmdnum > outfile -} - -/^sub/ { - subr = substr($0, 6, length($0)-5) -} - -/^hlp/ { - help = substr($0, 6, length($0)-5) -} - -/^cmd/ { - cmd = substr($0, 6, length($0)-5) - printf "%s\"%s\",\n", cmdtab, cmd > outfile - cmdtab = " " -} - -/^opt/ { - opt = substr($0, 6, length($0)-5) - if (opt == "dont_list") { - options += 1 - } - if (opt == "dont_summarize") { - options += 2 - } -} - -/^EOR/ { - print " (char const *)0" > outfile - print "};" > outfile - printf "extern void %s __SS_PROTO;\n", subr > outfile - subr_tab[cmdnum] = subr - options_tab[cmdnum] = options - help_tab[cmdnum] = help -} - -/^[0-9]/ { - linenum = $1; -} - -/^ERROR/ { - error = substr($0, 8, length($0)-7) - printf "Error in line %d: %s\n", linenum, error - print "#__ERROR_IN_FILE__" > outfile -} - -END { - printf "static ss_request_entry ssu%05d[] = {\n", cmdnum+1 > outfile - for (i=1; i <= cmdnum; i++) { - printf " { ssu%05d,\n", i > outfile - printf " %s,\n", subr_tab[i] > outfile - printf " \"%s\",\n", help_tab[i] > outfile - printf " %d },\n", options_tab[i] > outfile - } - print " { 0, 0, 0, 0 }" > outfile - print "};" > outfile - print "" > outfile - printf "ss_request_table %s = { 2, ssu%05d };\n", \ - cmdtbl, cmdnum+1 > outfile -} - diff --git a/src/util/ss/ct_c.awk.in b/src/util/ss/ct_c.awk.in new file mode 100644 index 000000000..872f6e007 --- /dev/null +++ b/src/util/ss/ct_c.awk.in @@ -0,0 +1,77 @@ +/^command_table / { + cmdtbl = $2; + printf "/* %s.c - automatically generated from %s.ct */\n", \ + rootname, rootname > outfile + print "#include " > outfile + print "" >outfile + print "#ifndef __STDC__" > outfile + print "#define const" > outfile + print "#endif" > outfile + print "" > outfile +} + +/^BOR$/ { + cmdnum++ + options = 0 + cmdtab = "" + printf "static char const * const ssu%05d[] = {\n", cmdnum > outfile +} + +/^sub/ { + subr = substr($0, 6, length($0)-5) +} + +/^hlp/ { + help = substr($0, 6, length($0)-5) +} + +/^cmd/ { + cmd = substr($0, 6, length($0)-5) + printf "%s\"%s\",\n", cmdtab, cmd > outfile + cmdtab = " " +} + +/^opt/ { + opt = substr($0, 6, length($0)-5) + if (opt == "dont_list") { + options += 1 + } + if (opt == "dont_summarize") { + options += 2 + } +} + +/^EOR/ { + print " (char const *)0" > outfile + print "};" > outfile + printf "extern void %s __SS_PROTO;\n", subr > outfile + subr_tab[cmdnum] = subr + options_tab[cmdnum] = options + help_tab[cmdnum] = help +} + +/^[0-9]/ { + linenum = $1; +} + +/^ERROR/ { + error = substr($0, 8, length($0)-7) + printf "Error in line %d: %s\n", linenum, error + print "#__ERROR_IN_FILE__" > outfile +} + +END { + printf "static ss_request_entry ssu%05d[] = {\n", cmdnum+1 > outfile + for (i=1; i <= cmdnum; i++) { + printf " { ssu%05d,\n", i > outfile + printf " %s,\n", subr_tab[i] > outfile + printf " \"%s\",\n", help_tab[i] > outfile + printf " %d },\n", options_tab[i] > outfile + } + print " { 0, 0, 0, 0 }" > outfile + print "};" > outfile + print "" > outfile + printf "ss_request_table %s = { 2, ssu%05d };\n", \ + cmdtbl, cmdnum+1 > outfile +} + diff --git a/src/util/ss/ct_c.sed b/src/util/ss/ct_c.sed deleted file mode 100644 index f99cd7fd2..000000000 --- a/src/util/ss/ct_c.sed +++ /dev/null @@ -1,161 +0,0 @@ -# -# This script parses a command_table file into something which is a bit -# easier for an awk script to understand. -# -# Input syntax: a .ct file -# -# Output syntax: -# (for the command_table line) -# command_table -# -#(for each request definition) -# BOR -# sub: -# hlp: -# cmd: -# opt: