home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-08-25 | 36.8 KB | 1,356 lines |
- Newsgroups: comp.sources.misc
- From: Michel.Fingerhut@ircam.fr (Michel Fingerhut)
- Subject: v31i127: mkskel - create a skeleton for commonly used files, Part01/01
- Message-ID: <1992Aug26.150548.5216@sparky.imd.sterling.com>
- X-Md4-Signature: b7b5aedc1f09ff3b58aa4b957d1dc665
- Date: Wed, 26 Aug 1992 15:05:48 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: Michel.Fingerhut@ircam.fr (Michel Fingerhut)
- Posting-number: Volume 31, Issue 127
- Archive-name: mkskel/part01
- Environment: Perl
-
- Mkskel is a perl script used to create a "skeleton" file for commonly used
- files, such as C programs, Makefiles, etc..., where a standard format is
- required (e.g., including copyright, version control ...). It is easy to
- tailor, and easier to use:
-
- Create a skeletal C file:
-
- mkskel t.c
-
- Create a skeletal Makefile for a target library from sources:
-
- mkskel Makefile mylib.a *.c *.h *.[1-8]
-
- Same, but for executable target:
-
- mkskel Makefile myprog *.c *.h *.[1-8]
-
- -------------------------------- cut here -------------------------------------
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: README Makefile lib lib/COPYRIGHT lib/Makefile
- # lib/skel.README lib/skel.c lib/skel.cc lib/skel.csh lib/skel.h
- # lib/skel.lisp lib/skel.make lib/skel.man lib/skel.perl lib/skel.sh
- # mkskel.1 mkskel.pl
- # Wrapped by kent@sparky on Wed Aug 26 10:01:28 1992
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 1 (of 1)."'
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(392 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- XThis program is used to create "skeleton" files for the most common languages,
- Xinterpreters or data files (.h and, most notably, Makefiles). The prototype
- Xfor those skeleton files are easy to create, tailor and maintain.
- X
- XINSTALLATION
- X
- XConfiguration consists in modifying a couple of variables in the mkskel.sh
- Xfile, together with the paths to the standard interpreters in the %langs
- Xarray.
- END_OF_FILE
- if test 392 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(1620 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- X#
- X# Copyright (c) 1992 by IRCAM
- X# All rights reserved.
- X#
- X# For any information regarding this and other IRCAM software, please
- X# send email to:
- X# manager@ircam.fr
- X#
- X
- X#
- X# Makefile 1.6 IRCAM 8/25/92
- X#
- X# Makefile for mkskel
- X#
- X# Modification history
- X#
- X# 5-Aug-92 - Michel Fingerhut (fingerhu@ircam.fr)
- X#
- X
- XMAKEFILE := Makefile
- XTARGET := mkskel
- XROOTDIR := /usr/local
- XOWNER := root
- XGROUP := wheel
- X# Where executables and man pages go
- XBINDIR := $(ROOTDIR)/bin
- XLIBDIR := $(ROOTDIR)/lib
- XMANDIR := $(ROOTDIR)/man
- XDESTDIR := $(BINDIR)
- XSHFILES := mkskel.pl
- XTAPE := /dev/rmt0h
- XMANFILES1 := mkskel.1
- XMANFILES := mkskel.1
- XLIBFILES := lib/Makefile lib/COPYRIGHT $(wildcard lib/skel.*)
- XINSTMANFILES := $(addprefix $(MANDIR)/man1/, $(MANFILES1))
- X
- XSOURCE := README $(MAKEFILE) $(MANFILES) $(DOCFILES) $(SHFILES) \
- X $(OTHERS) $(INCLUDES) $(YACCFILES) $(LEXFILES) \
- X $(CFILES) $(FFILES) $(ASFILES)
- XLISTFILES := $(MAKEFILE) $(SHFILES) $(INCLUDES) $(YACCFILES) \
- X $(LEXFILES) $(CFILES) $(FFILES) $(ASFILES)
- X
- X.PHONY: all install uninstall clean depend
- Xall: $(TARGET)
- X
- Xinstall: $(DESTDIR)/$(TARGET) $(INSTMANFILES)
- X cd lib; $(MAKE) install
- X
- X
- Xuninstall:
- X rm -f $(DESTDIR)/$(TARGET) $(INSTMANFILES)
- X cd lib; $(MAKE) install
- X
- Xdepend:
- X
- X$(TARGET): $(TARGET).pl
- X cat $< > $@
- X chmod a+x $@
- X
- X$(DESTDIR)/$(TARGET): $(TARGET)
- X install -c -o $(OWNER) -g $(GROUP) -m 0755 $< $@
- X
- X$(MANDIR)/man1/% : %
- X install -c -o $(OWNER) -g $(GROUP) -m 0644 $< $@
- X
- Xshar:
- X shar $(SOURCE) $(LIBFILES) > mkskel.shar
- Xtar:
- X tar rfcb $(TAPE) 20 $(SOURCE)
- X
- Xclean:
- X -rm -f $(OBJECTS)
- X sccs clean
- X
- END_OF_FILE
- if test 1620 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test ! -d 'lib' ; then
- echo shar: Creating directory \"'lib'\"
- mkdir 'lib'
- fi
- if test -f 'lib/COPYRIGHT' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/COPYRIGHT'\"
- else
- echo shar: Extracting \"'lib/COPYRIGHT'\" \(392 characters\)
- sed "s/^X//" >'lib/COPYRIGHT' <<'END_OF_FILE'
- X$$COB
- X$$COM Copyright (c) $$YEAR by $$ORG
- X$$COM All rights reserved.
- X$$COM
- X$$COM For any information regarding this and other $$ORG software, please
- X$$COM send email to:
- X$$COM $$MANAGER
- X$$COE
- X
- X$$COB
- X$$COM $$FILENAME $$IDSTRING
- X$$COM
- X$$COM REPLACE WITH ONE LINE DESCRIPTION OF CONTENTS OF FILE
- X$$COM
- X$$COM $$LOGSTRING
- X$$COM
- X$$COM $$DATE - $$AUTHOR
- X$$COE
- END_OF_FILE
- if test 392 -ne `wc -c <'lib/COPYRIGHT'`; then
- echo shar: \"'lib/COPYRIGHT'\" unpacked with wrong size!
- fi
- # end of 'lib/COPYRIGHT'
- fi
- if test -f 'lib/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/Makefile'\"
- else
- echo shar: Extracting \"'lib/Makefile'\" \(909 characters\)
- sed "s/^X//" >'lib/Makefile' <<'END_OF_FILE'
- X#
- X# Copyright (c) 1992 by IRCAM
- X# All rights reserved.
- X#
- X# For any information regarding this and other IRCAM software, please
- X# send email to:
- X# manager@ircam.fr
- X#
- X
- X#
- X# Makefile %I% IRCAM %G%
- X#
- X# Makefile for mkskel/lib
- X#
- X# Modification history
- X#
- X# 5-Aug-92 - Nadia Boulanger (fingerhu@ircam.fr)
- X#
- X
- XMAKEFILE := Makefile
- XROOTDIR := /usr/local
- XOWNER := root
- XGROUP := wheel
- XLIBDIR := $(ROOTDIR)/lib/mkskel
- XSOURCES := COPYRIGHT skel.README skel.c skel.cc skel.csh skel.h \
- X skel.lisp skel.make skel.man skel.perl skel.sh
- XINSTFILES := $(addprefix $(LIBDIR)/, $(SOURCES))
- X
- X.PHONY: all install uninstall clean depend
- Xall:
- X
- Xinstall: $(LIBDIR) $(INSTFILES)
- X
- Xuninstall:
- X rm -f $(LIBDIR)
- X
- Xdepend:
- X
- X$(LIBDIR):
- X -mkdir $@; chown $(OWNER).$(ROOT) $@
- X
- X$(LIBDIR)/%: %
- X install -c -o $(OWNER) -g $(GROUP) -m 0644 $< $@
- X
- Xtar:
- X tar rfcb $(TAPE) 20 $(SOURCE)
- X
- Xclean:
- X sccs clean
- END_OF_FILE
- if test 909 -ne `wc -c <'lib/Makefile'`; then
- echo shar: \"'lib/Makefile'\" unpacked with wrong size!
- fi
- # end of 'lib/Makefile'
- fi
- if test -f 'lib/skel.README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/skel.README'\"
- else
- echo shar: Extracting \"'lib/skel.README'\" \(20 characters\)
- sed "s/^X//" >'lib/skel.README' <<'END_OF_FILE'
- X@@INCLUDE COPYRIGHT
- END_OF_FILE
- if test 20 -ne `wc -c <'lib/skel.README'`; then
- echo shar: \"'lib/skel.README'\" unpacked with wrong size!
- fi
- # end of 'lib/skel.README'
- fi
- if test -f 'lib/skel.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/skel.c'\"
- else
- echo shar: Extracting \"'lib/skel.c'\" \(134 characters\)
- sed "s/^X//" >'lib/skel.c' <<'END_OF_FILE'
- X#ifndef lint
- X@@IF SCCS
- Xstatic char sccsid[]= "$$IDSTRING";
- X@@ELSE
- Xstatic char rcsid[]= "$$IDSTRING";
- X@@FI
- X#endif
- X
- X@@INCLUDE COPYRIGHT
- END_OF_FILE
- if test 134 -ne `wc -c <'lib/skel.c'`; then
- echo shar: \"'lib/skel.c'\" unpacked with wrong size!
- fi
- # end of 'lib/skel.c'
- fi
- if test -f 'lib/skel.cc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/skel.cc'\"
- else
- echo shar: Extracting \"'lib/skel.cc'\" \(134 characters\)
- sed "s/^X//" >'lib/skel.cc' <<'END_OF_FILE'
- X#ifndef lint
- X@@IF SCCS
- Xstatic char sccsid[]= "$$IDSTRING";
- X@@ELSE
- Xstatic char rcsid[]= "$$IDSTRING";
- X@@FI
- X#endif
- X
- X@@INCLUDE COPYRIGHT
- END_OF_FILE
- if test 134 -ne `wc -c <'lib/skel.cc'`; then
- echo shar: \"'lib/skel.cc'\" unpacked with wrong size!
- fi
- # end of 'lib/skel.cc'
- fi
- if test -f 'lib/skel.csh' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/skel.csh'\"
- else
- echo shar: Extracting \"'lib/skel.csh'\" \(36 characters\)
- sed "s/^X//" >'lib/skel.csh' <<'END_OF_FILE'
- X#!$$INTERPRETER
- X@@INCLUDE COPYRIGHT
- END_OF_FILE
- if test 36 -ne `wc -c <'lib/skel.csh'`; then
- echo shar: \"'lib/skel.csh'\" unpacked with wrong size!
- fi
- # end of 'lib/skel.csh'
- fi
- if test -f 'lib/skel.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/skel.h'\"
- else
- echo shar: Extracting \"'lib/skel.h'\" \(20 characters\)
- sed "s/^X//" >'lib/skel.h' <<'END_OF_FILE'
- X@@INCLUDE COPYRIGHT
- END_OF_FILE
- if test 20 -ne `wc -c <'lib/skel.h'`; then
- echo shar: \"'lib/skel.h'\" unpacked with wrong size!
- fi
- # end of 'lib/skel.h'
- fi
- if test -f 'lib/skel.lisp' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/skel.lisp'\"
- else
- echo shar: Extracting \"'lib/skel.lisp'\" \(20 characters\)
- sed "s/^X//" >'lib/skel.lisp' <<'END_OF_FILE'
- X@@INCLUDE COPYRIGHT
- END_OF_FILE
- if test 20 -ne `wc -c <'lib/skel.lisp'`; then
- echo shar: \"'lib/skel.lisp'\" unpacked with wrong size!
- fi
- # end of 'lib/skel.lisp'
- fi
- if test -f 'lib/skel.make' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/skel.make'\"
- else
- echo shar: Extracting \"'lib/skel.make'\" \(5955 characters\)
- sed "s/^X//" >'lib/skel.make' <<'END_OF_FILE'
- X@@INCLUDE COPYRIGHT
- X
- XMAKEFILE := $$MAKEFILE
- XTARGET := $$TARGET
- XROOTDIR := $$HOME
- XOWNER := $$USER
- XGROUP := $$GROUP
- X
- X# Where executables and man pages go
- XBINDIR := $(ROOTDIR)/bin
- XLIBDIR := $(ROOTDIR)/lib
- XETCDIR := $(ROOTDIR)/etc
- XMANDIR := $(ROOTDIR)/man
- X@@IF LIB
- XDESTDIR := $(LIBDIR)
- X@@ELSE
- XDESTDIR := $(BINDIR)
- X@@FI
- X
- X@@IF A.OUT|LIB
- XCPREFIX :=
- XCC := $(CPREFIX)cc
- XINCLUDE := /usr/local/include
- XCPPFLAGS := $(addprefix -I, $(INCLUDE))
- XCFLAGS := -O
- X@@IF YACCFILES
- XYFLAGS := -d
- X@@FI
- X@@IF FFILES
- XFFLAGS := -onetrip -w66 -O
- X@@FI
- XLDFLAGS := -n
- XLIBS := -lm
- XLINT := $(CPREFIX)lint $(CPPFLAGS) $(CFLAGS) -habx
- XAR := $(CPREFIX)ar
- XLORDER := $(CPREFIX)lorder
- XRANLIB := $(CPREFIX)ranlib
- X
- X@@IF INCLUDES
- XINCLUDES := $$INCLUDES
- X@@FI
- X@@IF CFILES
- XCFILES := $$CFILES
- X@@FI
- X@@IF CCFILES
- XCCFILES := $$CCFILES
- X@@FI
- X@@IF FFILES
- XFFILES := $$FFILES
- X@@FI
- X@@IF ASFILES
- XASFILES := $$ASFILES
- X@@FI
- X@@IF YACCFILES
- XYACCFILES := $$YACCFILES
- X@@FI
- X@@IF LEXFILES
- XLEXFILES := $$LEXFILES
- X@@FI
- X@@FI
- X@@IF SHFILES
- XSHFILES := $$SHFILES
- X@@FI
- XTAPE := /dev/rmt0h
- X@@IF MANFILES1
- XMANFILES1 := $$MANFILES1
- X@@FI
- X@@IF MANFILES2
- XMANFILES2 := $$MANFILES2
- X@@FI
- X@@IF MANFILES3
- XMANFILES3 := $$MANFILES3
- X@@FI
- X@@IF MANFILES4
- XMANFILES4 := $$MANFILES4
- X@@FI
- X@@IF MANFILES5
- XMANFILES5 := $$MANFILES5
- X@@FI
- X@@IF MANFILES6
- XMANFILES6 := $$MANFILES6
- X@@FI
- X@@IF MANFILES7
- XMANFILES7 := $$MANFILES7
- X@@FI
- X@@IF MANFILES8
- XMANFILES8 := $$MANFILES8
- X@@FI
- X@@IF MANFILES1|MANFILES2|MANFILES3|MANFILES4|MANFILES5|MANFILES6|MANFILES7|MANFILES8
- XMANFILES := $${MANFILES1?$(MANFILES1)} $${MANFILES2?$(MANFILES2)} $${MANFILES3?$(MANFILES3)} $${MANFILES4?$(MANFILES4)} $${MANFILES5?$(MANFILES5)} $${MANFILES6?$(MANFILES6)} $${MANFILES6?$(MANFILES7)} $${MANFILES8?$(MANFILES8)}
- XINSTMANFILES := $${MANFILES1?$(addprefix $(MANDIR)/man1/, $(MANFILES1))} $${MANFILES2?$(addprefix $(MANDIR)/man2/, $(MANFILES2))} $${MANFILES3?$(addprefix $(MANDIR)/man3/, $(MANFILES3))} $${MANFILES4?$(addprefix $(MANDIR)/man4/, $(MANFILES4))} $${MANFILES5?$(addprefix $(MANDIR)/man5/, $(MANFILES5))} $${MANFILES6?$(addprefix $(MANDIR)/man6/, $(MANFILES6))} $${MANFILES7?$(addprefix $(MANDIR)/man7/, $(MANFILES7))} $${MANFILES8?$(addprefix $(MANDIR)/man8/, $(MANFILES8))}
- X@@FI
- XINSTTARGET := $(addprefix $(DESTDIR)/, $(TARGET))
- X
- X@@IF DOCFILES
- XDOCFILES := $$DOCFILES
- X@@FI
- X@@IF A.OUT|LIB
- XOBJECTS := $${CFILES?$(subst .c,.o,$(CFILES))} $${CCFILES?$(subst .cc,.o,$(CCFILES))} $${CCFILES?$(subst .c++,.o,$(CCFILES))} $${FFILES?$(subst .f,.o,$(FFILES))} $${YACCFILES?$(subst .y,.o,$(YACCFILES))} $${LEXFILES?$(subst .l,.o,$(LEXFILES))} $${ASFILES?$(subst .s,.o,$(ASFILES))}
- X@@FI
- XSOURCE := $(MAKEFILE) $(MANFILES) $(DOCFILES) $(SHFILES) \
- X $(INCLUDES) $(YACCFILES) $(LEXFILES) \
- X $(CFILES) $(FFILES) $(ASFILES)
- X
- X.PHONY: all install uninstall clean depend
- Xall: $(TARGET)
- X
- Xinstall: $(INSTTARGET) $(INSTMANFILES)
- X
- Xuninstall:
- X rm -f $(INSTTARGET) $(INSTMANFILES)
- X
- X@@IF A.OUT|LIB
- Xdepend: Mkfile.depend
- X
- XMkfile.depend: $(YACCFILES) $(LEXFILES) $(CFILES) $(FFILES) $(INCLUDES)
- X @echo "# Automatically generated dependencies" > Mkfile.depend
- X@@IF MKDEPEND
- X $$MKDEPEND $(CPPFLAGS) $(YACCFILES) $(LEXFILES) $(CCFILES) \
- X $(CFILES) $(FFILES) >> Mkfile.depend
- X@@ELSE
- X -@for i in $(YACCFILES) $(LEXFILES) $(CFILES) $(FFILES) ; do\
- X base=`expr \$\$i ':' '\(.*\).[cylf]\$\$'`;\
- X suffix=`expr \$\$i ':' '.*\.\([cylf]\)\$\$'`;\
- X@@IF LEXFILES
- X if /bin/test \$\$suffix = l ; then\
- X lex \$\$i;\
- X mv lex.yy.c \$\$base.c;\
- X suffix=c;\
- X echo "\$\$base.c: \$\$base.l" >> Mkfile.depend;\
- X@@IFN YACCFILES
- X fi;\
- X@@FI
- X@@FI
- X@@IF YACCFILES
- X $${LEXFILES?el}if /bin/test \$\$suffix = y ; then\
- X yacc $(YFLAGS) \$\$i;\
- X mv y.tab.c \$\$base.c;\
- X suffix=c;\
- X echo "\$\$base.c: \$\$base.y" >> Mkfile.depend;\
- X echo "y.tab.h: \$\$base.y" >> Mkfile.depend;\
- X fi;\
- X@@FI
- X $(CC) $(CPPFLAGS) -E \$\$base.\$\$suffix |\
- X grep '^# [0-9][0-9]* ".*"\$\$' > /tmp/grep\$\$\$\$;\
- X sed -e 's/.*"\(.*\)"\$\$/\1/' -e 's/^.\///' < /tmp/grep\$\$\$\$ |\
- X sort -u |\
- X awk\
- X "BEGIN { line=\"\$\$base.o: \"}\
- X {\
- X if(length(line \\$\$0)>63)\
- X {\
- X print line,\"\\\\\";\
- X line=\" \"\\$\$0\
- X }\
- X else\
- X line=line\" \"\\$\$0\
- X }\
- X END { print line}"\
- X >> Mkfile.depend;\
- X done;\
- X rm /tmp/grep\$\$\$\$
- X@@FI
- X@@ELSE
- Xdepend:
- X@@FI
- X
- X@@IF SH
- X$(TARGET): $(TARGET).sh
- X@@FI
- X@@IF PERL
- X$(TARGET): $(TARGET).pl
- X cat $< > $@
- X chmod a+x $@
- X@@FI
- X@@IF CSH
- X$(TARGET): $(TARGET).csh
- X cat $< > $@
- X chmod a+x $@
- X@@FI
- X@@IF A.OUT
- X$(TARGET): $(OBJECTS)
- X $(CC) $(LDFLAGS) $(OBJECTS) -o $(TARGET) $(LIBS)
- X size $(TARGET)
- X@@FI
- X@@IF LIB
- X$(TARGET): $(OBJECTS)
- X -rm $(TARGET)
- X $(AR) rcv $(TARGET) `$(LORDER) $(OBJECTS) | tsort`
- X -$(RANLIB) $(TARGET)
- X@@FI
- X
- X$(DESTDIR)/%: %
- X@@IF A.OUT|CSH|SH|PERL
- X install -c -o $(OWNER) -g $(GROUP) -m 0755 $< $@
- X@@ELSE
- X install -c -o $(OWNER) -g $(GROUP) -m 0644 $< $@
- X@@FI
- X@@IF LIB
- X -$(RANLIB) $@
- X@@FI
- X
- X@@IF MANFILES1
- X$(MANDIR)/man1/% : %
- X install -c -o $(OWNER) -g $(GROUP) -m 0644 $< $@
- X@@FI
- X@@IF MANFILES2
- X$(MANDIR)/man2/% : %
- X install -c -o $(OWNER) -g $(GROUP) -m 0644 $< $@
- X@@FI
- X@@IF MANFILES3
- X$(MANDIR)/man3/% : %
- X install -c -o $(OWNER) -g $(GROUP) -m 0644 $< $@
- X@@FI
- X@@IF MANFILES4
- X$(MANDIR)/man4/% : %
- X install -c -o $(OWNER) -g $(GROUP) -m 0644 $< $@
- X@@FI
- X@@IF MANFILES5
- X$(MANDIR)/man5/% : %
- X install -c -o $(OWNER) -g $(GROUP) -m 0644 $< $@
- X@@FI
- X@@IF MANFILES6
- X$(MANDIR)/man6/% : %
- X install -c -o $(OWNER) -g $(GROUP) -m 0644 $< $@
- X@@FI
- X@@IF MANFILES7
- X$(MANDIR)/man7/% : %
- X install -c -o $(OWNER) -g $(GROUP) -m 0644 $< $@
- X@@FI
- X@@IF MANFILES8
- X$(MANDIR)/man8/% : %
- X install -c -o $(OWNER) -g $(GROUP) -m 0644 $< $@
- X@@FI
- X
- Xtar:
- X tar rfcb $(TAPE) 20 $(SOURCE)
- X
- Xshar: $(TARGET).shar
- X
- X$(TARGET).shar: $(SOURCE)
- X shar $^ > $@
- X
- Xclean:
- X -rm -f $(OBJECTS)
- X@@IF SCCS
- X sccs clean
- X@@ELSE
- X rcsclean
- X@@FI
- X
- X@@IF A.OUT|LIB
- XMkfile.depend:
- X if [ ! -f Mkfile.depend ] ; then echo > Mkfile.depend ; fi
- Xinclude Mkfile.depend
- X@@MESSAGE Don't forget to make depend to finish the job.
- X@@FI
- X@@MESSAGE Done.
- END_OF_FILE
- if test 5955 -ne `wc -c <'lib/skel.make'`; then
- echo shar: \"'lib/skel.make'\" unpacked with wrong size!
- fi
- # end of 'lib/skel.make'
- fi
- if test -f 'lib/skel.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/skel.man'\"
- else
- echo shar: Extracting \"'lib/skel.man'\" \(392 characters\)
- sed "s/^X//" >'lib/skel.man' <<'END_OF_FILE'
- X.TH $$NAME $$SECTION "$$IDSTRING"
- X@@INCLUDE COPYRIGHT
- X.SH $$NAME
- X$$name - description
- X.SH SYNOPSIS
- X.B $$name
- X[
- X.B \-keyword
- X]
- X[
- X.I parameter
- X]
- X.I parameter
- X.SH DESCRIPTION
- X.PP
- X.B $$Name
- Xdescription
- X.SH OPTIONS
- X.TP
- X\fB\-keyword \fIoption\fP
- Xaction
- X.TP
- X\fIparameter\fP
- Xaction
- X.SH FILES
- X.nf
- X.ta \w'longestfilename 'u
- X\fIfilename\fR description
- X.fi
- X.SH "SEE ALSO"
- X.SH BUGS
- X.SH AUTHOR
- X$$AUTHOR
- END_OF_FILE
- if test 392 -ne `wc -c <'lib/skel.man'`; then
- echo shar: \"'lib/skel.man'\" unpacked with wrong size!
- fi
- # end of 'lib/skel.man'
- fi
- if test -f 'lib/skel.perl' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/skel.perl'\"
- else
- echo shar: Extracting \"'lib/skel.perl'\" \(730 characters\)
- sed "s/^X//" >'lib/skel.perl' <<'END_OF_FILE'
- X#!$$INTERPRETER
- X@@INCLUDE COPYRIGHT
- X$[ = 1; # set array base to 1
- X$, = ' '; # set output field separator
- X$\ = "\n"; # set output record separator
- X
- X($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst) = localtime(time);
- X%month= ( 1, 'Jan', 2, 'Feb', 3, 'Mar', 4, 'Apr', 5, 'May', 6, 'Jun',
- X 7, 'Jul', 8, 'Aug', 9, 'Sep', 10, 'Oct', 11, 'Nov', 12, 'Dec');
- X
- X$date= sprintf("%2d-%s-%d", $mday, $month{$mon+1}, $year);
- X
- X$options = ':v'; # for getopts
- X$usage = "Usage: $0 [-v]\n"; # if failed
- X
- X# parse arguments
- Xrequire 'getopts.pl';
- X&Getopts($options) || die $usage ; # parse the arguments
- X
- X# -v: print version and exit
- Xif (defined $opt_v) {
- X print '$$IDSTRING';
- X exit;
- X}
- END_OF_FILE
- if test 730 -ne `wc -c <'lib/skel.perl'`; then
- echo shar: \"'lib/skel.perl'\" unpacked with wrong size!
- fi
- # end of 'lib/skel.perl'
- fi
- if test -f 'lib/skel.sh' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lib/skel.sh'\"
- else
- echo shar: Extracting \"'lib/skel.sh'\" \(36 characters\)
- sed "s/^X//" >'lib/skel.sh' <<'END_OF_FILE'
- X#!$$INTERPRETER
- X@@INCLUDE COPYRIGHT
- END_OF_FILE
- if test 36 -ne `wc -c <'lib/skel.sh'`; then
- echo shar: \"'lib/skel.sh'\" unpacked with wrong size!
- fi
- # end of 'lib/skel.sh'
- fi
- if test -f 'mkskel.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mkskel.1'\"
- else
- echo shar: Extracting \"'mkskel.1'\" \(7484 characters\)
- sed "s/^X//" >'mkskel.1' <<'END_OF_FILE'
- X.TH MKSKEL 1 "IRCAM 2.6 8/25/92"
- X.SH NAME
- Xmkskel - create standard skeleton files for man pages, shell scripts, C programs, etc...
- X.SH SYNOPSIS
- X.B mkskel
- X[
- X.B \-v
- X]
- X[
- X.B \-r
- X]
- X[
- X.BI \-t
- X.I skeleton-file-type
- X]
- X[
- X.B \-s
- X.I target-type
- X]
- X[
- X.B \-l
- X.I dir
- X]
- X[
- X.I skeleton-file
- X[
- X.I target
- X[
- X.I files, ...
- X]
- X]
- X]
- X.SH DESCRIPTION
- X.PP
- X.B Mkskel
- Xcreates a file named
- X.B file
- X(or on standard output, if not specified)
- Xwhich is a standard skeleton for C, C++, lisp programs, man
- Xpages, shell and perl scripts, README and Makefiles.
- XIt comprizes some copyright and version control information,
- Xas well as a standard beginning for some type of programs (e.g., perl).
- XIt can be used for multiple targets (see below MULTIPLE TARGETS
- Xsection).
- X.SH EXAMPLES
- XCreate a main.c prototype file for a C program:
- X.EX 5
- Xmkskel main.c
- X.EE
- X
- XCreate a prototype lisp program on stdout and redirect it somewhere
- X.EX 5
- Xmkskel -t lisp > setf.lsp
- X.EE
- X
- XCreate a prototype man page for a section 7 documentation:
- X.EX 5
- Xmkskel mydoc.7
- X.EE
- X
- XCreate a prototype Makefile for a target executable called ``myprog''
- Xfrom all sources, includes, docs in the current directory:
- X.EX 5
- Xmkskel Makefile myprog *.c *.h *.[1-8]
- X.EE
- X
- XSame, for a library:
- X.EX 5
- Xmkskel Makefile mylib.a *.c *.h *.[1-8]
- X.EE
- X
- XCreate a README file:
- X.EX 5
- Xmkskel README
- X.EE
- X.SH OPTIONS
- X.TP
- X.B \-v
- Xprint version of this program and exit.
- X.B \-r
- Xinsert RCS version control keywords (default is SCCS).
- X.TP
- X.BI \-t\ file-type
- XDetermine the type of the prototype to be created
- Xfrom this flag. It can currently be
- X.B c, cc,
- X.B lisp, perl,
- X.B sh, csh, h, man
- Xfor C, C++, lisp programs, perl, sh and csh scripts, include files
- Xand man pages. It not present, it is infered from the name
- Xof the file.
- X.TP
- X.BI \-s\ target-type
- X(Only for Makefiles) determine the type of the target to be created
- X.B a.out
- Xif the target is an executable compiled from sources,
- X.B lib
- Xif the target is a library
- X.B sh, csh, perl
- Xif the target is an executable script in sh, csh or perl.
- XIf not specified, it tries to infer it
- Xfrom the target name.
- X.I Makefile
- Xis the name of the makefile to be generated,
- X.I target
- Xthe target name, and
- X.I files
- Xare the names of the files from which the target is
- Xto be generated. Examples:
- X.sp 1
- Xcreate a library from sources:
- X.EX 5
- Xmkskel Makefile mylib.a *.c *.h *.[1-8]
- X.EE
- X.sp 1
- Xcreate an executable a.out called myprog:
- X.EX 5
- Xmkskel -s a.out Makefile myprog *.c *.h
- X.EE
- X.sp 1
- Xcreate an executable shell script:
- X.EX 5
- Xmkskel -s sh Makefile myscript *.sh *.1
- X.EE
- X.EE
- X.TP
- X.BI \-l\ dir
- XIs the name of a directory containing prototypical skeletons. If not
- Xmentioned, it defaults to the variable
- X.B $LIBSKEL
- Xif it is defined in the program, and if not, to
- X.B \./lib.
- X.TP
- X.I file
- XIs the name of the output file. If no type has been specified through
- Xthe
- X.B \-l
- Xflag, the program tries to determine it from the extension of the file name.
- XThe most common extensions are recognized (.c, .cc, .pl, .sh, .csh, .h, and
- X\.1 through \.8).
- X.SH MULTIPLE TARGETS
- XIn order to create a file for multiple targets, proceed as above, by specifying
- Xjust one of the targets. Then modify the Makefile accordingly:
- X.TP
- XAll targets go to the same destination directory
- X(E.g., all executables, or all libraries, etc...)
- XPut all their names in the
- X.B TARGET :=
- Xline, e.g.,
- X.EX 5
- XTARGET := prog1 prog2 prog3 ...
- X.EE
- X.TP
- XTargets for different destinations
- X(E.g., libraries, executables, etc...) Modify the
- X.B INSTTARGET
- Xrule according to the various destinations. Make sure there are
- Xappropriate creation and install
- Xrules for each type of target.
- X.SH PROTOTYPE FILES
- XThe prototype files contain text, directives and variables which get
- Xexecuted and substituted when read. The recognized directive are:
- X.TP
- X.B @@ELSE
- Xdenotes the starting alternative branch of an
- X.B @@IF.
- X.TP
- X.B @@FI
- Xdenotes the end of the
- X.B @@IF ... ( @@ELSE )
- Xor
- X.B @@IFN ... ( @@ELSE )
- Xscope.
- X.TP
- X.BI @@IF\ condition
- XThe following lines until the next
- X.B @@ELSE
- Xor
- X.B @@FI
- Xare included if the
- X.I condition
- Xevaluates to true. Conditions are of the form
- X.I var
- Xor
- X.I var|var...
- Xor
- X.I var&var...
- Xwhere
- X.I var
- Xare variables in
- X.B mkskel (see further down). The
- X.B @@ELSE
- Xbranch is not mandatory, and the constructs can be nested.
- X.TP
- X.BI @@IFN\ condition
- XAs above, but if the condition evaluates to false
- X.TP
- X.BI @@INCLUDE\ file
- Xwhich includes at this point a file named
- X.I file
- Xfrom the lib directory.
- X.TP
- X.BI @@MESSAGE\ text
- Xprints the
- X.I text
- Xon stderr (e.g., operator message, error, etc...).
- X
- XThe following variables are recognized and substituted:
- X.TP
- X.B $$AUTHOR
- XFull name and email address of author of the program.
- X.TP
- X.B $$COB, $$COM, $$COE
- XDenote the strings identifying the beginning of a comment (e.g., /* for C),
- Xthe "middle" of a comment (no real meaning other than cosmetic -- set to
- X" *" for C, see skel.c for a use) and the end of a comment. For most
- Xcases, all three are identical.
- X.TP
- X.B $$DATE
- XToday's date in dd-mmm-yy format.
- X.TP
- X.B $$FILENAME
- XName of the file (default: blank). See also
- X.B $$NAME.
- X.TP $$GROUP
- XName of the group to which the user belongs.
- X.TP
- X.B $$HOME
- XHome directory of the user.
- X.TP
- X.B $$IDSTRING
- XVersion control string, typically RCS or SCCS (defaults to an SCCS-type
- Xstring if not defined). Care must be taken in defining this string in
- Xthe program, so as to prevent the version control of the program to
- Xmuck with this string!
- X.TP
- X.B $$INTERPRETER
- XPath to interpreter for interpreted languages.
- X.TP
- X.B $$LOGSTRING
- XVersion history log (e.g.,
- X.B $Log$
- Xfor RCS). Same care as for
- X.B $$IDSTRING
- X(default is "Modification history").
- X.TP
- X.B $$MAILHOST
- XFully qualified name of the machine on which author of program can be found
- X(default: local machine).
- X.TP
- X.B $$MANAGER
- XEmail address of the person to whom to send enquiries about the program
- X(default: root on local machine).
- X.TP
- X.B $$NAME, $$Name, $$Name
- XName of file stripped of its extension in uppercase, in initial uppercase
- Xand in lower case taken from file name (default is "NAME").
- X.TP
- X.B $$ORG
- XThe name of the organization, if defined in the program, or else the one
- Xbut last component of the fully qualified name of the machine on which
- Xthe program is executed.
- X.TP
- X.B $$RCS
- XDefined if RCS is the version control system used, as required
- Xwith the
- X.B \-r
- Xflag (default is SCCS).
- X.TP
- X.B $$SCCS
- XDefined if SCCS is the version control system used (default).
- X.TP
- X.B $$SECTION
- XSection number for man pages (default: 1).
- X.TP
- X.B $$USER
- XUser name (login) of the user running the program.
- X.TP
- X.B $$YEAR
- XCurrent year (4 digit number).
- X.TP
- X.BI $${ condition\fB:\fPtext }
- XIf
- X.I condition
- Xevaluates to true, then subsitute
- X.I text
- Xat this point, else nothing.
- X
- XIn the special case of Makefiles, an additional set of variables is
- Xdefined:
- X.B $$INCLUDES, $$CFILES, $$CCFILES, $$FFILES
- X.B $$ASFILES, $$YACCFILES, $$LIBFILES
- X.B $$LEXFILES, $$SHFILES,
- X.B $$MANFILES1 - $$MANFILES8
- Xand
- X.B $$DOCFILES
- Xwhich will contain the list of files of each type among the arguments to the
- Xcommand. Those variables can later be used in conditionals.
- X.SH CONFIGURATION
- XThe program is configured by setting several (optional) variables in
- Xits beginning, as well as by changing the location of the language
- Xinterpreters as specified in the associative array
- X.B %types.
- X.SH FILES
- X.TP
- X.B /usr/local/lib/mkskel/*
- X(or the directory specified with the
- X.B \-l
- Xflag) contains the prototypical files for each type. Their name is of
- Xthe form
- X.BI skel. type .
- X.SH "SEE ALSO"
- Xmakemake(1)
- X.SH AUTHOR
- XMichel Fingerhut (fingerhu@ircam.fr)
- END_OF_FILE
- if test 7484 -ne `wc -c <'mkskel.1'`; then
- echo shar: \"'mkskel.1'\" unpacked with wrong size!
- fi
- # end of 'mkskel.1'
- fi
- if test -f 'mkskel.pl' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'mkskel.pl'\"
- else
- echo shar: Extracting \"'mkskel.pl'\" \(10104 characters\)
- sed "s/^X//" >'mkskel.pl' <<'END_OF_FILE'
- X#!/usr/local/bin/perl
- X# Copyright (c) 1992 by IRCAM
- X# All rights reserved.
- X#
- X# For any information regarding this and other IRCAM software, please
- X# send email to:
- X# manager@ircam.fr
- X
- X#
- X# mkskel 2.8 IRCAM 8/24/92
- X#
- X# Create a skeleton file for a program in C, perl or sh.
- X#
- X# Modification history
- X#
- X# 28-Jul-92 - Michel Fingerhut (fingerhu@ircam.fr)
- X#
- X
- X#------------------------------------------------------------------------------
- X# site-dependent configurable part (optional)
- X#------------------------------------------------------------------------------
- X
- X$ORG = "IRCAM"; # no blanks
- X$MAILHOST = "ircam.fr"; # fully qualified name (where author is)
- X$MANAGER = "manager@ircam.fr"; # full address whom to send questions to
- X$IDSTRING = "%I\045 $ORG \045G%"; # for SCCS, e.g.. (\045=%...)
- X$LOGSTRING= "Modification history"; # for RCS, might be $Log$, e.g.
- X$LIBSKEL = "/usr/local/lib/mkskel"; # where the skeletons are
- X$NAME = "NAME"; # default if not specified
- X$MKDEPEND = "cc -Em"; # or "gcc -M"; if none, default code
- X
- X#------------------------------------------------------------------------------
- X# end of configuration
- X#------------------------------------------------------------------------------
- X
- X$[ = 1; # set array base to 1
- X$, = ' '; # set output field separator
- X$\ = "\n"; # set output record separator
- X
- X($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst) = localtime(time);
- X%month= ( 1, 'Jan', 2, 'Feb', 3, 'Mar', 4, 'Apr', 5, 'May', 6, 'Jun',
- X 7, 'Jul', 8, 'Aug', 9, 'Sep', 10, 'Oct', 11, 'Nov', 12, 'Dec');
- Xchop($hostname= `hostname`);
- X$options = "s:l:t:rv";
- X$usage = "Usage: $0 [-v] [-r] [-l dir] [-t type] [-s source] [file]\n";
- Xrequire 'getopts.pl';
- X
- X# check arguments and exit (before all the rest) if wrong
- X
- X&Getopts($options) || die $usage ; # parse the arguments
- X
- Xif ($opt_v) {
- X print "2.8 IRCAM 8/24/92";
- X exit;
- X}
- X
- Xif ($opt_r) {
- X ($IDSTRING, $LOGSTRING, $RCS) =('$Revision$ '."$ORG".' $Date$', '$Log$', 1);
- X} else {
- X $SCCS= 1;
- X}
- X
- X#------------------------------------------------------------------------------
- X# File types: pattern:INTERPRETER:COB:COM:COE
- X#------------------------------------------------------------------------------
- X%types = ("c", ".+\.c::/*: *: */",
- X "cc", ".+\.cc:://://://",
- X "csh", ".+\.csh:/bin/csh:\043:\043:\043",
- X "h", ".+\.h::/*: *: */",
- X "lisp", ".+\.l::;:;:;",
- X "man", ".+.\[1-8]::.\\\":.\\\":.\\\"",
- X "perl", ".+\.pl|perl:/usr/local/bin/perl:#:#:#",
- X "sh", ".+\.sh:/bin/sh:#:#:#",
- X "make", "[Mm]akefile:/usr/local/bin/make:#:#:#",
- X "README", "[Rr][Ee][Aa][Dd][Mm][Ee]::::"
- X );
- X
- X#------------------------------------------------------------------------------
- X# File types for Makefiles: pattern for name, name of variable
- X#------------------------------------------------------------------------------
- X
- X%subtypes= (".*\\.h", "INCLUDES",
- X ".*\\.c", "CFILES",
- X ".*\\.(cc|c\\+\\+)", "CCFILES",
- X ".*\\.f", "FFILES",
- X ".*\\.s", "ASFILES",
- X ".*\\.y", "YACCFILES",
- X ".*\\.a", "LIBFILES",
- X ".*\\.l", "LEXFILES",
- X ".*\\.(sh|csh|pl)", "SHFILES",
- X ".*\\.1", "MANFILES1",
- X ".*\\.2", "MANFILES2",
- X ".*\\.3", "MANFILES3",
- X ".*\\.4", "MANFILES4",
- X ".*\\.5", "MANFILES5",
- X ".*\\.6", "MANFILES6",
- X ".*\\.7", "MANFILES7",
- X ".*\\.8", "MANFILES8",
- X ".*\\.(mm|me|doc|tex)", "DOCFILES",
- X "README|INSTALL", "DOCFILES",
- X );
- X
- X%subtype =("lib", 1, "sh", 1, "a.out", 1, "perl", 1, "csh", 1);
- X
- X#-----------------------------------------------------------------------------
- X# Check arguments
- X#------------------------------------------------------------------------------
- X
- X$LIBDIR= $opt_l || $LIBSKEL || "./lib"; # where the skeletons are
- X
- Xdie "Unknown file type\n" if defined $opt_t && ! defined $types{$opt_t};
- X
- Xif ($#ARGV) {
- X $file= $ARGV[1];
- X ($suffix= $file) =~ s/.*\.//;
- X}
- X
- X#-----------------------------------------------------------------------------
- X# Variables likely to be substituted
- X#------------------------------------------------------------------------------
- X
- X$MAILHOST = (gethostbyname($hostname))[1] unless defined $MAILHOST;
- X$MANAGER = "root@$MAILHOST" unless defined $MANAGER;
- X$ORG = "\U$1\E" if !defined $ORG && $MAILHOST =~ /\.([^\.]+)\.[^\.]*/;
- X$IDSTRING = "%I\045 $ORG \045G%" unless defined $IDSTRING;
- X$LOGSTRING= $IDSTRING unless defined $LOGSTRING;
- X$DATE = sprintf("%2d-%s-%d", $mday, $month{$mon+1}, $year);
- X$LOGIN = getlogin || (getpwuid($<))[1];
- X$AUTHOR = sprintf ("%s (%s@%s)", (getpwuid($<))[7], $LOGIN, $MAILHOST);
- X$USER = $ENV{'USER'};
- X$HOME = $ENV{'HOME'};
- X$GROUP = (getgrgid((getpwuid($<))[4]))[1];
- X$YEAR = "19$year"; # soon to modify...
- X$FILENAME = $file if defined $file; # else stdout
- X$NAME = (split(/\./, "\U$file\E"))[1] if defined $file; # else default
- X$Name = "\U$1\E\L$2\E" if $NAME=~ /(.)(.*)/;
- X$name = "\L$NAME\E";
- X#-----------------------------------------------------------------------------
- X# Determine type and execute
- X#------------------------------------------------------------------------------
- X
- Xif (defined $opt_t) {
- X $type= $opt_t;
- X} else {
- X foreach $t (keys %types) {
- X $pattern= (split(/:/, $types{$t}))[1];
- X $type= $t, last if defined $file && $file =~ /^$pattern$/;
- X }
- X}
- Xdie "Can't tell which type!\n" if ! defined $type;
- X($pattern, $INTERPRETER, $COB, $COM, $COE)= split(/:/, $types{$type});
- X$SECTION= $suffix =~ /^[1-8]$/ ? $suffix : 1 if $type eq "man";
- X
- X# special treatment for Makefiles
- X
- Xif ($type eq "make") {
- X
- X # Target name comes right next, no default
- X
- X $MAKEFILE= $ARGV[1] || "Makefile" ;
- X $TARGET = $ARGV[2] || "a.out";
- X
- X # Type of processing (a.out, sh, lib, perl, csh)
- X
- X if (defined $opt_s) {
- X die "Unknown source type\n" if ! defined $subtype{$opt_s};
- X $subtype = $opt_s;
- X } elsif ($TARGET =~ /.a$/) {
- X $subtype = "lib";
- X } else {
- X $subtype = "a.out";
- X }
- X $subtype=~ s/\./_/g;
- X eval "\$\U$subtype\E= 1";
- X
- X # Define all variables according to the rest of the files
- X
- X foreach $file (@ARGV[3..$#ARGV]) {
- X foreach $s (keys %subtypes) {
- X eval "\$$subtypes{$s} .= \"$file \"", last if $file =~ /^$s$/;
- X }
- X }
- X}
- X
- X# now open the output and perform
- X
- X&openfile($file) if defined $file;
- X&dofile("$LIBDIR/skel.$type");
- X
- X#------------------------------------------------------------------------------
- X# Open output file with backup
- X#------------------------------------------------------------------------------
- X
- Xsub openfile {{
- X local($file)= $_[1];
- X if (-e $file) {
- X die "Files $file and $file.bak exist, not overwritten\n"
- X if -e "$file.bak";
- X print STDERR "renaming existing $file to $file.bak";
- X rename($file, "$file.bak");
- X }
- X open (STDOUT, ">$file") || die "Can't open $file for output: $!\n";
- X print STDERR "output file is $file";
- X}}
- X
- X#------------------------------------------------------------------------------
- X# Read a file with substitutions and possible inclusions (recurse then)
- X#------------------------------------------------------------------------------
- X
- Xsub dofile {{
- X local($file)= $_[1];
- X local($d)= 0;
- X open (FILE, $file) || die "Can't find $file: $!\n";
- X
- X push(cond, 1) if ! $#cond; # initialize the stack
- X while (<FILE>) {
- X chop;
- X
- X # perform action if keyword and not nested in a skipped conditional
- X
- X $d++, $cond[$#cond] && push(cond, $d, &docondition($1)),
- X next if /^@@IF (.*)$/;
- X
- X $d++, $cond[$#cond] && push(cond, $d, ! &docondition($1)),
- X next if /^@@IFN (.*)$/;
- X
- X $d == $cond[$#cond-1] && push(cond, ! pop(cond)),
- X next if /^@@ELSE$/;
- X
- X $d == $cond[$#cond-1] && (pop(cond), pop(cond)), $d--,
- X next if /^@@FI$/;
- X
- X next if ! $cond[$#cond];
- X
- X &doinclude($1), next if /^@@INCLUDE (.*)$/;
- X
- X (print STDERR $1), next if /^@@MESSAGE (.*)$/;
- X
- X # if not keyword, substitute variable and print (conditionals first)
- X
- X while (/\$\${([^\?}]*)\?([^}]*)/) { # find all conditionals
- X $cond= $1;
- X $value= $2;
- X &docondition($cond)? s/\$\${[^}]*}/$value/ : s/\$\${[^}]*}//;
- X }
- X
- X while (/.*\$\$(\w+).*/) { # find all variables occurrences
- X $value= eval "\$$1"; # compute the value
- X s/\$\$$1/$value/; # and do the replacement
- X }
- X
- X s/\\\$\\\$/\$\$/g; # restore all escaped $$
- X
- X &printlongline($_);
- X }
- X close (FILE);
- X}}
- X
- X#------------------------------------------------------------------------------
- X# doinclude - execute the INCLUDE directive
- X#------------------------------------------------------------------------------
- X
- Xsub doinclude {{
- X local($file)= $_[1];
- X
- X $n++; # for recursion
- X open("SAVE$n", "<&FILE") || die "dup: $!\n"; # save handle on "stack"
- X $where=tell(FILE); # and place
- X &dofile("$LIBDIR/$file"); # recurse on dofile
- X open(FILE, "<&SAVE$n") || die "dup: $!\n"; # restore handle
- X seek(FILE, $where, 0); # and place
- X}}
- X
- X
- X#------------------------------------------------------------------------------
- X# docondition - evaluate a condition
- X#------------------------------------------------------------------------------
- X
- Xsub docondition {{
- X local($condition)= "$".$_[1];
- X
- X $condition=~ s/\./_/g;
- X $condition=~ s/\|/\|\|\$/g;
- X $condition=~ s/\&/\&\&\$/g;
- X
- X "" ne eval $condition;
- X}}
- X
- X#------------------------------------------------------------------------------
- X# printlongline - fold lines with continuation characters
- X#------------------------------------------------------------------------------
- X
- Xsub printlongline {{
- X local($line)= $_[1];
- X local($max)= 80; # for 1st line - 80, then less ('cause of tab)
- X
- X while (length($line) > $max) {
- X
- X # split at last white space before $max-2
- X ($l1, $l2)= ($1, $2) if substr($line, 1, $max-2) =~/(.*)\s([^\s]*)/;
- X
- X # print segment and repeat
- X printf "$l1 \\\n\t";
- X $line= $l2.substr($line, $max-1);
- X $max= 72;
- X }
- X
- X # print last stuff
- X print $line;
- X}}
- END_OF_FILE
- if test 10104 -ne `wc -c <'mkskel.pl'`; then
- echo shar: \"'mkskel.pl'\" unpacked with wrong size!
- fi
- # end of 'mkskel.pl'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-