mpack-1.6/0000777005347200000120000000000007707076053006231 5mpack-1.6/INSTALL0000644005347200000120000001722707707056132007203 Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. mpack-1.6/Makefile.am0000644005347200000120000000153507707074660010207 AUTOMAKE_OPTIONS=foreign ACLOCAL=aclocal -I $(srcdir)/cmulocal bin_PROGRAMS=mpack munpack mpack_SOURCES=unixpk.c encode.c codes.c magic.c unixos.c xmalloc.c \ md5c.c mpack_LDADD=@LIBOBJS@ @LIB_SOCKET@ munpack_SOURCES=unixunpk.c decode.c uudecode.c codes.c unixos.c \ part.c xmalloc.c md5c.c munpack_LDADD=@LIBOBJS@ @LIB_SOCKET@ noinst_HEADERS=common.h md5.h part.h version.h xmalloc.h man_MANS=mpack.1 munpack.1 BUILT_SOURCES=mpack.1 munpack.1 mpack.1: unixpk.man cp $? $@ munpack.1: unixunpk.man cp $? $@ EXTRA_DIST=README.mac macICKeys.h macmpack.c macndlog.c macntcp.c \ macproj.hqx README.unix macICTypes.h macmpack.h macnfile.c macnte.c \ macrsrc.hqx macICAPI.h macbhex.c macnapp.c macninit.c macos.c \ mkreadme.pl macICGlue.v macfile.c macnapp.h macnsmtp.c macpcstr.c \ unixpk.man unixunpk.man cmulocal Changes mpack-1.6/Makefile.in0000644005347200000120000002602207707076000010204 # 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. 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 = . 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 = : CC = @CC@ LIB_SOCKET = @LIB_SOCKET@ MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ AUTOMAKE_OPTIONS = foreign ACLOCAL = aclocal -I $(srcdir)/cmulocal bin_PROGRAMS = mpack munpack mpack_SOURCES = unixpk.c encode.c codes.c magic.c unixos.c xmalloc.c md5c.c mpack_LDADD = @LIBOBJS@ @LIB_SOCKET@ munpack_SOURCES = unixunpk.c decode.c uudecode.c codes.c unixos.c part.c xmalloc.c md5c.c munpack_LDADD = @LIBOBJS@ @LIB_SOCKET@ noinst_HEADERS = common.h md5.h part.h version.h xmalloc.h man_MANS = mpack.1 munpack.1 BUILT_SOURCES = mpack.1 munpack.1 EXTRA_DIST = README.mac macICKeys.h macmpack.c macndlog.c macntcp.c macproj.hqx README.unix macICTypes.h macmpack.h macnfile.c macnte.c macrsrc.hqx macICAPI.h macbhex.c macnapp.c macninit.c macos.c mkreadme.pl macICGlue.v macfile.c macnapp.h macnsmtp.c macpcstr.c unixpk.man unixunpk.man cmulocal Changes ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = PROGRAMS = $(bin_PROGRAMS) DEFS = @DEFS@ -I. -I$(srcdir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ mpack_OBJECTS = unixpk.o encode.o codes.o magic.o unixos.o xmalloc.o \ md5c.o mpack_DEPENDENCIES = @LIBOBJS@ mpack_LDFLAGS = munpack_OBJECTS = unixunpk.o decode.o uudecode.o codes.o unixos.o \ part.o xmalloc.o md5c.o munpack_DEPENDENCIES = @LIBOBJS@ munpack_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ man1dir = $(mandir)/man1 MANS = $(man_MANS) NROFF = nroff HEADERS = $(noinst_HEADERS) DIST_COMMON = INSTALL Makefile.am Makefile.in aclocal.m4 configure \ configure.in getopt.c install-sh missing mkinstalldirs strcasecmp.c DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = gtar GZIP_ENV = --best SOURCES = $(mpack_SOURCES) $(munpack_SOURCES) OBJECTS = $(mpack_OBJECTS) $(munpack_OBJECTS) all: all-redirect .SUFFIXES: .SUFFIXES: .S .c .o .s $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status $(ACLOCAL_M4): configure.in cd $(srcdir) && $(ACLOCAL) config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) mostlyclean-binPROGRAMS: clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) distclean-binPROGRAMS: maintainer-clean-binPROGRAMS: install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) list='$(bin_PROGRAMS)'; for p in $$list; do \ rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ done .c.o: $(COMPILE) -c $< .s.o: $(COMPILE) -c $< .S.o: $(COMPILE) -c $< mostlyclean-compile: -rm -f *.o core *.core clean-compile: distclean-compile: -rm -f *.tab.c maintainer-clean-compile: mpack: $(mpack_OBJECTS) $(mpack_DEPENDENCIES) @rm -f mpack $(LINK) $(mpack_LDFLAGS) $(mpack_OBJECTS) $(mpack_LDADD) $(LIBS) munpack: $(munpack_OBJECTS) $(munpack_DEPENDENCIES) @rm -f munpack $(LINK) $(munpack_LDFLAGS) $(munpack_OBJECTS) $(munpack_LDADD) $(LIBS) install-man1: $(mkinstalldirs) $(DESTDIR)$(man1dir) @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ done uninstall-man1: @list='$(man1_MANS)'; \ l2='$(man_MANS)'; for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ rm -f $(DESTDIR)$(man1dir)/$$inst; \ done install-man: $(MANS) @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-man1 uninstall-man: @$(NORMAL_UNINSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-man1 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 = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist -rm -rf $(distdir) GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz mkdir $(distdir)/=build mkdir $(distdir)/=inst dc_install_base=`cd $(distdir)/=inst && pwd`; \ cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) dist -rm -rf $(distdir) @banner="$(distdir).tar.gz is ready for distribution"; \ dashes=`echo "$$banner" | sed s/./=/g`; \ echo "$$dashes"; \ echo "$$banner"; \ echo "$$dashes" dist: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) dist-all: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) -rm -rf $(distdir) distdir: $(DISTFILES) -rm -rf $(distdir) mkdir $(distdir) -chmod 777 $(distdir) @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$d/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am install-exec-am: install-binPROGRAMS install-exec: install-exec-am install-data-am: install-man install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall-binPROGRAMS uninstall-man uninstall: uninstall-am all-am: Makefile $(PROGRAMS) $(MANS) $(HEADERS) all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 mostlyclean-generic: clean-generic: 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 "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ mostlyclean-tags mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-binPROGRAMS clean-compile clean-tags clean-generic \ mostlyclean-am clean: clean-am distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \ distclean-generic clean-am distclean: distclean-am -rm -f config.status maintainer-clean-am: maintainer-clean-binPROGRAMS \ maintainer-clean-compile 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 -rm -f config.status .PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile install-man1 uninstall-man1 install-man \ uninstall-man tags mostlyclean-tags distclean-tags clean-tags \ maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ installcheck-am installcheck install-exec-am install-exec \ install-data-am install-data install-am install uninstall-am uninstall \ all-redirect all-am all installdirs mostlyclean-generic \ distclean-generic clean-generic maintainer-clean-generic clean \ mostlyclean distclean maintainer-clean mpack.1: unixpk.man cp $? $@ munpack.1: unixunpk.man cp $? $@ # 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: mpack-1.6/aclocal.m40000644005347200000120000001040507707076000007775 dnl aclocal.m4 generated automatically by aclocal 1.4 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This program is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. # But this isn't really a big deal. # serial 1 dnl Usage: dnl AM_INIT_AUTOMAKE(package,version, [no-define]) AC_DEFUN(AM_INIT_AUTOMAKE, [AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] AC_SUBST(VERSION) dnl test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi ifelse([$3],, AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) AC_REQUIRE([AM_SANITY_CHECK]) AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. missing_dir=`cd $ac_aux_dir && pwd` AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_REQUIRE([AC_PROG_MAKE_SET])]) # # Check to make sure that the build environment is sane. # AC_DEFUN(AM_SANITY_CHECK, [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "[$]*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "[$]*" != "X $srcdir/configure conftestfile" \ && test "[$]*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "[$]2" = conftestfile ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi rm -f conftest* AC_MSG_RESULT(yes)]) dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) dnl The program must properly implement --version. AC_DEFUN(AM_MISSING_PROG, [AC_MSG_CHECKING(for working $2) # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if ($2 --version) < /dev/null > /dev/null 2>&1; then $1=$2 AC_MSG_RESULT(found) else $1="$3/missing $2" AC_MSG_RESULT(missing) fi AC_SUBST($1)]) dnl bsd_sockets.m4--which socket libraries do we need? dnl Derrick Brashear dnl from Zephyr dnl $Id: bsd_sockets.m4,v 1.8 2002/05/25 19:57:41 leg Exp $ dnl Hacked on by Rob Earhart to not just toss stuff in LIBS dnl It now puts everything required for sockets into LIB_SOCKET AC_DEFUN(CMU_SOCKETS, [ save_LIBS="$LIBS" LIB_SOCKET="" AC_CHECK_FUNC(connect, :, AC_CHECK_LIB(nsl, gethostbyname, LIB_SOCKET="-lnsl $LIB_SOCKET") AC_CHECK_LIB(socket, connect, LIB_SOCKET="-lsocket $LIB_SOCKET") ) LIBS="$LIB_SOCKET $save_LIBS" AC_CHECK_FUNC(res_search, :, AC_CHECK_LIB(resolv, res_search, LIB_SOCKET="-lresolv $LIB_SOCKET") ) LIBS="$LIB_SOCKET $save_LIBS" AC_CHECK_FUNCS(dn_expand dns_lookup) LIBS="$save_LIBS" AC_SUBST(LIB_SOCKET) ]) mpack-1.6/configure0000755005347200000120000015057107707076000010055 #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=common.h # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:556: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 echo "configure:609: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftestfile` fi if test "$*" != "X $srcdir/configure conftestfile" \ && test "$*" != "X conftestfile $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { echo "configure: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" 1>&2; exit 1; } fi test "$2" = conftestfile ) then # Ok. : else { echo "configure: error: newly created file is older than distributed files! Check your system clock" 1>&2; exit 1; } fi rm -f conftest* echo "$ac_t""yes" 1>&6 if test "$program_transform_name" = s,x,x,; then program_transform_name= else # Double any \ or $. echo might interpret backslashes. cat <<\EOF_SED > conftestsed s,\\,\\\\,g; s,\$,$$,g EOF_SED program_transform_name="`echo $program_transform_name|sed -f conftestsed`" rm -f conftestsed fi test "$program_prefix" != NONE && program_transform_name="s,^,${program_prefix},; $program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" # sed with no file args requires a program. test "$program_transform_name" = "" && program_transform_name="s,x,x," echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 echo "configure:666: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftestmake <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftestmake fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$ac_t""yes" 1>&6 SET_MAKE= else echo "$ac_t""no" 1>&6 SET_MAKE="MAKE=${MAKE-make}" fi PACKAGE=mpack VERSION=1.6 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } fi cat >> confdefs.h <> confdefs.h <&6 echo "configure:712: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (aclocal --version) < /dev/null > /dev/null 2>&1; then ACLOCAL=aclocal echo "$ac_t""found" 1>&6 else ACLOCAL="$missing_dir/missing aclocal" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 echo "configure:725: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoconf --version) < /dev/null > /dev/null 2>&1; then AUTOCONF=autoconf echo "$ac_t""found" 1>&6 else AUTOCONF="$missing_dir/missing autoconf" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 echo "configure:738: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (automake --version) < /dev/null > /dev/null 2>&1; then AUTOMAKE=automake echo "$ac_t""found" 1>&6 else AUTOMAKE="$missing_dir/missing automake" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 echo "configure:751: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (autoheader --version) < /dev/null > /dev/null 2>&1; then AUTOHEADER=autoheader echo "$ac_t""found" 1>&6 else AUTOHEADER="$missing_dir/missing autoheader" echo "$ac_t""missing" 1>&6 fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 echo "configure:764: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. if (makeinfo --version) < /dev/null > /dev/null 2>&1; then MAKEINFO=makeinfo echo "$ac_t""found" 1>&6 else MAKEINFO="$missing_dir/missing makeinfo" echo "$ac_t""missing" 1>&6 fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:780: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:810: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then case "`uname -s`" in *win32* | *WIN32*) # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:861: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi ;; esac fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:893: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF #line 904 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo "configure:935: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo "configure:940: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo "configure:968: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi save_LIBS="$LIBS" LIB_SOCKET="" echo $ac_n "checking for connect""... $ac_c" 1>&6 echo "configure:1004: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else connect(); #endif ; return 0; } EOF if { (eval echo configure:1032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_connect=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 echo "configure:1050: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIB_SOCKET="-lnsl $LIB_SOCKET" else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 echo "configure:1090: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIB_SOCKET="-lsocket $LIB_SOCKET" else echo "$ac_t""no" 1>&6 fi fi LIBS="$LIB_SOCKET $save_LIBS" echo $ac_n "checking for res_search""... $ac_c" 1>&6 echo "configure:1134: checking for res_search" >&5 if eval "test \"`echo '$''{'ac_cv_func_res_search'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char res_search(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_res_search) || defined (__stub___res_search) choke me #else res_search(); #endif ; return 0; } EOF if { (eval echo configure:1162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_res_search=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_res_search=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'res_search`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6 echo "configure:1180: checking for res_search in -lresolv" >&5 ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIB_SOCKET="-lresolv $LIB_SOCKET" else echo "$ac_t""no" 1>&6 fi fi LIBS="$LIB_SOCKET $save_LIBS" for ac_func in dn_expand dns_lookup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:1226: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:1254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done LIBS="$save_LIBS" for ac_func in strchr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:1285: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:1313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done for ac_func in strcasecmp getopt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:1340: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:1368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}" fi done trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. cat > conftest.defs <<\EOF s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g s%\[%\\&%g s%\]%\\&%g s%\$%$$%g EOF DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` rm -f conftest.defs # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@PACKAGE@%$PACKAGE%g s%@VERSION@%$VERSION%g s%@ACLOCAL@%$ACLOCAL%g s%@AUTOCONF@%$AUTOCONF%g s%@AUTOMAKE@%$AUTOMAKE%g s%@AUTOHEADER@%$AUTOHEADER%g s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g s%@CC@%$CC%g s%@LIB_SOCKET@%$LIB_SOCKET%g s%@LIBOBJS@%$LIBOBJS%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 mpack-1.6/configure.in0000644005347200000120000000023507707075776010471 AC_INIT(common.h) AM_INIT_AUTOMAKE(mpack,1.6) AC_PROG_CC CMU_SOCKETS AC_CHECK_FUNCS([strchr]) AC_REPLACE_FUNCS([strcasecmp getopt]) AC_OUTPUT([Makefile]) mpack-1.6/getopt.c0000444005347200000120000000621507707047223007612 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include #ifdef __OS2__ # include #endif #if defined(__MSDOS__) || defined(__OS2__) #define ERR(s, c) \ if (opterr) { \ char buff[3]; \ buff[0] = c; buff[1] = '\r'; buff[2] = '\n'; \ (void)write(2, av[0], strlen(av[0])); \ (void)write(2, s, strlen(s)); \ (void)write(2, buff, 3); \ } #else /* __MSDOS__ */ #define ERR(s, c) \ if (opterr) { \ char buff[2]; \ buff[0] = c; buff[1] = '\n'; \ (void)write(2, av[0], strlen(av[0])); \ (void)write(2, s, strlen(s)); \ (void)write(2, buff, 2); \ } #endif int opterr = 1; int optind = 1; int optopt; char *optarg; /* ** Return options and their values from the command line. ** This comes from the AT&T public-domain getopt published in mod.sources ** (i.e., comp.sources.unix before the great Usenet renaming). */ int getopt(int ac, char **av, char *opts) { extern char *strchr(const char *, int); static int i = 1; char *p; /* Move to next value from argv? */ if (i == 1) { if (optind >= ac || #if defined(__MSDOS__) || defined(__OS2__) (av[optind][0] != '-' && av[optind][0] != '/') #else av[optind][0] != '-' #endif || av[optind][1] == '\0') return EOF; if (strcmp(av[optind], "--") == 0) { optind++; return EOF; } } /* Get next option character. */ if ((optopt = av[optind][i]) == ':' || (p = strchr(opts, optopt)) == NULL) { ERR(": illegal option -- ", optopt); if (av[optind][++i] == '\0') { optind++; i = 1; } return '?'; } /* Snarf argument? */ if (*++p == ':') { if (av[optind][i + 1] != '\0') optarg = &av[optind++][i + 1]; else { if (++optind >= ac) { ERR(": option requires an argument -- ", optopt); i = 1; return '?'; } optarg = av[optind++]; } i = 1; } else { if (av[optind][++i] == '\0') { i = 1; optind++; } optarg = NULL; } return optopt; } mpack-1.6/install-sh0000755005347200000120000001273607601415551010153 #!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 mpack-1.6/missing0000755005347200000120000001421307601415551007536 #! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright (C) 1996, 1997 Free Software Foundation, Inc. # Franc,ois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing - GNU libit 0.0" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`configure.in'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 mpack-1.6/mkinstalldirs0000755005347200000120000000132207601415551010742 #! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here mpack-1.6/strcasecmp.c0000444005347200000120000000564107707047223010456 /* * String manipulation routines */ /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include static unsigned char upcase[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, ' ','!','"','#','$','%','&', 39,'(',')','*','+',',','-','.','/', '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?', '@','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', 'P','Q','R','S','T','U','V','W','X','Y','Z','[', 92,']','^','_', '`','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O', 'P','Q','R','S','T','U','V','W','X','Y','Z','{','|','}','~',127, 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207, 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239, 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255}; #define UPC(x) (upcase[(unsigned char)(x)]) /* * Same as strcmp, but case-insensitive. */ int strcasecmp(register char *s1, register char *s2) { register char c1; while ((c1 = *s1) && UPC(c1) == UPC(*s2)) { s1++; s2++; } return UPC(c1) - UPC(*s2); } /* * Same as strncmp, but case-insensitive. */ int strncasecmp(register char *s1, register char *s2, int n) { register char c1; while (n-- && (c1 = *s1) && UPC(c1) == UPC(*s2)) { s1++; s2++; } if (n == -1) return 0; return UPC(c1) - UPC(*s2); } mpack-1.6/unixpk.c0000644005347200000120000001572307707051041007625 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include #include #include #include "common.h" #include "version.h" #include "xmalloc.h" #define MAXADDRESS 100 extern char *getenv(); extern int errno; extern int optind; extern char *optarg; void usage(void); void sendmail(FILE *infile, char **addr, int start); void inews(FILE *infile); int main(int argc, char **argv) { int opt; char *fname = 0; char *subject = 0; char *descfname = 0; long maxsize = 0; char *outfname = 0; char *newsgroups = 0; char *ctype = 0; char *headers = 0; int i; char *p; char sbuf[1024]; char fnamebuf[4096]; int part; FILE *infile; FILE *descfile = 0; if ((p = getenv("SPLITSIZE")) && *p >= '0' && *p <= '9') { maxsize = atoi(p); } while ((opt = getopt(argc, argv, "s:d:m:c:o:n:")) != EOF) { switch (opt) { case 's': subject = optarg; break; case 'd': descfname = optarg; break; case 'm': maxsize = atoi(optarg); break; case 'c': ctype = optarg; break; case 'o': outfname = optarg; break; case 'n': newsgroups = optarg; break; default: usage(); } } if (ctype) { if (!strncasecmp(ctype, "text/", 5)) { fprintf(stderr, "This program is not appropriate for encoding textual data\n"); exit(1); } if (strncasecmp(ctype, "application/", 12) && strncasecmp(ctype, "audio/", 6) && strncasecmp(ctype, "image/", 6) && strncasecmp(ctype, "video/", 6)) { fprintf(stderr, "Content type must be subtype of application, audio, image, or video\n"); exit(1); } } if (optind == argc) { fprintf(stderr, "An input file must be specified\n"); usage(); } fname = argv[optind++]; /* Must have exactly one of -o, -n, or destination addrs */ if (optind == argc) { if (outfname && newsgroups) { fprintf(stderr, "The -o and -n switches are mutually exclusive.\n"); usage(); } if (!outfname && !newsgroups) { fprintf(stderr, "Either an address or one of the -o or -n switches is required\n"); usage(); } if (newsgroups) { headers = xmalloc(strlen(newsgroups) + 25); sprintf(headers, "Newsgroups: %s\n", newsgroups); } } else { if (outfname) { fprintf(stderr, "The -o switch and addresses are mutually exclusive.\n"); usage(); } if (newsgroups) { fprintf(stderr, "The -n switch and addresses are mutually exclusive.\n"); usage(); } headers = xmalloc(strlen(argv[optind]) + 25); sprintf(headers, "To: %s", argv[optind]); for (i = optind+1; i < argc; i++) { headers = xrealloc(headers, strlen(headers)+strlen(argv[i]) + 25); strcat(headers, ",\n\t"); strcat(headers, argv[i]); } strcat(headers, "\n"); } if (!subject) { fputs("Subject: ", stdout); fflush(stdout); if (!fgets(sbuf, sizeof(sbuf), stdin)) { fprintf(stderr, "A subject is required\n"); usage(); } if (p = strchr(sbuf, '\n')) *p = '\0'; subject = sbuf; } if (!outfname) { if (getenv("TMPDIR")) { strcpy(fnamebuf, getenv("TMPDIR")); } else { strcpy(fnamebuf, "/usr/tmp"); } strcat(fnamebuf, "/mpackXXXXXX"); mktemp(fnamebuf); outfname = strsave(fnamebuf); } infile = fopen(fname, "r"); if (!infile) { os_perror(fname); exit(1); } if (descfname) { descfile = fopen(descfname, "r"); if (!descfile) { os_perror(descfname); exit(1); } } if (encode(infile, (FILE *)0, fname, descfile, subject, headers, maxsize, ctype, outfname)) exit(1); if (optind < argc || newsgroups) { for (part = 0;;part++) { sprintf(fnamebuf, "%s.%02d", outfname, part); infile = fopen(part ? fnamebuf : outfname, "r"); if (!infile) { if (part) break; continue; } if (newsgroups) { inews(infile); } else { sendmail(infile, argv, optind); } fclose(infile); remove(part ? fnamebuf : outfname); } } exit(0); } void usage(void) { fprintf(stderr, "mpack version %s\n", MPACK_VERSION); fprintf(stderr, "usage: mpack [-s subj] [-d file] [-m maxsize] [-c content-type] file address...\n"); fprintf(stderr, " mpack [-s subj] [-d file] [-m maxsize] [-c content-type] -o file file\n"); fprintf(stderr, " mpack [-s subj] [-d file] [-m maxsize] [-c content-type] -n groups file\n"); exit(1); } void sendmail(FILE *infile, char **addr, int start) { int status; int pid; if (start < 2) abort(); #ifdef SCO addr[--start] = "execmail"; #else addr[--start] = "-oi"; addr[--start] = "sendmail"; #endif do { pid = fork(); } while (pid == -1 && errno == EAGAIN); if (pid == -1) { perror("fork"); return; } if (pid != 0) { while (pid != wait(&status)); return; } dup2(fileno(infile), 0); fclose(infile); #ifdef SCO execv("/usr/lib/mail/execmail", addr+start); #else execv("/usr/lib/sendmail", addr+start); execv("/usr/sbin/sendmail", addr+start); #endif perror("execv"); _exit(1); } void inews(FILE *infile) { int status; int pid; do { pid = fork(); } while (pid == -1 && errno == EAGAIN); if (pid == -1) { perror("fork"); return; } if (pid != 0) { while (pid != wait(&status)); return; } dup2(fileno(infile), 0); fclose(infile); execlp("inews", "inews", "-h", "-S", (char *)0); execl("/usr/local/news/inews", "inews", "-h", "-S", (char *)0); execl("/usr/local/lib/news/inews", "inews", "-h", "-S", (char *)0); execl("/etc/inews", "inews", "-h", "-S", (char *)0); execl("/usr/etc/inews", "inews", "-h", "-S", (char *)0); execl("/usr/news/inews", "inews", "-h", "-S", (char *)0); execl("/usr/news/bin/inews", "inews", "-h", "-S", (char *)0); perror("execl"); _exit(1); } void warn(void) { abort(); } mpack-1.6/encode.c0000444005347200000120000001572607707047223007554 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include #include extern char *magic_look(FILE *infile); extern char *os_genid(void); extern FILE *os_createnewfile(char *fname); extern char *md5digest(FILE *infile, long int *len); #define NUMREFERENCES 4 /* * Encode a file into one or more MIME messages, each * no larger than 'maxsize'. A 'maxsize' of zero means no size limit. * If 'applefile' is non-null, it is the first part of a multipart/appledouble * pair. */ int encode(FILE *infile, FILE *applefile, char *fname, FILE *descfile, char *subject, char *headers, long int maxsize, char *typeoverride, char *outfname) { char *type; FILE *outfile; char *cleanfname, *p; char *digest, *appledigest; long filesize, l, written; int thispart, numparts = 1; int wrotefiletype = 0; char *multipartid, *msgid, *referenceid[NUMREFERENCES]; char buf[1024]; int i; /* Clean up fname for printing */ cleanfname = fname; #ifdef __riscos /* This filename-cleaning knowledge will probably * be moved to the os layer in a future version. */ if (p = strrchr(cleanfname, '.')) cleanfname = p+1; #else if (p = strrchr(cleanfname, '/')) cleanfname = p+1; if (p = strrchr(cleanfname, '\\')) cleanfname = p+1; #endif if (p = strrchr(cleanfname, ':')) cleanfname = p+1; /* Find file type */ if (typeoverride) { type = typeoverride; } else { type = magic_look(infile); } /* Compute MD5 digests */ digest = md5digest(infile, &filesize); if (applefile) { appledigest = md5digest(applefile, &l); filesize += l; } /* See if we have to do multipart */ if (maxsize) { filesize = (filesize / 54) * 73; /* Allow for base64 expansion */ /* Add in size of desc file */ if (descfile) { free(md5digest(descfile, &l)); /* XXX */ filesize += l; } numparts = (filesize-1000)/maxsize + 1; if (numparts < 1) numparts = 1; } multipartid = os_genid(); for (i=0; i\n", msgid); fprintf(outfile, "Mime-Version: 1.0\n"); if (headers) fputs(headers, outfile); if (numparts > 1) { fprintf(outfile, "Subject: %s (%02d/%02d)\n", subject, thispart, numparts); if (thispart == 1) { referenceid[0] = msgid; } else { /* Put out References: header pointing to previous parts */ fprintf(outfile, "References: <%s>\n", referenceid[0]); for (i=1; i\n", referenceid[i]); } for (i=2; i 1) { fprintf(outfile, "Message-ID: <%s>\n", multipartid); fprintf(outfile, "MIME-Version: 1.0\n"); } fprintf(outfile, "Subject: %s\n", subject); fprintf(outfile, "Content-Type: multipart/mixed; boundary=\"-\"\n"); fprintf(outfile, "\nThis is a MIME encoded message. Decode it with \"munpack\"\n"); fprintf(outfile, "or any other MIME reading software. Mpack/munpack is available\n"); fprintf(outfile, "via anonymous FTP in ftp.andrew.cmu.edu:pub/mpack/\n"); written = 300; /* Spit out description section */ if (descfile) { fprintf(outfile, "---\n\n"); while (fgets(buf, sizeof(buf), descfile)) { /* Strip multiple leading dashes as they may become MIME * boundaries */ p = buf; if (*p == '-') { while (p[1] == '-') p++; } fputs(p, outfile); written += strlen(p); } fprintf(outfile, "\n"); } fprintf(outfile, "---\n"); if (applefile) { fprintf(outfile, "Content-Type: multipart/appledouble; boundary=\"=\"; name=\"%s\"\n", cleanfname); fprintf(outfile, "Content-Disposition: inline; filename=\"%s\"\n", cleanfname); fprintf(outfile, "\n\n--=\n"); fprintf(outfile, "Content-Type: application/applefile\n"); fprintf(outfile, "Content-Transfer-Encoding: base64\n"); fprintf(outfile, "Content-MD5: %s\n\n", appledigest); free(appledigest); written += 100; } } if (applefile && !feof(applefile)) { if (written == maxsize) written--; /* avoid a nasty fencepost error */ written += to64(applefile, outfile, (thispart == numparts) ? 0 : (maxsize-written)); if (!feof(applefile)) { fclose(outfile); continue; } fprintf(outfile, "\n--=\n"); } if (!wrotefiletype++) { fprintf(outfile, "Content-Type: %s; name=\"%s\"\n", type, cleanfname); fprintf(outfile, "Content-Transfer-Encoding: base64\n"); fprintf(outfile, "Content-Disposition: inline; filename=\"%s\"\n", cleanfname); fprintf(outfile, "Content-MD5: %s\n\n", digest); free(digest); written += 80; } if (written == maxsize) written--; /* avoid a nasty fencepost error */ written += to64(infile, outfile, (thispart == numparts) ? 0 : (maxsize-written)); if (thispart == numparts) { if (applefile) fprintf(outfile, "\n--=--\n"); fprintf(outfile, "\n-----\n"); } fclose(outfile); } return 0; } mpack-1.6/codes.c0000444005347200000120000001050307707051074007377 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore) Permission to use, copy, modify, and distribute this material for any purpose and without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies, and that the name of Bellcore not be used in advertising or publicity pertaining to this material without the specific, prior written permission of an authorized representative of Bellcore. BELLCORE MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. */ #include #include #include #include "xmalloc.h" #include "md5.h" void output64chunk(int c1, int c2, int c3, int pads, FILE *outfile); static char basis_64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int to64(FILE *infile, FILE *outfile, long int limit) { int c1, c2, c3, ct=0, written=0; if (limit && limit < 73) return 1; while ((c1 = getc(infile)) != EOF) { c2 = getc(infile); if (c2 == EOF) { output64chunk(c1, 0, 0, 2, outfile); } else { c3 = getc(infile); if (c3 == EOF) { output64chunk(c1, c2, 0, 1, outfile); } else { output64chunk(c1, c2, c3, 0, outfile); } } ct += 4; if (ct > 71) { putc('\n', outfile); if (limit) { limit -= ct + 1; if (limit < 73) return 1; } written += 73; ct = 0; } } if (ct) { putc('\n', outfile); ct++; } return written + ct; } void output64chunk(int c1, int c2, int c3, int pads, FILE *outfile) { putc(basis_64[c1>>2], outfile); putc(basis_64[((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4)], outfile); if (pads == 2) { putc('=', outfile); putc('=', outfile); } else if (pads) { putc(basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)], outfile); putc('=', outfile); } else { putc(basis_64[((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6)], outfile); putc(basis_64[c3 & 0x3F], outfile); } } char *md5contextTo64(MD5_CTX *context) { unsigned char digest[18]; char encodedDigest[25]; int i; char *p; MD5Final(digest, context); digest[sizeof(digest)-1] = digest[sizeof(digest)-2] = 0; p = encodedDigest; for (i=0; i < sizeof(digest); i+=3) { *p++ = basis_64[digest[i]>>2]; *p++ = basis_64[((digest[i] & 0x3)<<4) | ((digest[i+1] & 0xF0)>>4)]; *p++ = basis_64[((digest[i+1] & 0xF)<<2) | ((digest[i+2] & 0xC0)>>6)]; *p++ = basis_64[digest[i+2] & 0x3F]; } *p-- = '\0'; *p-- = '='; *p-- = '='; return strsave(encodedDigest); } char *md5digest(FILE *infile, long int *len) { MD5_CTX context; char buf[1000]; long length = 0; int nbytes; MD5Init(&context); while (nbytes = fread(buf, 1, sizeof(buf), infile)) { length += nbytes; MD5Update(&context, buf, nbytes); } rewind(infile); if (len) *len = length; return md5contextTo64(&context); } mpack-1.6/magic.c0000444005347200000120000000514607707047223007372 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include /* Description of the various file formats and their magic numbers */ struct magic { char *name; /* Name of the file format */ char *num; /* The magic number */ int len; /* Length of same (0 means strlen(magicnum)) */ }; /* The magic numbers of the file formats we know about */ static struct magic magic[] = { { "image/gif", "GIF", 0 }, { "image/jpeg", "\377\330\377", 0 }, { "video/mpeg", "\0\0\001\263", 4 }, { "application/postscript", "%!", 0 }, }; static int num_magic = (sizeof(magic)/sizeof(magic[0])); static char *default_type = "application/octet-stream"; /* The longest magic number */ static int max_magiclen = 0; /* * Determins the format of the file "inputf". The name * of the file format (or NULL on error) is returned. */ char *magic_look(FILE *infile) { int i, j; char buf[80]; int numread = 0; if (max_magiclen == 0) { for (i=0; i max_magiclen) max_magiclen = magic[i].len; } } numread = fread(buf, 1, max_magiclen, infile); rewind(infile); for (i=0; i= magic[i].len) { for (j=0; j #include #include #include #include #include #include #include #include "xmalloc.h" #include "common.h" #include "part.h" #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 #endif extern int errno; extern char *malloc(); extern char *getenv(); int overwrite_files = 0; int didchat; /* The name of the file we're writing */ static char *output_fname = 0; /* Characters that shouldn't be in filenames */ #define BADCHARS "!$&*()|\'\";<>[]{}?/`\\ \t" /* Generate a message-id */ char *os_genid(void) { static int pid = 0; static time_t curtime; static char hostname[MAXHOSTNAMELEN+1]; char *result; struct hostent *hp; if (pid == 0) { pid = getpid(); time(&curtime); gethostname(hostname, sizeof(hostname)); /* If we don't have a FQDN, try canonicalizing with gethostbyname */ if (!strchr(hostname, '.')) { hp = gethostbyname(hostname); if (hp) { strcpy(hostname, hp->h_name); } } } result = malloc(25+strlen(hostname)); sprintf(result, "%d.%d@%s", pid, curtime++, hostname); return result; } /* Create and return directory for a message-id */ char *os_idtodir(char *id) { static char buf[4096]; char *p; if (getenv("TMPDIR")) { strcpy(buf, getenv("TMPDIR")); } else { strcpy(buf, "/usr/tmp"); } strcat(buf, "/m-prts-"); p = getenv("USER"); if (!p) p = getenv("LOGNAME"); if (!p) p = "x"; strcat(buf, p); (void)mkdir(buf, 0700); p = buf + strlen(buf); *p++ = '/'; while (*id && p < buf+sizeof(buf)-10 ) { if (isprint(*id) && !strchr(BADCHARS, *id)) *p++ = *id; id++; } *p = '\0'; if (mkdir(buf, 0700) == -1 && errno != EEXIST) { perror(buf); return 0; } *p++ = '/'; *p = '\0'; return buf; } /* * We are done with the directory returned by os_idtodir() * Remove it */ void os_donewithdir(char *dir) { char *p; /* Remove trailing slash */ p = dir + strlen(dir) - 1; *p = '\0'; rmdir(dir); } FILE *os_createnewfile(char *fname) { int fd; FILE *ret; #ifdef O_EXCL fd=open(fname, O_RDWR|O_CREAT|O_EXCL, 0644); #else fd=open(fname, O_RDWR|O_CREAT|O_TRUNC, 0644); #endif if (fd == -1) return NULL; ret=fdopen(fd, "w"); return ret; } /* * Create a new file, with suggested filename "fname". * "fname" may have come from an insecure source, so clean it up first. * It may also be null. * "contentType" is passed in for use by systems that have typed filesystems. * "flags" contains a bit pattern describing attributes of the new file. */ FILE *os_newtypedfile(char *fname, char *contentType, int flags, params contentParams) { char *p; static int filesuffix=0; char buf[128], *descfname=0; FILE *outfile = 0; if (!fname) fname = ""; /* If absolute path name, chop to tail */ if (*fname == '/') { p = strrchr(fname, '/'); fname = p+1; } /* Get rid of leading ~ or ~/ */ while (*fname == '~' || *fname == '/') fname++; while (!strncmp(fname, "../", 3)) fname += 3; /* Clean out bad characters, create directories along path */ for (p=fname; *p; p++) { if (*p == '/') { if (!strncmp(p, "/../", 4)) { p[1] = p[2] = 'X'; } *p = '\0'; (void) mkdir(fname, 0777); *p = '/'; } else if (!isprint(*p) || strchr(BADCHARS, *p)) *p = 'X'; } if (!fname[0]) { do { if (outfile) fclose(outfile); sprintf(buf, "part%d", ++filesuffix); } while (outfile = fopen(buf, "r")); fname = buf; } else if (!overwrite_files && (outfile = fopen(fname, "r"))) { do { fclose(outfile); sprintf(buf, "%s.%d", fname, ++filesuffix); } while (outfile = fopen(buf, "r")); fname = buf; } if (overwrite_files) outfile = fopen(fname, "w"); else outfile = os_createnewfile(fname); if (!outfile) { perror(fname); } if (output_fname) free(output_fname); output_fname = strsave(fname); if (strlen(fname) > sizeof(buf)-6) { descfname = xmalloc(strlen(fname)+6); } else { descfname = buf; } strcpy(descfname, fname); p = strchr(descfname, '/'); if (!p) p = descfname; if (p = strrchr(p, '.')) *p = '\0'; strcat(descfname, ".desc"); (void) rename(TEMPFILENAME, descfname); if (descfname != buf) free(descfname); fprintf(stdout, "%s (%s)\n", output_fname, contentType); didchat = 1; return outfile; } /* * Close a file opened by os_newTypedFile() */ void os_closetypedfile(FILE *outfile) { fclose(outfile); } /* * (Don't) Handle a BinHex'ed file */ int os_binhex(struct part *inpart, int part, int nparts) { return 1; } /* * Warn user that the MD5 digest of the last file created by os_newtypedfile() * did not match that supplied in the Content-MD5: header. */ void os_warnMD5mismatch(void) { char *warning; warning = xmalloc(strlen(output_fname) + 100); sprintf(warning, "%s was corrupted in transit", output_fname); warn(warning); free(warning); } /* * Report an error (in errno) concerning a filename */ void os_perror(char *file) { perror(file); } mpack-1.6/xmalloc.c0000444005347200000120000000354007707047223007745 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include #include extern char *malloc(), *realloc(); char *xmalloc (int size) { char *ret; if (ret = malloc((unsigned) size)) return ret; fprintf(stderr, "Memory exhausted\n"); exit(1); } char *xrealloc (char *ptr, int size) { char *ret; /* xrealloc (NULL, size) behaves like xmalloc (size), as in ANSI C */ if (ret = !ptr ? malloc ((unsigned) size) : realloc (ptr, (unsigned) size)) return ret; fprintf(stderr, "Memory exhausted\n"); exit(1); } char *strsave(char *str) { char *p = xmalloc(strlen(str)+1); strcpy(p, str); return p; } mpack-1.6/md5c.c0000444005347200000120000002421007707047223007133 /* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ #include "md5.h" /* Constants for MD5Transform routine. */ #define S11 7 #define S12 12 #define S13 17 #define S14 22 #define S21 5 #define S22 9 #define S23 14 #define S24 20 #define S31 4 #define S32 11 #define S33 16 #define S34 23 #define S41 6 #define S42 10 #define S43 15 #define S44 21 static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64])); static void Encode PROTO_LIST ((unsigned char *, UINT4 *, unsigned int)); static void Decode PROTO_LIST ((UINT4 *, unsigned char *, unsigned int)); static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int)); static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int)); static unsigned char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* F, G, H and I are basic MD5 functions. */ #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) #define G(x, y, z) (((x) & (z)) | ((y) & (~z))) #define H(x, y, z) ((x) ^ (y) ^ (z)) #define I(x, y, z) ((y) ^ ((x) | (~z))) /* ROTATE_LEFT rotates x left n bits. */ #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent recomputation. */ #define FF(a, b, c, d, x, s, ac) { \ (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) { \ (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) { \ (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) { \ (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } /* MD5 initialization. Begins an MD5 operation, writing a new context. */ void MD5Init (MD5_CTX *context) /* context */ { context->count[0] = context->count[1] = 0; /* Load magic initialization constants. */ context->state[0] = 0x67452301; context->state[1] = 0xefcdab89; context->state[2] = 0x98badcfe; context->state[3] = 0x10325476; } /* MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context. */ void MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen) /* context */ /* input block */ /* length of input block */ { unsigned int i, index, partLen; /* Compute number of bytes mod 64 */ index = (unsigned int)((context->count[0] >> 3) & 0x3F); /* Update number of bits */ if ((context->count[0] += ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3)) context->count[1]++; context->count[1] += ((UINT4)inputLen >> 29); partLen = 64 - index; /* Transform as many times as possible. */ if (inputLen >= partLen) { MD5_memcpy ((POINTER)&context->buffer[index], (POINTER)input, partLen); MD5Transform (context->state, context->buffer); for (i = partLen; i + 63 < inputLen; i += 64) MD5Transform (context->state, &input[i]); index = 0; } else i = 0; /* Buffer remaining input */ MD5_memcpy ((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen-i); } /* MD5 finalization. Ends an MD5 message-digest operation, writing the the message digest and zeroizing the context. */ void MD5Final (unsigned char *digest, MD5_CTX *context) /* message digest */ /* context */ { unsigned char bits[8]; unsigned int index, padLen; /* Save number of bits */ Encode (bits, context->count, 8); /* Pad out to 56 mod 64. */ index = (unsigned int)((context->count[0] >> 3) & 0x3f); padLen = (index < 56) ? (56 - index) : (120 - index); MD5Update (context, PADDING, padLen); /* Append length (before padding) */ MD5Update (context, bits, 8); /* Store state in digest */ Encode (digest, context->state, 16); /* Zeroize sensitive information. */ MD5_memset ((POINTER)context, 0, sizeof (*context)); } /* MD5 basic transformation. Transforms state based on block. */ static void MD5Transform (UINT4 *state, unsigned char *block) { UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode (x, block, 64); /* Round 1 */ FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ /* Round 2 */ GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ /* Round 3 */ HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ /* Round 4 */ II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ state[0] += a; state[1] += b; state[2] += c; state[3] += d; /* Zeroize sensitive information. */ MD5_memset ((POINTER)x, 0, sizeof (x)); } /* Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4. */ static void Encode (unsigned char *output, UINT4 *input, unsigned int len) { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) { output[j] = (unsigned char)(input[i] & 0xff); output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); } } /* Decodes input (unsigned char) into output (UINT4). Assumes len is a multiple of 4. */ static void Decode (UINT4 *output, unsigned char *input, unsigned int len) { unsigned int i, j; for (i = 0, j = 0; j < len; i++, j += 4) output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); } /* Note: Replace "for loop" with standard memcpy if possible. */ static void MD5_memcpy (POINTER output, POINTER input, unsigned int len) { unsigned int i; for (i = 0; i < len; i++) output[i] = input[i]; } /* Note: Replace "for loop" with standard memset if possible. */ static void MD5_memset (POINTER output, int value, unsigned int len) { unsigned int i; for (i = 0; i < len; i++) ((char *)output)[i] = (char)value; } mpack-1.6/unixunpk.c0000444005347200000120000000543707707051153010173 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include #include "version.h" #include "part.h" extern int optind; extern char *optarg; extern int overwrite_files; extern int didchat; int quiet; void usage(void); int main(int argc, char **argv) { int opt; FILE *file; int extractText = 0; while ((opt = getopt(argc, argv, "qftC:")) != EOF) { switch (opt) { case 'f': overwrite_files = 1; break; case 'q': quiet = 1; break; case 't': extractText = 1; break; case 'C': if (chdir(optarg)) { perror(optarg); exit(1); } break; default: usage(); } } if (optind == argc) { fprintf(stderr, "munpack: reading from standard input\n"); didchat = 0; handleMessage(part_init(stdin), "text/plain", 0, extractText); if (!didchat) { fprintf(stdout, "Did not find anything to unpack from standard input\n"); } exit(0); } while (argv[optind]) { file = fopen(argv[optind], "r"); if (!file) { perror(argv[optind]); } else { didchat = 0; handleMessage(part_init(file), "text/plain", 0, extractText); fclose(file); if (!didchat) { fprintf(stdout, "Did not find anything to unpack from %s\n", argv[optind]); } } optind++; } exit(0); } void usage(void) { fprintf(stderr, "munpack version %s\n", MPACK_VERSION); fprintf(stderr, "usage: munpack [-f] [-q] [-C directory] [files...]\n"); exit(1); } void warn(char *s) { fprintf(stderr, "munpack: warning: %s\n", s); } void chat(char *s) { didchat = 1; if (!quiet) fprintf(stdout, "%s\n", s); } mpack-1.6/decode.c0000644005347200000120000007175407707050572007550 /* * Decode MIME parts. */ /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include #include #include #include "xmalloc.h" #include "common.h" #include "part.h" #include "md5.h" extern char *os_idtodir(char *id); extern FILE *os_newtypedfile(char *fname, char *contentType, int flags, params contentParams); extern FILE *os_createnewfile(char *fname); extern char *md5contextTo64(MD5_CTX *context); /* The possible content transfer encodings */ enum encoding { enc_none, enc_qp, enc_base64 }; char *ParseHeaders(struct part *inpart, char **subjectp, char **contentTypep, enum encoding *contentEncodingp, char **contentDispositionp, char **contentMD5p); enum encoding parseEncoding(char *s); params ParseContent(char **headerp); char *getParam(params cParams, char *key); char *getDispositionFilename(char *disposition); void from64(struct part *inpart, FILE *outfile, char **digestp, int suppressCR); void fromqp(struct part *inpart, FILE *outfile, char **digestp); void fromnone(struct part *inpart, FILE *outfile, char **digestp); /* * Read and handle an RFC 822 message from the body-part 'inpart'. */ int handleMessage(struct part *inpart, char *defaultContentType, int inAppleDouble, int extractText) { char *headers, *subject, *contentType, *contentDisposition, *contentMD5; enum encoding contentEncoding; params contentParams; /* Parse the headers, getting the ones we're interested in */ headers = ParseHeaders(inpart, &subject, &contentType, &contentEncoding, &contentDisposition, &contentMD5); if (!headers) return 1; /* If no content type, or a non-MIME content type, use the default */ if (!contentType || !strchr(contentType, '/')) { contentType = defaultContentType; } contentParams = ParseContent(&contentType); if (!strcasecmp(contentType, "message/rfc822")) { if (contentEncoding != enc_none) { warn("ignoring invalid content encoding on message/rfc822"); } /* Simple recursion */ return handleMessage(inpart, "text/plain", 0, extractText); } else if (!strcasecmp(contentType, "message/partial")) { if (contentEncoding != enc_none) { warn("ignoring invalid content encoding on message/partial"); } return handlePartial(inpart, headers, contentParams, extractText); } else if (!strncasecmp(contentType, "message/", 8)) { /* Probably message/external. We don't care--toss it */ return ignoreMessage(inpart); } else if (!strncasecmp(contentType, "multipart/", 10)) { if (contentEncoding != enc_none) { warn("ignoring invalid content encoding on multipart"); } return handleMultipart(inpart, contentType, contentParams, extractText); } else if (part_depth(inpart) == 0 && !strncasecmp(contentType, "text/", 5) && contentEncoding == enc_none && !getDispositionFilename(contentDisposition) && !getParam(contentParams, "name")) { /* top-level text message, handle as possible uuencoded file */ return handleUuencode(inpart, subject, extractText); } else if (!extractText && !inAppleDouble && !strncasecmp(contentType, "text/", 5) && !getDispositionFilename(contentDisposition) && !getParam(contentParams, "name")) { return handleText(inpart, contentEncoding); } else { /* Some sort of attachment, extract it */ return saveToFile(inpart, inAppleDouble, contentType, contentParams, contentEncoding, contentDisposition, contentMD5); } } /* * Skip whitespace and RFC-822 comments. */ void SkipWhitespace(char **s) { char *p = *s; int commentlevel = 0; while (*p && (isspace(*p) || *p == '(')) { if (*p == '\n') { p++; if (*p != ' ' && *p != '\t') { *s = 0; return; } } else if (*p == '(') { p++; commentlevel++; while (commentlevel) { switch (*p) { case '\n': p++; if (*p == ' ' || *p == '\t') break; /* FALL THROUGH */ case '\0': *s = 0; return; case '\\': p++; break; case '(': commentlevel++; break; case ')': commentlevel--; break; } p++; } } else p++; } if (*p == 0) { *s = 0; } else { *s = p; } } /* * Read and parse the headers of an RFC 822 message, returning them in * a pointer to a static buffer. The headers are read from 'inpart'. * A pointer to the value of any Subject:, Content-Type:, * Content-Disposition:, or Content-MD5: header is stored in the space * pointed to by 'subjectp', 'contentTypep', contentDispositionp, and * contentMD5p, respectively. The Content-Transfer-Encoding is stored * in the enum pointed to by 'contentEncodingp'. */ #define HEADGROWSIZE 1000 char *ParseHeaders(struct part *inpart, char **subjectp, char **contentTypep, enum encoding *contentEncodingp, char **contentDispositionp, char **contentMD5p) { static int alloced = 0; static char *headers; int left, len, i; char *next, *val; /* Read headers into buffer pointed to by "headers" */ if (!alloced) { headers = xmalloc(alloced = HEADGROWSIZE); } next = headers; *next++ = '\n'; /* Leading newline to make matching header names easier */ left = alloced - 2; /* Allow room for terminating null */ while (part_gets(next, left, inpart) && (*next != '\n' || next[-1] != '\n')) { len = strlen(next); if (next[-1] == '\n') { /* Check for valid header-ness of "next" */ for (i = 0; i < len; i++) { if (next[i] == ':' || next[i] <= ' ' || next[i] >= '\177') break; } if (i == 0 || next[i] != ':') { /* Check for header continuation line */ if (next == headers+1 || (next[0] != ' ' && next[0] != '\t')) { /* * Not a valid header, push back on input stream * and stop reading input. */ part_ungets(next, inpart); break; } } } left -= len; next += len; if (left < 100) { len = next - headers; alloced += HEADGROWSIZE; left += HEADGROWSIZE; headers = xrealloc(headers, alloced); next = headers + len; } } *next = '\0'; /* Look for the headers we find particularly interesting */ *subjectp = *contentTypep = *contentDispositionp = *contentMD5p = 0; *contentEncodingp = enc_none; for (next = headers; *next; next++) { if (*next == '\n') { switch(next[1]) { case 's': case 'S': if (!strncasecmp(next+2, "ubject:", 7)) { val = next+9; SkipWhitespace(&val); if (val) *subjectp = val; } break; case 'c': case 'C': if (!strncasecmp(next+2, "ontent-type:", 12)) { val = next+14; SkipWhitespace(&val); if (val) *contentTypep = val; } else if (!strncasecmp(next+2, "ontent-transfer-encoding:", 25)) { *contentEncodingp = parseEncoding(next+27); } else if (!strncasecmp(next+2, "ontent-disposition:", 19)) { val = next+21; SkipWhitespace(&val); if (val) *contentDispositionp = val; } else if (!strncasecmp(next+2, "ontent-md5:", 11)) { val = next+13; SkipWhitespace(&val); if (val) *contentMD5p = val; } } } } return headers; } /* * Parse the Content-Transfer-Encoding: value pointed to by 's'. * Returns the appropriate encoding enum. */ enum encoding parseEncoding(char *s) { SkipWhitespace(&s); if (s) { switch (*s) { case 'q': case 'Q': if (!strncasecmp(s+1, "uoted-printable", 15) && (isspace(s[16]) || s[16] == '(')) { return enc_qp; } break; case '7': case '8': if (!strncasecmp(s+1, "bit", 3) && (isspace(s[4]) || s[4] == '(')) { return enc_none; } break; case 'b': case 'B': if (!strncasecmp(s+1, "ase64", 5) && (isspace(s[6]) || s[6] == '(')) { return enc_base64; } if (!strncasecmp(s+1, "inary", 5) && (isspace(s[6]) || s[6] == '(')) { return enc_none; } } warn("ignoring unknown content transfer encoding\n"); } return enc_none; } /* * Parse the value of a Content-Type: header. * 'headerp' points to a pointer to the input string. * The pointer pointed to by 'headerp' is changed to point to * a static buffer containing the content type stripped of whitespace * and parameters. The parameters are converted to a type suitable for * getParm() and returned. */ #define PARAMGROWSIZE 10 params ParseContent(char **headerp) { char *header; static int palloced = 0; static char **param; static int calloced = 0; static char *cbuf; char *p; int nparam; p = header = *headerp; /* Find end of header, including continuation lines */ do { p = strchr(p+1, '\n'); } while (p && isspace(p[1])); if (!p) { p = header + strlen(header); } /* If necessary, allocate/grow cbuf to hold header. */ if (p - header >= calloced) { calloced = p - header + 1; if (calloced < 200) calloced = 200; cbuf = xrealloc(cbuf, calloced); } /* Copy header to cbuf */ strncpy(cbuf, header, p - header); cbuf[p - header] = 0; header = *headerp = cbuf; nparam = 0; /* Strip whitespace from content type */ /* ParseHeaders() stripped leading whitespace */ p = header; while (header && *header && *header != ';') { while (*header && !isspace(*header) && *header != '(' && *header != ';') { *p++ = *header++; } SkipWhitespace(&header); } if (!header || !*header) return 0; header++; *p = '\0'; /* Parse the parameters */ while (*header) { SkipWhitespace(&header); if (!header) break; if (nparam+1 >= palloced) { palloced += PARAMGROWSIZE; param = (char **) xrealloc((char *)param, palloced * sizeof(char *)); } param[nparam++] = header; /* Find any separating semicolon. Pay attention to quoted-strings */ while (*header && *header != ';') { if (*header == '\"') { ++header; while (*header && *header != '\"') { if (*header == '\\') { ++header; if (!*header) break; } ++header; } if (!*header) break; } else if (*header == '(') { /* Convert comments to spaces */ p = header; SkipWhitespace(&p); if (!p) { break; } while (header < p) *header++ = ' '; header--; } header++; } if (*header) *header++ = '\0'; } if (nparam == 0) return 0; param[nparam] = 0; return param; } /* * Get the value of the parameter named 'key' from the content-type * parameters 'cParams'. Returns a pointer to a static bufer which * contains the value, or null if no such parameter was found. */ #define VALUEGROWSIZE 100 char *getParam(params cParams, char *key) { static char *value; static int alloced = 0; int left; int keylen = strlen(key); char *from, *to; if (!cParams) return 0; if (!alloced) { value = xmalloc(alloced = VALUEGROWSIZE); } /* Find the named parameter */ while (*cParams) { if (!strncasecmp(key, *cParams, keylen) && ((*cParams)[keylen] == '=' || isspace((*cParams)[keylen]))) break; cParams++; } if (!*cParams) return 0; /* Skip over the "=" and any surrounding whitespace */ from = *cParams + keylen; while (*from && isspace(*from)) from++; if (*from++ != '=') return 0; while (*from && isspace(*from)) from++; if (!*from) return 0; /* Copy value into buffer */ to = value; left = alloced - 1; if (*from == '\"') { /* Quoted-string */ from++; while (*from && *from != '\"') { if (!--left) { alloced += VALUEGROWSIZE; left += VALUEGROWSIZE; value = xrealloc(value, alloced); to = value + alloced - left - 2; } if (*from == '\\') { from++; if (!*from) return 0; } *to++ = *from++; } if (!*from) return 0; } else { /* Just a token */ while (*from && !isspace(*from)) { if (!--left) { alloced += VALUEGROWSIZE; left += VALUEGROWSIZE; value = xrealloc(value, alloced); to = value + alloced - left - 2; } *to++ = *from++; } } *to = '\0'; return value; } /* * Get the value of the "filename" parameter in a Content-Disposition: * header. Returns a pointer to a static buffer containing the value, or * a null pointer if there was no such parameter. */ char * getDispositionFilename(char *disposition) { static char *value; static int alloced = 0; int left; char *to; if (!disposition) return 0; /* Skip until we find ";" "filename" "=" tokens. */ for (;;) { /* Skip until we find ";" */ while (*disposition != ';') { if (!*disposition) return 0; else if (*disposition == '\"') { ++disposition; while (*disposition && *disposition != '\"') { if (*disposition == '\\') { ++disposition; if (!*disposition) return 0; } ++disposition; } if (!*disposition) return 0; } else if (*disposition == '(') { SkipWhitespace(&disposition); if (!disposition) return 0; disposition--; } disposition++; } /* Skip over ";" and trailing whitespace */ disposition++; SkipWhitespace(&disposition); if (!disposition) return 0; /* * If we're not looking at a "filename" token, go back * and look for another ";". Otherwise skip it and * trailing whitespace. */ if (strncasecmp(disposition, "filename", 8) != 0) continue; disposition += 8; if (!isspace(*disposition) && *disposition != '=' && *disposition != '(') { continue; } SkipWhitespace(&disposition); if (!disposition) return 0; /* If we're looking at a ";", we found what we're looking for */ if (*disposition++ == ';') break; } SkipWhitespace(&disposition); if (!disposition) return 0; if (!alloced) { value = xmalloc(alloced = VALUEGROWSIZE); } /* Copy value into buffer */ to = value; left = alloced - 1; if (*disposition == '\"') { /* Quoted-string */ disposition++; while (*disposition && *disposition != '\"') { if (!--left) { alloced += VALUEGROWSIZE; left += VALUEGROWSIZE; value = xrealloc(value, alloced); to = value + alloced - left - 2; } if (*disposition == '\\') { disposition++; if (!*disposition) return 0; } *to++ = *disposition++; } if (!*disposition) return 0; } else { /* Just a token */ while (*disposition && !isspace(*disposition) && *disposition != '(') { if (!--left) { alloced += VALUEGROWSIZE; left += VALUEGROWSIZE; value = xrealloc(value, alloced); to = value + alloced - left - 2; } *to++ = *disposition++; } } *to = '\0'; return value; } /* * Read and handle a message/partial object from the file 'inpart'. */ int handlePartial(struct part *inpart, char *headers, params contentParams, int extractText) { char *id, *dir, *p; int thispart; int nparts = 0; char buf[1024]; FILE *partfile, *outfile; struct part *outpart; int i, docopy; id = getParam(contentParams, "id"); if (!id) { warn("partial message has no id parameter"); goto ignore; } /* Get directory to store the parts being reassembled */ dir = os_idtodir(id); if (!dir) goto ignore; p = getParam(contentParams, "number"); if (!p) { warn("partial message doesn't have number parameter"); goto ignore; } thispart = atoi(p); if (p = getParam(contentParams, "total")) { nparts = atoi(p); if (nparts <= 0) { warn("partial message has invalid number of parts"); goto ignore; } /* Store number of parts in reassembly directory */ sprintf(buf, "%sCT", dir); partfile = os_createnewfile(buf); if (!partfile) { os_perror(buf); goto ignore; } fprintf(partfile, "%d\n", nparts); fclose(partfile); } else { /* Try to retrieve number of parts from reassembly directory */ sprintf(buf, "%sCT", dir); if (partfile = fopen(buf, "r")) { if (fgets(buf, sizeof(buf), partfile)) { nparts = atoi(buf); if (nparts < 0) nparts = 0; } fclose(partfile); } } /* Sanity check */ if (thispart <= 0 || (nparts && thispart > nparts)) { warn("partial message has invalid number"); goto ignore; } sprintf(buf, "Saving part %d ", thispart); if (nparts) sprintf(buf+strlen(buf), "of %d ", nparts); strcat(buf, getParam(contentParams, "id")); chat(buf); /* Create file to store this part */ sprintf(buf, "%s%d", dir, thispart); partfile = os_createnewfile(buf); if (!partfile) { os_perror(buf); goto ignore; } /* Do special-case header handling for first part */ if (thispart == 1) { int skippedfirstbyte = 0; while (*headers) { if (*headers == '\n' && (!strncasecmp(headers, "\ncontent-", 9) || !strncasecmp(headers, "\nmessage-id:", 12))) { /* Special case, skip header */ headers++; while (*headers && (*headers != '\n' || isspace(headers[1]))) { headers++; } } else { /* First byte of headers is extra newline, don't write it to file */ if (skippedfirstbyte++) putc(*headers, partfile); headers++; } } docopy = 0; /* Handle headers in the multipart/partial body */ while (part_gets(buf, sizeof(buf), inpart)) { if (*buf == '\n') { putc('\n', partfile); break; } if (!strncasecmp(buf, "content-", 8) || !strncasecmp(buf, "message-id:", 11)) { docopy = 1; } else if (!isspace(*buf)) { docopy = 0; } if (docopy) fputs(buf, partfile); while(buf[strlen(buf)-1] != '\n' && part_gets(buf, sizeof(buf), inpart)) { if (docopy) fputs(buf, partfile); } } } /* Copy the contents to the file */ while (part_gets(buf, sizeof(buf), inpart)) { fputs(buf, partfile); } fclose(partfile); /* Check to see if we have all parts. Start from the highest numbers * as we are more likely not to have them. */ for (i = nparts; i; i--) { sprintf(buf, "%s%d", dir, i); partfile = fopen(buf, "r"); if (partfile) { fclose(partfile); } else { break; } } if (i || !nparts) { /* We don't have all the parts yet */ return 0; } /* We have everything, concatenate all the parts into a single file */ sprintf(buf, "%sFULL", dir); outfile = os_createnewfile(buf); if (!outfile) { os_perror(buf); return 1; } for (i=1; i<=nparts; i++) { sprintf(buf, "%s%d", dir, i); partfile = fopen(buf, "r"); if (!partfile) { os_perror(buf); return 1; } while (fgets(buf, sizeof(buf), partfile)) { fputs(buf, outfile); } fclose(partfile); /* Done with message part file, delete it */ sprintf(buf, "%s%d", dir, i); remove(buf); } /* Open the concatenated file for reading and handle it */ fclose(outfile); sprintf(buf, "%sFULL", dir); outfile = fopen(buf, "r"); if (!outfile) { os_perror(buf); return 1; } outpart = part_init(outfile); handleMessage(outpart, "text/plain", 0, extractText); part_close(outpart); /* Clean up the rest of the reassembly directory */ sprintf(buf, "%sFULL", dir); remove(buf); sprintf(buf, "%sCT", dir); remove(buf); os_donewithdir(dir); return 0; ignore: ignoreMessage(inpart); return 1; } /* * Skip over a message object from the file 'inpart'. */ int ignoreMessage(struct part *inpart) { while (part_getc(inpart) != EOF); return 0; } /* * Read and handle a multipart object from 'inpart'. */ int handleMultipart(struct part *inpart, char *contentType, params contentParams, int extractText) { char *id; char *defaultContentType = "text/plain"; int isAppleDouble = 0; /* Components of multipart/digest have a different default content-type */ if (!strcasecmp(contentType, "multipart/digest")) { defaultContentType = "message/rfc822"; } if (!strcasecmp(contentType, "multipart/appledouble")) { isAppleDouble++; } if (!(id = getParam(contentParams, "boundary"))) { warn("multipart message has no boundary parameter"); id=""; } /* Add the new boundary id */ part_addboundary(inpart, id); #ifdef __riscos /* * "Marcel" encodes RISCOS directory structure in the multipart * structure. That is the Wrong Way to do it, but we hold our * nose and pass the information to the OS layer. */ os_boundaryhookopen(part_depth(inpart)); #endif /* * Skip over preamble. * HACK: The initial boundary doesn't have to start with a newline, * so we deal with this by stuffing an initial newline into the input * stream */ part_ungetc('\n', inpart); ignoreMessage(inpart); /* Handle the component messages */ while (!part_readboundary(inpart)) { handleMessage(inpart, defaultContentType, isAppleDouble, extractText); } #ifdef __riscos os_boundaryhookclose(part_depth(inpart)); #endif /* Skip over postamble */ ignoreMessage(inpart); /* Remove any lingering unused description file */ (void) remove(TEMPFILENAME); return 0; } /* * Handle a text message object from 'inpart' by saving it to * the temporary description file. */ int handleText(struct part *inpart, enum encoding contentEncoding) { FILE *descfile; descfile = os_createnewfile(TEMPFILENAME); if (!descfile) { os_perror(TEMPFILENAME); ignoreMessage(inpart); return 1; } /* Write the file, handling the appropriate encoding */ switch (contentEncoding) { case enc_none: fromnone(inpart, descfile, (char **)0); break; case enc_qp: fromqp(inpart, descfile, (char **)0); break; case enc_base64: from64(inpart, descfile, (char **)0, 1); break; } fclose(descfile); return 0; } /* * Read a message object from 'inpart' and save it to a file. */ int saveToFile(struct part *inpart, int inAppleDouble, char *contentType, params contentParams, enum encoding contentEncoding, char *contentDisposition, char *contentMD5) { FILE *outfile = 0; int flags = 0; int suppressCR = 0; char *outputmd5; char *fname; if (!strncasecmp(contentType, "text/", 5)) { suppressCR = 1; } else if (contentEncoding == enc_base64) { /* * HEURISTIC: It is not in general possible to determine whether * any non-text content type is line-oriented. We guess * the "binary" status of a part from the composer's choice * of content transfer encoding. * * If the content transfer encoding is "binary" and the input is * not line-oriented, we're screwed anyway--the input file has * been opened in text mode. So the "binary output file" heuristic * is not applied in this case. */ flags |= FILE_BINARY; } if (inAppleDouble) flags |= FILE_INAPPLEDOUBLE; /* Find an appropriate filename and create the output file */ fname = getDispositionFilename(contentDisposition); if (!fname) fname = getParam(contentParams, "name"); if (fname) fname = strsave(fname); outfile = os_newtypedfile(fname, contentType, flags, contentParams); if (fname) free(fname); if (!outfile) { ignoreMessage(inpart); return 1; } /* Write the file, handling the appropriate encoding */ switch (contentEncoding) { case enc_none: fromnone(inpart, outfile, &outputmd5); break; case enc_qp: fromqp(inpart, outfile, &outputmd5); break; case enc_base64: from64(inpart, outfile, &outputmd5, suppressCR); break; } rewind(outfile); /* Check the MD5 digest if it was supplied */ if (contentMD5) { if (strncmp(outputmd5, contentMD5, strlen(outputmd5)) != 0) { os_warnMD5mismatch(); } } free(outputmd5); os_closetypedfile(outfile); return 0; } #define XX 127 /* * Table for decoding hexadecimal in quoted-printable */ static char index_hex[256] = { XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,XX,XX, XX,XX,XX,XX, XX,10,11,12, 13,14,15,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,10,11,12, 13,14,15,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, }; #define HEXCHAR(c) (index_hex[(unsigned char)(c)]) /* * Table for decoding base64 */ static char index_64[256] = { XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,62, XX,XX,XX,63, 52,53,54,55, 56,57,58,59, 60,61,XX,XX, XX,XX,XX,XX, XX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, 15,16,17,18, 19,20,21,22, 23,24,25,XX, XX,XX,XX,XX, XX,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, 41,42,43,44, 45,46,47,48, 49,50,51,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, }; #define CHAR64(c) (index_64[(unsigned char)(c)]) void from64(struct part *inpart, FILE *outfile, char **digestp, int suppressCR) { int c1, c2, c3, c4; int DataDone = 0; char buf[3]; MD5_CTX context; if (digestp) MD5Init(&context); while ((c1 = part_getc(inpart)) != EOF) { if (c1 != '=' && CHAR64(c1) == XX) { continue; } if (DataDone) continue; do { c2 = part_getc(inpart); } while (c2 != EOF && c2 != '=' && CHAR64(c2) == XX); do { c3 = part_getc(inpart); } while (c3 != EOF && c3 != '=' && CHAR64(c3) == XX); do { c4 = part_getc(inpart); } while (c4 != EOF && c4 != '=' && CHAR64(c4) == XX); if (c2 == EOF || c3 == EOF || c4 == EOF) { warn("Premature EOF"); break; } if (c1 == '=' || c2 == '=') { DataDone=1; continue; } c1 = CHAR64(c1); c2 = CHAR64(c2); buf[0] = ((c1<<2) | ((c2&0x30)>>4)); if (!suppressCR || buf[0] != '\r') putc(buf[0], outfile); if (c3 == '=') { if (digestp) MD5Update(&context, buf, 1); DataDone = 1; } else { c3 = CHAR64(c3); buf[1] = (((c2&0x0F) << 4) | ((c3&0x3C) >> 2)); if (!suppressCR || buf[1] != '\r') putc(buf[1], outfile); if (c4 == '=') { if (digestp) MD5Update(&context, buf, 2); DataDone = 1; } else { c4 = CHAR64(c4); buf[2] = (((c3&0x03) << 6) | c4); if (!suppressCR || buf[2] != '\r') putc(buf[2], outfile); if (digestp) MD5Update(&context, buf, 3); } } } if (digestp) *digestp = md5contextTo64(&context); } void fromqp(struct part *inpart, FILE *outfile, char **digestp) { int c1, c2; MD5_CTX context; char c; if (digestp) MD5Init(&context); while ((c1 = part_getc(inpart)) != EOF) { if (c1 == '=') { c1 = part_getc(inpart); if (c1 != '\n') { c1 = HEXCHAR(c1); c2 = part_getc(inpart); c2 = HEXCHAR(c2); c = c1<<4 | c2; if (c != '\r') putc(c, outfile); if (digestp) MD5Update(&context, &c, 1); } } else { putc(c1, outfile); if (c1 == '\n') { if (digestp) MD5Update(&context, "\r", 1); } c = c1; if (digestp) MD5Update(&context, &c, 1); } } if (digestp) *digestp=md5contextTo64(&context); } void fromnone(struct part *inpart, FILE *outfile, char **digestp) { int c; char ch; MD5_CTX context; if (digestp) MD5Init(&context); while ((c = part_getc(inpart)) != EOF) { putc(c, outfile); if (c == '\n') { if (digestp) MD5Update(&context, "\r", 1); } ch = c; if (digestp) MD5Update(&context, &ch, 1); } if (digestp) *digestp=md5contextTo64(&context); } mpack-1.6/uudecode.c0000644005347200000120000005574407707050455010123 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include #include #include #include "xmalloc.h" #include "common.h" #include "part.h" extern char *os_idtodir(char *id); extern FILE *os_newtypedfile(char *fname, char *contentType, int flags, params contentParams); extern FILE *os_createnewfile(char *fname); static FILE *startDescFile(char *fname); /* Length of a normal uuencoded line, including newline */ #define UULENGTH 62 /* * Table of valid boundary characters * * XXX: Old versions of Mark Crispin's c-client library * generate boundaries which contain the syntactically * illegal character '#'. It is marked in this table with * a 2 in case we want to use this table in the future to * complain about bad syntax. * */ static char bchar[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; /* * Read an input file, looking for data in split-uuencode format */ int handleUuencode(struct part *inpart, char *subject, int extractText) { char *fname = 0, *tmpfname; int part, nparts; int tmppart, tmpnparts; char buf[1024], buf2[1024]; char fnamebuf[80]; char *boundary_end, *p; int wantdescfile = 0; FILE *descfile = 0; /* Scan "Subject:" header for filename/part information */ if (parseSubject(subject, &fname, &part, &nparts) != 0) { part = -1; } if (part == 0) { return saveUuFile(inpart, fname, part, nparts, (char *)0); } if (part == 1) { wantdescfile = 1; } /* Scan body for interesting lines */ while (part_gets(buf, sizeof(buf), inpart)) { /* Uuencode "begin" line */ if (!strncmp(buf, "begin ", 6) && isdigit(buf[6]) && isdigit(buf[7]) && isdigit(buf[8]) && buf[9] == ' ') { if (part == -1) { /* * We have no part N of M information. Perhaps it is * a single-part uuencoded file. */ return saveUuFile(inpart, (char *)0, 1, 0, buf); } else { if (descfile) fclose(descfile); return saveUuFile(inpart, fname, part, nparts, buf); } } else if (!strncmp(buf, "section ", 8) && isdigit(buf[8])) { tmppart = 0; for (p = buf+8; isdigit(*p); p++) tmppart = tmppart*10 + *p - '0'; if (tmppart == 0) continue; if (strncmp(p, " of ", 4) == 0) { /* * "section N of ... of file F ..." */ for (p += 4; *p && strncmp(p, " of file ", 9) != 0; p++); if (!*p) continue; p += 9; tmpfname = p; p = strchr(p, ' '); if (!p) continue; *p = '\0'; if (descfile) fclose(descfile); return saveUuFile(inpart, tmpfname, tmppart, 0, (char *)0); } else if (*p == '/' && isdigit(p[1])) { /* * "section N/M file F ..." */ tmpnparts = 0; for (p++; isdigit(*p); p++) { tmpnparts = tmpnparts*10 + *p - '0'; } while (*p && isspace(*p)) p++; if (tmppart > tmpnparts || strncmp(p, "file ", 5) != 0) { continue; } tmpfname = p+5; p = strchr(tmpfname, ' '); if (!p) continue; *p = '\0'; if (descfile) fclose(descfile); return saveUuFile(inpart, tmpfname, tmppart, tmpnparts, (char *)0); } } else if (!strncmp(buf, "POST V", 6)) { /* * "POST Vd.d.d F (Part N/M)" */ p = strchr(buf+6, ' '); if (!p) continue; tmpfname = p+1; p = strchr(tmpfname, ' '); if (!p || strncmp(p, " (Part ", 7) != 0) continue; *p = '\0'; p += 7; tmppart = 0; while (isdigit(*p)) tmppart = tmppart*10 + *p++ - '0'; if (tmppart == 0 || *p++ != '/') continue; tmpnparts = 0; while (isdigit(*p)) tmpnparts = tmpnparts*10 + *p++ - '0'; if (tmppart > tmpnparts || *p != ')') continue; if (descfile) fclose(descfile); return saveUuFile(inpart, tmpfname, tmppart, tmpnparts, (char *)0); } else if (!strncmp(buf, "File: ", 6)) { /* * "File: F -- part N of M -- ... */ tmpfname = buf+6; p = strchr(tmpfname, ' '); if (!p || strncmp(p, " -- part ", 9) != 0) continue; *p = '\0'; p += 9; tmppart = 0; while (isdigit(*p)) tmppart = tmppart*10 + *p++ - '0'; if (tmppart == 0 || strncmp(p, " of ", 4) != 0) continue; p += 4; tmpnparts = 0; while (isdigit(*p)) tmpnparts = tmpnparts*10 + *p++ - '0'; if (tmppart > tmpnparts || strncmp(p, " -- ", 4) != 0) continue; if (descfile) fclose(descfile); return saveUuFile(inpart, tmpfname, tmppart, tmpnparts, (char *)0); } else if (!strncmp(buf, "[Section: ", 10)) { /* * "[Section: N/M File: F ..." */ tmppart = 0; for (p = buf+10; isdigit(*p); p++) tmppart = tmppart*10 + *p - '0'; if (tmppart == 0) continue; tmpnparts = 0; for (p++; isdigit(*p); p++) { tmpnparts = tmpnparts*10 + *p - '0'; } while (*p && isspace(*p)) p++; if (tmppart > tmpnparts || strncmp(p, "File: ", 6) != 0) { continue; } tmpfname = p+6; p = strchr(tmpfname, ' '); if (!p) continue; *p = '\0'; if (descfile) fclose(descfile); return saveUuFile(inpart, tmpfname, tmppart, tmpnparts, (char *)0); } else if (*buf == '[') { /* * "[F ... - part N of M]" * (usual BinHex practice) */ tmpfname = buf+1; p = strchr(tmpfname, ' '); if (!p) continue; *p++ = '\0'; while (p && strncmp(p, "- part ", 7) != 0) { p = strchr(p+1, '-'); } if (!p) continue; p += 7; tmppart = 0; while (isdigit(*p)) tmppart = tmppart*10 + *p++ - '0'; if (tmppart == 0 || strncmp(p, " of ", 4) != 0) continue; p += 4; tmpnparts = 0; while (isdigit(*p)) tmpnparts = tmpnparts*10 + *p++ - '0'; if (tmppart > tmpnparts || *p != ']') continue; if (descfile) fclose(descfile); return saveUuFile(inpart, tmpfname, tmppart, tmpnparts, (char *)0); } else if (fname && part > 0 && nparts > 0 && part <= nparts && (!strncmp(buf, "BEGIN", 5) || !strncmp(buf, "--- BEGIN ---", 12) || (buf[0] == 'M' && strlen(buf) == UULENGTH))) { /* * Found the start of a section of uuencoded data * and have the part N of M information. */ if (descfile) fclose(descfile); return saveUuFile(inpart, fname, part, nparts, buf); } else if (!strncasecmp(buf, "x-file-name: ", 13)) { for (p = buf + 13; *p && !isspace(*p); p++); *p = '\0'; strncpy(fnamebuf, buf+13, sizeof(fnamebuf)-1); fnamebuf[sizeof(fnamebuf)-1] = '\0'; fname = fnamebuf; continue; } else if (!strncasecmp(buf, "x-part: ", 8)) { tmppart = atoi(buf+8); if (tmppart > 0) part = tmppart; continue; } else if (!strncasecmp(buf, "x-part-total: ", 14)) { tmpnparts = atoi(buf+14); if (tmpnparts > 0) nparts = tmpnparts; continue; } else if (part == 1 && fname && !descfile && !strncasecmp(buf, "x-file-desc: ", 13)) { if (descfile = startDescFile(fname)) { fputs(buf+13, descfile); fclose(descfile); descfile = 0; } continue; } else if (!strcmp(buf, "(This file must be converted with BinHex 4.0)\n")) { if (descfile) fclose(descfile); return os_binhex(inpart, 1, 1); } else if (!strncasecmp(buf, "content-", 8)) { /* * HEURISTIC: If we see something that looks like a content-* * header, push it back and call the message parser. */ p = buf+8; /* Check to see if header's field-name is syntactically valid */ while (*p) { if (*p == ':' || *p <= ' ' || *p >= '\177') break; p++; } if (*p == ':') { part_ungets(buf, inpart); if (descfile) fclose(descfile); return handleMessage(inpart, "text/plain", 0, extractText); } } if (buf[0] == '-' && buf[1] == '-') { /* * Heuristic: If we see something that looks like a * multipart boundary, followed by something that looks * like a header, push them back and parse as a multipart. */ p = buf+2; while (*p) { if (!bchar[(unsigned char)*p]) break; p++; } if (*p != '\n') { /* * We found an invalid boundary character. * Move 'p' such that it will fail all subsequent checks. */ p = buf + 2; } /* Back up to ignore trailing whitespace */ while (p > buf+2 && p[-1] == ' ') p--; /* * Check that boundary is within legal size limits * If so, peek at next line */ if (p - buf > 2 && p - buf <= 72 && part_gets(buf2, sizeof(buf2), inpart)) { boundary_end = p; p = buf2; /* * Check to see if a syntactically valid header follows * what looks to be a boundary. * * XXX: Unfortunately, we can't check for "Content-"; * it is syntactically valid to have a body-part * header that doesn't start with that and ZMail * takes advantage of that. If this heuristic starts * causing problems, we could keep looking ahead until * we find a "Content-" header or find something that's * not a header. */ while (*p) { if (*p == ':' || *p <= ' ' || *p >= '\177') break; p++; } /* Push back the lookahead line */ part_ungets(buf2, inpart); if (p > buf2 && *p == ':') { /* Push back the boundary */ part_ungets(buf, inpart); /* * Generate and push back a header to get us into * the multipart parser. */ *boundary_end = '\0'; sprintf(buf2, "Content-type: multipart/mixed; boundary=\"%s\"\n\n", buf+2); part_ungets(buf2, inpart); if (descfile) fclose(descfile); return handleMessage(inpart, "text/plain", 0, extractText); } } } /* * Save useful-looking text that is before a "part 1 of N" * in a description file. */ if (wantdescfile && !descfile) { for (p = buf; *p && isspace(*p); p++); if (*p) { if (!strncasecmp(p, "x-", 2)) { /* * Check for "X-foobar:" * If so, there probably will be a "X-File-Desc:" line * later, so ignore this line. */ while (*p != ':' && *p > ' ' && *p < '\177') p++; if (*p == ':') continue; } if (!descEnd(buf) && (descfile = startDescFile(fname))) { fputs(buf, descfile); } wantdescfile = 0; } } else if (descfile) { if (descEnd(buf)) { fclose(descfile); descfile = 0; } else { fputs(buf, descfile); } } } if (descfile) fclose(descfile); return 0; } /* * Handle a split-uuencode part * If nparts is 0, then look for an "end" line to detect the last part. * If fname is null, then we are attempting to decode a single-part message. * If firstline is non-null, it is written as the first line of the saved part */ int saveUuFile(struct part *inpart, char *fname, int part, int nparts, char *firstline) { char buf[1024]; char *dir; FILE *partfile; if (fname) { sprintf(buf, "Saving part %d ", part); if (nparts) sprintf(buf+strlen(buf), "of %d ", nparts); strcat(buf, fname); chat(buf); } else fname = "unknown"; /* Create directory to store parts and copy this part there. */ dir = os_idtodir(fname); if (!dir) return 1; sprintf(buf, "%s%d", dir, part); partfile = os_createnewfile(buf); if (!partfile) { os_perror(buf); return 1; } if (firstline) fputs(firstline, partfile); while (part_gets(buf, sizeof(buf), inpart)) { fputs(buf, partfile); if (nparts == 0 && strcmp(buf, "end\n") == 0) { /* This is the last part. Remember the fact */ nparts = part; fclose(partfile); sprintf(buf, "%sCT", dir); partfile = os_createnewfile(buf); if (!partfile) { os_perror(buf); } else { fprintf(partfile, "%d\n", nparts); } break; } } fclose(partfile); /* Retrieve any previously saved number of the last part */ if (nparts == 0) { sprintf(buf, "%sCT", dir); if (partfile = fopen(buf, "r")) { if (fgets(buf, sizeof(buf), partfile)) { nparts = atoi(buf); if (nparts < 0) nparts = 0; } fclose(partfile); } } if (nparts == 0) return 0; /* Check to see if we have all parts. Start from the highest numbers * as we are more likely not to have them. */ for (part = nparts; part; part--) { sprintf(buf, "%s%d", dir, part); partfile = fopen(buf, "r"); if (partfile) { fclose(partfile); } else { return 0; } } return uudecodefiles(dir, nparts); } /* * Parse a Subject: header, looking for clues with which to decode * split-uuencoded data. */ int parseSubject(char *subject, char **fnamep, int *partp, int *npartsp) { char *scan, *bak, *start; int part = -1, nparts = 0, hasdot = 0; /* No subject header */ if (!subject) return 1; /* Skip leading whitespace and other garbage */ scan = subject; while (*scan == ' ' || *scan == '\t' || *scan == '-') scan++; if (!strncasecmp(scan, "repost", 6)) { for (scan += 6; *scan == ' ' || *scan == '\t' || *scan == ':' || *scan == '-'; scan++); } /* Replies aren't usually data */ if (!strncasecmp(scan, "re:", 3)) return 1; /* Get filename */ /* Grab the first filename-like string. Explicitly ignore strings with * prefix "v" ending in ":", since that is a popular volume/issue * representation syntax */ do { while (*scan != '\n' && !isalnum(*scan) && *scan != '_') ++scan; *fnamep = start = scan; while (isalnum(*scan) || *scan == '-' || *scan == '+' || *scan == '&' || *scan == '_' || *scan == '.') { if (*scan++ == '.') hasdot = 1; } if (!*scan || *scan == '\n') return 1; } while (start == scan || (start[0] == 'v' && isdigit(start[1]) && *scan == ':')); *scan++ = '\0'; /* Try looking for a filename with a "." in it later in the subject line. * Exclude ., since that is usually a version number. */ if (!hasdot) { while (*(start = scan) != '\0' && *scan != '\n') { while (isspace(*start)) ++start; for (scan = start; isalnum(*scan) || *scan == '-' || *scan == '+' || *scan == '&' || *scan == '_' || *scan == '.'; ++scan) { if (*scan == '.' && (!isdigit(scan[-1]) || !isdigit(scan[1]))) { hasdot = 1; } } if (hasdot && scan > start) { *fnamep = start; *scan++ = '\0'; break; } while (*scan && *scan != '\n' && !isalnum(*scan)) ++scan; } scan = *fnamep + strlen(*fnamep) + 1; } /* Get part number */ while (*scan && *scan != '\n') { /* skip over versioning */ if (*scan == 'v' && isdigit(scan[1])) { ++scan; while (isdigit(*scan)) ++scan; } /* look for "1/6" or "1 / 6" or "1 of 6" or "1-of-6" or "1o6" */ if (isdigit(*scan) && (scan[1] == '/' || (scan[1] == ' ' && scan[2] == '/') || (scan[1] == ' ' && scan[2] == 'o' && scan[3] == 'f') || (scan[1] == '-' && scan[2] == 'o' && scan[3] == 'f') || (scan[1] == 'o' && isdigit(scan[2])))) { while (isdigit(scan[-1])) scan--; part = 0; while (isdigit(*scan)) { part = part * 10 + *scan++ - '0'; } while (*scan != '\0' && *scan != '\n' && !isdigit(*scan)) scan++; if (isdigit(*scan)) { nparts = 0; while (isdigit(*scan)) { nparts = nparts * 10 + *scan++ - '0'; } } break; } /* look for "6 parts" or "part 1" */ if (!strncasecmp("part", scan, 4)) { if (scan[4] == 's') { for (bak = scan; bak >= subject && !isdigit(*bak); bak--); if (bak > subject) { while (bak > subject && isdigit(bak[-1])) bak--; nparts = 0; while (isdigit(*bak)) { nparts = nparts * 10 + *bak++ - '0'; } } } else { while (*scan && *scan != '\n' && !isdigit(*scan)) scan++; bak = scan - 1; if (isdigit(*scan)) { part = 0; do { part = part * 10 + *scan++ - '0'; } while (isdigit(*scan)); } scan = bak; } } scan++; } if (nparts == 0 || part == -1 || part > nparts) return 1; *partp = part; *npartsp = nparts; return 0; } /* * Return nonzero if 'line' should mark the end of a part-1 description */ int descEnd(char *line) { return !strncmp(line, "---", 3) || !strncmp(line, "#!", 2) || !strncasecmp(line, "part=", 5) || !strncasecmp(line, "begin", 5); } /* * Open and return a file pointer for a description file for 'fname'. * If a description file for 'fname' already exists, or if there is an * error, return a null pointer. */ static FILE *startDescFile(char *fname) { char buf[1024]; char *dir; FILE *descfile; /* Create directory to store parts and copy this part there. */ dir = os_idtodir(fname); if (!dir) return 0; sprintf(buf, "%s0", dir); /* See if part 0 already exists, return failure if so */ descfile = fopen(buf, "r"); if (descfile) { fclose(descfile); return 0; } descfile = os_createnewfile(buf); if (!descfile) { os_perror(buf); return 0; } return descfile; } /* * Decode the uuencoded file that is in 'nparts' pieces in 'dir'. */ int uudecodefiles(char *dir, int nparts) { int part; enum {st_start, st_inactive, st_decode, st_nextlast, st_last, st_binhex} state; FILE *infile; FILE *outfile = NULL; struct part *inpart; char buf[1024]; char lastline[UULENGTH+1]; char *fname, *p; char *contentType = "application/octet-stream"; int line_length = 0; /* If a part 0, copy to description filename */ sprintf(buf, "%s0", dir); infile = fopen(buf, "r"); if (infile) { outfile = os_createnewfile(TEMPFILENAME); if (outfile) { while (fgets(buf, sizeof(buf), infile)) { fputs(buf, outfile); } fclose(outfile); outfile = NULL; } fclose(infile); sprintf(buf, "%s0", dir); remove(buf); } state = st_start; /* Handle each part in order */ for (part = 1; part <= nparts; part++) { sprintf(buf, "%s%d", dir, part); infile = fopen(buf, "r"); if (!infile) { os_perror(buf); if (outfile) fclose(outfile); remove(TEMPFILENAME); return 1; } while (fgets(buf, sizeof(buf), infile)) { switch (state) { case st_start: /* Looking for start of uuencoded * or binhex'ed file */ if (!strcmp(buf, "(This file must be converted with BinHex 4.0)\n")) { state = st_binhex; inpart = part_init(infile); os_binhex(inpart, part, nparts); part_close(inpart); goto endbinhex; } if (strncmp(buf, "begin ", 6)) break; /* skip mode */ p = buf + 6; while (*p && !isspace(*p)) p++; while (*p && isspace(*p)) p++; fname = p; while (*p && !isspace(*p)) p++; *p = '\0'; if (!*fname) return 1; /* Guess the content-type of common filename extensions */ if (p = strrchr(fname, '.')) { if (!strcasecmp(p, ".gif")) contentType = "image/gif"; if (!strcasecmp(p, ".jpg")) contentType = "image/jpeg"; if (!strcasecmp(p, ".jpeg")) contentType = "image/jpeg"; if (!strcasecmp(p, ".mpg")) contentType = "video/mpeg"; if (!strcasecmp(p, ".mpeg")) contentType = "video/mpeg"; } /* Create output file and start decoding */ outfile = os_newtypedfile(fname, contentType, FILE_BINARY, (params) 0); if (!outfile) { fclose(infile); return 1; } state = st_decode; break; case st_inactive: /* Looking for uuencoded data to resume */ if (*buf != 'M' || strlen(buf) != line_length) { if (*buf == 'B' && !strncmp(buf, "BEGIN", 5)) { state = st_decode; } break; } state = st_decode; /* FALL THROUGH */ case st_decode: /* Decoding data */ if (line_length == 0) line_length = strlen(buf); if (*buf == 'M' && strlen(buf) == line_length) { uudecodeline(buf, outfile); break; } if (strlen(buf) > line_length) { state = st_inactive; break; } /* * May be on nearing end of file. * Save this line in case we are. */ strcpy(lastline, buf); if (*buf == ' ' || *buf == '`') { state = st_last; } else { state = st_nextlast; } break; case st_nextlast: /* May be nearing end of file */ if (*buf == ' ' || *buf == '`') { state = st_last; } else { state = st_inactive; } break; case st_last: /* Should be at end of file */ if (!strncmp(buf, "end", 3) && isspace(buf[3])) { /* Handle that last line we saved */ uudecodeline(lastline, outfile); fclose(infile); os_closetypedfile(outfile); for (;part <= nparts; part++) { sprintf(buf, "%s%d", dir, part); remove(buf); } sprintf(buf, "%sCT", dir); remove(buf); os_donewithdir(dir); return 0; } state = st_inactive; break; case st_binhex: if (strncmp(buf, "---", 3)) break; inpart = part_init(infile); os_binhex(inpart, part, nparts); part_close(inpart); goto endbinhex; } } if (state != st_binhex) state = st_inactive; fclose(infile); endbinhex: sprintf(buf, "%s%d", dir, part); remove(buf); } if (outfile) os_closetypedfile(outfile); if (state == st_binhex) os_binhex(0, 0, 0); sprintf(buf, "%sCT", dir); remove(buf); os_donewithdir(dir); return 0; } #define DEC(c) (((c) - ' ') & 077) /* * Decode a uuencoded line to 'outfile' */ int uudecodeline(char *line, FILE *outfile) { int c, len; len = DEC(*line++); while (len) { c = DEC(*line) << 2 | DEC(line[1]) >> 4; putc(c, outfile); if (--len) { c = DEC(line[1]) << 4 | DEC(line[2]) >> 2; putc(c, outfile); if (--len) { c = DEC(line[2]) << 6 | DEC(line[3]); putc(c, outfile); len--; } } line += 4; } return; } mpack-1.6/part.c0000444005347200000120000001733407707047223007262 /* * Read MIME body-part, stopping on boundaries. */ /* (C) Copyright 1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include #include #include "part.h" #include "xmalloc.h" #define BUFSIZE 1024 /* must be > PART_MAX_BOUNDARY_LEN */ #define GROWBOUNDARY 20 static int pendingboundary(struct part *part); /* * Create, initialize, and return a new struct part pointer * for the input file 'infile'. */ struct part *part_init(FILE *infile) { static struct part zeropart; struct part *newpart; newpart = (struct part *)xmalloc(sizeof(struct part)); *newpart = zeropart; newpart->infile = infile; newpart->buf = (unsigned char *)xmalloc(BUFSIZE); newpart->buf_alloc = BUFSIZE; return newpart; } /* * Close and free 'part'. */ int part_close(struct part *part) { fclose(part->infile); if (part->buf) free(part->buf); if (part->boundary) free(part->boundary); } /* * Return the multipart depth of 'part'. Top-level is '0'. */ int part_depth(struct part *part) { return part->boundary_num; } /* * Add to 'part' the multipart boundary 'boundary'. */ int part_addboundary(struct part *part, char *boundary) { /* Grow boundary array if necessary */ if (part->boundary_num == part->boundary_alloc) { part->boundary_alloc += GROWBOUNDARY; part->boundary = (char (*)[PART_MAX_BOUNDARY_LEN+1]) xrealloc((char *)part->boundary, part->boundary_alloc * (PART_MAX_BOUNDARY_LEN+1)); part->boundary_length = (int *) xrealloc((char *)part->boundary_length, part->boundary_alloc * sizeof(int)); } strncpy(part->boundary[part->boundary_num], boundary, PART_MAX_BOUNDARY_LEN); part->boundary[part->boundary_num][PART_MAX_BOUNDARY_LEN] = '\0'; part->boundary_length[part->boundary_num] = strlen(part->boundary[part->boundary_num]); part->boundary_num++; if (part->boundary_seen+1 == part->boundary_num) { part->boundary_seen++; } } /* * Private function that is only called from the part_getc() macro. * * Fills the input buffer for 'part' if necessary. Returns the next * input character or EOF if at a boundary or end of file. */ int part_fill(struct part *part) { /* part_getc() decremented this before calling us, put it back */ part->cnt++; /* Return EOF if we saw a boundary */ if (part->boundary_seen < part->boundary_num) return EOF; /* Fill buffer if it is empty */ if (part->cnt == 0) { part->ptr = part->buf; part->cnt = fread(part->buf, 1, part->buf_alloc, part->infile); if (part->cnt == 0) { part->boundary_seen = 0; return EOF; } } /* If there is a newline, see if it is followed by a boundary */ if (part->ptr[0] == '\n' && pendingboundary(part)) { return EOF; } part->cnt--; return *part->ptr++; } /* * Read a line into the array 's', of size 'n', from 'part'. * Reads until 'n'-1 characters are read, a newline is read, or * an EOF is encountered. The array is then nul-terminated and returned. * If the first character read is an EOF, then a null pointer is instead * returned. */ char * part_gets(char *s, int n, struct part *part) { int c; char *p = s; if (n == 0) return 0; n--; while (n-- && (c = part_getc(part)) != EOF) { *p++ = c; if (c == '\n') break; } if (p == s) return 0; *p++ = '\0'; return s; } /* * Push back the string 's' into the input buffer of 'part'. * Leaves room in the input buffer to push back an additional single * character using the prot_ungetc() macro. */ int part_ungets(char *s, struct part *part) { int len = strlen(s); int i; /* Grow buffer if necessary */ if (part->cnt + len + 1 > part->buf_alloc) { i = part->ptr - part->buf; part->buf_alloc = part->cnt + len + 1; part->buf = (unsigned char *) xrealloc((char *)part->buf, part->buf_alloc); part->ptr = part->buf + i; } /* Move current data down to make room for new data if necessary */ if (len + 1 > part->ptr - part->buf) { for (i = part->cnt-1; i >= 0; i--) { part->buf[len+1+i] = part->ptr[i]; } part->ptr = part->buf + len + 1; } /* Copy in the new data */ part->ptr -= len; part->cnt += len; for (i = 0; i < len; i++) { part->ptr[i] = s[i]; } } /* * Reset the saw-boundary state of 'part' and set up to read next * body-part Returns nonzero iff the pending boundary was a final * boundary of the current multipart. */ int part_readboundary(struct part *part) { int c; int sawfinal = 0; if (part->boundary_seen < part->boundary_num-1) { /* We saw an enclosing boundary. Signal end of multipart, but * don't skip over the boundary. */ part->boundary_num--; return 1; } /* Deal with EOF on input stream */ if (part->cnt == 0) return 1; /* Skip over delimiter, reset the "saw boundary" state */ part->ptr += part->boundary_length[part->boundary_seen] + 3; part->cnt -= part->boundary_length[part->boundary_seen] + 3; part->boundary_seen = part->boundary_num; /* Check for two dashes, which indicate a final delimiter */ c = part_getc(part); if (c == '-') { c = part_getc(part); if (c == '-') { sawfinal = 1; part->boundary_num--; } } /* Eat rest of the boundary line */ while (c != '\n' && c != EOF) { c = part_getc(part); } return sawfinal; } /* * Return nonzero and set the saw-boundary state iff 'part' * is positioned at a boundary. */ static int pendingboundary(struct part *part) { int bufleft; int i; /* Fill buffer if we don't have enough to do our look ahead */ if (part->cnt < 3 || (part->cnt < PART_MAX_BOUNDARY_LEN+3 && part->ptr[1] == '-' && part->ptr[2] == '-')) { bufleft = part->buf_alloc - part->cnt - (part->ptr - part->buf); /* If not enough room, move everything to beginning of buffer */ if (part->ptr!=part->buf && bufleft + part->cnt < PART_MAX_BOUNDARY_LEN+3) { for (i = 0; i < part->cnt; i++) { part->buf[i] = part->ptr[i]; } part->ptr = part->buf; bufleft = part->buf_alloc - part->cnt; } /* Read in more data */ part->cnt += fread(part->ptr+part->cnt, 1, bufleft, part->infile); } /* If no "--", it's not a boundary */ if (part->cnt < 3 || part->ptr[1] != '-' || part->ptr[2] != '-') { return 0; } for (i = 0; i < part->boundary_num; i++) { if (part->cnt - 3 >= part->boundary_length[i] && !strncmp((char *)part->ptr+3, part->boundary[i], part->boundary_length[i])) { break; } } if (i == part->boundary_num) return 0; /* Saw boundary, index 'i' */ part->boundary_seen = i; return 1; } mpack-1.6/common.h0000444005347200000120000000324707707075762007620 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #ifdef __riscos #define TEMPFILENAME "TempDesc" #else #define TEMPFILENAME "tempdesc.txt" #endif #if defined(unix) && !defined(remove) #define remove unlink #endif typedef char **params; /* Flags for os_newtypedfile */ #define FILE_BINARY 0x1 /* File should be opened in binary mode */ #define FILE_INAPPLEDOUBLE 0x2 /* File was inside multipart/appledouble */ #ifndef HAVE_STRCHR #define strchr index #define strrchr rindex #endif mpack-1.6/md5.h0000444005347200000120000000412407707047223006777 /* MD5.H - header file for MD5C.C */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ /* GLOBAL.H - RSAREF types and constants */ /* PROTOTYPES should be set to one if and only if the compiler supports function argument prototyping. The following makes PROTOTYPES default to 0 if it has not already been defined with C compiler flags. */ #ifndef PROTOTYPES #define PROTOTYPES 0 #endif /* POINTER defines a generic pointer type */ typedef unsigned char *POINTER; /* UINT2 defines a two byte word */ typedef unsigned short int UINT2; /* UINT4 defines a four byte word */ typedef unsigned long int UINT4; /* PROTO_LIST is defined depending on how PROTOTYPES is defined above. If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it returns an empty list. */ #if PROTOTYPES #define PROTO_LIST(list) list #else #define PROTO_LIST(list) () #endif /* MD5 context. */ typedef struct { UINT4 state[4]; /* state (ABCD) */ UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ } MD5_CTX; void MD5Init PROTO_LIST ((MD5_CTX *)); void MD5Update PROTO_LIST ((MD5_CTX *, unsigned char *, unsigned int)); void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); mpack-1.6/part.h0000444005347200000120000000422207707047223007257 /* * Read MIME body-part, stopping on boundaries. */ /* (C) Copyright 1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* Max length of a MIME "boundary", per RFC 1521 */ #define PART_MAX_BOUNDARY_LEN 70 /* Structure describing an input file from which we read MIME */ struct part { /* Input file */ FILE *infile; /* Input buffer */ unsigned char *buf; int buf_alloc; unsigned char *ptr; int cnt; /* Boundary information */ char (*boundary)[PART_MAX_BOUNDARY_LEN+1]; int *boundary_length; int boundary_alloc; int boundary_num; int boundary_seen; /* Index of boundary last seen, or * boundary_num if no pending boundary */ }; #define part_getc(s) (((s)->cnt-- > 0 && (s)->ptr[0] != '\n') ? (int)*(s)->ptr++ : part_fill(s)) #define part_ungetc(c, s) ((s)->cnt++, ((s)->boundary_seen = (s)->boundary_num), (*--(s)->ptr = (c))) extern struct part *part_init(FILE *infile); extern char *part_gets(char *s, int n, struct part *part); mpack-1.6/version.h0000444005347200000120000000241407707033646010003 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #define MPACK_VERSION "1.6" mpack-1.6/xmalloc.h0000444005347200000120000000253507707047223007755 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ extern char *xmalloc(int size); extern char *xrealloc(char *ptr, int size); extern char *strsave(char *str); mpack-1.6/README.mac0000644005347200000120000001354507707027502007567 mpack/munpack version 1.5 for mac Mpack and munpack are utilities for encoding and decoding (respectively) binary files in MIME (Multipurpose Internet Mail Extensions) format mail messages. For compatibility with older forms of transferring binary files, the munpack program can also decode messages in split-uuencoded format. The Macintosh version can also decode messages in split-BinHex format. The canonical FTP site for this software is ftp.andrew.cmu.edu:pub/mpack/ Binaries are no longer provided. The pc, os2, amiga and archimedes ports have been removed. The mac version probably doesn't compile anymore, but is still included (MacOS X users can use the unix version...) This MIME implementation is intended to be as simple and portable as possible. For a slightly more sophisticated MIME implementation, see the program MetaMail, available via anonymous FTP to thumper.bellcore.com, in directory pub/nsb Decoding MIME messages: To decode a MIME message, first save it to a text file. If possible, save it with all headers included. Mpack can decode some MIME files when the headers are missing or incomplete, other files it cannot decode without having the information in the headers. In general, messages which have a statement at the beginning that they are in MIME format can be decoded without the headers. Messages which have been split into multiple parts generally require all headers in order to be reassembled and decoded. Some LAN-based mail systems and some mail providers (including America Online, as of the writing of this document) place the mail headers at the bottom of the message, instead of at the top of the message. If you are having problems decoding a MIME message on such a system, you need to convert the mail back into the standard format by removing the system's nonstandard headers and moving the standard Internet headers to the top of the message (separated from the message body with a blank line). There must be exactly one message per file. Mpack cannot deal with multiple messages in a single file, to decode things correctly it must know when one message ends and the next one begins. The Macintosh version of mpack/munpack is a single standalone application. A text file may be decoded either by drag & drop, or by choosing the "Decode Files..." item from the application's File menu. Non-text files may be encoded either by drag & drop, or by choosing the "Encode Files..." item from the application's File menu. The Macintosh version of mpack/munpack supports the new MacMIME standard (RFC 1740). This allows cross-platform transport of Macintosh files to any MIME-capable machine, and also preserves Macintosh specific file attributes between two Macintoshes. Mpack will use MacMIME for any unrecognized Macintosh file, and regular MIME for standard MIME types. For more details and descriptions of the preferences, see the "Help Using Mpack..." menu item in mpack which can be found under the help menu in systems 7 and above, and under the apple menu in older systems. Reporting bugs: Bugs and comments should be reported to mpack-bugs@andrew.cmu.edu. When reporting bugs or other problems, please include the following information: * The version number of Mpack * The platform (Unix, PC, OS/2, Mac, Amiga, Archimedes) * The EXACT output of any unsuccessful attempts. * If having a problem decoding, the first couple of lines of the input file. Compilation: Mpack was compiled with THINK C 6.0 with the 4-byte int option turned on (and the ANSI-small library compiled with the 4-byte int option) and prototype enforcement turned off. Included with this distribution should be the files "macproj.hqx" which is a BinHex4 version of the THINK C 6.0 project file, and "macrsrc.hqx" which is a BinHex4 version of the resources file. Mpack checks for the existence of "Internet Config", and if it is available, mpack uses it to translate MIME types to and from Macintosh type/creator codes. Included is the file "macICglue.hqx" which is a BinHex4 version of Internet Config's MPW object file library. This needs to be linked with the application. Using mpack: See the "Help Using Mpack..." menu item in the application. Acknowledgements: Written by John G. Myers, jgm+@cmu.edu The mac version was written by Christopher J. Newman, chrisn+@cmu.edu Send all bug reports to mpack-bugs@andrew.cmu.edu Thanks to Nathaniel Borenstein for testing early versions of mpack and for making many helpful suggestions. PGP signature: The mpack 1.6 distribution is not pgp signed. Legalese: (C) Copyright 1993,1994 by Carnegie Mellon University All Rights Reserved. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Carnegie Mellon University not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Carnegie Mellon University makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Portions of this software are derived from code written by Bell Communications Research, Inc. (Bellcore) and by RSA Data Security, Inc. and bear similar copyrights and disclaimers of warranty. mpack-1.6/macICKeys.h0000444005347200000120000001543405720743041010122 /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* The canonical Internet Config interface is defined in Pascal. These headers have not been thoroughly tested. If there is a conflict between these headers and the Pascal interfaces, the Pascal should take precedence. */ /* ///////////////////////////////////////////////////////////////////////////////// */ #ifndef __ICKEYS__ #define __ICKEYS__ #ifndef __TYPES__ #include #endif #ifndef __ALIASES__ #include #endif /* ///////////////////////////////////////////////////////////////////////////////// */ #define kICRealName "\pRealName" /* PString */ #define kICEmail "\pEmail" /* PString -- user@host.domain */ #define kICMailAccount "\pMailAccount" /* PString -- user@host.domain */ #define kICMailPassword "\pMailPassword" /* PString -- scrambled */ #define kICNewsAuthUsername "\pNewsAuthUsername" /* PString -- host.domain */ #define kICNewsAuthPassword "\pNewsAuthPassword" /* PString -- scrambled */ #define kICArchiePreferred "\pArchiePreferred" /* PString -- formatted */ #define kICArchieAll "\pArchieAll" /* STR# -- formatted */ #define kICUMichPreferred "\pUMichPreferred" /* PString -- formatted */ #define kICUMichAll "\pUMichAll" /* STR# -- formatted */ #define kICInfoMacPreferred "\pInfoMacPreferred" /* PString -- formatted */ #define kICInfoMacAll "\pInfoMacAll" /* STR# -- formatted */ #define kICPhHost "\pPhHost" /* PString -- host.domain */ #define kICWhoisHost "\pWhoisHost" /* PString -- host.domain */ #define kICFingerHost "\pFingerHost" /* PString -- host.domain */ #define kICFTPHost "\pFTPHost" /* PString -- host.domain */ #define kICTelnetHost "\pTelnetHost" /* PString -- host.domain */ #define kICSMTPHost "\pSMTPHost" /* PString -- host.domain */ #define kICNNTPHost "\pNNTPHost" /* PString -- host.domain */ #define kICGopherHost "\pGopherHost" /* PString -- host.domain */ #define kICLDAPServer "\pLDAPServer" /* PString -- host.domain */ #define kICLDAPSearchbase "\pLDAPSearchbase" /* PString -- string LDAP thing */ #define kICWWWHomePage "\pWWWHomePage" /* PString -- URL */ #define kICWAISGateway "\pWAISGateway" /* PString -- no idea */ #define kICScreenFont "\pScreenFont" /* ICFontRecord */ #define kICPrinterFont "\pPrinterFont" /* ICFontRecord */ #define kICTextCreator "\pTextCreator" /* ICAppSpec */ #define kICBinaryTypeCreator "\pBinaryTypeCreator" /* ICFileInfo */ #define kICDownloadFolder "\pDownloadFolder" /* ICFileSpec */ #define kICSignature "\pSignature" /* TEXT */ #define kICOrganization "\pOrganization" /* PString */ #define kICPlan "\pPlan" /* TEXT */ #define kICQuotingString "\pQuotingString" /* PString */ #define kICMailHeaders "\pMailHeaders" /* TEXT */ #define kICNewsHeaders "\pNewsHeaders" /* TEXT */ #define kICMapping "\pMapping" /* ICMapEntries */ #define kICCharacterSet "\pCharacterSet" /* ICCharTable */ #define kICHelper "\pHelper¥" /* ICAppSpec */ #define kICServices "\pServices" /* ICServices */ #if defined(powerc) || defined (__powerc) #pragma options align=mac68k #endif struct ICFontRecord { short size; Style face; char pad; Str255 font; }; typedef struct ICFontRecord ICFontRecord, *ICFontRecordPtr, **ICFontRecordHandle; struct ICCharTable { unsigned char net_to_mac[256]; unsigned char mac_to_net[256]; }; typedef struct ICCharTable ICCharTable, *ICCharTablePtr, **ICCharTableHandle; struct ICAppSpec { OSType fCreator; Str63 name; }; typedef struct ICAppSpec ICAppSpec, *ICAppSpecPtr, **ICAppSpecHandle; struct ICFileInfo { OSType fType; OSType fCreator; Str63 name; }; typedef struct ICFileInfo ICFileInfo, *ICFileInfoPtr, **ICFileInfoHandle; struct ICFileSpec { Str31 vol_name; long vol_creation_date; FSSpec fss; AliasRecord alias; /* plus extra data, aliasSize 0 means no alias manager present when ICFileSpecification was created */ }; typedef struct ICFileSpec ICFileSpec, *ICFileSpecPtr, **ICFileSpecHandle; enum { ICfile_spec_header_size = sizeof(ICFileSpec) - sizeof(AliasRecord) }; struct ICMapEntry { short total_length; short fixed_length; short version; OSType file_type; OSType file_creator; OSType post_creator; long flags; /* variable part starts here */ Str255 extension; Str255 creator_app_name; Str255 post_app_name; Str255 MIME_type; Str255 entry_name; }; typedef struct ICMapEntry ICMapEntry, *ICMapEntryPtr, **ICMapEntryHandle; enum { ICmap_binary_bit = 0, /* file should be transfered in binary as opposed to text mode */ ICmap_binary_mask = 0x00000001, ICmap_resource_fork_bit = 1, /* the resource fork of the file is significant */ ICmap_resource_fork_mask = 0x00000002, ICmap_data_fork_bit = 2, /* the data fork of the file is significant */ ICmap_data_fork_mask = 0x00000004, ICmap_post_bit = 3, /* post process using post fields */ ICmap_post_mask = 0x00000008, ICmap_not_incoming_bit = 4, /* ignore this mapping for incoming files */ ICmap_not_incoming_mask = 0x00000010, ICmap_not_outgoing_bit = 5, /* ignore this mapping for outgoing files */ ICmap_not_outgoing_mask = 0x00000020, ICmap_fixed_length = 22 /* number in fixed_length field */ }; struct ICServiceEntry { Str255 name; short port; short flags; }; typedef struct ICServiceEntry ICServiceEntry, *ICServiceEntryPtr, **ICServiceEntryHandle; struct ICServices { short count; ICServiceEntry services[1]; }; typedef struct ICServices ICServices, *ICServicesPtr, **ICServicesHandle; enum { ICservices_tcp_bit = 0, ICservices_tcp_mask = 0x00000001, ICservices_udp_bit = 1, ICservices_udp_mask = 0x00000002 /* both bits can be set, which means the service is both TCP and UDP, eg daytime */ }; #if defined(powerc) || defined(__powerc) #pragma options align=reset #endif #endif mpack-1.6/macmpack.c0000444005347200000120000015223105720743041010056 /* macmpack.c -- Mac user interface to mpack routines * * (C) Copyright 1993-1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of Carnegie Mellon University * not be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Carnegie * Mellon University makes no representations about the suitability of * this software for any purpose. It is provided "as is" without * express or implied warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * NOTE: a good GUI requires a lot of work... This needs more. */ #include #include #include #include #include #include #include #include "version.h" #include "part.h" #include "macnapp.h" #include "macmpack.h" #include "macICTypes.h" #include "macICAPI.h" #include "macICKeys.h" /* ThinkC's internal stdio functions: */ #include /* window types: */ #define DECODELIST 1 #define PREFWIN 2 /* save watch cursor */ Cursor watch; /* preferences */ struct pref_folder *pfolder = NULL; struct mpack_preferences **mpack_prefs = NULL; static ICInstance icinst = NULL; /* flag for active help window */ static WindowPtr helpw = NULL; /* active decode status window */ static na_win *curstatwin = NULL; short didchat; /* MacTCP started: -1 = error, 1 = active, 0 = unknown */ static short tcpstart = 0; /* this is used for opening TEXT files */ SFTypeList textList = { 'TEXT', 0, 0, 0 }; /* next two types are used in the dialog used to select files to decode */ typedef struct filelist { short vRefNum; long dirID; PCstr fname[65]; } filelist; typedef struct listwin { na_win win; int count; filelist **hflist; ListHandle l; } listwin; /* this is the status window for decoding */ typedef struct statuswin { na_win win; RgnHandle urgn; /* user region */ Rect urect; /* user rectangle */ Rect frect; /* frame rectangle */ short row; /* row at top of scroll area */ short nrow; /* rows of status text */ long size, used; /* bytes of status text & amount used */ Handle text; /* status text */ ControlHandle sb; /* scroll bar control */ short height, ascent; /* font height and ascent */ } statuswin; /* this is for the encode window */ typedef struct encodewin { nate_win w; Boolean nateon; /* cursor in Desc edit field */ Boolean useemail; /* sending email */ long partsize; /* max part size (0 = no limit) */ OSType ftype; /* type of file to encode */ FSSpec fspec; /* file to encode */ FSSpec ofile; /* output file */ } encodewin; /* show progress */ typedef struct progresswin { natcp_win w; short percent; } progresswin; /* send mail */ typedef struct mailwin { progresswin w; Handle headers; /* email headers */ Handle envelope; /* envelope */ short state; /* state */ short remaining; /* messages remaining */ Boolean sending; /* flag for active SMTP task */ Boolean useemail; /* sending email */ Boolean gothost; /* got the hostname */ long partsize; /* max part size (0 = no limit) */ long dirID; /* ID for temp dir */ OSType ftype; /* type of file to encode */ FSSpec fspec; /* file to be encoded */ FSSpec ofile; /* output file */ FILE *dfile; /* desc file */ PCstr server[257]; /* SMTP server */ PCstr subj[257]; /* subject */ CInfoPBRec cpb; } mailwin; /* mailwin states */ #define MS_MACTCP 0 /* Starting MacTCP */ #define MS_GETHOST 1 /* Getting hostname */ #define MS_ENCODE 2 /* Do encoding */ #define MS_SENDING 3 /* Sending email */ /* some prototypes */ void warn(char *str); void stattext(Str255, unsigned char); static void do_decodefiles(na_win *); static void addfile(listwin *, FSSpec *); static void removefile(listwin *); static short listclose(na_win *); static short listmouse(na_win *, Point, short, short); static short listctrl(na_win *, Point, short, short, ControlHandle); static short listupdate(na_win *, Boolean); static short listinit(na_win *,long *); static short prefsctrl(na_win *, Point, short, short, ControlHandle); static short prefsinit(na_win *, long *); static void do_decode(FSSpec *); static void do_encode(FSSpec *, OSType); static short mainmenu(struct na_win*, WORD, WORD); #define dwin ((listwin *) win) #define swin ((statuswin *) win) #define ewin ((encodewin *) win) #define twin ((nate_win *) win) #define prwin ((progresswin *) win) #define mwin ((mailwin *) win) /* Get a FILE* to a Macintosh file ******************************* ############################### * KLUDGE ALERT! KLUDGE ALERT! * # KLUDGE ALERT! KLUDGE ALERT! # ******************************* ############################### * Mac files are specified by name/vRefNum/dirID combo, but the portable * portions of mpack use FILE* to do I/O. We need a way to get an open FILE* * from a file specified by name/vRefNum/dirID. Here we use the proper Macintosh * routines to open a file, then hack together a FILE* using ThinkC's internal * routines. The major trouble is that we have no way to get at the FILE action * procedure (fp->proc), so we need a sample FILE* to be passed in. Bleargh! ******************************* ############################### * KLUDGE ALERT! KLUDGE ALERT! * # KLUDGE ALERT! KLUDGE ALERT! # ******************************* ############################### */ FILE *Macopen(FILE *sample, Str255 name, short vRefNum, long dirID, short binary_flag, short res_fork, SignedByte permission) { FILE *fp = NULL; short refnum; long curEOF; OSErr err; if ((!res_fork && (err = HOpen(vRefNum, dirID, name, permission, &refnum)) == noErr) || (res_fork && (err = HOpenRF(vRefNum, dirID, name, permission, &refnum)) == noErr)) { if ((fp = __getfile()) == NULL) { FSClose(refnum); } else { if (permission == fsWrPerm) { /* if we're writing to the file, truncate it */ SetEOF(refnum, curEOF = 0); } else { GetEOF(refnum, &curEOF); } fp->refnum = refnum; fp->len = (fpos_t) curEOF; fp->binary = binary_flag; setvbuf(fp, NULL, _IOFBF, BUFSIZ); fp->proc = sample->proc; } } return (fp); } /* warn the user */ void warn(char *str) { PCstr wstr[257]; CtoPCstrncpy(wstr, str, 255); ParamText(P(wstr), NULL, NULL, NULL); NAalert(warnALRT); } /* yell at the user */ void yell(char *str) { PCstr wstr[257]; CtoPCstrncpy(wstr, str, 255); ParamText(P(wstr), NULL, NULL, NULL); NAalert(errorALRT); } /* chat with user */ chat(char *str) { PCstr tmpstr[257]; CtoPCstrcpy(tmpstr, str); stattext(P(tmpstr), 0); } /* returns NA_ALLCLOSED if appropriate, else NA_CLOSED */ static short alldone(na_win *win) { if (win->next == NULL && win->afterp == NULL && (*mpack_prefs)->quit_finished && RecoverHandle((Ptr) win) == (Handle) NAhead) { return (NA_ALLCLOSED); } return (NA_CLOSED); } /* update procedure for status dialog box */ static short statupdate(na_win *win, Boolean newsize) { RgnHandle savergn; unsigned char *s; short row, top; Rect tmpr; FrameRect(&swin->frect); savergn = NewRgn(); if (savergn) { GetClip(savergn); SetClip(swin->urgn); } /* redraw text area */ HLock(swin->text); s = * (unsigned char **) swin->text; top = swin->urect.top; for (row = 0; row < swin->row; ++row) { s += s[1] + 2; } for (; row < swin->nrow && top + swin->height <= swin->urect.bottom; ++row) { MoveTo(swin->urect.left, top + swin->ascent); if (*s) TextFace(1); DrawString(s + 1); if (*s) TextFace(0); /* advance to next string */ top += swin->height; s += s[1] + 2; } HUnlock(swin->text); if (savergn) { SetClip(savergn); DisposeRgn(savergn); } return (NA_NOTPROCESSED); } /* refresh status window */ void statrefresh() { na_win *win = curstatwin; Draw1Control(swin->sb); statupdate(win, false); } /* add text to the status window */ void stattext(Str255 str, unsigned char bold) { na_win *win = curstatwin; short i, len; unsigned char *s, *start; RgnHandle rgn; Rect tmpr; if (!win) return; didchat = 1; /* advance to next row */ if (swin->height * (swin->nrow++ - swin->row) >= swin->urect.bottom - swin->urect.top) { SetCtlMax(swin->sb, ++swin->row); SetCtlValue(swin->sb, swin->row); if ((rgn = NewRgn()) != NULL) { tmpr = swin->urect; ScrollRect(&tmpr, 0, -swin->height, rgn); DisposeRgn(rgn); } } /* add the text */ len = * (unsigned char *) str; if (swin->size - swin->used < len + 1) { SetHandleSize(swin->text, swin->size * 2); if (MemError() == 0) swin->size *= 2; } HLock(swin->text); s = start = * (unsigned char **) swin->text; for (i = 1; i < swin->nrow; ++i) { s += s[1] + 2; } if (len + 2 + s < start + swin->size) { *s = bold; memcpy(s + 1, str, len + 1); swin->used = s + len + 2 - start; } HUnlock(swin->text); statupdate(win, false); } /* scroll the status dialog */ static void statscroll(na_win *win, short rows) { RgnHandle rgn; if ((rgn = NewRgn()) != NULL) { SetCtlValue(swin->sb, swin->row += rows); ScrollRect(&swin->urect, 0, - swin->height * rows, rgn); EraseRgn(rgn); DisposeRgn(rgn); } statupdate(win, false); } /* scroll bar procedure */ static pascal void statscollbar(ControlHandle ctrlh, short part) { na_win *win = (na_win *) GetCRefCon(ctrlh); short max, new, page; max = GetCtlMax(ctrlh); page = (swin->urect.bottom - swin->urect.top) / swin->height - 1; switch (part) { case inUpButton: page = 1; /* fall through */ case inPageUp: if (swin->row > 0) { statscroll(win, - (swin->row < page ? swin->row : page)); } break; case inDownButton: page = 1; /* fall through */ case inPageDown: if (swin->row < max) { statscroll(win, max - swin->row < page ? max - swin->row : page); } break; case inThumb: break; } } /* control procedure for status dialog box */ static short statctrl(na_win *win, Point p, short item, short mods, ControlHandle ctrlh) { short value; if (ctrlh == swin->sb) { ctrlh = swin->sb; if (item != inThumb) { SetCRefCon(ctrlh, (long) win); TrackControl(ctrlh, p, statscollbar); } else { TrackControl(ctrlh, p, nil); value = GetCtlValue(ctrlh); if (value != swin->row) statscroll(win, value - swin->row); } } else if (item == iOk) { return (NA_REQCLOSE); } return (NA_NOTPROCESSED); } /* close procedure for status dialog box */ static short statclose(na_win *win) { DisposeRgn(swin->urgn); DisposHandle(swin->text); DisposeControl(swin->sb); return (alldone(win)); } /* init procedure for status dialog box */ static short statinit(na_win *win, long *data) { Rect tmpr; FontInfo finfo; /* disable OK button while working */ NAhiliteDItem(win->pwin, iOk, 255); /* set up status text area & font */ if ((swin->urgn = NewRgn()) == NULL) return (NA_CLOSED); TextFont(geneva); TextSize(9); GetFontInfo(&finfo); swin->ascent = finfo.ascent; swin->height = finfo.ascent + finfo.descent + finfo.leading; NAgetDRect(win->pwin, iStatus, &swin->frect); swin->urect = swin->frect; InsetRect(&swin->urect, 2, 2 + ((swin->urect.bottom - swin->urect.top - 4) % swin->height) / 2); RectRgn(swin->urgn, &swin->urect); /* set up text storage */ if ((swin->text = NewHandle(swin->size = 1024)) == NULL) { DisposeRgn(swin->urgn); return (NA_CLOSED); } **(char **)swin->text = '\0'; /* set up scrollbar */ NAgetDRect(win->pwin, iStatScroll, &tmpr); swin->sb = NewControl(win->pwin, &tmpr, "\p", true, 0, 0, 0, scrollBarProc, 0); if (!swin->sb) { DisposeRgn(swin->urgn); DisposHandle(swin->text); return (NA_CLOSED); } /* set up procedures */ win->closep = statclose; win->ctrlp = statctrl; win->updatep = statupdate; /* keep window locked until decoding is done */ ++win->locks; curstatwin = win; return (NA_NOTPROCESSED); } /* process the files in the file list */ static void do_decodefiles(na_win *win) { int count = dwin->count; filelist *fl; FILE *dfile, *tmpf; extern long _ftype, _fcreator; long ticks; int result; MapTypeCreator("text/plain", 0); SetCursor(&watch); if (NAwindow(0, NA_DIALOGWINDOW | NA_TITLEBAR | NA_DEFBUTTON | NA_USERESOURCE | NA_CLOSEBOX | NA_HASCONTROLS, 0, dstatDLOG, 0, sizeof (statuswin), statinit) == NA_CLOSED) { warn("Not enough memory to decode"); return; } MoveHHi((Handle) dwin->hflist); HLock((Handle) dwin->hflist); fl = *dwin->hflist; tmpf = tmpfile(); while (count--) { stattext(fl->fname, 1); didchat = 0; if (dfile = Macopen(tmpf, fl->fname, fl->vRefNum, fl->dirID, 0, 0, 1)) { result = handleMessage(part_init(dfile), "text/plain", 0, (*mpack_prefs)->extract_text); if (result != 0 || didchat <= 0) { if (didchat < 0) { chat("Decoding cancelled"); } else { chat("Found nothing to decode"); } } fclose(dfile); } else { chat("Couldn't find source file"); } ++fl; } fclose(tmpf); HUnlock((Handle) dwin->hflist); NAhiliteDItem(curstatwin->pwin, iOk, 0); NAunlockWindow(curstatwin); curstatwin = NULL; SetCursor(&arrow); DisposHandle((Handle) dwin->hflist); } /* return non-zero if two filenames have the same prefix */ static int fprefixMatch(char *base, PCstr *match) { PCstr temp[257]; char *scan; short prefixlen; PtoPCstrcpy(temp, base); scan = C(temp) + PCstrlen(temp) - 1; while (isdigit(*scan) && scan > C(temp)) --scan; prefixlen = scan - C(temp) + 1; if (strncmp(C(temp), C(match), prefixlen)) return (0); scan = C(match) + prefixlen; while (isdigit(*scan)) ++scan; return (!*scan); } /* do the add of a file to a list */ static void addit(listwin *dw, short vRefNum, long dirID, char *fname) { long size = GetHandleSize((Handle) dw->hflist) / sizeof (filelist); filelist *fl; char *bp; Cell c; int i; PCstr fbuf[42]; if (size == dw->count) { SetHandleSize((Handle) dw->hflist, (++size * sizeof (filelist))); if (MemError() != noErr) return; } MoveHHi((Handle) dw->hflist); HLock((Handle) dw->hflist); fl = *dw->hflist; for (i = dw->count; i; --i, ++fl) { if (fl->vRefNum == vRefNum && fl->dirID == dirID && *fl->fname == *fname && !strncmp(C(fl->fname), C(fname), *fl->fname)) { break; } } if (!i) { fl->vRefNum = vRefNum; fl->dirID = dirID; PtoPCstrcpy(fl->fname, fname); SetPt(&c, 0, dw->count); LAddRow(1, ++dw->count, dw->l); LSetCell((Ptr) C(fname), (short) Pstrlen(fname), c, dw->l); } HUnlock((Handle) dw->hflist); } /* add file set to file list */ static void addfile(dw, fspec) listwin *dw; FSSpec *fspec; { CInfoPBRec cipbr; HFileInfo *fpb = (HFileInfo *)&cipbr; PCstr fbuf[42]; short idx, foundone = 0; long procid; /* remove working directory stuff */ if (fspec->parID == 0) { GetWDInfo(fspec->vRefNum, &fspec->vRefNum, &fspec->parID, &procid); } /* loop through directory */ for (idx = 1; ; ++idx) { fpb->ioVRefNum = fspec->vRefNum; fpb->ioNamePtr = P(fbuf); fpb->ioDirID = fspec->parID; fpb->ioFDirIndex = idx; if (PBGetCatInfoSync(&cipbr)) break; SetClen(fbuf); if (!(fpb->ioFlAttrib & 16) && fprefixMatch((char *)fspec->name, fbuf)) { addit(dw, fspec->vRefNum, fspec->parID, (char *) P(fbuf)); foundone = 1; } } if (!foundone) { addit(dw, fspec->vRefNum, fspec->parID, (char *) fspec->name); } } /* remove file from file list */ static void removefile(dw) listwin *dw; { filelist *fl; int count; Cell c; c.h = c.v = 0; if (LGetSelect(TRUE, &c, dw->l)) { MoveHHi((Handle) dw->hflist); HLock((Handle) dw->hflist); fl = *dw->hflist + c.v; count = dw->count - c.v; while (--count) { fl[0] = fl[1]; ++fl; } HUnlock((Handle) dw->hflist); --dw->count; LDelRow(1, c.v, dw->l); } } /* close list window */ static short listclose(win) na_win *win; { LDispose(dwin->l); return (alldone(win)); } /* mouse procedure */ static short listmouse(na_win *win, Point p, short type, short mods) { Cell c; if (!(type & 1)) { LClick(p, mods, dwin->l); c.h = c.v = 0; NAhiliteDItem((DialogPtr)win->pwin, iRemove, LGetSelect(TRUE, &c, dwin->l) ? 0 : 255); } return (NA_NOTPROCESSED); } /* control procedure */ static short listctrl(na_win *win, Point p, short item, short mods, ControlHandle ctrlh) { StandardFileReply reply; switch (item) { case iAdd: NAgetFile(NULL, 1, textList, &reply); if (reply.sfGood) { if (!dwin->count) { NAhiliteDItem((DialogPtr)win->pwin, iOk, 0); } addfile(dwin, &reply.sfFile); } return (NA_PROCESSED); case iRemove: removefile(dwin); NAhiliteDItem((DialogPtr)win->pwin, iRemove, 255); if (!dwin->count) { NAhiliteDItem((DialogPtr)win->pwin, iOk, 255); } return (NA_PROCESSED); case iOk: win->afterp = do_decodefiles; case iCancel: return (NA_REQCLOSE); } return (NA_NOTPROCESSED); } /* update the list window */ static short listupdate(na_win *win, Boolean resize) { Rect r; NAgetDRect(win->pwin, iFileList, &r); FrameRect(&r); LUpdate(win->pwin->visRgn, dwin->l); return (NA_NOTPROCESSED); } /* initialize the list window */ static short listinit(win, data) na_win *win; long *data; { FSSpec *fspec = (FSSpec *) data; Rect r, zrect; Point p; Handle hand; short type; GetDItem((DialogPtr)win->pwin, iFileList, &type, &hand, &r); InsetRect(&r, 1, 1); zrect.top = zrect.bottom = zrect.left = p.h = p.v = 0;\ zrect.right = 1; dwin->l = LNew(&r, &zrect, p, 0, win->pwin, 0, 0, 0, 1); if (!dwin->l) return (NA_CLOSED); (*dwin->l)->selFlags = lOnlyOne; dwin->hflist = (filelist **) NewHandle(sizeof (filelist)); if (!dwin->hflist) { LDispose(dwin->l); return (NA_CLOSED); } dwin->count = 0; addfile(dwin, fspec); win->closep = listclose; win->updatep = listupdate; win->ctrlp = listctrl; win->mousep = listmouse; win->type = DECODELIST; NAhiliteDItem((DialogPtr)win->pwin, iRemove, 255); ShowWindow(win->pwin); LDoDraw(TRUE, dwin->l); return (NA_NOTPROCESSED); } /* Decode procedure: first get a file, then open decode window */ static void do_decode(FSSpec *fspec) { StandardFileReply infile; na_win **wh, *wp; if (!fspec) { NAgetFile(NULL, 1, textList, &infile); if (!infile.sfGood) return; fspec = &infile.sfFile; } else { /* file supplied by drag & drop, look for existing decode window: */ for (wh = NAhead; wh && (*wh)->type != DECODELIST; wh = (*wh)->next); if (wh && (wp = NAlockWindow(wh)) != NULL) { addfile((listwin *) wp, fspec); NAunlockWindow(wp); return; } } NAwindow(0, NA_DIALOGWINDOW | NA_USERESOURCE | NA_DEFBUTTON | NA_HASCONTROLS | NA_CLOSEBOX, NULL, decodeDLOG, (long *) fspec, sizeof (listwin), listinit); } /* Map MIME type to/from Macintosh file types */ void MapTypeCreator(char *contenttype, OSType type) { extern long _ftype, _fcreator; PCstr tstr[257]; Handle h; ICAttr attr; long size = 0; Ptr map; ICMapEntry *ment; unsigned char *scan, *end, *pstr; short mapcount, i, foundit = 0; OSType temp; if (!type) CtoPCstrncpy(tstr, contenttype, 255); /* first try a lookup via Internet Config */ if (icinst && ICBegin(icinst, icReadOnlyPerm) == noErr) { if (ICGetPref(icinst, kICMapping, &attr, nil, &size) == noErr && size > 0 && (map = NewPtr(size)) != nil) { if (ICGetPref(icinst, kICMapping, &attr, map, &size) == noErr) { scan = (unsigned char *) map; end = scan + size; while (scan < end) { ment = (ICMapEntry *) scan; pstr = scan + ment->fixed_length; scan += ment->total_length; if (type && ment->file_type != type) continue; pstr += *pstr + 1; /* skip over extension */ pstr += *pstr + 1; /* skip over creator app name */ pstr += *pstr + 1; /* skip over post app name */ if (type) { PtoPCstrcpy((PCstr *) contenttype, (char *) pstr); foundit = 1; break; } else if (EqualString(P(tstr), pstr, false, true)) { _ftype = ment->file_type; _fcreator = ment->file_creator; foundit = 1; break; } } } DisposPtr(map); } ICEnd(icinst); } /* if we didn't find it, try our quick&dirty mappings */ if (!foundit) { if (type) { mapcount = CountResources('TyCr'); for (i = 1; i <= mapcount; ++i) { h = GetIndResource('TyCr', i); if (h && **(OSType **)h == type) { GetResInfo(h, &i, &temp, P(contenttype)); if (ResError() == noErr) break; } } SetClen((PCstr *) contenttype); } else { h = GetNamedResource('TyCr', P(tstr)); if (h) { _ftype = (*(OSType **)h)[0]; _fcreator = (*(OSType **)h)[1]; } else { _ftype = '????'; _fcreator = 'mPAK'; } } } } /* get internet config string prefs */ static short getICprefs(na_win *win, PCstr *eaddr, PCstr *smtphost) { char *scan, *end; ICAttr attr; long size; ICError err = noErr; *C(eaddr) = '\0'; SetPlen(eaddr); *C(smtphost) = '\0'; SetPlen(smtphost); if (icinst && ICBegin(icinst, icReadOnlyPerm) == noErr) { size = 256; if (ICGetPref(icinst, kICEmail, &attr, (Ptr) eaddr, &size) == noErr && win && (attr & ICattr_locked_mask)) { NAenableDItem(win->pwin, iEmailAddr, 0); } SetClen(eaddr); size = 256; if (ICGetPref(icinst, kICSMTPHost, &attr, (Ptr) smtphost, &size) == noErr && win && (attr & ICattr_locked_mask)) { NAenableDItem(win->pwin, iMailServer, 0); } SetClen(smtphost); ICEnd(icinst); } else { HLock((Handle) mpack_prefs); end = (char *) (*mpack_prefs) + GetHandleSize((Handle) mpack_prefs); scan = (*mpack_prefs)->internet_host; while (scan < end && *scan++); if (scan < end) CtoPCstrcpy(eaddr, scan); while (scan < end && *scan++); if (scan < end) CtoPCstrcpy(smtphost, scan); HUnlock((Handle) mpack_prefs); } } /* copy desc file, with word-wrap */ static short copydesc(FILE *out, TEHandle hTE) { char c; short i, count, word, col, reset; char **htxt; count = (*hTE)->teLength; htxt = (char **) (*hTE)->hText; for (i = word = col = 0; i < count; ++i) { c = (*htxt)[i]; reset = i - word == 80 || c == '\r'; if (reset || c == ' ') { while (word < i) putc((*htxt)[word], out), ++word; } if (reset || ++col == 80) { putc('\r', out); c = (*htxt)[word]; if (c == ' ' || c == '\r') ++word; col = 0; } } while (word < i) putc((*htxt)[word], out), ++word; rewind(out); } /* start up MacTCP callback */ static void mytcpinit(short status) { static DialogPtr dialog = NULL; GrafPtr save; Rect box; if (status < 0) { tcpstart = -1; } else if (status == 0) { tcpstart = 1; } else { if (!dialog && status < 100) { dialog = GetNewDialog(progDLOG, nil, (WindowPtr) -1); NAsetIText(dialog, iWorkText, "\pWaiting for MacTCP to finish. Press \021. to stop."); } if (dialog) { GetPort(&save); SetPort(dialog); NAgetDRect(dialog, iProgress, &box); FrameRect(&box); InsetRect(&box, 1, 1); box.right = box.left + (box.right - box.left) * status / 100; FillRect(&box, qd.dkGray); SetPort(save); if (status == 100) { DisposDialog(dialog); dialog = NULL; } } } } /* update the progress bar */ static short progressupdate(na_win *win, Boolean newsize) { Rect box; if (prwin->percent >= 0) { NAgetDRect(win->pwin, iProgress, &box); FrameRect(&box); InsetRect(&box, 1, 1); if (prwin->percent) { box.right = box.left + (box.right - box.left) * prwin->percent / 100; FillRect(&box, qd.dkGray); } else { EraseRect(&box); } } return (NA_NOTPROCESSED); } /* handle the cancel button */ static short progressctrl(na_win *win, Point p, short item, short mods, ControlHandle ctrlh) { return (item == iCancel ? NA_REQCLOSE : NA_NOTPROCESSED); } /* close progress window */ static short progressclose(na_win *win) { NAmodalMenus(0); return (NA_CLOSED); } /* make/go directory under prefs and return directory number */ static OSErr prefsubdir(PCstr *name, long *dirID) { CInfoPBRec cipbr; DirInfo *dpb = &cipbr.dirInfo; long subdir, dir; short vref = pfolder->fspec.vRefNum; OSErr err; err = DirCreate(vref, dir = pfolder->fspec.parID, P(name), &subdir); if (err == dupFNErr) { dpb->ioVRefNum = vref; dpb->ioNamePtr = P(name); dpb->ioDrDirID = dir; dpb->ioFDirIndex = 0; if ((err = PBGetCatInfoSync(&cipbr)) != noErr) return (err); subdir = dpb->ioDrDirID; } else if (err != noErr) { return (err); } *dirID = subdir; return (noErr); } /* smtp status task */ static void smtpstat(void *wh, short code, short err, long num, char *errstr) { na_win *win, **winh; char msg[256]; OSErr oserr = noErr; /* verify win is valid */ for (winh = NAhead; winh && winh != wh; winh = (*winh)->next); if (!winh) return; /* handle SMTP callback */ win = NAlockWindow((na_win **) wh); if (code == NASMTP_progress) { prwin->percent = err; progressupdate(win, false); } else if (code == NASMTP_badaddr) { sprintf(msg, "Invalid address: <%s>. Email will be sent to valid recipients.", errstr); yell(msg); } else { switch (code) { case NASMTP_nomem: yell("Not enough memory to send email"); break; case NASMTP_tcpfail: yell("Failed to connect to mail host"); break; case NASMTP_temperr: case NASMTP_permerr: sprintf(msg, "Delivery failed: %s", errstr); yell(msg); break; default: yell("Mail delivery failed."); case NASMTP_completed: break; } mwin->sending = false; oserr = HDelete(mwin->fspec.vRefNum, mwin->fspec.parID, mwin->fspec.name); } if (oserr != noErr && oserr != fnfErr) { if (mwin->remaining) ++mwin->cpb.hFileInfo.ioFDirIndex; yell("Unable to remove temporary email file."); } NAunlockWindowh((na_win **) wh, win); } /* Get the email hostname */ static void mailhost(void *user, na_tcp s, short status, long size, char *data) { struct mpack_preferences *mp; char *ihost; na_win *win, **winh; long len, oldsize; /* first make sure our window still exists */ for (winh = NAhead; winh && winh != user; winh = (*winh)->next); if (!winh) return; win = NAlockWindow(winh); /* check for errors */ if (status != NATCP_connect) { warn("Failed to get hostname from MacTCP"); } else { mwin->gothost = true; if (data[size - 1] == '.') --size; /* update internet_host preference */ len = strlen((*mpack_prefs)->internet_host); oldsize = GetHandleSize((Handle) mpack_prefs); if (len < size) { SetHandleSize((Handle) mpack_prefs, oldsize + (size - len)); if (MemError() != noErr) return; } HLock((Handle) mpack_prefs); mp = *mpack_prefs; ihost = mp->internet_host; memmove(ihost + size + 1, ihost + len + 1, oldsize - len - 1 - ((char *) ihost - (char *) mp)); memcpy(ihost, data, size); ihost[size] = '\0'; HUnlock((Handle) mpack_prefs); } NAunlockWindowh(winh, win); } /* clean up mail task */ static short mailclose(na_win *win) { if (mwin->dfile != NULL) fclose(mwin->dfile); if (mwin->envelope) DisposeHandle(mwin->envelope); if (mwin->headers) DisposeHandle(mwin->headers); NAmodalMenus(0); return (alldone(win)); } /* send email */ static short mailtask(na_win *win) { short vrefnum, encoding, refnum, result; long procid; FILE *tmpf, *fp, *resfork; OSErr err; CInfoPBRec cipbr; HFileInfo *fpb = (HFileInfo *)&cipbr; PCstr tstr[257], mtype[257], fname[257]; extern long _ftype, _fcreator; switch (mwin->state) { case MS_MACTCP: if (tcpstart < 0) { yell("Couldn't find MacTCP"); return (NA_REQCLOSE); } if (tcpstart == 0) break; ++mwin->state; NAsetIText(win->pwin, iWorkText, "\pGetting Hostname"); mwin->gothost = false; NATCPgethost(mailhost, (void *) GetWRefCon(win->pwin)); /* fall through */ case MS_GETHOST: if (!mwin->gothost) break; ++mwin->state; /* fall through */ case MS_ENCODE: NAsetIText(win->pwin, iWorkText, "\pEncoding file"); /* get temp output filename for email */ if (mwin->useemail) { mwin->ofile.vRefNum = pfolder->fspec.vRefNum; memcpy(mwin->ofile.name, "\pemail", 6); if (prefsubdir("\poutgoing-email", &mwin->ofile.parID) != noErr) { yell("Failed to write encoded file"); return (NA_REQCLOSE); } } /* set file type */ SetCursor(&watch); MapTypeCreator((char *) mtype, mwin->ftype); /* Determine the correct encoding */ encoding = (*mpack_prefs)->encoding; fpb->ioVRefNum = mwin->fspec.vRefNum; fpb->ioNamePtr = mwin->fspec.name; fpb->ioDirID = mwin->fspec.parID; fpb->ioFDirIndex = 0; if (PBGetCatInfoSync(&cipbr) != noErr) { SetCursor(&arrow); yell("File disappeared before being encoded!"); return (NA_REQCLOSE); } if (encoding == EN_AUTO) { encoding = EN_DOUBLE; if (!fpb->ioFlRLgLen && *mtype != '\0') encoding = EN_DATA; } if (!fpb->ioFlLgLen) encoding = EN_SINGLE; /* do applesingle/appledouble encoding */ tmpf = tmpfile(); fp = Macopen(tmpf, mwin->fspec.name, mwin->fspec.vRefNum, mwin->fspec.parID, strcmp(C(mtype), "text/plain") ? 1 : 0, 0, fsRdPerm); if (!fp) { fclose(tmpf); SetCursor(&arrow); yell("Couldn't save encoded file"); return (NA_REQCLOSE); } if (encoding == EN_DATA) { fclose(tmpf); tmpf = NULL; } else { /* open resource fork & output file for applesingle/double encoding */ resfork = Macopen(tmpf, mwin->fspec.name, mwin->fspec.vRefNum, mwin->fspec.parID, 1, 1, 1); if (encode_applefile(tmpf, fpb, resfork, encoding == EN_SINGLE ? fp : NULL) < 0) { SetCursor(&arrow); yell("Couldn't save encoded file"); return (NA_REQCLOSE); } rewind(tmpf); if (encoding == EN_SINGLE) { fp = tmpf; tmpf = NULL; strcpy(C(mtype), "application/applefile"); SetPlen(mtype); } } /* generate output files */ _fcreator = 'mPAK'; _ftype = 'TEXT'; GetVol(0, &vrefnum); err = OpenWD(mwin->ofile.vRefNum, mwin->ofile.parID, 0, &refnum); SetVol(0, err == noErr ? refnum : mwin->ofile.vRefNum); PtoPCstrcpy(tstr, (char *) mwin->ofile.name); PtoPCstrcpy(fname, (char *) mwin->fspec.name); result = encode(fp, tmpf, C(fname), mwin->dfile, C(mwin->subj), NULL, mwin->partsize, PCstrlen(mtype) ? C(mtype) : NULL, C(tstr)); if (err == noErr) CloseWD(refnum); SetVol(0, vrefnum); if (tmpf) fclose(tmpf); fclose(fp); if (mwin->dfile) { fclose(mwin->dfile); mwin->dfile = NULL; } SetCursor(&arrow); if (!mwin->useemail) return (NA_REQCLOSE); prwin->percent = 0; progressupdate(win, false); ++mwin->state; /* count files */ mwin->cpb.dirInfo.ioVRefNum = mwin->ofile.vRefNum; mwin->cpb.dirInfo.ioDrDirID = mwin->dirID = mwin->ofile.parID; mwin->cpb.dirInfo.ioFDirIndex = -1; if (PBGetCatInfoSync(&mwin->cpb) != noErr) { return (NA_CLOSED); } mwin->remaining = mwin->cpb.dirInfo.ioDrNmFls; mwin->cpb.dirInfo.ioFDirIndex = 1; /* fall through */ case MS_SENDING: if (mwin->sending) break; if (!mwin->remaining) return (NA_REQCLOSE); sprintf(C(tstr), "Email parts remaining to submit: %d", mwin->remaining--); SetPlen(tstr); NAsetIText(win->pwin, iWorkText, tstr); prwin->percent = 0; progressupdate(win, false); mwin->cpb.hFileInfo.ioDirID = mwin->dirID; mwin->cpb.hFileInfo.ioNamePtr = (StringPtr) &mwin->fspec.name; if (PBGetCatInfoSync(&mwin->cpb) != noErr) { yell("Email disappeared before submission!"); return (NA_REQCLOSE); } mwin->sending = true; mwin->fspec.vRefNum = mwin->cpb.hFileInfo.ioVRefNum; mwin->fspec.parID = mwin->dirID; NASMTPsubmit(smtpstat, C(mwin->server), &mwin->fspec, mwin->headers, mwin->envelope, NASMTP_crtrans, (void *) GetWRefCon(win->pwin)); break; } return (NA_NOTPROCESSED); } /* Following routine stolen from Mark Crispin's c-client library: * * Write current time in RFC 822 format * Accepts: destination string * * This depends upon the ReadLocation() call in System 7 and the * user properly setting his location/timezone in the Map control * panel. * 2/95 - I added support for dlsDelta & compatibility checking */ void rfc822_date(char *string) { long tz, tzm; time_t ti = time (0); struct tm *t = localtime (&ti); MachineLocation loc; /* output date */ strcpy(string, "Date: "); string += 6; strftime (string,1024,"%a, %d %b %Y %H:%M:%S ",t); /* now output time zone, if we can get it */ tz = 0; if (Gestalt(gestaltScriptMgrVersion, &tz) == noErr && tz >= 200) { ReadLocation(&loc); /* get location/timezone */ /* get sign-extended time zone */ tz = (loc.gmtFlags.gmtDelta & 0x00ffffff) | ((loc.gmtFlags.gmtDelta & 0x00800000) ? 0xff000000 : 0); tz /= 60; /* get timezone in minutes */ tzm = tz % 60; /* get minutes from the hour */ sprintf (string += strlen(string),"%+03ld%02ld", tz/60,tzm >= 0 ? tzm : -tzm); if (!tzm && tz <= -240 && tz >= -660) { string += strlen(string); if (loc.gmtFlags.dlsDelta & 0x80) { sprintf(string, " (%cDT)", "AECMPYHB"[- (tz / 60) - 3]); } else { sprintf(string, " (%cST)", "AECMPYHB"[- (tz / 60) - 4]); } } } else { sprintf(string + strlen(string), "+0000 (Local Time Zone Unknown)"); } } /* init mail sending */ static short mailinit(na_win *win, long *data) { encodewin *ew = (encodewin *) data; WindowPtr pwin = ew->w.winp.pwin; ControlHandle ctrlh; PCstr tstr[257], email[257]; /* copy values from encode window */ NAgetIText(pwin, iSubj, mwin->subj); NAgetIText(pwin, iEmailto, email); mwin->partsize = ew->partsize; mwin->useemail = ew->useemail; mwin->fspec = ew->fspec; mwin->ftype = ew->ftype; mwin->ofile = ew->ofile; /* copy desc file */ mwin->dfile = NULL; if ((*ew->w.hTE)->teLength && (mwin->dfile = tmpfile()) != NULL) { copydesc(mwin->dfile, ew->w.hTE); } /* set procedures */ win->taskp = mailtask; win->updatep = progressupdate; win->ctrlp = progressctrl; win->closep = mailclose; /* Customize Progress window, set up envelope & headers for email */ prwin->percent = -1; NAgetDHandle(win->pwin, iCancel, &ctrlh); SetCTitle(ctrlh, "\pStop"); NAmodalMenus(1); if (!mwin->useemail) { mwin->state = MS_ENCODE; } else { if (!tcpstart) NATCPinit(mytcpinit); NAsetIText(win->pwin, iWorkText, "\pLooking for MacTCP"); mwin->state = MS_MACTCP; /* create envelope, get server */ getICprefs(NULL, tstr, mwin->server); if (PtrToHand(C(tstr), &mwin->envelope, PCstrlen(tstr) + 1) != noErr || PtrAndHand(C(email), mwin->envelope, PCstrlen(email) + 1) != noErr) { if (mwin->envelope) DisposeHandle(mwin->envelope); return (NA_CLOSED); } /* create headers */ if ((mwin->headers = NewHandle(1024)) == NULL) { DisposeHandle(mwin->envelope); return (NA_CLOSED); } HLock(mwin->headers); rfc822_date((char *) *mwin->headers); sprintf((char *) (*mwin->headers) + strlen((char *) (*mwin->headers)), "\r\nFrom: %s\r\nTo: %s\r\n", C(tstr), C(email)); HUnlock(mwin->headers); SetHandleSize(mwin->headers, strlen((char *) (*mwin->headers))); } return (NA_NOTPROCESSED); } /* update the encode window */ static short encodeupdate(na_win *win, Boolean newsize) { Rect btmp; ControlHandle ctrlh; /* draw double-line */ NAgetDRect(win->pwin, iBar, &btmp); FrameRect(&btmp); /* draw disabled edittext boxes */ NAgetDHandle(win->pwin, iLimit, &ctrlh); if (!GetCtlValue(ctrlh)) { NAhiliteDItem(win->pwin, iPartLimit, 255); } if (NAradioGet(win->pwin, iEmail, iSavefile) == iSavefile) { NAhiliteDItem(win->pwin, iEmailto, 255); } return (NATEupdatep(win, newsize)); } /* select desc text */ static short seldesctext(na_win *win) { win->activep = NATEactivep; win->idlep = NATEidlep; NATEactivep(win, true); ewin->nateon = true; SelIText(win->pwin, iDescEdit, 0, 0); TESetSelect(32767, 32767, twin->hTE); } /* encode control proc */ static short encodectrl(na_win *win, Point p, short item, short mods, ControlHandle ctrlh) { short value; DialogPeek dpeek = (DialogPeek) win->pwin; char *scan; Boolean good; StandardFileReply reply; PCstr tstr[257]; if (ctrlh == twin->vctrl) { return (NATEctrlp(win, p, item, mods, ctrlh)); } switch (item) { case iOk: /* get part size */ ewin->partsize = 0; NAgetDHandle(win->pwin, iLimit, &ctrlh); if (GetCtlValue(ctrlh)) { NAgetIText(win->pwin, iPartLimit, tstr); ewin->partsize = atol(C(tstr)) * 1000; } NAgetIText(win->pwin, iEmailto, tstr); ewin->useemail = NAradioGet(win->pwin, iEmail, iSavefile) == iEmail; if (ewin->useemail) { /* verify email address */ if (!strchr(C(tstr), '@')) { yell("Invalid Email address, please re-enter"); SelIText(win->pwin, iEmailto, 0, 32767); break; } } else { /* get output filename */ PtoPCstrcpy(tstr, (char *) ewin->fspec.name); if (PCstrlen(tstr) > 23) { PCstrlen(tstr) = 23; SetClen(tstr); } strcat(C(tstr), ".mime"); SetPlen(tstr); do { NAputFile(ewin->partsize ? "\pPart prefix" : "\pEmail file:", tstr, &reply); good = true; if (reply.sfGood && EqualString(reply.sfFile.name, ewin->fspec.name, true, false)) { good = false; yell("The output filename must be different from the input filename"); } } while (!good); if (!reply.sfGood) break; ewin->ofile = reply.sfFile; } if (NAwindow(0, NA_DIALOGWINDOW | NA_TITLEBAR | NA_HASTASK | NA_USERESOURCE | NA_MODAL, NULL, progDLOG, (long *) win, sizeof (mailwin), mailinit) == NA_CLOSED) { warn("Not enough memory to proceed"); break; } case iCancel: return (NA_REQCLOSE); case iEmail: case iSavefile: NAradioSet(win->pwin, iEmail, iSavefile, item); NAenableDItem(win->pwin, iEmailto, item == iEmail ? 1 : 0); NAhiliteDItem(win->pwin, iEmailto, item == iEmail ? 0 : 255); if (item == iEmail || dpeek->editField == iEmailto - 1) { SelIText(win->pwin, item == iEmail ? iEmailto : iSubj, 0, 32767); } break; case iLimit: SetCtlValue(ctrlh, value = !GetCtlValue(ctrlh)); NAenableDItem(win->pwin, iPartLimit, value ? 1 : 0); NAhiliteDItem(win->pwin, iPartLimit, value ? 0 : 255); if (value || dpeek->editField == iPartLimit - 1) { SelIText(win->pwin, value ? iPartLimit : iSubj, 0, 32767); } break; case iDescEdit: case iSubj: case iEmailto: case iPartLimit: if (!ewin->nateon && dpeek->editField == iDescEdit - 1) { seldesctext(win); } break; } if (ewin->nateon && dpeek->editField != iDescEdit - 1) { win->activep = NULL; win->idlep = NULL; NATEactivep(win, false); ewin->nateon = false; } return (NA_NOTPROCESSED); } /* encode key proc */ static short encodekey(na_win *win, long c, short mods) { if (!(mods & cmdKey)) { if (ewin->nateon && c != '\t' && c != '\n' && c != '\3' && c != '\033') { return (NATEkeyp(win, c, mods)); } } return (NA_NOTPROCESSED); } /* menu proc for encode window */ static short encodemenu(na_win *win, WORD menu, WORD item) { StandardFileReply descfile; MenuHandle mf = NAmenuh(mFile); short result = NA_NOTPROCESSED; short refnum; long size; Ptr text; Boolean success; switch (menu) { case 0: EnableItem(mf, iInsert); /* fall through */ case mEdit: result = ewin->nateon ? NATEmenup(win, menu, item) : NAdialogMenu(win, menu, item); break; case mFile: if (item != iInsert) break; result = NA_PROCESSED; NAgetFile(NULL, 1, textList, &descfile); if (!descfile.sfGood) break; if (HOpen(descfile.sfFile.vRefNum, descfile.sfFile.parID, descfile.sfFile.name, fsRdPerm, &refnum) != noErr) { warn("Failed to open file"); break; } text = NULL; success = GetEOF(refnum, &size) == noErr && (text = NewPtr(size)) != NULL && FSRead(refnum, &size, text) == noErr; if (success) { TEInsert(text, size, twin->hTE); TESelView(twin->hTE); NATEsetscroll(win, false, (Rect*) NULL, (Rect*) NULL); } else { warn("Failed to read file"); } if (text) DisposPtr(text); FSClose(refnum); break; } if (menu != 0) DisableItem(mf, iInsert); return (result); } /* mouse proc for encode window */ static short encodemouse(na_win *win, Point p, short type, short mods) { if (p.v >= twin->topoff && !ewin->nateon) seldesctext(win); return (NATEmousep(win, p, type, mods)); } /* close the encode window */ static short encodeclose(na_win *win) { NATEclosep(win); return (NA_CLOSED); } /* init the encode window */ static short encodeinit(na_win *win, long *data) { StandardFileReply *sf = (StandardFileReply *) data; Rect rtmp, btmp; FontInfo finfo; /* copy data */ ewin->fspec = sf->sfFile; ewin->ftype = sf->sfType; /* set sizing limits */ NAgetDRect(win->pwin, iBar, &btmp); rtmp = win->pwin->portRect; win->minw = win->maxw = rtmp.right - rtmp.left; win->minh = btmp.bottom + 64; twin->topoff = btmp.bottom; /* init text area */ TextFont(monaco); TextSize(9); GetFontInfo(&finfo); NATEinit(win, NATE_NOHSCROLL, 80 * finfo.widMax + 2, NULL, 0); ewin->nateon = 0; TextFont(0); TextSize(0); /* set control values */ NAradioSet(win->pwin, iEmail, iSavefile, iSavefile); if (tcpstart < 0) NAhiliteDItem(win->pwin, iEmail, 255); NAenableDItem(win->pwin, iEmailto, 0); NAenableDItem(win->pwin, iPartLimit, 0); NAsetIText(win->pwin, iSubj, ewin->fspec.name); SelIText(win->pwin, iSubj, 0, 32767); SetWTitle(win->pwin, ewin->fspec.name); ShowWindow(win->pwin); /* set window procedures */ win->updatep = encodeupdate; win->closep = encodeclose; win->keyp = encodekey; win->ctrlp = encodectrl; win->mousep = encodemouse; win->menup = encodemenu; win->idlep = NULL; win->activep = NULL; return (NA_NOTPROCESSED); } /* Encode procedure: first get a file, then open encode save window */ static void do_encode(FSSpec *fspec, OSType ftype) { StandardFileReply infile; if (!fspec) { NAgetFile(NULL, -1, NULL, &infile); if (!infile.sfGood) return; } else { infile.sfFile = *fspec; infile.sfType = ftype; } NAwindow(NULL, NA_DIALOGWINDOW | NA_TITLEBAR | NA_GROWBOX | NA_USERESOURCE | NA_DEFBUTTON | NA_HASCONTROLS, NULL, sendDLOG, (long *) &infile, sizeof (encodewin), encodeinit); } /* Open a file via drag&drop */ static short openfile(short message, FSSpec *fspec, FInfo *finfo) { if (message != appOpen) return (-1); /* open file */ if (finfo->fdType == 'TEXT') { do_decode(fspec); } else { do_encode(fspec, finfo->fdType); } return (0); } #define hwinfo ((nate_win *)win) /* help close procedure */ static short helpclose(na_win *win) { helpw = NULL; return (NATEclosep(win)); } /* help window procedure */ static short helpwindow(na_win *win, long *data) { Rect rtemp, vtemp; Handle h, hs; long len; TEHandle hTE; rtemp = win->pwin->portRect; vtemp = rtemp; vtemp.right = vtemp.left + (hwinfo->docwidth = 475); win->mousep = NATEmousep; win->idlep = NATEidlep; win->menup = NATEmenup; win->activep = NATEactivep; win->updatep = NATEupdatep; win->ctrlp = NATEctrlp; win->closep = helpclose; win->cursorRgn = NewRgn(); hwinfo->vctrl = hwinfo->hctrl = NULL; TEAutoView(true, hTE = hwinfo->hTE = TEStylNew(&vtemp, &rtemp)); h = GetResource('TEXT', helpTEXT); hs = GetResource('styl', helpSTYL); len = GetHandleSize(h); HLock(h); TEStylInsert(*h, len, (StScrpHandle) hs, hTE); HUnlock(h); TESetSelect(0, 0, hTE); hwinfo->lheight = TEGetHeight((*hTE)->nLines, 0, hTE) / (*hTE)->nLines; ShowWindow(helpw = win->pwin); return (NA_NOTPROCESSED); } /* Set the hostname: TCP callback */ static void sethost(void *user, na_tcp s, short status, long size, char *data) { PCstr host[65]; Rect box; na_win *win, **winh; /* first make sure our window still exists */ for (winh = NAhead; winh && (*winh)->type != PREFWIN; winh = (*winh)->next); if (!winh || (*winh)->child != user) return; win = NAlockWindow((na_win **) user); /* check for errors */ if (status != NATCP_connect) { warn("Failed to get hostname from MacTCP"); } else { if (data[size - 1] == '.') --size; PCstrlen(host) = size; memcpy(C(host), data, size); NAsetIText((*winh)->pwin, iHost, host); SelIText((*winh)->pwin, iHost, 0, 32767); } prwin->percent = 100; progressupdate(win, false); NAunlockWindowh(winh, win); } /* if TCP is active, get hostname */ static short settask(na_win *win) { if (tcpstart == 0 && !prwin->percent) { NAsetIText(win->pwin, iWorkText, "\pLooking for MacTCP"); prwin->percent = 1; progressupdate(win, false); NATCPinit(mytcpinit); } else if (tcpstart == 1 && prwin->percent < 50) { NAsetIText(win->pwin, iWorkText, "\pLooking up Internet hostname"); prwin->percent = 50; progressupdate(win, false); NATCPgethost(sethost, (void *) GetWRefCon(win->pwin)); } progressupdate(win, false); if (tcpstart == -1) { warn("MacTCP not available"); NAhiliteDItem((*win->parent)->pwin, iSet, 255); } return (tcpstart == -1 || prwin->percent == 100 ? NA_CLOSED : NA_NOTPROCESSED); } /* set the Internet host via MacTCP */ static short setinit(na_win *win, long *data) { win->taskp = settask; win->updatep = progressupdate; win->closep = progressclose; NAmodalMenus(1); return (NA_NOTPROCESSED); } /* preference control procedure */ static short prefsctrl(na_win *win, Point p, short item, short mods, ControlHandle ctrlh) { PCstr tmpstr[257]; short encoding, extract_text, quit_finished, result = NA_NOTPROCESSED; ControlHandle ctrl; char *scan, *end; short changed, len, i, useic; static short prefitem[3] = { iHost, iEmailAddr, iMailServer }; switch (item) { case iOk: HLock((Handle) mpack_prefs); changed = 0; encoding = NAradioGet(win->pwin, iAuto, iDouble) - iAuto; NAgetDHandle(win->pwin, iTextEncode, &ctrl); extract_text = GetCtlValue(ctrl); NAgetDHandle(win->pwin, iQuitFinish, &ctrl); quit_finished = GetCtlValue(ctrl); if (encoding != (*mpack_prefs)->encoding || extract_text != (*mpack_prefs)->extract_text || quit_finished != (*mpack_prefs)->quit_finished) { changed = 1; } if (changed) { (*mpack_prefs)->encoding = encoding; (*mpack_prefs)->extract_text = extract_text; (*mpack_prefs)->quit_finished = quit_finished; ChangedResource((Handle) mpack_prefs); changed = 0; } len = 1; scan = (*mpack_prefs)->internet_host; end = (char *) *mpack_prefs + GetHandleSize((Handle) mpack_prefs); for (i = 0; i < 3; ++i) { NAgetIText(win->pwin, prefitem[i], P(tmpstr)); SetClen(tmpstr); len += PCstrlen(tmpstr); if (scan == end || strcmp(C(tmpstr), scan)) { changed = 1; } while (scan < end && *scan++); } if (changed) { HUnlock((Handle) mpack_prefs); /* update the preferences resource */ SetHandleSize((Handle) mpack_prefs, sizeof (struct mpack_preferences) + len); HLock((Handle) mpack_prefs); scan = (*mpack_prefs)->internet_host; useic = icinst && ICBegin(icinst, icReadWritePerm) == noErr; for (i = 0; i < 3; ++i) { NAgetIText(win->pwin, prefitem[i], P(tmpstr)); SetClen(tmpstr); strcpy(scan, C(tmpstr)); scan += PCstrlen(tmpstr) + 1; if (i && useic) { ICSetPref(icinst, i == 1 ? kICEmail : kICSMTPHost, ICattr_no_change, (Ptr) P(tmpstr), PCstrlen(tmpstr) + 1); } } if (useic) ICEnd(icinst); ChangedResource((Handle) mpack_prefs); } HUnlock((Handle) mpack_prefs); case iCancel: result = NA_REQCLOSE; NAmodalMenus(0); break; case iAuto: case iData: case iSingle: case iDouble: NAradioSet(win->pwin, iAuto, iDouble, item); break; case iTextEncode: case iQuitFinish: SetCtlValue(ctrlh, !GetCtlValue(ctrlh)); break; case iSet: NAwindow(0, NA_DIALOGWINDOW | NA_TITLEBAR | NA_HASTASK | NA_USERESOURCE | NA_MODAL | NA_CHILDWINDOW, NULL, progDLOG, NULL, sizeof (progresswin), setinit); break; } return (result); } /* update preferences dialog */ static short prefsupdate(na_win *win, Boolean newsize) { Handle hn; Rect box; short type; /* draw disabled items */ GetDItem(win->pwin, iEmailAddr, &type, &hn, &box); if (type == statText) NAhiliteDItem(win->pwin, iEmailAddr, 255); GetDItem(win->pwin, iMailServer, &type, &hn, &box); if (type == statText) NAhiliteDItem(win->pwin, iMailServer, 255); return (NA_NOTPROCESSED); } /* initialize preferences dialog */ static short prefsinit(na_win *win, long *data) { PCstr tmpstr[257], eaddr[257]; ControlHandle ctrl; win->type = PREFWIN; win->ctrlp = prefsctrl; win->menup = NAdialogMenu; win->updatep = prefsupdate; HLock((Handle) mpack_prefs); strcpy(C(tmpstr), (*mpack_prefs)->internet_host); HUnlock((Handle) mpack_prefs); SetPlen(tmpstr); NAsetIText(win->pwin, iHost, P(tmpstr)); SelIText(win->pwin, iHost, 0, 32767); getICprefs(win, eaddr, tmpstr); NAsetIText(win->pwin, iEmailAddr, P(eaddr)); NAsetIText(win->pwin, iMailServer, P(tmpstr)); NAradioSet(win->pwin, iAuto, iDouble, (*mpack_prefs)->encoding + iAuto); NAsetIval(win->pwin, iTextEncode, (*mpack_prefs)->extract_text); NAsetIval(win->pwin, iQuitFinish, (*mpack_prefs)->quit_finished); if (tcpstart == -1) NAhiliteDItem(win->pwin, iSet, 255); NAmodalMenus(1); ShowWindow(win->pwin); return (NA_NOTPROCESSED); } /* Main menu procedure */ static short mainmenu(na_win *win, WORD menuid, WORD itemno) { short status = NA_NOTPROCESSED; MenuHandle mh; PCstr version[32]; switch (menuid) { case 0: NAenableMItem(mApple, iAbout); return (status); case mApple: if (itemno == iAbout) { CtoPCstrcpy(version, MPACK_VERSION); ParamText(P(version), NULL, NULL, NULL); return (NA_NOTPROCESSED); } break; case mFile: switch (itemno) { case iEncode: do_encode(NULL, 0); status = NA_PROCESSED; break; case iDecode: do_decode(NULL); status = NA_PROCESSED; break; case iClose: break; case iPrefs: status = NAwindow(0, NA_DIALOGWINDOW | NA_USERESOURCE | NA_MODAL | NA_DEFBUTTON | NA_TITLEBAR, NULL, prefsDLOG, (long *) NULL, 0, prefsinit); break; case iQuit: status = NA_REQCLOSEALL; break; } break; case mEdit: break; case mHelp: if (!helpw) { NAwindow(0, NA_USERESOURCE | NATEflags | NATE_READONLY | NA_SMARTSIZE, NULL, helpWIND, (long *) NULL, sizeof (nate_win), helpwindow); } else { SelectWindow(helpw); } break; } NAdisableMItem(mApple, iAbout); return (status); } /* make preferences folder/file * returns -1 on failure. */ static short makepref() { Handle hpref = NULL, htmpl; long dirID; short vRefNum; char *scan, *end; PCstr dname[257]; CInfoPBRec cpb; DirInfo *dp = &cpb.dirInfo; ParamBlockRec pb; VolumeParam *vp = &pb.volumeParam; FInfo finfo; static unsigned char pname[] = "\pprefs"; /* set up pref folder storage */ pfolder = (struct pref_folder *) NewPtr(sizeof (struct pref_folder)); if (!pfolder) return (-1); end = scan = (char *) pfolder->prefs + sizeof (pfolder->prefs) - 1; *scan = '\0'; /* get pref folder */ if (FindFolder(kOnSystemDisk, kPreferencesFolderType, kCreateFolder, &vRefNum, &pfolder->fspec.parID) != noErr) { return (-1); } /* create subfolder, if needed */ PtoPCstrcpy(dname, (char *) "\pMpack"); (void) DirCreate(vRefNum, pfolder->fspec.parID, P(dname), &dirID); /* get mpack prefs folder info */ dp->ioNamePtr = P(dname); dp->ioVRefNum = vRefNum; dp->ioFDirIndex = 0; dp->ioDrDirID = pfolder->fspec.parID; if (PBGetCatInfoSync(&cpb) != noErr) return (-1); pfolder->fspec.parID = dirID = dp->ioDrDirID; pfolder->fspec.vRefNum = vRefNum; /* generate pathname */ dp->ioFDirIndex = -1; for (;;) { *--scan = ':'; if (scan - (char *) pfolder->prefs < 1 + PCstrlen(dname)) return (-1); scan -= PCstrlen(dname); memcpy(scan, C(dname), PCstrlen(dname)); if ((dp->ioDrDirID = dp->ioDrParID) == 2) break; if (PBGetCatInfoSync(&cpb) != noErr) return (-1); } vp->ioVolIndex = 0; vp->ioNamePtr = P(dname); vp->ioVRefNum = vRefNum; if (PBGetVInfoSync(&pb) != noErr) return (-1); *--scan = ':'; if (scan - (char *) pfolder->prefs < 16 + PCstrlen(dname)) return (-1); PtoPCstrcpy(pfolder->prefs, (char *) P(dname)); CtoPCstrcat(pfolder->prefs, scan); /* Get/Create preferences file */ HCreateResFile(vRefNum, dirID, pname); if (ResError() == noErr) { HGetFInfo(vRefNum, dirID, pname, &finfo); finfo.fdType = 'pref'; finfo.fdCreator = 'mPAK'; HSetFInfo(vRefNum, dirID, pname, &finfo); hpref = GetResource('mPRF', prefsID); DetachResource(hpref); htmpl = GetResource('TMPL', IDnaID); DetachResource(htmpl); } pfolder->refnum = HOpenResFile(vRefNum, dirID, pname, fsRdWrPerm); if (pfolder->refnum < 0) return (-1); if (hpref) { AddResource(hpref, 'mPRF', prefsID, "\p"); AddResource(htmpl, 'TMPL', IDnaID, "\pIDna"); ReleaseResource(htmpl); } else { hpref = GetResource('mPRF', prefsID); } if (!hpref) return (-1); mpack_prefs = (struct mpack_preferences **) hpref; return (0); } /* cleanup shared resources */ void maccleanup() { if (pfolder) { CloseResFile(pfolder->refnum); DisposPtr((Ptr) pfolder); } if (icinst) ICStop(icinst); if (tcpstart == 1) NATCPdone(120); /* give 2 seconds to go away */ } main() { CursHandle cursH; if (NAinit(128, 2, openfile, mainmenu, 3, 1, 0, iClose) == 0) { /* set up preferences */ if (makepref() < 0) { yell("Couldn't create preferences file"); } else { /* set up internet config */ if (ICStart(&icinst, 'mPAK') == noErr) { (void) ICFindConfigFile(icinst, 0, NULL); } /* save watch cursor */ cursH = GetCursor(watchCursor); watch = **cursH; /* enter main loop, cleanup on exit */ NAmainloop(); maccleanup(); } } } mpack-1.6/macndlog.c0000444005347200000120000001451205720743042010066 /* macndlog.c -- dialog utilities for nifty application library */ /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* (C) Copyright 1990-1995 by Christopher J. Newman * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Christopher J. Newman not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Christopher J. Newman makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Christopher J. Newman * Message: This is a nifty program. */ #ifndef THINK_C #include #endif #include #include "macnapp.h" /* enable/disable menus for a moveable modal dialog */ void NAmodalMenus(int begin) { short i, end; MenuHandle mh; /* unhilite menus */ HiliteMenu(0); /* everything but the edit/apple/help menus */ for (i = mFile; (mh = NAmenuh(i)); ++i) { if (i != mEdit) { if (begin) DisableItem(mh, 0); else EnableItem(mh, 0); } } /* kill the help items */ mh = NAmenuh(mApple); i = NAappleitems; if (NAhelpcount) { HMGetHelpMenuHandle(&mh); i = NAhelpcount + 1; } for (end = NAhelpitems + i; i <= end; ++i) { if (begin) DisableItem(mh, i); else EnableItem(mh, i); } DrawMenuBar(); } /* enable/disable a control in a dialog window */ void NAenableDItem(DialogPtr dialog, short item, Boolean on) { short type; Handle ctrl; short ty; Rect box; GetDItem(dialog, item, &ty, &ctrl, &box); type = ty; if (on) type &= ~itemDisable; else type |= itemDisable; if (type == (editText | itemDisable)) { type = statText; } else if (type == statText) { type = editText; } SetDItem(dialog, item, type, ctrl, &box); } /* hilite a control in a dialog window */ void NAhiliteDItem(DialogPtr dialog, short item, short how) { Handle ctrl; short type; Rect box; PenState tmpPen; GetDItem(dialog, item, &type, &ctrl, &box); if (type & ctrlItem) { HiliteControl((ControlHandle) ctrl, how); } else if (type & (statText | editText)) { GetPenState(&tmpPen); PenNormal(); if (how == 255) PenPat(QD(gray)); InsetRect(&box, -3, -3); FrameRect(&box); SetPenState(&tmpPen); } } /* make an item visible/invisible in a dialog window */ void NAvisibleDItem(DialogPtr dialog, short item, Boolean show) { if (show) ShowDItem(dialog, item); else HideDItem(dialog, item); } /* set the text in a dialog item */ void NAsetIText(DialogPtr dialog, short item, PCstr *str) { Handle texth; NAgetDHandle(dialog, item, &texth); SetIText(texth, str); } /* get the text in a dialog item */ void NAgetIText(DialogPtr dialog, short item, PCstr *str) { Handle texth; NAgetDHandle(dialog, item, &texth); GetIText(texth, str); SetClen(str); } /* set the appropriate radio buttons */ short NAradioSet(DialogPtr dialog, short firstitem, short lastitem, short setting) { short item; ControlHandle ctrl; for (item = firstitem; item <= lastitem; item++) { NAgetDHandle(dialog, item, &ctrl); SetCtlValue(ctrl, item == setting ? 1 : 0); } return (setting - firstitem); } /* get the itemno of the active radio button */ short NAradioGet(DialogPtr dialog, short firstitem, short lastitem) { short item; ControlHandle ctrl; for (item = firstitem; item <= lastitem; item++) { NAgetDHandle(dialog, item, &ctrl); if (GetCtlValue(ctrl)) return (item); } return (firstitem); } /* handle the edit menu for a dialog window */ short NAdialogMenu(na_win *win, WORD menu, WORD item) { MenuHandle mh = NAmenuh(mEdit); DialogPeek dpeek = (DialogPeek) win->pwin; short result = NA_NOTPROCESSED; switch (menu) { case 0: if ((*dpeek->textH)->selStart != (*dpeek->textH)->selEnd) { EnableItem(mh, iCopy); EnableItem(mh, iCut); EnableItem(mh, iClear); } EnableItem(mh, iPaste); if ((*dpeek->textH)->teLength > 0) EnableItem(mh, iSelAll); break; case mEdit: switch (item) { case iCut: DlgCut(win->pwin); ZeroScrap(); TEToScrap(); break; case iCopy: DlgCopy(win->pwin); ZeroScrap(); TEToScrap(); break; case iClear: DlgDelete(win->pwin); break; case iPaste: DlgPaste(win->pwin); break; case iSelAll: SelIText(win->pwin, dpeek->editField + 1, 0, 32767); break; } result = NA_PROCESSED; break; } if (menu != 0) DisableItem(mh, iSelAll); return (result); } mpack-1.6/macntcp.c0000444005347200000120000005320205720743042007726 /* macntcp.c -- macintosh nifty application library async TCP routines */ /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* (C) Copyright 1994-1995 by Christopher J. Newman * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Christopher J. Newman not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Christopher J. Newman makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Christopher J. Newman * Message: This is a nifty program. */ #include #include #include #include #include #include "macnapp.h" #define DEF_STREAM_SIZE 8192 #define MAX_TCPCON 16 #define RDS 8 /* write buffer for TCP writes */ typedef struct tcpwb { short rused; /* number of RDS used (-1 == in TCPsend) */ short wused; /* amount of small buffer used */ rdsEntry rds[RDS+1]; /* array of RDS pointers */ char fflag[RDS+1]; /* free flags for RDS pointers (1 = call DisposPtr) */ char *buf; /* write buffer */ } tcpwb; /* structure describing a TCP connection */ typedef struct tcpinfo { short state; /* current state */ short rclose; /* remote host wants to close */ short lclose; /* local host wants to close */ int havedata:1; /* data is available to read */ int urgent:1; /* TCP in urgent mode */ int push:1; /* next write should be pushed */ int pushed:1; /* last write was pushed */ int reading:1; /* reading data */ int server:1; /* is a server, rather than client */ int gethost:1; /* getting hostname -- not a real connection */ int dnrdone:1; /* DNR query is done */ short wbnum; /* write buffer for next write */ unsigned short wbsize; /* size of write buffer */ unsigned short reason; /* reason for TCP termination */ StreamPtr stream; /* TCP stream */ ip_port port; /* TCP port number to connect to */ void *context; /* user context */ na_tcpreadp *callback; /* callback function */ rdsEntry rrds[RDS+1]; /* read RDS structure */ tcpwb wb[2]; /* write buffers */ struct hostInfo host; /* hostname & ip_addr of host */ TCPiopb pb; /* parameter block for TCP connect/write/close */ TCPiopb rpb; /* parameter block for TCP read */ char buf[1]; /* stream buffer follows */ } tcpinfo; /* TCP task state information */ struct tcpstate { na_win win; short tcp_driver; na_tcpinitp *tcp_initp; tcpinfo *tcpbufs[MAX_TCPCON]; IOParam *open_pb; long waiticks, waitstart; short waitpercent; long streamsize; byte TOS, precedence; unsigned short wbsize; char localhost[256]; } **tcpstate = NULL; #define tstate ((struct tcpstate *) win) /* tcp state bitmasks */ #define TCP_PBINUSE 0x04 /* tcp->pb in use */ #define TCP_DNSINUSE 0x08 /* DNS in use */ #define TCP_NOTREADY 0x10 /* not ready for reading */ /* tcp states */ #define TCP_READY 1 /* inactive */ #define TCP_RESOLVE (TCP_NOTREADY + TCP_DNSINUSE + 0) /* resolving hostname */ #define TCP_GETHOST (TCP_NOTREADY + TCP_DNSINUSE + 1) /* looking up hostname */ #define TCP_WRITING (TCP_PBINUSE + 0) /* writing data */ #define TCP_CONNECT (TCP_NOTREADY + TCP_PBINUSE + 0) /* waiting for a connection */ #define TCP_CLOSING (TCP_NOTREADY + TCP_PBINUSE + 1) /* waiting for TCPclose */ #define TCP_CLOSED 2 /* closed */ /* free write buffer storage */ static void freewb(tcpwb *wb) { short i; for (i = 0; wb->rds[i].length; ++i) { if (wb->fflag[i]) { DisposPtr(wb->rds[i].ptr); wb->fflag[i] = 0; } } wb->rused = 0; wb->wused = 0; } /* make sure tcp_driver is open */ static short tcp_checkdriver() { short msg = NATCP_nodriver; struct tcpstate *ts = *tcpstate; IOParam *opb = ts->open_pb; if (!opb) return (1); if (opb->ioResult == 1) return (0); if (opb->ioResult == noErr && OpenResolver(nil) == noErr) { ts->tcp_driver = opb->ioRefNum; msg = NATCP_connect; } DisposPtr((Ptr) opb); ts = *tcpstate; ts->open_pb = NULL; (*ts->tcp_initp)(msg); return (1); } /* wait for MacTCP to finish whatever it's doing, with user cancel */ static short tcp_wait(struct tcpstate *ts, tcpinfo *tcp) { KeyMap mapkeys; #define keys ((unsigned char *)mapkeys) short percent; while (!tcp_checkdriver() || (tcp && (tcp->state & TCP_DNSINUSE) && ! (volatile) tcp->dnrdone) || (tcp && (tcp->state & TCP_PBINUSE) && (volatile short) tcp->pb.ioResult == 1)) { if (ts) { if (!ts->waiticks) return (0); percent = ((TickCount() - ts->waitstart) * 100) / ts->waiticks; if (percent > 100) percent = 100; if (percent != ts->waitpercent) { (*ts->tcp_initp)(ts->waitpercent = percent); } if (percent == 100) return (0); } SystemTask(); GetKeys(mapkeys); if ((keys[0x37 >> 3] >> (0x37 & 7)) & (keys[0x2f >> 3] >> (0x2f & 7)) & 1) { return (0); } } return (1); } /* clean up the TCP task */ static short tcp_closep(na_win *win) { short i, j; tcpinfo *tcp; tcpwb *wb; TCPiopb pb; tstate->waitstart = TickCount(); tstate->waitpercent = 0; tcp_wait(tstate, NULL); memset((void *) &pb, 0, sizeof (pb)); for (i = 0; i < MAX_TCPCON; ++i) { if ((tcp = tstate->tcpbufs[i]) != NULL) { /* wait for MacTCP to finish what it's doing, but permit user cancel */ if (!tcp->server || tcp->state != TCP_CONNECT) tcp_wait(tstate, tcp); if (!tcp->gethost) { pb.ioCRefNum = tstate->tcp_driver; pb.tcpStream = tcp->stream; pb.csCode = TCPRelease; PBControl((ParmBlkPtr) &pb, false); } freewb(tcp->wb); freewb(tcp->wb + 1); DisposPtr((Ptr) tcp); tstate->tcpbufs[i] = NULL; } } tcpstate = NULL; if (tstate->tcp_driver) CloseResolver(); return (NA_CLOSED); } /* begin writing data */ static short beginwrite(tcpinfo *tcp) { tcpwb *wb = tcp->wb + tcp->wbnum; /* if connection terminated, or we've sent a TCPclose, we can't write */ if (tcp->rclose == 3 || tcp->lclose > 1) return (0); memset((void *) &tcp->pb.csParam, 0, sizeof (tcp->pb.csParam)); tcp->pb.csCode = TCPSend; tcp->pb.csParam.send.ulpTimeoutValue = 60; /* 1 minute to send data */ tcp->pb.csParam.send.ulpTimeoutAction = 0; tcp->pb.csParam.send.validityFlags = 0xC0; tcp->pb.csParam.send.wdsPtr = (Ptr) wb->rds; tcp->pb.csParam.send.pushFlag = tcp->pushed = tcp->push; PBControl((ParmBlkPtr) &tcp->pb, true); tcp->push = 0; tcp->wbnum = 1 - tcp->wbnum; wb->rused = -1; return (tcp->state = TCP_WRITING); } /* do I/O polling */ short NATCPtask(na_win *win) { tcpinfo *tcp; rdsEntry *rds, *trds; short result, newstate; short processed = NA_PROCESSED; na_tcp i; tcpwb *wb; int j; /* finish off driver initialization: */ if (!tstate->tcp_driver) { if (!tcp_checkdriver()) return (NA_NOTPROCESSED); if (!tstate->tcp_driver) return (NA_REQCLOSE); } /* loop through connections */ for (i = 0; i < MAX_TCPCON; ++i) { if ((tcp = tstate->tcpbufs[i]) != NULL) do { /* read data if we have it */ if (!tcp->reading && !tcp->rclose && tcp->havedata && tcp->state != TCP_CONNECT) { tcp->rpb.ioCRefNum = tstate->tcp_driver; tcp->rpb.tcpStream = tcp->stream; tcp->rpb.csCode = TCPNoCopyRcv; tcp->rpb.csParam.receive.rdsPtr = (Ptr) tcp->rrds; tcp->rpb.csParam.receive.commandTimeoutValue = 5; tcp->rpb.csParam.receive.rdsLength = RDS; if (tcp->pushed) { tcp->rpb.csParam.receive.commandTimeoutValue = 1; tcp->rpb.csParam.receive.rdsLength = 1; } tcp->havedata = 0; PBControl((ParmBlkPtr) &tcp->rpb, tcp->pushed ? false : true); tcp->reading = 1; tcp->pushed = 0; } if (tcp->reading) { if ((result = tcp->rpb.ioResult) == 1) { processed = NA_NOTPROCESSED; } else { tcp->reading = 0; if (result != noErr) { if (result != commandTimeout) { (*tcp->callback)(tcp->context, i, NATCP_noread, result, NULL); } } else { result = NATCP_data | NATCP_more; if (tcp->rpb.csParam.receive.urgentFlag) tcp->urgent = 1; if (tcp->urgent) result |= NATCP_urgent; if (tcp->rpb.csParam.receive.markFlag) tcp->urgent = 0; for (rds = tcp->rrds; rds->length; ++rds) { if (!rds[1].length) result &= ~NATCP_more; (*tcp->callback)(tcp->context, i, result, rds->length, rds->ptr); } tcp->rpb.csCode = TCPRcvBfrReturn; PBControl((ParmBlkPtr) &tcp->rpb, false); } } } result = tcp->pb.ioResult; newstate = 0; switch (tcp->state) { case TCP_GETHOST: if (tcp->dnrdone) { tcp->rclose = 3; newstate = TCP_CLOSED; if (tcp->host.rtnCode != noErr) { (*tcp->callback)(tcp->context, i, NATCP_nohost, tcp->host.rtnCode, NULL); } else { (*tcp->callback)(tcp->context, i, NATCP_connect, strlen(tcp->host.cname), tcp->host.cname); strcpy(tstate->localhost, tcp->host.cname); } } break; case TCP_RESOLVE: if (tcp->dnrdone) { if (tcp->host.rtnCode != noErr) { tcp->rclose = 3; newstate = TCP_CLOSED; (*tcp->callback)(tcp->context, i, NATCP_nohost, tcp->host.rtnCode, NULL); } else if (!tcp->lclose) { memset((void *) &tcp->pb, 0, sizeof (tcp->pb)); tcp->pb.ioCRefNum = tstate->tcp_driver; tcp->pb.tcpStream = tcp->stream; tcp->pb.csParam.open.ulpTimeoutValue = 30; tcp->pb.csParam.open.ulpTimeoutAction = 1; /* Abort on timeout */ tcp->pb.csParam.open.tosFlags = tstate->TOS; tcp->pb.csParam.open.precedence = tstate->precedence; tcp->pb.csParam.open.validityFlags = timeoutValue|timeoutAction|typeOfService|precedence; tcp->pb.csParam.open.remoteHost = tcp->host.addr[0]; if (tcp->server) { tcp->pb.csCode = TCPPassiveOpen; tcp->pb.csParam.open.commandTimeoutValue = 0; tcp->pb.csParam.open.remotePort = 0; tcp->pb.csParam.open.localPort = tcp->port; } else { tcp->pb.csCode = TCPActiveOpen; tcp->pb.csParam.open.remotePort = tcp->port; tcp->pb.csParam.open.localPort = 0; } PBControl((ParmBlkPtr) &tcp->pb, true); newstate = TCP_CONNECT; } } break; case TCP_CONNECT: if (result == 1) { processed = NA_NOTPROCESSED; break; } if (result != noErr) { tcp->rclose = 3; newstate = TCP_CLOSED; (*tcp->callback)(tcp->context, i, NATCP_nocon, result, NULL); } else { newstate = TCP_READY; if (tcp->server) { tcp->port = tcp->pb.csParam.open.remotePort; if (!*tcp->host.cname) { AddrToStr(tcp->pb.csParam.open.remoteHost, tcp->host.cname); } } (*tcp->callback)(tcp->context, i, NATCP_connect, tcp->port, tcp->host.cname); } break; case TCP_READY: /* Write data if we have it */ wb = tcp->wb + tcp->wbnum; if (wb->rused && (newstate = beginwrite(tcp))) { break; } /* check if other side wants to close */ if (tcp->rclose == 1) { tcp->rclose = 2; (*tcp->callback)(tcp->context, i, NATCP_closing, 0, NULL); } /* check if connection needs closing at this end */ if (tcp->lclose == 1) { tcp->lclose = 2; tcp->pb.csCode = TCPClose; tcp->pb.csParam.close.validityFlags = 0xC0; tcp->pb.csParam.close.ulpTimeoutValue = 30; /* give 30 secs to close */ tcp->pb.csParam.close.ulpTimeoutAction = 0; PBControl((ParmBlkPtr) &tcp->pb, true); newstate = TCP_CLOSING; break; } /* check if connection closed at both ends */ if (tcp->rclose == 3) { (*tcp->callback)(tcp->context, i, NATCP_closed, tcp->reason, NULL); newstate = TCP_CLOSED; } break; case TCP_WRITING: if (result == 1) { processed = NA_NOTPROCESSED; break; } wb = tcp->wb; if (wb->rused != -1) ++wb; freewb(wb); if (result != noErr) { tcp->pushed = 0; (*tcp->callback)(tcp->context, i, NATCP_nowrite, result, NULL); } newstate = TCP_READY; break; case TCP_CLOSING: if (result == 1) { processed = NA_NOTPROCESSED; break; } newstate = TCP_READY; break; case TCP_CLOSED: if (!tcp->rclose) break; if (!tcp->gethost) { tcp->pb.csCode = TCPRelease; PBControl((ParmBlkPtr)&tcp->pb, false); } freewb(tcp->wb); freewb(tcp->wb + 1); DisposPtr((Ptr) tcp); tstate->tcpbufs[i] = NULL; break; } if (newstate) tcp->state = newstate; } while (newstate); } return (processed); } /* Async notification routine */ static pascal void myTCPNotifyProc(StreamPtr stream, unsigned short eventCode, Ptr userDataPtr, unsigned short terminReason, struct ICMPReport *icmpMsg) { tcpinfo *tcp = (tcpinfo *) userDataPtr; switch (eventCode) { case TCPTerminate: tcp->rclose = 3; tcp->reason = terminReason; break; case TCPClosing: tcp->rclose = 1; break; case TCPDataArrival: tcp->havedata = 1; break; case TCPUrgent: tcp->urgent = 1; break; } } /* DNR resultproc */ static pascal void addrproc(struct hostInfo *hinfop, char *udata) { ((tcpinfo *) udata)->dnrdone = 1; } /* callback to pass TCP info to window */ static void winreadp(void *context, na_tcp i, short status, long len, char *buf) { natcp_win *w; w = (natcp_win *) NAlockWindow((na_win **) context); w->s = i; (*w->readp)(&w->winp, status, len, buf); NAunlockWindowh((na_win **) context, &w->winp); } /* adjust TCP settings */ void NATCPsettings(long streamsize, short type_of_service, short precedence, unsigned short wbsize) { if (!streamsize) streamsize = DEF_STREAM_SIZE; (*tcpstate)->streamsize = streamsize ? streamsize : DEF_STREAM_SIZE; (*tcpstate)->TOS = type_of_service; (*tcpstate)->precedence = precedence; if (!wbsize) wbsize = 1024; (*tcpstate)->wbsize = wbsize; } /* initialize TCP system */ void NATCPinit(na_tcpinitp *initp) { IOParam *pb; int i; struct tcpstate *ts; pb = (IOParam *) NewPtrClear(sizeof (IOParam)); tcpstate = (struct tcpstate **) NAaddtask(NATCPtask, sizeof (struct tcpstate)); if (!tcpstate || !pb) { (*initp)(NATCP_nomem); } else { pb->ioNamePtr = "\p.IPP"; PBOpen((ParmBlkPtr) pb, true); ts = *tcpstate; for (i = 0; i < MAX_TCPCON; ++i) ts->tcpbufs[i] = NULL; ts->waiticks = 60; /* wait 1 sec for TCP close by default */ ts->win.type = NA_TCPTYPE; ts->win.closep = tcp_closep; ts->win.priority = -1; ts->tcp_initp = initp; ts->open_pb = pb; NATCPsettings(0, 0, 0, 0); } } /* get a TCP buffer block */ static tcpinfo *getTCPbuf(na_tcpreadp *callback, void *context, int *id) { int i; tcpinfo *tcp; /* make sure driver is open */ if (!(*tcpstate)->tcp_driver && (!tcp_wait(NULL, NULL) || !(*tcpstate)->tcp_driver)) { (*callback)(context, -1, NATCP_nodriver, 0, NULL); return (NULL); } /* find pointer slot and create buffer */ for (i = 0; i < MAX_TCPCON && (*tcpstate)->tcpbufs[i]; ++i); if (i == MAX_TCPCON) { (*callback)(context, -1, NATCP_notcpbuf, 0, NULL); return (NULL); } tcp = (tcpinfo *) NewPtr(sizeof (tcpinfo) - 1 + (*tcpstate)->streamsize + (unsigned long) (*tcpstate)->wbsize * 2); if (!tcp) { (*callback)(context, -1, NATCP_nomem, 0, NULL); return (NULL); }; *id = i; (*tcpstate)->tcpbufs[i] = tcp; memset((char *) tcp, 0, sizeof (tcpinfo)); /* initialize fields from global state */ tcp->wbsize = (*tcpstate)->wbsize; tcp->wb[0].buf = tcp->buf + (*tcpstate)->streamsize; tcp->wb[1].buf = tcp->wb[0].buf + tcp->wbsize; tcp->pb.ioCRefNum = (*tcpstate)->tcp_driver; tcp->context = context; tcp->callback = callback; return (tcp); } /* get host name */ void NATCPgethost(na_tcpreadp *callback, void *context) { int id; tcpinfo *tcp; struct IPParamBlock *ippb; na_win *win; if ((*tcpstate)->localhost[0]) { win = NAlockWindow((na_win **) tcpstate); (*callback)(context, -1, NATCP_connect, strlen(tstate->localhost), tstate->localhost); NAunlockWindowh((na_win **) tcpstate, win); } else if ((tcp = getTCPbuf(callback, context, &id)) != NULL) { /* here we make the assumption that an IP param block is smaller than * a TCP param block. This seems like a safe assumption to me. */ ippb = (struct IPParamBlock *) &tcp->pb; /* get IP address */ ippb->ioCRefNum = (*tcpstate)->tcp_driver; ippb->csCode = ipctlGetAddr; PBControl((ParmBlkPtr)ippb, false); if (ippb->ioResult != 0) { (*callback)(context, -1, NATCP_notcpbuf, ippb->ioResult, NULL); DisposPtr((Ptr) tcp); (*tcpstate)->tcpbufs[id] = NULL; } else { /* begin IP address lookup */ tcp->dnrdone = 0; AddrToName(ippb->ourAddress, &tcp->host, addrproc, (char *) tcp); tcp->state = TCP_GETHOST; tcp->gethost = 1; } } } /* open a TCP connection */ na_tcp NATCPopen(na_tcpreadp *callback, void *context, char *host, long port, short flags) { int i, err = NATCP_notcpbuf; OSErr resolve = noErr; tcpinfo *tcp; if ((tcp = getTCPbuf(callback, context, &i)) == NULL) return (-1); if (flags & NATCP_server) tcp->server = 1; tcp->port = port; tcp->pb.csCode = TCPCreate; tcp->pb.csParam.create.rcvBuff = (Ptr) tcp->buf; tcp->pb.csParam.create.rcvBuffLen = (*tcpstate)->streamsize; tcp->pb.csParam.create.notifyProc = myTCPNotifyProc; tcp->pb.csParam.create.userDataPtr = (Ptr) tcp; PBControl((ParmBlkPtr)&tcp->pb, false); if (tcp->pb.ioResult == 0) { tcp->state = TCP_RESOLVE; tcp->stream = tcp->pb.tcpStream; /* a server isn't required to have a hostname */ if (!host && tcp->server) return (i); tcp->dnrdone = 0; resolve = StrToAddr(host, &tcp->host, addrproc, (char *) tcp); if (resolve == noErr) tcp->dnrdone = 1; if (resolve == cacheFault || resolve == noErr) { return (i); } err = NATCP_nohost; } DisposPtr((Ptr) tcp); (*tcpstate)->tcpbufs[i] = NULL; (*callback)(context, -1, err, resolve, NULL); return (-1); } /* open a connection to a tcp window */ na_tcp NATCPwinopen(natcp_win *w, char *host, long port, short flags) { return (NATCPopen(winreadp, (void *) RecoverHandle((Ptr) w), host, port, flags)); } /* pass a buffer to tcp connection for writing * dispose of -1 = copy data */ short NATCPwrite(na_tcp i, Ptr data, long len, short dispose) { tcpinfo *tcp = (*tcpstate)->tcpbufs[i]; rdsEntry *rds = NULL; tcpwb *wb; long totallen = 0; int j; if (tcp == NULL || tcp->lclose > 0 || tcp->rclose == 3) { return (NATCP_nocon); } wb = tcp->wb + tcp->wbnum; if (wb->rused == RDS) wb = tcp->wb + (1 - tcp->wbnum); if (wb->rused == -1 || wb->rused == RDS) return (NATCP_notcpbuf); for (j = 0; j < wb->rused; ++j) { totallen += wb->rds[j].length; } if (totallen + len >= 65535) return (NATCP_notcpbuf); rds = wb->rds + wb->rused; rds->length = len; rds->ptr = data; rds[1].length = 0; if (dispose < 0) { if (len < tcp->wbsize - wb->wused) { /* if data short enough, use small internal buffer */ rds->ptr = wb->buf + wb->wused; wb->wused += len; dispose = 0; /* If adjacent to last rds, attach to it */ if (wb->rused && rds[-1].ptr + rds[-1].length == rds->ptr) { --wb->rused; rds[-1].length += len; rds->length = 0; } } else { rds->ptr = NewPtr(len); if (!rds->ptr) return (NATCP_nomem); dispose = 1; } memcpy(rds->ptr, data, len); } wb->fflag[wb->rused++] = dispose; if (tcp->push && tcp->state == TCP_READY) { (void) beginwrite(tcp); } return (NATCP_data); } /* put a character on the TCP connection -- optimized for fast turnaround */ short NATCPputchar(na_tcp i, char c) { (*tcpstate)->tcpbufs[i]->push = 1; return (NATCPwrite(i, (Ptr) &c, 1, -1)); } /* close a TCP connection */ void NATCPclose(na_tcp i) { tcpinfo *tcp = (*tcpstate)->tcpbufs[i]; if (tcp && tcp->lclose < 1) tcp->lclose = 1; } /* dispose of all TCP system resources */ void NATCPdone(long waiticks) { struct tcpstate *ts; if (tcpstate) { ts = (struct tcpstate *) NAlockWindow((na_win **) tcpstate); ts->waiticks = waiticks; NAcloseWindow((na_win *) ts, NA_REQCLOSE); } } mpack-1.6/macproj.hqx0000444005347200000120000006230605720743042010317 (This file must be converted with BinHex 4.0) :#Qe`B@0V,R"bEfS!8&*25NY"5%`!!!!!!!!!!%R&G5N!!!!!!3!!!%FX!!"',!! !!TP&!%j"Ad*&5%P14!"139p)390$6dj88Np-8`"139p)33TYF'&MDbj`FQpU!!) !!!"38Np+5d&)6!%!!,3!!!!!!!"38Np+5d&)6!%!!,3!!!!!!!!!!!!!!!!!!!! !!!!!!+EmFFB!!!!!!!"*a84"9%%!6N&I8de"8P4659T&!%j"Ae*&3d919%95!%j "AdC28N0&8dPD43"139p539G,49N!6N&I5%P-594&3e456&-!6N&849p'6%&(8`" 139p98d95AdC-38Fa!%j"Ae9649*I4Na"4c)!6N&I990&8Pp'6%&(-`"139p98d9 5AdB!!!2`!!!!!!!!!!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)!24 X+!#!rrm!!"hX!24Vm!#!rrm!!%B!!24Vi!!#rrm!!"2'!24VA!!$rrm!!"2+!24 V9!!%rrm!!"21!24V6!!&rrm!!"25!24V4!!#rrm!!"2@!24VC!!$rrm!!"2D!24 V5!!%rrm!!"2H!24V@!!&rrm!!"2L!24V8!!!rrm!!%BD!24X!!#!rrm!!!3'!24 Ve!#!rrm!!"51!24V-!9YDf&SE!dJ,QmJ3fpZGQ9bG'9b"e4)58j,)%-*9%K*6NX J8Q9k!6X+6A"KBfXJBfpNC3P-D@*bBA*TCA-,98N[EQPQG(PKF(!06QPQG(PKF(! J5@jTG&q!: mpack-1.6/README.unix0000644005347200000120000002117407707056222010010 mpack/munpack version 1.6 for unix Mpack and munpack are utilities for encoding and decoding (respectively) binary files in MIME (Multipurpose Internet Mail Extensions) format mail messages. For compatibility with older forms of transferring binary files, the munpack program can also decode messages in split-uuencoded format. The Macintosh version can also decode messages in split-BinHex format. The canonical FTP site for this software is ftp.andrew.cmu.edu:pub/mpack/ Binaries are no longer provided. The pc, os2, amiga and archimedes ports have been removed. The mac version probably doesn't compile anymore, but is still included (MacOS X users can use the unix version...) This MIME implementation is intended to be as simple and portable as possible. For a slightly more sophisticated MIME implementation, see the program MetaMail, available via anonymous FTP to thumper.bellcore.com, in directory pub/nsb Decoding MIME messages: First, you have to compile the munpack program. See the instructions in the section "Compilation" below. If, after reading the instructions, you are still unsure as to how to compile munpack, please try to find someone locally to help you. To decode a MIME message, first save it to a text file. If possible, save it with all headers included. Munpack can decode some MIME files when the headers are missing or incomplete, other files it cannot decode without having the information in the headers. In general, messages which have a statement at the beginning that they are in MIME format can be decoded without the headers. Messages which have been split into multiple parts generally require all headers in order to be reassembled and decoded. Some LAN-based mail systems and some mail providers (including America Online, as of the writing of this document) place the mail headers at the bottom of the message, instead of at the top of the message. If you are having problems decoding a MIME message on such a system, you need to convert the mail back into the standard format by removing the system's nonstandard headers and moving the standard Internet headers to the top of the message (separated from the message body with a blank line). There must be exactly one message per file. Munpack cannot deal with multiple messages in a single file, to decode things correctly it must know when one message ends and the next one begins. To decode a message, run the command: munpack file where "file" is the name of the file containing the message. More than one filename may be specified, munpack will try to decode the message in each file. For more information on ways to run munpack, see the section "Using munpack" below. Reporting bugs: Bugs and comments should be reported to mpack-bugs@andrew.cmu.edu. When reporting bugs or other problems, please include the following information: * The version number of Mpack * The platform (Unix, PC, OS/2, Mac, Amiga, Archimedes) * The EXACT output of any unsuccessful attempts. * If having a problem decoding, the first couple of lines of the input file. Compilation: Mpack uses autoconf and automake on unix. refer to INSTALL for more information Using mpack: Mpack is used to encode a file into one or more MIME format messages. The program is invoked with: mpack [options] -o outputfile file or mpack [options] file address... or mpack [options] -n newsgroups file Where "[options]" is one or more optional switches described below. "-o outputfile" is also described below. "file" is the name of the file to encode, "address..." is one or more e-mail address to mail the resulting messages to and "newsgroups" is a comma-separated list of newsgroups to post the resulting messages to. The possible options are: -s subject Set the Subject header field to Subject. By default, mpack will prompt for the contents of the subject header. -d descriptionfile Include the contents of the file descriptionfile in an introductory section at the beginning of the first generated message. -m maxsize Split the message (if necessary) into partial messages, each not exceeding maxsize characters. The default limit is the value of the SPLITSIZE environment variable, or no limit if the environment variable does not exist. Specifying a maxsize of 0 means there is no limit to the size of the generated message. -c content-type Label the included file as being of MIME type content-type, which must be a subtype of application, audio, image, or video. If this switch is not given, mpack examines the file to determine its type. -o outputfile Write the generated message to the file outputfile. If the message has to be split, the partial messages will instead be written to the files outputfile.01, outputfile.02, etc. The environment variables which control mpack's behavior are: SPLITSIZE Default value of the -m switch. Default "0". TMPDIR Directory to store temporary files. Default "/tmp". Using munpack: Munpack is used to decode one or more messages in MIME or split-uuencoded format and extract the embedded files. The program is invoked with: munpack [options] filename... which reads the messages in the files "filename...". Munpack may also be invoked with just: munpack [options] which reads a message from the standard input. If the message suggests a file name to use for the imbedded part, that name is cleaned of potential problem characters and used for the output file. If the suggested filename includes subdirectories, they will be created as necessary. If the message does not suggest a file name, the names "part1", "part2", etc are used in sequence. If the imbedded part was preceded with textual information, that information is also written to a file. The file is named the same as the imbedded part, with any filename extension replaced with ".desc" The possible options are: -f Forces the overwriting of existing files. If a message suggests a file name of an existing file, the file will be overwritten. Without this flag, munpack appends ".1", ".2", etc to find a nonexistent file. -t Also unpack the text parts of multipart messages to files. By default, text parts that do not have a filename parameter do not get unpacked. -q Be quiet--suppress messages about saving partial messages. -C directory Change the current directory to "directory" before reading any files. This is useful when invoking munpack from a mail or news reader. The environment variables which control munpack's behavior are: TMPDIR Root of directory to store partial messages awaiting reassembly. Default is "/usr/tmp". Partial messages are stored in subdirectories of $TMPDIR/m-prts-$USER/ Acknowledgements: Written by John G. Myers, jgm+@cmu.edu The mac version was written by Christopher J. Newman, chrisn+@cmu.edu Send all bug reports to mpack-bugs@andrew.cmu.edu Thanks to Nathaniel Borenstein for testing early versions of mpack and for making many helpful suggestions. PGP signature: The mpack 1.6 distribution is not pgp signed. Legalese: (C) Copyright 1993,1994 by Carnegie Mellon University All Rights Reserved. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Carnegie Mellon University not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Carnegie Mellon University makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Portions of this software are derived from code written by Bell Communications Research, Inc. (Bellcore) and by RSA Data Security, Inc. and bear similar copyrights and disclaimers of warranty. mpack-1.6/macICTypes.h0000444005347200000120000000655205720743041010314 /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* The canonical Internet Config interface is defined in Pascal. These headers have not been thoroughly tested. If there is a conflict between these headers and the Pascal interfaces, the Pascal should take precedence. */ /* ///////////////////////////////////////////////////////////////////////////////// */ #ifndef __ICTYPES__ #define __ICTYPES__ #ifndef __TYPES__ #include #endif /* ///////////////////////////////////////////////////////////////////////////////// */ #if defined(powerc) || defined (__powerc) #pragma options align=mac68k #endif enum { icPrefNotFoundErr = -666, /* preference not found (duh!) */ icPermErr = -667, /* cannot set preference */ icPrefDataErr = -668, /* problem with preference data */ icInternalErr = -669, /* hmm, this is not good */ icTruncatedErr = -670, /* more data was present than was returned */ icNoMoreWritersErr = -671 /* you cannot begin a write session because someone else is already doing it */ }; enum { ICattr_no_change = 0xFFFFFFFFL, /* supply this to ICSetPref to tell it not to change the attributes */ ICattr_locked_bit = 0, /* bits in the preference attributes */ ICattr_locked_mask = 0x00000001L /* masks for the above */ }; #define ICfiletype 'ICAp' #define ICcreator 'ICAp' #define ICdefault_file_name "\pInternet Preferences" /* default file name, for internal use, overridden by a component resource */ enum { ICdefault_file_name_ID = 1024 /* ID of resource in component file */ }; struct ICDirSpec { /* a record that specifies a folder */ short vRefNum; long dirID; }; typedef struct ICDirSpec ICDirSpec; typedef ICDirSpec ICDirSpecArray[4]; /* an array of the above */ typedef ICDirSpecArray *ICDirSpecArrayPtr; /* a pointer to that array */ typedef long ICAttr; /* type for preference attributes */ typedef long ICError; /* type for error codes */ typedef Ptr ICInstance; /* opaque type for preference reference */ enum { icNoPerm = 0, icReadOnlyPerm = 1, icReadWritePerm = 2 }; typedef unsigned char ICPerm; #if defined(powerc) || defined(__powerc) #pragma options align=reset #endif #endif mpack-1.6/macmpack.h0000444005347200000120000001072305720743041010062 /* macmpack.h -- resources for mac interface to mpack */ /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* (C) Copyright 1993-1995 by Christopher J. Newman * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Christopher J. Newman not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Christopher J. Newman makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #define progDLOG 128 #define decodeDLOG 129 #define warnALRT 131 #define errorALRT 133 #define prefsDLOG 134 #define dstatDLOG 135 #define sendDLOG 136 #define prefsID 128 #define IDnaID 1000 #define mainMBAR 128 #define textWIND 128 #define helpWIND 129 #define helpTEXT 128 #define helpSTYL 128 /* file menu */ #define iEncode 1 #define iDecode 2 #define iInsert 3 #define iClose 4 #define iPrefs 6 #define iQuit 8 /* help menu */ #define iHelp 1 /* progress dialog items */ #define iWorkText 1 #define iProgress 3 /* decode dialog items */ #define iAdd 3 #define iRemove 4 #define iFileList 5 #define iFileScroll 6 /* replace alert */ #define iNewname 1 #define iReplace 2 /* preferences dialog */ #define iHost 3 #define iAuto 6 #define iData 7 #define iSingle 8 #define iDouble 9 #define iTextEncode 10 #define iQuitFinish 11 #define iEmailAddr 12 #define iMailServer 15 #define iSet 16 /* decode status dialog */ #define iStatus 2 #define iStatScroll 3 /* encode/send dialog */ #define iSubj 4 #define iEmail 5 #define iSavefile 6 #define iEmailto 7 #define iLimit 8 #define iPartLimit 9 #define iBar 11 #define iDescEdit 3 /* mpack prefs folder */ extern struct pref_folder { short refnum; FSSpec fspec; unsigned char prefs[257]; } *pfolder; /* mpack preferences */ extern struct mpack_preferences { short encoding; short extract_text; short quit_finished; short reserved[4]; char internet_host[2]; /* C string */ } **mpack_prefs; /* encodings */ #define EN_AUTO 0 #define EN_DATA 1 #define EN_DOUBLE 2 #define EN_SINGLE 3 /* shared routines */ FILE *Macopen(FILE *, Str255, short, long, short, short, SignedByte); void maccleanup(void); void MapTypeCreator(char *, OSType); /* used for chatting */ void statrefresh(void); void stattext(Str255, unsigned char); extern short didchat; /* buffer for copy operations */ #define COPY_BUFSIZE 1024 extern char copy_buf[COPY_BUFSIZE]; /* watch cursor */ extern Cursor watch; mpack-1.6/macnfile.c0000444005347200000120000000736405720743042010067 /* macnfile.c -- standard file operations for nifty application library */ /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* (C) Copyright 1990-1995 by Christopher J. Newman * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Christopher J. Newman not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Christopher J. Newman makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Christopher J. Newman * Message: This is a nifty program. */ #include #include "macnapp.h" /* copy SFReply to StandardFileReply */ static void sftostd(SFReply *rep, StandardFileReply *reply) { long procid = 0; if ((reply->sfGood = rep->good) == true) { reply->sfReplacing = false; reply->sfType = rep->fType; memcpy((void *) reply->sfFile.name, rep->fName, *rep->fName + 1); reply->sfFile.parID = 0; reply->sfFile.vRefNum = rep->vRefNum; GetWDInfo(rep->vRefNum, &reply->sfFile.vRefNum, &reply->sfFile.parID, &procid); } } /* get a file to save */ void NAputFile(Str255 prompt, Str255 initfname, StandardFileReply *reply) { SFReply rep; Point where; if (NAgestaltBits & NA_HASSTDFILE) { StandardPutFile(prompt, initfname, reply); } else { where.h = where.v = 0; SFPutFile(where, prompt, initfname, nil, &rep); sftostd(&rep, reply); } } /* get a file to open */ void NAgetFile(FileFilterProcPtr filter, short numtypes, SFTypeList types, StandardFileReply *reply) { Point p; SFReply rep; if (NAgestaltBits & NA_HASSTDFILE) { StandardGetFile(filter, numtypes, types, reply); } else { p.h = p.v = 0; SFGetFile(p, NULL, (ProcPtr) filter, numtypes, types, 0, &rep); sftostd(&rep, reply); } } mpack-1.6/macnte.c0000444005347200000120000002745005720743042007556 /* macnte.c -- TextEdit Utilities for nifty application library */ /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* (C) Copyright 1990-1995 by Christopher J. Newman * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Christopher J. Newman not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Christopher J. Newman makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Christopher J. Newman * Message: This is a nifty program. */ #include "macnapp.h" #ifndef THINK_C #include #include #include #endif #define DOCWIDTH 2047 #define teinfo ((nate_win *)winp) /* prototypes for private procedures */ static pascal void vscroll(ControlHandle, short); static pascal void hscroll(ControlHandle, short); /* initialize a premade window as a TextEdit window with options */ void NATEinit(na_win *winp, long flags, short docwidth, Ptr data, long len) { Rect rtemp, vtemp; winp->flags = (winp->flags & ~NATE_FLAGS) | flags; if (!docwidth) docwidth = DOCWIDTH; teinfo->docwidth = docwidth; rtemp = winp->pwin->portRect; rtemp.top += teinfo->topoff; vtemp = rtemp; if (!(flags & NATE_NOHSCROLL)) { vtemp.right = vtemp.left + docwidth; } if (!(flags & NATE_READONLY)) { winp->keyp = NATEkeyp; } if (!(flags & NATE_NOMOUSE)) { winp->mousep = NATEmousep; winp->idlep = NATEidlep; } winp->menup = NATEmenup; winp->activep = NATEactivep; winp->updatep = NATEupdatep; winp->ctrlp = NATEctrlp; winp->closep = NATEclosep; winp->cursorRgn = NewRgn(); teinfo->vctrl = teinfo->hctrl = NULL; TEAutoView(true, teinfo->hTE = TENew(&vtemp, &rtemp)); if (len > 0 && data != (Ptr) NULL) { TESetText(data, len, teinfo->hTE); TESetSelect(0, 0, teinfo->hTE); } teinfo->lheight = (*teinfo->hTE)->lineHeight; } /* initialize a new TextEdit window */ short NATEinitp(na_win *winp, long *datap) #ifndef THINK_C #pragma unused (datap) #endif { teinfo->topoff = 0; NATEinit(winp, winp->flags, 0, NULL, 0); return (NA_PROCESSED); } /* set the controls in the TextEdit window correctly */ void NATEsetscroll(na_win *winp, Boolean moved, Rect *hrect, Rect *vrect) { short vmax, vvalue, hmax, hvalue; TEPtr te = *teinfo->hTE; ControlHandle vctrl, hctrl; vmax = te->nLines + (*(*te->hText + te->teLength - 1) == '\015' ? 1 : 0) - (te->viewRect.bottom - te->viewRect.top) / teinfo->lheight; hmax = (short) teinfo->docwidth - (te->viewRect.right - te->viewRect.left); if (vmax < 0) vmax = 0; if (hmax < 0) hmax = 0; vvalue = (te->viewRect.top - te->destRect.top) / teinfo->lheight; hvalue = te->viewRect.left - te->destRect.left; if (!(winp->flags & NATE_NOVSCROLL)) { if (teinfo->vctrl == (ControlHandle) NULL) { teinfo->vctrl = NewControl(winp->pwin, vrect, "\p", true, vvalue, 0, vmax, scrollBarProc, 0); if (winp->pwin != FrontWindow()) HiliteControl(teinfo->vctrl, 255); } else { if (vvalue < 0) vvalue = 0; if (vvalue > vmax) vvalue = vmax; SetCtlMax(vctrl = teinfo->vctrl, vmax); SetCtlValue(vctrl, vvalue); if (moved) { MoveControl(vctrl, vrect->left, vrect->top); SizeControl(vctrl, vrect->right - vrect->left, vrect->bottom - vrect->top); ShowControl(vctrl); } } } if (!(winp->flags & NATE_NOHSCROLL)) { if (teinfo->hctrl == (ControlHandle) NULL) { teinfo->hctrl = NewControl(winp->pwin, hrect, "\p", true, hvalue, 0, hmax, scrollBarProc, 0); if (winp->pwin != FrontWindow()) HiliteControl(teinfo->hctrl, 255); } else { if (hvalue < 0) hvalue = 0; if (hvalue > hmax) hvalue = hmax; SetCtlMax(hctrl = teinfo->hctrl, hmax); SetCtlValue(hctrl, hvalue); if (moved) { MoveControl(hctrl, hrect->left, hrect->top); SizeControl(hctrl, hrect->right - hrect->left, hrect->bottom - hrect->top); ShowControl(hctrl); } } } } /* track procedure for the vertical scroll bar */ static pascal void vscroll(ControlHandle ctrl, short part) { short amount, value, max, lh; na_win *winp; TEHandle hTE; if (part == 0) return; winp = * (na_win**) GetWRefCon((*ctrl)->contrlOwner); hTE = teinfo->hTE; value = ((*hTE)->viewRect.bottom - (*hTE)->viewRect.top) / (lh = teinfo->lheight); switch (part) { case inUpButton: amount = -1; break; case inDownButton: amount = 1; break; case inPageUp: amount = - value; break; case inPageDown: amount = value; break; } if ((amount += (value = GetCtlValue(ctrl))) < 0) amount = 0; if (amount > (max = GetCtlMax(ctrl))) amount = max; SetCtlValue(ctrl, amount); TEScroll(0, (value - amount) * lh, hTE); } /* track procedure for the horizontal scroll bar */ static pascal void hscroll(ControlHandle ctrl, short part) { short amount, value, max; if (part) { TEHandle hTE = (* (nate_win**) GetWRefCon((*ctrl)->contrlOwner))->hTE; value = (*hTE)->viewRect.right - (*hTE)->viewRect.left; switch (part) { case inUpButton: amount = -6; break; case inDownButton: amount = 6; break; case inPageUp: amount = - value; break; case inPageDown: amount = value; break; } if ((amount += (value = GetCtlValue(ctrl))) < 0) amount = 0; if (amount > (max = GetCtlMax(ctrl))) amount = max; SetCtlValue(ctrl, amount); TEScroll(value - amount, 0, hTE); } } /* activate procedure for TextEdit */ short NATEactivep(na_win *winp, Boolean on) { if (on) { TEActivate(teinfo->hTE); } else { TEDeactivate(teinfo->hTE); } return (NA_NOTPROCESSED); } /* Update procedure for textedit window */ short NATEupdatep(na_win *winp, Boolean newsize) { TEHandle hTE = teinfo->hTE; WindowPtr window = winp->pwin; Rect prect, vrect, hrect, drect; prect = window->portRect; prect.top += teinfo->topoff; EraseRect(&prect); hrect = vrect = prect; vrect.top--; hrect.left--; vrect.left = ++vrect.right - 16; hrect.top = ++hrect.bottom - 16; vrect.bottom -= 14; hrect.right -= 14; InsetRect(&prect, 4, 4); prect.right -= 15; if (!(winp->flags & NATE_NOHSCROLL)) prect.bottom -= 15; prect.bottom -= (prect.bottom - prect.top) % teinfo->lheight; if (newsize) { drect = (*hTE)->viewRect = prect; drect.right = drect.left + (short) teinfo->docwidth; (*hTE)->destRect = drect; RectRgn(winp->cursorRgn, &prect); OffsetRgn(winp->cursorRgn, -window->portBits.bounds.left, -window->portBits.bounds.top); TECalText(hTE); TESelView(hTE); if (teinfo->hctrl != (ControlHandle) NULL) HideControl(teinfo->hctrl); if (teinfo->vctrl != (ControlHandle) NULL) HideControl(teinfo->vctrl); } TEUpdate(&prect, hTE); if (newsize) NATEsetscroll(winp, true, &hrect, &vrect); return (NA_NOTPROCESSED); } /* control processing procedure for TextEdit */ short NATEctrlp(na_win *winp, Point p, short part, short mods, ControlHandle ctrl) #ifndef THINK_C #pragma unused (mods) #endif { short value; if (part) { value = GetCtlValue(ctrl); switch (part) { case inThumb: part = TrackControl(ctrl, p, (ProcPtr) NULL); if (part && (value -= GetCtlValue(ctrl))) { TEHandle hTE = teinfo->hTE; if (ctrl == teinfo->vctrl) { TEScroll(0, value * teinfo->lheight, hTE); } else if (ctrl == teinfo->hctrl) { TEScroll(value, 0, hTE); } } break; default: (void) TrackControl(ctrl, p, (ProcPtr) (ctrl == teinfo->vctrl ? vscroll : hscroll)); break; } } return (NA_PROCESSED); } /* idle procedure for TextEdit */ short NATEidlep(na_win *winp) { TEIdle(teinfo->hTE); return (NA_PROCESSED); } /* key press procedure for TextEdit */ short NATEkeyp(na_win *winp, long c, short mods) { short status = NA_NOTPROCESSED; if (!(mods & cmdKey)) { status = NA_PROCESSED; ObscureCursor(); TEKey(c, teinfo->hTE); NATEsetscroll(winp, false, (Rect*) NULL, (Rect*) NULL); } return (status); } /* an edit menu handler for TextEdit */ short NATEmenup(na_win *winp, WORD menuid, WORD itemno) { MenuHandle mh = NAmenuh(mEdit); TEHandle hTE = teinfo->hTE; TEPtr pte; short status = NA_NOTPROCESSED; switch (menuid) { case 0: pte = *hTE; if (pte->selStart != pte->selEnd) { EnableItem(mh, iCopy); if (!(winp->flags & NATE_READONLY)) { EnableItem(mh, iCut); EnableItem(mh, iClear); } } else { DisableItem(mh, iCopy); if (!(winp->flags & NATE_READONLY)) { DisableItem(mh, iCut); DisableItem(mh, iClear); } } EnableItem(mh, iSelAll); if (!(winp->flags & NATE_READONLY)) { EnableItem(mh, iPaste); } break; case mEdit: switch (itemno) { case iCut: TECut(hTE); goto DOSCRAP; case iCopy: TECopy(hTE); DOSCRAP: ZeroScrap(); TEToScrap(); goto EDITDONE; case iPaste: TEFromScrap(); TEPaste(hTE); goto EDITDONE; case iClear: TEDelete(hTE); goto EDITDONE; case iSelAll: TESetSelect(0, 32767, hTE); TESelView(hTE); EDITDONE: status = NA_PROCESSED; NATEsetscroll(winp, false, (Rect*) NULL, (Rect*) NULL); break; } default: DisableItem(mh, iSelAll); break; } return (status); } /* mouse procedure for TextEdit */ short NATEmousep(na_win *winp, Point p, short type, short mods) { TEHandle hTE = teinfo->hTE; if (!PtInRect(p, &(*hTE)->viewRect)) return (NA_NOTPROCESSED); if (type == NA_DOWN1 || type == NA_DOWN2 || type == NA_DOWNN) { TEClick(p, mods & shiftKey ? true : false, hTE); NAmousetime = TickCount(); NAlastmouse++; } return (NA_PROCESSED); } /* close procedure for TextEdit */ short NATEclosep(na_win *winp) { TEDispose(teinfo->hTE); return (NA_CLOSED); } /* append text at the end of a TextEdit window */ void NATEappend(na_win *winp, char *data, long len) { TEHandle hTE = ((nate_win*) winp)->hTE; TESetSelect(32767, 32767, hTE); TEInsert(data, len, hTE); TESelView(hTE); NATEsetscroll(winp, false, (Rect*) NULL, (Rect*) NULL); } mpack-1.6/macrsrc.hqx0000444005347200000120000006203105720743043010312 (This file must be converted with BinHex 4.0) :$fe`B@0V,R"bEfSZFR0bB`"bFh*M8P0&4!!!!!!!!!!!5CI(a3!!!!!"!!!!48J !!%4)!!!%6`!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!$fe`B@0V,R" bEfSZFR0bB`)!!!"bFh*M8P0&4!%!!-J!!(*cFQ058d9%!3!!b!!!!!!!!!!!!!! !!!!!!!!!!!!!T[abb`!!!!!!!%QA!!!!!!!!!!!!!!!!!!!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#*KFb"TFb)JGfPdD'peG#"PH("bCA0c)'pb)'PYF'a TC@3JGf&bFQ&ZG(NZ$3e$39*148G*45"048a-6diJ98j*9N958dP8@5"%590$6%& *69-J38a-)&G"8P*"6P4*49-J9dP85#"548G"8N3J9%mJ9%K*8b"66dC89d&545` J58j$6&9%58j()%&-6#"*69"-589%)&G"8P*"6P4*49-J6dBJ68953dK"6P4"3NP -594C)%&14#"'59414906,#"*6L"16b"&9N919#"65%&-6#"$39*148G*45"048a -6diJ98j*9N958dP8@5"#45"-58%8J4Np5)%&1@5"68%9$58&-,#"*6N4*8N9 $9#"28L"$6dj649&948j858&-)%4"68&(49-J6e)J38jC)%4"68&(49-J9dK"9&0 249C&8L"549096&4*6NFJ4P*265"-6e06)%p')&9645`J4%&835"28L"38Np'594 6,#"A5%985%95)%P1)%&1)%&$9%P26L"24L"$6dj88N&$9#`J6N9(6%P(48j$45" 28L"29%K&8L"86e*858p98b""3e4*6diX)%&5590*6NFJ6e98)%p')%p5)%P1)%0 26Nj&3e4*6diJ9dP85#"85%8J990&)%p5)&"&8NC28Ne"6N0&)%p')&4)59-J8dp '9&G"8N8Z$3e3Eh*dD@pZFb"[CL"dD'Pc)(0[CR4hBA*P)'KKGQ8JG'KP)'C[E'a [GfPZCb"MEh"jFQPRD(3k$3e$Eh"jFQPRD(3JU5!a16N`,6%j168JBRNJ3fKbDA0 dEh"SCA)J5LiJ6Q9hE@&Z$8&XE#"5D@GSG(-J8Q9cCA*fC@3Z$3e3CA*YDA0cD@p Z)(4[)(9cC5`JBfp`H5`JE@pND@Cj,#"NDA0dFQPLGA4P,#"KEQ3JFf9XE#"dD'P c)(0[CR4hBA*P)'&ZC#"TG(-JC'pMG@ePER4KG'P[EL"QEh)JB@jj)("eFR"[Ff8 JDA-JD'9bC@*j)'GbB@jdC@3JGfPdD'peG#"QC@8X)("bEhCTC'9N)(4SBA3JG'K P)'&LEhCP)'0[F(PbD@GSG#"ZEh4TBf8JBA"`C@&b)'PZ)'&XE#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rr!!"!LJ!!!!!!J[rr!!"$%J!!!!!%4QPXC34&C'Pd"8&`F'aP#@0XDA"LEf& bC!j2GfjPFL"bCA0[GA*MC3PABA*Z)%&XFR3*9f&bEL""E(*d"Q4PBfpNC3CNC@0 [C'8%G'9iG!P6G'p`)%&XFR3*8h4[F#""E(*d"&4j3h)+G'9iG#p`E'&TEJPTE@& RC5pRD@B+D@eKCf8[DR"PC`4SC@a`"'e38NB,8(*PCQ9bC@jMCA-,8(*PCQ9bC@j MCA-04'9MEf4P)(0dBA4eF`e%C@0[C'8JFh4KG(9c#@KPE(!JE@9ZG3C&EQ0[C'8 'C@jMEf4P#("bEfGbCA0c#8&LEh9d)%*[H!9KBQpeG!TfD@4PEbpYF'9R#f&eC'P [,f*KFfPM#("bEfGbCA0c"%P%EQ'I``: mpack-1.6/macICAPI.h0000444005347200000120000001375605720743041007625 /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* The canonical Internet Config interface is defined in Pascal. These headers have not been thoroughly tested. If there is a conflict between these headers and the Pascal interfaces, the Pascal should take precedence. */ /* ///////////////////////////////////////////////////////////////////////////////// */ #ifndef __ICAPI__ #define __ICAPI__ #ifndef __TYPES__ #include #endif #ifndef __FILES__ #include #endif #ifndef __ICTYPES__ #include #endif /* ///////////////////////////////////////////////////////////////////////////////// */ #ifdef __cplusplus extern "C" { #endif pascal ICError ICStart(ICInstance *inst, OSType creator); /* call at application initialisation */ pascal ICError ICStop(ICInstance inst); /* call at application termination */ pascal ICError ICFindConfigFile(ICInstance inst, short count, ICDirSpecArrayPtr folders); /* count is the number of ICDirSpecs that are valid in folders */ /* searches the specified folders first, then backs out to preferences folder */ /* don't you worry about how it finds the file (; */ /* you can pass nil to folders if count is 0 */ pascal ICError ICSpecifyConfigFile(ICInstance inst, FSSpec *config); /* for use *only* by Internet Configuration application */ pascal ICError ICGetSeed(ICInstance inst, long *seed); /* returns current seed for prefs file */ /* this seed changes every time a preference is modified */ /* poll this to detect preference changes by other applications */ pascal ICError ICGetPerm(ICInstance inst, ICPerm *perm); /* returns the permissions currently associated with this file */ /* mainly used by overriding components, applications normally */ /* know what permissions they have */ pascal ICError ICBegin(ICInstance inst, ICPerm perm); /* start reading/writing the preferences */ /* must be balanaced by a ICEnd */ /* do not call WaitNextEvent between this pair */ /* specify either icReadOnlyPerm or icReadWritePerm */ /* note that this may open resource files and leave them open until ICEnd */ pascal ICError ICGetPref(ICInstance inst, ConstStr255Param key, ICAttr *attr, Ptr buf, long *size); /* this routine may be called without a ICBegin/ICEnd pair, in which case */ /* it implicitly calls ICBegin(inst, icReadOnlyPerm */ /* given a key string, returns the attributes and the (optionally) the data for a preference */ /* key must not be the empty string */ /* if buf is nil then no data fetched and incoming size is ignored*/ /* size must be non-negative, is size of allocated space for data at buf */ /* attr and size and always set on return */ /* size is actual size of data (if key present); */ /* attr is pref attributes */ /* if icTruncatedErr then everything is valid, except you lost some data, size is size of real data*/ /* on other errors, attr is ICattr_no_change and size is 0 */ pascal ICError ICSetPref(ICInstance inst, ConstStr255Param key, ICAttr attr, Ptr buf, long size); /* this routine may be called without a ICBegin/ICEnd pair, in which case */ /* it implicitly calls ICBegin(inst, icReadWritePerm */ /* given a key string, sets the attributes and the data for a preference (either is optional); */ /* key must not be the empty string */ /* if buf is nil then no data stored and size is ignored, used for setting attr */ /* size must be non-negative, is size of the data at buf to store */ /* icPermErr if ICBegin was given icReadOnlyPerm */ /* icPermErr if current attr is locked, new attr is locked and buf <> nil */ pascal ICError ICCountPref(ICInstance inst, long *count); /* count total number of preferences */ /* if error then count is 0 */ pascal ICError ICGetIndPref(ICInstance inst, long n, Str255 key); /* return the key of the Nth preference */ /* n must be positive */ /* icPrefNotFoundErr if n is beyond the last preference */ pascal ICError ICDeletePref(ICInstance inst, ConstStr255Param key); /* delete the preference specified by key */ /* key must not be the empty string */ /* preference specified by key must be present */ /* icPrefNotFoundErr if it isn't */ pascal ICError ICEnd(ICInstance inst); /* stop reading/writing the preferences */ pascal ICError ICDefaultFileName(ICInstance inst, Str63 name); /* return the default file name */ /* the component calls this routine to set up the default internet configuration file name*/ /* this allows this operation to be intercepted by a component that has captured us */ /* it currently gets it from the component resource file */ /* the glue version is hardwired */ pascal ICError ICGetComponentInstance(ICInstance inst, Ptr *component_inst); /* returns noErr and the component instance that we're talking to, if we're using the component */ /* returns an error and nil if we're doing it with glue */ #ifdef __cplusplus } #endif __cplusplus #endif mpack-1.6/macbhex.c0000444005347200000120000002174605720743041007717 /* macbhex.c -- simple binhex decoding routine */ /* (C) Copyright 1993,1994 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include #include #include #include "part.h" #include "macnapp.h" #include "macmpack.h" /* from macos.c: */ extern void renameDescFile(char *, short, long); char binhex_decode[256] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, 13, 14, 15, 16, 17, 18, 19, -1, 20, 21, -1, -1, -1, -1, -1, -1, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1, 37, 38, 39, 40, 41, 42, 43, -1, 44, 45, 46, 47, -1, -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, -1, 55, 56, 57, 58, 59, 60, -1, -1, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; #define BHEXVAL(c) (binhex_decode[(unsigned char) c]) typedef union { unsigned char c[4]; unsigned long val; } longbuf; typedef struct { OSType type, creator; unsigned short flags; long dlen, rlen; } binhex_header; #define STATE_START 0 #define STATE_FNAME 1 #define STATE_HEADER 2 #define STATE_HCRC 3 #define STATE_DFORK 4 #define STATE_DCRC 5 #define STATE_RFORK 6 #define STATE_RCRC 7 #define STATE_DONE 8 #define STATE_ERROR 9 typedef struct binhex_state { short state; /* current state */ short part; /* current part number */ unsigned short CRC; /* cumulative CRC */ unsigned short fileCRC; /* CRC value from file */ longbuf octetbuf; /* buffer for decoded 6-bit values */ short octetin; /* current input position in octetbuf */ short donepos; /* ending position in octetbuf */ short inCRC; /* flag set when reading a CRC */ long count; /* generic counter */ FILE *outfile; /* output file */ short marker; /* flag indicating maker */ unsigned char rlebuf; /* buffer for last run length encoding value */ PCstr namebuf[65]; /* buffer for binhex filename */ binhex_header head; /* buffer for header */ FSSpec fspec; /* output file */ } binhex_state; /* global state */ static binhex_state bh; /* process a binhex character */ static void binhex_process(struct part *inpart) { unsigned short tmpcrc, cval; unsigned char ctmp, c = bh.rlebuf; StandardFileReply reply; FInfo finfo; char buf[256]; /* do CRC */ ctmp = bh.inCRC ? c : 0; cval = bh.CRC & 0xf000; tmpcrc = ((unsigned short) (bh.CRC << 4) | (ctmp >> 4)) ^ (cval | (cval >> 7) | (cval >> 12)); cval = tmpcrc & 0xf000; bh.CRC = ((unsigned short) (tmpcrc << 4) | (ctmp & 0x0f)) ^ (cval | (cval >> 7) | (cval >> 12)); /* handle state */ switch (bh.state) { case STATE_START: bh.state = STATE_FNAME; bh.count = 1; *bh.namebuf = (c & 63); break; case STATE_FNAME: bh.namebuf[bh.count] = c; if (bh.count++ > *bh.namebuf) { bh.state = STATE_HEADER; bh.count = 0; } break; case STATE_HEADER: ((char *)&bh.head)[bh.count] = c; if (++bh.count == 18) { bh.state = STATE_HCRC; bh.inCRC = 1; bh.count = 0; } break; case STATE_DFORK: case STATE_RFORK: putc(c, bh.outfile); if (--bh.count == 0) { fclose(bh.outfile); bh.outfile = NULL; ++bh.state; bh.inCRC = 1; } break; case STATE_HCRC: case STATE_DCRC: case STATE_RCRC: if (!bh.count++) { bh.fileCRC = (unsigned short) c << 8; } else { if ((bh.fileCRC | c) != bh.CRC) { if (bh.state > STATE_HCRC) { HDelete(bh.fspec.vRefNum, bh.fspec.parID, bh.fspec.name); SetCursor(&arrow); yell("BinHex file corrupted in transit"); SetCursor(&watch); } bh.state = STATE_ERROR; break; } bh.CRC = 0; if (++bh.state == STATE_DONE) { finfo.fdType = bh.head.type; finfo.fdCreator = bh.head.creator; finfo.fdFlags = bh.head.flags & 0xf800; HSetFInfo(bh.fspec.vRefNum, bh.fspec.parID, bh.fspec.name, &finfo); PtoCstr(bh.fspec.name); renameDescFile((char *)bh.fspec.name, bh.fspec.vRefNum, bh.fspec.parID); break; } bh.count = bh.head.rlen; if (bh.state == STATE_DFORK) { /* prompt user */ sprintf(buf, "Saving BinHex file %s", C(bh.namebuf)); chat(buf); SetCursor(&arrow); NAputFile("\pSave decoded BinHex file as:", P(bh.namebuf), &reply); SetCursor(&watch); statrefresh(); if (!reply.sfGood) { didchat = -1; bh.state = STATE_ERROR; } else { bh.fspec = reply.sfFile; HCreate(bh.fspec.vRefNum, bh.fspec.parID, bh.fspec.name, bh.head.creator, bh.head.type); bh.count = bh.head.dlen; } } if (bh.count) { bh.inCRC = 0; bh.outfile = Macopen(inpart->infile, bh.fspec.name, bh.fspec.vRefNum, bh.fspec.parID, 1, bh.state == STATE_DFORK ? 0 : 1, fsWrPerm); if (!bh.outfile) { bh.state = STATE_ERROR; HDelete(bh.fspec.vRefNum, bh.fspec.parID, bh.fspec.name); SetCursor(&arrow); yell("Failed to open file for writing"); SetCursor(&watch); } } else { ++bh.state; } } break; } } /* * decode a binhex file * returns -1 on fatal error, 0 for continue, 1 for done */ int os_binhex(struct part *inpart, int part, int nparts) { long val; int c; char *bptr; short octetpos; static char buf[1024]; /* reset state */ if (part == 1) { bh.state = STATE_START; bh.part = 0; bh.CRC = 0; bh.octetbuf.val = 0; bh.octetin = 26; bh.donepos = 3; bh.inCRC = 0; bh.outfile = NULL; bh.marker = 0; } if (++bh.part != part) bh.state = STATE_ERROR; /* do nothing on error/completion */ if (!inpart) { if (bh.state < STATE_DONE) bh.state = STATE_ERROR; } else { /* skip blank lines */ do { if (part_gets(buf, sizeof (buf), inpart) == NULL) return (0); } while (*buf == '\n'); bptr = buf; if (part == 1 && *bptr++ != ':') bh.state = STATE_ERROR; /* line reading loop */ do { /* check line for separator */ if (!strncmp(buf, "--- ", 4)) break; buf[strlen(buf) - 1] = '\0'; /* loop through line of binhex charaters */ while (bh.state < STATE_DONE) { /* fill in octetbuf */ do { if ((val = BHEXVAL(*bptr++)) == -1) { if (bptr[-1]) { --bh.donepos; if (bh.octetin >= 14) --bh.donepos; if (bh.octetin >= 20) --bh.donepos; } break; } bh.octetbuf.val |= val << bh.octetin; } while ((bh.octetin -= 6) > 2); if (!bptr[-1]) break; /* handle decoded characters -- run length encoding (rle) detection */ for (octetpos = 0; octetpos < bh.donepos; ++octetpos) { /* get character & handle rle */ c = bh.octetbuf.c[octetpos]; if (c == 0x90 && !bh.marker++) continue; if (bh.marker) { if (c == 0) { bh.rlebuf = 0x90; binhex_process(inpart); } else { while (--c > 0) { binhex_process(inpart); } } bh.marker = 0; } else { bh.rlebuf = (unsigned char) c; binhex_process(inpart); } if (bh.state >= STATE_DONE) break; } if (bh.donepos < 3 && bh.state < STATE_DONE) bh.state = STATE_ERROR; bh.octetin = 26; bh.octetbuf.val = 0; } } while (bh.state < STATE_DONE && part_gets(bptr = buf, sizeof (buf), inpart) != NULL); } /* error clean up */ if (bh.state == STATE_ERROR && bh.outfile) { fclose(bh.outfile); bh.outfile = NULL; HDelete(bh.fspec.vRefNum, bh.fspec.parID, bh.fspec.name); } return (bh.state == STATE_ERROR ? 1 : 0); } mpack-1.6/macnapp.c0000444005347200000120000011374505720743041007730 /* macnapp.c -- macintosh nifty application library */ /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* (C) Copyright 1990-1995 by Christopher J. Newman * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Christopher J. Newman not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Christopher J. Newman makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Christopher J. Newman * Message: This is a nifty program. */ #ifndef THINK_C #include #include #include #include #include #include #include #include #endif #include #include "macnapp.h" /* export globals */ na_win **NAhead = (na_win**) NULL; /* head of the window tree */ na_win **NAtask = (na_win**) NULL; /* head of the task list */ na_win **NActask = (na_win**) NULL; /* next task to be called */ na_win *NAwin = (na_win*) NULL; /* the current window */ na_menup NAmenup = (na_menup) NULL; /* application menu procedure */ MenuHandle **NAmenus; /* list of menu handles */ short NAnewitem = 0; /* the new item number */ short NAcloseitem = 0; /* the close item number */ short NAappleitems = 0; /* number of user apple menu items */ short NAhelpitems = 0; /* number of user help menu items */ short NAhelpcount = 0; /* number of system help menu items */ Boolean NAhasedit = false; /* true if application supports edit menu */ long NAdelay = 30; /* delay (1/60th of a second) between null events */ SysEnvRec NAsysenv; /* set up by Initialize */ Boolean NAinBack = false; /* true when app is in the background */ short NAlastmouse = NA_RELEASE; /* the last mouse event type */ long NAmousetime = 0; /* the time of the last mouse up */ Point NAmousept; /* the point (local) of last mouse down */ THz NAappzone; /* the application heap zone */ RgnHandle NAfullRgn; /* a region containing everything */ RgnHandle NAnullRgn; /* a region containing nothing */ Cursor NAibeam; /* the Ibeam cursor */ long NAgestaltBits; /* flags for gestalt options */ /* private globals */ static Point mselpoint; /* the menu selection point */ static short aestatus; /* if set, close everything */ /* constants for DoDraw procedure */ #define DO_UPDATE 0x0 #define DO_RESIZE 0x1 #define DO_ACTIVATE 0x2 #define DO_DEACTIVATE 0x4 /* private routines */ static na_win **GetWinH(WindowPtr); static void DoDraw(na_win*, short); static short DoActivate(WindowPtr, na_win*, Boolean, Point p); static short DoMenu(na_win*, BYTE); static void AdjustCursor(na_win*, Point, Boolean); static short aboutmouse(na_win*, Point, short, short); /* get the handle to a window */ static na_win **GetWinH(WindowPtr window) { na_win **winh; /* make positively sure that we have a valid handle */ if (window != (WindowPtr) NULL && !NAisDAWindow(window)) { #ifdef DEBUG if (PtrZone((Ptr) window) == NAappzone && MemError() == noErr) { #endif if ((winh = (na_win **) GetWRefCon(window)) != (na_win**) NULL) { #ifdef DEBUG if (HandleZone((Handle) winh) == NAappzone && MemError() == noErr) { if ((*winh)->pwin == window) { #endif return (winh); #ifdef DEBUG } else { NAdebug("Corrupted window structure found.\015"); NAdebug("handle: %lx, pwin: %lx, window: %lx\015", (long) winh, (long) (*winh)->pwin, (long) window); Debugger(); } } else { NAdebug("Corrupted Handle Zone Found.\015"); NAdebug("handle: %lx, error: %ld\015", (long) winh, (long) MemError()); Debugger(); } #endif } #ifdef DEBUG } else { NAdebug("Corrupted Window Pointer Found.\n"); NAdebug("Pointer: %lx, error: %ld\n", (long) window, (long) MemError()); Debugger(); } #endif } return ((na_win**) NULL); } /* handle drawing controls & growbox for update/activate events */ static void DoDraw(na_win *winp, short how) { WindowPtr window = winp->pwin; long flags = winp->flags; ControlHandle ctrl; Rect tmpRect; RgnHandle tmpRgn; /* hilite or draw controls as appropriate */ if (flags & NA_HASCONTROLS) { if (how & (DO_ACTIVATE | DO_DEACTIVATE)) { if (flags & NA_HILITECTRLS) { for (ctrl = ((WindowPeek) window)->controlList; ctrl; ctrl = (*ctrl)->nextControl) { HiliteControl(ctrl, (how & DO_ACTIVATE) ? 0 : 255); } } } else { DrawControls(window); } } /* draw the grow box properly -- mask out scroll bar outlines */ if (flags & NA_GROWBOX) { tmpRgn = window->clipRgn; tmpRect.left = (tmpRect.right = window->portRect.right) - 15; tmpRect.top = (tmpRect.bottom = window->portRect.bottom) - 15; RectRgn(window->clipRgn = NewRgn(), &tmpRect); DrawGrowIcon(window); DisposeRgn(window->clipRgn); window->clipRgn = tmpRgn; } /* draw the default button on a dialog */ if (flags & NA_DEFBUTTON) NAdefaultButton(window); /* calculate the un-cursor region if the window size changed */ if (how & DO_RESIZE) NAcalcCursor(winp); } /* handle activate event (either activate or MultiFinder suspend/resume) */ static short DoActivate(WindowPtr window, na_win *winp, Boolean activate, Point p) { na_win **winh; short status = NA_NOTPROCESSED; GrafPtr tmpPort; /* unlock current front window */ if (winp != (na_win*) NULL) { NAunlockWindow(winp); NAwin = (na_win*) NULL; } /* check if there is a new window, and lock it */ if (window == (WindowPtr) NULL) return (NA_PROCESSED); /* for app windows, update the cursor, call the activate proc, and DoDraw */ if ((NAwin = winp = NAlockWindow(winh = GetWinH(window))) != (na_win*) NULL) { GetPort(&tmpPort); SetPort(window); if (winp->cursorRgn != (RgnHandle) NULL && ((activate && !NAinBack) || winp->flags & NA_CURSORON)) { LocalToGlobal(&p); AdjustCursor(winp, p, activate); } if (winp->activep == (na_activep) NULL || (status = (*winp->activep)(winp, activate)) == NA_NOTPROCESSED) { DoDraw(winp, activate ? DO_ACTIVATE : DO_DEACTIVATE); } if (!activate || winp->pwin != FrontWindow()) { SetPort(tmpPort); NAunlockWindowh(winh, winp); NAwin = (na_win*) NULL; } } return (status); } /* handle menu selection -- either menu click or menu shortcut */ static short DoMenu(na_win *winp, BYTE key) { WindowPtr window = FrontWindow(); short status = NA_NOTPROCESSED; WORD menuid, itemno; MenuHandle mnu; long menusel; PCstr mItem[256]; /* enable/disable edit menu as appropriate */ if (NAhasedit) { mnu = NAmenuh(mEdit); if (NAisDAWindow(window)) { EnableItem(mnu, iUndo); for (itemno = iCut; itemno <= iClear; itemno++) { EnableItem(mnu, itemno); } } else { DisableItem(mnu, iUndo); for (itemno = iCut; itemno <= iClear; itemno++) { DisableItem(mnu, itemno); } } } /* enable/disable the close menu as appropriate */ if (NAcloseitem) { mnu = NAmenuh(mFile); if (window != (WindowPtr) NULL && (winp == (na_win*) NULL || winp->pwin != window || winp->flags & NA_CLOSEBOX)) { EnableItem(mnu, NAcloseitem); } else { DisableItem(mnu, NAcloseitem); } } /* call menu proc to enable/disable items as appropriate */ if (winp != (na_win*) NULL && winp->menup != (na_menup) NULL) { status = (*winp->menup)(winp, (WORD) 0, (WORD) key); } if (status == NA_NOTPROCESSED && NAmenup != (na_menup) NULL && (winp == (na_win *) NULL || !(winp->flags & NA_MODAL))) { status = (*NAmenup)(winp, (WORD) 0, (WORD) key); } if (status != NA_NOTPROCESSED) return (status); /* get menu selection */ menusel = (key == 0) ? MenuSelect(mselpoint) : MenuKey(key); itemno = LOWORD(menusel); if ((menuid = HIWORD(menusel)) == 0) menuid = 1; /* check for DA menu items */ switch (menuid) { case mApple: /* check for a desk accessary selection */ if (itemno > NAappleitems) { if (itemno - NAappleitems <= NAhelpitems) { itemno -= NAappleitems; menuid = mHelp; } else { GetItem(NAmenuh(mApple), itemno, mItem); OpenDeskAcc(mItem); menuid = 1; } } break; case mFile: /* check for the close menu item for DAs */ if (itemno == NAcloseitem && NAisDAWindow(window)) { CloseDeskAcc(((WindowPeek) window)->windowKind); menuid = 1; } break; case mEdit: /* check for the edit menu for DAs */ if (NAhasedit && itemno <= iClear && SystemEdit(itemno - iUndo)) { menuid = 1; } break; case mHelp: itemno -= NAhelpcount; break; } /* call menu proc to handle/disable items */ if (winp != (na_win*) NULL && winp->menup != (na_menup) NULL) { status = (*winp->menup)(winp, menuid, itemno); } if (status != NA_PROCESSED && NAmenup != (na_menup) NULL) { status = (*NAmenup)(winp, menuid, itemno); } /* if close/about item wasn't processed, process it */ if (status == NA_NOTPROCESSED) { if (menuid == mFile && itemno == NAcloseitem) { status = NA_REQCLOSE; } else if (menuid == mApple && itemno == iAbout) { NAwindow(0, NA_DIALOGWINDOW | NA_USERESOURCE | NA_MODAL, NULL, NA_ABOUTDLOG, (long *) NULL, 0, NAabout); } } /* turn off the menu */ HiliteMenu(0); return (status); } /* set the cursor icon appropriately */ static void AdjustCursor(na_win *winp, Point gmouse, Boolean active) { short status = NA_NOTPROCESSED; /* don't change the cursor when in wrong window */ if (active && FrontWindow() != winp->pwin) return; /* if the cursor is on */ if (winp->flags & NA_CURSORON) { /* and the point moves outside the cursor region or window is deactivated * turn cursor off */ if (!active || PtInRgn(gmouse, winp->uncrsrRgn)) { winp->flags &= ~NA_CURSORON; if (winp->cursorp == (na_cursorp*) NULL) { SetCursor(&QD(arrow)); } else { goto DOCURSORP; } } /* if the cursor is off and the point moves into the window, turn cursor on */ } else if (PtInRgn(gmouse, winp->cursorRgn)) { winp->flags |= NA_CURSORON; if (winp->cursorp == (na_cursorp) NULL) { SetCursor(&NAibeam); } else { DOCURSORP: GlobalToLocal(&gmouse); status = (*winp->cursorp)(winp, gmouse); } } /* if cursor event was processed, reset the un-cursor region */ if (status == NA_PROCESSED) NAcalcCursor(winp); } /* export routines */ /* save the current window position in a resource file */ void NAsaveWin(na_win *winp) { Rect *rptr; WindowPtr window = winp->pwin; Handle wind = GetResource('WIND', winp->resid); HLock(wind); rptr = (Rect *) *wind; rptr->right = (rptr->left = -window->portBits.bounds.left) + window->portRect.right; rptr->bottom = (rptr->top = -window->portBits.bounds.top) + window->portRect.bottom; ChangedResource(wind); HUnlock(wind); } /* calculate the cursor regions for Multi-Finder */ void NAcalcCursor(na_win *winp) { if (winp->cursorRgn != (RgnHandle) NULL) { if (winp->uncrsrRgn == (RgnHandle) NULL) winp->uncrsrRgn = NewRgn(); DiffRgn(NAfullRgn, winp->cursorRgn, winp->uncrsrRgn); } } /* lock a window context */ na_win *NAlockWindow(na_win **winh) { if (winh == (na_win**) NULL) return ((na_win*) NULL); if (!(*winh)->locks++) { MoveHHi((Handle) winh); HLock((Handle) winh); } return (*winh); } /* request or force a window to close */ short NAcloseWindow(na_win *winp, short status) { na_win **winh, ***whp; short childstatus; if (winp == (na_win*) NULL) return (NA_NOTPROCESSED); switch (status) { case NA_REQCLOSE: /* check if window ready to close */ status = NA_CLOSED; if (winp->closep != (na_closep) NULL) status = (*winp->closep)(winp); if (status > NA_CLOSED) break; case NA_CLOSED: /* close children */ childstatus = NAcloseWindows(winp->child, NA_REQCLOSEALL); /* clear current window */ if (winp == NAwin) NAwin = (na_win*) NULL; /* reset the cursor */ if (winp->flags & NA_CURSORON) SetCursor(&QD(arrow)); /* dispose of any cursor regions */ if (winp->cursorRgn != (RgnHandle) NULL) DisposeRgn(winp->cursorRgn); if (winp->uncrsrRgn != (RgnHandle) NULL) DisposeRgn(winp->uncrsrRgn); /* close the window */ if (winp->pwin != (WindowPtr) NULL) { if (winp->flags & NA_DIALOGWINDOW) { DisposDialog((DialogPtr) winp->pwin); } else { DisposeWindow(winp->pwin); } } /* remove from window list */ winh = (na_win**) RecoverHandle((Ptr) winp); whp = &NAhead; if (winp->parent != (na_win**) NULL) whp = &(*winp->parent)->child; while (*whp != (na_win**) NULL) { if (*whp == winh) { *whp = winp->next; } else { whp = &(**whp)->next; } } /* relink children in list */ if (childstatus > NA_ALLCLOSED) { *whp = winp->child; do { (**whp)->parent = winp->parent; whp = &(**whp)->next; } while (*whp != (na_win**) NULL); *whp = winp->next; } /* remove from task list */ whp = &NAtask; while (*whp != (na_win**) NULL && *whp != winh) { whp = &(**whp)->task; } *whp = winp->task; NActask = (na_win**) NULL; /* after-close function */ if (winp->afterp != (na_afterp) NULL) (*winp->afterp)(winp); /* destroy window structure */ DisposHandle((Handle) winh); if (status < NA_CLOSED) { if ((status = NAcloseWindows(NAhead, status)) > NA_CLOSED) { status = NA_CLOSED; } } break; } return (status); } short NAcloseWindows(na_win **winh, short status) { na_win *winp, **lasth; short substatus; while ((winp = NAlockWindow(winh)) != (na_win*) NULL) { lasth = winh; winh = winp->next; substatus = NAcloseWindow(winp, status + 2); if (substatus > NA_CLOSED) { NAunlockWindowh(lasth, winp); return (NA_NOTPROCESSED); } if (substatus < NA_CLOSED) return (substatus); } return (NA_ALLCLOSED); } /* remove the window on a mouse-up event */ static short aboutmouse(na_win *winp, Point mousep, short type, short mods) #ifdef applec #pragma unused (winp, mousep, mods) #endif { return (type & 1 ? NA_REQCLOSE : NA_PROCESSED); } /* a standard about box init procedure */ short NAabout(na_win *winp, long *dptr) #ifdef applec #pragma unused (dptr) #endif { winp->mousep = aboutmouse; return (NA_PROCESSED); } /* flash a button in a dialog box for equivalent keypresses */ void NAflashButton(DialogPtr dialog, short item) { long scratch; short type; Handle ctrl; Rect box; GetDItem(dialog, item, &type, &ctrl, &box); if (type == ctrlItem + btnCtrl) { HiliteControl((ControlHandle) ctrl, 1); Delay(5, &scratch); HiliteControl((ControlHandle) ctrl, 0); } } /* draw the default button */ void NAdefaultButton(DialogPtr dialog) { Rect tmpRect; PenState pnState; NAgetDRect(dialog, iOk, &tmpRect); GetPenState(&pnState); PenNormal(); PenSize(3, 3); InsetRect(&tmpRect, -4, -4); FrameRoundRect(&tmpRect, 16, 16); SetPenState(&pnState); } /* a filter proc which handles Return, Enter, Esc, command-period properly */ pascal Boolean NAfilterProc(DialogPtr dialog, EventRecord *pevent, short *item) { if (pevent->what == autoKey || pevent->what == keyDown) { switch (pevent->message & charCodeMask) { case '\r': case '\n': case 0x03: *item = 1; goto HILITE; case '.': if (!(pevent->modifiers & cmdKey)) break; case '\033': *item = 2; HILITE: NAflashButton(dialog, *item); return (true); } } return (false); } /* send an event message to all windows */ short NAallWindows(na_win **winh, EventRecord *pevent) { na_win *winp, **oldwinh; short status = NA_NOTPROCESSED; while ((winp = NAlockWindow(winh)) != (na_win*) NULL) { oldwinh = winh; winh = winp->next; if (winp->miscp != (na_miscp) NULL) { GrafPtr tempPort; GetPort(&tempPort); SetPort(winp->pwin); status = (*winp->miscp)(winp, pevent); SetPort(tempPort); } if ((status == NA_CLOSED || status == NA_REQCLOSE) && NAcloseWindow(winp, status) == NA_CLOSED) { continue; } NAunlockWindowh(oldwinh, winp); if (status == NA_ALLCLOSED || status == NA_REQCLOSEALL) { if (NAcloseWindows(NAhead, status) == NA_ALLCLOSED) { return (NA_ALLCLOSED); } /* make sure our handle is still valid */ if (GetHandleSize((Handle) oldwinh) == 0) continue; } if ((*oldwinh)->child != (na_win**) NULL && NAallWindows((*oldwinh)->child, pevent) == NA_ALLCLOSED) { return (NA_ALLCLOSED); } } return (NA_PROCESSED); } /* apple event handler */ pascal OSErr NArequiredAE(AppleEvent *, AppleEvent *, long); pascal OSErr NArequiredAE(AppleEvent *event, AppleEvent *reply, long ref) { na_openp openp = (na_openp) ref; OSErr err; DescType actualType, eventID; Size actualSize; AEDescList doclist; long count, i; short gotdoc; FSSpec fspec; AEKeyword keywd; FInfo finfo; err = AEGetAttributePtr(event, keyEventIDAttr, typeType, &actualType, (Ptr) &eventID, sizeof (eventID), &actualSize); if (err == noErr) { gotdoc = 0; if (eventID == kAEOpenDocuments || eventID == kAEPrintDocuments) { err = AEGetParamDesc(event, keyDirectObject, typeAEList, &doclist); if (err == noErr) gotdoc = 1; } if (err == noErr) { err = AEGetAttributePtr(event, keyMissedKeywordAttr, typeWildCard, &actualType, NULL, 0, &actualSize); if (err == errAEDescNotFound) { err = noErr; } else if (err == noErr) { err = errAEEventNotHandled; } } if (err == noErr) switch (eventID) { case kAEOpenApplication: if (NAmenup && NAnewitem) { aestatus = (*NAmenup)(NULL, mFile, NAnewitem); } break; case kAEOpenDocuments: case kAEPrintDocuments: err = AECountItems(&doclist, &count); if (err != noErr) break; for (i = 1; i <= count; ++i) { err = AEGetNthPtr(&doclist, i, typeFSS, &keywd, &actualType, (Ptr) &fspec, sizeof (fspec), &actualSize); if (err != noErr) break; FSpGetFInfo(&fspec, &finfo); if (!openp || (*openp)(eventID == kAEOpenDocuments ? appOpen : appPrint, &fspec, &finfo) <= 0) { err = errAEEventNotHandled; break; } } break; case kAEQuitApplication: aestatus = NA_ALLCLOSED; if (NAhead != NULL) { aestatus = NAcloseWindows(NAhead, NA_REQCLOSEALL); if (aestatus != NA_ALLCLOSED) err = userCanceledErr; } break; } if (gotdoc) { AEDisposeDesc(&doclist); } } return (err); } /* handle Dialog window events */ static Boolean DoDialog(na_win *winp, EventRecord *event, Point mouse, short item, short *status) { DialogPtr dialog = NULL; ControlHandle ctrlh; Boolean result = false; if (*status == NA_NOTPROCESSED && (item || ((result = IsDialogEvent(event)) && DialogSelect(event, &dialog, &item))) && winp && winp->ctrlp) { if (!dialog) dialog = winp->pwin; NAgetDHandle(dialog, item, &ctrlh); *status = (*winp->ctrlp)(winp, mouse, item, event->modifiers, ctrlh); } return (result); } /* call the main loop procedure */ void NAmainloop() { na_win *winp, *wp, **wh; Boolean gotEvent; EventRecord event; Point mouse; Point ptemp; short status; short citem, item; short part; short delay; short mousepix; short fastdelay = 0; long growInfo; long key; WindowPtr window; GrafPtr tempPort; ControlHandle ctrl; RgnHandle rgn; Rect tmpRect, bRect; short prioritycnt; UnloadSeg((Ptr) NAinit); /* unload the initialize routine */ do { /* check for a window in front */ if ((winp = NAwin) == (na_win*) NULL && (window = FrontWindow()) != (WindowPtr) NULL && (NAwin = winp = NAlockWindow(GetWinH(window))) != (na_win *) NULL) { SetPort(window); } /* get an event */ rgn = NAfullRgn; delay = NAdelay; /* if there is an app window in front, use app delay & cursor region */ if (winp != (na_win*) NULL) { delay = winp->delay; if (winp->cursorRgn != (RgnHandle) NULL && !NAinBack) { rgn = winp->cursorRgn; if (!(winp->flags & NA_CURSORON)) rgn = winp->uncrsrRgn; } if (winp->mousepix && !(NAlastmouse & 1)) { rgn = NAnullRgn; delay = 0; } } gotEvent = WaitNextEvent(everyEvent, &event, fastdelay ? 0 : delay, rgn); fastdelay = 0; status = NA_NOTPROCESSED; /* get mouse position */ mouse = event.where; GlobalToLocal(&mouse); item = 0; /* handle the event */ if (gotEvent) switch (event.what) { case mouseUp: /* deal with mouse up events to keep track of double/triple clicks */ if (NAlastmouse & 1) break; ++NAlastmouse; NAmousetime = TickCount(); if (winp == (na_win*) NULL) break; DOMOUSEP: if (winp->mousep != (na_mousep) NULL) { status = (*winp->mousep)(winp, mouse, NAlastmouse, event.modifiers); } break; case mouseDown: part = FindWindow(event.where, &window); /* Rules for clicks when a modal dialog is in front: * 1) let the user command-move other windows * 2) don't let user do anything else with other app windows * 3) if not movable, require click to be in window */ if (winp != (na_win*) NULL && winp->flags & NA_MODAL && !(part == inDrag && event.modifiers & cmdKey) && ((!(winp->flags & NA_TITLEBAR) && !PtInRect(mouse, &winp->pwin->portRect)) || (window != NULL && window != winp->pwin))) { SysBeep(10); status = NA_PROCESSED; break; } switch (part) { case inMenuBar: /* call an appropriate menu bar handler */ mselpoint = event.where; status = DoMenu(winp, 0); break; case inSysWindow: /* System Click in DA */ SystemClick(&event, window); break; case inContent: /* click a window to front if not in front */ if (window != FrontWindow()) { SelectWindow(window); if (winp != (na_win*) NULL) NAunlockWindow(winp); NAwin = (na_win*) NULL; NAlastmouse = NA_RELEASE; break; } /* don't bother processing further if no mouse proc */ if (winp == (na_win*) NULL) break; /* check for control events */ if (winp->ctrlp != (na_ctrlp) NULL && winp->flags & NA_HASCONTROLS) { if ((citem = FindControl(mouse, window, &ctrl)) != 0 && (status = (*winp->ctrlp)(winp, mouse, citem, event.modifiers, ctrl)) != NA_NOTPROCESSED) { break; } } /* deal with double clicks */ if ((NAlastmouse & 1) && NAlastmouse < NA_RELEASE && event.when - NAmousetime <= GetDblTime()) { if (++NAlastmouse > NA_DOWNN) NAlastmouse = NA_DOWNN; } else { NAlastmouse = NA_DOWN1; } NAmousept = mouse; /* call the mouse handler */ goto DOMOUSEP; case inDrag: /* drag the window */ tmpRect = QD(screenBits.bounds); InsetRect(&tmpRect, 4, 4); bRect = window->portBits.bounds; DragWindow(window, event.where, &tmpRect); if ((bRect.left != window->portBits.bounds.left || bRect.top != window->portBits.bounds.top) && (wp = NAlockWindow(wh = GetWinH(window))) != NULL) { if (wp->flags & NA_SMARTSIZE) NAsaveWin(wp); if (wp->cursorRgn != (RgnHandle) NULL) { OffsetRgn(wp->cursorRgn, bRect.left - window->portBits.bounds.left, bRect.top - window->portBits.bounds.top); NAcalcCursor(wp); } NAunlockWindowh(wh, wp); } break; case inGoAway: /* deal with the close window box */ if (TrackGoAway(window, event.where)) status = NA_REQCLOSE; break; case inGrow: /* grow the window */ /* assume there is a valid app window in front */ /* calculate min & max grow dimensions */ tmpRect = QD(screenBits.bounds); tmpRect.bottom -= tmpRect.top; tmpRect.right -= tmpRect.left; tmpRect.top = winp->minh; tmpRect.left = winp->minw; if (winp->maxh) tmpRect.bottom = winp->maxh; if (winp->maxw) tmpRect.right = winp->maxw; /* check for resize proc */ if (winp->resizep != (na_resizep) NULL) { status = (*winp->resizep)(winp, event.where, &tmpRect); if (status == NA_PROCESSED) break; goto RESIZEWINDOW; } /* grow, resize, and update the window */ if ((growInfo = GrowWindow(window, event.where, &tmpRect))) { SizeWindow(window, LOWORD(growInfo), HIWORD(growInfo), false); goto RESIZEWINDOW; } break; case inZoomIn: case inZoomOut: /* assume there is a valid app window in front */ /* track, zoom, and update the window */ if (TrackBox(window, event.where, part)) { SetPort(window); EraseRect(&window->portRect); ZoomWindow(window, part, true); RESIZEWINDOW: if (winp != (na_win*) NULL) { if (winp->flags & NA_SMARTSIZE) NAsaveWin(winp); if (winp->updatep == (na_updatep) NULL || (status = (*winp->updatep)(winp, (Boolean) true)) == NA_NOTPROCESSED) { DoDraw(winp, DO_RESIZE); } } ValidRect(&window->portRect); } break; } break; case keyDown: case autoKey: /* deal with keyboard events */ key = event.message & charCodeMask; /* call the window's key handling procedure */ if (winp != (na_win *) NULL && winp->keyp != (na_keyp) NULL) { status = (*winp->keyp)(winp, winp->flags & NA_RAWKEY ? event.message : key, event.modifiers); } /* translate command-foo to an appropriate menu operation */ if (status == NA_NOTPROCESSED && (event.modifiers & cmdKey) && event.what == keyDown && (status = DoMenu(winp, key)) != NA_NOTPROCESSED) { break; } /* require an app window for further processing */ if (winp == (na_win*) NULL) break; /* if it's an unprocessed event in a dialog window */ if (status == NA_NOTPROCESSED && (winp->flags & NA_DIALOGWINDOW)) { if (!NAfilterProc(winp->pwin, &event, &item) && (event.modifiers & cmdKey)) { status = NA_PROCESSED; } } break; case activateEvt: /* deal with activate windows based on activeFlag */ status = DoActivate((WindowPtr) event.message, winp, event.modifiers & activeFlag, mouse); break; case updateEvt: /* deal with update events with proper port setting, etc. */ window = (WindowPtr) event.message; BeginUpdate(window); if ((wp = NAlockWindow(wh = GetWinH(window))) != (na_win*) NULL) { GetPort(&tempPort); SetPort(window); if (wp->flags & NA_DIALOGWINDOW) { UpdtDialog(window, window->visRgn); } if (wp->updatep == (na_updatep) NULL || (status = (*wp->updatep)(wp, (Boolean) false)) == NA_NOTPROCESSED) { DoDraw(wp, DO_UPDATE); } DoDialog(winp, &event, mouse, 0, &status); SetPort(tempPort); NAunlockWindowh(wh, wp); } EndUpdate(window); if (status == NA_NOTPROCESSED) status = NA_PROCESSED; break; case diskEvt: /* let the user format bad disks */ if (HIWORD(event.message) != noErr) { SetPt(&ptemp, 0x0070, 0x0050); (void) DIBadMount(ptemp, event.message); } else { status = NAallWindows(NAhead, &event); } break; case networkEvt: case driverEvt: case app1Evt: case app2Evt: case app3Evt: /* send event to all windows */ status = NAallWindows(NAhead, &event); break; case osEvt: switch ((event.message >> 24) & 0xff) { case suspendResumeMessage: status = DoActivate(FrontWindow(), winp, !(NAinBack = !(event.message & resumeFlag)), mouse); break; case mouseMovedMessage: /* only interesting if a window is in front */ if (NAinBack || winp == (na_win*) NULL) break; mousepix = winp->mousepix; /* deal with mouse dragging */ if (mousepix && !(NAlastmouse & 1)) { if (NAlastmouse != NA_DRAG) { InsetRect(&tmpRect, -mousepix, -mousepix); if (PtInRect(mouse, &tmpRect)) break; NAlastmouse = NA_DRAG; } goto DOMOUSEP; /* deal with cursor moving in/out of window */ } else if (winp->cursorRgn != (RgnHandle) NULL) { AdjustCursor(winp, event.where, true); } break; } break; case kHighLevelEvent: if (NAgestaltBits & NA_HASAEVENTS) { aestatus = status; (void) AEProcessAppleEvent(&event); status = aestatus; } break; } /* handle dialog events */ DoDialog(winp, &event, mouse, item, &status); /* call the idle procedure of the front window */ if (winp != (na_win*) NULL && !NAinBack && status >= NA_NOTPROCESSED && winp->idlep != (na_idlep) NULL) { status = (*winp->idlep)(winp); } /* deal with window/app close requests and events */ switch (status) { case NA_ALLCLOSED: case NA_REQCLOSEALL: status = NAcloseWindows(NAhead, status); break; case NA_CLOSED: case NA_REQCLOSE: status = NAcloseWindow(winp, status); break; default: /* call the next task procedure */ if (NAtask != (na_win**) NULL) { if (NActask == (na_win**) NULL) { NActask = NAtask; prioritycnt = (*NAtask)->priority; } for (wh = NAtask; wh; wh = (*wh)->task) { if ((wh == NActask || (*wh)->priority == -1) && (wp = NAlockWindow(wh)) != (na_win*) NULL && wp->taskp != (na_taskp) NULL) { GetPort(&tempPort); if (wp->pwin != (WindowPtr) NULL) SetPort(wp->pwin); status = (*wp->taskp)(wp); SetPort(tempPort); if (status == NA_REQCLOSE || status == NA_CLOSED) { status = NAcloseWindow(wp, status); break; } if (status == NA_REQCLOSEALL || status == NA_ALLCLOSED) { status = NAcloseWindows(NAhead, status); break; } if (status == NA_NOTPROCESSED) fastdelay = 1; NAunlockWindowh(wh, wp); } } if (NActask && prioritycnt-- <= 0 && (NActask = (*NActask)->task) != (na_win **) NULL) { prioritycnt = (*NActask)->priority; } } case NA_USERINTERACT: break; } } while (status != NA_ALLCLOSED); while (NAtask != NULL) NAcloseWindow(NAlockWindow(NAtask), NA_REQCLOSE); DisposeRgn(NAfullRgn); DisposeRgn(NAnullRgn); DisposHandle((Handle) NAmenus); } /* position a rectangle based on screen size */ Rect *NAscreenrect(short position) { static short stacktimes = 0; static Rect sb; short topoffset, leftoffset; short width, height; short bw; /* calculate the position to open the window */ sb = QD(screenBits.bounds); InsetRect(&sb, 4, 4); sb.top += MBarHeight; if (position & NA_TITLEOFFSET) { sb.top += 18; } width = sb.right - sb.left; height = sb.bottom - sb.top; if (position & 0x03) { width = (width * (position & 0x03)) >> 2; } if (position & 0x0c) { height = (height * ((position & 0x0c) >> 2)) >> 2; } if (position & NA_TOPSCN) { sb.bottom = sb.top + height; } else if (position & NA_BOTTOMSCN) { sb.top = sb.bottom - height; } else { short bw = (sb.bottom - sb.top - height) >> 1; sb.top += bw; sb.bottom -= bw; } if (position & NA_LEFTSCN) { sb.right = sb.left + width; } else if (position & NA_RIGHTSCN) { sb.left = sb.right - width; } else { bw = (sb.right - sb.left - width) >> 1; sb.left += bw; sb.right -= bw; } return (&sb); } /* create a new window/dialog/task structure */ short NAwindow(Rect *rpos, long flags, char *title, short res, long *initdata, long datasize, na_initp initp) { GrafPtr tmpPort; short procID; short status; Boolean goAwayFlag, visible; na_win **winh, *winp; char *newdata, *dcopy; WindowPtr behind, prev, window; Rect wsize, sb; PCstr wtitle[257]; Handle items; /* save previous window */ prev = FrontWindow(); /* set up flags for the NewWindow call */ goAwayFlag = (flags & NA_CLOSEBOX); visible = (flags & NA_NOTVISIBLE) ? false : true; behind = (flags & NA_BEHIND && NAwin != (na_win*) NULL) ? NAwin->pwin : (WindowPtr) -1; /* decide on the correct procID */ procID = rDocProc; if ((flags & NA_ROUNDBORDER) != NA_ROUNDBORDER) { procID = plainDBox; if (flags & NA_SHADOWBORDER) procID = altDBoxProc; if (flags & NA_DOUBLEBORDER) procID = dBoxProc; if (flags & NA_TITLEBAR) { procID = flags & NA_DOUBLEBORDER ? movableDBoxProc : documentProc; } if (!(flags & NA_GROWBOX) && procID == documentProc) procID |= noGrowDocProc; if (flags & NA_ZOOMBOX) procID |= zoomDocProc; } /* get the window title to a pacsal string */ if (title) CtoPCstrcpy(wtitle, title); /* allocate memory and copy the user data */ if (!datasize) datasize = sizeof (na_win); winh = (na_win**) NewHandleClear((Size) datasize); if (winh == (na_win**) NULL) return (NA_NOTPROCESSED); MoveHHi((Handle) winh); HLock((Handle) winh); winp = *winh; if (initdata != NULL && flags & NA_COPYDATA) { dcopy = (char *) initdata; datasize -= sizeof (na_win); for (newdata = (char*) winp + sizeof (na_win); datasize > 0; datasize--) { *newdata = *dcopy++; newdata++; } } /* initialize winp parameters */ winp->locks = 1; winp->delay = NAdelay; winp->flags = flags; winp->minw = 128; winp->minh = 64; winp->resid = res; /* install in window tree */ if (flags & NA_CHILDWINDOW && NAwin != (na_win*) NULL) { winp->parent = (na_win**) RecoverHandle((Ptr)NAwin); winp->next = NAwin->child; NAwin->child = winh; } else { winp->next = NAhead; NAhead = winh; } /* install in task list */ if (flags & NA_HASTASK) { winp->task = NAtask; NAtask = winh; } /* open the window appropriately */ switch (flags & (NA_COLORWINDOW | NA_DIALOGWINDOW)) { case NA_DIALOGWINDOW: case (NA_DIALOGWINDOW | NA_COLORWINDOW): if (flags & NA_USERESOURCE) { window = (WindowPtr) GetNewDialog(res, (Ptr) NULL, behind); } else { items = GetResource('DITL', res); DetachResource(items); if (flags & NA_COLORWINDOW) { window = (WindowPtr) NewCDialog((Ptr) NULL, rpos, wtitle, visible, procID, behind, goAwayFlag, (long) winh, items); } else { window = (WindowPtr) NewDialog((Ptr) NULL, rpos, wtitle, visible, procID, behind, goAwayFlag, (long) winh, items); } } break; case NA_COLORWINDOW: if (flags & NA_USERESOURCE) { window = (WindowPtr) GetNewCWindow(res, (Ptr) NULL, behind); } else { window = (WindowPtr) NewCWindow((Ptr) NULL, rpos, wtitle, visible, procID, behind, goAwayFlag, (long) winh); } break; default: if (flags & NA_USERESOURCE) { window = GetNewWindow(res, (Ptr) NULL, behind); } else { window = NewWindow((Ptr) NULL, rpos, wtitle, visible, procID, behind, goAwayFlag, (long) winh); } break; } if (title && (flags & NA_USERESOURCE)) SetWTitle(window, wtitle); winp->pwin = window; /* activate the window */ GetPort(&tmpPort); SetPort(window); /* additional options for windows from resources */ if (flags & NA_USERESOURCE) { SetWRefCon(window, (long) winh); /* force the size */ if (flags & NA_FORCESIZE) { MoveWindow(window, rpos->left, rpos->top, false); SizeWindow(window, rpos->right - rpos->left, rpos->bottom - rpos->top, false); } } /* get the screen bounds */ sb = QD(screenBits.bounds); InsetRect(&sb, 4, 4); /* get window position */ wsize = window->portRect; LocalToGlobal((Point *)&wsize.top); /* make sure the window is on the screen */ if (wsize.top > sb.bottom || wsize.left > sb.right) { MoveWindow(window, 60, 60, false); } /* call the init procedure */ if ((status = (*initp)(winp, initdata)) >= NA_NOTPROCESSED) { /* draw the window immediately for better look & update has first newsize */ if (winp->updatep == (na_updatep) NULL || (status = (*winp->updatep)(winp, (Boolean) true)) == NA_NOTPROCESSED) { DoDraw(winp, FrontWindow() != window ? DO_RESIZE | DO_DEACTIVATE : DO_RESIZE); } if (flags & NA_DIALOGWINDOW) DrawDialog(window); ValidRect(&window->portRect); } /* deal with close requests/events result codes */ switch (status) { case NA_ALLCLOSED: case NA_REQCLOSEALL: status = NAcloseWindows(NAhead, status); break; case NA_CLOSED: case NA_REQCLOSE: status = NAcloseWindow(winp, status); break; default: NAunlockWindowh(winh, winp); break; } /* give a nice return value & clean up the port */ if (status == NA_NOTPROCESSED) status = NA_PROCESSED; if (FrontWindow() != window || status != NA_PROCESSED) SetPort(tmpPort); return (status); } /* create & add a new task to the task list */ na_win **NAaddtask(na_taskp taskp, long size) { na_win **task, *winp; if (!size) size = sizeof (na_win); task = (na_win **) NewHandleClear(size); if (task) { (*task)->taskp = taskp; (*task)->task = NAtask; NAtask = task; } return (task); } mpack-1.6/macninit.c0000444005347200000120000002012705720743042010103 /* macninit.c -- general mac nifty application library initialization */ /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* (C) Copyright 1990-1994 by Christopher J. Newman * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Christopher J. Newman not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Christopher J. Newman makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Christopher J. Newman * Message: This is a nifty program. */ #ifndef THINK_C #include #include #include extern void _DataInit(); /* MPW initialize routine */ #endif #include #include #include #include #include #include "macnapp.h" extern pascal OSErr NArequiredAE(AppleEvent *, AppleEvent *, long); #ifndef _Unimplemented #define _Unimplemented 0xA89F #endif #ifndef _WaitNextEvent #define _WaitNextEvent 0xA860 #endif #ifndef _Gestalt #define _Gestalt 0xA1AD #endif /* global to hold the application heap zone */ extern THz NAappzone; static Boolean TrapAvailable(short); /* this checks if a given trap is available on the system */ static Boolean TrapAvailable(short tNumber) { short numtraps = 0x400; TrapType tType; tType = tNumber & 0x800 ? ToolTrap : OSTrap; if (tType == ToolTrap) { if (NGetTrapAddress(_InitGraf, ToolTrap) == NGetTrapAddress(0xAA6E, ToolTrap)) { numtraps = 0x200; } tNumber = tNumber & 0x07FF; if (tNumber >= numtraps) tNumber = _Unimplemented; } return (NGetTrapAddress(tNumber, tType) != NGetTrapAddress(_Unimplemented, ToolTrap)); } /* initialize the Macintosh managers and niftyapp internal variables. * call this first. */ short NAinit(short minK, short masters, na_openp openp, na_menup menup, short nummenu, short numapple, short newitem, short closeitem) { long total, contig, response, procid; EventRecord event; short count; Handle menuBar; short message, i, aeflag = 0; AppFile afile; FSSpec fspec; Str255 str; MenuHandle mh, helpmh; CInfoPBRec catinfo; #ifndef THINK_C UnloadSeg((Ptr) _DataInit); /* unload MPW init routine */ #endif MaxApplZone(); /* expand heap so code loads at top */ /* initialize all the managers */ InitGraf((Ptr) &QD(thePort)); InitFonts(); InitWindows(); InitMenus(); TEInit(); InitDialogs(NULL); InitCursor(); /* allocate enough master pointers */ for (count = 1; count <= masters; count++) { MoreMasters(); if (MemError() != noErr) return (-1); } /* hack to bring to front in MultiFinder */ for (count = 1; count <= 3; count++) EventAvail(everyEvent, &event); /* get the system environment */ (void) SysEnvirons(1, &NAsysenv); /* verify we have 128K ROMS, WaitNextEvent is available, and we have enough memory */ if (NAsysenv.machineType < 0 || !TrapAvailable(_WaitNextEvent) || (long) GetApplLimit() - (long) ApplicZone() < minK) { return (-1); } /* check for some Gestalt things and set up Apple Event Handler * We assume that the Gestalt compatibility glue is used */ NAgestaltBits = 0; if (Gestalt(gestaltAppleEventsAttr, &response) == noErr) { NAgestaltBits |= NA_HASAEVENTS; if (AEInstallEventHandler(kCoreEventClass, typeWildCard, NArequiredAE, (long) openp, FALSE) == noErr) { aeflag = 1; } } if (Gestalt(gestaltFSAttr, &response) == noErr && (response & gestaltHasFSSpecCalls)) { NAgestaltBits |= NA_HASFSSPEC; } if (Gestalt(gestaltStandardFileAttr, &response) == noErr) { NAgestaltBits |= NA_HASSTDFILE; } /* clean up and check available free memory */ PurgeSpace(&total, &contig); if (total < minK) return (-1); /* store our application heap zone */ NAappzone = ApplicZone(); /* if the user wants automatic menu handling, do it now */ NAmenus = NULL; if (menup != (na_menup) NULL) { NAmenus = (MenuHandle **) NewHandle(sizeof (MenuHandle) * (nummenu + 1)); if (NAmenus == (MenuHandle **) NULL) return (-1); HLock((Handle) NAmenus); for (i = 0; i < nummenu; ++i) { InsertMenu((*NAmenus)[i] = GetMenu(mApple + i), 0); } (*NAmenus)[i] = NULL; HUnlock((Handle) NAmenus); mh = **NAmenus; /* Apple menu */ *str = 0; GetIndString(str, NA_HELPSTR, 1); if (*str) { if (Gestalt(gestaltHelpMgrAttr, &response) != noErr || HMGetHelpMenuHandle(&helpmh) != noErr) { helpmh = mh; } else { NAhelpcount = CountMItems(helpmh); } for (i = 2; *str; ++i) { ++NAhelpitems; AppendMenu(helpmh, str); GetIndString(str, NA_HELPSTR, i); } } AppendMenu(mh, "\p-"); AddResMenu(mh, 'DRVR'); DrawMenuBar(); NAcloseitem = closeitem; NAnewitem = newitem; NAappleitems = numapple; if (nummenu > 2) NAhasedit = true; NAmenup = menup; } /* create full & empty regions */ NAfullRgn = NewRgn(); NAnullRgn = NewRgn(); if (!NAfullRgn || !NAnullRgn) return (-1); SetRectRgn(NAfullRgn, -32767, -32767, 32767, 32767); /* save ibeam cursor */ NAibeam = **GetCursor(iBeamCursor); /* handle startup files (prior to system 7) */ if (!aeflag) { count = 0; if (openp != (na_openp) NULL) { CountAppFiles(&message, &count); if (count) { for (i = 1; i <= count; i++) { GetAppFiles(i, &afile); procid = 0; catinfo.hFileInfo.ioNamePtr = (StringPtr) &afile.fName; catinfo.hFileInfo.ioVRefNum = afile.vRefNum; catinfo.hFileInfo.ioFDirIndex = 0; catinfo.hFileInfo.ioDirID = 0; GetWDInfo(afile.vRefNum, &catinfo.hFileInfo.ioVRefNum, &catinfo.hFileInfo.ioDirID, &procid); if (PBGetCatInfoSync(&catinfo) == noErr) { fspec.vRefNum = catinfo.hFileInfo.ioVRefNum; fspec.parID = catinfo.hFileInfo.ioFlParID; memcpy(fspec.name, afile.fName, *afile.fName + 1); if ((*openp)(message, &fspec, &catinfo.hFileInfo.ioFlFndrInfo) < 0) { break; } } } ClrAppFiles(count); if (message == appPrint && NAcloseWindows(NAhead, NA_REQCLOSEALL) == NA_ALLCLOSED) { return (1); } } } if (newitem && !count && menup != (na_menup) NULL) { (*menup)(NULL, mFile, newitem); } } return (0); } mpack-1.6/macos.c0000444005347200000120000002312407707036712007411 /* macos.c -- operating system dependant mpack code for the Macintosh */ /* (C) Copyright 1993-1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear in * supporting documentation, and that the name of Carnegie Mellon University * not be used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. Carnegie * Mellon University makes no representations about the suitability of * this software for any purpose. It is provided "as is" without * express or implied warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ #include #include #include #include #include "common.h" #include "macnapp.h" #include "macmpack.h" extern char *malloc(), *realloc(); char copy_buf[COPY_BUFSIZE]; char *xmalloc(unsigned size) { char *ret; if (ret = malloc((unsigned) size)) return ret; yell("Not enough memory available."); maccleanup(); exit(1); } char *xrealloc (char *ptr, unsigned size) { char *ret; /* xrealloc (NULL, size) behaves like xmalloc (size), as in ANSI C */ if (ret = !ptr ? malloc ((unsigned) size) : realloc (ptr, (unsigned) size)) return ret; yell("Not enough memory available"); maccleanup(); exit(1); } char *strsave(char *str) { char *p = xmalloc(strlen(str)+1); strcpy(p, str); return p; } /* save output filename buffer */ static char *output_fname = NULL; static short applefile_flag = 0; static FSSpec fspec; /* rename or copy a file to a new location */ static void rename_or_copy(srcfname, dstfname, dstvol, dirid) char *srcfname; PCstr *dstfname; short dstvol; long dirid; { PCstr tstr[257]; short srefnum, drefnum; long count; WDPBRec wdpb; HParamBlockRec hpb; CMovePBRec cpb; wdpb.ioNamePtr = P(tstr); if (PBHGetVol(&wdpb, FALSE) != noErr) return; CtoPCstrcpy(tstr, srcfname); if (HOpen(0, 0, P(tstr), fsRdPerm, &srefnum) != noErr) return; if (GetEOF(srefnum, &count) == noErr && !count) { FSClose(srefnum); return; } if (wdpb.ioWDVRefNum == dstvol) { /* files on same drive -- do a rename/move */ FSClose(srefnum); hpb.fileParam.ioNamePtr = P(tstr); hpb.fileParam.ioVRefNum = 0; hpb.ioParam.ioMisc = (Ptr) P(dstfname); hpb.fileParam.ioDirID = 0; if (PBHRenameSync(&hpb) == noErr && wdpb.ioWDDirID != dirid) { cpb.ioNamePtr = P(dstfname); cpb.ioVRefNum = 0; cpb.ioNewName = NULL; cpb.ioNewDirID = dirid; cpb.ioDirID = 0; PBCatMoveSync(&cpb); } } else { /* files on different drive -- do a copy */ if (HCreate(dstvol, dirid, P(dstfname), _fcreator, _ftype) != noErr) { FSClose(srefnum); return; } if (HOpen(dstvol, dirid, P(dstfname), fsWrPerm, &drefnum) != noErr) { FSClose(srefnum); HDelete(dstvol, dirid, P(dstfname)); return; } count = sizeof (copy_buf); while (FSRead(srefnum, &count, (Ptr) copy_buf) != noErr && count > 0) { FSWrite(drefnum, &count, (Ptr) copy_buf); count = sizeof (copy_buf); } FSClose(srefnum); FSClose(drefnum); } } /* Generate a message-id */ char *os_genid() { char *result; long tick; unsigned long time; tick = TickCount(); result = malloc(64); GetDateTime(&time); HLock((Handle) mpack_prefs); sprintf(result, "%lu.%lu@%s", tick, time, (*mpack_prefs)->internet_host); HUnlock((Handle) mpack_prefs); /* make sure tick count is bumped before we return... */ while (tick == TickCount()); return (result); } /* Create and return directory for a message-id */ char *os_idtodir(id) char *id; { static PCstr buf[257]; PCstr idbuf[257]; char *fname; short uqid; OSErr err; long dirID; Handle h; ResType type = 'IDna'; /* prepare filename */ PtoPCstrcpy(buf, (char *) P(pfolder->prefs)); fname = C(buf) + PCstrlen(buf); /* is there a mapping for the id? */ CtoPCstrcpy(idbuf, id); h = GetNamedResource(type, P(idbuf)); /* no mapping -- create one */ if (!h) { while ((uqid = UniqueID(type)) < 128); h = NewHandle(sizeof (short)); if (h) (**(short **)h) = uqid; AddResource(h, type, uqid, P(idbuf)); if ((err = ResError()) != noErr) { return (NULL); } } else { uqid = ** (short **) h; } /* set directory name & create it */ sprintf(fname, "%d:", uqid); SetPlen(buf); err = DirCreate(pfolder->fspec.vRefNum, 0, P(buf), &dirID); if (err != noErr && err != dupFNErr) { RmveResource(h); DisposHandle(h); h = NULL; } return (h ? C(buf) : NULL); } /* * We are done with the directory returned by os_idtodir() * Remove it */ os_donewithdir(dir) char *dir; { PCstr buf[257]; short uqid; char *fname; Handle h; CtoPCstrcpy(buf, dir); HDelete(0, 0, P(buf)); fname = strrchr(C(buf), ':'); while (fname > C(buf) && *--fname != ':'); if (fname > C(buf)) { uqid = atoi(fname + 1); h = GetResource('IDna', uqid); if (h) { RmveResource(h); DisposHandle(h); } } } /* rename the description file */ void renameDescFile(char *fname, short vRefNum, long dirid) { PCstr tstr[65]; char *p; MapTypeCreator("text/plain", 0); /* save description file */ CtoPCstrcpy(tstr, fname); if (p = strrchr(C(tstr), '.')) *p = '\0'; strcat(C(tstr), ".desc"); SetPlen(tstr); rename_or_copy(TEMPFILENAME, tstr, vRefNum, dirid); (void) remove(TEMPFILENAME); } FILE *os_createnewfile(fname) char *fname; { return fopen(fname, "w"); } /* * Create a new file, with suggested filename "fname". * "fname" may have come from an insecure source, so clean it up first. * It may also be null. * "contentType" is passed in for use by systems that have typed filesystems. * "flags" contains a bit pattern describing attributes of the new file. */ FILE *os_newtypedfile(fname, contentType, flags, contentParams) char *fname; char *contentType; int flags; params *contentParams; { char *p; int applefile; FILE *outfile = 0, *tmpf; StandardFileReply reply; PCstr tstr[257]; if (!fname) fname = ""; /* Translate ':' to underscore */ for (p=fname; *p; p++) { if (*p == ':' || !isprint(*p)) *p = '_'; } /* chop filename to length */ if (strlen(fname) > 31) { fname += strlen(fname) - 31; } /* remove leading periods, to protect from ".SONY" attacks */ while (*fname == '.') ++fname; /* get filename from user */ applefile = !strcmp(contentType, "application/applefile"); if (!applefile || !(flags & FILE_INAPPLEDOUBLE)) { sprintf(C(tstr), "Found file: %s (%s)", fname[0] ? fname : "Untitled", contentType); SetPlen(tstr); stattext(P(tstr), 1); } if (!applefile && (!applefile_flag || !(flags & FILE_INAPPLEDOUBLE))) { SetCursor(&arrow); CtoPstr(fname); NAputFile("\pSave decoded file as:", fname[0] ? (unsigned char *) fname : "\pUntitled", &reply); PtoCstr((unsigned char *) fname); SetCursor(&watch); statrefresh(); if (!reply.sfGood) { didchat = -1; return (NULL); } } /* set the type */ MapTypeCreator(contentType, 0); /* save file */ tmpf = tmpfile(); if (applefile) { outfile = tmpf; tmpf = NULL; } else if ((flags & FILE_INAPPLEDOUBLE) && applefile_flag) { outfile = Macopen(tmpf, fspec.name, fspec.vRefNum, fspec.parID, flags & FILE_BINARY, 0, fsWrPerm); } else { HCreate(reply.sfFile.vRefNum, reply.sfFile.parID, reply.sfFile.name, _fcreator, _ftype); outfile = Macopen(tmpf, reply.sfFile.name, reply.sfFile.vRefNum, reply.sfFile.parID, flags & FILE_BINARY, 0, fsWrPerm); } applefile_flag = applefile; if (tmpf) fclose(tmpf); PtoCstr(reply.sfFile.name); fname = (char *) reply.sfFile.name; if (!outfile) { sprintf(C(tstr), "Couldn't open file %s", fname); warn(C(tstr)); return (0); } if (output_fname) free(output_fname); output_fname = strsave(fname); renameDescFile(fname, reply.sfFile.vRefNum, reply.sfFile.parID); return outfile; } /* * Close a file opened by os_newTypedFile() */ os_closetypedfile(outfile) FILE *outfile; { char buf[128]; if (applefile_flag) { rewind(outfile); if (decode_applefile(outfile, &fspec) < 0) { sprintf(buf, "Failed to decode file %s", output_fname); if (didchat >= 0) warn(buf); applefile_flag = 0; } } /* close file */ fclose(outfile); } /* * Warn user that the MD5 digest of the last file created by os_newtypedfile() * did not match that supplied in the Content-MD5: header. */ os_warnMD5mismatch() { char *warning; warning = xmalloc(strlen(output_fname) + 100); sprintf(warning, "%s was corrupted in transit", output_fname); warn(warning); free(warning); } /* bring up an error dialog for a file error */ void os_perror(char *str) { extern int errno; char *err = strerror(errno), *scan; char msg[256]; short maxflen; maxflen = 255 - (strlen(err) + 2); if (strlen(str) > maxflen) { str += strlen(str) - maxflen; for (scan = str; *scan && *scan++ != ':';); if (*scan) str = scan; } sprintf(msg, "%s: %s", str, err); yell(msg); } mpack-1.6/mkreadme.pl0000755005347200000120000004037107707056124010274 #!/usr/bin/perl $systype = $ARGV[0] || die "usage: $0 systype\n"; if ($ARGV[1]) { $sysname = $ARGV[1]; } else { $sysname = $systype; } open(VERSION, "version.h") || die "can't read version.h: $!\n"; while () { $version = $1 if /^#define MPACK_VERSION "(.*)"\n/; } die "Can't find version number in version.h\n" if !defined($version); $hdr = "mpack/munpack version $version for $sysname\n"; print " " x ((75-length($hdr))/2), $hdr; $dooutput = 1; while () { if (/^=/) { $dooutput = /\W$systype\W/; } elsif (/^!/) { $dooutput = !/\W$systype\W/; } elsif ($dooutput) { s/^\.//; print; } } exit 0; __END__ Mpack and munpack are utilities for encoding and decoding (respectively) binary files in MIME (Multipurpose Internet Mail Extensions) format mail messages. For compatibility with older forms of transferring binary files, the munpack program can also decode messages in split-uuencoded format. The Macintosh version can also decode messages in split-BinHex format. =arc The Archimedes port interworks with Marcel (ANT's RISC OS MIME-compliant MUA) to preserve filetypes, timestamps and access permissions. munpack should correctly unpack any Marcel message. At present, mpack doesn't include the filetype, etc. information. This may be implemented in a future release. ! The canonical FTP site for this software is ftp.andrew.cmu.edu:pub/mpack/ Binaries are no longer provided. The pc, os2, amiga and archimedes ports have been removed. The mac version probably doesn't compile anymore, but is still included (MacOS X users can use the unix version...) This MIME implementation is intended to be as simple and portable as possible. For a slightly more sophisticated MIME implementation, see the program MetaMail, available via anonymous FTP to thumper.bellcore.com, in directory pub/nsb Decoding MIME messages: =unix First, you have to compile the munpack program. See the instructions in the section "Compilation" below. If, after reading the instructions, you are still unsure as to how to compile munpack, please try to find someone locally to help you. ! To decode a MIME message, first save it to a text file. If possible, !mac save it with all headers included. Munpack can decode some MIME files =mac save it with all headers included. Mpack can decode some MIME files ! when the headers are missing or incomplete, other files it cannot decode without having the information in the headers. In general, messages which have a statement at the beginning that they are in MIME format can be decoded without the headers. Messages which have been split into multiple parts generally require all headers in order to be reassembled and decoded. Some LAN-based mail systems and some mail providers (including America Online, as of the writing of this document) place the mail headers at the bottom of the message, instead of at the top of the message. If you are having problems decoding a MIME message on such a system, you need to convert the mail back into the standard format by removing the system's nonstandard headers and moving the standard Internet headers to the top of the message (separated from the message body with a blank line). !mac There must be exactly one message per file. Munpack cannot deal with multiple messages in a single file, to decode things correctly it must know when one message ends and the next one begins. To decode a message, run the command: munpack file where "file" is the name of the file containing the message. More than one filename may be specified, munpack will try to decode the message in each file. For more information on ways to run munpack, see the section "Using munpack" below. =mac There must be exactly one message per file. Mpack cannot deal with multiple messages in a single file, to decode things correctly it must know when one message ends and the next one begins. The Macintosh version of mpack/munpack is a single standalone application. A text file may be decoded either by drag & drop, or by choosing the "Decode Files..." item from the application's File menu. Non-text files may be encoded either by drag & drop, or by choosing the "Encode Files..." item from the application's File menu. The Macintosh version of mpack/munpack supports the new MacMIME standard (RFC 1740). This allows cross-platform transport of Macintosh files to any MIME-capable machine, and also preserves Macintosh specific file attributes between two Macintoshes. Mpack will use MacMIME for any unrecognized Macintosh file, and regular MIME for standard MIME types. For more details and descriptions of the preferences, see the "Help Using Mpack..." menu item in mpack which can be found under the help menu in systems 7 and above, and under the apple menu in older systems. ! Reporting bugs: Bugs and comments should be reported to mpack-bugs@andrew.cmu.edu. When reporting bugs or other problems, please include the following information: * The version number of Mpack * The platform (Unix, PC, OS/2, Mac, Amiga, Archimedes) * The EXACT output of any unsuccessful attempts. * If having a problem decoding, the first couple of lines of the input file. Compilation: =unix Mpack uses autoconf and automake on unix. refer to INSTALL for more information =pc The pc sources have been compiled with Microsoft C version 7.0. The project files "mpack.mak" and "munpack.mak" are for mpack.exe and munpack.exe, respectively. =os2 The os2 sources have been compiled with IBM Cset++ version 2.1. The makefiles "mpack.os2" and "munpack.os2" are for mpack.exe and munpack.exe, respectively. Both makefiles also include statements to compile the sources with EMX 0.9a from Eberhard Mattes. =amiga The amiga sources have been compiled with SAS/C version 6.3. To compile with SAS/C, use the command "smake". =arc The RISC OS sources have been compiled with Acorn C version 4.0 and UnixLib 3.6e (ftp-able from micros.hensa.ac.uk). =mac Mpack was compiled with THINK C 6.0 with the 4-byte int option turned on (and the ANSI-small library compiled with the 4-byte int option) and prototype enforcement turned off. Included with this distribution should be the files "macproj.hqx" which is a BinHex4 version of the THINK C 6.0 project file, and "macrsrc.hqx" which is a BinHex4 version of the resources file. Mpack checks for the existence of "Internet Config", and if it is available, mpack uses it to translate MIME types to and from Macintosh type/creator codes. Included is the file "macICglue.hqx" which is a BinHex4 version of Internet Config's MPW object file library. This needs to be linked with the application. Using mpack: See the "Help Using Mpack..." menu item in the application. !mac Using mpack: Mpack is used to encode a file into one or more MIME format messages. The program is invoked with: mpack [options] -o outputfile file =unix os2 amiga or mpack [options] file address... or mpack [options] -n newsgroups file !mac Where "[options]" is one or more optional switches described below. "-o outputfile" is also described below. "file" is the name of the !mac unix os2 amiga file to encode. =unix os2 amiga file to encode, "address..." is one or more e-mail address to mail the resulting messages to and "newsgroups" is a comma-separated list of newsgroups to post the resulting messages to. =amiga There is extra flexibility in the options and addresses. Use "mpack ?" for a list of options; a second "?" will print more information. AmigaDOS 2.0 or later is required to run mpack. !mac The possible options are: -s subject Set the Subject header field to Subject. By default, mpack will prompt for the contents of the subject header. -d descriptionfile Include the contents of the file descriptionfile in an introductory section at the beginning of the first generated message. -m maxsize Split the message (if necessary) into partial messages, each not exceeding maxsize characters. The default limit is the value of the SPLITSIZE environment variable, or no limit if the environment variable does not exist. Specifying a maxsize of 0 means there is no limit to the size of the generated message. -c content-type Label the included file as being of MIME type content-type, which must be a subtype of application, audio, image, or video. If this switch is not given, mpack examines the file to determine its type. -o outputfile Write the generated message to the file outputfile. If the message has to be split, the partial messages will !mac arc instead be written to the files outputfile.01, outputfile.02, etc. =arc instead be written to the files outputfile/01, outputfile/02, etc. =os2 -f username Specifies the user name to be used for mail or news. If this option is ommitted, the environment variable LOGNAME will be used to determine the user name. !mac The environment variables which control mpack's behavior are: SPLITSIZE Default value of the -m switch. Default "0". =unix TMPDIR Directory to store temporary files. Default "/tmp". =pc os2 amiga HOSTNAME Fully qualified domain name to use in generated message-ids. Default "random-pc" or "random-amiga". =arc HOSTNAME Fully qualified domain name to use in generated message-ids. Default "random-arc". =os2 amiga DOMAINNAME If $HOSTNAME does not have a '.' in it, this is appended to $HOSTNAME to get the domain to use. Default is "random-domain". =amiga POSTNEWS Command to use to post news. Compatible with Dillon UUCP usage. SENDMAIL Command to use to send mail. Compatible with Dillon UUCP usage. =os2 POSTNEWS Command to use to post news. Compatible with UUPC inews. SENDMAIL Command to use to send mail. Compatible with IBM sendmail. LOGNAME User name for sending mail or posting news. Defaults to "postmaster". !mac Using munpack: Munpack is used to decode one or more messages in MIME or split-uuencoded format and extract the embedded files. The program is invoked with: munpack [options] filename... !mac pc arc which reads the messages in the files "filename...". Munpack may also be invoked with just: =pc arc which reads the messages in the files "filename...". Wildcards are accepted. Munpack may also be invoked with just: !mac munpack [options] which reads a message from the standard input. =amiga Munpack does not accept wildcards. Under AmigaDOS prior to 2.0, only filenames are allowed. Under AmigaDOS 2.0 or later, the options described later are supported, with extra flexibility. Use "munpack ?" for a list of options; a second "?" will print more information. !mac If the message suggests a file name to use for the imbedded part, that name is cleaned of potential problem characters and used for the output file. If the suggested filename includes subdirectories, they will be created as necessary. If the message does not suggest a file name, the names "part1", "part2", etc are used in sequence. If the imbedded part was preceded with textual information, that information is also written to a file. The file is named the same as the imbedded part, with any filename extension replaced with !mac pc os2 arc ".desc" =pc os2 ".dsc" =arc "/dsc" !mac The possible options are: -f Forces the overwriting of existing files. If a message suggests a file name of an existing file, the file will be =unix amiga overwritten. Without this flag, munpack appends ".1", ".2", etc to find a nonexistent file. =pc os2 overwritten. Without this flag, munpack replaces any filename extension with ".1", ".2", etc to find a nonexistent file. =arc overwritten. Without this flag, munpack appends "/1", "/2", etc to find a nonexistent file. !mac -t Also unpack the text parts of multipart messages to files. By default, text parts that do not have a filename parameter do not get unpacked. -q Be quiet--suppress messages about saving partial messages. -C directory Change the current directory to "directory" before reading any files. This is useful when invoking munpack from a mail or news reader. =os2 -e Writes the MIME content type into the extended attribute "MIME-TYPE". This extended attribute can be used by any software that post processes the decoded files. The following is an example program how to read this extended attribute in Rexx: ---------------------------cut here--------------------------------- /* This Rexx program demonstrates how to read the MIME-type * * parameter out of the EA of the decoded file. Note, that the * * options '-e' must be used to write this EA. */ call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' call SysLoadFuncs parse ARG name if SysGetEA(name, "MIME-TYPE", "TYPEINFO") = 0 then parse var typeinfo 4 type else type = "undefined" say "MIME content-type is" type ---------------------------cut here--------------------------------- !mac The environment variables which control munpack's behavior are: =unix TMPDIR Root of directory to store partial messages awaiting reassembly. Default is "/usr/tmp". Partial messages are stored in subdirectories of $TMPDIR/m-prts-$USER/ =pc os2 TMP Root of directory to store partial messages awaiting reassembly. Default is "\tmp". Partial messages are stored in subdirectories of $TMP\parts\ =arc Wimp$ScrapDir Root of directory to store partial messages awaiting reassembly. Default is "/tmp" which UnixLib should do something sensible with. Partial messages are stored in subdirectories of .parts =amiga METAMAIL_P_DIR [amiga version only] Root of directory to store partial messages awaiting reassembly. Default is "t:". Partial messages are stored in subdirectories of METAMAIL_P_DIR. USER, USERNAME Subdirectory of METMAIL_P_DIR where mime parts are stored. USER is checked first, then USERNAME. Default "anonymous". If the shared library netsupport.library is available, it will be used to get the value of the environment variables. This allows them to be set in uulib:config file instead of in the environment. If this library not present, then a warning that the library was not found is printed. You may ignore this warning. ! Acknowledgements: Written by John G. Myers, jgm+@cmu.edu The mac version was written by Christopher J. Newman, chrisn+@cmu.edu Send all bug reports to mpack-bugs@andrew.cmu.edu Thanks to Nathaniel Borenstein for testing early versions of mpack and for making many helpful suggestions. PGP signature: The mpack 1.6 distribution is not pgp signed. Legalese: (C) Copyright 1993,1994 by Carnegie Mellon University All Rights Reserved. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Carnegie Mellon University not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. Carnegie Mellon University makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Portions of this software are derived from code written by Bell Communications Research, Inc. (Bellcore) and by RSA Data Security, Inc. and bear similar copyrights and disclaimers of warranty. mpack-1.6/macICGlue.v0000444005347200000120000000030005720743041010103 ICCStart ICCStop ICStart ICStop ICFindConfigFile ICSpecifyConfigFile ICGetSeed ICBegin ICGetPref ICSetPref ICCountPref ICGetIndPref ICDeletePref ICEnd ICDefaultFileName ICGetComponentInstance mpack-1.6/macfile.c0000444005347200000120000002543205720743041007704 /* macfile.c -- simple applesingle/appledouble encoding/decoding routines */ /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* (C) Copyright 1994-1995 by Christopher J. Newman * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Christopher J. Newman not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Christopher J. Newman makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #include #include #include "macmpack.h" /* for copy_buf & watch */ /* applefile definitions used */ #define APPLESINGLE_MAGIC 0x00051600L #define APPLEDOUBLE_MAGIC 0x00051607L #define VERSION 0x00020000 #define ENT_DFORK 1 #define ENT_RFORK 2 #define ENT_NAME 3 #define ENT_COMMENT 4 #define ENT_DATES 8 #define ENT_FINFO 9 #define CONVERT_TIME 1265437696L /* applefile structures */ typedef struct ap_header { long magic; long version; char fill[16]; short entries; } ap_header; typedef struct ap_entry { unsigned long id; unsigned long offset; unsigned long length; } ap_entry; typedef struct ap_dates { long create, modify, backup, access; } ap_dates; /* default number of entries */ #define NUM_ENTRIES 6 /* Generate an applefile * outfile -- output file * fpb -- hierarchical file parameter block * rfork, dfork -- resource & data forks * returns -1 on failure, 0 on success * * closes dfork & rfork, but not outputfile */ int encode_applefile(FILE *outfile, HFileInfo *fpb, FILE *rfork, FILE *dfork) { ap_header head; ap_entry entries[NUM_ENTRIES]; ap_dates dates; short i, count; long comlen, procID; DateTimeRec cur_time; unsigned long cur_secs; IOParam vinfo; GetVolParmsInfoBuffer vp; DTPBRec dtp; char comment[256]; /* make sure things look OK */ if (!rfork || !outfile) { if (rfork) fclose(rfork); if (dfork) fclose(dfork); if (outfile) fclose(outfile); return (-1); } /* get a file comment, if possible */ procID = 0; GetWDInfo(fpb->ioVRefNum, &fpb->ioVRefNum, &fpb->ioDirID, &procID); memset((void *) &vinfo, '\0', sizeof (vinfo)); vinfo.ioVRefNum = fpb->ioVRefNum; vinfo.ioBuffer = (Ptr) &vp; vinfo.ioReqCount = sizeof (vp); comlen = 0; if (PBHGetVolParmsSync((HParmBlkPtr) &vinfo) == noErr && ((vp.vMAttrib >> bHasDesktopMgr) & 1)) { memset((void *) &dtp, '\0', sizeof (dtp)); dtp.ioVRefNum = fpb->ioVRefNum; if (PBDTGetPath(&dtp) == noErr) { dtp.ioDTBuffer = (Ptr) comment; dtp.ioNamePtr = fpb->ioNamePtr; dtp.ioDirID = fpb->ioFlParID; if (PBDTGetCommentSync(&dtp) == noErr) comlen = dtp.ioDTActCount; } } /* write header */ head.magic = dfork ? APPLESINGLE_MAGIC : APPLEDOUBLE_MAGIC; head.version = VERSION; memset(head.fill, '\0', sizeof (head.fill)); head.entries = NUM_ENTRIES - (dfork ? 0 : 1); fwrite((char *) &head, sizeof (head), 1, outfile); /* write entry descriptors */ entries[0].offset = sizeof (head) + sizeof (ap_entry) * head.entries; entries[0].id = ENT_NAME; entries[0].length = *fpb->ioNamePtr; entries[1].id = ENT_FINFO; entries[1].length = sizeof (FInfo) + sizeof (FXInfo); entries[2].id = ENT_DATES; entries[2].length = sizeof (ap_dates); entries[3].id = ENT_COMMENT; entries[3].length = comlen; entries[4].id = ENT_RFORK; entries[4].length = fpb->ioFlRLgLen; entries[5].id = ENT_DFORK; entries[5].length = fpb->ioFlLgLen; for (i = 1; i < NUM_ENTRIES; ++i) { entries[i].offset = entries[i-1].offset + entries[i-1].length; } fwrite((char *) entries, sizeof (ap_entry), head.entries, outfile); /* write name */ fwrite((char *) fpb->ioNamePtr + 1, *fpb->ioNamePtr, 1, outfile); /* write finder info */ fwrite((char *) &fpb->ioFlFndrInfo, sizeof (FInfo), 1, outfile); fwrite((char *) &fpb->ioFlXFndrInfo, sizeof (FXInfo), 1, outfile); /* write dates */ GetTime(&cur_time); Date2Secs(&cur_time, &cur_secs); dates.create = fpb->ioFlCrDat + CONVERT_TIME; dates.modify = fpb->ioFlMdDat + CONVERT_TIME; dates.backup = fpb->ioFlBkDat + CONVERT_TIME; dates.access = cur_secs + CONVERT_TIME; fwrite((char *) &dates, sizeof (ap_dates), 1, outfile); /* write comment */ if (comlen) fwrite(comment, sizeof (char), comlen, outfile); /* write resource fork */ while ((count = fread(copy_buf, sizeof (char), sizeof (copy_buf), rfork)) > 0) { fwrite(copy_buf, sizeof (char), count, outfile); } fclose(rfork); /* write data fork */ if (dfork) { while ((count = fread(copy_buf, sizeof (char), sizeof (copy_buf), dfork)) > 0) { fwrite(copy_buf, sizeof (char), count, outfile); } fclose(dfork); } return (0); } /* decode an applefile * infile -- input file * fspec -- file spec of saved file * returns -1 on failure, 0 on success */ int decode_applefile(FILE *infile, FSSpec *fspec) { ap_header head; ap_entry entries[NUM_ENTRIES + 1]; ap_dates dates; StandardFileReply reply; int i, j; short refnum; long count; OSErr err; HFileInfo *fpb; CInfoPBRec cipbr; long procID; IOParam vinfo; GetVolParmsInfoBuffer vp; DTPBRec dtp; char comment[256]; /* read & verify header */ fread((char *) &head, sizeof (head), 1, infile); if (head.magic != APPLESINGLE_MAGIC && head.magic != APPLEDOUBLE_MAGIC) { return (-1); } if (head.version != VERSION) { return (-1); } /* read entries */ for (i = j = 0; i < head.entries; ++i) { fread((char *) (entries + j), sizeof (ap_entry), 1, infile); if (j < NUM_ENTRIES) switch (entries[j].id) { case ENT_NAME: case ENT_FINFO: case ENT_DATES: case ENT_COMMENT: case ENT_RFORK: case ENT_DFORK: ++j; break; } } /* read name */ for (i = 0; i < j && entries[i].id != ENT_NAME; ++i); if (i == j) return (-1); fseek(infile, entries[i].offset, SEEK_SET); if (entries[i].length > 63) entries[i].length = 63; *fspec->name = fread((char *) fspec->name + 1, sizeof (char), entries[i].length, infile); SetCursor(&arrow); NAputFile("\pSave decoded file as:", fspec->name, &reply); SetCursor(&watch); statrefresh(); if (!reply.sfGood) return (didchat = -1); *fspec = reply.sfFile; /* create & get info for file */ if (reply.sfReplacing) HDelete(fspec->vRefNum, fspec->parID, fspec->name); if (HCreate(fspec->vRefNum, fspec->parID, fspec->name, '????', '????') != noErr) { return (-1); } fpb = (HFileInfo *) &cipbr; fpb->ioVRefNum = fspec->vRefNum; fpb->ioNamePtr = fspec->name; fpb->ioDirID = fspec->parID; fpb->ioFDirIndex = 0; PBGetCatInfoSync(&cipbr); /* get finder info */ for (i = 0; i < j && entries[i].id != ENT_FINFO; ++i); if (i < j) { fseek(infile, entries[i].offset, SEEK_SET); fread((char *) &fpb->ioFlFndrInfo, sizeof (FInfo), 1, infile); fread((char *) &fpb->ioFlXFndrInfo, sizeof (FXInfo), 1, infile); fpb->ioFlFndrInfo.fdFlags &= 0xf800; /* clear flags maintained by finder */ } /* get file date info */ for (i = 0; i < j && entries[i].id != ENT_DATES; ++i); if (i < j) { fseek(infile, entries[i].offset, SEEK_SET); fread((char *) &dates, sizeof (dates), 1, infile); fpb->ioFlCrDat = dates.create - CONVERT_TIME; fpb->ioFlMdDat = dates.modify - CONVERT_TIME; fpb->ioFlBkDat = dates.backup - CONVERT_TIME; } /* update info */ fpb->ioDirID = fpb->ioFlParID; PBSetCatInfoSync(&cipbr); /* get comment & save it */ for (i = 0; i < j && entries[i].id != ENT_COMMENT; ++i); if (i < j && entries[i].length != 0) { memset((void *) &vinfo, '\0', sizeof (vinfo)); vinfo.ioVRefNum = fpb->ioVRefNum; vinfo.ioBuffer = (Ptr) &vp; vinfo.ioReqCount = sizeof (vp); if (PBHGetVolParmsSync((HParmBlkPtr) &vinfo) == noErr && ((vp.vMAttrib >> bHasDesktopMgr) & 1)) { memset((void *) &dtp, '\0', sizeof (dtp)); dtp.ioVRefNum = fpb->ioVRefNum; if (PBDTGetPath(&dtp) == noErr) { if (entries[i].length > 255) entries[i].length = 255; fseek(infile, entries[i].offset, SEEK_SET); fread(comment, entries[i].length, 1, infile); dtp.ioDTBuffer = (Ptr) comment; dtp.ioNamePtr = fpb->ioNamePtr; dtp.ioDirID = fpb->ioDirID; dtp.ioDTReqCount = entries[i].length; if (PBDTSetCommentSync(&dtp) == noErr) { PBDTFlushSync(&dtp); } } } } /* do resource/data forks */ for (i = 0; i < j; ++i) { if (entries[i].id == ENT_RFORK || entries[i].id == ENT_DFORK) { fseek(infile, entries[i].offset, SEEK_SET); if (entries[i].id == ENT_DFORK) { err = HOpen(fspec->vRefNum, fspec->parID, fspec->name, 2, &refnum); } else { err = HOpenRF(fspec->vRefNum, fspec->parID, fspec->name, 2, &refnum); } if (err != noErr) { HDelete(fspec->vRefNum, fspec->parID, fspec->name); return (-1); } while (entries[i].length > sizeof (copy_buf)) { count = fread(copy_buf, sizeof (char), sizeof (copy_buf), infile); entries[i].length -= count; FSWrite(refnum, &count, (Ptr) copy_buf); } count = fread(copy_buf, sizeof (char), entries[i].length, infile); FSWrite(refnum, &count, (Ptr) copy_buf); FSClose(refnum); } } return (0); } mpack-1.6/macnapp.h0000444005347200000120000006253605720743042007737 /* macnapp.h -- general mac application library header */ /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* (C) Copyright 1990-1995 by Christopher J. Newman * All Rights Reserved. * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Christopher J. Newman not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Christopher J. Newman makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Chris Newman * Message: This is a nifty program. */ #ifdef THINK_C #define QD(x) (x) #ifndef NULL #define NULL 0 #endif #else #define QD(x) (qd.x) #include #include #include #include #include #include #include #include #include #include #endif /* dual pascal/C strings */ typedef unsigned char PCstr; #define C(str) ((char*)(str) + 1) #define P(str) ((unsigned char*)(str)) /* various machine types. */ typedef unsigned short WORD; typedef unsigned char BYTE; /* useful macros: */ #define HIWORD(x) ( (WORD) ( (x) >> 16) ) #define LOWORD(x) ( (WORD) (x) ) /* most window/menu procedures return short integers (see defines below) */ typedef short (*na_menup)(struct na_win *, WORD, WORD); typedef short (*na_mousep)(struct na_win *, Point, short, short); typedef short (*na_ctrlp)(struct na_win *, Point, short, short, ControlHandle); typedef short (*na_activep)(struct na_win *, Boolean); typedef short (*na_closep)(struct na_win *); typedef void (*na_afterp)(struct na_win *); typedef short (*na_updatep)(struct na_win *, Boolean); typedef short (*na_keyp)(struct na_win *, long, short); typedef short (*na_cursorp)(struct na_win *, Point); typedef short (*na_miscp)(struct na_win *, EventRecord *); typedef short (*na_idlep)(struct na_win *); typedef short (*na_taskp)(struct na_win *); typedef short (*na_resizep)(struct na_win *, Point, Rect *); typedef short (*na_openp)(short, FSSpec *, FInfo *); typedef short (*na_initp)(struct na_win *, long *); typedef struct na_win { long flags; /* flags indicating various window settings (see below) */ short delay; /* delay between main loop cycles (in ticks) */ short mousepix; /* number of pixels mouse can move until drag starts */ short minw, minh; /* minimum width and height for the window */ short maxw, maxh; /* maximum width and height for the window */ short type; /* current window type (negatives reserved) */ BYTE locks; /* locks on this window structure */ short priority; /* priority if there is a taskp (-1 = everytime) */ RgnHandle cursorRgn; /* cursor region */ RgnHandle uncrsrRgn; /* region cursor isn't in */ WindowPtr pwin; /* window pointer */ struct na_win **next; /* handle to next window in linked list */ struct na_win **task; /* handle to next task in a linked list of active tasks */ struct na_win **child; /* handle to child window list (NULL = no child) */ struct na_win **parent; /* handle to parent window (NULL = toplevel) */ na_menup menup; /* menu proc */ na_mousep mousep; /* mouse proc */ na_ctrlp ctrlp; /* dialog item/control proc */ na_activep activep; /* activate proc */ na_closep closep; /* close proc */ na_afterp afterp; /* after proc */ na_updatep updatep; /* update proc */ na_keyp keyp; /* key proc */ na_cursorp cursorp; /* cursor setting proc */ na_miscp miscp; /* miscellaneous event proc (disk/net/app/driver) */ na_idlep idlep; /* idle proc */ na_taskp taskp; /* task proc */ na_resizep resizep; /* resize proc */ long resid; /* storage for window resource id or user data. */ char *data; /* data pointer for user */ } na_win; typedef struct nate_win { na_win winp; TEHandle hTE; /* textedit handle for auto-textedit routines */ ControlHandle hctrl; /* horizontal scroll bar for textedit */ ControlHandle vctrl; /* vertical scroll bar for textedit */ long docwidth; /* width of the document */ short lheight; /* line height of text */ short topoff; /* offset from top of window to textedit area */ } nate_win; /* procedures types: * * // called for menu events when window is frontmost * // supercedes global menu function unless NA_NOTPROCESSED is returned. * // if menuid is 0, the procedure should enable/disable menus appropriately * // if menuid is 1, the procedure should disable enabled menus appropriately * short menu(winp, menuid, itemno) * WORD menuid; // resource id of the menu * WORD itemno; // item number of the menu item * * // called for mouse down/up/move events in the window * short mouse(winp, p, type, mods) * Point p; // location of mouse action * short type; // type of mouse action (see below) * short mods; // modifier keys * * // called for dialog events in dialog windows * // control events in windows with controls * // In a dialog window with no key procedure, ESC, command-., return, enter are * // mapped to iCancel and iOk. * short control(winp, p, itemHit, mods, ctrlh) * Point p; // point in window local coords * short itemHit; // the item/part code clicked * short mods; // modifier keys * ControlHandle ctrlh; // handle to the control * * // called when window is activated or deactivated * // close return values may be ignored on a deactivate * short activate(winp, on) * Boolean on; // true = activate, false = deactivate * * // called when a window close request has been made (close box/close menu item) * // called when any window function returns NA_REQCLOSE or NA_REQCLOSEALL * // respond with either NA_CLOSED or NA_NOTPROCESSED * short close(winp) * * // called after window closed & removed from lists, but before window object freed * void afterp(winp) * * // called on update events * short update(winp, newsize) * Boolean newsize; // true if r is a new window size * * // called on key/autokey events (menu keys are parsed out first) * short key(winp, c, mods) * long c; // ASCII value of the key (unless NA_RAWKEY option set) * short mods; // modifier keys * * // called when cursor moves into or out of a window * // use winp->flags & NA_CURSORON * // close request return values are ignored. * // return NA_PROCESSED only when the cursorRgn is changed * short cursor(winp, p) * Point p; // point where the cursor is * * // This is called for miscellaneous events (disk/network/driver/app1-3) * short miscp(winp, pevent) * EventRecord *pevent; // the event * * // called every time through the event loop when window active * short idle(winp) * * // called cyclicly with other tasks with each pass through event loop * // only used when task is installed * // the task procedure can only close it's own window. * short task(winp) * * // function called to resize the window * // (parameters similar to GrowWindow function) * short resize(winp, where, rct) * Point where; * Rect *rct; * * // function passed to NAinit: * // should return 0 if OK, and -1 to stop opening files * short open(message, afile, fspec) * short message; // either appOpen or appPrint (in SegLoad.h) * FSSpec *fspec; // file to open/print * Finfo *finfo; // finder info * * // function passed to NAwindow: * // returns standard window status * short init(winp, datap) * na_win *winp; // pointer to new window structure * long *datap; // pointer to data passed through NAwindow */ /* niftyapp globals */ extern na_win **NAhead; /* handle to the head of the window tree */ extern na_win **NAtask; /* handle to the head of the window task list */ extern na_win **NActask; /* handle to the current task */ extern na_win *NAwin; /* pointer to current window (NULL = no current window) */ extern na_menup NAmenup; /* pointer to default menu procedure */ extern MenuHandle **NAmenus; /* list of menu handles */ extern short NAnewitem; /* item number of the new item on the file menu (0 = not avail) */ extern short NAcloseitem; /* item number of the close item on the file menu (0 = not avail) */ extern short NAappleitems; /* the number of (user) items at the top of the apple menu */ extern short NAhelpitems; /* the number of (user) help items */ extern short NAhelpcount; /* the number of (system) items at the top of the help menu */ extern Boolean NAhasedit; /* true if application has an edit menu */ extern long NAdelay; /* the wait next event delay */ extern SysEnvRec NAsysenv; /* mac system environment */ extern Boolean NAinBack; /* true if application is backgrounded */ extern long NAmousetime; /* time of last mouse up event */ extern short NAlastmouse; /* kind of last mouse event */ extern Cursor NAibeam; /* the ibeam cursor */ extern long NAgestaltBits; /* 0 = gestalt not on system */ /* globals for your convenience */ extern RgnHandle NAfullRgn, NAnullRgn; /* niftyapp definitions */ /* default resource id for niftyapp windows */ #define NA_CLIPWINDOW 1000 #define NA_ABOUTDLOG 1000 #define NA_PREFSDLOG 1001 #define NA_HELPSTR 1000 /* default item numbers for OK & cancel */ #define iOk 1 #define iCancel 2 /* default ids for APPLE, FILE, EDIT, and HELP menus */ #define mApple 128 #define mFile 129 #define mEdit 130 #define mHelp ((WORD)-16490) /* default item numbers for about & edit menu */ #define iAbout 1 #define iUndo 1 #define iCut 3 #define iCopy 4 #define iPaste 5 #define iClear 6 #define iSelAll 7 #define iClipboard 9 /* new window positions */ #define NA_HFULLSCN 0x0000 #define NA_HQUARTERSCN 0x0001 #define NA_HHALFSCN 0x0002 #define NA_H3QUARTERSCN 0x0003 #define NA_VFULLSCN 0x0000 #define NA_VQUARTERSCN 0x0004 #define NA_VHALFSCN 0x0008 #define NA_V3QUARTERSCN 0x000C #define NA_CENTERSCN 0x0000 #define NA_TOPSCN 0x0010 #define NA_BOTTOMSCN 0x0020 #define NA_LEFTSCN 0x0040 #define NA_RIGHTSCN 0x0080 #define NA_TITLEOFFSET 0x0100 /* new window flags */ #define NA_PLAINWIN 0x00000000L /* plain window -- no title, simple border */ #define NA_COLORWINDOW 0x00000001L /* allow color in the window */ #define NA_DIALOGWINDOW 0x00000002L /* open as a dialog */ #define NA_TITLEBAR 0x00000004L /* have title bar */ #define NA_GROWBOX 0x00000008L /* have a grow box (enables automatic drawing) */ #define NA_ZOOMBOX 0x00000010L /* have a zoom box */ #define NA_CLOSEBOX 0x00000020L /* have a close box (enables close menu item) */ #define NA_SHADOWBORDER 0x00000040L /* have a shadow border (for dialogs) */ #define NA_DOUBLEBORDER 0x00000080L /* have a double (dialog) border */ #define NA_ROUNDBORDER 0x000000c0L /* have rounded corners and black title bar */ #define NA_CHILDWINDOW 0x00000100L /* open as a child window of current window */ #define NA_NOTVISIBLE 0x00000200L /* do not make window visible on open */ #define NA_BEHIND 0x00000400L /* open window behind current window */ #define NA_HASCONTROLS 0x00000800L /* process/draw/kill controls automatically */ #define NA_HASTASK 0x00001000L /* install window in background task list */ #define NA_USERESOURCE 0x00002000L /* use res parameter as WIND/DLOG/wctb/dctb resource */ #define NA_CURSORON 0x00004000L /* true if application has set the cursor */ #define NA_MODAL 0x00008000L /* set if window/dialog will be modal */ #define NA_DEFBUTTON 0x00010000L /* show default button after init proc */ #define NA_COPYDATA 0x00020000L /* data will by copied by NAwindow */ #define NA_SMARTSIZE 0x00040000L /* window resizes & placements are saved in WIND res */ #define NA_FORCESIZE 0x00080000L /* when a resource is used, re-size the window anyway */ #define NA_RAWKEY 0x00100000L /* if set, key event fields aren't stripped */ #define NA_HILITECTRLS 0x00200000L /* if set, hilite controls on activate/deactive */ #define NATE_FLAGS 0x0f000000L /* flags reserved for NATE */ #define NA_USER_FLAG1 0x10000000L /* flags reserved for users */ #define NA_USER_FLAG2 0x20000000L #define NA_USER_FLAG3 0x40000000L #define NA_USER_FLAG4 0x80000000L /* niftyapp window/task types */ #define NA_CLIPTYPE -1 #define NA_DEBUGTYPE -2 #define NA_TCPTYPE -3 #define NA_SMTPTYPE -4 /* mouse click types */ #define NA_DOWN1 0 #define NA_UP1 1 #define NA_DOWN2 2 #define NA_UP2 3 #define NA_DOWNN 4 #define NA_UPN 5 #define NA_DRAG 6 #define NA_RELEASE 7 /* return values for window/menu procedures */ #define NA_ALLCLOSED -4 /* all windows are to be destroyed & exit app immediately */ #define NA_REQCLOSEALL -3 /* request to close all windows & exit app */ #define NA_CLOSED -2 /* current window is ready to close (used by closep/taskp) */ #define NA_REQCLOSE -1 /* request to close current window */ #define NA_NOTPROCESSED 0 /* use any default handler available */ #define NA_PROCESSED 1 /* do nothing more */ #define NA_USERINTERACT 2 /* user interaction pending -- don't do tasks */ /* Gestalt bits */ #define NA_HASAEVENTS 0x00000001L /* Apple events supported */ #define NA_HASFSSPEC 0x00000002L /* FSSpec calls supported */ #define NA_HASSTDFILE 0x00000004L /* New standard file available */ /* niftyapp basic macros */ #define NAunlockWindow(winp) {if (!--(winp)->locks) HUnlock((Handle) GetWRefCon((winp)->pwin));} #define NAunlockWindowh(winh, winp) {if (!--(winp)->locks) HUnlock((Handle) winh);} #define NAisDAWindow(pWnd) (( (WindowPeek) pWnd)->windowKind < 0) #define NAmenuh(menu) ((*NAmenus)[(menu) - mApple]) #define NAenableMItem(menu, item) EnableItem(NAmenuh(menu), item) #define NAdisableMItem(menu, item) DisableItem(NAmenuh(menu), item) #define NAcheckItem(menu, item, c) CheckItem(NAmenuh(menu), item, c) #define NAgetDHandle(dlg, it, hn) {short ty; Rect r; GetDItem(dlg, it, &ty, (Handle *) (hn), &r);} #define NAgetDRect(dlg, it, rct) {short ty; Handle hn; GetDItem(dlg, it, &ty, &hn, (rct));} #define NAsetIval(dlg, it, val) {short ty; Rect r; Handle hn; GetDItem(dlg, it, &ty, &hn, &r); SetCtlValue((ControlHandle)hn, (val));} #define NAsetInum(dlg, it, val) NAsetIText(dlg, it, longtoPCstr(val)) #define NAalert(resid) Alert(resid, NAfilterProc) /* niftyapp basic procedures */ /* initialize the Macintosh managers and niftyapp internal variables. * optionally set up a menu bar & menu procedure. * Returns 0 if OK, negative if an error occured, 1 if print files requested & app should quit * short minK; // minimum K needed to execute * short masters; // number of times to call MoreMasters() * na_proc *openp; // open file procedure -- called for each application in the startup list * na_proc *menup; // pointer to a menu procedure (NULL = no menu handling) * short nummenu; // number of menus (starting at mApple == 128) * short numapple; // number of apple menu items * short newitem; // item number of new item (mFile) * short closeitem; // item number of close item (mFile) */ short NAinit(short, short, na_openp, na_menup, short, short, short, short); /* call the main loop procedure */ void NAmainloop(void); /* create a rectangle based on the screen size * short position; // see above */ Rect *NAscreenrect(short); /* create a new window structure * returns window status result, up to the caller to pass on NA_ALLCLOSED * Rect *rpos; // placement rectangle * long flags; // flags determining type of window * char *title; // window title (C string may not be NULL unless NA_USERESOURCE) * short res; // resource number of WIND/DLOG/wctb/dctb/DITL * long *initdata; // window data (may be NULL) * long datasize; // bytes of window data * na_proc *initp; // procedure to initialize the window functions, etc. */ short NAwindow(Rect *, long, char *, short, long *, long, na_initp); /* create & add a new task to the task list, given pointer to task procedure, * and data size */ na_win **NAaddtask(na_taskp, long); /* standard init procedure for an about box -- stops all background tasks, however */ short NAabout(na_win*, long*); /* standard button flash procedure used by shell for keypresses */ void NAflashButton(DialogPtr, short); /* draw the default button */ void NAdefaultButton(DialogPtr); /* filter proc for modal dialogs which handles ESC and command-. */ pascal Boolean NAfilterProc(DialogPtr, EventRecord *, short *); /* re-calculate cursor region information (after changing winp->cursorRgn) */ void NAcalcCursor(na_win*); /* this saves a window's dimensions into a 'WIND' resource with appropriate resid */ void NAsaveWin(na_win*); /* This is available to access window structures other than the current window * best for looking at parent window or child window(s). */ na_win *NAlockWindow(na_win**); /* This is available, but the user should only call it is severe cases */ short NAcloseWindow(na_win*, short); /* this is for closing all windows, the user should only call it from main * usually NAhead is the first parameter. */ short NAcloseWindows(na_win**, short); /* this is for sending an event directly to the misc procedure of all windows. * usually NAhead is the first parameter. */ short NAallWindows(na_win**, EventRecord*); /* niftyapp clipboard library: * NAclipboard: true = window on, false = window off, 'TEXT' or 'PICT' */ void NAclipboard(Boolean, ResType); /* niftyapp debug library: */ void NAdebug(char *, ...); #ifdef DEBUG #define NADEBUG(x) NAdebug x #else #define NADEBUG(x) #endif /* niftyapp dialog library: */ /* select a radio button * returns number from 0 to firstitem - lastitem: the button that's been pressed * DialogPtr dialog; // the dialog window * short firstitem; // the itemno of first radio button * short lastitem; // the itemno of last radio button * short setting; // the radio button to set (itemno to lastitem) */ short NAradioSet(DialogPtr, short, short, short); /* get the itemno of the active radio button * DialogPtr dialog; // the dialog window * short firstitem; // the itemno of first radio button * short lastitem; // the itemno of last radio button */ short NAradioGet(DialogPtr, short, short); /* enable/disable,hilite,show/hide an item in a dialog window */ void NAenableDItem(DialogPtr, short, Boolean); void NAhiliteDItem(DialogPtr, short, short); void NAvisibleDItem(DialogPtr, short, Boolean); /* set/get the item text in a dialog item */ void NAsetIText(DialogPtr, short, PCstr*); void NAgetIText(DialogPtr, short, PCstr*); /* enable/disable modal menus for a moveable modal dialog box (1 = go modal) */ void NAmodalMenus(int); /* handle edit menu for dialogs */ short NAdialogMenu(na_win *, WORD, WORD); /* NATE (NiftyApp TextEdit) libraries */ #define NATEflags (NA_TITLEBAR | NA_GROWBOX | NA_ZOOMBOX | NA_CLOSEBOX \ | NA_HASCONTROLS | NA_HILITECTRLS) #define NATE_DEFAULT 0x00000000L #define NATE_READONLY 0x01000000L #define NATE_NOMOUSE 0x02000000L #define NATE_NOHSCROLL 0x04000000L #define NATE_NOVSCROLL 0x08000000L void NATEinit(na_win*, long, short, Ptr, long); /* winp, flags, horizwidth, data, len */ short NATEinitp(na_win*, long*); short NATEmousep(na_win*, Point, short, short); short NATEidlep(na_win*); short NATEactivep(na_win*, Boolean); short NATEkeyp(na_win*, long, short); short NATEmenup(na_win*, WORD, WORD); short NATEupdatep(na_win*, Boolean); short NATEctrlp(na_win*, Point, short, short, ControlHandle); short NATEclosep(na_win*); void NATEsetscroll(na_win*, Boolean, Rect*, Rect*); void NATEappend(na_win*, char*, long); /* Niftyapp file library */ /* get a file to open -- similar to StandardGetFile, but works on older systems * extra fields in "StandardFileReply" are only valid if NA_HASSTDFILE is set in * NAgestaltBits */ void NAgetFile(FileFilterProcPtr, short, SFTypeList, StandardFileReply *); /* put a file to open -- similar to StandardPutFile, but works on older systems * extra fields in "StandardFileReply" are only valid if NA_HASSTDFILE is set in * NAgestaltBits */ void NAputFile(Str255, Str255, StandardFileReply *); /* Niftyapp TCP library */ /* tcp stream descriptor */ typedef int na_tcp; /* tcp init function * passed NATCP_connect for success, NATCP_nodriver/NATCP_nomem for failure * passed 1 to 100 for progress waiting for MacTCP to finish cleanly */ typedef void na_tcpinitp(short); /* TCP read/status callback for connection, or TCP window * void *user; Context generic pointer (passed to NATCPopen) * na_tcp s; TCP stream id * short status; TCP status (see below) * long size; size of buffer (or Macintosh error) * char *data; data or NULL */ typedef void na_tcpreadp(void *, na_tcp, short, long, char *); typedef void na_readp(na_win *, short, long, char *); /* TCP window */ typedef struct natcp_win { na_win winp; na_tcp s; na_readp *readp; } natcp_win; /* status values/bits */ #define NATCP_closing 0x08 /* other end of connection closed */ #define NATCP_urgent 0x04 /* in urgent mode */ #define NATCP_more 0x02 /* more data will follow immediately */ #define NATCP_data 0x01 /* data to read */ #define NATCP_connect 0x00 /* connection ready */ #define NATCP_noread -1 /* non-fatal */ #define NATCP_nowrite -2 /* fatal... */ #define NATCP_nodriver -3 #define NATCP_notcpbuf -4 #define NATCP_nomem -5 #define NATCP_nohost -6 #define NATCP_nocon -7 #define NATCP_closed -8 /* connection fully closed */ /* open flags */ #define NATCP_server 0x01 /* be a server */ /* functions */ void NATCPinit(na_tcpinitp *); /* NATCPsettings: TCP buffer size, type of service, precedence, write buffer size */ void NATCPsettings(long, short, short, unsigned short); short NATCPtask(na_win *); /* NATCPopen: callback, context, host, port, flags */ na_tcp NATCPopen(na_tcpreadp *, void *, char *, long, short); na_tcp NATCPwinopen(natcp_win *, char *, long, short); /* tcp window, host, port, flags */ short NATCPwrite(na_tcp, Ptr, long, short); /* tcp, buffer, length, dispose */ short NATCPputchar(na_tcp, char); void NATCPclose(na_tcp); void NATCPdone(long); /* number of 1/60 sec intervals to wait for MacTCP to finish cleanly */ /* returns passes NATCP_connect to readp on success with hostname as argument */ void NATCPgethost(na_tcpreadp *, void *); /* niftyapp SMTP library */ /* status: * void *context; user context * short code; see below * short err; SMTP error code or NATCP error code (NASMTP_tcpfail) or 0 * long num; macintosh TCP error code or address number or 0 * char *errstr; SMTP error string or NULL */ typedef void (*na_smtpstat)(void *, short, short, long, char *); #define NASMTP_progress 2 /* progress: err = % done */ #define NASMTP_badaddr 1 /* address was not valid */ #define NASMTP_completed 0 /* success */ #define NASMTP_nomem -1 /* not enough memory */ #define NASMTP_badargs -2 /* input arguments invalid */ #define NASMTP_oserr -3 /* OS failure (e.g. file error) */ #define NASMTP_tcpfail -4 /* TCP connection to SMTP server failed */ #define NASMTP_conclosed -5 /* connection closed by other side before completion */ #define NASMTP_badprot -6 /* other end sent unrecognizable protocol */ #define NASMTP_temperr -7 /* SMTP persistant temporary failure */ #define NASMTP_permerr -8 /* SMTP permanent failure */ /* Submit email: statf, server, fspec, headers, envelope, flags, context */ void NASMTPsubmit(na_smtpstat, char *, FSSpec *, Handle, Handle, short, void *); #define NASMTP_crtrans 0x01 /* flag indicating translation of CR -> CRLF desired */ /* PC, C string libraries: */ #define SetClen(pcstr) (*((pcstr) + *(pcstr) + 1) = '\0') #define PCstrlen(pcstr) (*(pcstr)) #define Pstrlen(pstr) (* (unsigned char *) (pstr)) void PtoPCstrcpy(PCstr*, char*); void CtoPCstrcpy(PCstr*, char*); void PCtoPCstrcpy(PCstr*, PCstr*); void PtoPCstrncpy(PCstr*, char*, short); void CtoPCstrncpy(PCstr*, char*, short); void PtoPCstrcat(PCstr*, char*); void CtoPCstrcat(PCstr*, char*); PCstr *PtoPCstr(char*); PCstr *CtoPCstr(char*); void SetPlen(PCstr*); PCstr *longtoPCstr(long); mpack-1.6/macnsmtp.c0000444005347200000120000003004505720743042010123 /* macnsmtp.c -- simple async SMTP client */ /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* (C) Copyright 1994-1995 by Christopher J. Newman * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Christopher J. Newman not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Christopher J. Newman makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Christopher J. Newman * Message: This is a nifty program. */ #include "macnapp.h" #define SMTP_PORT 25 typedef struct { na_win w; void *context; /* user context */ short num, rcpt; /* recipient count (num), and sent (rcpt) */ na_smtpstat statf; /* callback */ na_tcp tcpid; /* TCP id */ short state; /* SMTP state (see below) */ short count; /* bytes used in linebuf */ short refnum; /* input file */ short crfound:1; /* found a CR in SMTP server data */ short crlf:1; /* found a CRLF in SMTP server data */ short crtrans:1; /* translate CR to CRLF in file */ long headsize; /* size of extra headers starting at data */ long fsize, fdone; /* file size & amount written */ long bufsize; /* usable buffer size */ Ptr buf; /* output buffer */ char linebuf[1024]; /* input line buffer */ char data[1]; /* header & envelope */ } na_smtpwin; #define sw ((na_smtpwin *) w) /* states: */ #define S_conn 0 /* connecting to server */ #define S_greet 1 /* waiting for greeting */ #define S_hello 2 /* waiting for local host lookup and HELO reply */ #define S_mailf 3 /* waiting for MAIL FROM reply */ #define S_rcpt 4 /* waiting for RCPT TO reply */ #define S_data 5 /* waiting for DATA continue reply */ #define S_send 6 /* transmitting data */ #define S_done 7 /* waiting for DATA success reply */ #define S_quit 8 /* waiting for QUIT reply */ #define S_wait 9 /* waiting for connection close */ #define S_close 10 /* closed */ /* generate and submit SMTP command line (put command & data together with CRLF ending) * returns NATCPwrite result code */ static int SMTPsend(na_win *w, char *com, char *data) { char buf[512]; char *dest = buf; int result = 0; while ((*dest = *com) != '\0') ++dest, ++com; if (data) { while ((*dest = *data++) != '\0') ++dest; if (com[-1] == '<') *dest++ = '>'; } *dest++ = '\r'; *dest++ = '\n'; result = NATCPwrite(sw->tcpid, buf, dest - buf, -1); return (result); } /* do final callback */ static void smtpclose(na_win *w, short code, short err, long size, char *data) { if (sw->state < S_wait) { NATCPclose(sw->tcpid); FSClose(sw->refnum); sw->state = S_wait; (*sw->statf)(sw->context, code, err, size, data); } } /* TCP read/write callback */ static void readp(void *wh, na_tcp s, short status, long size, char *data) { na_win *w, **taskh; char *dest; short major, count, smtpcode; /* make sure our SMTP task still exists */ for (taskh = NAtask; taskh && taskh != wh; taskh = (*taskh)->task); if (!taskh) return; /* handle TCP result */ w = NAlockWindow((na_win **) wh); if (status == NATCP_connect) { /* deal with new connection */ sw->state = S_greet; } else if (status < 0) { /* deal with TCP errors */ smtpclose(w, NASMTP_tcpfail, status, size, NULL); if (status == NATCP_closed) sw->state = S_close; } else if (status & NATCP_closing) { /* deal with a closed connection */ if (sw->state < S_wait) { smtpclose(w, NASMTP_conclosed, 0, 0, NULL); } } else if (status & NATCP_data) { do { /* buffer SMTP line */ dest = sw->linebuf + sw->count; while (size && sw->count < sizeof (sw->linebuf)) { --size, ++sw->count; if (sw->crfound && *data == '\n') { *--dest = '\0'; --sw->count; ++data; sw->crfound = 0; sw->crlf = 1; break; } sw->crfound = (*dest++ = *data++) == '\r'; } if (!sw->crlf) { if (sw->count == sizeof (sw->linebuf)) { sw->linebuf[sw->count - 1] = '\0'; smtpclose(w, NASMTP_badprot, 0, 0, sw->linebuf); } break; } sw->crlf = 0; /* parse SMTP result code */ dest = sw->linebuf; if (sw->count < 3 || !isdigit(dest[0]) || !isdigit(dest[1]) || !isdigit(dest[2])) { smtpclose(w, NASMTP_badprot, 0, 0, dest); break; } sw->count = 0; major = dest[0] - '0'; smtpcode = major * 100 + (dest[1] - '0') * 10 + (dest[2] - '0'); /* handle reply continuation */ if (dest[3] == '-') continue; /* handle major errors */ if (major > 3) { if (sw->state != S_rcpt) { smtpclose(w, major == 4 ? NASMTP_temperr : NASMTP_permerr, smtpcode, sw->state, dest + 3); break; } (*sw->statf)(sw->context, NASMTP_badaddr, smtpcode, 0, sw->linebuf + 3); } dest = sw->data + sw->headsize; /* state changes */ switch (sw->state) { case S_greet: if (sw->buf) { SMTPsend(w, "HELO ", sw->buf); if (sw->buf) DisposPtr(sw->buf); } sw->state = S_hello; break; case S_hello: SMTPsend(w, "MAIL FROM:<", dest); (*sw->statf)(sw->context, NASMTP_progress, 5, 0, 0); sw->state = S_mailf; break; case S_mailf: case S_rcpt: count = ++sw->rcpt; if (count < sw->num + 1) { while (count--) { while (*dest++); } SMTPsend(w, "RCPT TO:<", dest); (*sw->statf)(sw->context, NASMTP_progress, 5 + 10 * sw->rcpt / sw->num, 0, 0); } else { sw->state = S_data; SMTPsend(w, "DATA", 0); (*sw->statf)(sw->context, NASMTP_progress, 20, 0, 0); } break; case S_data: if (major != 3) { smtpclose(w, NASMTP_badprot, 0, 0, dest); break; } sw->state = S_send; if (sw->headsize) { sw->buf = NewPtr(sw->bufsize = sw->headsize); if (!sw->buf) { smtpclose(w, NASMTP_nomem, 0, 0, NULL); break; } memcpy(sw->buf, sw->data, sw->headsize); } case S_send: /* NOTE: this case should never happen */ break; case S_done: sw->state = S_quit; SMTPsend(w, "QUIT", NULL); (*sw->statf)(sw->context, NASMTP_progress, 95, 0, 0); break; case S_quit: smtpclose(w, NASMTP_completed, 0, 0, 0); break; } } while (size); } NAunlockWindowh((na_win **) wh, w) } /* TCP gethost callback */ static void hostp(void *wh, na_tcp s, short status, long size, char *data) { na_win *w, **taskh; /* make sure our task still exists */ for (taskh = NAtask; taskh && taskh != wh; taskh = (*taskh)->task); if (!taskh) return; /* store host/error */ w = NAlockWindow((na_win **) wh); if (status == NATCP_connect) { if (sw->state == S_hello) { SMTPsend(w, "HELO ", data); } else { sw->buf = NewPtr(size + 1); if (sw->buf == NULL) { smtpclose(w, NASMTP_nomem, 0, 0, NULL); } else { memcpy(sw->buf, data, size + 1); } } } else { smtpclose(w, NASMTP_tcpfail, status, size, NULL); } NAunlockWindowh((na_win **) wh, w); } /* translate CR to CRLF */ static void crtocrlf(char *buf, long *size) { long crcount = 0; char *src, *dst, *end = buf + *size; for (src = buf; src < end; ++src) { if (src[0] == '\r') ++crcount; } src = end - 1; for (dst = src + crcount; dst > src; *dst-- = *src--) { if (*src == '\r') *dst-- = '\n'; } *size += crcount; } /* SMTP task */ static short taskp(na_win *w) { OSErr oserr; if (sw->state == S_send || sw->state == S_done) { /*XXX: could be generous with NewPtr() failure if a NATCPwritePending() */ if (!sw->bufsize) { if ((sw->buf = NewPtr(8192)) == NULL) { smtpclose(w, NASMTP_nomem, 0, 0, NULL); return (NA_NOTPROCESSED); } sw->bufsize = sw->crtrans ? 4096 : 8192; oserr = FSRead(sw->refnum, &sw->bufsize, sw->buf); if (oserr != noErr && oserr != eofErr) sw->bufsize = 0; if (!sw->bufsize) { if (oserr == eofErr && sw->state == S_send) { memcpy(sw->buf, "\r\n.\r\n", 5); sw->bufsize = 5; sw->state = S_done; } else { DisposPtr(sw->buf); } } else { if (sw->crtrans) { crtocrlf(sw->buf, &sw->bufsize); } (*sw->statf)(sw->context, NASMTP_progress, 20 + 70 * (sw->fdone += sw->bufsize) / sw->fsize, 0, 0); } } if (sw->bufsize && NATCPwrite(sw->tcpid, sw->buf, sw->bufsize, 1) == NATCP_data) { sw->bufsize = 0; } } return (sw->state == S_close ? NA_REQCLOSE : NA_NOTPROCESSED); } /* SMTP close procedure * IMPORTANT: if the user quits during mail transmission, we want to * warn the user that mail will be lost. */ static short closep(na_win *w) { if (sw->state < S_wait) { /*XXX: put modal dialog here, allow abort of close */ if (sw->tcpid >= 0) NATCPclose(sw->tcpid); FSClose(sw->refnum); } return (NA_CLOSED); } /* submit file to SMTP: * creates SMTP task, initializes data, starts TCP connection * copies from & dest addresses, so they don't need to persist * task is not completed until statf() is called */ void NASMTPsubmit(na_smtpstat statf, char *server, FSSpec *fspec, Handle headers, Handle envelope, short flags, void *context) { long size; na_win **wh, *w; char *src, *dst; OSErr oserr; /* create task */ size = sizeof (na_smtpwin); if (headers) size += GetHandleSize(headers); size += GetHandleSize(envelope); wh = NAaddtask(taskp, size); if (!wh) { (*statf)(context, NASMTP_nomem, 0, 0, 0); return; } /* init task */ w = NAlockWindow(wh); w->type = NA_SMTPTYPE; w->closep = closep; sw->context = context; sw->statf = statf; if (headers && (sw->headsize = GetHandleSize(headers))) { memcpy(sw->data, (char *) *headers, sw->headsize); } size = GetHandleSize(envelope); sw->num = -1; dst = sw->data + sw->headsize; for (src = (char *) *envelope; size; --size) { if ((*dst++ = *src++) == '\0') ++sw->num; } if (flags & NASMTP_crtrans) sw->crtrans = 1; /* open file */ if ((oserr = HOpen(fspec->vRefNum, fspec->parID, fspec->name, fsRdPerm, &sw->refnum)) != noErr) { (*statf)(context, NASMTP_oserr, 0, oserr, 0); NAcloseWindow(w, NA_CLOSED); return; } GetEOF(sw->refnum, &sw->fsize); /* open MacTCP */ sw->tcpid = NATCPopen(readp, (void *) wh, server, SMTP_PORT, 0); if (sw->tcpid != -1) NATCPgethost(hostp, (void *) wh); NAunlockWindowh(wh, w); } mpack-1.6/macpcstr.c0000444005347200000120000002003105720743042010107 /* macpcstr.c -- niftyapp library pascal/C combination strings */ /* (C) Copyright 1995 by Carnegie Mellon University * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of Carnegie * Mellon University not be used in advertising or publicity * pertaining to distribution of the software without specific, * written prior permission. Carnegie Mellon University makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. * * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* (C) Copyright 1990, 1991 by Christopher J. Newman * All Rights Reserved. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Christopher J. Newman not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission. Christopher J. Newman makes no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * * CHRISTOPHER J. NEWMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT * SHALL CHRISTOPHER J. NEWMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. * * Author: Christopher J. Newman * Message: This is a nifty program. * * Created 9/1/88, Assembly Code 6/27/90 */ #ifdef THINK_C typedef unsigned char PCstr; /* assembler function prototypes */ void PtoPCstrcpy(void); void CtoPCstrcpy(void); void PCtoPCstrcpy(void); void PtoPCstrncpy(void); void CtoPCstrncpy(void); void PtoPCstrcat(void); void CtoPCstrcat(void); PCstr *PtoPCstr(void); PCstr *CtoPCstr(void); void SetPlen(void); PCstr *longtoPCstr(long); /* not in assembler */ void PtoPCstrcpy( /* PCstr *dest, *src */ ) { asm 68000 { movea.l 8(sp),a0 ; a0 = src movea.l 4(sp),a1 ; a1 = dest clr.w d0 move.b (a0),d0 clr.b 1(a1,d0) @loop: move.b (a0)+,(a1)+ dbf.w d0,@loop } } void CtoPCstrcpy( /* PCstr *dest, char *src */) { asm 68000 { movea.l 8(sp),a0 ; a0 = src movea.l 4(sp),a1 ; a1 = dest addq.l #1,a1 moveq.l #-1,d0 @loop: addq.w #1,d0 move.b (a0)+,(a1)+ bne.s @loop movea.l 4(sp),a1 ; a1 = dest move.b d0,(a1) } } void PCtoPCstrcpy( /* PCstr *dest, PCstr *src */) { asm 68000 { movea.l 8(sp),a0 ; a0 = src movea.l 4(sp),a1 ; a1 = dest move.b (a0)+,(a1)+ @loop: move.b (a0)+,(a1)+ bne.s @loop } } void PtoPCstrncpy( /* PCstr *dest, char *src, short n */) { asm 68000 { movea.l 8(sp),a0 ; a0 = src movea.l 4(sp),a1 ; a1 = dest move.w 12(sp),d0 ; d0 = n clr.w d1 move.b (a0)+,d1 cmp.w d0,d1 bcc.s @skip move.w d1,d0 @skip: move.b d0,(a1)+ subq.w #1,d0 bcs.s @exit @loop: move.b (a0)+,(a1)+ dbf d0,@loop @exit: } } void CtoPCstrncpy( /* PCstr *dest, char *src, short n */ ) { asm 68000 { movea.l 8(sp),a0 ; a0 = src movea.l 4(sp),a1 ; a1 = dest addq.l #1,a1 clr.w d1 move.w 12(sp),d0 ; d0 = n bra.s @skip @loop: addq.w #1,d1 move.b (a0)+,(a1)+ @skip: dbeq.w d0,@loop clr.b (a1) movea.l 4(sp),a1 ; a1 = dest subq.w #1,d1 move.b d1,(a1) } } void PtoPCstrcat( /* PCstr *dest, char *src */ ) { asm 68000 { movea.l 8(sp),a0 ; a0 = src movea.l 4(sp),a1 ; a1 = dest clr.w d0 clr.w d1 move.b (a0)+,d0 move.b (a1),d1 add.b d0,(a1) lea.l 1(a1,d1),a1 bra.s @skip @loop: move.b (a0)+,(a1)+ @skip: dbf.w d0,@loop clr.b (a1) } } void CtoPCstrcat( /* PCstr *dest, char *src */ ) { asm 68000 { movea.l 8(sp),a0 ; a0 = src movea.l 4(sp),a1 ; a1 = dest clr.w d0 move.b (a1),d0 lea.l 1(a1,d0),a1 subq.w #1,d0 @loop: addq.w #1,d0 move.b (a0)+,(a1)+ bne.s @loop movea.l 4(sp),a1 ; a1 = dest move.b d0,(a1) } } PCstr *PtoPCstr( /* char *str */ ) { asm 68000 { movea.l 4(sp),a0 ; a0 = str clr.w d0 move.b (a0),d0 clr.b 1(a0,d0) move.l a0,d0 } } PCstr *CtoPCstr( /* char *str */) { asm 68000 { movea.l 4(sp),a0 ; a0 = str move.b (a0)+,d0 lea.l (a0),a1 @loop: move.b (a1),d1 move.b d0,(a1)+ move.b d1,d0 bne.s @loop move.b d0,(a1) suba.l a0,a1 move.l a1,d0 move.b d0,-(a0) move.l a0,d0 } } void SetPlen( /* PCstr *pcstr */ ) { asm 68000 { movea.l 4(sp),a0 ; a0 = str lea.l 1(a0),a1 moveq.l #-1,d0 @loop: addq.w #1,d0 @skip: tst.b (a1)+ bne.s @loop move.b d0,(a0) } } #else /* C function prototypes in mac_napp.h */ #include "macnapp.h" void PtoPCstrcpy(dest, src) register PCstr *dest; register char *src; { register short i; i = Pstrlen(src); C(dest)[i] = '\0'; do { *dest++ = *src++; } while (i--); } void CtoPCstrcpy(dest, src) register PCstr *dest; register char *src; { register short i; register char *cpy; cpy = C(dest); for (i = 0; *cpy++ = *src++; i++); *dest = i; } void PCtoPCstrcpy(dest, src) register PCstr *dest; register PCstr *src; { *dest++ = *src++; while (*dest++ = *src++); } void PtoPCstrncpy(PCstr *dest, char *src, short n) { if (Pstrlen(src) < n) n = Pstrlen(src); *dest++ = n; src++; while (n--) *dest++ = *src++; *dest++ = '\0'; } void CtoPCstrncpy(PCstr *dest, char *src, short n) { register char *tmp; register short i; tmp = C(dest); for (i = 0; n-- && (*tmp++ = *src++); i++); *tmp = '\0'; *dest = i; } void PtoPCstrcat(dest, src) register PCstr *dest; register char *src; { register short i; register short j; i = *dest; *dest += (j = (unsigned char) *src++); dest += i + 1; while (j--) *dest++ = *src++; *dest = '\0'; } void CtoPCstrcat(dest, src) register PCstr *dest; register char *src; { register short i; register char *tmp; tmp = (char *) dest + (i = *dest) + 1; while (*tmp++ = *src++) i++; *dest = i; } PCstr *PtoPCstr(str) register char *str; { SetClen((PCstr*) str); return ((PCstr*) str); } PCstr *CtoPCstr(str) register char *str; { register PCstr i; register char c, d; register char *tmp; i = 0; tmp = str; tmp++; c = *tmp++; do { d = *tmp; *tmp++ = c; i++; } while (c = d); (*(PCstr*)str) = i; return ((PCstr*) str); } void SetPlen(pcstr) register PCstr *pcstr; { register short i = -1; register char *len = C(pcstr); do { i++; } while (*len++); *pcstr = i; } #endif /* simple procedure to convert decimal number of * less than 20 digits to a PC string. * Compiling with 68020 option makes this quite a bit more efficient. */ PCstr *longtoPCstr(i) register long i; { static PCstr sbuf[21]; register Boolean negflag; register unsigned long val, ten = 10; register PCstr *pos = sbuf + sizeof (sbuf) - 1; register PCstr *posst; *pos = '\0'; posst = --pos; negflag = false; val = i; if (i < 0) { negflag = true; val = -i; } do { *pos = (unsigned short) (val % ten) + '0'; pos--; } while (val /= ten); if (negflag) { *pos = '-'; pos--; } *pos = posst - pos; return (pos); } mpack-1.6/unixpk.man0000444005347200000120000000426105720743046010155 .TH MPACK 1 .SH NAME mpack \- pack a file in MIME format .SH SYNOPSIS .B mpack [ .B \-s .I subject ] [ .B \-d .I descriptionfile ] [ .B \-m .I maxsize ] [ .B \-c .I content-type ] .I file .I "address \&..." .br .B mpack [ .B \-s .I subject ] [ .B \-d .I descriptionfile ] [ .B \-m .I maxsize ] [ .B \-c .I content-type ] .B \-o .I outputfile .I file .br .B mpack [ .B \-s .I subject ] [ .B \-d .I descriptionfile ] [ .B \-m .I maxsize ] [ .B \-c .I content-type ] .B \-n .I newsgroups .I file .SH DESCRIPTION The .I mpack program encodes the the named file in one or more MIME messages. The resulting messages are mailed to one or more recipients, written to a named file or set of files, or posted to a set of newsgroups. .PP .SH OPTIONS .TP .BI \-s " subject" Set the .B Subject header field to .IR Subject . By default, .B mpack will prompt for the contents of the subject header. .TP .BI \-d " descriptionfile Include the contents of the file .I descriptionfile in an introductory section at the beginning of the first generated message. .TP .BI \-m " maxsize" Split the message (if necessary) into partial messages, each not exceeding .I maxsize characters. The default limit is the value of the .B SPLITSIZE environment variable, or no limit if the environment variable does not exist. Specifying a .I maxsize of 0 means there is no limit to the size of the generated message. .TP .BI \-c " content-type" Label the included file as being of MIME type .IR content-type , which must be a subtype of .BR application , .BR audio , .BR image , or .BR video . If this switch is not given, .B mpack examines the file to determine its type. .TP .BI \-o " outputfile" Write the generated message to the file .IR outputfile . If the message has to be split, the partial messages will instead be written to the files .IR outputfile .01, .IR outputfile .02, etc. .TP .BI \-n " newsgroups" Post the generated message(s) to the comma-separated netnews .IR newsgroups . .TP .I file Encode the named .IR file . .TP .I "address \&..." Mail the generated messages to the specified addresses. .SH ENVIRONMENT .TP .B TMPDIR Directory to store temporary files. Default is /usr/tmp. .TP .B SPLITSIZE Default value of the -m switch. mpack-1.6/unixunpk.man0000444005347200000120000000660105720743046010520 .TH MUNPACK 1 .SH NAME munpack \- unpack messages in MIME or split-uuencode format .SH SYNOPSIS .B munpack [ .B \-f ] [ .B \-q ] [ .B \-t ] [ .B \-C .I directory ] [ .I "filename \&..." ] .SH DESCRIPTION The .I munpack program reads each RFC-822 message .I filename and writes all non-text MIME parts or split-uuencoded files as files. If no filename argument is given, .B munpack reads from standard input. .LP If the message suggests a file name to use for the imbedded part, that name is cleaned of potential problem characters and used for the output file. If the suggested filename includes subdirectories, they will be created as necessary. If the message does not suggest a file name, the names "part1", "part2", etc are used in sequence. .LP If the imbedded part was preceded with textual information, that information is also written to a file. The file is named the same as the imbedded part, with any filename extension replaced with ".desc". .SH OPTIONS .TP .B \-f Force overwriting of existing files. If a message suggests a file name of an existing file, the file will be overwritten. Without this flag, .B munpack appends ".1", ".2", etc to find a nonexistent file. .TP .B \-q Be quiet. Supresses messages about saving partial messages and about messages with no interesting information. .TP .B \-t Also write the text MIME parts of multipart messages as files. By default, text parts that do not have a filename parameter do not get unpacked. This option effectively disables the ".desc" file feature for MIME messages. .TP .BI \-C " directory" Change the current directory to .I directory before reading any files. This is useful when invoking .B munpack from a mail or news reader. .SH "DECODING MIME" .LP To decode a MIME message, first save it to a text file. If possible, save it with all headers included. .I Munpack can decode some MIME files when the headers are missing or incomplete, other files it cannot decode without having the information in the headers. In general, messages which have a statement at the beginning that they are in MIME format can be decoded without the headers. Messages which have been split into multiple parts generally require all headers in order to be reassembled and decoded. .LP Some LAN-based mail systems and some mail providers (including America Online, as of the writing of this document) place the mail headers at the bottom of the message, instead of at the top of the message. If you are having problems decoding a MIME message on such a system, you need to convert the mail back into the standard format by removing the system's nonstandard headers and moving the standard Internet headers at the top of the message (separated from the message body with a blank line). .LP There must be exactly one message per file. .I Munpack cannot deal with multiple messages in a single file, to decode things correctly it must know when one message ends and the next one begins. .LP To decode a message, run the command: .IP .IB munpack " file" .LP where "file" is the name of the file containing the message. More than one filename may be specified, .I munpack will try to decode the message in each file. For more information on ways to run .IR munpack , see the section "OPTIONS" above. .SH ENVIRONMENT .TP .B TMPDIR Directory to store temporary files. Default is /usr/tmp. .SH FILES .TP .B $TMPDIR/m-prts-$USER/ Directory used to store partial messages awaiting reassembly. mpack-1.6/cmulocal/0000755005347200000120000000000007707033712010017 5mpack-1.6/cmulocal/CVS/0000755005347200000120000000000007707033712010452 5mpack-1.6/cmulocal/CVS/Root0000644005347200000120000000003707707033711011237 /afs/andrew.cmu.edu/system/cvs mpack-1.6/cmulocal/CVS/Repository0000644005347200000120000000001507707033711012467 src/cmulocal mpack-1.6/cmulocal/CVS/Entries0000644005347200000120000000352707707033712011735 /COPYING/1.1/Fri Oct 2 21:35:59 1998// /README.andrew/1.10/Sat Oct 30 23:06:31 1999// /afs.m4/1.25/Fri May 9 03:51:17 2003// /agentx.m4/1.4/Sat May 25 19:57:41 2002// /arx.m4/1.4/Sat Dec 21 18:44:24 2002// /berkdb.m4/1.11/Tue Apr 15 22:25:41 2003// /bsd_sockets.m4/1.8/Sat May 25 19:57:41 2002// /c-attribute.m4/1.2/Wed Feb 23 06:49:00 2000// /c-fpic.m4/1.1/Fri Jun 13 15:08:41 2003// /com_err.m4/1.5/Sat May 25 19:57:41 2002// /com_err_link.m4/1.6/Sat Dec 21 18:44:24 2002// /common.m4/1.10/Thu Aug 15 00:11:10 2002// /cyrus.m4/1.3/Sat May 25 19:57:42 2002// /db.m4/1.1/Wed Apr 4 17:58:30 2001// /find-func-no-libs.m4/1.1/Wed Apr 4 17:58:30 2001// /find-func-no-libs2.m4/1.1/Wed Apr 4 17:58:30 2001// /find-func.m4/1.1/Wed Apr 4 17:58:30 2001// /heimdal.m4/1.6/Sat Dec 21 18:44:24 2002// /init_automake.m4/1.3/Sat May 25 19:57:42 2002// /ipv6.m4/1.1/Thu Jan 9 19:52:18 2003// /kafs.m4/1.5/Sat Dec 21 18:44:24 2002// /kerberos_v4.m4/1.25/Sun Dec 29 05:13:02 2002// /kerberos_v5.m4/1.6/Sat Dec 21 18:44:24 2002// /libXau.m4/1.3/Sat Dec 21 18:44:24 2002// /libcyrus.m4/1.18/Sat Dec 21 18:44:24 2002// /libloguse.m4/1.4/Sat Dec 21 18:44:24 2002// /libnet.m4/1.6/Sat Dec 21 18:44:24 2002// /libpcap.m4/1.7/Sat Dec 21 18:44:24 2002// /librestrict.m4/1.3/Sat Dec 21 18:44:25 2002// /libssl.m4/1.8/Sat Dec 21 18:44:25 2002// /libtoolhack.m4/1.3/Sat May 25 19:57:42 2002// /libwrap.m4/1.6/Wed Aug 21 15:03:19 2002// /mips-abi.m4/1.4/Sat May 25 19:57:42 2002// /nadine.m4/1.5/Sat Dec 21 18:44:25 2002// /nana.m4/1.4/Thu Aug 15 22:24:02 2002// /openssl.m4/1.6/Thu Feb 13 16:55:54 2003// /pthreads.m4/1.10/Sat May 25 19:57:42 2002// /sasl.m4/1.21/Sat Dec 21 18:44:25 2002// /sasl2.m4/1.30/Wed Jul 2 13:13:40 2003// /tcl.m4/1.3/Sat May 25 19:57:42 2002// /telnet.m4/1.11/Sat May 25 19:57:42 2002// /ucdsnmp.m4/1.5/Wed Aug 21 15:03:19 2002// /util.m4/1.9/Sat May 25 19:57:43 2002// D mpack-1.6/cmulocal/COPYING0000644005347200000120000000202406605243477010777 Copyright 1998 by Carnegie Mellon University All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Carnegie Mellon University not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. mpack-1.6/cmulocal/README.andrew0000644005347200000120000000567307006674767012126 This is a collection of autoconf macros which've been written by various people at CMU. To use it, use "aclocal -I cmulocal" (after the first time, automake should automatically use the -I cmulocal, if you've called CMU_INIT_AUTOMAKE in configure.in). CMU_INIT_AUTOMAKE If you use automake, you should call this after AM_INIT_AUTOMAKE. It adds "-I cmulocal" to the aclocal command line, so that when automake runs aclocal, aclocal'll continue to pick up these macros. CMU_ADD_LIBPATH Add -L(arg), and possibly -R(arg) (or whatever the runpath is) to LDFLAGS. CMU_ADD_LIBPATH_TO Likewise to above, except adds it to the specified variable (arg 2). CMU_GUESS_RUNPATH_SWITCH Attempts to guess what the runpath switch is (-R or whatever). CMU_COMERR Requires that com_err exist in the collection (at CMU, do this by running "cvs checkout com_err", and adding com_err to DIST_SUBDIRS in your Makefile.am). It sets the output variable COMPILE_ET to the compile_et program to use, and adds the appropriate paths to LDFLAGS and CPPFLAGS. It does *not* add -lcom_err to LIBS (this would cause later library checks to fail if com_err needs to be built), so Makefiles need to explicitly add -lcom_err (which, after all, should always exist as long as the com_err compile doesn't blow up). Makefiles should do this by using LIB_COMERR, which will substitute to the appropriate magic to use to grab the library. (This may involve a libtool archive; you should be using libtool to link your program if you distribute libraries with it that the program may link against). Note that com_err will only be compiled if the configure script can't find compile_et or libcom_err; if the system already has them, the configure script will use the system installation (although, due to some autoconf wonkiness, com_err will still be configured; it just won't show up in the @subdirs@ expansion). CMU_NANA Adds --with-nana, set by default; if set, attempts to link against libnana. If not set, or if libnana is unavailable, or if we're not using gcc, it defines WITHOUT_NANA. CMU_PROG_LIBTOOL Just like AM_PROG_LIBTOOL, except it performs a couple little hacks to make sure that things don't break on picky vendor compilers which whine about empty translation units. CMU_PTHREADS This attempts to link against libpthread (failing if it can't be found), and attempts to do any system-specific setup required for thread support (for example, most things want _REENTRANT to be defined, but Solaris wants _POSIX_PTHREAD_SEMANTICS and __EXTENSIONS__, IRIX wants to see _SGI_REENTRANT_FUNCTIONS, etc). CMU_SASL This tries to find a SASL library, and calls AC_SUBST on LIB_SASL if it finds one, or tells the user to go ftp it if it doesn't exist. Provides --with-sasldir. CMU_KRB4 This attempts to find Kerberos 4 libraries and set up CFLAGS and LIBS appropriately. It also updates and substitutes RPATH for shared library stuff. mpack-1.6/cmulocal/afs.m40000644005347200000120000003010407656622665010766 dnl afs.m4--AFS libraries, includes, and dependencies dnl $Id: afs.m4,v 1.25 2003/05/09 03:51:17 cg2v Exp $ dnl Chaskiel Grundman dnl based on kerberos_v4.m4 dnl Derrick Brashear dnl from KTH krb and Arla AC_DEFUN(CMU_AFS_INC_WHERE1, [ cmu_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$cmu_save_CPPFLAGS -I$1" AC_TRY_COMPILE([#include ], [#ifndef SYS_NAME choke me #endif int foo;], ac_cv_found_afs_inc=yes, ac_cv_found_afs_inc=no) CPPFLAGS=$cmu_save_CPPFLAGS ]) AC_DEFUN(CMU_AFS_LIB_WHERE1, [ save_LIBS="$LIBS" save_LDFLAGS="$LDFLAGS" LIBS="-lauth $1/afs/util.a $LIB_SOCKET $LIBS" LDFLAGS="-L$1 -L$1/afs $LDFLAGS" dnl suppress caching AC_TRY_LINK([],[afsconf_Open();], ac_cv_found_afs_lib=yes, ac_cv_found_afs_lib=no) LIBS="$save_LIBS" LDFLAGS="$save_LDFLAGS" ]) AC_DEFUN(CMU_AFS_WHERE, [ for i in $1; do AC_MSG_CHECKING(for AFS in $i) CMU_AFS_INC_WHERE1("$i/include") ac_cv_found_lwp_inc=$ac_cv_found_afs_inc CMU_TEST_INCPATH($i/include, lwp) ac_cv_found_afs_inc=$ac_cv_found_lwp_inc if test "$ac_cv_found_afs_inc" = "yes"; then CMU_AFS_LIB_WHERE1("$i/lib") if test "$ac_cv_found_afs_lib" = "yes"; then ac_cv_afs_where=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_AFS, [ AC_REQUIRE([CMU_SOCKETS]) AC_REQUIRE([CMU_LIBSSL]) AC_ARG_WITH(AFS, [ --with-afs=PREFIX Compile with AFS support], [if test "X$with_AFS" = "X"; then with_AFS=yes fi]) if test "X$with_AFS" != "X"; then ac_cv_afs_where=$with_AFS fi if test "X$ac_cv_afs_where" = "X"; then CMU_AFS_WHERE(/usr/afsws /usr/local /usr/athena) fi AC_MSG_CHECKING(whether to include AFS) if test "X$ac_cv_afs_where" = "Xno" -o "X$ac_cv_afs_where" = "X"; then ac_cv_found_afs=no AC_MSG_RESULT(no) else ac_cv_found_afs=yes AC_MSG_RESULT(yes) AFS_INC_DIR="$ac_cv_afs_where/include" AFS_LIB_DIR="$ac_cv_afs_where/lib" AFS_TOP_DIR="$ac_cv_afs_where" AFS_INC_FLAGS="-I${AFS_INC_DIR}" AFS_LIB_FLAGS="-L${AFS_LIB_DIR} -L${AFS_LIB_DIR}/afs" cmu_save_LIBS="$LIBS" cmu_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS ${AFS_INC_FLAGS}" cmu_save_LDFLAGS="$LDFLAGS" LDFLAGS="$cmu_save_LDFLAGS ${AFS_LIB_FLAGS}" AC_CHECK_HEADERS(afs/stds.h) AC_MSG_CHECKING([if libdes is needed]) AC_TRY_LINK([],[des_quad_cksum();],AFS_DES_LIB="",AFS_DES_LIB="maybe") if test "X$AFS_DES_LIB" != "X"; then LIBS="$cmu_save_LIBS -ldes" AC_TRY_LINK([], [des_quad_cksum();],AFS_DES_LIB="yes") if test "X$AFS_DES_LIB" = "Xyes"; then AC_MSG_RESULT([yes]) AFS_LIBDES="-ldes" AFS_LIBDESA="${AFS_LIB_DIR}/libdes.a" else LIBS="$cmu_save_LIBS $LIBSSL_LIB_FLAGS" AC_TRY_LINK([], [des_quad_cksum();],AFS_DES_LIB="libcrypto") if test "X$AFS_DES_LIB" = "Xlibcrypto"; then AC_MSG_RESULT([libcrypto]) AFS_LIBDES="$LIBSSL_LIB_FLAGS" AFS_LIBDESA="$LIBSSL_LIB_FLAGS" else AC_MSG_RESULT([unknown]) AC_MSG_ERROR([Could not use -ldes]) fi fi else AC_MSG_RESULT([no]) fi AFS_CLIENT_LIBS_STATIC="${AFS_LIB_DIR}/afs/libvolser.a ${AFS_LIB_DIR}/afs/libvldb.a ${AFS_LIB_DIR}/afs/libkauth.a ${AFS_LIB_DIR}/afs/libprot.a ${AFS_LIB_DIR}/libubik.a ${AFS_LIB_DIR}/afs/libauth.a ${AFS_LIB_DIR}/librxkad.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/afs/libsys.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/liblwp.a ${AFS_LIBDESA} ${AFS_LIB_DIR}/afs/libcmd.a ${AFS_LIB_DIR}/afs/libcom_err.a ${AFS_LIB_DIR}/afs/util.a" AFS_KTC_LIBS_STATIC="${AFS_LIB_DIR}/afs/libauth.a ${AFS_LIB_DIR}/afs/libsys.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/liblwp.a ${AFS_LIBDESA} ${AFS_LIB_DIR}/afs/libcom_err.a ${AFS_LIB_DIR}/afs/util.a" AFS_CLIENT_LIBS="-lvolser -lvldb -lkauth -lprot -lubik -lauth -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a" AFS_RX_LIBS="-lauth -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a" AFS_KTC_LIBS="-lauth ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcom_err ${AFS_LIB_DIR}/afs/util.a" LIBS="$cmu_save_LIBS" AC_CHECK_FUNC(flock) LIBS="$cmu_save_LIBS ${AFS_CLIENT_LIBS} ${LIB_SOCKET}" if test "X$ac_cv_func_flock" != "Xyes"; then AC_MSG_CHECKING([if AFS needs flock]) AC_TRY_LINK([#include #ifdef HAVE_AFS_STDS_H #include #endif #include #include #include #include struct ubik_client * cstruct; int sigvec() {return 0;} extern int UV_SetSecurity();], [vsu_ClientInit(1,"","",0, &cstruct,UV_SetSecurity)], AFS_FLOCK=no,AFS_FLOCK=yes) if test $AFS_FLOCK = "no"; then AC_MSG_RESULT([no]) else AC_MSG_RESULT([yes]) LDFLAGS="$LDFLAGS -L/usr/ucblib" AC_CHECK_LIB(ucb, flock,:, [AC_CHECK_LIB(BSD, flock)]) fi fi LIBS="$cmu_save_LIBS" AC_CHECK_FUNC(sigvec) LIBS="$cmu_save_LIBS ${AFS_CLIENT_LIBS} ${LIB_SOCKET}" if test "X$ac_cv_func_sigvec" != "Xyes"; then AC_MSG_CHECKING([if AFS needs sigvec]) AC_TRY_LINK([#include #ifdef HAVE_AFS_STDS_H #include #endif #include #include #include #include struct ubik_client * cstruct; int flock() {return 0;} extern int UV_SetSecurity();], [vsu_ClientInit(1,"","",0, &cstruct,UV_SetSecurity)], AFS_SIGVEC=no,AFS_SIGVEC=yes) if test $AFS_SIGVEC = "no"; then AC_MSG_RESULT([no]) else AC_MSG_RESULT([yes]) LDFLAGS="$LDFLAGS -L/usr/ucblib" AC_CHECK_LIB(ucb, sigvec,:,[AC_CHECK_LIB(BSD, sigvec)]) fi fi if test "$ac_cv_lib_ucb_flock" = "yes" -o "$ac_cv_lib_ucb_sigvec" = "yes"; then AFS_LIB_FLAGS="${AFS_LIB_FLAGS} -L/usr/ucblib -R/usr/ucblib" fi if test "$ac_cv_lib_ucb_flock" = "yes" -o "$ac_cv_lib_ucb_sigvec" = "yes"; then AFS_BSD_LIB="-lucb" elif test "$ac_cv_lib_BSD_flock" = "yes" -o "$ac_cv_lib_BSD_sigvec" = "yes"; then AFS_BSD_LIB="-lBSD" fi if test "X$AFS_BSD_LIB" != "X" ; then AFS_CLIENT_LIBS_STATIC="$AFS_CLIENT_LIBS_STATIC $AFS_BSD_LIB" AFS_KTC_LIBS_STATIC="$AFS_KTC_LIBS_STATIC $AFS_BSD_LIB" AFS_CLIENT_LIBS="$AFS_CLIENT_LIBS $AFS_BSD_LIB" AFS_RX_LIBS="$AFS_CLIENT_LIBS $AFS_BSD_LIB" AFS_KTC_LIBS="$AFS_KTC_LIBS $AFS_BSD_LIB" fi LIBS="$cmu_save_LIBS $AFS_CLIENT_LIBS ${LIB_SOCKET}" AC_CHECK_FUNC(des_pcbc_init) if test "X$ac_cv_func_des_pcbc_init" != "Xyes"; then AC_CHECK_LIB(descompat, des_pcbc_init, AFS_DESCOMPAT_LIB="-ldescompat") if test "X$AFS_DESCOMPAT_LIB" != "X" ; then AFS_CLIENT_LIBS_STATIC="$AFS_CLIENT_LIBS_STATIC $AFS_DESCOMPAT_LIB" AFS_KTC_LIBS_STATIC="$AFS_KTC_LIBS_STATIC $AFS_DESCOMPAT_LIB" AFS_CLIENT_LIBS="$AFS_CLIENT_LIBS $AFS_DESCOMPAT_LIB" AFS_KTC_LIBS="$AFS_KTC_LIBS $AFS_DESCOMPAT_LIB" else AC_MSG_CHECKING([if rxkad needs des_pcbc_init]) AC_TRY_LINK(,[tkt_DecodeTicket();],RXKAD_PROBLEM=no,RXKAD_PROBLEM=maybe) if test "$RXKAD_PROBLEM" = "maybe"; then AC_TRY_LINK([int des_pcbc_init() { return 0;}], [tkt_DecodeTicket();],RXKAD_PROBLEM=yes,RXKAD_PROBLEM=error) if test "$RXKAD_PROBLEM" = "yes"; then AC_MSG_RESULT([yes]) AC_MSG_ERROR([cannot use rxkad]) else AC_MSG_RESULT([unknown]) AC_MSG_ERROR([Unknown error testing rxkad]) fi else AC_MSG_RESULT([no]) fi fi fi AC_MSG_CHECKING([if libaudit is needed]) AFS_LIBAUDIT="" LIBS="$cmu_save_LIBS $AFS_CLIENT_LIBS ${LIB_SOCKET}" AC_TRY_LINK([#include #ifdef HAVE_AFS_STDS_H #include #endif #include #include ], [afsconf_SuperUser();],AFS_AUDIT_LIB="",AFS_AUDIT_LIB="maybe") if test "X$AFS_AUDIT_LIB" != "X"; then LIBS="$cmu_save_LIBS -lvolser -lvldb -lkauth -lprot -lubik -lauth -laudit -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a $AFS_BSD_LIB $AFS_DESCOMPAT_LIB $LIB_SOCKET" AC_TRY_LINK([#include #ifdef HAVE_AFS_STDS_H #include #endif #include #include ], [afsconf_SuperUser();],AFS_AUDIT_LIB="yes") if test "X$AFS_AUDIT_LIB" = "Xyes"; then AC_MSG_RESULT([yes]) AFS_LIBAUDIT="-laudit" AFS_CLIENT_LIBS_STATIC="${AFS_LIB_DIR}/afs/libvolser.a ${AFS_LIB_DIR}/afs/libvldb.a ${AFS_LIB_DIR}/afs/libkauth.a ${AFS_LIB_DIR}/afs/libprot.a ${AFS_LIB_DIR}/libubik.a ${AFS_LIB_DIR}/afs/libauth.a ${AFS_LIB_DIR}/afs/libaudit.a ${AFS_LIB_DIR}/librxkad.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/afs/libsys.a ${AFS_LIB_DIR}/librx.a ${AFS_LIB_DIR}/liblwp.a ${AFS_LIBDESA} ${AFS_LIB_DIR}/afs/libcmd.a ${AFS_LIB_DIR}/afs/libcom_err.a ${AFS_LIB_DIR}/afs/util.a" AFS_CLIENT_LIBS="-lvolser -lvldb -lkauth -lprot -lubik -lauth -laudit -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a $AFS_BSD_LIB $AFS_DESCOMPAT_LIB" AFS_RX_LIBS="-lauth -laudit -lrxkad -lrx ${AFS_LIB_DIR}/afs/libsys.a -lrx -llwp ${AFS_LIBDES} -lcmd -lcom_err ${AFS_LIB_DIR}/afs/util.a $AFS_BSD_LIB $AFS_DESCOMPAT_LIB" else AC_MSG_RESULT([unknown]) AC_MSG_ERROR([Could not use -lauth while testing for -laudit]) fi else AC_MSG_RESULT([no]) fi AC_CHECK_FUNCS(VL_ProbeServer) AC_MSG_CHECKING([if new-style afs_ integer types are defined]) AC_CACHE_VAL(ac_cv_afs_int32, dnl The next few lines contain a quoted argument to egrep dnl It is critical that there be no leading or trailing whitespace dnl or newlines [AC_EGREP_CPP(dnl changequote(<<,>>)dnl <<(^|[^a-zA-Z_0-9])afs_int32[^a-zA-Z_0-9]>>dnl changequote([,]), [#include #ifdef HAVE_AFS_STDS_H #include #endif], ac_cv_afs_int32=yes, ac_cv_afs_int32=no)]) AC_MSG_RESULT($ac_cv_afs_int32) if test $ac_cv_afs_int32 = yes ; then AC_DEFINE(HAVE_AFS_INT32,, [AFS provides new "unambiguous" type names]) else AC_DEFINE(afs_int16, int16, [it's a type definition]) AC_DEFINE(afs_int32, int32, [it's a type definition]) AC_DEFINE(afs_uint16, u_int16, [it's a type definition]) AC_DEFINE(afs_uint32, u_int32, [it's a type definition]) fi CPPFLAGS="${cmu_save_CPPFLAGS}" LDFLAGS="${cmu_save_LDFLAGS}" LIBS="${cmu_save_LIBS}" AC_DEFINE(AFS_ENV,, [Use AFS. (find what needs this and nuke it)]) AC_DEFINE(AFS,, [Use AFS. (find what needs this and nuke it)]) AC_SUBST(AFS_CLIENT_LIBS_STATIC) AC_SUBST(AFS_KTC_LIBS_STATIC) AC_SUBST(AFS_CLIENT_LIBS) AC_SUBST(AFS_RX_LIBS) AC_SUBST(AFS_KTC_LIBS) AC_SUBST(AFS_INC_FLAGS) AC_SUBST(AFS_LIB_FLAGS) AC_SUBST(AFS_TOP_DIR) AC_SUBST(AFS_LIBAUDIT) AC_SUBST(AFS_LIBDES) AC_SUBST(AFS_LIBDESA) fi ]) AC_DEFUN(CMU_NEEDS_AFS, [AC_REQUIRE([CMU_AFS]) if test "$ac_cv_found_afs" != "yes"; then AC_ERROR([Cannot continue without AFS]) fi]) mpack-1.6/cmulocal/agentx.m40000644005347200000120000000241607473766265011512 dnl agentx.m4--detect agentx libraries dnl copied from x-unixrc dnl Tim Martin dnl $Id: agentx.m4,v 1.4 2002/05/25 19:57:41 leg Exp $ AC_DEFUN(CMU_AGENTX, [ dnl dnl CMU AgentX dnl AC_MSG_CHECKING([for AgentX]) AC_ARG_WITH(agentx, [ --with-agentx CMU AgentX libraries located in (val)], AGENTX_DIR="$withval", AGENTX_DIR=no) found_agentx="no" if test "${AGENTX_DIR}" != "no" && test -f $AGENTX_DIR/lib${ABILIBDIR}/libagentx.a && test -f $AGENTX_DIR/include/agentx.h; then AGENTX_DIR="$AGENTX_DIR" found_agentx="yes" elif test -d /usr/local && test -f /usr/local/lib${ABILIBDIR}/libagentx.a && test -f /usr/local/include/agentx.h; then AGENTX_DIR="/usr/local" found_agentx="yes" elif test -d /usr/ng && test -f /usr/ng/lib${ABILIBDIR}/libagentx.a && test -f /usr/ng/include/agentx.h; then AGENTX_DIR="/usr/ng" found_agentx="yes" fi if test "$found_agentx" = "no"; then AC_MSG_WARN([Could not locate AgentX Libraries! http://www.net.cmu.edu/groups/netdev/agentx/]) else LIB_AGENTX="-L$AGENTX_DIR/lib${ABILIBDIR} -lagentx" AC_SUBST(LIB_AGENTX) AGENTXFLAGS="-I$AGENTX_DIR/include" AC_SUBST(AGENTXFLAGS) AC_MSG_RESULT([found $AGENTX_DIR/lib${ABILIBDIR}/libagentx.a]) fi ]) mpack-1.6/cmulocal/arx.m40000644005347200000120000000740707601133210010766 dnl $Id: arx.m4,v 1.4 2002/12/21 18:44:24 cg2v Exp $ AC_DEFUN(CMU_ARX_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1" AC_TRY_COMPILE([#include ], [arx_context *foo;], ac_cv_found_arx_inc=yes, ac_cv_found_arx_inc=no) CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_ARX_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for arx headers in $i) CMU_ARX_INC_WHERE1($i) CMU_TEST_INCPATH($i, arx) if test "$ac_cv_found_arx_inc" = "yes"; then ac_cv_arx_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) # # Test for lib files # AC_DEFUN(CMU_ARX_LIB_WHERE1, [ AC_REQUIRE([CMU_AFS]) AC_REQUIRE([CMU_KRB4]) saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -larx $AFS_LIB_FLAGS $AFS_CLIENT_LIBS $KRB_LIB_FLAGS $LIB_SOCKET" AC_TRY_LINK(, [arx_Init();], [ac_cv_found_arx_lib=yes], ac_cv_found_arx_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_ARX_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for arx libraries in $i) CMU_ARX_LIB_WHERE1($i) CMU_TEST_LIBPATH($i, arx) if test "$ac_cv_found_arx_lib" = "yes" ; then ac_cv_arx_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_USE_ARX, [ AC_ARG_WITH(arx, [ --with-arx=PREFIX Compile with arx support], [if test "X$with_arx" = "X"; then with_arx=yes fi]) AC_ARG_WITH(arx-lib, [ --with-arx-lib=dir use arx libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-arx-lib]) fi]) AC_ARG_WITH(arx-include, [ --with-arx-include=dir use arx headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-arx-include]) fi]) if test "X$with_arx" != "X"; then if test "$with_arx" != "yes"; then ac_cv_arx_where_lib=$with_arx/lib ac_cv_arx_where_inc=$with_arx/include fi fi if test "X$with_arx_lib" != "X"; then ac_cv_arx_where_lib=$with_arx_lib fi if test "X$ac_cv_arx_where_lib" = "X"; then CMU_ARX_LIB_WHERE(/usr/athena/lib /usr/local/lib /usr/lib) fi if test "X$with_arx_include" != "X"; then ac_cv_arx_where_inc=$with_arx_include fi if test "X$ac_cv_arx_where_inc" = "X"; then CMU_ARX_INC_WHERE(/usr/athena/include /usr/local/include) fi AC_MSG_CHECKING(whether to include arx) if test "X$ac_cv_arx_where_lib" = "X" -o "X$ac_cv_arx_where_inc" = "X"; then ac_cv_found_arx=no AC_MSG_RESULT(no) else ac_cv_found_arx=yes AC_MSG_RESULT(yes) ARX_INC_DIR=$ac_cv_arx_where_inc ARX_LIB_DIR=$ac_cv_arx_where_lib ARX_INC_FLAGS="-I${ARX_INC_DIR}" ARX_LIB_FLAGS="-L${ARX_LIB_DIR} -larx" ARX_LD_FLAGS="-L${ARX_LIB_DIR}" dnl Do not force configure.in to put these in CFLAGS and LIBS unconditionally dnl Allow makefile substitutions.... AC_SUBST(ARX_INC_FLAGS) AC_SUBST(ARX_LIB_FLAGS) AC_SUBST(ARX_LD_FLAGS) if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${ARX_LIB_DIR}" else RPATH="${RPATH}:${ARX_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${ARX_LIB_DIR}" else RPATH="${RPATH}:${ARX_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${ARX_LIB_DIR}" else RPATH="${RPATH}:${ARX_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${ARX_LIB_DIR}" else RPATH="${RPATH}:${ARX_LIB_DIR}" fi else RPATH="${RPATH} -R${ARX_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) mpack-1.6/cmulocal/berkdb.m40000644005347200000120000001525707647103345011447 dnl $Id: berkdb.m4,v 1.11 2003/04/15 22:25:41 rjs3 Exp $ AC_DEFUN(CMU_DB_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1" AC_TRY_COMPILE([#include ], [DB *db; db_create(&db, NULL, 0); db->open(db, "foo.db", NULL, DB_UNKNOWN, DB_RDONLY, 0644);], ac_cv_found_db_inc=yes, ac_cv_found_db_inc=no) CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_DB_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for db headers in $i) CMU_DB_INC_WHERE1($i) CMU_TEST_INCPATH($i, db) if test "$ac_cv_found_db_inc" = "yes"; then ac_cv_db_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) # # Test for lib files # AC_DEFUN(CMU_DB3_LIB_WHERE1, [ AC_REQUIRE([CMU_AFS]) AC_REQUIRE([CMU_KRB4]) saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -ldb-3" AC_TRY_LINK(, [db_env_create();], [ac_cv_found_db_3_lib=yes], ac_cv_found_db_3_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_DB4_LIB_WHERE1, [ AC_REQUIRE([CMU_AFS]) AC_REQUIRE([CMU_KRB4]) saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -ldb-4" AC_TRY_LINK(, [db_env_create();], [ac_cv_found_db_4_lib=yes], ac_cv_found_db_4_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_DB_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for db libraries in $i) if test "$enable_db4" = "yes"; then CMU_DB4_LIB_WHERE1($i) CMU_TEST_LIBPATH($i, [db-4]) ac_cv_found_db_lib=$ac_cv_found_db_4_lib else CMU_DB3_LIB_WHERE1($i) CMU_TEST_LIBPATH($i, [db-3]) ac_cv_found_db_lib=$ac_cv_found_db_3_lib fi if test "$ac_cv_found_db_lib" = "yes" ; then ac_cv_db_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_USE_DB, [ AC_ARG_WITH(db, [ --with-db=PREFIX Compile with db support], [if test "X$with_db" = "X"; then with_db=yes fi]) AC_ARG_WITH(db-lib, [ --with-db-lib=dir use db libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-db-lib]) fi]) AC_ARG_WITH(db-include, [ --with-db-include=dir use db headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-db-include]) fi]) AC_ARG_ENABLE(db4, [ --enable-db4 use db 4.x libraries]) if test "X$with_db" != "X"; then if test "$with_db" != "yes"; then ac_cv_db_where_lib=$with_db/lib ac_cv_db_where_inc=$with_db/include fi fi if test "X$with_db_lib" != "X"; then ac_cv_db_where_lib=$with_db_lib fi if test "X$ac_cv_db_where_lib" = "X"; then CMU_DB_LIB_WHERE(/usr/athena/lib /usr/lib /usr/local/lib) fi if test "X$with_db_include" != "X"; then ac_cv_db_where_inc=$with_db_include fi if test "X$ac_cv_db_where_inc" = "X"; then CMU_DB_INC_WHERE(/usr/athena/include /usr/local/include) fi AC_MSG_CHECKING(whether to include db) if test "X$ac_cv_db_where_lib" = "X" -o "X$ac_cv_db_where_inc" = "X"; then ac_cv_found_db=no AC_MSG_RESULT(no) else ac_cv_found_db=yes AC_MSG_RESULT(yes) DB_INC_DIR=$ac_cv_db_where_inc DB_LIB_DIR=$ac_cv_db_where_lib DB_INC_FLAGS="-I${DB_INC_DIR}" if test "$enable_db4" = "yes"; then DB_LIB_FLAGS="-L${DB_LIB_DIR} -ldb-4" else DB_LIB_FLAGS="-L${DB_LIB_DIR} -ldb-3" fi dnl Do not force configure.in to put these in CFLAGS and LIBS unconditionally dnl Allow makefile substitutions.... AC_SUBST(DB_INC_FLAGS) AC_SUBST(DB_LIB_FLAGS) if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${DB_LIB_DIR}" else RPATH="${RPATH}:${DB_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${DB_LIB_DIR}" else RPATH="${RPATH}:${DB_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${DB_LIB_DIR}" else RPATH="${RPATH}:${DB_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${DB_LIB_DIR}" else RPATH="${RPATH}:${DB_LIB_DIR}" fi else RPATH="${RPATH} -R${DB_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) dnl ---- CUT HERE --- dnl These are the Cyrus Berkeley DB macros. In an ideal world these would be dnl identical to the above. dnl They are here so that they can be shared between Cyrus IMAPd dnl and Cyrus SASL with relative ease. dnl The big difference between this and the ones above is that we don't assume dnl that we know the name of the library, and we try a lot of permutations dnl instead. We also assume that DB4 is acceptable. dnl When we're done, there will be a BDB_LIBADD and a BDB_INCADD which should dnl be used when necessary. We should probably be smarter about our RPATH dnl handling. dnl Call these with BERKELEY_DB_CHK. dnl We will also set $dblib to "berkeley" if we are successful, "no" otherwise. dnl this is unbelievably painful due to confusion over what db-3 should be dnl named and where the db-3 header file is located. arg. AC_DEFUN(CYRUS_BERKELEY_DB_CHK_LIB, [ BDB_SAVE_LIBS=$LIBS if test -d $with_bdb_lib; then CMU_ADD_LIBPATH_TO($with_bdb_lib, LIBS) CMU_ADD_LIBPATH_TO($with_bdb_lib, BDB_LIBADD) else BDB_LIBADD="" fi for dbname in db-4.1 db4.1 db41 db-4.0 db4.0 db-4 db40 db4 db-3.3 db3.3 db33 db-3.2 db3.2 db32 db-3.1 db3.1 db31 db-3 db30 db3 db do AC_CHECK_LIB($dbname, db_create, BDB_LIBADD="$BDB_LIBADD -l$dbname"; dblib="berkeley"; break, dblib="no") done if test "$dblib" = "no"; then AC_CHECK_LIB(db, db_open, BDB_LIBADD="$BDB_LIBADD -ldb"; dblib="berkeley"; dbname=db, dblib="no") fi LIBS=$BDB_SAVE_LIBS ]) AC_DEFUN(CYRUS_BERKELEY_DB_OPTS, [ AC_ARG_WITH(bdb-libdir, [ --with-bdb-libdir=DIR Berkeley DB lib files are in DIR], with_bdb_lib=$withval, [ test "${with_bdb_lib+set}" = set || with_bdb_lib=none]) AC_ARG_WITH(bdb-incdir, [ --with-bdb-incdir=DIR Berkeley DB include files are in DIR], with_bdb_inc=$withval, [ test "${with_bdb_inc+set}" = set || with_bdb_inc=none ]) ]) AC_DEFUN(CYRUS_BERKELEY_DB_CHK, [ AC_REQUIRE([CYRUS_BERKELEY_DB_OPTS]) cmu_save_CPPFLAGS=$CPPFLAGS if test -d $with_bdb_inc; then CPPFLAGS="$CPPFLAGS -I$with_bdb_inc" BDB_INCADD="-I$with_bdb_inc" else BDB_INCADD="" fi dnl Note that FreeBSD puts it in a wierd place dnl (but they should use with-bdb-incdir) AC_CHECK_HEADER(db.h, CYRUS_BERKELEY_DB_CHK_LIB(), dblib="no") CPPFLAGS=$cmu_save_CPPFLAGS ]) mpack-1.6/cmulocal/bsd_sockets.m40000644005347200000120000000146107473766265012526 dnl bsd_sockets.m4--which socket libraries do we need? dnl Derrick Brashear dnl from Zephyr dnl $Id: bsd_sockets.m4,v 1.8 2002/05/25 19:57:41 leg Exp $ dnl Hacked on by Rob Earhart to not just toss stuff in LIBS dnl It now puts everything required for sockets into LIB_SOCKET AC_DEFUN(CMU_SOCKETS, [ save_LIBS="$LIBS" LIB_SOCKET="" AC_CHECK_FUNC(connect, :, AC_CHECK_LIB(nsl, gethostbyname, LIB_SOCKET="-lnsl $LIB_SOCKET") AC_CHECK_LIB(socket, connect, LIB_SOCKET="-lsocket $LIB_SOCKET") ) LIBS="$LIB_SOCKET $save_LIBS" AC_CHECK_FUNC(res_search, :, AC_CHECK_LIB(resolv, res_search, LIB_SOCKET="-lresolv $LIB_SOCKET") ) LIBS="$LIB_SOCKET $save_LIBS" AC_CHECK_FUNCS(dn_expand dns_lookup) LIBS="$save_LIBS" AC_SUBST(LIB_SOCKET) ]) mpack-1.6/cmulocal/c-attribute.m40000644005347200000120000000106007054701334012416 dnl dnl $Id: c-attribute.m4,v 1.2 2000/02/23 06:49:00 leg Exp $ dnl dnl dnl Test for __attribute__ dnl AC_DEFUN(CMU_C___ATTRIBUTE__, [ AC_MSG_CHECKING(for __attribute__) AC_CACHE_VAL(ac_cv___attribute__, [ AC_TRY_COMPILE([ #include ], [ static void foo(void) __attribute__ ((noreturn)); static void foo(void) { exit(1); } ], ac_cv___attribute__=yes, ac_cv___attribute__=no)]) if test "$ac_cv___attribute__" = "yes"; then AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__]) fi AC_MSG_RESULT($ac_cv___attribute__) ]) mpack-1.6/cmulocal/c-fpic.m40000644005347200000120000000074607672364371011362 dnl dnl $Id: c-fpic.m4,v 1.1 2003/06/13 15:08:41 rjs3 Exp $ dnl dnl dnl Test for -fPIC dnl AC_DEFUN(CMU_C_FPIC, [ AC_MSG_CHECKING(if compiler supports -fPIC) AC_CACHE_VAL(ac_cv_fpic, [ save_CFLAGS=$CFLAGS CFLAGS="${CFLAGS} -fPIC" AC_TRY_COMPILE([ #include ], [ static void foo(void) { exit(1); } ], ac_cv_fpic=yes, ac_cv_fpic=no) CFLAGS=$save_CFLAGS ]) if test "$ac_cv_fpic" = "yes"; then FPIC_CFLAGS="-fPIC" else FPIC_CFLAGS="" fi AC_MSG_RESULT($ac_cv_fpic) ]) mpack-1.6/cmulocal/com_err.m40000644005347200000120000000157007473766265011652 dnl com_err.m4--com_err detection macro dnl Rob Earhart dnl $Id: com_err.m4,v 1.5 2002/05/25 19:57:41 leg Exp $ AC_DEFUN(CMU_COMERR, [ cmu_need_compile_et=no AC_CHECK_PROGS(COMPILE_ET, compile_et, no) if test "$COMPILE_ET" = no; then COMPILE_ET="\$(top_builddir)/com_err/compile_et" cmu_need_to_compile_com_err=yes fi AC_CHECK_HEADER(com_err.h,,CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/com_err") cmu_save_LIBS="$LIBS" AC_CHECK_LIB(com_err, com_err, LIB_COMERR="-lcom_err", LDFLAGS="$LDFLAGS -L`pwd`/com_err" LIB_COMERR="\$(top_builddir)/com_err/libcom_err.la" cmu_need_to_compile_com_err=yes) AC_SUBST(LIB_COMERR) LIBS="$cmu_save_LIBS" AC_MSG_CHECKING(whether we need to compile com_err) if test "$cmu_need_to_compile_com_err" = yes; then AC_MSG_RESULT(yes) AC_CONFIG_SUBDIRS(com_err) else AC_MSG_RESULT(no) fi ]) mpack-1.6/cmulocal/com_err_link.m40000644005347200000120000001003007601133210012621 dnl damnit, i don't want to figure out if I need to build an integral com_err dnl library with the collection, I just want to know where it's installed, dnl so don't bitch, Rob... dnl Derrick Brashear dnl $Id: com_err_link.m4,v 1.6 2002/12/21 18:44:24 cg2v Exp $ AC_DEFUN(CMU_COMERR_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1" AC_TRY_COMPILE([#include ], [int foo;], ac_cv_found_com_err_inc=yes, ac_cv_found_com_err_inc=no) CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_COMERR_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for com_err headers in $i) CMU_COMERR_INC_WHERE1($i) CMU_TEST_INCPATH($i, com_err) if test "$ac_cv_found_com_err_inc" = "yes"; then ac_cv_comerr_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) # # Test for lib files # AC_DEFUN(CMU_COMERR_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lcom_err" AC_TRY_LINK(, [com_err();], [ac_cv_found_com_err_lib=yes], ac_cv_found_com_err_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_COMERR_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for com_err libraries in $i) CMU_COMERR_LIB_WHERE1($i) CMU_TEST_LIBPATH($i, com_err) if test "$ac_cv_found_com_err_lib" = "yes" ; then ac_cv_comerr_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_USE_COMERR, [ AC_ARG_WITH(comerr, [ --with-comerr=PREFIX Compile with com_err support], [if test "X$with_comerr" = "X"; then with_comerr=yes fi]) AC_ARG_WITH(comerr-lib, [ --with-comerr-lib=dir use com_err libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-comerr-lib]) fi]) AC_ARG_WITH(comerr-include, [ --with-comerr-include=dir use com_err headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-comerr-include]) fi]) if test "X$with_comerr" != "X"; then if test "$with_comerr" != "yes"; then ac_cv_comerr_where_lib=$with_comerr/lib ac_cv_comerr_where_inc=$with_comerr/include fi fi if test "X$with_comerr_lib" != "X"; then ac_cv_comerr_where_lib=$with_comerr_lib fi if test "X$ac_cv_comerr_where_lib" = "X"; then CMU_COMERR_LIB_WHERE(/usr/athena/lib /usr/lib /usr/local/lib) fi if test "X$with_comerr_include" != "X"; then ac_cv_comerr_where_inc=$with_comerr_include fi if test "X$ac_cv_comerr_where_inc" = "X"; then CMU_COMERR_INC_WHERE(/usr/athena/include /usr/local/include) fi AC_MSG_CHECKING(whether to include com_err) if test "X$ac_cv_comerr_where_lib" = "X" -a "X$ac_cv_comerr_where_inc" = "X"; then ac_cv_found_com_err=no AC_MSG_RESULT(no) else ac_cv_found_com_err=yes AC_MSG_RESULT(yes) COMERR_INC_DIR=$ac_cv_comerr_where_inc COMERR_LIB_DIR=$ac_cv_comerr_where_lib COMERR_INC_FLAGS="-I${COMERR_INC_DIR}" COMERR_LIB_FLAGS="-L${COMERR_LIB_DIR} -lcom_err" dnl Do not force configure.in to put these in CFLAGS and LIBS unconditionally dnl Allow makefile substitutions.... AC_SUBST(COMERR_INC_FLAGS) AC_SUBST(COMERR_LIB_FLAGS) if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${COMERR_LIB_DIR}" else RPATH="${RPATH}:${COMERR_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${COMERR_LIB_DIR}" else RPATH="${RPATH}:${COMERR_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${COMERR_LIB_DIR}" else RPATH="${RPATH}:${COMERR_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${COMERR_LIB_DIR}" else RPATH="${RPATH}:${COMERR_LIB_DIR}" fi else RPATH="${RPATH} -R${COMERR_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) mpack-1.6/cmulocal/common.m40000644005347200000120000000215007526570636011501 dnl $Id: common.m4,v 1.10 2002/08/15 00:11:10 cg2v Exp $ AC_DEFUN(CMU_TEST_LIBPATH, [ changequote(<<, >>) define(<>, translit(ac_cv_found_$2_lib, <<- *>>, <<__p>>)) changequote([, ]) if test "$CMU_AC_CV_FOUND" = "yes"; then if test \! -r "$1/lib$2.a" -a \! -r "$1/lib$2.so" -a \! -r "$1/lib$2.sl"; then CMU_AC_CV_FOUND=no fi fi ]) AC_DEFUN(CMU_TEST_INCPATH, [ changequote(<<, >>) define(<>, translit(ac_cv_found_$2_inc, [ *], [_p])) changequote([, ]) if test "$CMU_AC_CV_FOUND" = "yes"; then if test \! -r "$1/$2.h"; then CMU_AC_CV_FOUND=no fi fi ]) dnl CMU_CHECK_HEADER_NOCACHE(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) AC_DEFUN(CMU_CHECK_HEADER_NOCACHE, [dnl Do the transliteration at runtime so arg 1 can be a shell variable. ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` AC_MSG_CHECKING([for $1]) AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes", eval "ac_cv_header_$ac_safe=no") if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) ifelse([$3], , , [$3 ])dnl fi ]) mpack-1.6/cmulocal/cyrus.m40000644005347200000120000000254507473766266011375 dnl dnl Additional macros for configure.in packaged up for easier theft. dnl $Id: cyrus.m4,v 1.3 2002/05/25 19:57:42 leg Exp $ dnl tjs@andrew.cmu.edu 6-may-1998 dnl dnl It would be good if ANDREW_ADD_LIBPATH could detect if something was dnl already there and not redundantly add it if it is. dnl add -L(arg), and possibly (runpath switch)(arg), to LDFLAGS dnl (so the runpath for shared libraries is set). AC_DEFUN(CMU_ADD_LIBPATH, [ # this is CMU ADD LIBPATH if test "$andrew_runpath_switch" = "none" ; then LDFLAGS="-L$1 ${LDFLAGS}" else LDFLAGS="-L$1 $andrew_runpath_switch$1 ${LDFLAGS}" fi ]) dnl add -L(1st arg), and possibly (runpath switch)(1st arg), to (2nd arg) dnl (so the runpath for shared libraries is set). AC_DEFUN(CMU_ADD_LIBPATH_TO, [ # this is CMU ADD LIBPATH TO if test "$andrew_runpath_switch" = "none" ; then $2="-L$1 ${$2}" else $2="-L$1 ${$2} $andrew_runpath_switch$1" fi ]) dnl runpath initialization AC_DEFUN(CMU_GUESS_RUNPATH_SWITCH, [ # CMU GUESS RUNPATH SWITCH AC_CACHE_CHECK(for runpath switch, andrew_runpath_switch, [ # first, try -R SAVE_LDFLAGS="${LDFLAGS}" LDFLAGS="-R /usr/lib" AC_TRY_LINK([],[],[andrew_runpath_switch="-R"], [ LDFLAGS="-Wl,-rpath,/usr/lib" AC_TRY_LINK([],[],[andrew_runpath_switch="-Wl,-rpath,"], [andrew_runpath_switch="none"]) ]) LDFLAGS="${SAVE_LDFLAGS}" ])]) mpack-1.6/cmulocal/db.m40000644005347200000120000000154607262660306010575 dnl $Id: db.m4,v 1.1 2001/04/04 17:58:30 shadow Exp $ dnl dnl tests for various db libraries dnl AC_DEFUN([rk_DB],[berkeley_db=db AC_ARG_WITH(berkeley-db, [ --without-berkeley-db if you don't want berkeley db],[ if test "$withval" = no; then berkeley_db="" fi ]) if test "$berkeley_db"; then AC_CHECK_HEADERS([ \ db.h \ db_185.h \ ]) fi AC_FIND_FUNC_NO_LIBS2(dbopen, $berkeley_db, [ #include #if defined(HAVE_DB_185_H) #include #elif defined(HAVE_DB_H) #include #endif ],[NULL, 0, 0, 0, NULL]) AC_FIND_FUNC_NO_LIBS(dbm_firstkey, $berkeley_db gdbm ndbm) AC_FIND_FUNC_NO_LIBS(db_create, $berkeley_db) DBLIB="$LIB_dbopen" if test "$LIB_dbopen" != "$LIB_db_create"; then DBLIB="$DBLIB $LIB_db_create" fi if test "$LIB_dbopen" != "$LIB_dbm_firstkey"; then DBLIB="$DBLIB $LIB_dbm_firstkey" fi AC_SUBST(DBLIB)dnl ]) mpack-1.6/cmulocal/find-func-no-libs.m40000644005347200000120000000050107262660306013410 dnl $Id: find-func-no-libs.m4,v 1.1 2001/04/04 17:58:30 shadow Exp $ dnl dnl dnl Look for function in any of the specified libraries dnl dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments, extra libs, extra args) AC_DEFUN(AC_FIND_FUNC_NO_LIBS, [ AC_FIND_FUNC_NO_LIBS2([$1], ["" $2], [$3], [$4], [$5], [$6])]) mpack-1.6/cmulocal/find-func-no-libs2.m40000644005347200000120000000272107262660306013500 dnl $Id: find-func-no-libs2.m4,v 1.1 2001/04/04 17:58:30 shadow Exp $ dnl dnl dnl Look for function in any of the specified libraries dnl dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args) AC_DEFUN(AC_FIND_FUNC_NO_LIBS2, [ AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(ac_cv_funclib_$1, [ if eval "test \"\$ac_cv_func_$1\" != yes" ; then ac_save_LIBS="$LIBS" for ac_lib in $2; do if test -n "$ac_lib"; then ac_lib="-l$ac_lib" else ac_lib="" fi LIBS="$6 $ac_lib $5 $ac_save_LIBS" AC_TRY_LINK([$3],[$1($4)],eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break) done eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}" LIBS="$ac_save_LIBS" fi ]) eval "ac_res=\$ac_cv_funclib_$1" if false; then AC_CHECK_FUNCS($1) dnl AC_CHECK_LIBS($2, foo) fi # $1 ac_tr_func=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` ac_tr_lib=HAVE_LIB_`echo $ac_res |sed 's/-l//' | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` eval "LIB_$1=$ac_res" case "$ac_res" in yes) eval "ac_cv_func_$1=yes" eval "LIB_$1=" AC_DEFINE_UNQUOTED($ac_tr_func) AC_MSG_RESULT([yes]) ;; no) eval "ac_cv_func_$1=no" eval "LIB_$1=" AC_MSG_RESULT([no]) ;; *) eval "ac_cv_func_$1=yes" eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes" AC_DEFINE_UNQUOTED($ac_tr_func) AC_DEFINE_UNQUOTED($ac_tr_lib) AC_MSG_RESULT([yes, in $ac_res]) ;; esac AC_SUBST(LIB_$1) ]) mpack-1.6/cmulocal/find-func.m40000644005347200000120000000036507262660306012057 dnl $Id: find-func.m4,v 1.1 2001/04/04 17:58:30 shadow Exp $ dnl dnl AC_FIND_FUNC(func, libraries, includes, arguments) AC_DEFUN(AC_FIND_FUNC, [ AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4]) if test -n "$LIB_$1"; then LIBS="$LIB_$1 $LIBS" fi ]) mpack-1.6/cmulocal/heimdal.m40000644005347200000120000001266007601133210011574 dnl kerberos_v5.m4--Kerberos 5 libraries and includes dnl Derrick Brashear dnl from KTH krb and Arla dnl $Id: heimdal.m4,v 1.6 2002/12/21 18:44:24 cg2v Exp $ AC_DEFUN(CMU_LIBHEIMDAL_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1" AC_TRY_COMPILE([#include ], [krb5_keyblock foo;], ac_cv_found_libheimdal_inc=yes, ac_cv_found_libheimdal_inc=no) CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_LIBHEIMDAL_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for heimdal headers in $i) CMU_LIBHEIMDAL_INC_WHERE1($i) CMU_TEST_INCPATH($i, krb5) if test "$ac_cv_found_libheimdal_inc" = "yes"; then ac_cv_libheimdal_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) # # Test for kerberos lib files # AC_DEFUN(CMU_LIBHEIMDAL_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lkadm5clnt -lkrb5 -lasn1 -lkadm5clnt -lroken -lresolv" AC_TRY_LINK(, [krb5_get_in_tkt();], [ac_cv_found_libheimdal_lib=yes], ac_cv_found_libheimdal_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_LIBHEIMDAL_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for heimdal libraries in $i) CMU_LIBHEIMDAL_LIB_WHERE1($i) CMU_TEST_LIBPATH($i, krb5) if test "$ac_cv_found_libheimdal_lib" = "yes" ; then ac_cv_libheimdal_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_LIBHEIMDAL, [ AC_REQUIRE([CMU_SOCKETS]) AC_REQUIRE([CMU_USE_COMERR]) AC_REQUIRE([CMU_LIBSSL]) AC_ARG_WITH(LIBHEIMDAL, [ --with-libheimdal=PREFIX Compile with Heimdal support], [if test "X$with_libheimdal" = "X"; then with_libheimdal=yes fi]) AC_ARG_WITH(libheimdal-lib, [ --with-libheimdal-lib=dir use heimdal libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-libheimdal-lib]) fi]) AC_ARG_WITH(libheimdal-include, [ --with-libheimdal-include=dir use heimdal headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-libheimdal-include]) fi]) if test "X$with_libheimdal" != "X"; then if test "$with_libheimdal" != "yes" -a "$with_libheimdal" != "no"; then ac_cv_libheimdal_where_lib=$with_libheimdal/lib ac_cv_libheimdal_where_inc=$with_libheimdal/include fi fi if test "$with_libheimdal" != "no"; then if test "X$with_libheimdal_lib" != "X"; then ac_cv_libheimdal_where_lib=$with_libheimdal_lib fi if test "X$ac_cv_libheimdal_where_lib" = "X"; then CMU_LIBHEIMDAL_LIB_WHERE(/usr/athena/lib /usr/lib /usr/heimdal/lib /usr/local/lib) fi if test "X$with_libheimdal_include" != "X"; then ac_cv_libheimdal_where_inc=$with_libheimdal_include fi if test "X$ac_cv_libheimdal_where_inc" = "X"; then CMU_LIBHEIMDAL_INC_WHERE(/usr/athena/include /usr/heimdal/include /usr/local/include) fi fi AC_MSG_CHECKING([if libdes is needed]) AC_TRY_LINK([],[des_quad_cksum();],HEIM_DES_LIB="",HEIM_DES_LIB="maybe") if test "X$HEIM_DES_LIB" != "X"; then LIBS="$cmu_save_LIBS -ldes" AC_TRY_LINK([], [des_quad_cksum();],HEIM_DES_LIB="yes") if test "X$HEIM_DES_LIB" = "Xyes"; then AC_MSG_RESULT([yes]) HEIM_LIBDES="-ldes" HEIM_LIBDESA="${LIBHEIMDAL_LIB_DIR}/libdes.a" else LIBS="$cmu_save_LIBS $LIBSSL_LIB_FLAGS" AC_TRY_LINK([], [des_quad_cksum();],HEIM_DES_LIB="libcrypto") if test "X$HEIM_DES_LIB" = "Xlibcrypto"; then AC_MSG_RESULT([libcrypto]) HEIM_LIBDES="$LIBSSL_LIB_FLAGS" HEIM_LIBDESA="$LIBSSL_LIB_FLAGS" else AC_MSG_RESULT([unknown]) AC_MSG_ERROR([Could not use -ldes]) fi fi else AC_MSG_RESULT([no]) fi AC_MSG_CHECKING(whether to include heimdal) if test "X$ac_cv_libheimdal_where_lib" = "X" -a "X$ac_cv_libheimdal_where_inc" = "X"; then ac_cv_found_libheimdal=no AC_MSG_RESULT(no) else ac_cv_found_libheimdal=yes AC_MSG_RESULT(yes) LIBHEIMDAL_INC_DIR=$ac_cv_libheimdal_where_inc LIBHEIMDAL_LIB_DIR=$ac_cv_libheimdal_where_lib LIBHEIMDAL_INC_FLAGS="-I${LIBHEIMDAL_INC_DIR}" LIBHEIMDAL_LIB_FLAGS="-L${LIBHEIMDAL_LIB_DIR} -lkadm5clnt -lkrb5 -lasn1 ${HEIM_LIBDES} -lroken -lresolv" AC_SUBST(LIBHEIMDAL_INC_FLAGS) AC_SUBST(LIBHEIMDAL_LIB_FLAGS) if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${LIBHEIMDAL_LIB_DIR}" else RPATH="${RPATH}:${LIBHEIMDAL_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${LIBHEIMDAL_LIB_DIR}" else RPATH="${RPATH}:${LIBHEIMDAL_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${LIBHEIMDAL_LIB_DIR}" else RPATH="${RPATH}:${LIBHEIMDAL_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${LIBHEIMDAL_LIB_DIR}" else RPATH="${RPATH}:${LIBHEIMDAL_LIB_DIR}" fi else RPATH="${RPATH} -R${LIBHEIMDAL_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) mpack-1.6/cmulocal/init_automake.m40000644005347200000120000000036407473766266013056 dnl init_automake.m4--cmulocal automake setup macro dnl Rob Earhart dnl $Id: init_automake.m4,v 1.3 2002/05/25 19:57:42 leg Exp $ AC_DEFUN(CMU_INIT_AUTOMAKE, [ AC_REQUIRE([AM_INIT_AUTOMAKE]) ACLOCAL="$ACLOCAL -I \$(top_srcdir)/cmulocal" ]) mpack-1.6/cmulocal/ipv6.m40000644005347200000120000000514307607351362011073 dnl See whether we can use IPv6 related functions dnl contributed by Hajimu UMEMOTO AC_DEFUN(IPv6_CHECK_FUNC, [ AC_CHECK_FUNC($1, [dnl ac_cv_lib_socket_$1=no ac_cv_lib_inet6_$1=no ], [dnl AC_CHECK_LIB(socket, $1, [dnl LIBS="$LIBS -lsocket" ac_cv_lib_inet6_$1=no ], [dnl AC_MSG_CHECKING([whether your system has IPv6 directory]) AC_CACHE_VAL(ipv6_cv_dir, [dnl for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then break fi done])dnl AC_MSG_RESULT($ipv6_cv_dir) if test $ipv6_cv_dir = no; then ac_cv_lib_inet6_$1=no else if test x$ipv6_libinet6 = x; then ipv6_libinet6=no SAVELDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib" fi AC_CHECK_LIB(inet6, $1, [dnl if test $ipv6_libinet6 = no; then ipv6_libinet6=yes LIBS="$LIBS -linet6" fi],)dnl if test $ipv6_libinet6 = no; then LDFLAGS="$SAVELDFLAGS" fi fi])dnl ])dnl if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \ -o $ac_cv_lib_inet6_$1 = yes then ipv6_cv_$1=yes ifelse([$2], , :, [$2]) else ipv6_cv_$1=no ifelse([$3], , :, [$3]) fi]) dnl See whether we have ss_family in sockaddr_storage AC_DEFUN(IPv6_CHECK_SS_FAMILY, [ AC_MSG_CHECKING([whether you have ss_family in struct sockaddr_storage]) AC_CACHE_VAL(ipv6_cv_ss_family, [dnl AC_TRY_COMPILE([#include #include ], [struct sockaddr_storage ss; int i = ss.ss_family;], [ipv6_cv_ss_family=yes], [ipv6_cv_ss_family=no])])dnl if test $ipv6_cv_ss_family = yes; then ifelse([$1], , AC_DEFINE(HAVE_SS_FAMILY), [$1]) else ifelse([$2], , :, [$2]) fi AC_MSG_RESULT($ipv6_cv_ss_family)]) dnl whether you have sa_len in struct sockaddr AC_DEFUN(IPv6_CHECK_SA_LEN, [ AC_MSG_CHECKING([whether you have sa_len in struct sockaddr]) AC_CACHE_VAL(ipv6_cv_sa_len, [dnl AC_TRY_COMPILE([#include #include ], [struct sockaddr sa; int i = sa.sa_len;], [ipv6_cv_sa_len=yes], [ipv6_cv_sa_len=no])])dnl if test $ipv6_cv_sa_len = yes; then ifelse([$1], , AC_DEFINE(HAVE_SOCKADDR_SA_LEN), [$1]) else ifelse([$2], , :, [$2]) fi AC_MSG_RESULT($ipv6_cv_sa_len)]) dnl See whether sys/socket.h has socklen_t AC_DEFUN(IPv6_CHECK_SOCKLEN_T, [ AC_MSG_CHECKING(for socklen_t) AC_CACHE_VAL(ipv6_cv_socklen_t, [dnl AC_TRY_LINK([#include #include ], [socklen_t len = 0;], [ipv6_cv_socklen_t=yes], [ipv6_cv_socklen_t=no])])dnl if test $ipv6_cv_socklen_t = yes; then ifelse([$1], , AC_DEFINE(HAVE_SOCKLEN_T), [$1]) else ifelse([$2], , :, [$2]) fi AC_MSG_RESULT($ipv6_cv_socklen_t)]) mpack-1.6/cmulocal/kafs.m40000644005347200000120000001017507601133210011114 dnl kerberos_v4.m4--Kafs libraries and includes dnl Derrick Brashear dnl from KTH kafs and Arla dnl $Id: kafs.m4,v 1.5 2002/12/21 18:44:24 cg2v Exp $ AC_DEFUN(CMU_KAFS_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1" AC_TRY_COMPILE([ #include #include #include ], [struct ClearToken foo;], ac_cv_found_kafs_inc=yes, ac_cv_found_kafs_inc=no) if test "$ac_cv_found_kafs_inc" = "no"; then CPPFLAGS="$saved_CPPFLAGS -I$1 -I$1/kerberosIV" AC_TRY_COMPILE([ #include #include #include ], [struct ClearToken foo;], [ac_cv_found_kafs_inc=yes], ac_cv_found_kafs_inc=no) fi CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_KAFS_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for kafs headers in $i) CMU_KAFS_INC_WHERE1($i) CMU_TEST_INCPATH($i, kafs) if test "$ac_cv_found_kafs_inc" = "yes"; then ac_cv_kafs_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_KAFS_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lkafs $KRB_LIB_FLAGS $KRB5_LIB_FLAGS" AC_TRY_LINK(, [krb_afslog();], [ac_cv_found_kafs_lib=yes], ac_cv_found_kafs_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_KAFS_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for kafs libraries in $i) CMU_KAFS_LIB_WHERE1($i) dnl deal with false positives from implicit link paths CMU_TEST_LIBPATH($i, kafs) if test "$ac_cv_found_kafs_lib" = "yes" ; then ac_cv_kafs_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_KAFS, [ AC_REQUIRE([CMU_SOCKETS]) AC_REQUIRE([CMU_KRB4]) AC_REQUIRE([CMU_KRB5]) AC_ARG_WITH(kafs, [ --with-kafs=PREFIX Compile with Kafs support], [if test "X$with_kafs" = "X"; then with_kafs=yes fi]) AC_ARG_WITH(kafs-lib, [ --with-kafs-lib=dir use kafs libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-kafs-lib]) fi]) AC_ARG_WITH(kafs-include, [ --with-kafs-include=dir use kafs headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-kafs-include]) fi]) if test "X$with_kafs" != "X"; then if test "$with_kafs" != "yes" -a "$with_kafs" != no; then ac_cv_kafs_where_lib=$with_kafs/lib ac_cv_kafs_where_inc=$with_kafs/include fi fi if test "$with_kafs" != "no"; then if test "X$with_kafs_lib" != "X"; then ac_cv_kafs_where_lib=$with_kafs_lib fi if test "X$ac_cv_kafs_where_lib" = "X"; then CMU_KAFS_LIB_WHERE(/usr/athena/lib /usr/local/lib /usr/lib) fi if test "X$with_kafs_include" != "X"; then ac_cv_kafs_where_inc=$with_kafs_include fi if test "X$ac_cv_kafs_where_inc" = "X"; then CMU_KAFS_INC_WHERE(/usr/athena/include /usr/include/kerberosIV /usr/local/include /usr/include/kerberos) fi fi AC_MSG_CHECKING(whether to include kafs) if test "X$ac_cv_kafs_where_lib" = "X" -a "X$ac_cv_kafs_where_inc" = "X"; then ac_cv_found_kafs=no AC_MSG_RESULT(no) else ac_cv_found_kafs=yes AC_MSG_RESULT(yes) KAFS_INC_DIR=$ac_cv_kafs_where_inc KAFS_LIB_DIR=$ac_cv_kafs_where_lib KAFS_INC_FLAGS="-I${KAFS_INC_DIR}" KAFS_LIB_FLAGS="-L${KAFS_LIB_DIR} -lkafs" if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${KAFS_LIB_DIR}" else RPATH="${RPATH}:${KAFS_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${KAFS_LIB_DIR}" else RPATH="${RPATH}:${KAFS_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${KAFS_LIB_DIR}" else RPATH="${RPATH}:${KAFS_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${KAFS_LIB_DIR}" else RPATH="${RPATH}:${KAFS_LIB_DIR}" fi else RPATH="${RPATH} -R${KAFS_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) mpack-1.6/cmulocal/kerberos_v4.m40000644005347200000120000001745507603502136012436 dnl kerberos_v4.m4--Kerberos 4 libraries and includes dnl Derrick Brashear dnl from KTH krb and Arla dnl $Id: kerberos_v4.m4,v 1.25 2002/12/29 05:13:02 cg2v Exp $ AC_DEFUN(CMU_KRB_SENDAUTH_PROTO, [ AC_MSG_CHECKING(for krb_sendauth prototype) AC_TRY_COMPILE( [#include int krb_sendauth (long options, int fd, KTEXT ktext, char *service, char *inst, char *realm, u_long checksum, MSG_DAT *msg_data, CREDENTIALS *cred, Key_schedule schedule, struct sockaddr_in *laddr, struct sockaddr_in *faddr, char *version);], [int foo = krb_sendauth(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); ], ac_cv_krb_sendauth_proto=no, ac_cv_krb_sendauth_proto=yes) AC_MSG_RESULT($ac_cv_krb_sendauth_proto) if test "$ac_cv_krb_sendauth_proto" = yes; then AC_DEFINE(HAVE_KRB_SENDAUTH_PROTO)dnl fi AC_MSG_RESULT($ac_cv_krb_sendauth_proto) ]) AC_DEFUN(CMU_KRB_SET_KEY_PROTO, [ AC_MSG_CHECKING(for krb_set_key prototype) AC_CACHE_VAL(ac_cv_krb_set_key_proto, [ cmu_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="${CPPFLAGS} ${KRB_INC_FLAGS}" AC_TRY_COMPILE( [#include int krb_set_key(char *key, int cvt);], [int foo = krb_set_key(0, 0);], ac_cv_krb_set_key_proto=no, ac_cv_krb_set_key_proto=yes) ]) CPPFLAGS="${cmu_save_CPPFLAGS}" if test "$ac_cv_krb_set_key_proto" = yes; then AC_DEFINE(HAVE_KRB_SET_KEY_PROTO)dnl fi AC_MSG_RESULT($ac_cv_krb_set_key_proto) ]) AC_DEFUN(CMU_KRB4_32_DEFN, [ AC_MSG_CHECKING(for KRB4_32 definition) AC_CACHE_VAL(ac_cv_krb4_32_defn, [ cmu_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="${CPPFLAGS} ${KRB_INC_FLAGS}" AC_TRY_COMPILE( [#include ], [KRB4_32 foo = 1;], ac_cv_krb4_32_defn=yes, ac_cv_krb4_32_defn=no) ]) CPPFLAGS="${cmu_save_CPPFLAGS}" if test "$ac_cv_krb4_32_defn" = yes; then AC_DEFINE(HAVE_KRB4_32_DEFINE)dnl fi AC_MSG_RESULT($ac_cv_krb4_32_defn) ]) AC_DEFUN(CMU_KRB_RD_REQ_PROTO, [ AC_MSG_CHECKING(for krb_rd_req prototype) AC_CACHE_VAL(ac_cv_krb_rd_req_proto, [ cmu_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="${CPPFLAGS} ${KRB_INC_FLAGS}" AC_TRY_COMPILE( [#include int krb_rd_req(KTEXT authent, char *service, char *instance, unsigned KRB_INT32 from_addr, AUTH_DAT *ad, char *fn);], [int foo = krb_rd_req(0,0,0,0,0,0);], ac_cv_krb_rd_req_proto=no, ac_cv_krb_rd_req_proto=yes) ]) CPPFLAGS="${cmu_save_CPPFLAGS}" if test "$ac_cv_krb_rd_req_proto" = yes; then AC_DEFINE(HAVE_KRB_RD_REQ_PROTO)dnl fi AC_MSG_RESULT($ac_cv_krb_rd_req_proto) ]) AC_DEFUN(CMU_KRB_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1" AC_TRY_COMPILE([#include ], [struct ktext foo;], ac_cv_found_krb_inc=yes, ac_cv_found_krb_inc=no) if test "$ac_cv_found_krb_inc" = "no"; then CPPFLAGS="$saved_CPPFLAGS -I$1 -I$1/kerberosIV" AC_TRY_COMPILE([#include ], [struct ktext foo;], [ac_cv_found_krb_inc=yes], ac_cv_found_krb_inc=no) fi CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_KRB_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for kerberos headers in $i) CMU_KRB_INC_WHERE1($i) CMU_TEST_INCPATH($i, krb) if test "$ac_cv_found_krb_inc" = "yes"; then ac_cv_krb_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) # # Test for kerberos lib files # AC_DEFUN(CMU_KRB_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lkrb $KRB_LIBDES" AC_TRY_LINK(, [dest_tkt();], [ac_cv_found_krb_lib=yes], ac_cv_found_krb_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_KRB_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for kerberos libraries in $i) CMU_KRB_LIB_WHERE1($i) dnl deal with false positives from implicit link paths CMU_TEST_LIBPATH($i, krb) if test "$ac_cv_found_krb_lib" = "yes" ; then ac_cv_krb_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_KRB4, [ AC_REQUIRE([CMU_SOCKETS]) AC_REQUIRE([CMU_LIBSSL]) AC_ARG_WITH(krb4, [ --with-krb4=PREFIX Compile with Kerberos 4 support], [if test "X$with_krb4" = "X"; then with_krb4=yes fi]) AC_ARG_WITH(krb4-lib, [ --with-krb4-lib=dir use kerberos 4 libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-krb4-lib]) fi]) AC_ARG_WITH(krb4-include, [ --with-krb4-include=dir use kerberos 4 headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-krb4-include]) fi]) if test "X$with_krb4" != "X"; then if test "$with_krb4" != "yes" -a "$with_krb4" != "no"; then ac_cv_krb_where_lib=$with_krb4/lib ac_cv_krb_where_inc=$with_krb4/include fi fi if test "$with_krb4" != "no"; then if test "X$with_krb4_lib" != "X"; then ac_cv_krb_where_lib=$with_krb4_lib fi if test "X$with_krb4_include" != "X"; then ac_cv_krb_where_inc=$with_krb4_include fi if test "X$ac_cv_krb_where_inc" = "X"; then CMU_KRB_INC_WHERE(/usr/athena/include /usr/include/kerberosIV /usr/local/include /usr/include/kerberos) fi fi AC_MSG_CHECKING([if libdes is needed]) AC_TRY_LINK([],[des_quad_cksum();],KRB_DES_LIB="",KRB_DES_LIB="maybe") if test "X$KRB_DES_LIB" != "X"; then LIBS="$cmu_save_LIBS -ldes" AC_TRY_LINK([], [des_quad_cksum();],KRB_DES_LIB="yes") if test "X$KRB_DES_LIB" = "Xyes"; then AC_MSG_RESULT([yes]) KRB_LIBDES="-ldes" KRB_LIBDESA="${KRB_LIB_DIR}/libdes.a" else LIBS="$cmu_save_LIBS $LIBSSL_LIB_FLAGS" AC_TRY_LINK([], [des_quad_cksum();],KRB_DES_LIB="libcrypto") if test "X$KRB_DES_LIB" = "Xlibcrypto"; then AC_MSG_RESULT([libcrypto]) KRB_LIBDES="$LIBSSL_LIB_FLAGS" KRB_LIBDESA="$LIBSSL_LIB_FLAGS" else AC_MSG_RESULT([unknown]) AC_MSG_ERROR([Could not use -ldes]) fi fi else AC_MSG_RESULT([no]) fi LIBS="${cmu_save_LIBS}" if test "X$ac_cv_krb_where_lib" = "X"; then CMU_KRB_LIB_WHERE(/usr/athena/lib /usr/local/lib /usr/lib) fi AC_MSG_CHECKING(whether to include kerberos 4) if test "X$ac_cv_krb_where_lib" = "X" -o "X$ac_cv_krb_where_inc" = "X"; then ac_cv_found_krb=no AC_MSG_RESULT(no) else ac_cv_found_krb=yes AC_MSG_RESULT(yes) KRB_INC_DIR=$ac_cv_krb_where_inc KRB_LIB_DIR=$ac_cv_krb_where_lib KRB_INC_FLAGS="-I${KRB_INC_DIR}" KRB_LIB_FLAGS="-L${KRB_LIB_DIR} -lkrb ${KRB_LIBDES}" LIBS="${cmu_save_LIBS} ${KRB_LIB_FLAGS}" AC_CHECK_LIB(resolv, dns_lookup, KRB_LIB_FLAGS="${KRB_LIB_FLAGS} -lresolv",,"${KRB_LIB_FLAGS}") AC_CHECK_LIB(crypt, crypt, KRB_LIB_FLAGS="${KRB_LIB_FLAGS} -lcrypt",,"${KRB_LIB_FLAGS}") AC_CHECK_FUNCS(krb_get_int krb_life_to_time) AC_SUBST(KRB_INC_FLAGS) AC_SUBST(KRB_LIB_FLAGS) LIBS="${cmu_save_LIBS}" AC_DEFINE(KERBEROS,,[Use kerberos 4. find out what needs this symbol]) if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${KRB_LIB_DIR}" else RPATH="${RPATH}:${KRB_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${KRB_LIB_DIR}" else RPATH="${RPATH}:${KRB_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${KRB_LIB_DIR}" else RPATH="${RPATH}:${KRB_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${KRB_LIB_DIR}" else RPATH="${RPATH}:${KRB_LIB_DIR}" fi else RPATH="${RPATH} -R${KRB_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) mpack-1.6/cmulocal/kerberos_v5.m40000644005347200000120000001163407601133210012417 dnl kerberos_v5.m4--Kerberos 5 libraries and includes dnl Derrick Brashear dnl from KTH krb and Arla dnl $Id: kerberos_v5.m4,v 1.6 2002/12/21 18:44:24 cg2v Exp $ AC_DEFUN(CMU_KRB5_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1" AC_TRY_COMPILE([#include ], [krb5_keyblock foo;], ac_cv_found_krb5_inc=yes, ac_cv_found_krb5_inc=no) CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_KRB5_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for krb5 headers in $i) CMU_KRB5_INC_WHERE1($i) CMU_TEST_INCPATH($i, krb5) if test "$ac_cv_found_krb5_inc" = "yes"; then ac_cv_krb5_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) # # Test for kerberos lib files # AC_DEFUN(CMU_KRB5_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lkrb5 -lk5crypto" AC_TRY_LINK(, [krb5_get_in_tkt();], [ac_cv_found_krb5_lib=yes], ac_cv_found_krb5_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_KRB5_HLIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lkrb5 -ldes -lasn1" AC_TRY_LINK(, [krb5_get_in_tkt();], [ac_cv_found_krb5_lib=yes], ac_cv_found_krb5_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_KRB5_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for krb5 libraries in $i) CMU_KRB5_LIB_WHERE1($i) CMU_TEST_LIBPATH($i, krb5) if test "$ac_cv_found_krb5_lib" = "yes" ; then ac_cv_krb5_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_KRB5_HLIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for heimdal krb5 libraries in $i) CMU_KRB5_HLIB_WHERE1($i) CMU_TEST_LIBPATH($i, krb5) if test "$ac_cv_found_krb5_lib" = "yes" ; then ac_cv_krb5_where_hlib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_KRB5, [ AC_REQUIRE([CMU_SOCKETS]) AC_REQUIRE([CMU_USE_COMERR]) AC_ARG_WITH(krb5, [ --with-krb5=PREFIX Compile with Kerberos 5 support], [if test "X$with_krb5" = "X"; then with_krb5=yes fi]) AC_ARG_WITH(krb5-lib, [ --with-krb5-lib=dir use kerberos 5 libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-krb5-lib]) fi]) AC_ARG_WITH(krb5-include, [ --with-krb5-include=dir use kerberos 5 headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-krb5-include]) fi]) if test "X$with_krb5" != "X"; then if test "$with_krb5" != "yes" -a "$with_krb5" != "no"; then ac_cv_krb5_where_lib=$with_krb5/lib ac_cv_krb5_where_inc=$with_krb5/include fi fi if test "$with_krb5" != "no"; then if test "X$with_krb5_lib" != "X"; then ac_cv_krb5_where_lib=$with_krb5_lib fi if test "X$ac_cv_krb5_where_lib" = "X"; then CMU_KRB5_LIB_WHERE(/usr/athena/lib /usr/lib /usr/local/lib) fi if test "X$ac_cv_krb5_where_lib" = "X"; then CMU_KRB5_HLIB_WHERE(/usr/athena/lib /usr/lib /usr/local/lib) fi if test "X$with_krb5_include" != "X"; then ac_cv_krb5_where_inc=$with_krb5_include fi if test "X$ac_cv_krb5_where_inc" = "X"; then CMU_KRB5_INC_WHERE(/usr/athena/include /usr/include/kerberos /usr/local/include /usr/include) fi fi AC_MSG_CHECKING(whether to include kerberos 5) if test "X$ac_cv_krb5_where_lib" = "X" -a "X$ac_cv_krb5_where_hlib" = "X" -o "X$ac_cv_krb5_where_inc" = "X"; then ac_cv_found_krb5=no AC_MSG_RESULT(no) else ac_cv_found_krb5=yes AC_MSG_RESULT(yes) KRB5_INC_DIR=$ac_cv_krb5_where_inc if test "X$ac_cv_krb5_where_hlib" = "X"; then KRB5_LIB_DIR=$ac_cv_krb5_where_lib KRB5_LIB_FLAGS="-L${KRB5_LIB_DIR} -lkrb5 -lk5crypto" else KRB5_LIB_DIR=$ac_cv_krb5_where_hlib KRB5_LIB_FLAGS="-L${KRB5_LIB_DIR} -lkrb5 -ldes -lasn1" AC_DEFINE(HEIMDAL,,[we found heimdal krb5 and not MIT krb5]) fi KRB5_INC_FLAGS="-I${KRB5_INC_DIR}" AC_SUBST(KRB5_INC_FLAGS) AC_SUBST(KRB5_LIB_FLAGS) AC_DEFINE(KRB5,,[Use Kerberos 5. (maybe find what needs this and nuke it)]) if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${KRB5_LIB_DIR}" else RPATH="${RPATH}:${KRB5_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${KRB5_LIB_DIR}" else RPATH="${RPATH}:${KRB5_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${KRB5_LIB_DIR}" else RPATH="${RPATH}:${KRB5_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${KRB5_LIB_DIR}" else RPATH="${RPATH}:${KRB5_LIB_DIR}" fi else RPATH="${RPATH} -R${KRB5_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) mpack-1.6/cmulocal/libXau.m40000644005347200000120000000700007601133210011405 dnl $Id: libXau.m4,v 1.3 2002/12/21 18:44:24 cg2v Exp $ AC_DEFUN(CMU_XAU_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1" AC_TRY_COMPILE([ #include ], [Xauth foo;], ac_cv_found_Xau_inc=yes, ac_cv_found_Xau_inc=no) CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_XAU_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for Xau headers in $i) CMU_XAU_INC_WHERE1($i) CMU_TEST_INCPATH($i, X11/Xauth) if test "$ac_cv_found_Xau_inc" = "yes"; then ac_cv_Xau_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_XAU_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lXau $LIB_SOCKET" AC_TRY_LINK(, [XauDisposeAuth();], [ac_cv_found_Xau_lib=yes], ac_cv_found_Xau_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_XAU_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for Xau libraries in $i) CMU_XAU_LIB_WHERE1($i) dnl deal with false positives from implicit link paths CMU_TEST_LIBPATH($i, Xau) if test "$ac_cv_found_Xau_lib" = "yes" ; then ac_cv_Xau_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_XAU, [ AC_REQUIRE([CMU_SOCKETS]) AC_ARG_WITH(Xau, [ --with-Xau=PREFIX Compile with Xau support], [if test "X$with_Xau" = "X"; then with_Xau=yes fi]) AC_ARG_WITH(Xau-lib, [ --with-Xau-lib=dir use Xau libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-Xau-lib]) fi]) AC_ARG_WITH(Xau-include, [ --with-Xau-include=dir use Xau headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-Xau-include]) fi]) if test "X$with_Xau" != "X"; then if test "$with_Xau" != "yes"; then ac_cv_Xau_where_lib=$with_Xau/lib ac_cv_Xau_where_inc=$with_Xau/include fi fi if test "X$with_Xau_lib" != "X"; then ac_cv_Xau_where_lib=$with_Xau_lib fi if test "X$ac_cv_Xau_where_lib" = "X"; then CMU_XAU_LIB_WHERE(/usr/X11R6/lib /usr/local/lib /usr/openwin/lib) fi if test "X$with_Xau_include" != "X"; then ac_cv_Xau_where_inc=$with_Xau_include fi if test "X$ac_cv_Xau_where_inc" = "X"; then CMU_XAU_INC_WHERE(/usr/X11R6/include /usr/local/include /usr/openwin/include) fi AC_MSG_CHECKING(whether to include Xau) if test "X$ac_cv_Xau_where_lib" = "X" -a "X$ac_cv_Xau_where_inc" = "X"; then ac_cv_found_Xau=no AC_MSG_RESULT(no) else ac_cv_found_Xau=yes AC_MSG_RESULT(yes) XAU_INC_DIR=$ac_cv_Xau_where_inc XAU_LIB_DIR=$ac_cv_Xau_where_lib XAU_INC_FLAGS="-I${XAU_INC_DIR}" XAU_LIB_FLAGS="-L${XAU_LIB_DIR} -lXau" if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${XAU_LIB_DIR}" else RPATH="${RPATH}:${XAU_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${XAU_LIB_DIR}" else RPATH="${RPATH}:${XAU_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${XAU_LIB_DIR}" else RPATH="${RPATH}:${XAU_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${XAU_LIB_DIR}" else RPATH="${RPATH}:${XAU_LIB_DIR}" fi else RPATH="${RPATH} -R${XAU_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) mpack-1.6/cmulocal/libcyrus.m40000644005347200000120000001030707601133210012021 dnl libcyrus.m4--Cyrus libraries and includes dnl Derrick Brashear dnl from KTH kafs and Arla dnl $Id: libcyrus.m4,v 1.18 2002/12/21 18:44:24 cg2v Exp $ AC_DEFUN(CMU_LIBCYRUS_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1 $SASLFLAGS" CMU_CHECK_HEADER_NOCACHE(cyrus/imclient.h, ac_cv_found_cyrus_inc=yes, ac_cv_found_cyrus_inc=no) CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_LIBCYRUS_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for libcyrus headers in $i) CMU_LIBCYRUS_INC_WHERE1($i) CMU_TEST_INCPATH($i, imclient) if test "$ac_cv_found_cyrus_inc" = "yes"; then ac_cv_cyrus_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_LIBCYRUS_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lcyrus ${LIB_SASL} ${LIBSSL_LIB_FLAGS} ${LIB_SOCKET}" AC_TRY_LINK([void fatal(){}], [imclient_authenticate();], [ac_cv_found_cyrus_lib=yes], ac_cv_found_cyrus_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_LIBCYRUS_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for libcyrus libraries in $i) CMU_LIBCYRUS_LIB_WHERE1($i) dnl deal with false positives from implicit link paths CMU_TEST_LIBPATH($i, cyrus) if test "$ac_cv_found_cyrus_lib" = "yes" ; then ac_cv_cyrus_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_LIBCYRUS, [ AC_REQUIRE([CMU_SOCKETS]) AC_REQUIRE([CMU_SASL2]) AC_REQUIRE([CMU_LIBSSL]) AC_ARG_WITH(libcyrus, [ --with-libcyrus=PREFIX Compile with Libcyrus support], [if test "X$with_libcyrus" = "X"; then with_libcyrus=yes fi]) AC_ARG_WITH(libcyrus-lib, [ --with-libcyrus-lib=dir use libcyrus libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-libcyrus-lib]) fi]) AC_ARG_WITH(libcyrus-include, [ --with-libcyrus-include=dir use libcyrus headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-libcyrus-include]) fi]) if test "X$with_libcyrus" != "X"; then if test "$with_libcyrus" != "yes" -a "$with_libcyrus" != no; then ac_cv_cyrus_where_lib=$with_libcyrus/lib ac_cv_cyrus_where_inc=$with_libcyrus/include fi fi if test "$with_libcyrus" != "no"; then if test "X$with_libcyrus_lib" != "X"; then ac_cv_cyrus_where_lib=$with_libcyrus_lib fi if test "X$ac_cv_cyrus_where_lib" = "X"; then CMU_LIBCYRUS_LIB_WHERE(/usr/cyrus/lib /usr/local/lib /usr/lib) fi if test "X$with_libcyrus_include" != "X"; then ac_cv_cyrus_where_inc=$with_libcyrus_include fi if test "X$ac_cv_cyrus_where_inc" = "X"; then CMU_LIBCYRUS_INC_WHERE(/usr/cyrus/include /usr/local/include /usr/local/include/cyrus /usr/include/cyrus) fi fi AC_MSG_CHECKING(whether to include libcyrus) if test "X$ac_cv_cyrus_where_lib" = "X" -o "X$ac_cv_cyrus_where_inc" = "X"; then ac_cv_found_cyrus=no AC_MSG_RESULT(no) else ac_cv_found_cyrus=yes AC_MSG_RESULT(yes) LIBCYRUS_INC_DIR=$ac_cv_cyrus_where_inc LIBCYRUS_LIB_DIR=$ac_cv_cyrus_where_lib LIBCYRUS_INC_FLAGS="-I${LIBCYRUS_INC_DIR}" LIBCYRUS_LIB_FLAGS="-L${LIBCYRUS_LIB_DIR} -lcyrus" if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${LIBCYRUS_LIB_DIR}" else RPATH="${RPATH}:${LIBCYRUS_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${LIBCYRUS_LIB_DIR}" else RPATH="${RPATH}:${LIBCYRUS_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${LIBCYRUS_LIB_DIR}" else RPATH="${RPATH}:${LIBCYRUS_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${LIBCYRUS_LIB_DIR}" else RPATH="${RPATH}:${LIBCYRUS_LIB_DIR}" fi else RPATH="${RPATH} -R${LIBCYRUS_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi AC_SUBST(LIBCYRUS_INC_DIR) AC_SUBST(LIBCYRUS_LIB_DIR) AC_SUBST(LIBCYRUS_INC_FLAGS) AC_SUBST(LIBCYRUS_LIB_FLAGS) ]) mpack-1.6/cmulocal/libloguse.m40000644005347200000120000000456207601133210012160 dnl libloguse.m4--LOGUSE libraries and includes dnl Derrick Brashear dnl from KTH krb and Arla dnl $Id: libloguse.m4,v 1.4 2002/12/21 18:44:24 cg2v Exp $ AC_DEFUN(CMU_LOGUSE_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lloguse" AC_TRY_LINK(, [loguse("","","");], [ac_cv_found_loguse_lib=yes], ac_cv_found_loguse_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_LOGUSE_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for loguse library in $i) CMU_LOGUSE_LIB_WHERE1($i) CMU_TEST_LIBPATH($i, loguse) if test "$ac_cv_found_loguse_lib" = "yes" ; then ac_cv_loguse_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(no found) fi done ]) AC_DEFUN(CMU_LOGUSE, [ AC_REQUIRE([CMU_SOCKETS]) AC_ARG_WITH(loguse, [ --with-loguse=PREFIX Compile with LOGUSE support], [if test "X$with_loguse" = "X"; then with_loguse=yes fi]) if test "X$with_loguse" != "X"; then if test "$with_loguse" != "yes"; then ac_cv_loguse_where_lib=$with_loguse/lib fi fi if test "X$with_loguse_lib" != "X"; then ac_cv_loguse_where_lib=$with_loguse_lib fi if test "X$ac_cv_loguse_where_lib" = "X"; then CMU_LOGUSE_LIB_WHERE(/usr/lib /usr/local/lib) fi AC_MSG_CHECKING(whether to include loguse) if test "X$ac_cv_loguse_where_lib" = "X"; then ac_cv_found_loguse=no AC_MSG_RESULT(no) else ac_cv_found_loguse=yes AC_DEFINE(HAVE_LOGUSE) AC_MSG_RESULT(yes) LOGUSE_LIB_DIR=$ac_cv_loguse_where_lib LOGUSE_LIB_FLAGS="-L${LOGUSE_LIB_DIR} -lloguse" if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${LOGUSE_LIB_DIR}" else RPATH="${RPATH}:${LOGUSE_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${LOGUSE_LIB_DIR}" else RPATH="${RPATH}:${LOGUSE_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${LOGUSE_LIB_DIR}" else RPATH="${RPATH}:${LOGUSE_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${LOGUSE_LIB_DIR}" else RPATH="${RPATH}:${LOGUSE_LIB_DIR}" fi else RPATH="${RPATH} -R${LOGUSE_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) mpack-1.6/cmulocal/libnet.m40000644005347200000120000001165007601133210011444 dnl libnet.m4--libnet and includes dnl Derrick Brashear dnl from KTH krb and Arla dnl $Id: libnet.m4,v 1.6 2002/12/21 18:44:24 cg2v Exp $ AC_DEFUN(CMU_LIBNET_CFG_WHERE1, [ ac_cv_found_libnet_bin=no if test -f "$1/libnet-config" ; then ac_cv_found_libnet_cfg=yes fi ]) AC_DEFUN(CMU_LIBNET_CFG_WHERE, [ for i in $1; do AC_MSG_CHECKING(for libnet config in $i) CMU_LIBNET_CFG_WHERE1($i) if test "$ac_cv_found_libnet_cfg" = "yes"; then ac_cv_libnet_where_cfg=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_LIBNET_INC_WHERE1, [ ac_cv_found_libnet_inc=no if test -f "$1/libnet.h" ; then ac_cv_found_libnet_inc=yes fi ]) AC_DEFUN(CMU_LIBNET_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for libnet header in $i) CMU_LIBNET_INC_WHERE1($i) if test "$ac_cv_found_libnet_inc" = "yes"; then ac_cv_libnet_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_LIBNET_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lnet" AC_TRY_LINK(, [open_link_interface("","");], [ac_cv_found_libnet_lib=yes], AC_TRY_LINK(, [libnet_open_link_interface("","");], [ CMU_LIBNET_CFLAGS_ADD="-DNEW_LIBNET_INTERFACE" ac_cv_found_libnet_lib=yes ], ac_cv_found_libnet_lib=no) ) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_LIBNET_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for libnet library in $i) CMU_LIBNET_LIB_WHERE1($i) CMU_TEST_LIBPATH($i, net) if test "$ac_cv_found_libnet_lib" = "yes" ; then ac_cv_libnet_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_LIBNET, [ AC_ARG_WITH(libnet, [ --with-libnet=PREFIX Compile with LIBNET support], [if test "X$with_libnet" = "X"; then with_libnet=yes fi]) AC_ARG_WITH(libnet-config, [ --with-libnet-config=dir use libnet config program in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-libnet-config]) fi]) AC_ARG_WITH(libnet-lib, [ --with-libnet-lib=dir use libnet libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-libnet-lib]) fi]) AC_ARG_WITH(libnet-include, [ --with-libnet-include=dir use libnet headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-libnet-include]) fi]) if test "X$with_libnet" != "X"; then if test "$with_libnet" != "yes"; then if test -f "$with_libnet/libnet-config"; then ac_cv_libnet_where_cfg=$with_libnet else ac_cv_libnet_where_cfg=$with_libnet/bin fi ac_cv_libnet_where_lib=$with_libnet/lib ac_cv_libnet_where_inc=$with_libnet/include fi fi if test "X$with_libnet_cfg" != "X"; then ac_cv_libnet_where_cfg=$with_libnet_cfg fi if test "X$ac_cv_libnet_where_cfg" = "X"; then CMU_LIBNET_CFG_WHERE(/usr/ng/bin /usr/bin /usr/local/bin) fi if test "X$with_libnet_lib" != "X"; then ac_cv_libnet_where_lib=$with_libnet_lib fi if test "X$ac_cv_libnet_where_lib" = "X"; then CMU_LIBNET_LIB_WHERE(/usr/ng/lib /usr/lib /usr/local/lib) fi if test "X$with_libnet_include" != "X"; then ac_cv_libnet_where_inc=$with_libnet_include fi if test "X$ac_cv_libnet_where_inc" = "X"; then CMU_LIBNET_INC_WHERE(/usr/ng/include /usr/include /usr/local/include) fi AC_MSG_CHECKING(whether to include libnet) if test "X$ac_cv_libnet_where_lib" = "X" -o "X$ac_cv_libnet_where_inc" = "X" -o "X$ac_cv_libnet_where_cfg" = "X"; then ac_cv_found_libnet=no AC_MSG_RESULT(no) else ac_cv_found_libnet=yes AC_MSG_RESULT(yes) LIBNET_CONFIG=$ac_cv_libnet_where_cfg/libnet-config LIBNET_INC_DIR=$ac_cv_libnet_where_inc LIBNET_LIB_DIR=$ac_cv_libnet_where_lib LIBNET_CFLAGS="`$LIBNET_CONFIG --cflags` ${CMU_LIBNET_CFLAGS_ADD}" LIBNET_DEF_FLAGS="`$LIBNET_CONFIG --defines`" LIBNET_INC_FLAGS="-I${LIBNET_INC_DIR}" LIBNET_LIB_FLAGS="-L${LIBNET_LIB_DIR} `${LIBNET_CONFIG} --libs`" if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${LIBNET_LIB_DIR}" else RPATH="${RPATH}:${LIBNET_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${LIBNET_LIB_DIR}" else RPATH="${RPATH}:${LIBNET_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${LIBNET_LIB_DIR}" else RPATH="${RPATH}:${LIBNET_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${LIBNET_LIB_DIR}" else RPATH="${RPATH}:${LIBNET_LIB_DIR}" fi else RPATH="${RPATH} -R${LIBNET_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) mpack-1.6/cmulocal/libpcap.m40000644005347200000120000000662707601133210011611 dnl libpcap.m4--PCAP libraries and includes dnl Derrick Brashear dnl from KTH krb and Arla dnl $Id: libpcap.m4,v 1.7 2002/12/21 18:44:24 cg2v Exp $ AC_DEFUN(CMU_PCAP_INC_WHERE1, [ ac_cv_found_pcap_inc=no if test -f "$1/pcap.h" ; then ac_cv_found_pcap_inc=yes fi ]) AC_DEFUN(CMU_PCAP_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for pcap header in $i) CMU_PCAP_INC_WHERE1($i) if test "$ac_cv_found_pcap_inc" = "yes"; then ac_cv_pcap_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(no found) fi done ]) AC_DEFUN(CMU_PCAP_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lpcap" AC_TRY_LINK(, [pcap_lookupdev("");], [ac_cv_found_pcap_lib=yes], ac_cv_found_pcap_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_PCAP_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for pcap library in $i) CMU_PCAP_LIB_WHERE1($i) CMU_TEST_LIBPATH($i, pcap) if test "$ac_cv_found_pcap_lib" = "yes" ; then ac_cv_pcap_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(no found) fi done ]) AC_DEFUN(CMU_PCAP, [ AC_ARG_WITH(pcap, [ --with-pcap=PREFIX Compile with PCAP support], [if test "X$with_pcap" = "X"; then with_pcap=yes fi]) AC_ARG_WITH(pcap-lib, [ --with-pcap-lib=dir use pcap libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-pcap-lib]) fi]) AC_ARG_WITH(pcap-include, [ --with-pcap-include=dir use pcap headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-pcap-include]) fi]) if test "X$with_pcap" != "X"; then if test "$with_pcap" != "yes"; then ac_cv_pcap_where_lib=$with_pcap/lib ac_cv_pcap_where_inc=$with_pcap/include fi fi if test "X$with_pcap_lib" != "X"; then ac_cv_pcap_where_lib=$with_pcap_lib fi if test "X$ac_cv_pcap_where_lib" = "X"; then CMU_PCAP_LIB_WHERE(/usr/ng/lib /usr/lib /usr/local/lib) fi if test "X$with_pcap_include" != "X"; then ac_cv_pcap_where_inc=$with_pcap_include fi if test "X$ac_cv_pcap_where_inc" = "X"; then CMU_PCAP_INC_WHERE(/usr/ng/include /usr/include /usr/local/include) fi AC_MSG_CHECKING(whether to include pcap) if test "X$ac_cv_pcap_where_lib" = "X" -a "X$ac_cv_pcap_where_inc" = "X"; then ac_cv_found_pcap=no AC_MSG_RESULT(no) else ac_cv_found_pcap=yes AC_MSG_RESULT(yes) PCAP_INC_DIR=$ac_cv_pcap_where_inc PCAP_LIB_DIR=$ac_cv_pcap_where_lib PCAP_INC_FLAGS="-I${PCAP_INC_DIR}" PCAP_LIB_FLAGS="-L${PCAP_LIB_DIR} -lpcap" if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${PCAP_LIB_DIR}" else RPATH="${RPATH}:${PCAP_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${PCAP_LIB_DIR}" else RPATH="${RPATH}:${PCAP_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${PCAP_LIB_DIR}" else RPATH="${RPATH}:${PCAP_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${PCAP_LIB_DIR}" else RPATH="${RPATH}:${PCAP_LIB_DIR}" fi else RPATH="${RPATH} -R${PCAP_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) mpack-1.6/cmulocal/librestrict.m40000644005347200000120000000466407601133211012525 dnl librestrict.m4--restrict libraries and includes dnl Derrick Brashear dnl from KTH krb and Arla dnl $Id: librestrict.m4,v 1.3 2002/12/21 18:44:25 cg2v Exp $ AC_DEFUN(CMU_RESTRICT_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lrestrict" AC_TRY_LINK(, [ConsoleInUse();], [ac_cv_found_restrict_lib=yes], ac_cv_found_restrict_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_RESTRICT_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for restrict library in $i) CMU_RESTRICT_LIB_WHERE1($i) CMU_TEST_LIBPATH($i, restrict) if test "$ac_cv_found_restrict_lib" = "yes" ; then ac_cv_restrict_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(no found) fi done ]) AC_DEFUN(CMU_RESTRICT, [ AC_ARG_WITH(restrict, [ --with-restrict=PREFIX Compile with RESTRICT support], [if test "X$with_restrict" = "X"; then with_restrict=yes fi]) if test "X$with_restrict" != "X"; then if test "$with_restrict" != "yes"; then ac_cv_restrict_where_lib=$with_restrict/lib fi fi if test "X$with_restrict_lib" != "X"; then ac_cv_restrict_where_lib=$with_restrict_lib fi if test "X$ac_cv_restrict_where_lib" = "X"; then CMU_RESTRICT_LIB_WHERE(/usr/lib /usr/local/lib) fi AC_MSG_CHECKING(whether to include restrict) if test "X$ac_cv_restrict_where_lib" = "X"; then ac_cv_found_restrict=no AC_MSG_RESULT(no) else ac_cv_found_restrict=yes AC_DEFINE(HAVE_RESTRICT) AC_MSG_RESULT(yes) RESTRICT_LIB_DIR=$ac_cv_restrict_where_lib RESTRICT_LIB_FLAGS="-L${RESTRICT_LIB_DIR} -lrestrict" if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${RESTRICT_LIB_DIR}" else RPATH="${RPATH}:${RESTRICT_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${RESTRICT_LIB_DIR}" else RPATH="${RPATH}:${RESTRICT_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${RESTRICT_LIB_DIR}" else RPATH="${RPATH}:${RESTRICT_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${RESTRICT_LIB_DIR}" else RPATH="${RPATH}:${RESTRICT_LIB_DIR}" fi else RPATH="${RPATH} -R${RESTRICT_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi ]) mpack-1.6/cmulocal/libssl.m40000644005347200000120000000772107601133211011464 dnl libssl.m4--Ssl libraries and includes dnl Derrick Brashear dnl from KTH kafs and Arla dnl $Id: libssl.m4,v 1.8 2002/12/21 18:44:25 cg2v Exp $ AC_DEFUN(CMU_LIBSSL_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1" CMU_CHECK_HEADER_NOCACHE(openssl/ssl.h, ac_cv_found_libssl_inc=yes, ac_cv_found_libssl_inc=no) CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_LIBSSL_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for libssl headers in $i) CMU_LIBSSL_INC_WHERE1($i) CMU_TEST_INCPATH($i, ssl) if test "$ac_cv_found_libssl_inc" = "yes"; then ac_cv_libssl_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_LIBSSL_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lssl -lcrypto $LIB_SOCKET" AC_TRY_LINK(, [SSL_write();], [ac_cv_found_ssl_lib=yes], ac_cv_found_ssl_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_LIBSSL_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for libssl libraries in $i) CMU_LIBSSL_LIB_WHERE1($i) dnl deal with false positives from implicit link paths CMU_TEST_LIBPATH($i, ssl) if test "$ac_cv_found_ssl_lib" = "yes" ; then ac_cv_libssl_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_LIBSSL, [ AC_REQUIRE([CMU_SOCKETS]) AC_ARG_WITH(libssl, [ --with-libssl=PREFIX Compile with Libssl support], [if test "X$with_libssl" = "X"; then with_libssl=yes fi]) AC_ARG_WITH(libssl-lib, [ --with-libssl-lib=dir use libssl libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-libssl-lib]) fi]) AC_ARG_WITH(libssl-include, [ --with-libssl-include=dir use libssl headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-libssl-include]) fi]) if test "X$with_libssl" != "X"; then if test "$with_libssl" != "yes" -a "$with_libssl" != no; then ac_cv_libssl_where_lib=$with_libssl/lib ac_cv_libssl_where_inc=$with_libssl/include fi fi if test "$with_libssl" != "no"; then if test "X$with_libssl_lib" != "X"; then ac_cv_libssl_where_lib=$with_libssl_lib fi if test "X$ac_cv_libssl_where_lib" = "X"; then CMU_LIBSSL_LIB_WHERE(/usr/local/lib/openssl /usr/lib/openssl /usr/local/lib /usr/lib) fi if test "X$with_libssl_include" != "X"; then ac_cv_libssl_where_inc=$with_libssl_include fi if test "X$ac_cv_libssl_where_inc" = "X"; then CMU_LIBSSL_INC_WHERE(/usr/local/include /usr/include) fi fi AC_MSG_CHECKING(whether to include libssl) if test "X$ac_cv_libssl_where_lib" = "X" -a "X$ac_cv_libssl_where_inc" = "X"; then ac_cv_found_libssl=no AC_MSG_RESULT(no) else ac_cv_found_libssl=yes AC_MSG_RESULT(yes) LIBSSL_INC_DIR=$ac_cv_libssl_where_inc LIBSSL_LIB_DIR=$ac_cv_libssl_where_lib LIBSSL_INC_FLAGS="-I${LIBSSL_INC_DIR}" LIBSSL_LIB_FLAGS="-L${LIBSSL_LIB_DIR} -lssl -lcrypto" if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${LIBSSL_LIB_DIR}" else RPATH="${RPATH}:${LIBSSL_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${LIBSSL_LIB_DIR}" else RPATH="${RPATH}:${LIBSSL_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${LIBSSL_LIB_DIR}" else RPATH="${RPATH}:${LIBSSL_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${LIBSSL_LIB_DIR}" else RPATH="${RPATH}:${LIBSSL_LIB_DIR}" fi else RPATH="${RPATH} -R${LIBSSL_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi AC_SUBST(LIBSSL_INC_DIR) AC_SUBST(LIBSSL_LIB_DIR) AC_SUBST(LIBSSL_INC_FLAGS) AC_SUBST(LIBSSL_LIB_FLAGS) ]) mpack-1.6/cmulocal/libtoolhack.m40000644005347200000120000000146107473766266012517 dnl libtoolhack.m4--hack to make libtool behave better dnl Rob Earhart dnl $Id: libtoolhack.m4,v 1.3 2002/05/25 19:57:42 leg Exp $ dnl Libtool tries to compile an empty file to see whether it can build dnl shared libraries, and treats *any* warning as a problem. dnl Solaris's and HP's cc complains about the empty file. So we hack dnl the CFLAGS to make cc not complain. AC_DEFUN(CMU_PROG_LIBTOOL, [ AC_REQUIRE([AC_PROG_CC]) if test "$ac_cv_prog_gcc" = no; then case "$host_os" in solaris2*) save_cflags="${CFLAGS}" CFLAGS="-erroff=E_EMPTY_TRANSLATION_UNIT ${CFLAGS}" ;; hpux*) save_cflags="${CFLAGS}" CFLAGS="-w" ;; esac fi AM_PROG_LIBTOOL if test "$ac_cv_prog_gcc" = no; then case "$host_os" in solaris2*|hpux*) CFLAGS="${save_cflags}" esac fi ]) mpack-1.6/cmulocal/libwrap.m40000644005347200000120000000170607530725667011660 dnl libwrap.m4 --- do we have libwrap, the access control library? dnl $Id: libwrap.m4,v 1.6 2002/08/21 15:03:19 rjs3 Exp $ AC_DEFUN(CMU_LIBWRAP, [ AC_REQUIRE([CMU_SOCKETS]) AC_ARG_WITH(libwrap, [ --with-libwrap=DIR use libwrap (rooted in DIR) [yes] ], with_libwrap=$withval, with_libwrap=yes) if test "$with_libwrap" != no; then if test -d "$with_libwrap"; then CPPFLAGS="$CPPFLAGS -I${with_libwrap}/include" LDFLAGS="$LDFLAGS -L${with_libwrap}/lib" fi cmu_save_LIBS="$LIBS" AC_CHECK_LIB(wrap, request_init, [ AC_CHECK_HEADER(tcpd.h,, with_libwrap=no)], with_libwrap=no, ${LIB_SOCKET}) LIBS="$cmu_save_LIBS" fi AC_MSG_CHECKING(libwrap support) AC_MSG_RESULT($with_libwrap) LIB_WRAP="" if test "$with_libwrap" != no; then AC_DEFINE(HAVE_LIBWRAP) LIB_WRAP="-lwrap" AC_CHECK_LIB(nsl, yp_get_default_domain, LIB_WRAP="${LIB_WRAP} -lnsl") fi AC_SUBST(LIB_WRAP) ]) mpack-1.6/cmulocal/mips-abi.m40000644005347200000120000000517207473766266011730 dnl mips-abi.m4--Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext dnl to some value dnl Derrick Brashear dnl from KTH krb (from CMU) dnl $Id: mips-abi.m4,v 1.4 2002/05/25 19:57:42 leg Exp $ AC_DEFUN(AC_MIPS_ABI, [ AC_ARG_WITH(mips_abi, [ --with-mips-abi=abi ABI to use for IRIX (32, n32, or 64)]) case "$host_os" in irix*) with_mips_abi="${with_mips_abi:-yes}" if test -n "$GCC"; then # GCC < 2.8 only supports the O32 ABI. GCC >= 2.8 has a flag to select # which ABI to use, but only supports (as of 2.8.1) the N32 and 64 ABIs. # # Default to N32, but if GCC doesn't grok -mabi=n32, we assume an old # GCC and revert back to O32. The same goes if O32 is asked for - old # GCCs doesn't like the -mabi option, and new GCCs can't output O32. # # Don't you just love *all* the different SGI ABIs? case "${with_mips_abi}" in 32|o32) abi='-mabi=32'; abilibdirext='' ;; n32|yes) abi='-mabi=n32'; abilibdirext='32' ;; 64) abi='-mabi=64'; abilibdirext='64' ;; no) abi=''; abilibdirext='';; *) AC_ERROR("Invalid ABI specified") ;; esac if test -n "$abi" ; then ac_foo=krb_cv_gcc_`echo $abi | tr =- __` dnl dnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to dnl AC_MSG_RESULT dnl AC_MSG_CHECKING([if $CC supports the $abi option]) AC_CACHE_VAL($ac_foo, [ save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $abi" AC_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no) CFLAGS="$save_CFLAGS" ]) ac_res=`eval echo \\\$$ac_foo` AC_MSG_RESULT($ac_res) if test $ac_res = no; then # Try to figure out why that failed... case $abi in -mabi=32) save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -mabi=n32" AC_TRY_COMPILE(,int x;, ac_res=yes, ac_res=no) CLAGS="$save_CFLAGS" if test $ac_res = yes; then # New GCC AC_ERROR([$CC does not support the $with_mips_abi ABI]) fi # Old GCC abi='' abilibdirext='' ;; -mabi=n32|-mabi=64) if test $with_mips_abi = yes; then # Old GCC, default to O32 abi='' abilibdirext='' else # Some broken GCC AC_ERROR([$CC does not support the $with_mips_abi ABI]) fi ;; esac fi #if test $ac_res = no; then fi #if test -n "$abi" ; then else case "${with_mips_abi}" in 32|o32) abi='-32'; abilibdirext='' ;; n32|yes) abi='-n32'; abilibdirext='32' ;; 64) abi='-64'; abilibdirext='64' ;; no) abi=''; abilibdirext='';; *) AC_ERROR("Invalid ABI specified") ;; esac fi #if test -n "$GCC"; then ;; esac dnl And then we munge variables to make things work CFLAGS="${CFLAGS} $abi" libdir=`echo $libdir | sed 's,/*$,$abilibdirext,'` LDFLAGS=`echo $LDFLAGS | sed -e "s,/lib$,/lib$abilibdirext," -e "s,\\\(/lib[^a-zA-Z]\\\),\\\1$abilibdirext,g"` ]) mpack-1.6/cmulocal/nadine.m40000644005347200000120000001055707601133211011433 dnl nadine.m4--The nadine event library dnl Derrick Brashear dnl from KTH kafs and Arla dnl $Id: nadine.m4,v 1.5 2002/12/21 18:44:25 cg2v Exp $ AC_DEFUN(CMU_NADINE_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1" CMU_CHECK_HEADER_NOCACHE(libevent/libevent.h, ac_cv_found_event_inc=yes, ac_cv_found_event_inc=no) CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_NADINE_INC_WHERE, [ for i in $1; do AC_MSG_CHECKING(for nadine headers in $i) CMU_NADINE_INC_WHERE1($i) dnl CMU_TEST_INCPATH($i, ssl) dnl CMU_TEST_INCPATH isn't very versatile if test "$ac_cv_found_event_inc" = "yes"; then if test \! -f $i/libevent/libevent.h ; then ac_cv_found_event_inc=no fi fi if test "$ac_cv_found_event_inc" = "yes"; then ac_cv_event_where_inc=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_NADINE_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -levent" AC_TRY_LINK(, [libevent_Initialize();], [ac_cv_found_event_lib=yes], ac_cv_found_event_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_NADINE_LIB_WHERE, [ for i in $1; do AC_MSG_CHECKING(for event libraries in $i) CMU_NADINE_LIB_WHERE1($i) dnl deal with false positives from implicit link paths CMU_TEST_LIBPATH($i, event) if test "$ac_cv_found_event_lib" = "yes" ; then ac_cv_event_where_lib=$i AC_MSG_RESULT(found) break else AC_MSG_RESULT(not found) fi done ]) AC_DEFUN(CMU_NADINE, [ AC_REQUIRE([CMU_SOCKETS]) AC_ARG_WITH(nadine, [ --with-nadine=PREFIX Compile with nadine libevent support], [if test "X$with_nadine" = "X"; then with_nadine=yes fi]) AC_ARG_WITH(nadine-lib, [ --with-nadine-lib=dir use nadine libraries in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-nadine-lib]) fi]) AC_ARG_WITH(nadine-include, [ --with-nadine-include=dir use nadine headers in dir], [if test "$withval" = "yes" -o "$withval" = "no"; then AC_MSG_ERROR([No argument for --with-nadine-include]) fi]) if test "$with_ucdsnmp" = "no" ; then AC_MSG_WARN([Nadine requires UCD SNMP. Disabling Nadine support]) with_nadine=no with_nadine_lib=no with_nadine_include=no fi if test "X$with_nadine" != "X"; then if test "$with_nadine" != "yes" -a "$with_nadine" != no; then ac_cv_event_where_lib=$with_nadine/lib ac_cv_event_where_inc=$with_nadine/include fi fi if test "$with_nadine" != "no"; then if test "X$with_nadine_lib" != "X"; then ac_cv_event_where_lib=$with_nadine_lib fi if test "X$ac_cv_event_where_lib" = "X"; then CMU_NADINE_LIB_WHERE(/usr/local/lib /usr/ng/lib /usr/lib) fi if test "X$with_nadine_include" != "X"; then ac_cv_event_where_inc=$with_nadine_include fi if test "X$ac_cv_event_where_inc" = "X"; then CMU_NADINE_INC_WHERE(/usr/local/include /usr/ng/include /usr/include) fi fi AC_MSG_CHECKING(whether to include nadine) if test "X$ac_cv_event_where_lib" = "X" -a "X$ac_cv_event_where_inc" = "X"; then ac_cv_found_event=no AC_MSG_RESULT(no) else ac_cv_found_event=yes AC_MSG_RESULT(yes) NADINE_INC_DIR=$ac_cv_event_where_inc NADINE_LIB_DIR=$ac_cv_event_where_lib NADINE_INC_FLAGS="-I${NADINE_INC_DIR}" NADINE_LIB_FLAGS="-L${NADINE_LIB_DIR} -levent" if test "X$RPATH" = "X"; then RPATH="" fi case "${host}" in *-*-linux*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${NADINE_LIB_DIR}" else RPATH="${RPATH}:${NADINE_LIB_DIR}" fi ;; *-*-hpux*) if test "X$RPATH" = "X"; then RPATH="-Wl,+b${NADINE_LIB_DIR}" else RPATH="${RPATH}:${NADINE_LIB_DIR}" fi ;; *-*-irix*) if test "X$RPATH" = "X"; then RPATH="-Wl,-rpath,${NADINE_LIB_DIR}" else RPATH="${RPATH}:${NADINE_LIB_DIR}" fi ;; *-*-solaris2*) if test "$ac_cv_prog_gcc" = yes; then if test "X$RPATH" = "X"; then RPATH="-Wl,-R${NADINE_LIB_DIR}" else RPATH="${RPATH}:${NADINE_LIB_DIR}" fi else RPATH="${RPATH} -R${NADINE_LIB_DIR}" fi ;; esac AC_SUBST(RPATH) fi AC_SUBST(NADINE_INC_DIR) AC_SUBST(NADINE_LIB_DIR) AC_SUBST(NADINE_INC_FLAGS) AC_SUBST(NADINE_LIB_FLAGS) ]) mpack-1.6/cmulocal/nana.m40000644005347200000120000000125607527025002011113 dnl nana.m4--nana macro dnl Rob Earhart dnl $Id: nana.m4,v 1.4 2002/08/15 22:24:02 ken3 Exp $ AC_DEFUN(CMU_NANA, [ AC_REQUIRE([AC_PROG_CC]) AC_ARG_WITH(nana, [[ --with-nana use NANA [yes] ]],,with_nana=yes) if test "$GCC" != yes; then with_nana=no elif test "$with_nana" = yes; then AC_CHECK_PROGS(NANA, nana, :) if test "$NANA" = ":"; then with_nana=no else AC_CHECK_HEADER(nana.h, AC_CHECK_LIB(nana, nana_error,,with_nana=no), with_nana=no) fi else with_nana=no fi AC_MSG_CHECKING([whether to use NANA]) AC_MSG_RESULT($with_nana) if test "$with_nana" != yes; then AC_DEFINE(WITHOUT_NANA) fi ]) mpack-1.6/cmulocal/openssl.m40000644005347200000120000000211107622747032011662 dnl dnl macros for configure.in to detect openssl dnl $Id: openssl.m4,v 1.6 2003/02/13 16:55:54 rjs3 Exp $ dnl AC_DEFUN(CMU_HAVE_OPENSSL, [ AC_ARG_WITH(openssl,[ --with-openssl=PATH use OpenSSL from PATH], with_openssl=$withval, with_openssl="yes") save_CPPFLAGS=$CPPFLAGS save_LDFLAGS=$LDFLAGS if test -d $with_openssl; then CPPFLAGS="${CPPFLAGS} -I${with_openssl}/include" LDFLAGS="${LDFLAGS} -L${with_openssl}/lib" fi case "$with_openssl" in no) with_openssl="no";; *) dnl if openssl has been compiled with the rsaref2 libraries, dnl we need to include the rsaref libraries in the crypto check LIB_RSAREF="" AC_CHECK_LIB(rsaref, RSAPublicEncrypt, LIB_RSAREF="-lRSAglue -lrsaref"; cmu_have_rsaref=yes, cmu_have_rsaref=no) AC_CHECK_HEADER(openssl/evp.h, [ AC_CHECK_LIB(crypto, EVP_DigestInit, with_openssl="yes", with_openssl="no", $LIB_RSAREF)], with_openssl=no) ;; esac if test "$with_openssl" != "no"; then AC_DEFINE(HAVE_OPENSSL) else CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS fi ])mpack-1.6/cmulocal/pthreads.m40000644005347200000120000000115407473766266012035 dnl pthreads.m4--pthreads setup macro dnl Rob Earhart dnl $Id: pthreads.m4,v 1.10 2002/05/25 19:57:42 leg Exp $ AC_DEFUN(CMU_PTHREADS, [ AC_REQUIRE([AC_CANONICAL_HOST]) cmu_save_LIBS="$LIBS" AC_CHECK_LIB(pthread, pthread_create,LIB_PTHREAD="-lpthread", AC_CHECK_LIB(c_r, pthread_create,LIB_PTHREAD="-lc_r", AC_ERROR([Can't compile without pthreads]))) LIBS="$cmu_save_LIBS" AC_SUBST(LIB_PTHREAD) AC_DEFINE(_REENTRANT) case "$host_os" in solaris2*) AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) AC_DEFINE(__EXTENSIONS__) ;; irix6*) AC_DEFINE(_SGI_REENTRANT_FUNCTIONS) ;; esac ]) mpack-1.6/cmulocal/sasl.m40000644005347200000120000000435407601133211011135 dnl sasl.m4--sasl libraries and includes dnl Derrick Brashear dnl from KTH sasl and Arla dnl $Id: sasl.m4,v 1.21 2002/12/21 18:44:25 cg2v Exp $ AC_DEFUN(CMU_SASL_INC_WHERE1, [ saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$saved_CPPFLAGS -I$1" CMU_CHECK_HEADER_NOCACHE(sasl.h, ac_cv_found_sasl_inc=yes, ac_cv_found_sasl_inc=no) CPPFLAGS=$saved_CPPFLAGS ]) AC_DEFUN(CMU_SASL_INC_WHERE, [ for i in $1; do CMU_SASL_INC_WHERE1($i) CMU_TEST_INCPATH($i, sasl) if test "$ac_cv_found_sasl_inc" = "yes"; then ac_cv_sasl_where_inc=$i break fi done ]) AC_DEFUN(CMU_SASL_LIB_WHERE1, [ saved_LIBS=$LIBS LIBS="$saved_LIBS -L$1 -lsasl" AC_TRY_LINK(, [sasl_getprop();], [ac_cv_found_sasl_lib=yes], ac_cv_found_sasl_lib=no) LIBS=$saved_LIBS ]) AC_DEFUN(CMU_SASL_LIB_WHERE, [ for i in $1; do CMU_SASL_LIB_WHERE1($i) dnl deal with false positives from implicit link paths CMU_TEST_LIBPATH($i, sasl) if test "$ac_cv_found_sasl_lib" = "yes" ; then ac_cv_sasl_where_lib=$i break fi done ]) AC_DEFUN(CMU_SASL, [ AC_ARG_WITH(sasl, [ --with-sasl=DIR Compile with libsasl in ], with_sasl="$withval", with_sasl="yes") SASLFLAGS="" LIB_SASL="" cmu_saved_CPPFLAGS=$CPPFLAGS cmu_saved_LDFLAGS=$LDFLAGS cmu_saved_LIBS=$LIBS if test -d ${with_sasl}; then ac_cv_sasl_where_lib=${with_sasl}/lib ac_cv_sasl_where_inc=${with_sasl}/include SASLFLAGS="-I$ac_cv_sasl_where_inc" LIB_SASL="-L$ac_cv_sasl_where_lib" CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}" LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}" fi AC_CHECK_HEADER(sasl.h, AC_CHECK_LIB(sasl, sasl_getprop, ac_cv_found_sasl=yes, ac_cv_found_sasl=no), ac_cv_found_sasl=no) LIBS="$cmu_saved_LIBS" LDFLAGS="$cmu_saved_LDFLAGS" CPPFLAGS="$cmu_saved_CPPFLAGS" if test "$ac_cv_found_sasl" = yes; then LIB_SASL="$LIB_SASL -lsasl" else LIB_SASL="" SASLFLAGS="" fi AC_SUBST(LIB_SASL) AC_SUBST(SASLFLAGS) ]) AC_DEFUN(CMU_SASL_REQUIRED, [AC_REQUIRE([CMU_SASL]) if test "$ac_cv_found_sasl" != "yes"; then AC_ERROR([Cannot continue without libsasl. Get it from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/.]) fi]) mpack-1.6/cmulocal/sasl2.m40000644005347200000120000001741407700555204011232 dnl sasl2.m4--sasl2 libraries and includes dnl Rob Siemborski dnl $Id: sasl2.m4,v 1.30 2003/07/02 13:13:40 rjs3 Exp $ AC_DEFUN(SASL_GSSAPI_CHK,[ AC_ARG_ENABLE(gssapi, [ --enable-gssapi= enable GSSAPI authentication [yes] ], gssapi=$enableval, gssapi=yes) AC_REQUIRE([SASL2_CRYPT_CHK]) if test "$gssapi" != no; then if test -d ${gssapi}; then CPPFLAGS="$CPPFLAGS -I$gssapi/include" LDFLAGS="$LDFLAGS -L$gssapi/lib" fi AC_CHECK_HEADER(gssapi.h, AC_DEFINE(HAVE_GSSAPI_H,,[Define if you have the gssapi.h header file]), [ AC_CHECK_HEADER(gssapi/gssapi.h,, AC_WARN(Disabling GSSAPI); gssapi=no)]) fi if test "$gssapi" != no; then dnl We need to find out which gssapi implementation we are dnl using. Supported alternatives are: MIT Kerberos 5, dnl Heimdal Kerberos 5 (http://www.pdc.kth.se/heimdal), dnl and Sun SEAM (http://wwws.sun.com/software/security/kerberos/) dnl dnl The choice is reflected in GSSAPIBASE_LIBS dnl we might need libdb AC_CHECK_LIB(db, db_open) gss_impl="mit"; AC_CHECK_LIB(resolv,res_search) if test -d ${gssapi}; then CPPFLAGS="$CPPFLAGS -I$gssapi/include" LDFLAGS="$LDFLAGS -L$gssapi/lib" fi if test -d ${gssapi}; then gssapi_dir="${gssapi}/lib" GSSAPIBASE_LIBS="-L$gssapi_dir" GSSAPIBASE_STATIC_LIBS="-L$gssapi_dir" else dnl FIXME: This is only used for building cyrus, and then only as dnl a real hack. it needs to be fixed. gssapi_dir="/usr/local/lib" fi # Check a full link against the heimdal libraries. # If this fails, check a full link against the Solaris 8 and up libgss. # If this fails, assume MIT. AC_CHECK_LIB(gssapi,gss_unwrap,gss_impl="heimdal",,$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} -lcom_err) if test "$gss_impl" = "mit"; then AC_CHECK_LIB(gss,gss_unwrap,gss_impl="seam",,-lgss) fi if test "$gss_impl" = "mit"; then GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_LIBS $gssapi_dir/libgssapi_krb5.a $gssapi_dir/libkrb5.a $gssapi_dir/libk5crypto.a $gssapi_dir/libcom_err.a" elif test "$gss_impl" = "heimdal"; then GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} -lcom_err" GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_STATIC_LIBS $gssapi_dir/libgssapi.a $gssapi_dir/libkrb5.a $gssapi_dir/libasn1.a $gssapi_dir/libroken.a $gssapi_dir/libcom_err.a ${LIB_CRYPT}" elif test "$gss_impl" = "seam"; then GSSAPIBASE_LIBS=-lgss # there is no static libgss on Solaris 8 and up GSSAPIBASE_STATIC_LIBS=none else gssapi="no" AC_WARN(Disabling GSSAPI) fi fi if test "$ac_cv_header_gssapi_h" = "yes"; then AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,[Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE])) elif test "$ac_cv_header_gssapi_gssapi_h"; then AC_EGREP_HEADER(GSS_C_NT_HOSTBASED_SERVICE, gssapi/gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE,,[Define if your GSSAPI implimentation defines GSS_C_NT_HOSTBASED_SERVICE])) fi if test "$ac_cv_header_gssapi_h" = "yes"; then AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,[Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME])) elif test "$ac_cv_header_gssapi_gssapi_h"; then AC_EGREP_HEADER(GSS_C_NT_USER_NAME, gssapi/gssapi.h, AC_DEFINE(HAVE_GSS_C_NT_USER_NAME,,[Define if your GSSAPI implimentation defines GSS_C_NT_USER_NAME])) fi GSSAPI_LIBS="" AC_MSG_CHECKING(GSSAPI) if test "$gssapi" != no; then AC_MSG_RESULT(with implementation ${gss_impl}) AC_CHECK_LIB(resolv,res_search,GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lresolv") SASL_MECHS="$SASL_MECHS libgssapiv2.la" SASL_STATIC_OBJS="$SASL_STATIC_OBJS ../plugins/gssapi.o" cmu_save_LIBS="$LIBS" LIBS="$LIBS $GSSAPIBASE_LIBS" AC_CHECK_FUNCS(gsskrb5_register_acceptor_identity) LIBS="$cmu_save_LIBS" else AC_MSG_RESULT(disabled) fi AC_SUBST(GSSAPI_LIBS) AC_SUBST(GSSAPIBASE_LIBS) ]) dnl What we want to do here is setup LIB_SASL with what one would dnl generally want to have (e.g. if static is requested, make it that, dnl otherwise make it dynamic. dnl We also want to create LIB_DYN_SASL and DYNSASLFLAGS. dnl Also sets using_static_sasl to "no" "static" or "staticonly" AC_DEFUN(CMU_SASL2, [ AC_ARG_WITH(sasl, [ --with-sasl=DIR Compile with libsasl2 in ], with_sasl="$withval", with_sasl="yes") AC_ARG_WITH(staticsasl, [ --with-staticsasl=DIR Compile with staticly linked libsasl2 in ], with_staticsasl="$withval"; if test $with_staticsasl != "no"; then using_static_sasl="static" fi, with_staticsasl="no"; using_static_sasl="no") SASLFLAGS="" LIB_SASL="" cmu_saved_CPPFLAGS=$CPPFLAGS cmu_saved_LDFLAGS=$LDFLAGS cmu_saved_LIBS=$LIBS if test ${with_staticsasl} != "no"; then if test -d ${with_staticsasl}; then ac_cv_sasl_where_lib=${with_staticsasl}/lib ac_cv_sasl_where_inc=${with_staticsasl}/include SASLFLAGS="-I$ac_cv_sasl_where_inc" LIB_SASL="-L$ac_cv_sasl_where_lib" CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}" LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}" else with_staticsasl="/usr" fi AC_CHECK_HEADER(sasl/sasl.h, [ AC_CHECK_HEADER(sasl/saslutil.h, [ if test -r ${with_staticsasl}/lib/libsasl2.a; then ac_cv_found_sasl=yes AC_MSG_CHECKING(for static libsasl) LIB_SASL="$LIB_SASL ${with_staticsasl}/lib/libsasl2.a" else AC_MSG_CHECKING(for static libsasl) AC_ERROR([Could not find ${with_staticsasl}/lib/libsasl2.a]) fi ])]) AC_MSG_RESULT(found) SASL_GSSAPI_CHK LIB_SASL="$LIB_SASL $GSSAPIBASE_STATIC_LIBS" fi if test -d ${with_sasl}; then ac_cv_sasl_where_lib=${with_sasl}/lib ac_cv_sasl_where_inc=${with_sasl}/include DYNSASLFLAGS="-I$ac_cv_sasl_where_inc" if test "$ac_cv_sasl_where_lib" != ""; then CMU_ADD_LIBPATH_TO($ac_cv_sasl_where_lib, LIB_DYN_SASL) fi LIB_DYN_SASL="$LIB_DYN_SASL -lsasl2" CPPFLAGS="${cmu_saved_CPPFLAGS} -I${ac_cv_sasl_where_inc}" LDFLAGS="${cmu_saved_LDFLAGS} -L${ac_cv_sasl_where_lib}" fi dnl be sure to check for a SASLv2 specific function AC_CHECK_HEADER(sasl/sasl.h, [ AC_CHECK_HEADER(sasl/saslutil.h, [ AC_CHECK_LIB(sasl2, prop_get, ac_cv_found_sasl=yes, ac_cv_found_sasl=no)], ac_cv_found_sasl=no)], ac_cv_found_sasl=no) if test "$ac_cv_found_sasl" = "yes"; then if test "$ac_cv_sasl_where_lib" != ""; then CMU_ADD_LIBPATH_TO($ac_cv_sasl_where_lib, DYNLIB_SASL) fi DYNLIB_SASL="$DYNLIB_SASL -lsasl2" if test "$using_static_sasl" != "static"; then LIB_SASL=$DYNLIB_SASL SASLFLAGS=$DYNSASLFLAGS fi else DYNLIB_SASL="" DYNSASLFLAGS="" using_static_sasl="staticonly" fi LIBS="$cmu_saved_LIBS" LDFLAGS="$cmu_saved_LDFLAGS" CPPFLAGS="$cmu_saved_CPPFLAGS" AC_SUBST(LIB_DYN_SASL) AC_SUBST(DYNSASLFLAGS) AC_SUBST(LIB_SASL) AC_SUBST(SASLFLAGS) ]) AC_DEFUN(CMU_SASL2_REQUIRED, [AC_REQUIRE([CMU_SASL2]) if test "$ac_cv_found_sasl" != "yes"; then AC_ERROR([Cannot continue without libsasl2. Get it from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/.]) fi]) AC_DEFUN(CMU_SASL2_CHECKAPOP_REQUIRED, [ AC_REQUIRE([CMU_SASL2_REQUIRED]) cmu_saved_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $LIB_SASL" AC_CHECK_LIB(sasl2, sasl_checkapop, AC_DEFINE(HAVE_APOP), AC_MSG_ERROR([libsasl2 without working sasl_checkapop. Cannot continue.])) LDFLAGS=$cmu_saved_LDFLAGS ]) AC_DEFUN(SASL2_CRYPT_CHK,[ AC_CHECK_FUNC(crypt, cmu_have_crypt=yes, [ AC_CHECK_LIB(crypt, crypt, LIB_CRYPT="-lcrypt"; cmu_have_crypt=yes, cmu_have_crypt=no)]) AC_SUBST(LIB_CRYPT) ]) mpack-1.6/cmulocal/tcl.m40000644005347200000120000001347107473766266011012 dnl FIRST PASS AFTER STEALING THIS FROM CYRUS! dnl USE AT YOUR OWN PERIL! dnl I MEAN IT! dnl dnl tcl.m4: an autoconf Tcl locator dnl $Id: tcl.m4,v 1.3 2002/05/25 19:57:42 leg Exp $ dnl dnl This is rob's Tcl macro, fixed by tjs. It may need occasional tweaking, dnl but until the next impediment to compilation, it's fill-in-the-blank, dnl and it should be able to do reasonable things with user input. dnl dnl This will probably just work on Andrew systems, but given the variety dnl and apparent creativity of people who compile Tcl elsewhere, I don't know dnl what it will do. I have yet to see an autoconf Tcl test that users were dnl happy with. dnl dnl BUGS dnl The command-line arguments are overcomplicated. dnl There are doubtlessly others... dnl To use this macro, just do CMU_TCL. It outputs dnl TCL_LIBS, TCL_CPPFLAGS, and TCL_DEFS and SUBSTs them. dnl If successful, these have stuff in them. If not, they're empty. dnl If not successful, with_tcl has the value "no". AC_DEFUN(CMU_TCL, [ # --- BEGIN CMU_TCL --- dnl To link against Tcl, configure does several things to make my life dnl "easier". dnl dnl * maybe ask the user where they think Tcl lives, and try to find it dnl * maybe ask the user what "tclsh" is called this week (i.e., "tclsh8.0") dnl * run tclsh, ask it for a path, then run that path through sed dnl * sanity check its result (many installs are a little broken) dnl * try to figure out where Tcl is based on this result dnl * try to guess where the Tcl include files are dnl dnl Notes from previous incarnations: dnl > XXX MUST CHECK FOR TCL BEFORE KERBEROS V4 XXX dnl > This is because some genius at MIT named one of the Kerberos v4 dnl > library functions log(). This of course conflicts with the dnl > logarithm function in the standard math library, used by Tcl. dnl dnl > Checking for Tcl first puts -lm before -lkrb on the library list. dnl dnl Check for some information from the user on what the world looks like AC_ARG_WITH(tclconfig,[ --with-tclconfig=PATH use tclConfig.sh from PATH (configure gets Tcl configuration from here)], dnl trim tclConfig.sh off the end so we can add it back on later. TclLibBase=`echo ${withval} | sed s/tclConfig.sh\$//`) AC_ARG_WITH(tcl, [ --with-tcl=PATH use Tcl from PATH], TclLibBase="${withval}/lib") AC_ARG_WITH(tclsh, [ --with-tclsh=TCLSH use TCLSH as the tclsh program (let configure find Tcl using this program)], TCLSH="${withval}") if test "$TCLSH" = "no" -o "$with_tclconfig" = "no" ; then AC_MSG_WARN([Tcl disabled because tclsh or tclconfig specified as "no"]) with_tcl=no fi if test "$with_tcl" != "no"; then if test \! -z "$with_tclconfig" -a \! -d "$with_tclconfig" ; then AC_MSG_ERROR([--with-tclconfig requires a directory argument.]) fi if test \! -z "$TCLSH" -a \! -x "$TCLSH" ; then AC_MSG_ERROR([--with-tclsh must specify an executable file.]) fi if test -z "$TclLibBase"; then # do we already know? # No? Run tclsh and ask it where it lives. # Do we know where a tclsh lives? if test -z "$TCLSH"; then # Try and find tclsh. Any tclsh. # If a new version of tcl comes out and unfortunately adds another # filename, it should be safe to add it (to the front of the line -- # somef vendors have older, badly installed tclshs that we want to avoid # if we can) AC_PATH_PROGS(TCLSH, [tclsh8.1 tclsh8.0 tclsh], "unknown") fi # Do we know where to get a tclsh? if test "${TCLSH}" != "unknown"; then AC_MSG_CHECKING([where Tcl says it lives]) TclLibBase=`echo puts \\\$tcl_library | ${TCLSH} | sed -e 's,[^/]*$,,'` AC_MSG_RESULT($TclLibBase) fi fi if test -z "$TclLibBase" ; then AC_MSG_RESULT([can't find tclsh]) AC_MSG_WARN([can't find Tcl installtion; use of Tcl disabled.]) with_tcl=no else AC_MSG_CHECKING([for tclConfig.sh]) # Check a list of places where the tclConfig.sh file might be. for tcldir in "${TclLibBase}" \ "${TclLibBase}/.." \ "${TclLibBase}"`echo ${TCLSH} | sed s/sh//` ; do if test -f "${tcldir}/tclConfig.sh"; then TclLibBase="${tcldir}" break fi done if test -z "${TclLibBase}" ; then AC_MSG_RESULT("unknown") AC_MSG_WARN([can't find Tcl configuration; use of Tcl disabled.]) with_tcl=no else AC_MSG_RESULT(${TclLibBase}/) fi if test "${with_tcl}" != no ; then AC_MSG_CHECKING([Tcl configuration on what Tcl needs to compile]) . ${TclLibBase}/tclConfig.sh AC_MSG_RESULT(ok) dnl no TK stuff for us. dnl . ${TclLibBase}/tkConfig.sh fi if test "${with_tcl}" != no ; then dnl Now, hunt for the Tcl include files, since we don't strictly dnl know where they are; some folks put them (properly) in the dnl default include path, or maybe in /usr/local; the *BSD folks dnl put them in other places. AC_MSG_CHECKING([where Tcl includes are]) for tclinclude in "${TCL_PREFIX}/include/tcl${TCL_VERSION}" \ "${TCL_PREFIX}/include/tcl" \ "${TCL_PREFIX}/include" ; do if test -r "${tclinclude}/tcl.h" ; then TCL_CPPFLAGS="-I${tclinclude}" break fi done if test -z "${TCL_CPPFLAGS}" ; then AC_MSG_WARN(can't find Tcl includes; use of Tcl disabled.) with_tcl=no fi AC_MSG_RESULT(${TCL_CPPFLAGS}) fi # Finally, pick up the Tcl configuration if we haven't found an # excuse not to. if test "${with_tcl}" != no; then dnl TCL_LIBS="${TK_LIB_SPEC} ${TK_XLIBSW} ${TCL_LD_SEARCH_FLAGS} ${TCL_LIB_SPEC}" TCL_LIBS="${TCL_LD_SEARCH_FLAGS} ${TCL_LIB_SPEC} ${TCL_LIBS}" fi fi fi AC_SUBST(TCL_DEFS) AC_SUBST(TCL_LIBS) AC_SUBST(TCL_CPPFLAGS) # --- END CMU_TCL --- ]) dnl CMU_TCL mpack-1.6/cmulocal/telnet.m40000644005347200000120000001246507473766266011525 dnl telnet.m4--telnet special macros dnl Derrick Brashear dnl $Id: telnet.m4,v 1.11 2002/05/25 19:57:42 leg Exp $ AC_DEFUN(CMU_TELNET_WHICH_TERM, [ AC_CHECK_LIB(termlib, setupterm, [ AC_DEFINE(HAVE_SETUPTERM) AC_CHECK_LIB(c, setupterm, TCLIB="/usr/ccs/lib/libtermlib.a",TCLIB="-ltermlib","/usr/ccs/lib/libtermlib.a") ], TCLIB="-ltermcap") ]) AC_DEFUN(CMU_TELNET_CC_T, [ AC_MSG_CHECKING(for cc_t definition) AC_CACHE_VAL(cmu_cv_cc_t_definition, [ AC_TRY_COMPILE( [ #ifdef HAVE_SYS_TERMIOS_H #include #else #ifdef HAVE_SYS_TERMIO_H #include #endif #endif ], [cc_t ffoo;], cmu_cv_cc_t_definition=yes, cmu_cv_cc_t_definition=no) ]) if test "$cmu_cv_cc_t_definition" = "no"; then AC_DEFINE(NO_CC_T) fi AC_MSG_RESULT($cmu_cv_cc_t_definition) ]) AC_DEFUN(CMU_STREAMS, [ if test "$ac_cv_header_sys_stropts_h" = "yes" -o "$ac_cv_header_stropts_h" = "yes"; then AC_DEFINE(HAVE_STREAMS)dnl fi ]) AC_DEFUN(CMU_TERMIO_MODEL, [ if test "$ac_cv_header_sys_termio_h" = "yes" -o "$ac_cv_header_sys_termios_h" = "yes"; then AC_DEFINE(USE_TERMIO)dnl if test "$ac_cv_header_sys_termios_h" = "no"; then AC_DEFINE(SYSV_TERMIO)dnl fi fi ]) AC_DEFUN(CMU_TELNET_DES_STRING_TO_KEY_PROTO, [ AC_MSG_CHECKING(for des_string_to_key prototype) AC_CACHE_VAL(cmu_cv_des_string_to_key_proto, [ AC_TRY_COMPILE( [#include typedef unsigned char Block[8]; int des_string_to_key(char *, Block);], [int foo = des_string_to_key(NULL, NULL);], cmu_cv_des_string_to_key_proto=no, cmu_cv_des_string_to_key_proto=yes) ]) if test "$cmu_cv_des_string_to_key_proto" = yes; then AC_DEFINE(HAVE_DES_STRING_TO_KEY_PROTO)dnl fi AC_MSG_RESULT($cmu_cv_des_string_to_key_proto) ]) AC_DEFUN(CMU_TELNET_DES_KEY_SCHED_PROTO, [ AC_MSG_CHECKING(for des_key_sched prototype) AC_CACHE_VAL(cmu_cv_des_key_sched_proto, [ AC_TRY_COMPILE( [ #include char des_key_sched(int foo, int bar, int baz); ], [des_key_sched(NULL, NULL);], cmu_cv_des_key_sched_proto=no, cmu_cv_des_key_sched_proto=yes) ]) if test "$cmu_cv_des_key_sched_proto" = yes; then AC_DEFINE(HAVE_DES_KEY_SCHED_PROTO)dnl fi AC_MSG_RESULT($cmu_cv_des_key_sched_proto) ]) AC_DEFUN(CMU_TELNET_DES_SET_RANDOM_GENERATOR_SEED_PROTO, [ AC_MSG_CHECKING(for des_set_random_generator_seed prototype) AC_CACHE_VAL(cmu_cv_des_set_random_generator_seed_proto, [ AC_TRY_COMPILE( [ #include char des_set_random_generator_seed(int foo, int bar, int baz); ], [des_set_random_generator_seed(NULL, NULL);], cmu_cv_des_set_random_generator_seed_proto=no, cmu_cv_des_set_random_generator_seed_proto=yes) ]) if test "$cmu_cv_des_set_random_generator_seed_proto" = yes; then AC_DEFINE(HAVE_DES_SET_RANDOM_GENERATOR_SEED_PROTO)dnl fi AC_MSG_RESULT($cmu_cv_des_set_random_generator_seed_proto) ]) AC_DEFUN(CMU_TELNET_DES_NEW_RANDOM_KEY_PROTO, [ AC_MSG_CHECKING(for des_new_random_key prototype) AC_CACHE_VAL(cmu_cv_des_new_random_key_proto, [ AC_TRY_COMPILE( [ #include char des_new_random_key(int foo, int bar, int baz); ], [des_new_random_key(NULL, NULL);], cmu_cv_des_new_random_key_proto=no, cmu_cv_des_new_random_key_proto=yes) ]) if test "$cmu_cv_des_new_random_key_proto" = yes; then AC_DEFINE(HAVE_DES_NEW_RANDOM_KEY_PROTO)dnl fi AC_MSG_RESULT($cmu_cv_des_new_random_key_proto) ]) AC_DEFUN(CMU_TELNET_DES_ECB_ENCRYPT_PROTO, [ AC_MSG_CHECKING(for des_ecb_encrypt prototype) AC_CACHE_VAL(cmu_cv_des_ecb_encrypt_proto, [ AC_TRY_COMPILE( [#include typedef unsigned char Block[8]; typedef struct { Block _; } Schedule[16]; void des_ecb_encrypt(Block, Block, Schedule, int);], [int foo = des_ecb_encrypt(NULL, NULL, NULL, 0);], cmu_cv_des_ecb_encrypt_proto=no, cmu_cv_des_ecb_encrypt_proto=yes) ]) if test "$cmu_cv_des_ecb_encrypt_proto" = yes; then AC_DEFINE(HAVE_DES_ECB_ENCRYPT_PROTO)dnl fi AC_MSG_RESULT($cmu_cv_des_ecb_encrypt_proto) ]) AC_DEFUN(CMU_TELNET_NEWDES, [ AC_REQUIRE([CMU_KRB4]) AC_REQUIRE([CMU_KRB5]) AC_MSG_CHECKING(for des_new_random_key prototype) AC_CACHE_VAL(ac_cv_func_des_new_random_key_proto, [ AC_TRY_COMPILE( [#include des_cblock key;], [des_new_random_key(&key);], ac_cv_func_des_new_random_key=yes, ac_cv_func_des_new_random_key=no) ]) if test "$ac_cv_func_des_new_random_key" = yes; then AC_DEFINE(NEWDESLIB)dnl fi AC_MSG_RESULT($ac_cv_func_des_new_random_key) ]) AC_DEFUN(CMU_TELNET_OLDNEWDES, [ AC_REQUIRE([CMU_KRB4]) AC_REQUIRE([CMU_KRB5]) saved_LIBS=$LIBS LIBS="$KRB_LIB_FLAGS $KRB5_LIB_FLAGS" if test "$with_des" = yes; then AC_CHECK_FUNCS(des_new_random_key) if test "$ac_cv_func_des_new_random_key" = yes; then AC_DEFINE(NEWDESLIB) fi fi LIBS=$saved_LIBS ]) AC_DEFUN(CMU_TELNET_GETTYTAB, [ if test -f "/etc/gettytab"; then AC_CHECK_FUNCS(getent getstr) if test "X$ac_cv_func_getent" != "Xyes"; then AC_DEFINE(HAVE_GETTYTAB) if test "X$ac_cv_func_getstr" = "Xyes"; then CFLAGS="$CFLAGS -Dgetstr=ggetstr" fi fi else AC_CHECK_FUNCS(cgetent) fi ]) AC_DEFUN(CMU_TELNET_ISSUE, [ if test -f "/etc/issue.net"; then AC_DEFINE(ISSUE_FILE, "/etc/issue.net") else if test -f "/etc/issue"; then AC_DEFINE(ISSUE_FILE, "/etc/issue") fi fi ]) AC_DEFUN(CMU_TELNET_PTYDIR, [ if test -d /dev/pts -o -d /dev/pty; then case "${host}" in *-*-irix*) ;; *-*-linux*) AC_DEFINE(PTYDIR) ;; *) AC_DEFINE(PTYDIR) AC_DEFINE(STREAMSPTY) ;; esac fi ]) mpack-1.6/cmulocal/ucdsnmp.m40000644005347200000120000000174007530725667011667 dnl look for the ucdsnmp libraries dnl $Id: ucdsnmp.m4,v 1.5 2002/08/21 15:03:19 rjs3 Exp $ AC_DEFUN(CMU_UCDSNMP, [ AC_REQUIRE([CMU_SOCKETS]) AC_ARG_WITH(ucdsnmp, [ --with-ucdsnmp=DIR use ucd snmp (rooted in DIR) [yes] ], with_ucdsnmp=$withval, with_ucdsnmp=yes) if test "$with_ucdsnmp" != no; then if test -d "$with_ucdsnmp"; then CPPFLAGS="$CPPFLAGS -I${with_ucdsnmp}/include" LDFLAGS="$LDFLAGS -L${with_ucdsnmp}/lib" fi cmu_save_LIBS="$LIBS" AC_CHECK_LIB(snmp, sprint_objid, [ AC_CHECK_HEADER(ucd-snmp/version.h,, with_ucdsnmp=no)], with_ucdsnmp=no, ${LIB_SOCKET}) LIBS="$cmu_save_LIBS" fi AC_MSG_CHECKING(UCD SNMP libraries) AC_MSG_RESULT($with_ucdsnmp) LIB_UCDSNMP="" if test "$with_ucdsnmp" != no; then AC_DEFINE(HAVE_UCDSNMP) LIB_UCDSNMP="-lucdagent -lucdmibs -lsnmp" AC_CHECK_LIB(rpm, rpmdbOpen, LIB_UCDSNMP="${LIB_UCDSNMP} -lrpm -lpopt",,-lpopt) fi AC_SUBST(LIB_UCDSNMP) ]) mpack-1.6/cmulocal/util.m40000644005347200000120000000425007473766267011201 dnl util.m4--robutil macro dnl Rob Earhart dnl $Id: util.m4,v 1.9 2002/05/25 19:57:43 leg Exp $ dnl robutil is a collection of stuff I (Rob Earhart) have found useful dnl to have around when writing code; it's the stuff I wind up rewriting dnl every time I start a project. This does the autoconf setup dnl necessary for it. dnl This is a helper macro, here because there're times when I dnl want to know if a type exists or not, but don't want to define dnl it to something else (the way AC_CHECK_TYPE does). AC_DEFUN(CMU_CHECK_TYPE_EXISTS, [ changequote(<<, >>) define(<>, translit(CMU_HAVE_$1, [a-z *], [A-Z_P])) define(<>, translit(cmu_cv_type_$1, [ *], [_p])) changequote([, ]) AC_REQUIRE([AC_HEADER_STDC]) AC_MSG_CHECKING(for $1) AC_CACHE_VAL(CMU_CV_NAME, [ AC_EGREP_CPP([$1[[^a-zA-Z_0-9]]], [ #include #if STDC_HEADERS #include #include #endif ], CMU_CV_NAME=yes, CMU_CV_NAME=no)]) AC_MSG_RESULT($CMU_CV_NAME) if test $CMU_CV_NAME = yes; then AC_DEFINE(CMU_TYPE_NAME) fi ]) AC_DEFUN(CMU_UTIL, [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AM_PROG_CC_STDC]) AC_REQUIRE([AC_PROG_RANLIB]) AC_REQUIRE([CMU_NANA]) AC_REQUIRE([CMU_COMERR]) AC_REQUIRE([AC_HEADER_STDC]) AC_REQUIRE([AC_TYPE_MODE_T]) AC_REQUIRE([AC_C_CONST]) AC_CHECK_HEADERS(sys/sysmacros.h) AC_CHECK_HEADER(inttypes.h, AC_DEFINE(HAVE_INTTYPES_H), CMU_CHECK_TYPE_EXISTS(int8_t) CMU_CHECK_TYPE_EXISTS(uint8_t) CMU_CHECK_TYPE_EXISTS(u_int8_t) CMU_CHECK_TYPE_EXISTS(int16_t) CMU_CHECK_TYPE_EXISTS(uint16_t) CMU_CHECK_TYPE_EXISTS(u_int16_t) CMU_CHECK_TYPE_EXISTS(int32_t) CMU_CHECK_TYPE_EXISTS(uint32_t) CMU_CHECK_TYPE_EXISTS(u_int32_t) ) dnl I'm not sure why autoconf gets so annoyed when these dnl are embedded as part of the inttypes check, but, whatever, dnl this works. if test "$ac_cv_header_inttypes_h" = no; then AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) fi AC_CHECK_TYPE(ssize_t, signed) THREADED_UTIL_OBJECTS="" AC_SUBST(THREADED_UTIL_OBJECTS) ]) AC_DEFUN(CMU_THREAD_UTIL, [ AC_REQUIRE([CMU_UTIL]) THREADED_UTIL_OBJECTS="refcache.o rselock.o" ]) mpack-1.6/Changes0000644005347200000120000000060707707055453007444 1.6 -- Jul 21 2003 Use automake and a little bit of autoconf convert K&R declarations/definitions to ANSI Fixed buffer overflow in getParam and getDispositionFilename (debian patch) Fixed possible crash in ParseContent (debian patch) fix typo in getDispositionFilename (from Steve Friedl) use system strcasecmp and getopt where possible. use O_EXCL where available when creating files.