diff options
Diffstat (limited to 'crypto/heimdal/lib/sl')
-rw-r--r-- | crypto/heimdal/lib/sl/ChangeLog | 120 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/Makefile.am | 44 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/Makefile.in | 737 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/lex.l | 114 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/make_cmds.c | 240 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/make_cmds.h | 69 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/parse.y | 168 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/roken_rename.h | 61 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/sl.c | 223 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/sl.h | 57 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/sl_locl.h | 46 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/ss.c | 133 | ||||
-rw-r--r-- | crypto/heimdal/lib/sl/ss.h | 55 |
13 files changed, 2067 insertions, 0 deletions
diff --git a/crypto/heimdal/lib/sl/ChangeLog b/crypto/heimdal/lib/sl/ChangeLog new file mode 100644 index 0000000..eca7217 --- /dev/null +++ b/crypto/heimdal/lib/sl/ChangeLog @@ -0,0 +1,120 @@ +2000-01-06 Assar Westerlund <assar@sics.se> + + * Makefile.am: bump both versions to 0:1:0 + +1999-12-16 Assar Westerlund <assar@sics.se> + + * parse.y (name2number): not used here. remove. + +Thu Apr 1 17:03:59 1999 Johan Danielsson <joda@hella.pdc.kth.se> + + * make_cmds.c: use getarg + +Tue Mar 23 14:36:21 1999 Johan Danielsson <joda@hella.pdc.kth.se> + + * Makefile.am: don't rename + +Sun Mar 21 14:13:29 1999 Johan Danielsson <joda@hella.pdc.kth.se> + + * Makefile.am: don't roken-rename + +Sat Mar 20 03:43:30 1999 Assar Westerlund <assar@sics.se> + + * parse.y: replace return with YYACCEPT + +Fri Mar 19 14:53:20 1999 Johan Danielsson <joda@hella.pdc.kth.se> + + * Makefile.am: add libss; add version-info + +Thu Mar 18 15:07:06 1999 Johan Danielsson <joda@hella.pdc.kth.se> + + * Makefile.am: clean lex.c parse.c parse.h + + * Makefile.am: install ss.h + + * Makefile.am: include Makefile.am.common + +Thu Mar 11 15:01:01 1999 Johan Danielsson <joda@hella.pdc.kth.se> + + * parse.y: prototype for error_message + +Tue Feb 9 23:45:37 1999 Johan Danielsson <joda@hella.pdc.kth.se> + + * Makefile.in: add snprintf.o to make_cmds + +Sun Nov 22 10:46:23 1998 Assar Westerlund <assar@sics.se> + + * sl.c (sl_command_loop): remove unused variable + + * ss.c (ss_error): remove unused variable + + * make_cmds.c: include err.h + (main): remove unused variable + + * Makefile.in (WFLAGS): set + +Sun Sep 27 01:28:21 1998 Assar Westerlund <assar@sics.se> + + * make_cmds.c: clean-up and simplification + +Mon May 25 02:54:13 1998 Assar Westerlund <assar@sics.se> + + * Makefile.in (clean): try to remove shared library debris + + * Makefile.in: make symlink magic work + +Sun Apr 19 10:00:26 1998 Assar Westerlund <assar@sics.se> + + * Makefile.in: add symlink magic for linux + +Sun Apr 5 09:21:43 1998 Assar Westerlund <assar@sics.se> + + * parse.y: define alloca to malloc in case we're using bison but + don't have alloca + +Sat Mar 28 11:39:00 1998 Assar Westerlund <assar@sics.se> + + * sl.c (sl_loop): s/2/1 + +Sat Mar 21 00:46:51 1998 Johan Danielsson <joda@emma.pdc.kth.se> + + * sl.c (sl_loop): check that there is at least one argument before + calling sl_command + +Sun Mar 1 05:14:37 1998 Johan Danielsson <joda@emma.pdc.kth.se> + + * sl.c (sl_loop): Fix general broken-ness. + + * sl.c: Cleanup printing of help strings. + +Thu Feb 26 02:22:02 1998 Assar Westerlund <assar@sics.se> + + * Makefile.am: @LEXLIB@ + +Sat Feb 21 15:18:21 1998 assar westerlund <assar@sics.se> + + * Makefile.in: set YACC and LEX + +Mon Feb 16 16:08:25 1998 Johan Danielsson <joda@emma.pdc.kth.se> + + * Makefile.am: Some fixes for ss/mk_cmds. + +Sun Feb 15 05:12:11 1998 Johan Danielsson <joda@emma.pdc.kth.se> + + * Makefile.in: Install libsl under the `libss' name too. Install + mk_cmds, and ss.h. + + * make_cmds.c: A mk_cmds clone that creates SL structures. + + * ss.c: SS compatibility functions. + + * sl.c: Move command line split to function `sl_make_argv'. + +Tue Feb 3 16:45:44 1998 Johan Danielsson <joda@emma.pdc.kth.se> + + * sl.c: Add sl_command_loop, that is the loop body of sl_loop. + +Mon Oct 20 01:13:21 1997 Assar Westerlund <assar@sics.se> + + * sl.c (sl_help): actually use the `help' field of `SL_cmd' + diff --git a/crypto/heimdal/lib/sl/Makefile.am b/crypto/heimdal/lib/sl/Makefile.am new file mode 100644 index 0000000..e572e21 --- /dev/null +++ b/crypto/heimdal/lib/sl/Makefile.am @@ -0,0 +1,44 @@ +# $Id: Makefile.am,v 1.15 2000/01/06 21:52:20 assar Exp $ + +include $(top_srcdir)/Makefile.am.common + +YFLAGS = -d + +include_HEADERS = sl.h + +lib_LTLIBRARIES = libsl.la libss.la +libsl_la_LDFLAGS = -version-info 0:1:0 +libss_la_LDFLAGS = -version-info 0:1:0 + +RENAME_SRC = roken_rename.h strtok_r.c snprintf.c + +libsl_la_SOURCES = sl_locl.h sl.c +libss_la_SOURCES = $(libsl_la_SOURCES) ss.c ss.h + +EXTRA_libsl_la_SOURCES = strtok_r.c snprintf.c roken_rename.h + +# install these? + +noinst_PROGRAMS = mk_cmds + +mk_cmds_SOURCES = make_cmds.c make_cmds.h parse.y lex.l + +RENAME_mk_cmds_SRC = roken_rename.h snprintf.c + +EXTRA_mk_cmds_SOURCES = snprintf.c roken_rename.h + +ssincludedir = $(includedir)/ss +ssinclude_HEADERS = ss.h + +CLEANFILES = lex.c parse.c parse.h snprintf.c strtok_r.c + +$(mk_cmds_OBJECTS): parse.h + +LDADD = \ + $(LIB_roken) \ + $(LEXLIB) + +strtok_r.c: + $(LN_S) $(srcdir)/../roken/strtok_r.c . +snprintf.c: + $(LN_S) $(srcdir)/../roken/snprintf.c . diff --git a/crypto/heimdal/lib/sl/Makefile.in b/crypto/heimdal/lib/sl/Makefile.in new file mode 100644 index 0000000..634cd74 --- /dev/null +++ b/crypto/heimdal/lib/sl/Makefile.in @@ -0,0 +1,737 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# $Id: Makefile.am,v 1.15 2000/01/06 21:52:20 assar Exp $ + + +# $Id: Makefile.am.common,v 1.3 1999/04/01 14:58:43 joda Exp $ + + +# $Id: Makefile.am.common,v 1.13 1999/11/01 03:19:58 assar Exp $ + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AFS_EXTRA_LD = @AFS_EXTRA_LD@ +AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@ +AWK = @AWK@ +CANONICAL_HOST = @CANONICAL_HOST@ +CATMAN = @CATMAN@ +CATMANEXT = @CATMANEXT@ +CC = @CC@ +DBLIB = @DBLIB@ +EXEEXT = @EXEEXT@ +EXTRA_LIB45 = @EXTRA_LIB45@ +GROFF = @GROFF@ +INCLUDE_ = @INCLUDE_@ +LD = @LD@ +LEX = @LEX@ +LIBOBJS = @LIBOBJS@ +LIBTOOL = @LIBTOOL@ +LIB_ = @LIB_@ +LIB_AUTH_SUBDIRS = @LIB_AUTH_SUBDIRS@ +LIB_kdb = @LIB_kdb@ +LIB_otp = @LIB_otp@ +LIB_roken = @LIB_roken@ +LIB_security = @LIB_security@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MAKE_X_PROGS_BIN_PROGS = @MAKE_X_PROGS_BIN_PROGS@ +MAKE_X_PROGS_BIN_SCRPTS = @MAKE_X_PROGS_BIN_SCRPTS@ +MAKE_X_PROGS_LIBEXEC_PROGS = @MAKE_X_PROGS_LIBEXEC_PROGS@ +NEED_WRITEAUTH_FALSE = @NEED_WRITEAUTH_FALSE@ +NEED_WRITEAUTH_TRUE = @NEED_WRITEAUTH_TRUE@ +NM = @NM@ +NROFF = @NROFF@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ +VOID_RETSIGTYPE = @VOID_RETSIGTYPE@ +WFLAGS = @WFLAGS@ +WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@ +WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@ +YACC = @YACC@ + +AUTOMAKE_OPTIONS = foreign no-dependencies + +SUFFIXES = .et .h .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .x + +INCLUDES = -I$(top_builddir)/include + +AM_CFLAGS = $(WFLAGS) + +COMPILE_ET = $(top_builddir)/lib/com_err/compile_et + +buildinclude = $(top_builddir)/include + +LIB_XauReadAuth = @LIB_XauReadAuth@ +LIB_crypt = @LIB_crypt@ +LIB_dbm_firstkey = @LIB_dbm_firstkey@ +LIB_dbopen = @LIB_dbopen@ +LIB_dlopen = @LIB_dlopen@ +LIB_dn_expand = @LIB_dn_expand@ +LIB_el_init = @LIB_el_init@ +LIB_getattr = @LIB_getattr@ +LIB_gethostbyname = @LIB_gethostbyname@ +LIB_getpwent_r = @LIB_getpwent_r@ +LIB_getpwnam_r = @LIB_getpwnam_r@ +LIB_getsockopt = @LIB_getsockopt@ +LIB_logout = @LIB_logout@ +LIB_logwtmp = @LIB_logwtmp@ +LIB_odm_initialize = @LIB_odm_initialize@ +LIB_readline = @LIB_readline@ +LIB_res_search = @LIB_res_search@ +LIB_setpcred = @LIB_setpcred@ +LIB_setsockopt = @LIB_setsockopt@ +LIB_socket = @LIB_socket@ +LIB_syslog = @LIB_syslog@ +LIB_tgetent = @LIB_tgetent@ + +HESIODLIB = @HESIODLIB@ +HESIODINCLUDE = @HESIODINCLUDE@ +INCLUDE_hesiod = @INCLUDE_hesiod@ +LIB_hesiod = @LIB_hesiod@ + +INCLUDE_krb4 = @INCLUDE_krb4@ +LIB_krb4 = @LIB_krb4@ + +INCLUDE_readline = @INCLUDE_readline@ + +LEXLIB = @LEXLIB@ + +cat1dir = $(mandir)/cat1 +cat3dir = $(mandir)/cat3 +cat5dir = $(mandir)/cat5 +cat8dir = $(mandir)/cat8 + +MANRX = \(.*\)\.\([0-9]\) +CATSUFFIX = @CATSUFFIX@ + +NROFF_MAN = groff -mandoc -Tascii + +@KRB4_TRUE@LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS) + +@KRB5_TRUE@LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la $(top_builddir)/lib/asn1/libasn1.la +@KRB5_TRUE@LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la + +CHECK_LOCAL = $(PROGRAMS) + +YFLAGS = -d + +include_HEADERS = sl.h + +lib_LTLIBRARIES = libsl.la libss.la +libsl_la_LDFLAGS = -version-info 0:1:0 +libss_la_LDFLAGS = -version-info 0:1:0 + +RENAME_SRC = roken_rename.h strtok_r.c snprintf.c + +libsl_la_SOURCES = sl_locl.h sl.c +libss_la_SOURCES = $(libsl_la_SOURCES) ss.c ss.h + +EXTRA_libsl_la_SOURCES = strtok_r.c snprintf.c roken_rename.h + +# install these? + +noinst_PROGRAMS = mk_cmds + +mk_cmds_SOURCES = make_cmds.c make_cmds.h parse.y lex.l + +RENAME_mk_cmds_SRC = roken_rename.h snprintf.c + +EXTRA_mk_cmds_SOURCES = snprintf.c roken_rename.h + +ssincludedir = $(includedir)/ss +ssinclude_HEADERS = ss.h + +CLEANFILES = lex.c parse.c parse.h snprintf.c strtok_r.c + +LDADD = $(LIB_roken) $(LEXLIB) + +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../include/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(lib_LTLIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I../../include +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_LIBS = @X_LIBS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +libsl_la_LIBADD = +libsl_la_OBJECTS = sl.lo +libss_la_LIBADD = +libss_la_OBJECTS = sl.lo ss.lo +noinst_PROGRAMS = mk_cmds$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) + +mk_cmds_OBJECTS = make_cmds.$(OBJEXT) parse.$(OBJEXT) lex.$(OBJEXT) +mk_cmds_LDADD = $(LDADD) +mk_cmds_DEPENDENCIES = +mk_cmds_LDFLAGS = +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +HEADERS = $(include_HEADERS) $(ssinclude_HEADERS) + +DIST_COMMON = ChangeLog Makefile.am Makefile.in lex.c parse.c + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +SOURCES = $(libsl_la_SOURCES) $(EXTRA_libsl_la_SOURCES) $(libss_la_SOURCES) $(mk_cmds_SOURCES) $(EXTRA_mk_cmds_SOURCES) +OBJECTS = $(libsl_la_OBJECTS) $(libss_la_OBJECTS) $(mk_cmds_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .1 .3 .5 .8 .S .c .cat1 .cat3 .cat5 .cat8 .et .h .l .lo .o .obj .s .x .y +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common + cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/sl/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-libLTLIBRARIES: + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + +distclean-libLTLIBRARIES: + +maintainer-clean-libLTLIBRARIES: + +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libdir) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + done + +.c.o: + $(COMPILE) -c $< + +# FIXME: We should only use cygpath when building on Windows, +# and only if it is available. +.c.obj: + $(COMPILE) -c `cygpath -w $<` + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + -rm -f *.$(OBJEXT) + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.c.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +libsl.la: $(libsl_la_OBJECTS) $(libsl_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libsl_la_LDFLAGS) $(libsl_la_OBJECTS) $(libsl_la_LIBADD) $(LIBS) + +libss.la: $(libss_la_OBJECTS) $(libss_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libss_la_LDFLAGS) $(libss_la_OBJECTS) $(libss_la_LIBADD) $(LIBS) + +mostlyclean-noinstPROGRAMS: + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) + +distclean-noinstPROGRAMS: + +maintainer-clean-noinstPROGRAMS: + +mk_cmds$(EXEEXT): $(mk_cmds_OBJECTS) $(mk_cmds_DEPENDENCIES) + @rm -f mk_cmds$(EXEEXT) + $(LINK) $(mk_cmds_LDFLAGS) $(mk_cmds_OBJECTS) $(mk_cmds_LDADD) $(LIBS) +.l.c: + $(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@ +.y.c: + $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c + if test -f y.tab.h; then \ + if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \ + else :; fi +parse.h: parse.c + + +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(includedir) + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + list='$(include_HEADERS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(includedir)/$$p; \ + done + +install-ssincludeHEADERS: $(ssinclude_HEADERS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(ssincludedir) + @list='$(ssinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(ssincludedir)/$$p"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(ssincludedir)/$$p; \ + done + +uninstall-ssincludeHEADERS: + @$(NORMAL_UNINSTALL) + list='$(ssinclude_HEADERS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(ssincludedir)/$$p; \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = lib/sl + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: install-libLTLIBRARIES + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook +install-exec: install-exec-am + +install-data-am: install-includeHEADERS install-ssincludeHEADERS \ + install-data-local +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-libLTLIBRARIES uninstall-includeHEADERS \ + uninstall-ssincludeHEADERS +uninstall: uninstall-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) all-local +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) \ + $(DESTDIR)$(ssincludedir) + + +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: + -test -z "lexlparsehparsec" || rm -f lexl parseh parsec +mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-noinstPROGRAMS \ + mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-libLTLIBRARIES clean-compile clean-libtool \ + clean-noinstPROGRAMS clean-tags clean-generic \ + mostlyclean-am + +clean: clean-am + +distclean-am: distclean-libLTLIBRARIES distclean-compile \ + distclean-libtool distclean-noinstPROGRAMS \ + distclean-tags distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-libLTLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-noinstPROGRAMS maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \ +clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \ +uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \ +distclean-compile clean-compile maintainer-clean-compile \ +mostlyclean-libtool distclean-libtool clean-libtool \ +maintainer-clean-libtool mostlyclean-noinstPROGRAMS \ +distclean-noinstPROGRAMS clean-noinstPROGRAMS \ +maintainer-clean-noinstPROGRAMS uninstall-includeHEADERS \ +install-includeHEADERS uninstall-ssincludeHEADERS \ +install-ssincludeHEADERS tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi \ +check-local check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-local install-data-am install-data install-am \ +install uninstall-am uninstall all-local all-redirect all-am all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +install-suid-programs: + @foo='$(bin_SUIDS)'; \ + for file in $$foo; do \ + x=$(DESTDIR)$(bindir)/$$file; \ + if chown 0:0 $$x && chmod u+s $$x; then :; else \ + chmod 0 $$x; fi; done + +install-exec-hook: install-suid-programs + +install-build-headers:: $(include_HEADERS) $(build_HEADERZ) + @foo='$(include_HEADERS) $(build_HEADERZ)'; \ + for f in $$foo; do \ + f=`basename $$f`; \ + if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \ + else file="$$f"; fi; \ + if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \ + : ; else \ + echo " cp $$file $(buildinclude)/$$f"; \ + cp $$file $(buildinclude)/$$f; \ + fi ; \ + done + +all-local: install-build-headers +#NROFF_MAN = nroff -man +.1.cat1: + $(NROFF_MAN) $< > $@ +.3.cat3: + $(NROFF_MAN) $< > $@ +.5.cat5: + $(NROFF_MAN) $< > $@ +.8.cat8: + $(NROFF_MAN) $< > $@ + +dist-cat1-mans: + @foo='$(man1_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.1) foo="$$foo $$i";; \ + esac; done ;\ + for i in $$foo; do \ + x=`echo $$i | sed 's/\.[^.]*$$/.cat1/'`; \ + echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \ + $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \ + done + +dist-cat3-mans: + @foo='$(man3_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.3) foo="$$foo $$i";; \ + esac; done ;\ + for i in $$foo; do \ + x=`echo $$i | sed 's/\.[^.]*$$/.cat3/'`; \ + echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \ + $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \ + done + +dist-cat5-mans: + @foo='$(man5_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.5) foo="$$foo $$i";; \ + esac; done ;\ + for i in $$foo; do \ + x=`echo $$i | sed 's/\.[^.]*$$/.cat5/'`; \ + echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \ + $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \ + done + +dist-cat8-mans: + @foo='$(man8_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.8) foo="$$foo $$i";; \ + esac; done ;\ + for i in $$foo; do \ + x=`echo $$i | sed 's/\.[^.]*$$/.cat8/'`; \ + echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \ + $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \ + done + +dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans + +install-cat1-mans: + @ext=1;\ + foo='$(man1_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.1) foo="$$foo $$i";; \ + esac; done; \ + if test "$$foo"; then \ + $(mkinstalldirs) $(DESTDIR)$(cat1dir); \ + for x in $$foo; do \ + f=`echo $$x | sed 's/\.[^.]*$$/.cat1/'`; \ + if test -f "$(srcdir)/$$f"; then \ + b=`echo $$x | sed 's!$(MANRX)!\1!'`; \ + echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat1dir)/$$b.$(CATSUFFIX)";\ + $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat1dir)/$$b.$(CATSUFFIX);\ + fi; \ + done ;\ + fi + +install-cat3-mans: + @ext=3;\ + foo='$(man3_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.3) foo="$$foo $$i";; \ + esac; done; \ + if test "$$foo"; then \ + $(mkinstalldirs) $(DESTDIR)$(cat3dir); \ + for x in $$foo; do \ + f=`echo $$x | sed 's/\.[^.]*$$/.cat3/'`; \ + if test -f "$(srcdir)/$$f"; then \ + b=`echo $$x | sed 's!$(MANRX)!\1!'`; \ + echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat3dir)/$$b.$(CATSUFFIX)";\ + $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat3dir)/$$b.$(CATSUFFIX);\ + fi; \ + done ;\ + fi + +install-cat5-mans: + @ext=5;\ + foo='$(man5_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.5) foo="$$foo $$i";; \ + esac; done; \ + if test "$$foo"; then \ + $(mkinstalldirs) $(DESTDIR)$(cat5dir); \ + for x in $$foo; do \ + f=`echo $$x | sed 's/\.[^.]*$$/.cat5/'`; \ + if test -f "$(srcdir)/$$f"; then \ + b=`echo $$x | sed 's!$(MANRX)!\1!'`; \ + echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat5dir)/$$b.$(CATSUFFIX)";\ + $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat5dir)/$$b.$(CATSUFFIX);\ + fi; \ + done ;\ + fi + +install-cat8-mans: + @ext=8;\ + foo='$(man8_MANS)'; \ + bar='$(man_MANS)'; \ + for i in $$bar; do \ + case $$i in \ + *.8) foo="$$foo $$i";; \ + esac; done; \ + if test "$$foo"; then \ + $(mkinstalldirs) $(DESTDIR)$(cat8dir); \ + for x in $$foo; do \ + f=`echo $$x | sed 's/\.[^.]*$$/.cat8/'`; \ + if test -f "$(srcdir)/$$f"; then \ + b=`echo $$x | sed 's!$(MANRX)!\1!'`; \ + echo "$(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(cat8dir)/$$b.$(CATSUFFIX)";\ + $(INSTALL_DATA) $(srcdir)/$$g $(DESTDIR)$(cat8dir)/$$b.$(CATSUFFIX);\ + fi; \ + done ;\ + fi + +install-cat-mans: install-cat1-mans install-cat3-mans install-cat5-mans install-cat8-mans + +install-data-local: install-cat-mans + +.et.h: + $(COMPILE_ET) $< +.et.c: + $(COMPILE_ET) $< + +.x.c: + @cmp -s $< $@ 2> /dev/null || cp $< $@ + +check-local:: + @foo='$(CHECK_LOCAL)'; \ + if test "$$foo"; then \ + failed=0; all=0; \ + for i in $$foo; do \ + all=`expr $$all + 1`; \ + if ./$$i --version > /dev/null 2>&1; then \ + echo "PASS: $$i"; \ + else \ + echo "FAIL: $$i"; \ + failed=`expr $$failed + 1`; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="$$failed of $$all tests failed"; \ + fi; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + fi + +$(mk_cmds_OBJECTS): parse.h + +strtok_r.c: + $(LN_S) $(srcdir)/../roken/strtok_r.c . +snprintf.c: + $(LN_S) $(srcdir)/../roken/snprintf.c . + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/crypto/heimdal/lib/sl/lex.l b/crypto/heimdal/lib/sl/lex.l new file mode 100644 index 0000000..b7c1c44 --- /dev/null +++ b/crypto/heimdal/lib/sl/lex.l @@ -0,0 +1,114 @@ +%{ +/* + * Copyright (c) 1998 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * 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. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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. + */ + +#include "make_cmds.h" +#include "parse.h" + +RCSID("$Id: lex.l,v 1.3 1999/12/02 16:58:55 joda Exp $"); + +static unsigned lineno = 1; +void error_message(char *, ...); +int getstring(void); + +%} + + +%% +command_table { return TABLE; } +request { return REQUEST; } +unknown { return UNKNOWN; } +unimplemented { return UNIMPLEMENTED; } +end { return END; } +#[^\n]* ; +[ \t] ; +\n { lineno++; } +\" { return getstring(); } +[a-zA-Z0-9_]+ { yylval.string = strdup(yytext); return STRING; } +. { return *yytext; } +%% + +#ifndef yywrap /* XXX */ +int +yywrap () +{ + return 1; +} +#endif + +int +getstring(void) +{ + char x[128]; + int i = 0; + int c; + int backslash = 0; + while((c = input()) != EOF){ + if(backslash) { + if(c == 'n') + c = '\n'; + else if(c == 't') + c = '\t'; + x[i++] = c; + backslash = 0; + continue; + } + if(c == '\n'){ + error_message("unterminated string"); + lineno++; + break; + } + if(c == '\\'){ + backslash++; + continue; + } + if(c == '\"') + break; + x[i++] = c; + } + x[i] = '\0'; + yylval.string = strdup(x); + return STRING; +} + +void +error_message (char *format, ...) +{ + va_list args; + + va_start (args, format); + fprintf (stderr, "%s:%d: ", filename, lineno); + vfprintf (stderr, format, args); + va_end (args); + numerror++; +} diff --git a/crypto/heimdal/lib/sl/make_cmds.c b/crypto/heimdal/lib/sl/make_cmds.c new file mode 100644 index 0000000..492e9e6 --- /dev/null +++ b/crypto/heimdal/lib/sl/make_cmds.c @@ -0,0 +1,240 @@ +/* + * Copyright (c) 1998-1999 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * 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. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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. + */ + +#include "make_cmds.h" +#include <getarg.h> + +RCSID("$Id: make_cmds.c,v 1.6 1999/12/02 16:58:55 joda Exp $"); + +#include <roken.h> +#include <err.h> +#include "parse.h" + +int numerror; +extern FILE *yyin; +FILE *c_file; + +extern void yyparse(void); + +#ifdef YYDEBUG +extern int yydebug = 1; +#endif + +char *filename; +char *table_name; + +static struct command_list *commands; + +void +add_command(char *function, + char *help, + struct string_list *aliases, + unsigned flags) +{ + struct command_list *cl = malloc(sizeof(*cl)); + + if (cl == NULL) + err (1, "malloc"); + cl->function = function; + cl->help = help; + cl->aliases = aliases; + cl->flags = flags; + cl->next = NULL; + if(commands) { + *commands->tail = cl; + commands->tail = &cl->next; + return; + } + cl->tail = &cl->next; + commands = cl; +} + +static char * +quote(const char *str) +{ + char buf[1024]; /* XXX */ + const char *p; + char *q; + q = buf; + + *q++ = '\"'; + for(p = str; *p != '\0'; p++) { + if(*p == '\n') { + *q++ = '\\'; + *q++ = 'n'; + continue; + } + if(*p == '\t') { + *q++ = '\\'; + *q++ = 't'; + continue; + } + if(*p == '\"' || *p == '\\') + *q++ = '\\'; + *q++ = *p; + } + *q++ = '\"'; + *q++ = '\0'; + return strdup(buf); +} + +static void +generate_commands(void) +{ + char *base; + char *cfn; + char *p; + + p = strrchr(table_name, '/'); + if(p == NULL) + p = table_name; + else + p++; + + base = strdup (p); + if (base == NULL) + err (1, "strdup"); + + p = strrchr(base, '.'); + if(p) + *p = '\0'; + + asprintf(&cfn, "%s.c", base); + if (cfn == NULL) + err (1, "asprintf"); + + c_file = fopen(cfn, "w"); + if (c_file == NULL) + err (1, "cannot fopen %s", cfn); + + fprintf(c_file, "/* Generated from %s */\n", filename); + fprintf(c_file, "\n"); + fprintf(c_file, "#include <stddef.h>\n"); + fprintf(c_file, "#include <sl.h>\n"); + fprintf(c_file, "\n"); + + { + struct command_list *cl, *xl; + char *p, *q; + + for(cl = commands; cl; cl = cl->next) { + for(xl = commands; xl != cl; xl = xl->next) + if(strcmp(cl->function, xl->function) == 0) + break; + if(xl != cl) + continue; + /* XXX hack for ss_quit */ + if(strcmp(cl->function, "ss_quit") == 0) { + fprintf(c_file, "int %s (int, char**);\n", cl->function); + fprintf(c_file, "#define _ss_quit_wrap ss_quit\n\n"); + continue; + } + fprintf(c_file, "void %s (int, char**);\n", cl->function); + fprintf(c_file, "static int _%s_wrap (int argc, char **argv)\n", + cl->function); + fprintf(c_file, "{\n"); + fprintf(c_file, " %s (argc, argv);\n", cl->function); + fprintf(c_file, " return 0;\n"); + fprintf(c_file, "}\n\n"); + } + + fprintf(c_file, "SL_cmd %s[] = {\n", table_name); + for(cl = commands; cl; cl = cl->next) { + struct string_list *sl; + sl = cl->aliases; + p = quote(sl->string); + q = quote(cl->help); + fprintf(c_file, " { %s, _%s_wrap, %s },\n", p, cl->function, q); + free(p); + free(q); + + for(sl = sl->next; sl; sl = sl->next) { + p = quote(sl->string); + fprintf(c_file, " { %s },\n", p); + free(p); + } + } + fprintf(c_file, " { NULL },\n"); + fprintf(c_file, "};\n"); + fprintf(c_file, "\n"); + } + fclose(c_file); + free(base); + free(cfn); +} + +int version_flag; +int help_flag; +struct getargs args[] = { + { "version", 0, arg_flag, &version_flag }, + { "help", 0, arg_flag, &help_flag } +}; +int num_args = sizeof(args) / sizeof(args[0]); + +static void +usage(int code) +{ + arg_printusage(args, num_args, NULL, "command-table"); + exit(code); +} + +int +main(int argc, char **argv) +{ + int optind = 0; + + set_progname(argv[0]); + if(getarg(args, num_args, argc, argv, &optind)) + usage(1); + if(help_flag) + usage(0); + if(version_flag) { + print_version(NULL); + exit(0); + } + + if(argc == optind) + usage(1); + filename = argv[optind]; + yyin = fopen(filename, "r"); + if(yyin == NULL) + err(1, "%s", filename); + + yyparse(); + + generate_commands(); + + if(numerror) + return 1; + return 0; +} diff --git a/crypto/heimdal/lib/sl/make_cmds.h b/crypto/heimdal/lib/sl/make_cmds.h new file mode 100644 index 0000000..24dbd60 --- /dev/null +++ b/crypto/heimdal/lib/sl/make_cmds.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1998 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * 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. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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. + */ + +/* $Id: make_cmds.h,v 1.2 1999/12/02 16:58:55 joda Exp $ */ + +#ifndef __MAKE_CMDS_H__ +#define __MAKE_CMDS_H__ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <stdarg.h> + +extern char *filename; +extern char *table_name; +extern int numerror; + +struct command_list { + char *function; + char *help; + struct string_list *aliases; + unsigned flags; + struct command_list *next; + struct command_list **tail; +}; + +struct string_list { + char *string; + struct string_list *next; + struct string_list **tail; +}; + +void add_command(char*, char*, struct string_list*, unsigned); + +#endif /* __MAKE_CMDS_H__ */ diff --git a/crypto/heimdal/lib/sl/parse.y b/crypto/heimdal/lib/sl/parse.y new file mode 100644 index 0000000..18ef5ca --- /dev/null +++ b/crypto/heimdal/lib/sl/parse.y @@ -0,0 +1,168 @@ +%{ +/* + * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * 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. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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. + */ + +#include "make_cmds.h" +RCSID("$Id: parse.y,v 1.6 1999/12/16 10:34:11 assar Exp $"); + +void yyerror (char *s); +void error_message(char *, ...); + +struct string_list* append_string(struct string_list*, char*); +void free_string_list(struct string_list *list); +unsigned string_to_flag(const char *); + +/* This is for bison */ + +#if !defined(alloca) && !defined(HAVE_ALLOCA) +#define alloca(x) malloc(x) +#endif + +%} + +%union { + char *string; + unsigned number; + struct string_list *list; +} + +%token TABLE REQUEST UNKNOWN UNIMPLEMENTED END +%token <string> STRING +%type <number> flag flags +%type <list> aliases + +%% + +file : /* */ + | statements + ; + +statements : statement + | statements statement + ; + +statement : TABLE STRING ';' + { + table_name = $2; + } + | REQUEST STRING ',' STRING ',' aliases ',' '(' flags ')' ';' + { + add_command($2, $4, $6, $9); + } + | REQUEST STRING ',' STRING ',' aliases ';' + { + add_command($2, $4, $6, 0); + } + | UNIMPLEMENTED STRING ',' STRING ',' aliases ';' + { + free($2); + free($4); + free_string_list($6); + } + | UNKNOWN aliases ';' + { + free_string_list($2); + } + | END ';' + { + YYACCEPT; + } + ; + +aliases : STRING + { + $$ = append_string(NULL, $1); + } + | aliases ',' STRING + { + $$ = append_string($1, $3); + } + ; + +flags : flag + { + $$ = $1; + } + | flags ',' flag + { + $$ = $1 | $3; + } + ; +flag : STRING + { + $$ = string_to_flag($1); + free($1); + } + ; + + + +%% + +void +yyerror (char *s) +{ + error_message ("%s\n", s); +} + +struct string_list* +append_string(struct string_list *list, char *str) +{ + struct string_list *sl = malloc(sizeof(*sl)); + sl->string = str; + sl->next = NULL; + if(list) { + *list->tail = sl; + list->tail = &sl->next; + return list; + } + sl->tail = &sl->next; + return sl; +} + +void +free_string_list(struct string_list *list) +{ + while(list) { + struct string_list *sl = list->next; + free(list->string); + free(list); + list = sl; + } +} + +unsigned +string_to_flag(const char *string) +{ + return 0; +} diff --git a/crypto/heimdal/lib/sl/roken_rename.h b/crypto/heimdal/lib/sl/roken_rename.h new file mode 100644 index 0000000..c668802 --- /dev/null +++ b/crypto/heimdal/lib/sl/roken_rename.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1998 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * 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. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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. + */ + +/* $Id: roken_rename.h,v 1.3 1999/12/02 16:58:55 joda Exp $ */ + +#ifndef __roken_rename_h__ +#define __roken_rename_h__ + +#ifndef HAVE_STRTOK_R +#define strtok_r _sl_strtok_r +#endif +#ifndef HAVE_SNPRINTF +#define snprintf _sl_snprintf +#endif +#ifndef HAVE_ASPRINTF +#define asprintf _sl_asprintf +#endif +#ifndef HAVE_ASNPRINTF +#define asnprintf _sl_asnprintf +#endif +#ifndef HAVE_VASPRINTF +#define vasprintf _sl_vasprintf +#endif +#ifndef HAVE_VASNPRINTF +#define vasnprintf _sl_vasnprintf +#endif +#ifndef HAVE_VSNPRINTF +#define vsnprintf _sl_vsnprintf +#endif + +#endif /* __roken_rename_h__ */ diff --git a/crypto/heimdal/lib/sl/sl.c b/crypto/heimdal/lib/sl/sl.c new file mode 100644 index 0000000..688ca8b --- /dev/null +++ b/crypto/heimdal/lib/sl/sl.c @@ -0,0 +1,223 @@ +/* + * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * 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. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +RCSID("$Id: sl.c,v 1.25 1999/12/02 16:58:55 joda Exp $"); +#endif + +#include "sl_locl.h" + +static SL_cmd * +sl_match (SL_cmd *cmds, char *cmd, int exactp) +{ + SL_cmd *c, *current = NULL, *partial_cmd = NULL; + int partial_match = 0; + + for (c = cmds; c->name; ++c) { + if (c->func) + current = c; + if (strcmp (cmd, c->name) == 0) + return current; + else if (strncmp (cmd, c->name, strlen(cmd)) == 0 && + partial_cmd != current) { + ++partial_match; + partial_cmd = current; + } + } + if (partial_match == 1 && !exactp) + return partial_cmd; + else + return NULL; +} + +void +sl_help (SL_cmd *cmds, int argc, char **argv) +{ + SL_cmd *c, *prev_c; + + if (argc == 1) { + prev_c = NULL; + for (c = cmds; c->name; ++c) { + if (c->func) { + if(prev_c) + printf ("\n\t%s%s", prev_c->usage ? prev_c->usage : "", + prev_c->usage ? "\n" : ""); + prev_c = c; + printf ("%s", c->name); + } else + printf (", %s", c->name); + } + if(prev_c) + printf ("\n\t%s%s", prev_c->usage ? prev_c->usage : "", + prev_c->usage ? "\n" : ""); + } else { + c = sl_match (cmds, argv[1], 0); + if (c == NULL) + printf ("No such command: %s. " + "Try \"help\" for a list of all commands\n", + argv[1]); + else { + printf ("%s\t%s\n", c->name, c->usage); + if(c->help && *c->help) + printf ("%s\n", c->help); + if((++c)->name && c->func == NULL) { + printf ("Synonyms:"); + while (c->name && c->func == NULL) + printf ("\t%s", (c++)->name); + printf ("\n"); + } + } + } +} + +#ifdef HAVE_READLINE + +char *readline(char *prompt); +void add_history(char *p); + +#else + +static char * +readline(char *prompt) +{ + char buf[BUFSIZ]; + printf ("%s", prompt); + fflush (stdout); + if(fgets(buf, sizeof(buf), stdin) == NULL) + return NULL; + if (buf[strlen(buf) - 1] == '\n') + buf[strlen(buf) - 1] = '\0'; + return strdup(buf); +} + +static void +add_history(char *p) +{ +} + +#endif + +int +sl_command(SL_cmd *cmds, int argc, char **argv) +{ + SL_cmd *c; + c = sl_match (cmds, argv[0], 0); + if (c == NULL) + return -1; + return (*c->func)(argc, argv); +} + +struct sl_data { + int max_count; + char **ptr; +}; + +int +sl_make_argv(char *line, int *ret_argc, char ***ret_argv) +{ + char *foo = NULL; + char *p; + int argc, nargv; + char **argv; + + nargv = 10; + argv = malloc(nargv * sizeof(*argv)); + if(argv == NULL) + return ENOMEM; + argc = 0; + + for(p = strtok_r (line, " \t", &foo); + p; + p = strtok_r (NULL, " \t", &foo)) { + if(argc == nargv - 1) { + char **tmp; + nargv *= 2; + tmp = realloc (argv, nargv * sizeof(*argv)); + if (tmp == NULL) { + free(argv); + return ENOMEM; + } + argv = tmp; + } + argv[argc++] = p; + } + argv[argc] = NULL; + *ret_argc = argc; + *ret_argv = argv; + return 0; +} + +/* return values: 0 on success, -1 on fatal error, or return value of command */ +int +sl_command_loop(SL_cmd *cmds, char *prompt, void **data) +{ + int ret = 0; + char *buf; + int argc; + char **argv; + + ret = 0; + buf = readline(prompt); + if(buf == NULL) + return 1; + + if(*buf) + add_history(buf); + ret = sl_make_argv(buf, &argc, &argv); + if(ret) { + fprintf(stderr, "sl_loop: out of memory\n"); + free(buf); + return -1; + } + if (argc >= 1) { + ret = sl_command(cmds, argc, argv); + if(ret == -1) { + printf ("Unrecognized command: %s\n", argv[0]); + ret = 0; + } + } + free(buf); + free(argv); + return ret; +} + +int +sl_loop(SL_cmd *cmds, char *prompt) +{ + void *data = NULL; + int ret; + while((ret = sl_command_loop(cmds, prompt, &data)) == 0) + ; + return ret; +} diff --git a/crypto/heimdal/lib/sl/sl.h b/crypto/heimdal/lib/sl/sl.h new file mode 100644 index 0000000..1a6d3fa --- /dev/null +++ b/crypto/heimdal/lib/sl/sl.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * 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. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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. + */ + +/* $Id: sl.h,v 1.7 1999/12/02 16:58:55 joda Exp $ */ + +#ifndef _SL_H +#define _SL_H + +typedef int (*cmd_func)(int, char **); + +struct sl_cmd { + char *name; + cmd_func func; + char *usage; + char *help; +}; + +typedef struct sl_cmd SL_cmd; + +void sl_help (SL_cmd *, int argc, char **argv); +int sl_loop (SL_cmd *, char *prompt); +int sl_command_loop (SL_cmd *cmds, char *prompt, void **data); +int sl_command (SL_cmd *cmds, int argc, char **argv); +int sl_make_argv(char*, int*, char***); + + +#endif /* _SL_H */ diff --git a/crypto/heimdal/lib/sl/sl_locl.h b/crypto/heimdal/lib/sl/sl_locl.h new file mode 100644 index 0000000..4bd9660 --- /dev/null +++ b/crypto/heimdal/lib/sl/sl_locl.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * 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. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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. + */ + +/* $Id: sl_locl.h,v 1.6 1999/12/02 16:58:55 joda Exp $ */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> + +#include <roken.h> + +#include <sl.h> diff --git a/crypto/heimdal/lib/sl/ss.c b/crypto/heimdal/lib/sl/ss.c new file mode 100644 index 0000000..f3c0546 --- /dev/null +++ b/crypto/heimdal/lib/sl/ss.c @@ -0,0 +1,133 @@ +/* + * Copyright (c) 1998 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * 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. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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. + */ + +#include "sl_locl.h" +#include <com_err.h> +#include "ss.h" + +RCSID("$Id: ss.c,v 1.4 1999/12/02 16:58:55 joda Exp $"); + +struct ss_subst { + char *name; + char *version; + char *info; + ss_request_table *table; +}; + +static struct ss_subst subsystems[2]; +static int num_subsystems; + +int +ss_create_invocation(const char *subsystem, + const char *version, + const char *info, + ss_request_table *table, + int *code) +{ + struct ss_subst *ss; + if(num_subsystems >= sizeof(subsystems) / sizeof(subsystems[0])) { + *code = 17; + return 0; + } + ss = &subsystems[num_subsystems]; + ss->name = subsystem ? strdup(subsystem) : NULL; + ss->version = version ? strdup(version) : NULL; + ss->info = info ? strdup(info) : NULL; + ss->table = table; + *code = 0; + return num_subsystems++; +} + +void +ss_error (int index, long code, const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + com_err_va (subsystems[index].name, code, fmt, ap); + va_end(ap); +} + +void +ss_perror (int index, long code, const char *msg) +{ + ss_error(index, code, "%s", msg); +} + +int +ss_execute_command(int index, char **argv) +{ + int argc = 0; + while(argv[argc++]); + sl_command(subsystems[index].table, argc, argv); + return 0; +} + +int +ss_execute_line (int index, const char *line) +{ + char *buf = strdup(line); + int argc; + char **argv; + + sl_make_argv(buf, &argc, &argv); + sl_command(subsystems[index].table, argc, argv); + free(buf); + return 0; +} + +int +ss_listen (int index) +{ + char *prompt = malloc(strlen(subsystems[index].name) + 3); + if(prompt == NULL) { + abort(); + } + strcpy(prompt, subsystems[index].name); + strcat(prompt, ": "); + sl_loop(subsystems[index].table, prompt); + free(prompt); + return 0; +} + +int +ss_list_requests(int argc, char **argv /* , int index, void *info */) +{ + sl_help(subsystems[0 /* index */].table, argc, argv); + return 0; +} + +int +ss_quit(int argc, char **argv) +{ + return 1; +} diff --git a/crypto/heimdal/lib/sl/ss.h b/crypto/heimdal/lib/sl/ss.h new file mode 100644 index 0000000..0d9d297 --- /dev/null +++ b/crypto/heimdal/lib/sl/ss.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 1998 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * 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. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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. + */ +/* $Id: ss.h,v 1.2 1999/12/02 16:58:55 joda Exp $ */ + +/* SS compatibility for SL */ + +#ifndef __ss_h__ +#define __ss_h__ + +#include <sl.h> + +typedef SL_cmd ss_request_table; + +int ss_create_invocation (const char *, const char *, const char*, + ss_request_table*, int*); + +void ss_error (int, long, const char*, ...); +int ss_execute_command (int, char**); +int ss_execute_line (int, const char*); +int ss_list_requests (int argc, char**); +int ss_listen (int); +void ss_perror (int, long, const char*); +int ss_quit (int argc, char**); + +#endif /* __ss_h__ */ |