photopc-3.05/Makefile.in 644 2627 62 53721 7227711424 10300 # 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. # FSF thinks that the source generated by a tool copyrighted # by FSF is also copyrighted by FSF. This might be true, but # still, if you read this text in Makefile.in or Makefile, then # be informed that the orifinal file, and the "meat" of the # package, is: # # Copyright (c) 1997-1999 Eugene G. Crosser # Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) # # You may distribute and/or use for any purpose modified or unmodified # copies of this software if you preserve the copyright notice above. # # THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY # KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE # COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE # USE OF THIS SOFTWARE. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include DESTDIR = pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : AR = @AR@ CC = @CC@ CPP = @CPP@ ECHO = @ECHO@ INT16 = @INT16@ INT32 = @INT32@ LIBPROGS = @LIBPROGS@ LN = @LN@ LN_S = @LN_S@ MAKEINFO = @MAKEINFO@ MV = @MV@ PACKAGE = @PACKAGE@ PROGS = @PROGS@ RANLIB = @RANLIB@ RM = @RM@ U = @U@ VERSION = @VERSION@ AUTOMAKE_OPTIONS = foreign ansi2knr bin_PROGRAMS = photopc epinfo lib_LIBRARIES = libeph_io.a include_HEADERS = eph_io.h man_MANS = photopc.1 epinfo.1 EXTRA_DIST = $(man_MANS) protocol.htm usage.htm readme.dos dos/Makefile dos/config.h dos/version.h win32/Makefile win32/config.h win32/version.h photopc_SOURCES = photopc.c a12scan.c a12scan.h fnames.c fnames.h ctimez.c ctimez.h filetime.c filetime.h exifscan.c exifscan.h eph_io.h EXTRA_photopc_SOURCES = comio.c comio.h getopt.h usleep.h strcscmp.h photopc_LDADD = @LIBOBJS@ libeph_io.a epinfo_SOURCES = epinfo.c a12scan.c a12scan.h exifscan.c exifscan.h fnames.c fnames.h ctimez.c ctimez.h filetime.c filetime.h EXTRA_epinfo_SOURCES = getopt.h epinfo_LDADD = @LIBOBJS@ libeph_io_a_SOURCES = eph_read.c eph_iob.c eph_err.c eph_cmd.c eph_io.c eph_open.c eph_io.h eph_priv.h ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h ./dos/version.h ./win32/version.h CONFIG_CLEAN_FILES = LIBRARIES = $(lib_LIBRARIES) DEFS = @DEFS@ -I. -I$(srcdir) -I. -I./dos -I./win32 CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ ANSI2KNR = @ANSI2KNR@ libeph_io_a_LIBADD = libeph_io_a_OBJECTS = eph_read$U.o eph_iob$U.o eph_err$U.o eph_cmd$U.o \ eph_io$U.o eph_open$U.o PROGRAMS = $(bin_PROGRAMS) photopc_OBJECTS = photopc$U.o a12scan$U.o fnames$U.o ctimez$U.o \ filetime$U.o exifscan$U.o photopc_DEPENDENCIES = @LIBOBJS@ libeph_io.a photopc_LDFLAGS = epinfo_OBJECTS = epinfo$U.o a12scan$U.o exifscan$U.o fnames$U.o \ ctimez$U.o filetime$U.o epinfo_DEPENDENCIES = @LIBOBJS@ epinfo_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 = $(include_HEADERS) DIST_COMMON = README ./stamp-h1.in Makefile.am Makefile.in acconfig.h \ aclocal.m4 ansi2knr.1 ansi2knr.c config.h.in configure configure.in \ dos/stamp-h2.in dos/version.h.in getopt.c install-sh missing \ mkinstalldirs strcscmp.c usleep.c win32/stamp-h3.in win32/version.h.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = gtar GZIP_ENV = --best SOURCES = $(libeph_io_a_SOURCES) $(photopc_SOURCES) $(EXTRA_photopc_SOURCES) $(epinfo_SOURCES) $(EXTRA_epinfo_SOURCES) OBJECTS = $(libeph_io_a_OBJECTS) $(photopc_OBJECTS) $(epinfo_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) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES= CONFIG_HEADERS=config.h \ $(SHELL) ./config.status @echo timestamp > stamp-h1 2> /dev/null $(srcdir)/config.h.in: $(srcdir)/stamp-h1.in @if test ! -f $@; then \ rm -f $(srcdir)/stamp-h1.in; \ $(MAKE) $(srcdir)/stamp-h1.in; \ else :; fi $(srcdir)/stamp-h1.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h cd $(top_srcdir) && $(AUTOHEADER) @echo timestamp > $(srcdir)/stamp-h1.in 2> /dev/null dos/version.h: dos/stamp-h2 @if test ! -f $@; then \ rm -f dos/stamp-h2; \ $(MAKE) dos/stamp-h2; \ else :; fi dos/stamp-h2: $(srcdir)/dos/version.h.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES= CONFIG_HEADERS=dos/version.h \ $(SHELL) ./config.status @echo timestamp > dos/stamp-h2 2> /dev/null $(srcdir)/dos/version.h.in: $(srcdir)/dos/stamp-h2.in @if test ! -f $@; then \ rm -f $(srcdir)/dos/stamp-h2.in; \ $(MAKE) $(srcdir)/dos/stamp-h2.in; \ else :; fi $(srcdir)/dos/stamp-h2.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h cd $(top_srcdir) && $(AUTOHEADER) @echo timestamp > $(srcdir)/dos/stamp-h2.in 2> /dev/null win32/version.h: win32/stamp-h3 @if test ! -f $@; then \ rm -f win32/stamp-h3; \ $(MAKE) win32/stamp-h3; \ else :; fi win32/stamp-h3: $(srcdir)/win32/version.h.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES= CONFIG_HEADERS=win32/version.h \ $(SHELL) ./config.status @echo timestamp > win32/stamp-h3 2> /dev/null $(srcdir)/win32/version.h.in: $(srcdir)/win32/stamp-h3.in @if test ! -f $@; then \ rm -f $(srcdir)/win32/stamp-h3.in; \ $(MAKE) $(srcdir)/win32/stamp-h3.in; \ else :; fi $(srcdir)/win32/stamp-h3.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h cd $(top_srcdir) && $(AUTOHEADER) @echo timestamp > $(srcdir)/win32/stamp-h3.in 2> /dev/null mostlyclean-hdr: clean-hdr: distclean-hdr: -rm -f config.h dos/version.h win32/version.h maintainer-clean-hdr: mostlyclean-libLIBRARIES: clean-libLIBRARIES: -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) distclean-libLIBRARIES: maintainer-clean-libLIBRARIES: install-libLIBRARIES: $(lib_LIBRARIES) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(libdir) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ else :; fi; \ done @$(POST_INSTALL) @list='$(lib_LIBRARIES)'; for p in $$list; do \ if test -f $$p; then \ echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \ $(RANLIB) $(DESTDIR)$(libdir)/$$p; \ else :; fi; \ done uninstall-libLIBRARIES: @$(NORMAL_UNINSTALL) list='$(lib_LIBRARIES)'; for p in $$list; do \ rm -f $(DESTDIR)$(libdir)/$$p; \ 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: mostlyclean-krextra: clean-krextra: -rm -f ansi2knr distclean-krextra: maintainer-clean-krextra: ansi2knr: ansi2knr.o $(LINK) ansi2knr.o $(LIBS) ansi2knr.o: $(CONFIG_HEADER) mostlyclean-kr: -rm -f *_.c clean-kr: distclean-kr: maintainer-clean-kr: libeph_io.a: $(libeph_io_a_OBJECTS) $(libeph_io_a_DEPENDENCIES) -rm -f libeph_io.a $(AR) cru libeph_io.a $(libeph_io_a_OBJECTS) $(libeph_io_a_LIBADD) $(RANLIB) libeph_io.a 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 photopc: $(photopc_OBJECTS) $(photopc_DEPENDENCIES) @rm -f photopc $(LINK) $(photopc_LDFLAGS) $(photopc_OBJECTS) $(photopc_LDADD) $(LIBS) epinfo: $(epinfo_OBJECTS) $(epinfo_DEPENDENCIES) @rm -f epinfo $(LINK) $(epinfo_LDFLAGS) $(epinfo_OBJECTS) $(epinfo_LDADD) $(LIBS) a12scan_.c: a12scan.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/a12scan.c; then echo $(srcdir)/a12scan.c; else echo a12scan.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > a12scan_.c comio_.c: comio.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/comio.c; then echo $(srcdir)/comio.c; else echo comio.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > comio_.c ctimez_.c: ctimez.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ctimez.c; then echo $(srcdir)/ctimez.c; else echo ctimez.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ctimez_.c eph_cmd_.c: eph_cmd.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eph_cmd.c; then echo $(srcdir)/eph_cmd.c; else echo eph_cmd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > eph_cmd_.c eph_err_.c: eph_err.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eph_err.c; then echo $(srcdir)/eph_err.c; else echo eph_err.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > eph_err_.c eph_io_.c: eph_io.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eph_io.c; then echo $(srcdir)/eph_io.c; else echo eph_io.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > eph_io_.c eph_iob_.c: eph_iob.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eph_iob.c; then echo $(srcdir)/eph_iob.c; else echo eph_iob.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > eph_iob_.c eph_open_.c: eph_open.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eph_open.c; then echo $(srcdir)/eph_open.c; else echo eph_open.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > eph_open_.c eph_read_.c: eph_read.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eph_read.c; then echo $(srcdir)/eph_read.c; else echo eph_read.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > eph_read_.c epinfo_.c: epinfo.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/epinfo.c; then echo $(srcdir)/epinfo.c; else echo epinfo.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > epinfo_.c exifscan_.c: exifscan.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/exifscan.c; then echo $(srcdir)/exifscan.c; else echo exifscan.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > exifscan_.c filetime_.c: filetime.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/filetime.c; then echo $(srcdir)/filetime.c; else echo filetime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > filetime_.c fnames_.c: fnames.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fnames.c; then echo $(srcdir)/fnames.c; else echo fnames.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > fnames_.c getopt_.c: getopt.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt_.c photopc_.c: photopc.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/photopc.c; then echo $(srcdir)/photopc.c; else echo photopc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > photopc_.c strcscmp_.c: strcscmp.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/strcscmp.c; then echo $(srcdir)/strcscmp.c; else echo strcscmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > strcscmp_.c usleep_.c: usleep.c $(ANSI2KNR) $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/usleep.c; then echo $(srcdir)/usleep.c; else echo usleep.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > usleep_.c a12scan_.o comio_.o ctimez_.o eph_cmd_.o eph_err_.o eph_io_.o \ eph_iob_.o eph_open_.o eph_read_.o epinfo_.o exifscan_.o filetime_.o \ fnames_.o getopt_.o photopc_.o strcscmp_.o usleep_.o : $(ANSI2KNR) 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 install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(includedir) @list='$(include_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) list='$(include_HEADERS)'; for p in $$list; do \ rm -f $(DESTDIR)$(includedir)/$$p; \ done 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) config.h.in $(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)config.h.in$$unique$(LISP)$$tags" \ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$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) $(mkinstalldirs) $(distdir)/dos $(distdir)/win32 @for file in $(DISTFILES); do \ d=$(srcdir); \ if test -d $$d/$$file; then \ cp -pr $$/$$file $(distdir)/$$file; \ else \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file || :; \ fi; \ done a12scan.o: a12scan.c config.h a12scan.h ctimez.o: ctimez.c config.h ctimez.h eph_cmd.o: eph_cmd.c config.h eph_io.h eph_priv.h eph_err.o: eph_err.c config.h eph_io.h eph_priv.h eph_io.o: eph_io.c config.h getopt.h eph_io.h eph_priv.h eph_iob.o: eph_iob.c config.h eph_io.h eph_open.o: eph_open.c config.h getopt.h eph_io.h eph_priv.h eph_read.o: eph_read.c config.h eph_io.h eph_priv.h getopt.h epinfo.o: epinfo.c config.h a12scan.h exifscan.h fnames.h ctimez.h \ filetime.h getopt.h exifscan.o: exifscan.c config.h exifscan.h filetime.o: filetime.c config.h ctimez.h fnames.o: fnames.c config.h fnames.h ctimez.h photopc.o: photopc.c config.h getopt.h eph_io.h a12scan.h fnames.h \ ctimez.h filetime.h info-am: info: info-am dvi-am: dvi: dvi-am check-am: all-am check: check-am installcheck-am: installcheck: installcheck-am all-recursive-am: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive install-exec-am: install-libLIBRARIES install-binPROGRAMS install-exec: install-exec-am install-data-am: install-man install-includeHEADERS install-data: install-data-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am install: install-am uninstall-am: uninstall-libLIBRARIES uninstall-binPROGRAMS uninstall-man \ uninstall-includeHEADERS uninstall: uninstall-am all-am: Makefile $(ANSI2KNR) $(LIBRARIES) $(PROGRAMS) $(MANS) $(HEADERS) \ config.h all-redirect: all-am install-strip: $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install installdirs: $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) \ $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(includedir) 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: mostlyclean-am: mostlyclean-hdr mostlyclean-libLIBRARIES \ mostlyclean-compile mostlyclean-krextra mostlyclean-kr \ mostlyclean-binPROGRAMS mostlyclean-tags \ mostlyclean-generic mostlyclean: mostlyclean-am clean-am: clean-hdr clean-libLIBRARIES clean-compile clean-krextra \ clean-kr clean-binPROGRAMS clean-tags clean-generic \ mostlyclean-am clean: clean-am distclean-am: distclean-hdr distclean-libLIBRARIES distclean-compile \ distclean-krextra distclean-kr distclean-binPROGRAMS \ distclean-tags distclean-generic clean-am distclean: distclean-am -rm -f config.status maintainer-clean-am: maintainer-clean-hdr maintainer-clean-libLIBRARIES \ maintainer-clean-compile maintainer-clean-krextra \ maintainer-clean-kr maintainer-clean-binPROGRAMS \ 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-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ mostlyclean-libLIBRARIES distclean-libLIBRARIES clean-libLIBRARIES \ maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \ install-libLIBRARIES mostlyclean-compile distclean-compile \ clean-compile maintainer-clean-compile mostlyclean-krextra \ distclean-krextra clean-krextra maintainer-clean-krextra mostlyclean-kr \ distclean-kr clean-kr maintainer-clean-kr mostlyclean-binPROGRAMS \ distclean-binPROGRAMS clean-binPROGRAMS maintainer-clean-binPROGRAMS \ uninstall-binPROGRAMS install-binPROGRAMS install-man1 uninstall-man1 \ install-man uninstall-man uninstall-includeHEADERS \ install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \ maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \ installcheck-am installcheck all-recursive-am 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 # 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: photopc-3.05/dos/stamp-h2.in 644 2627 62 12 7227711414 10703 timestamp photopc-3.05/dos/version.h.in 644 2627 62 125 6755225616 11221 /* Name of package */ #undef PACKAGE /* Version number of package */ #undef VERSION photopc-3.05/dos/Makefile 644 2627 62 12626 6751647032 10463 # $Id: Makefile,v 2.9 1999/08/01 23:24:26 crosser Exp $ # # Copyright (c) 1997,1998 Eugene G. Crosser # Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) # # You may distribute and/or use for any purpose modified or unmodified # copies of this software if you preserve the copyright notice above. # # THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY # KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE # COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE # USE OF THIS SOFTWARE. # # $Log: Makefile,v $ # Revision 2.9 1999/08/01 23:24:26 crosser # DOS make in subdirectory # # Revision 2.8 1999/03/22 06:08:44 lightner # Fix logic to put ALL binaries into msdos/ # Add extra library to keep DOS link command line short # # Revision 2.7 1999/03/12 10:37:13 crosser # try workaround a problem with tmake # # Revision 2.6 1999/03/12 10:19:17 crosser # add ctrl-Z in the end # # Revision 2.5 1999/03/12 10:06:23 crosser # make usable with tc1.0 # # Revision 2.4 1999/03/10 22:34:43 crosser # sync with structure changes # # Revision 2.3 1999/01/17 13:27:59 bruce # make win/dos versions in separate subdirs # # Revision 2.2 1998/10/18 13:18:27 crosser # Put RCS logs and I.D. into the source # # Revision 2.1 1998/02/16 06:13:29 lightner # Add $(MODEL) and change to "small"; improve cleanup logic # # Revision 2.0 1998/02/13 23:01:50 crosser # remove $@ for work with make from TC1.0 # # Revision 1.2 1998/02/08 19:58:38 crosser # Support low memory: chunked saving etc. # # Revision 1.1 1998/01/18 02:16:45 crosser # Initial revision # # Modified by Bruce D. Lightner (lightner@lightner.net) on 1/8/98 to # support builds under Borland International Turbo C++ Version 3.0. # # To "make" using Borland International's Turbo C++ toolset, ensure that # your PATH points to the proper Turbo C++ binary directory, then enter # the following commands: # # make gclean # make srcdir = .. OPTS = -DHAVE_CONFIG_H CC = tcc #MODEL = -ml MODEL = -ms CFLAGS = $(MODEL) -O2 -G -wsus -wpar LD = tlink LDFLAGS = $(MODEL) -M AR = tlib # "-I." go first to include right config.h ! INC = -I. -I$(srcdir) ##### No need to touch anything below this line ##### LIBOBJS = eph_read.obj eph_iob.obj eph_err.obj eph_cmd.obj \ eph_io.obj eph_open.obj getopt.obj usleep.obj \ strcscmp.obj comio.obj LIBLIST1=+eph_read.obj+eph_iob.obj+eph_err.obj+eph_cmd.obj LIBLIST2=+eph_io.obj+eph_open.obj+getopt.obj+usleep.obj LIBLIST3=+strcscmp.obj+comio.obj LIB2OBJS=a12scan.obj fnames.obj ctimez.obj filetime.obj \ exifscan.obj LIB2LIST1=+a12scan.obj+fnames.obj+ctimez.obj+filetime.obj LIB2LIST2=+exifscan.obj .c.obj: $(CC) $(CFLAGS) $(OPTS) $(INC) -c $< all: eph_io.lib photopc.exe epinfo.exe eph_io.lib: $(LIBOBJS) del eph_io.lib $(AR) eph_io.lib $(LIBLIST1) $(AR) eph_io.lib $(LIBLIST2) $(AR) eph_io.lib $(LIBLIST3) del eph_io.bak ephextra.lib: $(LIB2OBJS) del ephextra.lib $(AR) ephextra.lib $(LIB2LIST1) $(AR) ephextra.lib $(LIB2LIST2) del ephextra.bak photopc.exe: photopc.obj eph_io.lib ephextra.lib $(CC) $(LDFLAGS) photopc.obj eph_io.lib ephextra.lib epinfo.exe: epinfo.obj eph_io.lib ephextra.lib $(CC) $(LDFLAGS) epinfo.obj eph_io.lib ephextra.lib tidyup: del ephextra.lib del ephextra.bak del eph_io.bak del *.map del *.obj clean: tidyup del eph_io.lib del photopc.exe del epinfo.exe rmdir $(T) MKOBJ = $(CC) $(CFLAGS) $(OPTS) $(INC) -c photopc.obj: $(srcdir)/photopc.c $(srcdir)/eph_io.h $(srcdir)/a12scan.h $(srcdir)/fnames.h $(srcdir)/ctimez.h $(srcdir)/filetime.h $(srcdir)/getopt.h $(srcdir)/strcscmp.h $(MKOBJ) -ophotopc.obj $(srcdir)/photopc.c epinfo.obj: $(srcdir)/epinfo.c $(srcdir)/a12scan.h $(srcdir)/exifscan.h $(srcdir)/fnames.h $(srcdir)/ctimez.h $(srcdir)/filetime.h $(srcdir)/getopt.h $(srcdir)/strcscmp.h $(MKOBJ) -oepinfo.obj $(srcdir)/epinfo.c a12scan.obj: $(srcdir)/a12scan.c $(srcdir)/a12scan.h $(MKOBJ) -oa12scan.obj $(srcdir)/a12scan.c exifscan.obj: $(srcdir)/exifscan.c $(srcdir)/exifscan.h $(MKOBJ) -oexifscan.obj $(srcdir)/exifscan.c fnames.obj: $(srcdir)/fnames.c $(srcdir)/fnames.h $(srcdir)/ctimez.h $(MKOBJ) -ofnames.obj $(srcdir)/fnames.c ctimez.obj: $(srcdir)/ctimez.c $(srcdir)/ctimez.h $(MKOBJ) -octimez.obj $(srcdir)/ctimez.c filetime.obj: $(srcdir)/filetime.c $(srcdir)/filetime.h $(srcdir)/ctimez.h $(MKOBJ) -ofiletime.obj $(srcdir)/filetime.c eph_read.obj: $(srcdir)/eph_read.c $(srcdir)/eph_io.h $(srcdir)/comio.h $(srcdir)/usleep.h $(MKOBJ) -oeph_read.obj $(srcdir)/eph_read.c eph_iob.obj: $(srcdir)/eph_iob.c $(srcdir)/eph_io.h $(MKOBJ) -oeph_iob.obj $(srcdir)/eph_iob.c eph_err.obj: $(srcdir)/eph_err.c $(srcdir)/eph_io.h $(srcdir)/eph_priv.h $(MKOBJ) -oeph_err.obj $(srcdir)/eph_err.c eph_cmd.obj: $(srcdir)/eph_cmd.c $(srcdir)/eph_io.h $(srcdir)/eph_priv.h $(MKOBJ) -oeph_cmd.obj $(srcdir)/eph_cmd.c eph_io.obj: $(srcdir)/eph_io.c $(srcdir)/eph_io.h $(srcdir)/eph_priv.h $(srcdir)/usleep.h $(srcdir)/comio.h $(MKOBJ) -oeph_io.obj $(srcdir)/eph_io.c eph_open.obj: $(srcdir)/eph_open.c $(srcdir)/eph_io.h $(srcdir)/eph_priv.h $(srcdir)/usleep.h $(srcdir)/comio.h $(srcdir)/usleep.h $(MKOBJ) -oeph_open.obj $(srcdir)/eph_open.c getopt.obj: $(srcdir)/getopt.c $(srcdir)/getopt.h $(MKOBJ) -ogetopt.obj $(srcdir)/getopt.c usleep.obj: $(srcdir)/usleep.c $(MKOBJ) -ousleep.obj $(srcdir)/usleep.c strcscmp.obj: $(srcdir)/strcscmp.c $(MKOBJ) -ostrcscmp.obj $(srcdir)/strcscmp.c comio.obj: $(srcdir)/comio.c $(MKOBJ) -ocomio.obj $(srcdir)/comio.c photopc-3.05/dos/config.h 644 2627 62 2475 7144624377 10426 #include "version.h" /* Define if you have the strftime function. */ #define HAVE_STRFTIME 1 /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Integer 16bit type */ #define INT16 short /* Integer 3bit type */ #define INT32 long /* Platform definition */ #define DOS 1 /* Low memory model */ #define LOWMEMORY 1 /* The number of bytes in a int. */ #define SIZEOF_INT 4 /* The number of bytes in a long. */ #define SIZEOF_LONG 4 /* The number of bytes in a short. */ #define SIZEOF_SHORT 2 /* Define if you have the getopt function. */ #define HAVE_GETOPT 1 /* Define if you have the mkdir function. */ #define HAVE_MKDIR 1 /* Define if you have the rename function. */ #define HAVE_RENAME 1 /* Define if you have the strerror function. */ #define HAVE_STRERROR 1 /* Define if you have the strspn function. */ #define HAVE_STRSPN 1 /* Define if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define if you have the header file. */ #define HAVE_STRING_H /* Define if you have the header file. */ #define HAVE_SYS_SELECT_H 1 /* Define if you have the header file. */ #define HAVE_UTIME_H 1 /* Define if compiler has function prototypes */ #define PROTOTYPES 1 /* is struct utimbuf defined in sys/utime.h */ #define HAVE_UTIMBUF 1 photopc-3.05/dos/version.h 644 2627 62 245 7227675022 10612 /* dos/version.h. Generated automatically by configure. */ /* Name of package */ #define PACKAGE "photopc" /* Version number of package */ #define VERSION "3.05" photopc-3.05/win32/stamp-h3.in 644 2627 62 12 7227711416 11063 timestamp photopc-3.05/win32/version.h.in 644 2627 62 125 6755225641 11374 /* Name of package */ #undef PACKAGE /* Version number of package */ #undef VERSION photopc-3.05/win32/Makefile 644 2627 62 12642 7012110014 10606 # $Id: Makefile,v 2.16 1999/11/09 18:55:03 crosser Exp $ # # Copyright (c) 1997,1998 Eugene G. Crosser # Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) # # You may distribute and/or use for any purpose modified or unmodified # copies of this software if you preserve the copyright notice above. # # THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY # KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE # COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE # USE OF THIS SOFTWARE. # # sample message # $Log: Makefile,v $ # Revision 2.16 1999/11/09 18:55:03 crosser # work on windows version # # Revision 2.15 1999/08/04 11:52:21 ady # test commit # # Revision 2.14 1999/08/01 23:25:11 crosser # move makefile to subdirectory, NOT working yet! # # Revision 2.13 1999/04/14 18:34:38 lightner # link with setargv to expand filenames # # Revision 2.12 1999/03/22 06:08:44 lightner # Add -DHAVE_RENAME # Fix overly long command line problem (add $(EXTRA_OBJS)) # Fix "make clean" to do full cleanup # # Revision 2.11 1999/03/12 23:22:30 crosser # define for new utime() code # # Revision 2.10 1999/03/12 10:06:23 crosser # setfiletime # # Revision 2.9 1999/03/10 22:34:43 crosser # sync with structure changes # # Revision 2.8 1999/01/17 13:37:29 crosser # fix copyright info # # Revision 2.7 1999/01/17 13:27:59 bruce # make win/dos versions in separate subdirs # # Revision 2.6 1998/10/18 13:18:27 crosser # Put RCS logs and I.D. into the source # # Revision 2.5 1998/02/16 06:12:02 lightner # Add dependancy for revision.h # # Revision 2.4 1998/02/08 19:58:38 crosser # Support low memory: chunked saving etc. # # Revision 2.3 1998/02/05 23:33:00 lightner # Fix make logic to allow debug # Fix "make clean" logic to remove MSVC++ "trash/debug" files # # Revision 2.2 1998/01/18 02:16:45 crosser # DOS support # HAVE_NANOSLEEP # # Revision 2.1 1998/01/03 12:50:02 crosser # fix for new name etc. # # Revision 2.0 1998/01/02 19:20:11 crosser # Added support for Win32 # # Revision 1.1 1998/01/02 00:49:34 crosser # Initial revision # # Modified by Bruce D. Lightner (lightner@lightner.net) on 1/2/98 to # support builds under Microsoft Windows 95/NT # # To "make" using Microsoft's Visual C++ toolset, ensure that your # PATH points to the proper development tools directory, verify that # the INCLUDE and LIB environment variables are set, then enter the # following commands: # # nmake clean # nmake srcdir = .. VPATH = .. OPTS = -DHAVE_CONFIG_H CC = cl #CFLAGS = -O2 -Zi CFLAGS = -O2 LD = cl LDFLAGS = $(CFLAGS) AR = lib # "-I." go first to include right config.h ! INC = -I. -I$(srcdir) ##### No need to touch anything below this line ##### LIBOBJS = eph_read.obj eph_iob.obj eph_err.obj \ eph_cmd.obj eph_io.obj eph_open.obj EXTRA_OBJS = getopt.obj usleep.obj strcscmp.obj \ a12scan.obj fnames.obj ctimez.obj filetime.obj \ exifscan.obj all: eph_io.lib photopc.exe epinfo.exe eph_io.lib: $(LIBOBJS) $(AR) /out:$@ $(LIBOBJS) photopc.exe: photopc.obj $(EXTRA_OBJS) eph_io.lib $(LD) $(LDFLAGS) -Fe$@ photopc.obj $(EXTRA_OBJS) eph_io.lib epinfo.exe: epinfo.obj $(EXTRA_OBJS) $(LD) $(LDFLAGS) -Fe$@ epinfo.obj $(EXTRA_OBJS) /link setargv.obj tidyup: del *.obj del vc*.pdb del eph_io.bak del photopc.vcp del photopc.ilk del photopc.pdb del epinfo.vcp del epinfo.ilk del epinfo.pdb clean: tidyup del eph_io.lib del photopc.exe del epinfo.exe MKOBJ = $(CPP) $(CFLAGS) $(OPTS) $(INC) -Fo$@ -c photopc.obj: $(srcdir)/photopc.c $(srcdir)/eph_io.h $(srcdir)/a12scan.h $(srcdir)/fnames.h $(srcdir)/ctimez.h $(srcdir)/filetime.h $(srcdir)/getopt.h $(srcdir)/strcscmp.h $(MKOBJ) -ophotopc.obj $(srcdir)/photopc.c epinfo.obj: $(srcdir)/epinfo.c $(srcdir)/a12scan.h $(srcdir)/exifscan.h $(srcdir)/fnames.h $(srcdir)/ctimez.h $(srcdir)/filetime.h $(srcdir)/getopt.h $(srcdir)/strcscmp.h $(MKOBJ) -oepinfo.obj $(srcdir)/epinfo.c a12scan.obj: $(srcdir)/a12scan.c $(srcdir)/a12scan.h $(MKOBJ) -oa12scan.obj $(srcdir)/a12scan.c exifscan.obj: $(srcdir)/exifscan.c $(srcdir)/exifscan.h $(MKOBJ) -oexifscan.obj $(srcdir)/exifscan.c fnames.obj: $(srcdir)/fnames.c $(srcdir)/fnames.h $(srcdir)/ctimez.h $(MKOBJ) -ofnames.obj $(srcdir)/fnames.c ctimez.obj: $(srcdir)/ctimez.c $(srcdir)/ctimez.h $(MKOBJ) -octimez.obj $(srcdir)/ctimez.c filetime.obj: $(srcdir)/filetime.c $(srcdir)/filetime.h $(srcdir)/ctimez.h $(MKOBJ) -ofiletime.obj $(srcdir)/filetime.c eph_read.obj: $(srcdir)/eph_read.c $(srcdir)/eph_io.h $(srcdir)/comio.h $(srcdir)/usleep.h $(MKOBJ) -oeph_read.obj $(srcdir)/eph_read.c eph_iob.obj: $(srcdir)/eph_iob.c $(srcdir)/eph_io.h $(MKOBJ) -oeph_iob.obj $(srcdir)/eph_iob.c eph_err.obj: $(srcdir)/eph_err.c $(srcdir)/eph_io.h $(srcdir)/eph_priv.h $(MKOBJ) -oeph_err.obj $(srcdir)/eph_err.c eph_cmd.obj: $(srcdir)/eph_cmd.c $(srcdir)/eph_io.h $(srcdir)/eph_priv.h $(MKOBJ) -oeph_cmd.obj $(srcdir)/eph_cmd.c eph_io.obj: $(srcdir)/eph_io.c $(srcdir)/eph_io.h $(srcdir)/eph_priv.h $(srcdir)/usleep.h $(srcdir)/comio.h $(MKOBJ) -oeph_io.obj $(srcdir)/eph_io.c eph_open.obj: $(srcdir)/eph_open.c $(srcdir)/eph_io.h $(srcdir)/eph_priv.h $(srcdir)/usleep.h $(srcdir)/comio.h $(srcdir)/usleep.h $(MKOBJ) -oeph_open.obj $(srcdir)/eph_open.c getopt.obj: $(srcdir)/getopt.c $(srcdir)/getopt.h $(MKOBJ) -ogetopt.obj $(srcdir)/getopt.c usleep.obj: $(srcdir)/usleep.c $(MKOBJ) -ousleep.obj $(srcdir)/usleep.c strcscmp.obj: $(srcdir)/strcscmp.c $(MKOBJ) -ostrcscmp.obj $(srcdir)/strcscmp.c photopc-3.05/win32/config.h 644 2627 62 2475 7144717641 10600 #include "version.h" /* Define if you have the strftime function. */ #define HAVE_STRFTIME 1 /* Define if you have the vprintf function. */ #define HAVE_VPRINTF 1 /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Integer 16bit type */ #define INT16 short /* Integer 3bit type */ #define INT32 long /* Platform definition */ #define MSWINDOWS 1 /* Low memory model */ /* #undef LOWMEMORY */ /* The number of bytes in a int. */ #define SIZEOF_INT 4 /* The number of bytes in a long. */ #define SIZEOF_LONG 4 /* The number of bytes in a short. */ #define SIZEOF_SHORT 2 /* Define if you have the getopt function. */ #define HAVE_GETOPT 1 /* Define if you have the mkdir function. */ #define HAVE_MKDIR 1 /* Define if you have the rename function. */ #define HAVE_RENAME 1 /* Define if you have the strerror function. */ #define HAVE_STRERROR 1 /* Define if you have the strspn function. */ #define HAVE_STRSPN 1 /* Define if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define if you have the header file. */ #define HAVE_STRING_H /* Define if you have the header file. */ #define HAVE_SYS_UTIME_H /* Define if compiler has function prototypes */ #define PROTOTYPES 1 /* is struct utimbuf defined in sys/utime.h */ #define HAVE_UTIMBUF 1 photopc-3.05/win32/version.h 644 2627 62 247 7227675023 10772 /* win32/version.h. Generated automatically by configure. */ /* Name of package */ #define PACKAGE "photopc" /* Version number of package */ #define VERSION "3.05" photopc-3.05/README 644 2627 62 16557 7106010266 7111 /* $Id: README,v 2.21 2000/05/09 13:20:54 crosser Exp $ */ /* Copyright (c) 1997-2000 Eugene G. Crosser Copyright (c) 1998,1999 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: README,v $ Revision 2.21 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 2.20 2000/05/02 22:26:35 crosser A few things incorporated from John Bowman's Nikon specific diffs Revision 2.19 2000/01/24 20:25:23 crosser do better job in walking thru folder tree; credit to Sergey I. Panov Revision 2.18 1999/11/24 21:51:25 crosser instruction about building from cvs source Revision 2.17 1999/09/19 12:33:11 crosser Mention comlite32 in the README Revision 2.16 1999/08/26 16:11:57 crosser Change README to reflect new directory structure Revision 2.15 1999/08/01 22:13:10 crosser mention reltime priority things Revision 2.14 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 2.13 1999/04/28 08:28:53 crosser just don't like long copyrights Revision 2.12 1999/04/27 20:55:35 lightner Fix MS-DOS/Win32 makefile instructions Revision 2.11 1999/03/22 05:59:31 lightner Fix docs: Windows binaries go to win32/ Revision 2.10 1999/03/21 20:21:04 crosser mention configure Revision 2.9 1999/01/17 09:51:16 crosser change Bruce's address Revision 2.8 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.7 1998/07/21 22:56:52 crosser fix CP 900 Revision 2.6 1998/06/07 13:55:20 crosser compatibilities and credits Revision 2.5 1998/05/09 18:22:42 crosser say that devices with modem control are allowable, minor fixes Revision 2.4 1998/03/01 18:57:04 crosser more credits Revision 2.3 1998/02/06 09:04:59 crosser mention DOS version Revision 2.2 1998/01/18 02:22:28 crosser change copyright Revision 2.1 1998/01/05 22:02:14 crosser add reference to Bruce's site Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 Revision 1.4 1997/12/24 00:30:14 crosser add vendors, add url, add credits. Revision 1.3 1997/11/15 19:29:47 crosser update for release 1.7 Revision 1.2 1997/11/12 09:50:27 crosser mention photopc600, minor changes Revision 1.1 1997/08/17 09:06:54 crosser Initial revision */ This is a library and a command-line frontend to manipulate digital still cameras based on Fujitsu chipset and Sierra Imaging firmware. The program is known to work with Agfa, Epson, Olympus, Sanyo and Nikon (at least CoolPix 900 and 950, but not CoolPix 600!) cameras. The cameras typically come with software for Windows and for Mac, and no description of the protocol. With this tool, they are managable from a UNIX box. Bruce D. Lightner has added support for Win32 and DOS platforms. Note that the program does not have any GUI, it is plain command-line even on Windows. I tried it under Linux/x86, FreeBSD, Solaris/SPARC and HP/UX, and it should be straightforward for other UNIX systems. Generally, UNIX system requirements are: - ANSI C compiler (theoretically should work with K&R but unchecked) - POSIX termios or BSD sgtty - presence of a 16bit integer type - serial port (with or without `modem control'). On UNIX, first run "./configure". Then, typing `make' will result in building the library and executables in the current directory. `make install' will install the executables, library and manual pages. If your `make' supports VPATH (e.g. GNU make), it is possible to build objects and executables in a different directory; create target directory and run /path/to/photopc/configure. If you are building from CVS source see instructions at the end of this file. When building on NeXT, you may need to specify --without-termios because termios is reportedly broken on NeXT. The program will use BSD sgtty style terminal control then. When building on BeOS, you may need to specify --enable-alarmed-read because on BeOS select() reportedly only works on network sockets and not on other type of streams. On UNIX systems that have sched_setcheduler() function the program can set itself "realtime priority". That makes it less vulnerable to possible timeouts caused by high system load, and, more important, it makes possible to use high-resolution mode of nanosleep() function. That means that it may run a bit quicker (but you probably will not notice anyway). Make the progrem setuid root to use this mode. There is hopefully no danger because it revokes root privileges really fast (even before processing command-line options). If you are so paranoid that you don't want even to compile in this feature, run configure with --without-rtprio option. To build for DOS and WIN32, chdir to "dos" or "win32" directories respectively and there type "make". The executable parameters are rather clear (hopefully). Running `photopc -h | more' will print the list of options and commands. If you are going to use the library for your own application and need the docs, tell me and I will write them. Included file `protocol.htm' contains description of the protocol used by the camera. `usage.htm' is a "casual" user's guide, full description is in the man pages. If you run the program on a DOS box, you may want a JPEG viewer; I've been told that a good free viewer `LXPIC' can be found at http://home.t-online.de/home/stefan.peichl. Also, there is a tool that may help in discovering serial protocols (although *I* did not use it when I examined that camera's protocol): http://www.endymion.com/portfolio/software/comlite32.htm Many commands may be unimplemented, esp. those specific for newer models. If you know how to do things that the program currently cannot do, please let me know. I can be contacted at , fresh version of this tool (if any) is at ftp://ftp.average.org/pub/photopc/, related information is at http://www.average.org/digicam/. For CVS see bottom of this file. Some earlier and modified versions of the code accompanied by Win32 and DOS executables and archived in .zip format can be found at http://www.lightner.net/lightner/bruce/photopc/ Thanks to Jeff Tranter for contributing the man page and a few bugfixes, Bruce Lightner for Windows and DOS support, Thierry Bousch for many details of the protocol and advice, Sergey I. Panov for invaluable investigation of the folder navigation means, John Bowman for Nikon specific parts and other people who helped me to track down problems and learn more about the protocol. Trademarks are properties of their respective respected owners. --- APPENDIX: Building from CVS source. You must have cvs, autoconf and automake installed on your system. $ cd $your_src_dir $ cvs -d :pserver:cvs@cvs.average.org:/var/cvs login Password: cvs $ cvs -d :pserver:cvs@cvs.average.org:/var/cvs checkout photopc $ cd photopc $ aclocal $ autoheader $ automake --add-missing $ autoconf $ ./configure --$various_options $ make photopc-3.05/stamp-h1.in 644 2627 62 12 7227711412 10113 timestamp photopc-3.05/Makefile.am 644 2627 62 4166 7012110012 10220 ## $Id: Makefile.am,v 1.6 1999/11/09 18:55:02 crosser Exp $ ## # FSF thinks that the source generated by a tool copyrighted # by FSF is also copyrighted by FSF. This might be true, but # still, if you read this text in Makefile.in or Makefile, then # be informed that the orifinal file, and the "meat" of the # package, is: # # Copyright (c) 1997-1999 Eugene G. Crosser # Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) # # You may distribute and/or use for any purpose modified or unmodified # copies of this software if you preserve the copyright notice above. # # THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY # KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE # COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE # USE OF THIS SOFTWARE. ## ## $Log: Makefile.am,v $ ## Revision 1.6 1999/11/09 18:55:02 crosser ## work on windows version ## ## Revision 1.5 1999/08/14 09:00:33 crosser ## Create version.h's in dos and win23 directories ## ## Revision 1.4 1999/08/01 23:28:06 crosser ## multiple enhancements ## ## Revision 1.3 1999/08/01 12:37:10 crosser ## typo ## ## Revision 1.2 1999/08/01 12:31:00 crosser ## add options, make notice about the copyright ## ## Revision 1.1 1999/07/29 07:53:33 crosser ## Initial revision ## AUTOMAKE_OPTIONS = foreign ansi2knr bin_PROGRAMS = photopc epinfo lib_LIBRARIES = libeph_io.a include_HEADERS = eph_io.h man_MANS = photopc.1 epinfo.1 EXTRA_DIST = $(man_MANS) protocol.htm usage.htm readme.dos \ dos/Makefile dos/config.h dos/version.h \ win32/Makefile win32/config.h win32/version.h photopc_SOURCES = photopc.c a12scan.c a12scan.h fnames.c fnames.h \ ctimez.c ctimez.h filetime.c filetime.h \ exifscan.c exifscan.h eph_io.h EXTRA_photopc_SOURCES = comio.c comio.h getopt.h usleep.h strcscmp.h photopc_LDADD = @LIBOBJS@ libeph_io.a epinfo_SOURCES = epinfo.c a12scan.c a12scan.h exifscan.c exifscan.h \ fnames.c fnames.h ctimez.c ctimez.h \ filetime.c filetime.h EXTRA_epinfo_SOURCES = getopt.h epinfo_LDADD = @LIBOBJS@ libeph_io_a_SOURCES = eph_read.c eph_iob.c eph_err.c eph_cmd.c eph_io.c \ eph_open.c eph_io.h eph_priv.h photopc-3.05/acconfig.h 644 2627 62 4313 7133532273 10125 /* $Id: acconfig.h,v 1.9 2000/07/14 06:35:39 crosser Exp $ */ /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: acconfig.h,v $ Revision 1.9 2000/07/14 06:35:39 crosser reportedly some models return CAN instead of DC1 Revision 1.8 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 1.7 2000/02/04 22:31:56 crosser Clean up things dealing with folder tree recursion. Fixed log entry in acconfig.h that conflicted with "configure" Revision 1.6 2000/02/01 22:04:15 crosser xchdir() function iterates thru path elements define a variable for extra verbosity Revision 1.5 1999/12/11 14:10:15 crosser Support sgtty terminal control Proper "fake speed" handling (needed two values) Revision 1.4 1999/11/17 13:48:08 crosser check if need to include getopt.h Revision 1.3 1999/11/09 18:55:03 crosser work on windows version Revision 1.2 1999/08/01 23:28:06 crosser add RTPRIO Revision 1.1 1999/07/29 06:48:17 crosser Initial revision */ /* Integer 16bit type */ #undef INT16 /* Integer 3bit type */ #undef INT32 /* Platform definition */ #undef UNIX #undef MSWINDOS #undef DOS /* Low memory model */ #undef LOWMEMORY /* Realtime priority */ #undef USE_RTPRIO /* struct tm has tm_gmtoff member */ #undef HAVE_TM_GMTOFF /* headers contain definition of optarg */ #undef OPTARG_DEFINED /* terminal control type */ #undef USE_TERMIOS #undef USE_SGTTY #undef USE_TERMIO /* is struct utimbuf defined in sys/utime.h */ #undef HAVE_UTIMBUF /* use blocking read() in conjunction with alarm() instead of select() */ #undef USE_ALARMED_READ /* devine for development versions - extra verbosity */ #undef DEVVERSION /* default device name */ #undef DEFAULT_DEVICE photopc-3.05/aclocal.m4 644 2627 62 16455 7227711370 10076 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)]) # Like AC_CONFIG_HEADER, but automatically create stamp file. AC_DEFUN(AM_CONFIG_HEADER, [AC_PREREQ([2.12]) AC_CONFIG_HEADER([$1]) dnl When config.status generates a header, we must update the stamp-h file. dnl This file resides in the same directory as the config header dnl that is generated. We must strip everything past the first ":", dnl and everything past the last "/". AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, <>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, <>; do case " <<$>>CONFIG_HEADERS " in *" <<$>>am_file "*<<)>> echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx ;; esac am_indx=`expr "<<$>>am_indx" + 1` done<<>>dnl>>) changequote([,]))]) # serial 1 AC_DEFUN(AM_C_PROTOTYPES, [AC_REQUIRE([AM_PROG_CC_STDC]) AC_REQUIRE([AC_PROG_CPP]) AC_MSG_CHECKING([for function prototypes]) if test "$am_cv_prog_cc_stdc" != no; then AC_MSG_RESULT(yes) AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes]) U= ANSI2KNR= else AC_MSG_RESULT(no) U=_ ANSI2KNR=./ansi2knr # Ensure some checks needed by ansi2knr itself. AC_HEADER_STDC AC_CHECK_HEADERS(string.h) fi AC_SUBST(U)dnl AC_SUBST(ANSI2KNR)dnl ]) # serial 1 # @defmac AC_PROG_CC_STDC # @maindex PROG_CC_STDC # @ovindex CC # If the C compiler in not in ANSI C mode by default, try to add an option # to output variable @code{CC} to make it so. This macro tries various # options that select ANSI C on some system or another. It considers the # compiler to be in ANSI C mode if it handles function prototypes correctly. # # If you use this macro, you should check after calling it whether the C # compiler has been set to accept ANSI C; if not, the shell variable # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source # code in ANSI C, you can make an un-ANSIfied copy of it by using the # program @code{ansi2knr}, which comes with Ghostscript. # @end defmac AC_DEFUN(AM_PROG_CC_STDC, [AC_REQUIRE([AC_PROG_CC]) AC_BEFORE([$0], [AC_C_INLINE]) AC_BEFORE([$0], [AC_C_CONST]) dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require dnl a magic option to avoid problems with ANSI preprocessor commands dnl like #elif. dnl FIXME: can't do this because then AC_AIX won't work due to a dnl circular dependency. dnl AC_BEFORE([$0], [AC_PROG_CPP]) AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) AC_CACHE_VAL(am_cv_prog_cc_stdc, [am_cv_prog_cc_stdc=no ac_save_CC="$CC" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" AC_TRY_COMPILE( [#include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; ], [ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ], [am_cv_prog_cc_stdc="$ac_arg"; break]) done CC="$ac_save_CC" ]) if test -z "$am_cv_prog_cc_stdc"; then AC_MSG_RESULT([none needed]) else AC_MSG_RESULT($am_cv_prog_cc_stdc) fi case "x$am_cv_prog_cc_stdc" in x|xno) ;; *) CC="$CC $am_cv_prog_cc_stdc" ;; esac ]) photopc-3.05/ansi2knr.1 644 0 0 2771 7032236565 7674 .TH ANSI2KNR 1 "19 Jan 1996" .SH NAME ansi2knr \- convert ANSI C to Kernighan & Ritchie C .SH SYNOPSIS .I ansi2knr [--varargs] input_file [output_file] .SH DESCRIPTION If no output_file is supplied, output goes to stdout. .br There are no error messages. .sp .I ansi2knr recognizes function definitions by seeing a non-keyword identifier at the left margin, followed by a left parenthesis, with a right parenthesis as the last character on the line, and with a left brace as the first token on the following line (ignoring possible intervening comments). It will recognize a multi-line header provided that no intervening line ends with a left or right brace or a semicolon. These algorithms ignore whitespace and comments, except that the function name must be the first thing on the line. .sp The following constructs will confuse it: .br - Any other construct that starts at the left margin and follows the above syntax (such as a macro or function call). .br - Some macros that tinker with the syntax of the function header. .sp The --varargs switch is obsolete, and is recognized only for backwards compatibility. The present version of .I ansi2knr will always attempt to convert a ... argument to va_alist and va_dcl. .SH AUTHOR L. Peter Deutsch wrote the original ansi2knr and continues to maintain the current version; most of the code in the current version is his work. ansi2knr also includes contributions by Francois Pinard and Jim Avera . photopc-3.05/ansi2knr.c 644 0 0 40630 7032236565 7772 /* Copyright (C) 1989, 1997, 1998 Aladdin Enterprises. All rights reserved. */ /*$Id: ansi2knr.c,v 1.10 1998/12/02 12:42:23 tromey Exp $*/ /* Convert ANSI C function definitions to K&R ("traditional C") syntax */ /* ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Refer to the GNU General Public License (the "GPL") for full details. Everyone is granted permission to copy, modify and redistribute ansi2knr, but only under the conditions described in the GPL. A copy of this license is supposed to have been given to you along with ansi2knr so you can know your rights and responsibilities. It should be in a file named COPYLEFT, or, if there is no file named COPYLEFT, a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. We explicitly state here what we believe is already implied by the GPL: if the ansi2knr program is distributed as a separate set of sources and a separate executable file which are aggregated on a storage medium together with another program, this in itself does not bring the other program under the GPL, nor does the mere fact that such a program or the procedures for constructing it invoke the ansi2knr executable bring any other part of the program under the GPL. */ /* * Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]] * --filename provides the file name for the #line directive in the output, * overriding input_file (if present). * If no input_file is supplied, input is read from stdin. * If no output_file is supplied, output goes to stdout. * There are no error messages. * * ansi2knr recognizes function definitions by seeing a non-keyword * identifier at the left margin, followed by a left parenthesis, * with a right parenthesis as the last character on the line, * and with a left brace as the first token on the following line * (ignoring possible intervening comments), except that a line * consisting of only * identifier1(identifier2) * will not be considered a function definition unless identifier2 is * the word "void". ansi2knr will recognize a multi-line header provided * that no intervening line ends with a left or right brace or a semicolon. * These algorithms ignore whitespace and comments, except that * the function name must be the first thing on the line. * The following constructs will confuse it: * - Any other construct that starts at the left margin and * follows the above syntax (such as a macro or function call). * - Some macros that tinker with the syntax of the function header. */ /* * The original and principal author of ansi2knr is L. Peter Deutsch * . Other authors are noted in the change history * that follows (in reverse chronological order): lpd 1998-11-09 added further hack to recognize identifier(void) as being a procedure lpd 1998-10-23 added hack to recognize lines consisting of identifier1(identifier2) as *not* being procedures lpd 1997-12-08 made input_file optional; only closes input and/or output file if not stdin or stdout respectively; prints usage message on stderr rather than stdout; adds --filename switch (changes suggested by ) lpd 1996-01-21 added code to cope with not HAVE_CONFIG_H and with compilers that don't understand void, as suggested by Tom Lane lpd 1996-01-15 changed to require that the first non-comment token on the line following a function header be a left brace, to reduce sensitivity to macros, as suggested by Tom Lane lpd 1995-06-22 removed #ifndefs whose sole purpose was to define undefined preprocessor symbols as 0; changed all #ifdefs for configuration symbols to #ifs lpd 1995-04-05 changed copyright notice to make it clear that including ansi2knr in a program does not bring the entire program under the GPL lpd 1994-12-18 added conditionals for systems where ctype macros don't handle 8-bit characters properly, suggested by Francois Pinard ; removed --varargs switch (this is now the default) lpd 1994-10-10 removed CONFIG_BROKETS conditional lpd 1994-07-16 added some conditionals to help GNU `configure', suggested by Francois Pinard ; properly erase prototype args in function parameters, contributed by Jim Avera ; correct error in writeblanks (it shouldn't erase EOLs) lpd 1989-xx-xx original version */ /* Most of the conditionals here are to make ansi2knr work with */ /* or without the GNU configure machinery. */ #if HAVE_CONFIG_H # include #endif #include #include #if HAVE_CONFIG_H /* For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h). This will define HAVE_CONFIG_H and so, activate the following lines. */ # if STDC_HEADERS || HAVE_STRING_H # include # else # include # endif #else /* not HAVE_CONFIG_H */ /* Otherwise do it the hard way */ # ifdef BSD # include # else # ifdef VMS extern int strlen(), strncmp(); # else # include # endif # endif #endif /* not HAVE_CONFIG_H */ #if STDC_HEADERS # include #else /* malloc and free should be declared in stdlib.h, but if you've got a K&R compiler, they probably aren't. */ # ifdef MSDOS # include # else # ifdef VMS extern char *malloc(); extern void free(); # else extern char *malloc(); extern int free(); # endif # endif #endif /* * The ctype macros don't always handle 8-bit characters correctly. * Compensate for this here. */ #ifdef isascii # undef HAVE_ISASCII /* just in case */ # define HAVE_ISASCII 1 #else #endif #if STDC_HEADERS || !HAVE_ISASCII # define is_ascii(c) 1 #else # define is_ascii(c) isascii(c) #endif #define is_space(c) (is_ascii(c) && isspace(c)) #define is_alpha(c) (is_ascii(c) && isalpha(c)) #define is_alnum(c) (is_ascii(c) && isalnum(c)) /* Scanning macros */ #define isidchar(ch) (is_alnum(ch) || (ch) == '_') #define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_') /* Forward references */ char *skipspace(); int writeblanks(); int test1(); int convert1(); /* The main program */ int main(argc, argv) int argc; char *argv[]; { FILE *in = stdin; FILE *out = stdout; char *filename = 0; #define bufsize 5000 /* arbitrary size */ char *buf; char *line; char *more; char *usage = "Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n"; /* * In previous versions, ansi2knr recognized a --varargs switch. * If this switch was supplied, ansi2knr would attempt to convert * a ... argument to va_alist and va_dcl; if this switch was not * supplied, ansi2knr would simply drop any such arguments. * Now, ansi2knr always does this conversion, and we only * check for this switch for backward compatibility. */ int convert_varargs = 1; while ( argc > 1 && argv[1][0] == '-' ) { if ( !strcmp(argv[1], "--varargs") ) { convert_varargs = 1; argc--; argv++; continue; } if ( !strcmp(argv[1], "--filename") && argc > 2 ) { filename = argv[2]; argc -= 2; argv += 2; continue; } fprintf(stderr, "Unrecognized switch: %s\n", argv[1]); fprintf(stderr, usage); exit(1); } switch ( argc ) { default: fprintf(stderr, usage); exit(0); case 3: out = fopen(argv[2], "w"); if ( out == NULL ) { fprintf(stderr, "Cannot open output file %s\n", argv[2]); exit(1); } /* falls through */ case 2: in = fopen(argv[1], "r"); if ( in == NULL ) { fprintf(stderr, "Cannot open input file %s\n", argv[1]); exit(1); } if ( filename == 0 ) filename = argv[1]; /* falls through */ case 1: break; } if ( filename ) fprintf(out, "#line 1 \"%s\"\n", filename); buf = malloc(bufsize); line = buf; while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL ) { test: line += strlen(line); switch ( test1(buf) ) { case 2: /* a function header */ convert1(buf, out, 1, convert_varargs); break; case 1: /* a function */ /* Check for a { at the start of the next line. */ more = ++line; f: if ( line >= buf + (bufsize - 1) ) /* overflow check */ goto wl; if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL ) goto wl; switch ( *skipspace(more, 1) ) { case '{': /* Definitely a function header. */ convert1(buf, out, 0, convert_varargs); fputs(more, out); break; case 0: /* The next line was blank or a comment: */ /* keep scanning for a non-comment. */ line += strlen(line); goto f; default: /* buf isn't a function header, but */ /* more might be. */ fputs(buf, out); strcpy(buf, more); line = buf; goto test; } break; case -1: /* maybe the start of a function */ if ( line != buf + (bufsize - 1) ) /* overflow check */ continue; /* falls through */ default: /* not a function */ wl: fputs(buf, out); break; } line = buf; } if ( line != buf ) fputs(buf, out); free(buf); if ( out != stdout ) fclose(out); if ( in != stdin ) fclose(in); return 0; } /* Skip over space and comments, in either direction. */ char * skipspace(p, dir) register char *p; register int dir; /* 1 for forward, -1 for backward */ { for ( ; ; ) { while ( is_space(*p) ) p += dir; if ( !(*p == '/' && p[dir] == '*') ) break; p += dir; p += dir; while ( !(*p == '*' && p[dir] == '/') ) { if ( *p == 0 ) return p; /* multi-line comment?? */ p += dir; } p += dir; p += dir; } return p; } /* * Write blanks over part of a string. * Don't overwrite end-of-line characters. */ int writeblanks(start, end) char *start; char *end; { char *p; for ( p = start; p < end; p++ ) if ( *p != '\r' && *p != '\n' ) *p = ' '; return 0; } /* * Test whether the string in buf is a function definition. * The string may contain and/or end with a newline. * Return as follows: * 0 - definitely not a function definition; * 1 - definitely a function definition; * 2 - definitely a function prototype (NOT USED); * -1 - may be the beginning of a function definition, * append another line and look again. * The reason we don't attempt to convert function prototypes is that * Ghostscript's declaration-generating macros look too much like * prototypes, and confuse the algorithms. */ int test1(buf) char *buf; { register char *p = buf; char *bend; char *endfn; int contin; if ( !isidfirstchar(*p) ) return 0; /* no name at left margin */ bend = skipspace(buf + strlen(buf) - 1, -1); switch ( *bend ) { case ';': contin = 0 /*2*/; break; case ')': contin = 1; break; case '{': return 0; /* not a function */ case '}': return 0; /* not a function */ default: contin = -1; } while ( isidchar(*p) ) p++; endfn = p; p = skipspace(p, 1); if ( *p++ != '(' ) return 0; /* not a function */ p = skipspace(p, 1); if ( *p == ')' ) return 0; /* no parameters */ /* Check that the apparent function name isn't a keyword. */ /* We only need to check for keywords that could be followed */ /* by a left parenthesis (which, unfortunately, is most of them). */ { static char *words[] = { "asm", "auto", "case", "char", "const", "double", "extern", "float", "for", "if", "int", "long", "register", "return", "short", "signed", "sizeof", "static", "switch", "typedef", "unsigned", "void", "volatile", "while", 0 }; char **key = words; char *kp; int len = endfn - buf; while ( (kp = *key) != 0 ) { if ( strlen(kp) == len && !strncmp(kp, buf, len) ) return 0; /* name is a keyword */ key++; } } { char *id = p; int len; /* * Check for identifier1(identifier2) and not * identifier1(void). */ while ( isidchar(*p) ) p++; len = p - id; p = skipspace(p, 1); if ( *p == ')' && (len != 4 || strncmp(id, "void", 4)) ) return 0; /* not a function */ } /* * If the last significant character was a ), we need to count * parentheses, because it might be part of a formal parameter * that is a procedure. */ if (contin > 0) { int level = 0; for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1)) level += (*p == '(' ? 1 : *p == ')' ? -1 : 0); if (level > 0) contin = -1; } return contin; } /* Convert a recognized function definition or header to K&R syntax. */ int convert1(buf, out, header, convert_varargs) char *buf; FILE *out; int header; /* Boolean */ int convert_varargs; /* Boolean */ { char *endfn; register char *p; /* * The breaks table contains pointers to the beginning and end * of each argument. */ char **breaks; unsigned num_breaks = 2; /* for testing */ char **btop; char **bp; char **ap; char *vararg = 0; /* Pre-ANSI implementations don't agree on whether strchr */ /* is called strchr or index, so we open-code it here. */ for ( endfn = buf; *(endfn++) != '('; ) ; top: p = endfn; breaks = (char **)malloc(sizeof(char *) * num_breaks * 2); if ( breaks == 0 ) { /* Couldn't allocate break table, give up */ fprintf(stderr, "Unable to allocate break table!\n"); fputs(buf, out); return -1; } btop = breaks + num_breaks * 2 - 2; bp = breaks; /* Parse the argument list */ do { int level = 0; char *lp = NULL; char *rp; char *end = NULL; if ( bp >= btop ) { /* Filled up break table. */ /* Allocate a bigger one and start over. */ free((char *)breaks); num_breaks <<= 1; goto top; } *bp++ = p; /* Find the end of the argument */ for ( ; end == NULL; p++ ) { switch(*p) { case ',': if ( !level ) end = p; break; case '(': if ( !level ) lp = p; level++; break; case ')': if ( --level < 0 ) end = p; else rp = p; break; case '/': p = skipspace(p, 1) - 1; break; default: ; } } /* Erase any embedded prototype parameters. */ if ( lp ) writeblanks(lp + 1, rp); p--; /* back up over terminator */ /* Find the name being declared. */ /* This is complicated because of procedure and */ /* array modifiers. */ for ( ; ; ) { p = skipspace(p - 1, -1); switch ( *p ) { case ']': /* skip array dimension(s) */ case ')': /* skip procedure args OR name */ { int level = 1; while ( level ) switch ( *--p ) { case ']': case ')': level++; break; case '[': case '(': level--; break; case '/': p = skipspace(p, -1) + 1; break; default: ; } } if ( *p == '(' && *skipspace(p + 1, 1) == '*' ) { /* We found the name being declared */ while ( !isidfirstchar(*p) ) p = skipspace(p, 1) + 1; goto found; } break; default: goto found; } } found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' ) { if ( convert_varargs ) { *bp++ = "va_alist"; vararg = p-2; } else { p++; if ( bp == breaks + 1 ) /* sole argument */ writeblanks(breaks[0], p); else writeblanks(bp[-1] - 1, p); bp--; } } else { while ( isidchar(*p) ) p--; *bp++ = p+1; } p = end; } while ( *p++ == ',' ); *bp = p; /* Make a special check for 'void' arglist */ if ( bp == breaks+2 ) { p = skipspace(breaks[0], 1); if ( !strncmp(p, "void", 4) ) { p = skipspace(p+4, 1); if ( p == breaks[2] - 1 ) { bp = breaks; /* yup, pretend arglist is empty */ writeblanks(breaks[0], p + 1); } } } /* Put out the function name and left parenthesis. */ p = buf; while ( p != endfn ) putc(*p, out), p++; /* Put out the declaration. */ if ( header ) { fputs(");", out); for ( p = breaks[0]; *p; p++ ) if ( *p == '\r' || *p == '\n' ) putc(*p, out); } else { for ( ap = breaks+1; ap < bp; ap += 2 ) { p = *ap; while ( isidchar(*p) ) putc(*p, out), p++; if ( ap < bp - 1 ) fputs(", ", out); } fputs(") ", out); /* Put out the argument declarations */ for ( ap = breaks+2; ap <= bp; ap += 2 ) (*ap)[-1] = ';'; if ( vararg != 0 ) { *vararg = 0; fputs(breaks[0], out); /* any prior args */ fputs("va_dcl", out); /* the final arg */ fputs(bp[0], out); } else fputs(breaks[0], out); } free((char *)breaks); return 0; } photopc-3.05/config.h.in 644 2627 62 7316 7106357375 10244 /* config.h.in. Generated automatically from configure.in by autoheader. */ /* Define to empty if the keyword does not work. */ #undef const /* Define if you don't have vprintf but do have _doprnt. */ #undef HAVE_DOPRNT /* Define if system calls automatically restart after interruption by a signal. */ #undef HAVE_RESTARTABLE_SYSCALLS /* Define if you have the strftime function. */ #undef HAVE_STRFTIME /* Define if you have the vprintf function. */ #undef HAVE_VPRINTF /* Define to `long' if doesn't define. */ #undef off_t /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE /* Define to `unsigned' if doesn't define. */ #undef size_t /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if your declares struct tm. */ #undef TM_IN_SYS_TIME /* Integer 16bit type */ #undef INT16 /* Integer 3bit type */ #undef INT32 /* Platform definition */ #undef UNIX #undef MSWINDOS #undef DOS /* Low memory model */ #undef LOWMEMORY /* Realtime priority */ #undef USE_RTPRIO /* struct tm has tm_gmtoff member */ #undef HAVE_TM_GMTOFF /* headers contain definition of optarg */ #undef OPTARG_DEFINED /* terminal control type */ #undef USE_TERMIOS #undef USE_SGTTY #undef USE_TERMIO /* is struct utimbuf defined in sys/utime.h */ #undef HAVE_UTIMBUF /* use blocking read() in conjunction with alarm() instead of select() */ #undef USE_ALARMED_READ /* devine for development versions - extra verbosity */ #undef DEVVERSION /* default device name */ #undef DEFAULT_DEVICE /* The number of bytes in a int. */ #undef SIZEOF_INT /* The number of bytes in a long. */ #undef SIZEOF_LONG /* The number of bytes in a short. */ #undef SIZEOF_SHORT /* Define if you have the cfmakeraw function. */ #undef HAVE_CFMAKERAW /* Define if you have the getopt function. */ #undef HAVE_GETOPT /* Define if you have the mkdir function. */ #undef HAVE_MKDIR /* Define if you have the nanosleep function. */ #undef HAVE_NANOSLEEP /* Define if you have the rename function. */ #undef HAVE_RENAME /* Define if you have the sched_setscheduler function. */ #undef HAVE_SCHED_SETSCHEDULER /* Define if you have the select function. */ #undef HAVE_SELECT /* Define if you have the snooze function. */ #undef HAVE_SNOOZE /* Define if you have the strerror function. */ #undef HAVE_STRERROR /* Define if you have the strspn function. */ #undef HAVE_STRSPN /* Define if you have the uname function. */ #undef HAVE_UNAME /* Define if you have the usleep function. */ #undef HAVE_USLEEP /* Define if you have the header file. */ #undef HAVE_FCNTL_H /* Define if you have the header file. */ #undef HAVE_SCHED_H /* Define if you have the header file. */ #undef HAVE_SGTTY_H /* Define if you have the header file. */ #undef HAVE_SIGNAL_H /* Define if you have the header file. */ #undef HAVE_STRING_H /* Define if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define if you have the header file. */ #undef HAVE_SYS_UTIME_H /* Define if you have the header file. */ #undef HAVE_TERMIO_H /* Define if you have the header file. */ #undef HAVE_TERMIOS_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you have the header file. */ #undef HAVE_UTIME_H /* Name of package */ #undef PACKAGE /* Version number of package */ #undef VERSION /* Define if compiler has function prototypes */ #undef PROTOTYPES photopc-3.05/configure 755 2627 62 306730 7227711374 10167 #! /bin/sh # From configure.in Id: configure.in,v 1.22 2001/01/12 23:26:38 crosser Exp # 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 # # Check to make sure that the build environment is sane. # # Like AC_CONFIG_HEADER, but automatically create stamp file. # serial 1 # serial 1 # @defmac AC_PROG_CC_STDC # @maindex PROG_CC_STDC # @ovindex CC # If the C compiler in not in ANSI C mode by default, try to add an option # to output variable @code{CC} to make it so. This macro tries various # options that select ANSI C on some system or another. It considers the # compiler to be in ANSI C mode if it handles function prototypes correctly. # # If you use this macro, you should check after calling it whether the C # compiler has been set to accept ANSI C; if not, the shell variable # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source # code in ANSI C, you can make an un-ANSIfied copy of it by using the # program @code{ansi2knr}, which comes with Ghostscript. # @end defmac # 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: ac_help="$ac_help --disable-termios do not use POSIX terminal control (e.g. for NeXT)" ac_help="$ac_help --with-default-device=DEVNAME serial device name [/dev/photopc]" ac_help="$ac_help --with-int16=TYPE integer type that is 16 bits [autodetect]" ac_help="$ac_help --with-int32=TYPE integer type that is 32 bits [autodetect]" ac_help="$ac_help --enable-lowmemory Build lowmemory model" ac_help="$ac_help --without-rtprio Do not use realtime priority" ac_help="$ac_help --enable-alarmed-read Use blocking read() in conjunction with alarm() instead of select() based (e.g. for BeOS)" # 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=eph_iob.c # 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:622: 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:675: 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:732: 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=photopc VERSION=3.05 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:778: 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:791: 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:804: 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:817: 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:830: 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 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 # 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:857: 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:887: 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:938: 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:970: 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 981 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:986: \"$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:1012: 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:1017: 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:1045: 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 if test "X$ac_cv_prog_gcc" = "Xyes"; then CFLAGS="$CFLAGS -Wall" fi echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 echo "configure:1083: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else am_cv_prog_cc_stdc=no ac_save_CC="$CC" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" cat > conftest.$ac_ext < #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main() { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } EOF if { (eval echo configure:1136: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_prog_cc_stdc="$ac_arg"; break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* done CC="$ac_save_CC" fi if test -z "$am_cv_prog_cc_stdc"; then echo "$ac_t""none needed" 1>&6 else echo "$ac_t""$am_cv_prog_cc_stdc" 1>&6 fi case "x$am_cv_prog_cc_stdc" in x|xno) ;; *) CC="$CC $am_cv_prog_cc_stdc" ;; esac echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:1160: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1181: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1198: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for function prototypes""... $ac_c" 1>&6 echo "configure:1242: checking for function prototypes" >&5 if test "$am_cv_prog_cc_stdc" != no; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define PROTOTYPES 1 EOF U= ANSI2KNR= else echo "$ac_t""no" 1>&6 U=_ ANSI2KNR=./ansi2knr # Ensure some checks needed by ansi2knr itself. echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 echo "configure:1255: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1268: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF if { (eval echo configure:1335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_header_stdc=no fi rm -fr conftest* fi fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 if test $ac_cv_header_stdc = yes; then cat >> confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi for ac_hdr in string.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:1362: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 echo "configure:1401: 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 # Extract the first word of "echo", so it can be a program name with args. set dummy echo; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1430: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ECHO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$ECHO" in /*) ac_cv_path_ECHO="$ECHO" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_ECHO="$ECHO" # Let the user override the test with a dos path. ;; *) 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_path_ECHO="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_ECHO" && ac_cv_path_ECHO="echo" ;; esac fi ECHO="$ac_cv_path_ECHO" if test -n "$ECHO"; then echo "$ac_t""$ECHO" 1>&6 else echo "$ac_t""no" 1>&6 fi # Extract the first word of "ln", so it can be a program name with args. set dummy ln; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1465: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$LN" in /*) ac_cv_path_LN="$LN" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_LN="$LN" # Let the user override the test with a dos path. ;; *) 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_path_LN="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_LN" && ac_cv_path_LN="ln" ;; esac fi LN="$ac_cv_path_LN" if test -n "$LN"; then echo "$ac_t""$LN" 1>&6 else echo "$ac_t""no" 1>&6 fi # Extract the first word of "mv", so it can be a program name with args. set dummy mv; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1500: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MV'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$MV" in /*) ac_cv_path_MV="$MV" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_MV="$MV" # Let the user override the test with a dos path. ;; *) 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_path_MV="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_MV" && ac_cv_path_MV="mv" ;; esac fi MV="$ac_cv_path_MV" if test -n "$MV"; then echo "$ac_t""$MV" 1>&6 else echo "$ac_t""no" 1>&6 fi # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1535: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$RM" in /*) ac_cv_path_RM="$RM" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_RM="$RM" # Let the user override the test with a dos path. ;; *) 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_path_RM="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_RM" && ac_cv_path_RM="rm" ;; esac fi RM="$ac_cv_path_RM" if test -n "$RM"; then echo "$ac_t""$RM" 1>&6 else echo "$ac_t""no" 1>&6 fi # 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:1579: 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' # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1634: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # 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_RANLIB="ranlib" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" fi fi RANLIB="$ac_cv_prog_RANLIB" if test -n "$RANLIB"; then echo "$ac_t""$RANLIB" 1>&6 else echo "$ac_t""no" 1>&6 fi # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1664: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$AR" in /*) ac_cv_path_AR="$AR" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_AR="$AR" # Let the user override the test with a dos path. ;; *) 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_path_AR="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_AR" && ac_cv_path_AR="ar" ;; esac fi AR="$ac_cv_path_AR" if test -n "$AR"; then echo "$ac_t""$AR" 1>&6 else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 echo "configure:1697: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else rm -f conftestdata if ln -s X conftestdata 2>/dev/null then rm -f conftestdata ac_cv_prog_LN_S="ln -s" else ac_cv_prog_LN_S=ln fi fi LN_S="$ac_cv_prog_LN_S" if test "$ac_cv_prog_LN_S" = "ln -s"; then echo "$ac_t""yes" 1>&6 else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 echo "configure:1719: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF if { (eval echo configure:1799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_header_stdc=no fi rm -fr conftest* fi fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 if test $ac_cv_header_stdc = yes; then cat >> confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi for ac_hdr in fcntl.h sys/time.h sys/select.h unistd.h sched.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:1826: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done for ac_hdr in termios.h termio.h sgtty.h utime.h sys/utime.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:1866: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done for ac_hdr in signal.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:1906: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done # Check whether --enable-termios or --disable-termios was given. if test "${enable_termios+set}" = set; then enableval="$enable_termios" : fi if test X$enable_termios != Xno && test X$ac_cv_header_termios_h = Xyes; then cat >> confdefs.h <<\EOF #define USE_TERMIOS 1 EOF elif test X$ac_cv_header_sgtty_h = Xyes; then cat >> confdefs.h <<\EOF #define USE_SGTTY 1 EOF elif test X$ac_cv_header_termio_h = Xyes; then cat >> confdefs.h <<\EOF #define USE_TERMIO 1 EOF else { echo "configure: error: No usable terminal control (neither of termios/sgtty/termio)" 1>&2; exit 1; } fi echo $ac_n "checking for working const""... $ac_c" 1>&6 echo "configure:1969: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } ; return 0; } EOF if { (eval echo configure:2023: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_const=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_c_const" 1>&6 if test $ac_cv_c_const = no; then cat >> confdefs.h <<\EOF #define const EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 echo "configure:2044: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_off_t=yes else rm -rf conftest* ac_cv_type_off_t=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_off_t" 1>&6 if test $ac_cv_type_off_t = no; then cat >> confdefs.h <<\EOF #define off_t long EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 echo "configure:2077: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_size_t=yes else rm -rf conftest* ac_cv_type_size_t=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_size_t" 1>&6 if test $ac_cv_type_size_t = no; then cat >> confdefs.h <<\EOF #define size_t unsigned EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 echo "configure:2110: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include int main() { struct tm *tp; ; return 0; } EOF if { (eval echo configure:2124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_time=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_header_time" 1>&6 if test $ac_cv_header_time = yes; then cat >> confdefs.h <<\EOF #define TIME_WITH_SYS_TIME 1 EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 echo "configure:2145: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF if { (eval echo configure:2158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_struct_tm=sys/time.h fi rm -f conftest* fi echo "$ac_t""$ac_cv_struct_tm" 1>&6 if test $ac_cv_struct_tm = sys/time.h; then cat >> confdefs.h <<\EOF #define TM_IN_SYS_TIME 1 EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 echo "configure:2179: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #ifdef signal #undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main() { int i; ; return 0; } EOF if { (eval echo configure:2201: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_type_signal=int fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_signal" 1>&6 cat >> confdefs.h <&6 echo "configure:2220: checking for restartable system calls" >&5 if eval "test \"`echo '$''{'ac_cv_sys_restartable_syscalls'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < #include ucatch (isig) { } main () { int i = fork (), status; if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); } signal (SIGINT, ucatch); status = wait(&i); if (status == -1) wait(&i); exit (status == -1); } EOF if { (eval echo configure:2246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sys_restartable_syscalls=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_sys_restartable_syscalls=no fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_sys_restartable_syscalls" 1>&6 if test $ac_cv_sys_restartable_syscalls = yes; then cat >> confdefs.h <<\EOF #define HAVE_RESTARTABLE_SYSCALLS 1 EOF fi echo $ac_n "checking whether struct tm has tm_gmtoff""... $ac_c" 1>&6 echo "configure:2270: checking whether struct tm has tm_gmtoff" >&5 if eval "test \"`echo '$''{'ac_cv_tm_gmtoff'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif int main() { struct tm stm; stm.tm_gmtoff=0; ; return 0; } EOF if { (eval echo configure:2296: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_tm_gmtoff=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_tm_gmtoff=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_tm_gmtoff" 1>&6 if test X$ac_cv_tm_gmtoff = Xyes; then cat >> confdefs.h <<\EOF #define HAVE_TM_GMTOFF 1 EOF fi echo $ac_n "checking whether struct utimbuf is defined""... $ac_c" 1>&6 echo "configure:2317: checking whether struct utimbuf is defined" >&5 if eval "test \"`echo '$''{'ac_cv_have_utimbuf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef HAVE_UTIME_H # include #else # ifdef HAVE_SYS_UTIME_H # include # endif #endif int main() { struct utimbuf utb; utb.actime=0; ; return 0; } EOF if { (eval echo configure:2350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_utimbuf=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_have_utimbuf=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_have_utimbuf" 1>&6 if test X$ac_cv_have_utimbuf = Xyes; then cat >> confdefs.h <<\EOF #define HAVE_UTIMBUF 1 EOF fi echo $ac_n "checking whether optarg is defined in headers""... $ac_c" 1>&6 echo "configure:2370: checking whether optarg is defined in headers" >&5 if eval "test \"`echo '$''{'ac_cv_optarg_defined'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifdef STDC_HEADERS #include #endif #ifdef HAVE_UNISTD_H #include #endif int main() { char *xxx; xxx=optarg; ; return 0; } EOF if { (eval echo configure:2393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_optarg_defined=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_optarg_defined=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_optarg_defined" 1>&6 if test X$ac_cv_optarg_defined = Xyes; then cat >> confdefs.h <<\EOF #define OPTARG_DEFINED 1 EOF fi echo $ac_n "checking size of short""... $ac_c" 1>&6 echo "configure:2413: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ac_cv_sizeof_short=2 else cat > conftest.$ac_ext < main() { FILE *f=fopen("conftestval", "w"); if (!f) exit(1); fprintf(f, "%d\n", sizeof(short)); exit(0); } EOF if { (eval echo configure:2432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_sizeof_short=0 fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_sizeof_short" 1>&6 cat >> confdefs.h <&6 echo "configure:2452: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ac_cv_sizeof_int=4 else cat > conftest.$ac_ext < main() { FILE *f=fopen("conftestval", "w"); if (!f) exit(1); fprintf(f, "%d\n", sizeof(int)); exit(0); } EOF if { (eval echo configure:2471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_sizeof_int=0 fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_sizeof_int" 1>&6 cat >> confdefs.h <&6 echo "configure:2491: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ac_cv_sizeof_long=4 else cat > conftest.$ac_ext < main() { FILE *f=fopen("conftestval", "w"); if (!f) exit(1); fprintf(f, "%d\n", sizeof(long)); exit(0); } EOF if { (eval echo configure:2510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_sizeof_long=0 fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_sizeof_long" 1>&6 cat >> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <> confdefs.h <<\EOF #define LOWMEMORY 1 EOF fi # Check whether --with-rtprio or --without-rtprio was given. if test "${with_rtprio+set}" = set; then withval="$with_rtprio" : fi if test "X$with_rtprio" != "Xno"; then cat >> confdefs.h <<\EOF #define USE_RTPRIO 1 EOF fi # Check whether --enable-alarmed_read or --disable-alarmed_read was given. if test "${enable_alarmed_read+set}" = set; then enableval="$enable_alarmed_read" cat >> confdefs.h <<\EOF #define USE_ALARMED_READ 1 EOF fi for ac_func in rename mkdir strerror strspn select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:2621: 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:2649: \"$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 uname cfmakeraw sched_setscheduler nanosleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:2676: 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:2704: \"$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 snooze do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:2731: 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:2759: \"$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 echo $ac_n "checking for vprintf""... $ac_c" 1>&6 echo "configure:2783: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+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 vprintf(); 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_vprintf) || defined (__stub___vprintf) choke me #else vprintf(); #endif ; return 0; } EOF if { (eval echo configure:2811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_vprintf=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_VPRINTF 1 EOF else echo "$ac_t""no" 1>&6 fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 echo "configure:2835: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+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 _doprnt(); 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__doprnt) || defined (__stub____doprnt) choke me #else _doprnt(); #endif ; return 0; } EOF if { (eval echo configure:2863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func__doprnt=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_DOPRNT 1 EOF else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking for strftime""... $ac_c" 1>&6 echo "configure:2888: checking for strftime" >&5 if eval "test \"`echo '$''{'ac_cv_func_strftime'+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 strftime(); 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_strftime) || defined (__stub___strftime) choke me #else strftime(); #endif ; return 0; } EOF if { (eval echo configure:2916: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strftime=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_strftime=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'strftime`\" = yes"; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_STRFTIME 1 EOF else echo "$ac_t""no" 1>&6 # strftime is in -lintl on SCO UNIX. echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 echo "configure:2938: checking for strftime in -lintl" >&5 ac_lib_var=`echo intl'_'strftime | 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="-lintl $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 cat >> confdefs.h <<\EOF #define HAVE_STRFTIME 1 EOF LIBS="-lintl $LIBS" else echo "$ac_t""no" 1>&6 fi fi for ac_func in usleep getopt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:2986: 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:3014: \"$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 echo $ac_n "checking for strcasecmp""... $ac_c" 1>&6 echo "configure:3041: checking for strcasecmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_strcasecmp'+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 strcasecmp(); 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_strcasecmp) || defined (__stub___strcasecmp) choke me #else strcasecmp(); #endif ; return 0; } EOF if { (eval echo configure:3069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strcasecmp=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_strcasecmp=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'strcasecmp`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 LIBOBJS="$LIBOBJS strcscmp.o" fi cat >> confdefs.h <<\EOF #define UNIX 1 EOF if test $ac_cv_header_termios_h != yes; then { echo "configure: error: Cannot work without termios!" 1>&2; exit 1; } fi if test $ac_cv_func_vprintf != yes; then { echo "configure: error: Cannot work without v*printf() functions!" 1>&2; exit 1; } fi if test $INT16 = unknown; then { echo "configure: error: Cannot determine 16bit integer type!" 1>&2; exit 1; } fi if test $INT32 = unknown; then { echo "configure: error: Cannot determine 32bit integer type!" 1>&2; exit 1; } fi case $VERSION in *dev*) cat >> confdefs.h <<\EOF #define DEVVERSION 1 EOF ;; esac # This is necessary so that .o files in LIBOBJS are also built via # the ANSI2KNR-filtering rules. LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'` if test "X$with_rtprio" = "Xyes"; then echo "$ac_t""***" 1>&6 echo "$ac_t""*** "photopc" program must be setuid root to use realtime priority" 1>&6 echo "$ac_t""***" 1>&6 fi 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 DEFS=-DHAVE_CONFIG_H # 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 config.h dos/version.h win32/version.h" | 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%@CPP@%$CPP%g s%@U@%$U%g s%@ANSI2KNR@%$ANSI2KNR%g s%@PROGS@%$PROGS%g s%@ECHO@%$ECHO%g s%@LN@%$LN%g s%@MV@%$MV%g s%@RM@%$RM%g s%@LIBPROGS@%$LIBPROGS%g s%@RANLIB@%$RANLIB%g s%@AR@%$AR%g s%@LN_S@%$LN_S%g s%@INT16@%$INT16%g s%@INT32@%$INT32%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* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; 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 echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: # Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF sed -n -f conftest.hdr confdefs.h > conftest.vals rm -f conftest.hdr # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >> conftest.vals <<\EOF s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write a limited-size here document to conftest.frag. echo ' cat > conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF sed -f conftest.frag conftest.in > conftest.out rm -f conftest.in mv conftest.out conftest.in ' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # 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" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF am_indx=1 for am_file in config.h dos/version.h win32/version.h; do case " $CONFIG_HEADERS " in *" $am_file "*) echo timestamp > `echo $am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx ;; esac am_indx=`expr "$am_indx" + 1` done 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 photopc-3.05/configure.in 644 2627 62 20014 7227711256 10534 dnl Process this file with autoconf to produce a configure script. AC_REVISION([$Id: configure.in,v 1.22 2001/01/12 23:26:38 crosser Exp $])dnl dnl $Log: configure.in,v $ dnl Revision 1.22 2001/01/12 23:26:38 crosser dnl new release, avoid strncasecmp, change copyright year dnl dnl Revision 1.21 2000/08/13 21:51:48 crosser dnl More changes incorporated from John Bowman's version dnl dnl Revision 1.20 2000/07/14 06:35:39 crosser dnl reportedly some models return CAN instead of DC1 dnl dnl Revision 1.19 2000/05/09 13:20:54 crosser dnl configure read() with alarm() better. dnl Address signed vs. unsigned arguments dnl other cleanups to make most notorious compilers happy dnl dnl Revision 1.18 2000/05/02 12:13:32 crosser dnl some better debugging output dnl alarm() based timeouted read (build with "--without-select") dnl dnl Revision 1.17 2000/03/14 21:15:35 crosser dnl Nikon cp950 seems to report negative file size, try negate it. dnl dnl Revision 1.16 2000/02/17 21:29:54 crosser dnl final cleanup for 3.04, change version dnl change debugging levels dnl dnl Revision 1.15 2000/02/01 22:04:15 crosser dnl xchdir() function iterates thru path elements dnl define DEVVERSION for extra verbosity dnl dnl Revision 1.14 2000/01/23 15:51:01 crosser dnl work in progress on folder tree support dnl dnl Revision 1.13 1999/12/26 13:59:45 crosser dnl sort frame list for erase command; new version 3.03 dnl dnl Revision 1.12 1999/12/11 14:10:15 crosser dnl Support sgtty terminal control dnl Proper "fake speed" handling (needed two values) dnl dnl Revision 1.11 1999/12/01 21:41:23 crosser dnl add "pseudo" speed dnl dnl Revision 1.10 1999/11/29 05:39:11 crosser dnl make release 3.02 dnl dnl Revision 1.9 1999/11/17 13:48:08 crosser dnl check if need to include getopt.h dnl dnl Revision 1.8 1999/11/09 18:55:03 crosser dnl work on windows version dnl dnl Revision 1.7 1999/09/19 12:33:11 crosser dnl Mention comlite32 in the README dnl dnl Revision 1.6 1999/08/14 09:00:33 crosser dnl Create version.h's in dos and win23 directories dnl dnl Revision 1.5 1999/08/01 23:28:06 crosser dnl multiple enhancements dnl dnl Revision 1.4 1999/03/12 23:22:30 crosser dnl check utime and timezone things dnl dnl Revision 1.3 1999/03/12 10:06:23 crosser dnl fix bad checks dnl dnl Revision 1.2 1999/03/10 22:34:43 crosser dnl check rename func dnl dnl Revision 1.1 1999/03/06 13:16:06 crosser dnl Initial revision dnl AC_INIT(eph_iob.c) AM_INIT_AUTOMAKE(photopc, 3.05) AM_CONFIG_HEADER(config.h dos/version.h win32/version.h) dnl Checks for programs. AC_LANG_C AC_PROG_CC if test "X$ac_cv_prog_gcc" = "Xyes"; then CFLAGS="$CFLAGS -Wall" fi AM_C_PROTOTYPES AC_PROG_MAKE_SET AC_SUBST(PROGS)dnl AC_PATH_PROG(ECHO, echo, echo)dnl AC_PATH_PROG(LN, ln, ln)dnl AC_PATH_PROG(MV, mv, mv)dnl AC_PATH_PROG(RM, rm, rm)dnl AC_SUBST(LIBPROGS)dnl AC_PROG_INSTALL AC_PROG_RANLIB AC_PATH_PROG(AR, ar, ar)dnl AC_PROG_LN_S dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h sys/time.h sys/select.h unistd.h sched.h) AC_CHECK_HEADERS(termios.h termio.h sgtty.h utime.h sys/utime.h) AC_CHECK_HEADERS(signal.h) AC_ARG_ENABLE(termios, [ --disable-termios do not use POSIX terminal control (e.g. for NeXT)]) if test X$enable_termios != Xno && test X$ac_cv_header_termios_h = Xyes; then AC_DEFINE(USE_TERMIOS) elif test X$ac_cv_header_sgtty_h = Xyes; then AC_DEFINE(USE_SGTTY) elif test X$ac_cv_header_termio_h = Xyes; then AC_DEFINE(USE_TERMIO) else AC_MSG_ERROR([No usable terminal control (neither of termios/sgtty/termio)]) fi dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_TYPE_SIGNAL AC_SYS_RESTARTABLE_SYSCALLS AC_MSG_CHECKING([whether struct tm has tm_gmtoff]) AC_CACHE_VAL(ac_cv_tm_gmtoff, [AC_TRY_COMPILE([ #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif ], [ struct tm stm; stm.tm_gmtoff=0; ], ac_cv_tm_gmtoff=yes, ac_cv_tm_gmtoff=no)])dnl AC_MSG_RESULT($ac_cv_tm_gmtoff) if test X$ac_cv_tm_gmtoff = Xyes; then AC_DEFINE(HAVE_TM_GMTOFF) fi AC_MSG_CHECKING([whether struct utimbuf is defined]) AC_CACHE_VAL(ac_cv_have_utimbuf, [AC_TRY_COMPILE([ #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef HAVE_UTIME_H # include #else # ifdef HAVE_SYS_UTIME_H # include # endif #endif ], [ struct utimbuf utb; utb.actime=0; ], ac_cv_have_utimbuf=yes, ac_cv_have_utimbuf=no)])dnl AC_MSG_RESULT($ac_cv_have_utimbuf) if test X$ac_cv_have_utimbuf = Xyes; then AC_DEFINE(HAVE_UTIMBUF) fi AC_MSG_CHECKING([whether optarg is defined in headers]) AC_CACHE_VAL(ac_cv_optarg_defined, [AC_TRY_COMPILE([ #include #ifdef STDC_HEADERS #include #endif #ifdef HAVE_UNISTD_H #include #endif ], [ char *xxx; xxx=optarg; ], ac_cv_optarg_defined=yes, ac_cv_optarg_defined=no)])dnl AC_MSG_RESULT($ac_cv_optarg_defined) if test X$ac_cv_optarg_defined = Xyes; then AC_DEFINE(OPTARG_DEFINED) fi AC_CHECK_SIZEOF(short,2) AC_CHECK_SIZEOF(int,4) AC_CHECK_SIZEOF(long,4) AC_ARG_WITH(default_device, [ --with-default-device=DEVNAME serial device name [/dev/photopc]]) if test "X$with_default_device" != "Xno" && test "X$with_default_device" != "Xyes" && test "X$with_default_device" != "X"; then AC_DEFINE_UNQUOTED(DEFAULT_DEVICE,"$with_default_device")dnl fi dnl define INT16 and INT32 AC_ARG_WITH(int16, [ --with-int16=TYPE integer type that is 16 bits [autodetect]]) if test "X$with_int16" != "Xno" && test "X$with_int16" != "Xyes" && test "X$with_int16" != "X"; then INT16=$with_int16 else if test "X$ac_cv_sizeof_short" = "X2"; then INT16=short else if test "X$ac_cv_sizeof_int" = "X2"; then INT16=int fi fi fi AC_ARG_WITH(int32, [ --with-int32=TYPE integer type that is 32 bits [autodetect]]) if test "X$with_int32" != "Xno" && test "X$with_int32" != "Xyes" && test "X$with_int32" != "X"; then INT32=$with_int32 else if test "X$ac_cv_sizeof_long" = "X4"; then INT32=long else if test "X$ac_cv_sizeof_int" = "X4"; then INT32=int fi fi fi : ${INT16=unknown} : ${INT32=unknown} AC_SUBST(INT16)dnl AC_SUBST(INT32)dnl AC_DEFINE_UNQUOTED(INT16,$INT16)dnl AC_DEFINE_UNQUOTED(INT32,$INT32)dnl dnl Define LOWMEMORY model AC_ARG_ENABLE(lomemory, [ --enable-lowmemory Build lowmemory model], AC_DEFINE(LOWMEMORY)) dnl Use RT priority (default yes) AC_ARG_WITH(rtprio, [ --without-rtprio Do not use realtime priority]) if test "X$with_rtprio" != "Xno"; then AC_DEFINE(USE_RTPRIO) fi AC_ARG_ENABLE(alarmed_read, [ --enable-alarmed-read Use blocking read() in conjunction with alarm() instead of select() based (e.g. for BeOS)], AC_DEFINE(USE_ALARMED_READ)) dnl Checks for library functions. AC_CHECK_FUNCS(rename mkdir strerror strspn select) AC_CHECK_FUNCS(uname cfmakeraw sched_setscheduler nanosleep) AC_CHECK_FUNCS(snooze) dnl this is BeOS replacement for usleep() AC_FUNC_VPRINTF AC_FUNC_STRFTIME AC_REPLACE_FUNCS(usleep getopt) AC_CHECK_FUNC(strcasecmp, [], [LIBOBJS="$LIBOBJS strcscmp.o"]) dnl this sould be done after determining the target system type... AC_DEFINE(UNIX) dnl check if all necessary functions are detected if test $ac_cv_header_termios_h != yes; then AC_MSG_ERROR([Cannot work without termios!]) fi if test $ac_cv_func_vprintf != yes; then AC_MSG_ERROR([Cannot work without v*printf() functions!]) fi if test $INT16 = unknown; then AC_MSG_ERROR([Cannot determine 16bit integer type!]) fi if test $INT32 = unknown; then AC_MSG_ERROR([Cannot determine 32bit integer type!]) fi case $VERSION in *dev*) AC_DEFINE(DEVVERSION);; esac # This is necessary so that .o files in LIBOBJS are also built via # the ANSI2KNR-filtering rules. LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'` if test "X$with_rtprio" = "Xyes"; then AC_MSG_RESULT([***]) AC_MSG_RESULT([*** "photopc" program must be setuid root to use realtime priority]) AC_MSG_RESULT([***]) fi AC_OUTPUT(Makefile) photopc-3.05/getopt.c 644 2627 62 60043 6751646764 7713 /* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu before changing it! Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO #define _NO_PROTO #endif #ifdef HAVE_CONFIG_H #if defined (emacs) || defined (CONFIG_BROKETS) /* We use instead of "config.h" so that a compilation using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h (which it would do because it found this file in $srcdir). */ #include #else #include "config.h" #endif #endif #ifndef __STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #if defined (_LIBC) || !defined (__GNU_LIBRARY__) /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ #include #endif /* GNU C library. */ /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* XXX 1003.2 says this must be 1 before any call. */ int optind = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return EOF with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ #include #define my_index strchr #else /* Avoid depending on library functions or files whose names are inconsistent. */ char *getenv (); static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ #ifndef __STDC__ /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); #endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ static const char * _getopt_initialize (optstring) const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind = 1; nextchar = NULL; /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (getenv ("POSIXLY_CORRECT") != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns `EOF'. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ #if NLS #include "nl_types.h" #endif int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { optarg = NULL; #if NLS libc_nls_init(); #endif if (optind == 0) optstring = _getopt_initialize (optstring); if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && (argv[optind][0] != '-' || argv[optind][1] == '\0')) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return EOF; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if ((argv[optind][0] != '-' || argv[optind][1] == '\0')) { if (ordering == REQUIRE_ORDER) return EOF; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((nameend - nextchar) == (int)strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) #if NLS fprintf (stderr, catgets(_libc_cat, GetoptSet, GetoptAmbiguous, "%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); #else fprintf (stderr, "%s: option `%s' is ambiguous\n", argv[0], argv[optind]); #endif nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) { if (argv[optind - 1][1] == '-') /* --option */ #if NLS fprintf (stderr, catgets(_libc_cat, GetoptSet, GetoptNoArgumentsAllowed1, "%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); #else fprintf (stderr, "%s: option `--%s' doesn't allow an argument\n", argv[0], pfound->name); #endif else /* +option or -option */ #if NLS fprintf (stderr, catgets(_libc_cat, GetoptSet, GetoptNoArgumentsAllowed2, "%s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); #else fprintf (stderr, "%s: option `%c%s' doesn't allow an argument\n", argv[0], argv[optind - 1][0], pfound->name); #endif } nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) #if NLS fprintf (stderr, catgets(_libc_cat, GetoptSet, GetoptRequiresArgument1, "%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); #else fprintf (stderr, "%s: option `%s' requires an argument\n", argv[0], argv[optind - 1]); #endif nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (opterr) { if (argv[optind][1] == '-') /* --option */ #if NLS fprintf (stderr, catgets(_libc_cat, GetoptSet, GetoptUnrecognized1, "%s: unrecognized option `--%s'\n"), argv[0], nextchar); #else fprintf (stderr, "%s: unrecognized option `--%s'\n", argv[0], nextchar); #endif else /* +option or -option */ #if NLS fprintf (stderr, catgets(_libc_cat, GetoptSet, GetoptUnrecognized2, "%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); #else fprintf (stderr, "%s: unrecognized option `%c%s'\n", argv[0], argv[optind][0], nextchar); #endif } nextchar = (char *) ""; optind++; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (opterr) { /* 1003.2 specifies the format of this message. */ #if NLS fprintf (stderr, catgets(_libc_cat, GetoptSet, GetoptIllegal, "%s: illegal option -- %c\n"), argv[0], c); #else fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); #endif } optopt = c; return '?'; } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ #if NLS fprintf (stderr, catgets(_libc_cat, GetoptSet, GetoptRequiresArgument2, "%s: option requires an argument -- %c\n"), argv[0], c); #else fprintf (stderr, "%s: option requires an argument -- %c\n", argv[0], c); #endif } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == EOF) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ photopc-3.05/install-sh 755 0 0 12736 7032236567 10113 #!/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 photopc-3.05/missing 755 0 0 14213 7032236567 7476 #! /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 photopc-3.05/mkinstalldirs 755 0 0 1322 7032236567 10662 #! /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 photopc-3.05/strcscmp.c 644 2627 62 255 6751647021 10171 #include int strcasecmp(char *s1, char *s2) { while (*s1 && *s2 && (toupper(*s1) == toupper(*s2))) { s1++; s2++; } return (toupper(*s1) - toupper(*s2)); } photopc-3.05/usleep.c 644 2627 62 16232 7106010266 7660 #ifndef LINT static char *rcsid="$Id: usleep.c,v 2.9 2000/05/09 13:20:54 crosser Exp $"; #endif /* Copyright (c) 1997-1999 Eugene G. Crosser Copyright (c) 1998,1999 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: usleep.c,v $ Revision 2.9 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 2.8 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 2.7 1999/04/22 04:14:54 crosser avoid GCC-isms Revision 2.6 1999/04/10 16:33:05 lightner Used calibrated spin loop for Win32 (like MSDOS) in place of Sleep() Speed upspin loop calibrarion for MSDOS Revision 2.5 1999/03/12 10:06:23 crosser fix typo Revision 2.4 1999/03/06 13:37:08 crosser Convert to autoconf-style Revision 2.3 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.2 1998/02/05 23:34:27 lightner Improve DOS logic short usleep() accuracy...use BIOS tick count Revision 2.1 1998/01/18 02:16:45 crosser DOS support Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 */ #include #ifdef HAVE_CONFIG_H #include "config.h" #endif #if defined(UNIX) #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_NANOSLEEP void usleep(unsigned int useconds) { struct timespec ts; ts.tv_sec=(long int)(useconds/1000000); ts.tv_nsec=(long int)(useconds%1000000)*1000ul; nanosleep (&ts, NULL); } #elif HAVE_SNOOZE extern void snooze(long long timeout); void usleep (unsigned long usec) { snooze((long long)usec); } #elif HAVE_SELECT #ifdef HAVE_SYS_SELECT_H #include #endif void usleep (unsigned long usec) { struct timeval timeout; timeout.tv_sec = usec / 1000000; timeout.tv_usec = usec - 1000000 * timeout.tv_sec; select(1, NULL, NULL, NULL, &timeout); } #else # error "cannot sleep: neither nanosleep nor select" #endif /* HAVE_NANOSLEEP / HAVE_SELECT */ #elif defined(MSWINDOWS) #include #include #include #include static unsigned long start_secs; static unsigned long start_usecs; static unsigned long end_usecs; static int calibrated = 0; volatile unsigned long dummy = 0; static double delay_factor = 1; #define DELAY_MARGIN 1.5 void start_time(void) { struct _timeb t; _ftime(&t); start_secs = t.time; start_usecs = 1000L * t.millitm; } unsigned long elasped_usecs(void) { struct _timeb t; _ftime(&t); end_usecs = 1000L * t.millitm + 1000000L * (t.time - start_secs); while (end_usecs < start_usecs) end_usecs += 60L * 1000000L; return end_usecs - start_usecs; } unsigned long spin_loop(double delay_factor) { unsigned long delay = delay_factor; unsigned long stop_usecs; #define CAL_TICKS 2 dummy = 0; start_time(); if (delay == 0) { /* sync with next clock tick */ while (elasped_usecs() == 0) ; stop_usecs = CAL_TICKS * 55000L + 1000L; } else { elasped_usecs(); stop_usecs = -1; } while (--delay > 0) { ++dummy; if (elasped_usecs() >= stop_usecs) break; } return dummy / CAL_TICKS; } void calibrate_delay(void) { # define MAX_LOOPS 3 int i; unsigned long loops, trial_loops; /* calibrate spin_loop() (returns loops per 18.2Hz PC timer tick */ loops = 0; for (i = 0; i < MAX_LOOPS; ++i) { trial_loops = spin_loop(0.0); if (trial_loops > loops) loops = trial_loops; } delay_factor = ((double)loops / 55000.0) * DELAY_MARGIN; calibrated = 1; /* printf("loops = %ld, delay_factor = %g\n", loops, delay_factor); */ } long usleep(long usecs) { if (!calibrated) calibrate_delay(); if (usecs > 1000000L) { Sleep((DWORD)usecs / 1000L); } else { spin_loop(delay_factor * usecs + 1); } } #elif defined(DOS) #include static unsigned long start_usecs; static unsigned long end_usecs; static int calibrated = 0; volatile unsigned long dummy = 0; double delay_factor = 1; #define DELAY_MARGIN 1.5 #ifndef USE_DOS_TIME unsigned long stop_tick; #ifndef NO_TICKS_MACRO #define get_bios_ticks() (*((volatile unsigned long far *)(MK_FP(0, 0x46c)))) #else /* !NO_TICKS_MACRO */ unsigned long get_bios_ticks(void) { static unsigned long far *p; if (!p) p = MK_FP(0, 0x46c); return *p; } #endif /* !NO_TICKS_MACRO */ #endif /* !USE_DOS_TIME */ void start_time(void) { #ifndef USE_DOS_TIME unsigned long t; t = get_bios_ticks() & 0xff; start_usecs = 55000L * t; #else struct dostime_t t; _dos_gettime(&t); start_usecs = 1000000L * t.second + 10000L * t.hsecond; #endif } unsigned long elasped_usecs(void) { #ifndef USE_DOS_TIME unsigned long t; t = get_bios_ticks() & 0xff; end_usecs = 55000L * t; while (end_usecs < start_usecs) end_usecs += 55000L * 0xff; #else struct dostime_t t; _dos_gettime(&t); end_usecs = 1000000L * t.second + 10000L * t.hsecond; while (end_usecs < start_usecs) end_usecs += 60L * 1000000L; #endif return end_usecs - start_usecs; } unsigned long spin_loop(double delay_factor) { unsigned long delay = delay_factor; #ifndef USE_DOS_TIME #define CAL_TICKS 2 dummy = 0; if (delay == 0) { unsigned long end_tick; unsigned long start_tick = get_bios_ticks(); /* sync with next clock tick */ while (start_tick == (end_tick = get_bios_ticks())) ; stop_tick = end_tick + CAL_TICKS; } else { stop_tick = get_bios_ticks() - 1; } #endif /* !USE_DOS_TIME */ while (--delay > 0) { ++dummy; #ifndef USE_DOS_TIME if (get_bios_ticks() == stop_tick) break; #endif } #ifndef USE_DOS_TIME return dummy / CAL_TICKS; #else return dummy; #endif } #ifndef USE_DOS_TIME void calibrate_delay(void) { # define MAX_LOOPS 3 int i; unsigned long loops, trial_loops; /* calibrate spin_loop() (returns loops per 18.2Hz PC timer tick */ loops = 0; for (i = 0; i < MAX_LOOPS; ++i) { trial_loops = spin_loop(0.0); if (trial_loops > loops) loops = trial_loops; } delay_factor = ((double)loops / 55000.0) * DELAY_MARGIN; calibrated = 1; /* printf("loops = %ld, delay_factor = %g\n", loops, delay_factor); */ } #else /* USE_DOS_TIME */ void calibrate_delay(void) { int i; unsigned long usecs; delay_factor = 1; for (i = 0; i < 32; ++i) { start_time(); spin_loop(delay_factor); usecs = elasped_usecs(); if (usecs >= 2L * 55L * 1000L) { delay_factor = delay_factor / usecs; break; } delay_factor = delay_factor * 4.0; } calibrated = 1; } #endif /* USE_DOS_TIME */ long usleep(long usecs) { if (!calibrated) calibrate_delay(); if (usecs > 200000) { start_time(); while (elasped_usecs() < usecs) ; } else { spin_loop(delay_factor * usecs + 1); } } #else # error platform not defined #endif photopc-3.05/eph_read.c 644 2627 62 14465 7133532273 10147 #ifndef LINT static char *rcsid="$Id: eph_read.c,v 2.11 2000/07/14 06:35:39 crosser Exp $"; #endif /* Copyright (c) 1997-2000 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: eph_read.c,v $ Revision 2.11 2000/07/14 06:35:39 crosser reportedly some models return CAN instead of DC1 Revision 2.10 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 2.9 2000/05/02 22:26:35 crosser A few things incorporated from John Bowman's Nikon specific diffs Revision 2.8 2000/05/02 12:13:32 crosser some better debugging output alarm() based timeouted read (build with "--without-select") Revision 2.7 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 2.6 1999/03/06 13:37:08 crosser Convert to autoconf-style Revision 2.5 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.4 1998/08/01 13:12:41 lightner change Windows logic and timeouts Revision 2.3 1998/01/18 02:16:45 crosser DOS support Revision 2.2 1998/01/05 19:49:14 lightner Win32 syntax error fixed: fd changed to iob->fd Revision 2.1 1998/01/03 19:57:13 crosser Fix Windows things, improve error reporting Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #ifdef HAVE_FCNTL_H #include #endif #include #include "eph_io.h" #include "eph_priv.h" #ifdef MSWINDOWS #define ERRNO GetLastError() #else #define ERRNO errno #endif /* Platform-dependant implementation of read with timeout */ #if defined(MSWINDOWS) #include #include #include #include #define MIN_TIMEOUT (1000) /* 1 second...doesn't change so often! */ size_t eph_readt(eph_iob *iob,char *buf,size_t length,long timeout_usec,int *rc) { BOOL stat; DWORD rlen; DWORD timeout_ms; DWORD interval; DWORD multiplier; DWORD constant; if (timeout_usec == 0) { /* return immediately if no read data ready */ interval = MAXDWORD; multiplier = 0; constant = 0; } else { /* normal read timeout */ timeout_ms = timeout_usec/1000; if (timeout_ms < MIN_TIMEOUT) timeout_ms = MIN_TIMEOUT; interval = 0; multiplier = 0; constant = timeout_ms; } /* reset timeout intervals if changed */ if (interval != iob->worktimeouts.ReadIntervalTimeout || multiplier != iob->worktimeouts.ReadTotalTimeoutMultiplier || constant != iob->worktimeouts.ReadTotalTimeoutConstant) { iob->worktimeouts.ReadIntervalTimeout = interval; iob->worktimeouts.ReadTotalTimeoutMultiplier = multiplier; iob->worktimeouts.ReadTotalTimeoutConstant = constant; if (!SetCommTimeouts(iob->fd, &iob->worktimeouts)) { eph_error(iob,ERRNO, "SetCommTimeouts set error %s", strerror(ERRNO)); return (size_t)-1; } } *rc=0; stat = ReadFile(iob->fd,buf,length,&rlen,NULL); /* no timeout error if timeout was zero */ if ((!stat || (rlen == 0)) && (timeout_usec != 0)) { SetLastError((DWORD)ERROR_SEM_TIMEOUT); return (size_t)-1; } else { SetLastError((DWORD)0L); *rc = rlen ? 1 : 0; return (size_t)rlen; } } #elif defined(UNIX) #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_SELECT_H #include #endif /* HAVE_SYS_SELECT_H */ #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef USE_ALARMED_READ #ifdef HAVE_SIGNAL_H #include #endif #ifdef HAVE_FCNTL_H #include #endif static RETSIGTYPE alrmhdl(int sig) {} size_t eph_readt(eph_iob *iob,char *buf,size_t length,long timeout_usec,int *rc) { int ret,timeout_sec; RETSIGTYPE *oldsig; if (length == 0) return 0; if (timeout_usec == 0L) { *rc=1; if (fcntl(iob->fd,F_SETFL,iob->flag|O_NDELAY) == -1) return (size_t)-1; ret=read(iob->fd,buf,length); if (fcntl(iob->fd,F_SETFL,iob->flag) == -1) return (size_t)-1; if ((ret == -1) && (errno == EAGAIN)) { ret=0; *rc=0; } return ret; } #ifdef HAVE_RESTARTABLE_SYSCALLS (void)siginterrupt(SIGALRM,1); #endif timeout_sec=timeout_usec/1000000; if (timeout_sec < 2) timeout_sec=2; oldsig=signal(SIGALRM,alrmhdl); alarm((unsigned)timeout_sec); *rc=1; ret=read(iob->fd,buf,length); if ((ret == -1) && (errno == EINTR)) { ret=0; *rc=0; } alarm(0); signal(SIGALRM,oldsig); return ret; } #else /* USE_ALARMED_READ */ size_t eph_readt(eph_iob *iob,char *buf,size_t length,long timeout_usec,int *rc) { fd_set rfds,wfds,efds; struct timeval timer; if (length == 0) return 0; FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&efds); FD_SET(iob->fd,&rfds); FD_SET(iob->fd,&efds); timer.tv_sec=timeout_usec / 1000000L; timer.tv_usec=timeout_usec % 1000000L; (*rc)=select((iob->fd)+1,&rfds,&wfds,&efds,&timer); if ((*rc) == 0) { return 0; } if (((*rc) < 0) || (FD_ISSET(iob->fd,&efds))) return (size_t)-1; return read(iob->fd,buf,length); } #endif /* USE_ALARMED_READ */ #elif defined(DOS) #include #include "comio.h" #include "usleep.h" #define TO_USECS (1L * 1000000L) size_t eph_readt(eph_iob *iob,char *buf,size_t length,long timeout_usec,int *rc) { int ch, reset = 0, rlen = 0; unsigned char *p = buf; if (length == 0) return 0; *rc = 0; start_time(); #if 0 while (elasped_usecs() <= ((unsigned long)TO_USECS + (length * 1000L))) #else while (elasped_usecs() <= (unsigned long)timeout_usec) #endif { while (ttchk()) { *rc = 0; reset = 1; if (rlen < 0) rlen = 0; ch = ttinc(); *(p++) = ch; if (++rlen >= length) { return (size_t)rlen; } } if (reset) { start_time(); reset = 0; } } return (size_t)rlen; } #else # error platform not defined #endif photopc-3.05/eph_iob.c 644 2627 62 5665 7024455507 7772 #ifndef LINT static char *rcsid="$Id: eph_iob.c,v 2.7 1999/12/11 14:10:15 crosser Exp $"; #endif /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: eph_iob.c,v $ Revision 2.7 1999/12/11 14:10:15 crosser Support sgtty terminal control Proper "fake speed" handling (needed two values) Revision 2.6 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 2.5 1999/07/28 19:58:59 crosser reorder includes Revision 2.4 1999/03/06 13:37:08 crosser Convert to autoconf-style Revision 2.3 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.2 1998/02/08 19:58:38 crosser Support low memory: chunked saving etc. Revision 2.1 1998/01/18 02:16:45 crosser DOS support Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef STDC_HEADERS #include #include #endif #include #include "eph_io.h" static void deferrorcb(int errcode,char *errstr) { fprintf(stderr,"Error %d: %s\n",errcode,errstr); } static void * defrealloccb(void *old,size_t length) { if (old) return realloc(old,length); else return malloc(length); } static void defruncb(off_t count) { return; } eph_iob * eph_new(void (*errorcb)(int errcode,char *errstr), void *(*realloccb)(void *old,size_t length), void (*runcb)(off_t count), int (*storecb)(char *data,size_t size), int debug) { eph_iob *iob; iob=(eph_iob *)malloc(sizeof(eph_iob)); if (!iob) return iob; if (errorcb) iob->errorcb=errorcb; else iob->errorcb=deferrorcb; if (realloccb) iob->realloccb=realloccb; else iob->realloccb=defrealloccb; if (runcb) iob->runcb=runcb; else iob->runcb=defruncb; if (storecb) iob->storecb=storecb; else iob->storecb=NULL; iob->debug=debug; #if defined(MSWINDOWS) iob->fd=INVALID_HANDLE_VALUE; memset((char*)&iob->savedcb,0,sizeof(iob->savedcb)); memset((char*)&iob->savetimeouts,0,sizeof(iob->savetimeouts)); #elif defined(UNIX) iob->fd=-1; #if defined(USE_TERMIOS) memset((char*)&iob->savetios,0,sizeof(iob->savetios)); #elif defined(USE_SGTTY) memset((char*)&iob->savesgtty,0,sizeof(iob->savesgtty)); #elif defined(USE_TERMIO) memset((char*)&iob->savetio,0,sizeof(iob->savetio)); #endif #elif defined(DOS) iob->fd=-1; #else # error "platform not defined" #endif return iob; } void eph_free(eph_iob *iob) { free(iob); } photopc-3.05/eph_err.c 644 2627 62 4710 6751646717 10012 #ifndef LINT static char *rcsid="$Id: eph_err.c,v 2.6 1999/08/01 21:36:54 crosser Exp $"; #endif /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: eph_err.c,v $ Revision 2.6 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 2.5 1999/07/28 19:57:52 crosser reorder includes Revision 2.4 1999/03/06 13:37:08 crosser Convert to autoconf-style Revision 2.3 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.2 1998/01/18 02:16:45 crosser DOS support Revision 2.1 1998/01/03 19:57:13 crosser Fix Windows things, improve error reporting Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include "eph_io.h" #include "eph_priv.h" static char *eph_errmsg[] = { /* 10001 */ "Data too long", /* 10002 */ "Timeout", /* 10003 */ "Unexpected amount of data read", /* 10004 */ "Bad packet header received", /* 10005 */ "Bad CRC on packet", /* 10006 */ "Bad speed value", /* 10007 */ "No memory", /* 10008 */ "Bad arguments", /* 10009 */ "", /* 10010 */ "", /* 10011 */ "", /* 10012 */ "", /* 10013 */ "", /* 10014 */ "", /* 10015 */ "", }; #ifndef HAVE_STRERROR char *strerror(int err) { static char buf[32]; sprintf(buf,"System error %d",err); return buf; } #endif /* We do not do any buffer override checks here because we are sure that the function is called *only* from within our library. */ void eph_error (eph_iob *iob,int err,char *fmt,...) { va_list ap; char *msg=NULL; char msgbuf[512]; va_start(ap,fmt); if (fmt) { vsprintf(msgbuf,fmt,ap); } else { if ((err >= ERR_BASE) && (err < ERR_MAX)) { msg=eph_errmsg[err-ERR_BASE]; } else { msg=strerror(err); } strcpy(msgbuf,msg); } va_end(ap); (iob->errorcb)(err,msgbuf); } photopc-3.05/eph_cmd.c 644 2627 62 23325 7106010266 7763 #ifndef LINT static char *rcsid="$Id: eph_cmd.c,v 1.19 2000/05/09 13:20:54 crosser Exp $"; #endif /* Copyright (c) 1997-2000 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: eph_cmd.c,v $ Revision 1.19 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 1.18 2000/05/02 22:26:35 crosser A few things incorporated from John Bowman's Nikon specific diffs Revision 1.17 2000/05/02 12:13:32 crosser some better debugging output alarm() based timeouted read (build with "--without-select") Revision 1.16 2000/02/13 11:15:01 crosser Kludge null setint for Nikon Revision 1.15 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 1.14 1999/07/28 19:56:31 crosser reorder includes Revision 1.13 1999/03/21 20:22:09 crosser change retry logic for first block (for Agfa 307) Revision 1.12 1999/03/06 13:37:08 crosser Convert to autoconf-style Revision 1.11 1999/01/21 09:12:56 crosser fix of retry logic from Richard Sharman Revision 1.10 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 1.9 1998/08/09 13:24:59 crosser cleanup for DOS Revision 1.8 1998/08/09 12:57:56 crosser make right running report on 16bit architecture Revision 1.7 1998/02/26 00:50:39 crosser extra error message Revision 1.6 1998/02/16 06:15:44 lightner Parameterize tmpbuf size; fix tmpbuf memory leak Revision 1.5 1998/02/08 19:58:38 crosser Support low memory: chunked saving etc. Revision 1.4 1998/02/05 23:29:17 lightner Force 32-bit math in eph_getint() Only realloc() an extra 2048 bytes when buffer too small (DOS only) Revision 1.3 1998/01/27 21:52:23 crosser add NANOSLEEP Revision 1.2 1998/01/18 02:16:45 crosser DOS support Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include "eph_io.h" #include "eph_priv.h" #define TMPBUF_SIZE (2048) #define MAYRETRY(rc) ((rc == -2) || (rc == NAK)) int eph_writecmd(eph_iob *iob,char *data,size_t length) { return eph_writepkt(iob,PKT_CMD,SEQ_CMD,data,length); } int eph_writeicmd(eph_iob *iob,char *data,size_t length) { return eph_writepkt(iob,PKT_CMD,SEQ_INITCMD,data,length); } int eph_setispeed(eph_iob *iob,long val) { unsigned char buf[6]; int rc; int count=0; buf[0]=CMD_SETINT; buf[1]=REG_SPEED; buf[2]=(val)&0xff; buf[3]=(val>>8)&0xff; buf[4]=(val>>16)&0xff; buf[5]=(val>>24)&0xff; do { if ((rc=eph_writeicmd(iob,buf,6))) return rc; rc=eph_waitack(iob,ACKTIMEOUT); } while (rc && (count++ < RETRIES)); if (count >= RETRIES) eph_error(iob,ERR_EXCESSIVE_RETRY, "excessive retries on setispeed"); if (iob->debug) printf("setispeed(%ld) rc=%d\n",val,rc); return rc; } int eph_setint(eph_iob *iob,int reg,long val) { unsigned char buf[6]; int rc; int count=0; buf[0]=CMD_SETINT; buf[1]=reg; buf[2]=(val)&0xff; buf[3]=(val>>8)&0xff; buf[4]=(val>>16)&0xff; buf[5]=(val>>24)&0xff; writeagain: if ((rc=eph_writecmd(iob,buf,6))) return rc; rc=eph_waitack(iob,(reg == REG_FRAME)?BIGACKTIMEOUT:ACKTIMEOUT); if (MAYRETRY(rc) && (count++ < RETRIES)) goto writeagain; if (count >= RETRIES) eph_error(iob,ERR_EXCESSIVE_RETRY, "excessive retries on setint"); if (iob->debug) printf("setint(%d,%ld) rc=%d\n",reg,val,rc); return rc; } int eph_setnullint(eph_iob *iob,int reg) { unsigned char buf[2]; int rc; int count=0; buf[0]=CMD_SETINT; buf[1]=reg; writeagain: if ((rc=eph_writecmd(iob,buf,2))) return rc; rc=eph_waitack(iob,(reg == REG_FRAME)?BIGACKTIMEOUT:ACKTIMEOUT); if (MAYRETRY(rc) && (count++ < RETRIES)) goto writeagain; if (count >= RETRIES) eph_error(iob,ERR_EXCESSIVE_RETRY, "excessive retries on setnullint"); if (iob->debug) printf("setnullint(%d) rc=%d\n",reg,rc); return rc; } int eph_getint(eph_iob *iob,int reg,long *val) { unsigned char buf[4]; eph_pkthdr pkt; int rc; size_t size=4; int count=0; (*val)=0L; buf[0]=CMD_GETINT; buf[1]=reg; writeagain: if ((rc=eph_writecmd(iob,buf,2))) return rc; readagain: rc=eph_readpkt(iob,&pkt,buf,&size,BIGDATATIMEOUT); if (MAYRETRY(rc) && (count++ < RETRIES)) goto writeagain; if ((rc == 0) && (pkt.typ == PKT_LAST) && (pkt.seq == 0)) { (*val)=((unsigned long)buf[0]) | ((unsigned long)buf[1]<<8) | ((unsigned long)buf[2]<<16) | ((unsigned long)buf[3]<<24); eph_writeack(iob); rc=0; goto fin; } else if ((rc == -1) && (count++ < RETRIES)) { eph_writenak(iob); goto readagain; } if (count >= RETRIES) eph_error(iob,ERR_EXCESSIVE_RETRY, "excessive retries on getint"); fin: if (iob->debug) printf("getint(%d)=%ld, rc=%d\n",reg,*val,rc); return rc; } int eph_action(eph_iob *iob,int reg,char *val,size_t length) { unsigned char buf[2050]; int rc; int count=0; if (length > (sizeof(buf) - 2)) { eph_error(iob,ERR_DATA_TOO_LONG,"arg action length %ld", (long)length); return -1; } buf[0]=CMD_ACTION; buf[1]=reg; memcpy(buf+2,val,length); writeagain: if ((rc=eph_writecmd(iob,buf,length+2))) return rc; rc=eph_waitack(iob,ACKTIMEOUT); if (MAYRETRY(rc) && (count++ < RETRIES)) goto writeagain; if (rc == 0) rc=eph_waitcomplete(iob); if (count >= RETRIES) eph_error(iob,ERR_EXCESSIVE_RETRY, "excessive retries on action"); if (iob->debug) printf("action(%d,%p(0x%02x),%u) rc=%d\n", reg,val, (length==1)?(val[0]&0xff):0, (unsigned int)length,rc); return rc; } int eph_setvar(eph_iob *iob,int reg,char *val,off_t olength) { unsigned char buf[2048]; int rc=0,seq=-1; int count=0; int pkttyp,pktseq; size_t pktsize,maywrite; off_t written=0; off_t length=olength; unsigned char *getpoint,*putpoint; getpoint=val; while (length && !rc) { if (seq == -1) { pkttyp=PKT_CMD; pktseq=SEQ_CMD; buf[0]=CMD_SETVAR; buf[1]=reg; putpoint=buf+2; maywrite=sizeof(buf)-2; pktsize=2; } else { pkttyp=PKT_DATA; pktseq=seq; putpoint=buf; maywrite=sizeof(buf); pktsize=0; (iob->runcb)(written); } if ((size_t)length <= maywrite) { maywrite=length; if (pkttyp == PKT_DATA) pkttyp=PKT_LAST; } memcpy(putpoint,getpoint,maywrite); pktsize+=maywrite; length-=maywrite; getpoint+=maywrite; written+=maywrite; seq++; writeagain: if ((rc=eph_writepkt(iob,pkttyp,pktseq,buf,pktsize))) goto fin; rc=eph_waitack(iob,ACKTIMEOUT); if (MAYRETRY(rc) && (count++ < RETRIES)) goto writeagain; } if (count >= RETRIES) eph_error(iob,ERR_EXCESSIVE_RETRY, "excessive retries on setvar"); fin: if (iob->debug) printf("setvar(%d,\"%.60s\",%lu) rc=%d\n", reg,val,(unsigned long)olength,rc); return rc; } int eph_getvar(eph_iob *iob,int reg,char **buffer,off_t *bufsize) { unsigned char buf[2]; eph_pkthdr pkt; int rc; int count=0; unsigned char expect=0; off_t index; size_t readsize; char *ptr; char *tmpbuf=NULL; size_t tmpbufsize=0; if ((buffer == NULL) && (iob->storecb == NULL)) { eph_error(iob,ERR_BADARGS, "NULL buffer and no store callback for getvar"); return -1; } if (buffer == NULL) { tmpbuf=(iob->realloccb)(NULL,(size_t)TMPBUF_SIZE); tmpbufsize=TMPBUF_SIZE; if (tmpbuf == NULL) { eph_error(iob,ERR_NOMEM, "could not alloc %lu for tmpbuf in getvar", (long)TMPBUF_SIZE); return -1; } } buf[0]=CMD_GETVAR; buf[1]=reg; writeagain: if ((rc=eph_writecmd(iob,buf,2))) return rc; index=0; readagain: if (buffer) { /* read to memory reallocating it */ if (((*bufsize) - index) < 2048) { if (iob->debug) printf("reallocing %lu",(unsigned long)(*bufsize)); #ifdef LOWMEMORY /* small memory! round up to next 2048 boundary */ (*bufsize)=(((index + 2048)-1)/2048L+1)*2048L; #else /* multiply current size by 2 and round up to 2048 boundary */ (*bufsize)=((((*bufsize)*2)-1)/2048+1)*2048; #endif if (iob->debug) printf(" -> %lu\n",(unsigned long)(*bufsize)); (*buffer)=(iob->realloccb)(*buffer,(size_t)*bufsize); if ((*buffer) == NULL) { eph_error(iob,ERR_NOMEM, "could not realloc %lu for getvar", (long)*bufsize); return -1; } } ptr=(*buffer)+index; readsize=(*bufsize)-index; } else { /* pass data to store callback */ ptr=tmpbuf; readsize=tmpbufsize; } rc=eph_readpkt(iob,&pkt,ptr,&readsize, (expect || ((reg != REG_IMG) || (reg != REG_TMN)))? DATATIMEOUT:BIGDATATIMEOUT); if (MAYRETRY(rc) && (expect == 0) && (count++ < RETRIES)) { eph_writenak(iob); if (rc == -2) goto readagain; else goto writeagain; } if ((rc == 0) && ((pkt.seq == expect) || (pkt.seq == (expect-1)))) { count=0; if (pkt.seq == expect) { index+=readsize; expect++; (iob->runcb)(index); if (buffer == NULL) { if (iob->debug) printf("storing %lu at %08lx\n", (unsigned long)readsize, (unsigned long)ptr); if ((iob->storecb)(ptr,readsize)) return -1; } } eph_writeack(iob); if (pkt.typ == PKT_LAST) { if (buffer) (*bufsize)=index; if (tmpbuf) free(tmpbuf); return 0; } else goto readagain; } if ((rc <= 0) && (count++ < RETRIES)) { eph_writenak(iob); goto readagain; } if (tmpbuf) free(tmpbuf); if (count >= RETRIES) eph_error(iob,ERR_EXCESSIVE_RETRY, "excessive retries on getvar"); if (iob->debug) printf("getvar(%d) got %lu, rc=%d\n", reg,(unsigned long)(*bufsize),rc); return rc; } photopc-3.05/eph_io.c 644 2627 62 27333 7133532273 7641 #ifndef LINT static char *rcsid="$Id: eph_io.c,v 2.19 2000/07/14 06:35:39 crosser Exp $"; #endif /* Copyright (c) 1997-1999 Eugene G. Crosser Copyright (c) 1998,1999 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: eph_io.c,v $ Revision 2.19 2000/07/14 06:35:39 crosser reportedly some models return CAN instead of DC1 Revision 2.18 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 2.17 2000/02/17 21:29:54 crosser final cleanup for 3.04, change version change debugging levels Revision 2.16 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 2.15 1999/07/28 19:29:18 crosser resort includes Revision 2.14 1999/04/22 04:14:54 crosser avoid GCC-isms Revision 2.13 1999/03/27 23:54:37 crosser backed out adding WRTDELAY: already done in eph_priv.h Revision 2.12 1999/03/22 05:59:31 lightner Add WRTDELAY to SMART CHUNKED WRITE's WRITE() Revision 2.11 1999/03/06 13:37:08 crosser Convert to autoconf-style Revision 2.10 1999/02/10 22:09:36 crosser strerror needs string.h with glibc2 Revision 2.9 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.8 1998/08/08 14:00:33 crosser fix typo Revision 2.7 1998/08/01 13:16:18 crosser move delays where they belong. Revision 2.6 1998/08/01 13:12:41 lightner change Windows logic and timeouts Revision 2.5 1998/08/01 12:30:50 crosser flushinput function Revision 2.4 1998/01/27 21:52:55 crosser add multi-block write Revision 2.3 1998/01/18 02:16:45 crosser DOS support Revision 2.2 1998/01/05 19:48:46 lightner Win32 syntax error fixed: i->length Revision 2.1 1998/01/03 19:57:13 crosser Fix Windows things, improve error reporting Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 Revision 1.3 1997/12/24 00:19:13 crosser Change default speed to 115200 Revision 1.2 1997/09/12 09:42:35 crosser skip possible NULs prior to `camera signature' Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #ifdef UNIX #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef HAVE_UNISTD_H #include #endif #endif #include #include #include #ifndef UNIX #include "usleep.h" #endif #include "eph_io.h" #include "eph_priv.h" #ifdef INT16 typedef unsigned INT16 uint16; #endif #ifdef MSWINDOWS #define ERRNO GetLastError() #else #define ERRNO errno #endif #ifdef HAVE_NANOSLEEP void shortsleep(long useconds) { struct timespec ts; ts.tv_sec=(long int)(useconds/1000000); ts.tv_nsec=(long int)(useconds%1000000)*1000ul; nanosleep(&ts,NULL); } #else /* HAVE_NANOSLEEP */ #define shortsleep(x) usleep(x) #endif /* HAVE_NANOSLEEP */ #if !defined(BYTE_BY_BYTE_WRITE) && !defined(SINGLE_BURST_WRITE) static struct _chunk { size_t offset; size_t size; long delay; } chunk[] = { { 0L, 1L, WRTPKTDELAY }, { 1L, 3L, WRTCMDDELAY }, { 4L, 0L, WRTPRMDELAY } }; #define MAXCHUNK 3 #endif /* System-specific WRITE implementation */ #if defined(DOS) #include "comio.h" #define WRITE(x,y,z) (dos_write(x,y,z) != z) int dos_write(int fd, void *buf, int length) { int i; unsigned char *p = buf; ttflui(); /* flush input buffer */ for (i = 0; i < length; ++i) { ttoc(*p++); } return length; } #elif defined(MSWINDOWS) #define WRITE(x,y,z) win_write(x,y,z) int win_write(HANDLE fd,void *buf,DWORD length) { DWORD nwrit; if (!WriteFile(fd,buf,length,&nwrit,NULL) || (nwrit != length)) return 1; else return 0; } #elif defined(UNIX) #define WRITE(x,y,z) (write(x,y,z) != z) #else # error "platform not defined" #endif int eph_writepkt(eph_iob *iob,int typ,int seq,char *data,size_t length) { uint16 crc=0; unsigned char buf[2054]; int i=0,j; if (length > (sizeof(buf)-6)) { eph_error(iob,ERR_DATA_TOO_LONG, "trying to write %ld in one pkt",(long)length); return -1; } buf[i++]=typ; buf[i++]=seq; buf[i++]=length&0xff; buf[i++]=length>>8; for (j=0;j<(int)length;j++) { crc+=(unsigned char)data[j]; buf[i++]=data[j]; } buf[i++]=crc&0xff; buf[i++]=crc>>8; if (iob->debug > 1) { printf("> (%d)",i); for (j=0;jfd,buf,(size_t)i)) { eph_error(iob,ERRNO,"pkt write error %s",strerror(ERRNO)); return -1; } #elif defined(BYTE_BY_BYTE_WRITE) /* It looks like the camera hates if data is sent at 115200 in one chunk. Thierry Bousch recommended to send data byte-by-byte with small delays. This really helps. */ shortsleep(WRTPKTDELAY); for (j=0;jfd,buf+j,1)) { eph_error(iob,ERRNO,"pkt write error %s",strerror(ERRNO)); return -1; } /* tcdrain()s do not seem to be necessary, at least on Linux... if (tcdrain(iob->fd)) { eph_error(iob,ERRNO,"pkt tcdrain error %s",strerror(ERRNO)); return -1; } */ } #else /* SMART CHUNKED WRITE */ for (j=0;jfd,buf+chunk[j].offset,(size_t)sz)) { eph_error(iob,ERRNO,"pkt write chunk %d(%d) error %s", j,(int)sz,strerror(ERRNO)); return -1; } } #endif return 0; } void eph_writeinit(eph_iob *iob) { unsigned char init=0; if (iob->debug > 1) printf("> INIT 00\n"); shortsleep(WRTDELAY); if (WRITE(iob->fd,&init,1)) { eph_error(iob,ERRNO,"init write error %s",strerror(ERRNO)); } } void eph_writeack(eph_iob *iob) { unsigned char ack=ACK; if (iob->debug > 1) printf("> ACK 06\n"); shortsleep(WRTDELAY); if (WRITE(iob->fd,&ack,1)) { eph_error(iob,ERRNO,"ack write errot %s",strerror(ERRNO)); } } void eph_writenak(eph_iob *iob) { unsigned char nak=NAK; if (iob->debug > 1) printf("> NAK 11\n"); shortsleep(WRTDELAY); if (WRITE(iob->fd,&nak,1)) { eph_error(iob,ERRNO,"nak write error %s",strerror(ERRNO)); } } int eph_readpkt(eph_iob *iob,eph_pkthdr *pkthdr,char *buffer, size_t *bufsize,long timeout_usec) { uint16 length,got; uint16 crc1=0,crc2; unsigned char buf[4]; int i,rc; i=eph_readt(iob,buf,1,timeout_usec,&rc); if (iob->debug > 1) printf ("pktstart: i=%d rc=%d char=0x%02x\n",i,rc,*buf); if (i < 0) { eph_error(iob,ERRNO,"pkt start read error %s",strerror(ERRNO)); return -1; } else if ((i == 0) && (rc == 0)) { eph_error(iob,ERR_TIMEOUT,"pkt start read timeout (%ld)", timeout_usec); return -2; } else if (i != 1) { eph_error(iob,ERR_BADREAD,"pkt start read %d, expected 1",i); return -1; } pkthdr->typ=buf[0]; if ((*buf != PKT_DATA) && (*buf != PKT_LAST)) { if ((*buf != NAK) && (*buf != DC1)) eph_error(iob,ERR_BADDATA,"pkt start got 0x%02x",*buf); return *buf; } got=0; while ((i=eph_readt(iob,buf+1+got,(unsigned)3-got,DATATIMEOUT,&rc)) > 0) { got+=i; } if (got != 3) { if (i < 0) { eph_error(iob,ERRNO,"pkt hdr read error %s (got %d)", strerror(ERRNO),got); return -1; } else if ((i == 0) && (rc == 0)) { eph_error(iob,ERR_TIMEOUT,"pkt hdr read timeout (%ld)", DATATIMEOUT); return -2; } else { eph_error(iob,ERR_BADREAD,"pkt hdr read return %d rc %d", i,rc); return -1; } } if (iob->debug > 1) printf("header: %02x %02x %02x %02x\n", buf[0],buf[1],buf[2],buf[3]); pkthdr->seq=buf[1]; length=(buf[3]<<8)|buf[2]; if (length > *bufsize) { eph_error(iob,ERR_DATA_TOO_LONG, "length in pkt header %lu bigger than buffer size %lu", (unsigned long)length,(unsigned long)*bufsize); return -1; } got=0; while ((i=eph_readt(iob,buffer+got,(unsigned)length-got,iob->timeout,&rc)) > 0) { got+=i; } if (got != length) { if (i < 0) { eph_error(iob,ERRNO,"pkt data read error %s",strerror(ERRNO)); return -1; } else if ((i == 0) && (rc == 0)) { eph_error(iob,ERR_TIMEOUT,"pkt data read timeout (%ld)", iob->timeout); return -2; } else { eph_error(iob,ERR_BADREAD, "pkt read return %d, rc %d",i,rc); return -1; } } for (i=0;i 0) { got+=i; } if (iob->debug > 1) printf ("crc: %02x %02x i=%d rc=%d\n",buf[0],buf[1],i,rc); if (got != 2) { if (i < 0) { eph_error(iob,ERRNO,"pkt crc read error %s",strerror(ERRNO)); return -1; } else if ((i == 0) && (rc == 0)) { eph_error(iob,ERR_TIMEOUT,"pkt crc read timeout (%ld)", DATATIMEOUT); return -2; } else { eph_error(iob,ERR_BADREAD,"pkt crc read return %d rc %d", i,rc); return -1; } } crc2=(buf[1]<<8)|buf[0]; if (crc1 != crc2) { if (iob->debug) printf("crc %04x != %04x\n",crc1,crc2); eph_error(iob,ERR_BADCRC, "crc received=0x%04x counted=0x%04x",crc2,crc1); return -1; } if (iob->debug > 1) { int j; printf("< %d,%d (%d)",pkthdr->typ,pkthdr->seq,length); if (iob->debug > 2) for (j=0;jtyp,pkthdr->seq,length); if (iob->debug > 2) for (j=0;j= ' ' && buffer[j] < 127) ? buffer[j] : '.'); } else printf(" ..."); printf("\n"); } (*bufsize)=length; return 0; } int eph_flushinput(eph_iob *iob) { unsigned char buf; int i,rc; i=eph_readt(iob,&buf,1,0L,&rc); if (iob->debug > 1) printf ("< %02x amount=%d rc=%d\n",buf,i,rc); if (i < 0) { eph_error(iob,ERRNO,"flushinput read error %s",strerror(ERRNO)); return -1; } else if ((i == 0) && (rc == 0)) { if (iob->debug) printf ("flushed: read %d amount=%d rc=%d\n",buf,i,rc); return 0; } else { eph_error(iob,ERR_BADREAD,"flushinput read %d expected 0",i); return -1; } } int eph_waitchar(eph_iob *iob,long timeout_usec) { unsigned char buf; int i,rc; i=eph_readt(iob,&buf,1,timeout_usec,&rc); if (iob->debug > 1) printf ("< %02x amount=%d rc=%d\n",buf,i,rc); if (i < 0) { eph_error(iob,ERRNO,"waitchar read error %s",strerror(ERRNO)); return -1; } else if ((i == 0) && (rc == 0)) { eph_error(iob,ERR_TIMEOUT,"waitchar read timeout (%ld)", timeout_usec); return -2; } else if (i != 1) { eph_error(iob,ERR_BADREAD,"waitchar read %d expected 1",i); return -1; } return buf; } int eph_waitack(eph_iob *iob,long timeout_usec) { int rc; if ((rc=eph_waitchar(iob,timeout_usec)) == ACK) return 0; if ((rc != DC1) && (rc != NAK) && (rc != CAN)) eph_error(iob,ERR_BADREAD,"eph_waitack got %d",rc); return rc; } int eph_waitcomplete(eph_iob *iob) { int rc; if ((rc=eph_waitchar(iob,CMDTIMEOUT)) == 0x05) return 0; if ((rc != DC1) && (rc != NAK)) eph_error(iob,ERR_BADREAD,"eph_waitcomplete got %d",rc); return rc; } int eph_waitsig(eph_iob *iob) { int rc,count=SKIPNULS; while (((rc=eph_waitchar(iob,INITTIMEOUT)) == 0) && (count-- > 0)) ; if (rc == 0x15) return 0; eph_error(iob,ERR_BADREAD,"eph_waitsig got %d",rc); return rc; } int eph_waiteot(eph_iob *iob) { int rc; if ((rc=eph_waitchar(iob,EODTIMEOUT)) == 0xff) return 0; if ((rc != DC1) && (rc != NAK)) eph_error(iob,ERR_BADREAD,"eph_waiteot got %d",rc); return rc; } photopc-3.05/eph_open.c 644 2627 62 32212 7145614164 10166 #ifndef LINT static char *rcsid="$Id: eph_open.c,v 2.25 2000/08/13 21:51:48 crosser Exp $"; #endif /* Copyright (c) 1997-2000 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: eph_open.c,v $ Revision 2.25 2000/08/13 21:51:48 crosser More changes incorporated from John Bowman's version Revision 2.24 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 2.23 2000/05/02 22:26:35 crosser A few things incorporated from John Bowman's Nikon specific diffs Revision 2.22 2000/05/02 12:13:32 crosser some better debugging output alarm() based timeouted read (build with "--without-select") Revision 2.21 1999/12/13 23:26:52 crosser Fix minor bugs in sgtty support, reported to work now. Revision 2.20 1999/12/11 14:10:15 crosser Support sgtty terminal control Proper "fake speed" handling (needed two values) Revision 2.19 1999/12/01 21:41:23 crosser add "pseudo" speed Revision 2.18 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 2.17 1999/03/06 13:37:08 crosser Convert to autoconf-style Revision 2.16 1999/02/10 22:09:36 crosser strerror needs string.h with glibc2 Revision 2.15 1998/12/20 21:49:38 crosser move flushinput to more proper place Revision 2.14 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.13 1998/08/08 14:00:33 crosser make switchoff friendly to Olympus Revision 2.12 1998/08/01 13:12:41 lightner Four ports for DOS Revision 2.11 1998/08/01 12:30:50 crosser flushinput function Revision 2.10 1998/05/09 18:21:08 crosser change O_NONBLOCK to O_NDELAY (is it correct? I don't know. On most systems they are the same, but what if they are not? Tell me if you have problems.) Revision 2.9 1998/04/09 07:38:44 crosser fix semantics of the "switch off" arg Revision 2.8 1998/02/26 00:50:39 crosser change c_breake code for compatibility Revision 2.7 1998/02/25 22:47:24 crosser fix saving termios data Revision 2.6 1998/02/16 06:15:05 lightner Call _cexit() in ^C handler Revision 2.5 1998/01/27 21:52:55 crosser clean up error message, remove unneeded speep Revision 2.4 1998/01/18 02:16:45 crosser DOS support Revision 2.3 1998/01/05 19:47:49 lightner Win32 syntax error fixed: text->commtext Revision 2.2 1998/01/04 13:55:57 crosser add param for close mode Revision 2.1 1998/01/03 19:57:13 crosser Fix Windows things, improve error reporting Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 Revision 1.4 1997/12/24 00:19:13 crosser Change default speed to 115200 Revision 1.3 1997/11/03 23:25:11 crosser add immediate session finish command Revision 1.2 1997/09/12 09:42:35 crosser skip possible NULs prior to `camera signature' Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #if defined(MSWINDOWS) #include "usleep.h" #elif defined(UNIX) #ifdef HAVE_UNISTD_H #include #endif #include #elif defined(DOS) #include "comio.h" #include "usleep.h" #else # error platform not defined #endif #include #ifdef STDC_HEADERS #include #include #endif #ifdef HAVE_FCNTL_H #include #endif #include #include "eph_io.h" #include "eph_priv.h" #ifdef MSWINDOWS #define ERRNO GetLastError() #else #define ERRNO errno #endif #define DEFSPEED 19200 #if defined(MSWINDOWS) #define CLOSE CloseHandle #elif defined(UNIX) #define CLOSE close #elif defined(DOS) #define CLOSE(x) ttclose() void exit_cleanup(void) { ttclose(); } #define ABORT 0 int c_break(void) { printf("\naborting program...%c\n", 7); ttclose(); exit(255); /* will call any exit handlers */ /* notreached */ } #else # error platform not defined #endif #ifdef UNIX speed_t speed2flag(long ttspeed) { speed_t tspeed; switch (ttspeed) { case 50: tspeed=B50; break; case 75: tspeed=B75; break; case 150: tspeed=B150; break; case 300: tspeed=B300; break; case 600: tspeed=B600; break; case 1200: tspeed=B1200; break; case 2400: tspeed=B2400; break; case 4800: tspeed=B4800; break; case 9600: tspeed=B9600; break; case 19200: #ifdef B19200 tspeed=B19200; #else tspeed=EXTA; #endif break; case 38400: #ifdef B38400 tspeed=B38400; #else tspeed=EXTB; #endif break; case 57600: #ifdef B57600 tspeed=B57600; #else tspeed=(speed_t)-1; #endif break; case 115200: #ifdef B115200 tspeed=B115200; #else tspeed=(speed_t)-1; #endif break; default: tspeed=(speed_t)-1; break; } return tspeed; } #endif /* UNIX */ int eph_open(eph_iob *iob,char *devname,long speed,long defttspeed,long ttspeed) { #if defined(MSWINDOWS) DCB dcb = { 0 }; char commtext[80]; #elif defined(UNIX) #if defined(USE_TERMIOS) struct termios tios; #elif defined(USE_SGTTY) struct sgttyb sgtty; #elif defined(USE_TERMIO) struct termio tio; #endif speed_t tspeed; /* representation of speed sutable for termios */ speed_t deftspeed; #elif defined(DOS) int port; #else # error platform not defined #endif long ephspeed; /* representation of speed sutable for camera command */ int rc; int count=0; /* speed is real, tell it to the camera. ttspeed is what you have to tell to the serial driver to make it set real speed */ if (speed == 0) speed=MAX_SPEED; if (ttspeed == 0) ttspeed=speed; if (defttspeed == 0) defttspeed=DEFSPEED; switch (speed) { case 9600: ephspeed=1; break; case 19200: ephspeed=2; break; case 38400: ephspeed=3; break; case 57600: ephspeed=4; break; case 115200: ephspeed=5; break; default: eph_error(iob,ERR_BADSPEED,"specified speed %ld invalid",speed); return -1; } #if defined(UNIX) if ((tspeed=speed2flag(ttspeed)) == (speed_t)-1) { eph_error(iob,ERR_BADSPEED,"specified speed %ld unsupported", ttspeed); return -1; } if ((deftspeed=speed2flag(defttspeed)) == (speed_t)-1) { eph_error(iob,ERR_BADSPEED,"specified speed %ld unsupported", defttspeed); return -1; } #endif /* UNIX */ iob->timeout=DATATIMEOUT+((2048000000L)/speed)*10; if (iob->debug) printf("set timeout to %lu\n",DATATIMEOUT+iob->timeout); #if defined(DOS) if (strcasecmp(devname,"COM1:") == 0) { port = 1; } else if (strcasecmp(devname,"COM2:") == 0) { port = 2; } else if (strcasecmp(devname,"COM3:") == 0) { port = 3; } else if (strcasecmp(devname,"COM4:") == 0) { port = 4; } else { eph_error(iob,ERRNO,"device name %s not COM1:, COM2:, COM3: or COM4:", devname); return -1; } ctrlbrk(c_break); atexit(exit_cleanup); usleep(1); if (iob->debug) printf("delay factor: %g loops/usec\n",(float)delay_factor); TTinit(port, DEFSPEED); if (ttopen()) { errno=2; #elif defined(MSWINDOWS) if ((iob->fd=CreateFile(devname, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) { #elif defined(UNIX) if ((iob->fd=open(devname,O_RDWR | O_NDELAY)) < 0) { #else # error platform not defined #endif if (strlen(devname) < 400) /* we have 512 byte buffer there */ eph_error(iob,ERRNO,"open %s error %s", devname,strerror(ERRNO)); return -1; } #if defined(MSWINDOWS) if (!GetCommState(iob->fd, &dcb)) { eph_error(iob,ERRNO,"GetCommState error %s",strerror(ERRNO)); CLOSE(iob->fd); return -1; } memcpy(&iob->savedcb,&dcb,sizeof(dcb)); memset((char*)&dcb,0,sizeof(dcb)); dcb.DCBlength = sizeof(dcb); sprintf(commtext, "%d,n,8,1", DEFSPEED); if (!BuildCommDCB(commtext, &dcb)) { eph_error(iob,ERRNO,"BuildCommDCB error %s",strerror(ERRNO)); CLOSE(iob->fd); return -1; } if (!SetCommState(iob->fd, &dcb)) { eph_error(iob,ERRNO,"SetCommState error %s",strerror(ERRNO)); CLOSE(iob->fd); return -1; } if (!GetCommTimeouts(iob->fd, &iob->savetimeouts)) { eph_error(iob,ERRNO,"GetCommTimeouts error %s",strerror(ERRNO)); CLOSE(iob->fd); return -1; } iob->worktimeouts.ReadIntervalTimeout=0; iob->worktimeouts.ReadTotalTimeoutMultiplier=1; iob->worktimeouts.ReadTotalTimeoutConstant=1000; iob->worktimeouts.WriteTotalTimeoutMultiplier=0; iob->worktimeouts.WriteTotalTimeoutConstant=0; if (!SetCommTimeouts(iob->fd, &iob->worktimeouts)) { eph_error(iob,ERRNO,"SetCommTimeouts initial attr error %s", strerror(ERRNO)); CLOSE(iob->fd); return -1; } #elif defined(UNIX) #if defined(USE_TERMIOS) if (tcgetattr(iob->fd,&tios) < 0) { eph_error(iob,ERRNO,"tcgetattr error %s",strerror(ERRNO)); close(iob->fd); return -1; } memcpy(&iob->savetios,&tios,sizeof(tios)); #ifdef HAVE_CFMAKERAW cfmakeraw(&tios); #else tios.c_iflag=0; tios.c_oflag=0; tios.c_lflag=0; #endif cfsetospeed(&tios,deftspeed); cfsetispeed(&tios,deftspeed); #ifdef USE_VMIN_AND_VTIME tios.c_cc[VMIN]=127; tios.c_cc[VTIME]=1; #else tios.c_cc[VMIN]=1; tios.c_cc[VTIME]=0; #endif tios.c_cflag|=(CS8|CLOCAL|CREAD); tios.c_cflag&=~(PARENB|PARODD #ifdef TRY_FLOW_CONTROL # ifdef CRTSXOFF |CRTSXOFF # endif # ifdef CRTSCTS |CRTSCTS # endif # ifdef CRTSFL |CRTSFL # endif #endif ); tios.c_iflag&=~INPCK; tios.c_iflag|=IGNBRK; if (tcsetattr(iob->fd,TCSANOW,&tios)) { eph_error(iob,ERRNO,"tcsetattr initial attr error %s", strerror(ERRNO)); close(iob->fd); return -1; } #elif defined(USE_SGTTY) if (ioctl(iob->fd, TIOCGETP, &sgtty) < 0) { eph_error(iob,ERRNO,"ioctl/TIOCGETP error %s",strerror(ERRNO)); close(iob->fd); return -1; } memcpy(&iob->savesgtty,&sgtty,sizeof(sgtty)); sgtty.sg_ispeed = deftspeed; sgtty.sg_ospeed = deftspeed; sgtty.sg_erase = 0; sgtty.sg_kill = 0; sgtty.sg_flags = RAW; if (ioctl(iob->fd, TIOCSETN, &sgtty) < 0) { eph_error(iob,ERRNO,"ioctl/TIOCSETN initial attr error %s", strerror(ERRNO)); close(iob->fd); return -1; } #elif defined(USE_TERMIO) # error "termio not supported" #endif /* terminal control selection */ #ifdef USE_ALARMED_READ if (((iob->flag)=fcntl(iob->fd,F_GETFL,0L)) == -1) { eph_error(iob,ERRNO,"fcntl(GETFL) failed: %s", strerror(ERRNO)); close(iob->fd); return -1; } iob->flag&=~O_NDELAY; if (fcntl(iob->fd,F_SETFL,iob->flag) == -1) { eph_error(iob,ERRNO,"fcntl(reset O_NDELAY) failed: %s", strerror(ERRNO)); close(iob->fd); return -1; } #endif #endif /* MSWINDOWS/UNIX; do nothing for DOS */ do { if (eph_flushinput(iob)) { eph_error(iob,ERRNO,"error flushing input: %s", strerror(ERRNO)); CLOSE(iob->fd); return -1; } eph_writeinit(iob); rc=eph_waitsig(iob); if (rc) usleep(500000L); } while (rc && (count++ < RETRIES)); if (rc) { CLOSE(iob->fd); return -1; } if (eph_setispeed(iob,ephspeed)) { eph_error(iob,ERRNO,"could not switch camera speed %d: %s", ephspeed,strerror(ERRNO)); CLOSE(iob->fd); return -1; } #if defined(MSWINDOWS) dcb.BaudRate = ttspeed; if (!SetCommState(iob->fd, &dcb)) { eph_error(iob,ERRNO,"SetCommState working attr error %s", strerror(ERRNO)); CLOSE(iob->fd); return -1; } #elif defined(UNIX) #if defined(USE_TERMIOS) cfsetospeed(&tios,tspeed); cfsetispeed(&tios,tspeed); if (tcsetattr(iob->fd,TCSANOW,&tios)) { eph_error(iob,ERRNO,"tcsetattr working attr error %s", strerror(ERRNO)); close(iob->fd); return -1; } #elif defined(USE_SGTTY) sgtty.sg_ispeed = tspeed; sgtty.sg_ospeed = tspeed; if (ioctl(iob->fd, TIOCSETN, &sgtty)) { eph_error(iob,ERRNO,"ioctl/TIOCSETN cound not reset attr: %s", strerror(ERRNO)); close(iob->fd); return -1; } #elif defined(USE_TERMIO) # error "termio not supported" #endif #elif defined(DOS) ttclose(); TTinit(port, ttspeed); if (ttopen()) { errno = 0; eph_error(iob,ERRNO,"dobaud set working attr error %s", strerror(ERRNO)); CLOSE(iob->fd); return -1; } #else # error platform not defined #endif usleep(SPEEDCHGDELAY); return 0; } int eph_close(eph_iob *iob,int switchoff) { if (switchoff) { char zero=0; eph_action(iob,4,&zero,1); /* Oly 600 does not send EOT if switched off by command eph_waiteot(iob); */ } else { eph_setispeed(iob,0L); } #if defined(MSWINDOWS) if (!SetCommState(iob->fd, &iob->savedcb)) eph_error(iob,ERRNO,"SetCommState reset attr error %s", strerror(ERRNO)); if (!SetCommTimeouts(iob->fd, &iob->savetimeouts)) eph_error(iob,ERRNO,"SetCommTimeouts reset attr error %s", strerror(ERRNO)); #elif defined(UNIX) #if defined(USE_TERMIOS) if (tcsetattr(iob->fd,TCSANOW,&iob->savetios)) eph_error(iob,ERRNO,"tcsetattr cound not reset attr: %s", strerror(ERRNO)); #elif defined(USE_SGTTY) if (ioctl(iob->fd, TIOCSETN, &iob->savesgtty)) eph_error(iob,ERRNO,"tcsetattr cound not reset attr: %s", strerror(ERRNO)); #elif defined(USE_TERMIO) # error "termio not supported" #endif #endif /* MSWINDOWS/UNIX; do nothing for DOS */ return CLOSE(iob->fd); } photopc-3.05/eph_io.h 644 2627 62 7535 7106010266 7621 /* $Id: eph_io.h,v 2.12 2000/05/09 13:20:54 crosser Exp $ */ /* Copyright (c) 1997-2000 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: eph_io.h,v $ Revision 2.12 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 2.11 2000/05/02 22:26:35 crosser A few things incorporated from John Bowman's Nikon specific diffs Revision 2.10 2000/02/13 11:15:01 crosser Kludge null setint for Nikon Revision 2.9 1999/12/11 14:10:15 crosser Support sgtty terminal control Proper "fake speed" handling (needed two values) Revision 2.8 1999/12/01 21:41:23 crosser add "pseudo" speed Revision 2.7 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.6 1998/02/26 00:50:39 crosser misc changes Revision 2.5 1998/02/13 23:02:40 crosser define type off_t for DOS Revision 2.4 1998/02/08 19:58:38 crosser Support low memory: chunked saving etc. Revision 2.3 1998/02/03 18:47:51 lightner Fix typo: definded -> defined Revision 2.2 1998/01/18 02:16:45 crosser DOS support Revision 2.1 1998/01/04 13:55:57 crosser add param for close mode Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifndef _EPH_IO_H #define _EPH_IO_H #include #ifdef DOS typedef long off_t; #endif #if defined(UNIX) #if defined(USE_TERMIOS) # include #elif defined(USE_SGTTY) # include #elif defined(USE_TERMIO) #include # error "termio unsupported, sorry" #else # error "no termios, sgtty or termio defined, no way to control the tty" #endif #elif defined(MSWINDOWS) #include #endif #include #ifndef DC1 #define DC1 0x11 #endif #define MAX_SPEED 115200 typedef struct _eph_iob { void (*errorcb)(int errcode,char *errstr); void *(*realloccb)(void *old,size_t length); void (*runcb)(off_t count); int (*storecb)(char *data,size_t size); int debug; #if defined(UNIX) int fd; #ifdef USE_ALARMED_READ long flag; #endif #if defined(USE_TERMIOS) struct termios savetios; #elif defined(USE_SGTTY) struct sgttyb savesgtty; #elif defined(USE_TERMIO) struct termio savetio; #endif #elif defined(MSWINDOWS) HANDLE fd; DCB savedcb; COMMTIMEOUTS savetimeouts,worktimeouts; #elif defined(DOS) int fd; #endif long timeout; } eph_iob; eph_iob *eph_new(void (*errorcb)(int errcode,char *errstr), void *(*realloccb)(void *old,size_t length), void (*runcb)(off_t count), int (*storecb)(char *data,size_t size), int debug); int eph_open(eph_iob *iob,char *device_name,long speed, long defttspeed,long ttspeed); int eph_close(eph_iob *iob,int newmodel); void eph_free(eph_iob *iob); int eph_setint(eph_iob *iob,int reg,long val); int eph_setnullint(eph_iob *iob,int reg); int eph_getint(eph_iob *iob,int reg,long *val); int eph_action(eph_iob *iob,int reg,char *val,size_t length); int eph_setvar(eph_iob *iob,int reg,char *val,off_t length); int eph_getvar(eph_iob *iob,int reg,char **val,off_t *length); #define ERR_BASE 10001 #define ERR_DATA_TOO_LONG 10001 #define ERR_TIMEOUT 10002 #define ERR_BADREAD 10003 #define ERR_BADDATA 10004 #define ERR_BADCRC 10005 #define ERR_BADSPEED 10006 #define ERR_NOMEM 10007 #define ERR_BADARGS 10008 #define ERR_EXCESSIVE_RETRY 10009 #define ERR_MAX 10010 #define REG_FRAME 4 #define REG_SPEED 17 #define REG_IMG 14 #define REG_TMN 15 #endif photopc-3.05/eph_priv.h 644 2627 62 7507 7133532273 10200 /* $Id: eph_priv.h,v 2.9 2000/07/14 06:35:39 crosser Exp $ */ /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: eph_priv.h,v $ Revision 2.9 2000/07/14 06:35:39 crosser reportedly some models return CAN instead of DC1 Revision 2.8 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 2.7 1999/01/17 09:50:55 crosser increase WRT*DELAYs Revision 2.6 1998/12/06 08:40:34 crosser chnage iniitimeout for Nikon Revision 2.5 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.4 1998/08/28 22:01:48 crosser increase INITTIMEOUT to suite Nikon CP900 Revision 2.3 1998/08/01 12:30:50 crosser flushinput function Revision 2.2 1998/01/27 21:52:55 crosser delays for smart multi-chunk writes Revision 2.1 1998/01/18 02:16:45 crosser DOS support Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 Revision 1.3 1997/11/03 23:25:11 crosser add immediate session finish command Revision 1.2 1997/09/12 09:42:35 crosser skip possible NULs prior to `camera signature' Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifndef _EPH_PRIV_H #define _EPH_PRIV_H #include #define RETRIES 3 #ifdef USE_VMIN_AND_VTIME #define INITTIMEOUT 1700000L #define DATATIMEOUT 1100000L #define BIGDATATIMEOUT 1500000L #define ACKTIMEOUT 1100000L #define BIGACKTIMEOUT 1100000L #define EODTIMEOUT 1100000L #define CMDTIMEOUT 15000000L #else #define INITTIMEOUT 3000000L #define DATATIMEOUT 200000L #define BIGDATATIMEOUT 1500000L #define ACKTIMEOUT 400000L #define BIGACKTIMEOUT 800000L #define EODTIMEOUT 400000L #define CMDTIMEOUT 15000000L #endif /* Bruce and others say that adding 1ms delay before all writes is good. I think that they should rather be fine-tuned. */ #if 1 #define WRTPKTDELAY 1250L #define WRTCMDDELAY 1250L #define WRTPRMDELAY 1500L #define WRTDELAY 2000L #else #define WRTPKTDELAY 250L #define WRTCMDDELAY 250L #define WRTPRMDELAY 500L #define WRTDELAY 1000L #endif #define SPEEDCHGDELAY 100000L #define SKIPNULS 200 #define ACK 0x06 #define DC1 0x11 #define NAK 0x15 /*#define NAK 0x11*/ #define CAN 0x18 #define CMD_SETINT 0 #define CMD_GETINT 1 #define CMD_ACTION 2 #define CMD_SETVAR 3 #define CMD_GETVAR 4 #define PKT_CMD 0x1b #define PKT_DATA 0x02 #define PKT_LAST 0x03 #define SEQ_INITCMD 0x53 #define SEQ_CMD 0x43 #ifndef O_NDELAY #define O_NDELAY O_NONBLOCK #endif typedef struct _eph_pkthdr { unsigned char typ; unsigned char seq; } eph_pkthdr; size_t eph_readt(eph_iob *iob,char *buf,size_t length,long timeout_usec,int *rc); void eph_error(eph_iob *iob,int err,char *fmt,...); int eph_flushinput(eph_iob *iob); void eph_writeinit(eph_iob *iob); void eph_writeack(eph_iob *iob); void eph_writenak(eph_iob *iob); int eph_waitack(eph_iob *iob,long timeout_usec); int eph_waitcomplete(eph_iob *iob); int eph_waitsig(eph_iob *iob); int eph_waiteot(eph_iob *iob); int eph_writepkt(eph_iob *iob,int typ,int seq,char *data,size_t length); int eph_writecmd(eph_iob *iob,char *data,size_t length); int eph_writeicmd(eph_iob *iob,char *data,size_t length); int eph_readpkt(eph_iob *iob,eph_pkthdr *pkthdr,char *buf,size_t *length,long timeout_usec); int eph_setispeed(eph_iob *iob,long val); #endif photopc-3.05/photopc.c 644 2627 62 167732 7227711260 10101 #ifndef LINT static char *rcsid="$Id: photopc.c,v 2.83 2001/01/12 23:26:40 crosser Exp $"; #endif /* Copyright (c) 1997-2001 Eugene G. Crosser Copyright (c) 1998,1999 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: photopc.c,v $ Revision 2.83 2001/01/12 23:26:40 crosser new release, avoid strncasecmp, change copyright year Revision 2.82 2001/01/12 11:07:03 crosser If root directory is non-empty, skip it anyway because buggy models report non-zero number of pictures even when current directory is root. Also small fix in displaying time if it is unavailable Revision 2.81 2001/01/11 06:49:58 crosser minor cleanups on source make manual page in sync with the source Revision 2.80 2000/08/13 21:51:48 crosser More changes incorporated from John Bowman's version Revision 2.79 2000/07/14 06:35:39 crosser reportedly some models return CAN instead of DC1 Revision 2.78 2000/05/10 05:20:42 crosser more of Bowman's Nikon things Revision 2.76 2000/05/02 22:26:35 crosser A few things incorporated from John Bowman's Nikon specific diffs Revision 2.75 2000/03/14 21:15:35 crosser Nikon cp950 seems to report negative file size, try negate it. Revision 2.74 2000/02/17 21:29:55 crosser final cleanup for 3.04, change version change debugging levels Revision 2.73 2000/02/17 07:07:41 crosser cleanup for upcoming release Revision 2.72 2000/02/16 22:55:57 crosser backout some changes Revision 2.70 2000/02/16 22:04:03 crosser playing with order of things for Nikon... Do not print header if directory is empty. Revision 2.69 2000/02/13 11:15:01 crosser Kludge null setint for Nikon Revision 2.68 2000/02/08 06:09:54 crosser properly pass back return code through invocations of descend() Revision 2.67 2000/02/05 12:37:42 crosser Oops, resore the code that I have accidently deleted... Revision 2.66 2000/02/04 22:31:56 crosser Clean up things dealing with folder tree recursion. Fixed log entry in acconfig.h that conflicted with "configure" Revision 2.65 2000/02/01 22:04:15 crosser xchdir() function iterates thru path elements define DEVVERSION for extra verbosity Revision 2.64 2000/01/31 21:59:31 crosser Oops! trailing slash... Revision 2.63 2000/01/25 22:16:26 crosser more work trying to chdir properly. I wonder if chdir to multi-component path works at all. Now when path is built properly we'll be able to check it. If chdir-ing to something like "\DCIM\1000OLYM" is impossible we'll have to descend recursively from root every time! Oh boy :-( Revision 2.62 2000/01/24 20:25:23 crosser do better job in walking thru folder tree; credit to Sergey I. Panov Revision 2.61 2000/01/23 15:51:02 crosser work in progress on folder tree support Revision 2.60 2000/01/21 15:03:25 crosser Experimenting with support for models with folder structure Revision 2.59 1999/12/26 13:59:45 crosser sort frame list for erase command; new version 3.03 Revision 2.58 1999/12/11 14:10:15 crosser Support sgtty terminal control Proper "fake speed" handling (needed two values) Revision 2.57 1999/12/01 21:41:24 crosser add "pseudo" speed Revision 2.56 1999/11/17 13:48:08 crosser check if need to include getopt.h Revision 2.55 1999/10/17 13:13:55 crosser check validity of picsum data Revision 2.54 1999/10/09 10:52:47 crosser make filetime honor usetimezone flag. set reg4 in every place (I hope) before other registers are used that depend on the frame number. Revision 2.53 1999/08/01 23:28:06 crosser add RTPRIO Revision 2.52 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 2.51 1999/07/29 07:20:12 crosser remove revision.h Revision 2.50 1999/07/28 20:01:29 crosser reorder includes Revision 2.49 1999/04/11 11:10:09 crosser Add comment about the first usleep() call and do it on non-unix only Revision 2.48 1999/04/10 16:31:34 lightner Change bad switch printout to match bad command printout Add usleep(0L) call to calibrate delays at startup Revision 2.47 1999/03/22 06:08:44 lightner No showhelp() on bad command switches (Windows/DOS errors got lost!) Revision 2.46 1999/03/21 20:22:09 crosser help message typo properly check if the path name is directory if needed Revision 2.45 1999/03/13 13:27:43 crosser add tzset Revision 2.44 1999/03/13 13:10:45 crosser fix usage message Revision 2.43 1999/03/12 23:22:30 crosser cleanup timezone handling Revision 2.42 1999/03/12 10:36:41 crosser fix writing Revision 2.41 1999/03/12 10:06:23 crosser repair low memory model and misc changes Revision 2.40 1999/03/12 01:31:05 crosser cleanups Revision 2.39 1999/03/10 22:34:43 crosser set utime; cleanup Revision 2.38 1999/03/06 13:37:08 crosser Convert to autoconf-style Revision 2.37 1999/02/26 23:54:42 crosser Correct JFIF vs. Exif vs. JPEG things Revision 2.36 1999/02/08 09:37:40 crosser fix help message Revision 2.35 1999/01/17 13:41:34 crosser fix -V message Revision 2.34 1999/01/17 13:32:03 crosser change copyright info Revision 2.33 1999/01/17 09:41:45 crosser fix bug imposed with audio file handling Revision 2.32 1998/12/20 21:49:38 crosser implement "audio" command Revision 2.31 1998/12/06 08:42:43 crosser remove usleep()s - apparently they do not make any difference Revision 2.30 1998/12/06 08:40:34 crosser better way to obtain picture date for the file name Revision 2.29 1998/11/19 11:04:31 crosser clean up things when timedate is not available in the file Revision 2.28 1998/10/18 19:27:31 crosser Insert sleep()s before eph_action, see if it helps Nikon... Revision 2.27 1998/10/18 19:07:36 crosser renamed "list" to "llist", make new "list" that works on all models. Revision 2.26 1998/10/18 13:47:59 crosser change 3 and 4 -f patterns Revision 2.25 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.24 1998/08/08 22:59:42 crosser check error from fclose, change error reportd from fwrite Revision 2.23 1998/08/08 22:16:33 crosser More timezone things Revision 2.22 1998/08/08 14:00:33 crosser make things more Olympus friendly, work on zimezone handling Revision 2.21 1998/08/01 13:12:41 lightner Four port for DOS, minor fix Revision 2.20 1998/07/21 22:25:07 crosser Allow numeric resolutions: come models have more than three allregs do not display 14 and 15 reg to avoid hanging reporterr() print timeout error if -v specified Revision 2.19 1998/06/11 07:23:26 crosser fix bug with -last interval Revision 2.18 1998/06/07 18:41:40 crosser frame intervals, digital zoom Revision 2.17 1998/06/07 13:55:20 crosser fix download in low memory model Revision 2.16 1998/03/01 18:57:04 crosser preview command Revision 2.15 1998/02/27 04:37:11 lightner Fix progress report bug (total image size too large) Revision 2.14 1998/02/27 03:44:49 lightner Image download progress report bug (total bytes low if ! LOW_MEMORY) Revision 2.13 1998/02/26 00:50:39 crosser change timezone stuff change time output routine add error callback to suppress timeout messages maybe other misc things Revision 2.12 1998/02/25 22:43:40 crosser fix termios data saving Revision 2.11 1998/02/16 06:17:36 lightner Add -V option Add -z option (camera time is local time) Fix bug with MS dir names of form "A:/" Validate timezone processing under MS-DOS/Windows Fix spelling of "quiet" (quite->quiet) Revision 2.10 1998/02/13 23:02:40 crosser define type off_t on DOS Revision 2.9 1998/02/08 19:58:38 crosser Support low memory: chunked saving etc. Revision 2.8 1998/02/06 09:22:13 crosser comment buffer roundup, fix ISDIR define Revision 2.7 1998/02/05 23:31:23 lightner Special define for S_ISDIR macro if DOS Add extra 2048 bytes when allocating image buffer (avoids realloc()) Revision 2.6 1998/01/27 21:52:55 crosser upload command Revision 2.5 1998/01/18 02:16:45 crosser DOS support Revision 2.4 1998/01/11 21:20:21 crosser off command, malloc/free cleanup Revision 2.3 1998/01/05 22:02:14 crosser disable gebug printout about scheduling policy Revision 2.2 1998/01/04 13:55:57 crosser new commands: protect, list Change close mode Revision 2.1 1998/01/03 19:55:24 crosser locktoggle command new -f variants Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 Revision 1.4 1997/12/24 00:36:17 crosser fix help message Revision 1.3 1997/12/24 00:19:13 crosser add new commands add formatted file names show more information in query Revision 1.2 1997/11/15 19:20:51 crosser photopc 600 specific commands/parameters and fix for making files when camera time not set Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #ifdef HAVE_FCNTL_H #include #endif #include #ifdef STDC_HEADERS #include #include #endif #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #include #ifndef OPTARG_DEFINED #include #endif #ifdef UNIX #ifdef HAVE_SCHED_H #include #endif #ifdef HAVE_UNAME #include #endif #ifdef HAVE_UNISTD_H #include #endif #else #include "strcscmp.h" #endif #include "eph_io.h" #include "a12scan.h" #include "fnames.h" #include "ctimez.h" #include "filetime.h" #ifdef MAXPATH #undef MAXPATH #endif #define MAXPATH 256 #ifdef DOS #define MS_PROGRAM_NAMES #pragma warn -par #pragma warn -sus #endif #ifdef MSWINDOWS #define MS_PROGRAM_NAMES #define ERRNO GetLastError() #else #define ERRNO errno #endif #ifdef UNIX #define WRITEMODE "w" #define READMODE "r" #else #define WRITEMODE "wb" #define READMODE "rb" #endif #ifndef S_ISDIR #define S_ISDIR(st_mode) ((S_IFDIR & (st_mode)) ? 1 : 0) #endif #ifdef DEFAULT_DEVICE static char *device=DEFAULT_DEVICE; #else # ifdef UNIX static char *device="/dev/photopc"; # else static char *device="COM1:"; # endif #endif static int debug=0; static int quiet=0; static int usetimezone=1; static int setutime=0; static unsigned long filesize=0L; static long frame=0L; static char *nameformat=NULL; static int switchoff=0; static FILE *fp = NULL; static char *fname = NULL; static int have_folders=0; void file_abort_cleanup(void) { if (fp) { fclose(fp); fp=NULL; } if (fname) { printf("\ndeleting file %s\n", fname); unlink(fname); free(fname); fname=NULL; } } static long numphotos(eph_iob *iob) { long r10,r40; if (eph_getint(iob,40,&r40)) { r40=-1; } if (eph_getint(iob,10,&r10)) { r10=-1; } return (r10>r40)?r10:r40; } static int xchdir(eph_iob *iob,char *where) { char path[MAXPATH],*p; if (!have_folders) { fprintf(stderr,"no folders on this model\n"); return -1; } strncpy(path,where,sizeof(path)-1); path[sizeof(path)-1]='\0'; for (p=path;*p;p++) if (*p == '/') *p='\\'; if (path[0] == '\\') { if (eph_setvar(iob,84,"\\",1)) { fprintf(stderr,"could not chdir to \"\\\"\n"); return -1; } } for (p=strtok(path,"\\");p;p=strtok(NULL,"\\")) { if (eph_setvar(iob,84,p,(off_t)strlen(p))) { fprintf(stderr,"could not chdir to \"%s\"\n",p); return -1; } } return 0; } static int descend(eph_iob *iob,int depth,char *root,int(*each)(eph_iob *iob,char *path)) { long nfolders=0L,i; off_t f_size; char *folder,*p; char path[MAXPATH]; int rc; if (!have_folders) return (*each)(iob,root); if (depth > 10) { fprintf(stderr,"cannot be that deep (%d), error!\n",depth); return -1; } if (xchdir(iob,root)) { fprintf(stderr,"chdir to \"%s\" failed\n",root); return -1; } if ((rc=(*each)(iob,root)) != 0) { if (debug) printf("(*each)() returned %d\n",rc); return rc; } eph_getint(iob,83,&nfolders); if (debug) printf("descend: %s has %ld folders\n", root,nfolders); if (nfolders == 0L) return 0; folder=(char*)malloc(2048); f_size=2048; path[sizeof(path)-1]='\0'; for (i=1;i<=nfolders;i++) { eph_setint(iob,83,i); eph_getvar(iob,84,&folder,&f_size); if (debug) printf("depth=%4d i=%4ld:\n",depth,i); strncpy(path,root,sizeof(path)-2); if (path[strlen(path)-1] != '\\') strncat(path,"\\",sizeof(path)-2); strncat(path,folder,sizeof(path)-2); for (p=path+strlen(path)-1;(*p == ' ') && (p > path);p--) *p='\0'; if ((rc=descend(iob,depth+1,path,each))) { free(folder); return rc; } if (xchdir(iob,root)) { fprintf(stderr,"restore dir to \"%s\" failed\n",root); free(folder); return -1; } } free(folder); if (debug) printf("descend: full tree walked through\n"); return 0; } static int nonempty(eph_iob *iob,char *path) { long result; if (eph_getint(iob,10,&result)) { return -1; } if (result) { if (strlen(path) < 2) { if (!quiet) fprintf(stderr,"Buggy camera: nonempty root folder \"%s\", skip over\n",path); return 0; } if (!quiet) printf("Starting in folder \"%s\"\n",path); return 1; } else return 0; } int init(eph_iob *iob) { long ret; int rc; if (eph_getint(iob,1,&ret)) return -1; #if 0 (void)eph_setint(iob,77,1L); (void)eph_setint(iob,82,60L); #endif if ((rc=eph_setnullint(iob,83))) { if (debug) printf("setnullint(83) returned %d\n",rc); } if (eph_setvar(iob,84,"\\",1)) { if (debug) printf("No folders on this model\n"); } else { have_folders=1; } if (have_folders) if (descend(iob,0,"\\",nonempty) < 0) return -1; return 0; } int setclock(eph_iob *iob,int argc,char *argv[]) { time_t now,new; (void)time(&now); if (!usetimezone) { now+=zoneoffset(now); } if (eph_setint(iob,2,(long)now)) return -1; if (eph_getint(iob,2,(long*)&new)) return -1; if (labs(now-new) > 59L) { fprintf(stderr,"time we tried to set does not match the result\n"); return -1; } else { return 0; } } int resolution(eph_iob *iob,int argc,char *argv[]) { long val=0; if (strcasecmp(argv[1],"Lo") == 0) { val=1; } else if (strcasecmp(argv[1],"Hi") == 0) { val=2; } else if (strcasecmp(argv[1],"Ext") == 0) { val=3; } else if ((val=atol(argv[1])) == 0) { fprintf(stderr,"bad resolution `%s'\n",argv[1]); return -1; } return eph_setint(iob,1,val); } int shutter(eph_iob *iob,int argc,char *argv[]) { long val=0; int adjust=0; char buffer[]={0,0,0,0,10,0,0,0}; if (strcasecmp(argv[1],"Auto") == 0) { val=0L; } else if ((strlen(argv[1]) > 2) && (strncmp(argv[1],"1/",2) == 0)) { val=atol(argv[1]+2); if (val == 0) { fprintf(stderr,"bad shutter speed `%s'\n",argv[1]); return -1; } else { val=1000000L/val; } } else if (sscanf(argv[1],"plus%ld",&val) == 1) { adjust=1; } else if (sscanf(argv[1],"minus%ld",&val) == 1) { adjust=-1; } else if ((val=atol(argv[1])) == 0) { fprintf(stderr,"bad shutter speed `%s'\n",argv[1]); return -1; } if (adjust) { if (val == 0) { fprintf(stderr,"bad shutter adjustment `%s'\n",argv[1]); return -1; } else { val=val*adjust; } buffer[0]=(val>>0)&0xff; buffer[1]=(val>>8)&0xff; buffer[2]=(val>>16)&0xff; buffer[3]=(val>>24)&0xff; return eph_setvar(iob,69,buffer,sizeof(buffer)); } else return eph_setint(iob,3,val); } int aperture(eph_iob *iob,int argc,char *argv[]) { long val=0; if (strcasecmp(argv[1],"Auto") == 0) { val=0; } else if (strcasecmp(argv[1],"Lo") == 0) { val=1; } else if (strcasecmp(argv[1],"Med") == 0) { val=2; } else if (strcasecmp(argv[1],"Hi") == 0) { val=4; } else if ((val=atol(argv[1])) == 0) { fprintf(stderr,"bad aperture `%s'\n",argv[1]); return -1; } return eph_setint(iob,5,val); } int flash(eph_iob *iob,int argc,char *argv[]) { long val=0; if (strcasecmp(argv[1],"Auto") == 0) { val=0; } else if (strcasecmp(argv[1],"Force") == 0) { val=1; } else if (strcasecmp(argv[1],"Off") == 0) { val=2; } else if (strcasecmp(argv[1],"Antiredeye") == 0) { val=3; } else if (strcasecmp(argv[1],"Slowsync") == 0) { val=4; } else { fprintf(stderr,"bad flash mode `%s'\n",argv[1]); return -1; } return eph_setint(iob,7,val); } int autoshut_host(eph_iob *iob,int argc,char *argv[]) { long val=0; if ((val=atol(argv[1])) <= 0) { fprintf(stderr,"bad timer value `%s'\n",argv[1]); return -1; } return eph_setint(iob,0x17,val); } int autoshut_field(eph_iob *iob,int argc,char *argv[]) { long val=0; if ((val=atol(argv[1])) <= 0) { fprintf(stderr,"bad timer value `%s'\n",argv[1]); return -1; } return eph_setint(iob,0x18,val); } int lcd_autoshut(eph_iob *iob,int argc,char *argv[]) { long val=0; if ((val=atol(argv[1])) <= 0) { fprintf(stderr,"bad timer value `%s'\n",argv[1]); return -1; } return eph_setint(iob,38,val); } int lcd_brightness(eph_iob *iob,int argc,char *argv[]) { long val=0; if (((val=atol(argv[1])) <= 0) || (val > 7)) { fprintf(stderr,"bad brighness value `%s'\n",argv[1]); return -1; } return eph_setint(iob,35,val); } int setid(eph_iob *iob,int argc,char *argv[]) { return eph_setvar(iob,0x16,argv[1],(off_t)strlen(argv[1])); } int focus(eph_iob *iob,int argc,char *argv[]) { long val=0; if (strcasecmp(argv[1],"Macro") == 0) { val=1; } else if (strcasecmp(argv[1],"Normal") == 0) { val=2; } else if (strcasecmp(argv[1],"Infinity") == 0) { val=3; } else if ((val=atol(argv[1])) == 0) { fprintf(stderr,"bad focus mode `%s'\n",argv[1]); return -1; } return eph_setint(iob,33,val); } int adjust(eph_iob *iob,int argc,char *argv[]) { long val=0; if (strcasecmp(argv[1],"Normal") == 0) { val=0; } else if (strcasecmp(argv[1],"Contrast+") == 0) { val=1; } else if (strcasecmp(argv[1],"Contrast-") == 0) { val=2; } else if (strcasecmp(argv[1],"Brightness+") == 0) { val=3; } else if (strcasecmp(argv[1],"Brightness-") == 0) { val=4; } else if ((val=atol(argv[1])) == 0) { fprintf(stderr,"bad adjust mode `%s'\n",argv[1]); return -1; } return eph_setint(iob,19,val); } int whitebalance(eph_iob *iob,int argc,char *argv[]) { long val=0; if (strcasecmp(argv[1],"Auto") == 0) { val=0; } else if (strcasecmp(argv[1],"Sunny") == 0) { val=1; } else if (strcasecmp(argv[1],"Incandescent") == 0) { val=2; } else if (strcasecmp(argv[1],"Fluorescent") == 0) { val=3; } else if (strcasecmp(argv[1],"Flash") == 0) { val=5; } else if (strcasecmp(argv[1],"Preset") == 0) { val=6; } else if (strcasecmp(argv[1],"Cloudy") == 0) { val=255; } else if ((val=atol(argv[1])) == 0) { fprintf(stderr,"bad whitebalance mode `%s'\n",argv[1]); return -1; } return eph_setint(iob,20,val); } int metering(eph_iob *iob,int argc,char *argv[]) { long val=0; if (strcasecmp(argv[1],"Center-weighted") == 0) { val=2; } else if (strcasecmp(argv[1],"Spot") == 0) { val=3; } else if (strcasecmp(argv[1],"Matrix") == 0) { val=5; } else if ((val=atol(argv[1])) == 0) { fprintf(stderr,"bad metering mode `%s'\n",argv[1]); return -1; } return eph_setint(iob,70,val); } int color(eph_iob *iob,int argc,char *argv[]) { long val=0; if (eph_getint(iob,72,&val)) { if (strcasecmp(argv[1],"On") == 0) { val=1; } else if (strcasecmp(argv[1],"Off") == 0) { val=2; } else if ((val=atol(argv[1])) == 0) { fprintf(stderr,"bad color mode `%s'\n",argv[1]); return -1; } return eph_setint(iob,6,val); } else { if (strcasecmp(argv[1],"On") == 0) { val&=~16; } else if (strcasecmp(argv[1],"Off") == 0) { val|=16; } else { fprintf(stderr,"bad color mode `%s'\n",argv[1]); return -1; } return eph_setint(iob,72,val); } } int dzoom(eph_iob *iob,int argc,char *argv[]) { long val=0; long highbits; if (eph_getint(iob,72,&val)) return -1; highbits=(val & 0x1F) | 8; if (strcasecmp(argv[1],"Zero") == 0) { val=0; } else if (strcasecmp(argv[1],"AEL/WBL") == 0) { val |= 1; } else if (strcasecmp(argv[1],"Reset") == 0) { val &= 0xFFFE; } else if (strcasecmp(argv[1],"Fisheye") == 0) { val=(val & 0xFFF1) | 2; } else if (strcasecmp(argv[1],"Wide") == 0) { val=(val & 0xFFF1) | 4; } else if (strcasecmp(argv[1],"Telephoto") == 0) { val=(val & 0xFFF9); } else if (strcasecmp(argv[1],"Auto") == 0) { val=highbits & 0x17; } else if (strcasecmp(argv[1],"1.25X") == 0) { val=highbits | 0x0100; } else if (strcasecmp(argv[1],"1.6X") == 0) { val=highbits | 0x0200; } else if (strcasecmp(argv[1],"2.0X") == 0) { val=highbits | 0x0300; } else if (strcasecmp(argv[1],"2.5X") == 0) { val=highbits | 0x0400; } else if (strcasecmp(argv[1],"1.0X") == 0) { val=highbits | 0x0500; } else if (strcasecmp(argv[1],"Off") == 0) { val=highbits | 0x0500; } else if ((val=atol(argv[1])) == 0) { fprintf(stderr,"bad dzoom mode `%s'\n",argv[1]); return -1; } return eph_setint(iob,72,val); } int zoom(eph_iob *iob,int argc,char *argv[]) { double val; char buffer[]={0,0,0,0,10,0,0,0}; if ((val=atof(argv[1])) <= 0.0 || val >= 26.0) { fprintf(stderr,"bad zoom value `%s'\n",argv[1]); return -1; } buffer[0]=(unsigned int)(10.0*val-0.5); return eph_setvar(iob,71,buffer,sizeof(buffer)); } int seti(eph_iob *iob,int argc,char *argv[]) { long reg; long val; if ((reg=atol(argv[1])) <= 0) { fprintf(stderr,"bad register value \"%s\"\n",argv[1]); return -1; } if (strspn(argv[2],"0123456789") != strlen(argv[2])) { fprintf(stderr,"bad set value \"%s\"\n",argv[2]); return -1; } val=atol(argv[2]); return eph_setint(iob,reg,val); } int setv(eph_iob *iob,int argc,char *argv[]) { long reg; if ((reg=atol(argv[1])) <= 0) { fprintf(stderr,"bad register value \"%s\"\n",argv[1]); return -1; } return eph_setvar(iob,reg,argv[2],(off_t)strlen(argv[2])); } int snapshot(eph_iob *iob,int argc,char *argv[]) { char zero=0; if (eph_action(iob,2,&zero,1)) return -1; else return 0; } int erase(eph_iob *iob,int argc,char *argv[]) { char zero=0; long frame; if ((frame=atol(argv[1])) <= 0) { fprintf(stderr,"bad frame number %s\n",argv[1]); return -1; } if (eph_setint(iob,4,frame)) return -1; if (eph_action(iob,7,&zero,1)) return -1; else return 0; } int protect(eph_iob *iob,int argc,char *argv[]) { char pmode; long frame; if (strcasecmp(argv[2],"On") == 0) { pmode=1; } else if (strcasecmp(argv[2],"Off") == 0) { pmode=0; } else { fprintf(stderr,"bad protect mode `%s'\n",argv[2]); return -1; } if ((frame=atol(argv[1])) <= 0) { fprintf(stderr,"bad frame number %s\n",argv[1]); return -1; } if (eph_setint(iob,4,frame)) return -1; if (eph_action(iob,9,&pmode,1)) return -1; else return 0; } int eraseall(eph_iob *iob,int argc,char *argv[]) { char zero=0; if (eph_action(iob,1,&zero,1)) return -1; else return 0; } int eraselast(eph_iob *iob,int argc,char *argv[]) { char zero=0; if (eph_action(iob,0,&zero,1)) return -1; else return 0; } int mode(eph_iob *iob,int argc,char *argv[]) { char val=0; if (strcasecmp(argv[1],"Off") == 0) { val=1; } else if (strcasecmp(argv[1],"Record") == 0) { val=2; } else if (strcasecmp(argv[1],"Play") == 0) { val=3; } else if (strcasecmp(argv[1],"Thumbnail") == 0) { val=6; } else if (strcasecmp(argv[1],"Next") == 0) { val=7; } else if (strcasecmp(argv[1],"Previous") == 0) { val=8; } else if ((val=atol(argv[1])) == 0) { fprintf(stderr,"bad mode `%s'\n",argv[1]); return -1; } if (eph_action(iob,8,&val,1)) return -1; else return 0; } int cmd(eph_iob *iob,int argc,char *argv[]) { long ccode; int intarg=-1; char chararg; if (strspn(argv[1],"0123456789") != strlen(argv[1])) { fprintf(stderr,"bad code value \"%s\"\n",argv[1]); return -1; } else ccode=atol(argv[1]); if (strspn(argv[2],"0123456789") == strlen(argv[2])) intarg=atol(argv[2]); if ((intarg >= 0) && (intarg <= 255)) { chararg=intarg; return eph_action(iob,ccode,&chararg,1); } else return eph_action(iob,ccode,argv[2],strlen(argv[2])); } static char *flashval[] = {"Auto","Force","Off","AntiRedeye","SlowSync"}; static char *resval[] = {"Unrecognized","Low","High","Extended"}; static char *macroval[] = {"Unrecognized","Macro","Normal","Infinity"}; static char *aperval[] = {"Auto","Low","Medium","High"}; static char *adjval[] = {"Normal","Contrast+","Contrast-","Brightness+", "Brightness-","Auto"}; static char *wbval[] = {"Auto","Sunny","Incandescent","Fluorescent", "Unrecognized","Flash","Preset"}; static char *meterval[] = {"Unrecognized","Unrecognized","Center","Spot", "Unrecognized","Matrix","Spot-AF-Area"}; static char *operval[] = {"Unrecognized","Off","Record","Play", "Unrecognized","Unrecognized","Thumbnail"}; int query(eph_iob *iob,int argc,char *argv[]) { long result; char *buffer; off_t bufsize; int rc; buffer=malloc(2048); if ((rc=eph_getint(iob,1,&result)) == 0) printf("Resolution: %lu - %s\n",(unsigned long)result, (result < 4)?resval[result]:"Model-specific"); else if (rc == DC1) printf("Resolution unavailable\n"); else goto failure; if ((rc=eph_getint(iob,2,&result)) == 0) { if ((result == 0L) || (result == -1L)) { printf("Camera time: not set (%ld)\n",result); } else { printf("Camera time: %s\n", ctimetz((time_t*)&result,usetimezone)); } } else if (rc == DC1) printf("Camera time unavailable\n"); else goto failure; if ((rc=eph_getint(iob,3,&result)) == 0) printf("Shutter: %lu (1/%lu)\n",(unsigned long)result, (unsigned long)(result?1000000/result:0L)); else if (rc == DC1) printf("Shutter unavailable\n"); else goto failure; if ((rc=eph_getint(iob,5,&result)) == 0) printf("Aperture: %lu - %s\n",(unsigned long)result, (result < 4)?aperval[result]:"Unrecognized"); else if (rc == DC1) printf("Aperture unavailable\n"); else goto failure; if ((rc=eph_getint(iob,6,&result)) == 0) printf("Color mode: %lu - %s\n",result, (result == 1)?"Color":(result == 2)?"B/W":"Unrecognized"); else if (rc == DC1) printf("Color mode unavailable\n"); else goto failure; if ((rc=eph_getint(iob,7,&result)) == 0) printf("Flash: %lu - %s\n",(unsigned long)result, (result < 5)?flashval[result]:"Unrecognized"); else if (rc == DC1) printf("Flash mode unavailable\n"); else goto failure; if ((rc=eph_getint(iob,10,&result)) == 0) printf("Frames in folder: %lu\n",(unsigned long)result); else if (rc == DC1) printf("Frames in folder unavailable\n"); else goto failure; if ((rc=eph_getint(iob,40,&result)) == 0) printf("Total frames: %lu\n",(unsigned long)result); else if (rc == DC1) printf("Total frames unavailable\n"); else goto failure; if ((rc=eph_getint(iob,11,&result)) == 0) printf("Frames left: %lu\n",(unsigned long)result); else if (rc == DC1) printf("Frames left unavailable\n"); else goto failure; if ((rc=eph_getint(iob,16,&result)) == 0) printf("Battery: %lu%%\n",(unsigned long)result); else if (rc == DC1) printf("Battery capacity unavailable\n"); else goto failure; if ((rc=eph_getint(iob,23,&result)) == 0) printf("Autoshut on host: %lu sec\n",(unsigned long)result); else if (rc == DC1) printf("Autoshut on host timer unavailable\n"); else goto failure; if ((rc=eph_getint(iob,24,&result)) == 0) printf("Autoshut on field: %lu sec\n",(unsigned long)result); else if (rc == DC1) printf("Autoshut on field timer unavailable\n"); else goto failure; if ((rc=eph_getint(iob,28,&result)) == 0) printf("Free memory: %lu bytes\n",(unsigned long)result); else if (rc == DC1) printf("Free memory size unavailable\n"); else goto failure; if ((rc=eph_getint(iob,33,&result)) == 0) printf("Macro mode: %lu - %s\n",result, (result < 4)?macroval[result]:"Unrecognized"); else if (rc == DC1) printf("Macro mode unavailable\n"); else goto failure; if ((rc=eph_getint(iob,34,&result)) == 0) printf("Operation mode: %lu - %s\n",result, (result < 7)?operval[result]:"Unrecognized"); else if (rc == DC1) printf("Operation mode unavailable\n"); else goto failure; if ((rc=eph_getint(iob,19,&result)) == 0) printf("Image adjust: %lu - %s\n",(unsigned long)result, (result < 6)?adjval[result]:"Unrecognized"); else if (rc == DC1) printf("Image adjust unavailable\n"); else goto failure; if ((rc=eph_getint(iob,20,&result)) == 0) printf("White balance: %lu - %s\n",(unsigned long)result, (result < 7)?wbval[result]: (result == 255)?"Cloudy":"Unrecognized"); else if (rc == DC1) printf("White balance unavailable\n"); else goto failure; if ((rc=eph_getint(iob,70,&result)) == 0) printf("Metering mode: %lu - %s\n",(unsigned long)result, (result < 7)?meterval[result]:"Unrecognized"); else if (rc == DC1) printf("Metering mode unavailable\n"); else goto failure; if ((rc=eph_getint(iob,35,&result)) == 0) printf("LCD brightness: %lu (of 7)\n",(unsigned long)result); else if (rc == DC1) printf("LCD brightness unavailable\n"); else goto failure; if ((rc=eph_getint(iob,38,&result)) == 0) printf("LCD autoshut: %lu sec\n",(unsigned long)result); else if (rc == DC1) printf("LCD autoshut timer unavailable\n"); else goto failure; /* bufsize=2048; buffer[0]='\0'; if ((rc=eph_getvar(iob,0x08,&buffer,&bufsize)) == 0) printf("Reg 8: \"%s\"\n",buffer); else if (rc == DC1) printf("Reg 8 unavailable\n"); else goto failure; */ bufsize=2048; buffer[0]='\0'; if ((rc=eph_getvar(iob,0x16,&buffer,&bufsize)) == 0) printf("Camera I.D.: \"%s\"\n",buffer); else if (rc == DC1) printf("Camera I.D. unavailable\n"); else goto failure; bufsize=2048; buffer[0]='\0'; if ((rc=eph_getvar(iob,0x19,&buffer,&bufsize)) == 0) printf("Serial No.: \"%s\"\n",buffer); else if (rc == DC1) printf("Serial No. unavailable\n"); else goto failure; bufsize=2048; buffer[0]='\0'; if ((rc=eph_getvar(iob,0x1a,&buffer,&bufsize)) == 0) printf("Version: \"%s\"\n",buffer); else if (rc == DC1) printf("Version unavailable\n"); else goto failure; bufsize=2048; buffer[0]='\0'; if ((rc=eph_getvar(iob,0x1b,&buffer,&bufsize)) == 0) printf("Model: \"%s\"\n",buffer); else if (rc == DC1) printf("Model unavailable\n"); else goto failure; bufsize=2048; buffer[0]='\0'; if ((rc=eph_getvar(iob,48,&buffer,&bufsize)) == 0) printf("Manufacturer: \"%s\"\n",buffer); else if (rc == DC1) printf("Manufacturer unavailable\n"); else goto failure; bufsize=2048; buffer[0]='\0'; if ((rc=eph_getvar(iob,69,&buffer,&bufsize)) == 0) { long adj=(long)(buffer[0]&0xff) +((long)(buffer[1]&0xff)<<8) +((long)(buffer[2]&0xff)<<16) +((long)(buffer[3]&0xff)<<24); printf("Shutter adjustment: %ld\n",adj); } else if (rc == DC1) printf("Shutter adjustment unavailable\n"); else goto failure; bufsize=2048; buffer[0]='\0'; if ((rc=eph_getvar(iob,71,&buffer,&bufsize)) == 0) { long ezoom=(long)(buffer[0]&0xff) +((long)(buffer[1]&0xff)<<8) +((long)(buffer[2]&0xff)<<16) +((long)(buffer[3]&0xff)<<24); printf("Effective zoom: %.1f\n",ezoom*.1); } else if (rc == DC1) printf("Effective zoom unavailable\n"); else goto failure; if ((rc=eph_getint(iob,72,&result)) == 0) printf("Digital zoom mode: %lu - %s\n", (unsigned long)result, (result <= 1)?"Off":"On"); else if (rc == DC1) printf("Digital zoom mode unavailable\n"); else goto failure; free(buffer); return 0; failure: free(buffer); return -1; } int count(eph_iob *iob,int argc,char *argv[]) { printf("%ld\n",numphotos(iob)); return 0; } int geti(eph_iob *iob,int argc,char *argv[]) { long res; long reg; if ((reg=atol(argv[1])) <= 0) { fprintf(stderr,"bad register value \"%s\"\n",argv[1]); return -1; } if (eph_getint(iob,reg,&res)) return -1; printf("Reg %ld=%ld\n",reg,res); return 0; } int getv(eph_iob *iob,int argc,char *argv[]) { char *buffer=malloc(2048); off_t bufsize=2048; int i; long reg; if ((reg=atol(argv[1])) <= 0) { fprintf(stderr,"bad register value \"%s\"\n",argv[1]); free(buffer); return -1; } buffer[0]='\0'; if (eph_getvar(iob,reg,&buffer,&bufsize)) { free(buffer); return -1; } printf("Reg %ld=\"",reg); for (i=0;i= ' ') && (buffer[i] <= 'z')) { printf("%c",buffer[i]); } else { printf("\\%03o",(unsigned char)buffer[i]); } } printf("\"\n"); free(buffer); return 0; } int camsum(eph_iob *iob,int argc,char *argv[]) { long res; char *buf=malloc(32); off_t bufsize=32; int i; if (eph_getvar(iob,46,&buf,&bufsize)) { fprintf(stderr,"cannot get summary data\n"); return -1; } for (i=0;i<32;i+=4) { res=(long)(buf[i]&0xff)+((long)(buf[i+1]&0xff)<<8)+ ((long)(buf[i+2]&0xff)<<16)+((long)(buf[i+3]&0xff)<<24); printf("%d: %08lx\n",i/4,res); } free(buf); return 0; } int picsum(eph_iob *iob,int argc,char *argv[]) { long res; char *buf=malloc(32); off_t bufsize=32; long frame; int i; if ((frame=atol(argv[1])) <= 0) { fprintf(stderr,"bad frame value \"%s\"\n",argv[1]); return -1; } if (eph_setint(iob,4,frame)) { fprintf(stderr,"cannot set frame frame \"%s\"\n",argv[1]); return -1; } if (eph_getvar(iob,47,&buf,&bufsize)) { fprintf(stderr,"cannot get summary data\n"); return -1; } for (i=0;i<32;i+=4) { res=(long)(buf[i]&0xff)+((long)(buf[i+1]&0xff)<<8)+ ((long)(buf[i+2]&0xff)<<16)+((long)(buf[i+3]&0xff)<<24); printf("%d: %08lx ",i/4,res); } printf("\n"); free(buf); return 0; } int allregs(eph_iob *iob,int argc,char *argv[]) { char *buffer; off_t bufsize; int i,rc; long j,max; long res; if ((max=atol(argv[1])) <= 0) { fprintf(stderr,"bad max register value \"%s\"\n",argv[1]); return -1; } for (j=0;j<=max;j++) { printf("%3ld ",j); /* do not query for image data because this may hang the camera if frame number is not set beforehand. On Olympus D-600L even reading length registers hang it. */ if (((j >= 12) && (j <= 15)) || (j == 39) || (j == 43) || (j == 44) || (j == 47)) { printf("Reg %ld not queried: dangerous...\n",j); continue; } if ((rc=eph_getint(iob,j,&res)) == DC1) { printf("N/A "); } else if (rc) { printf("FAIL "); } else { printf("%10ld ",res); } buffer=malloc(2048); buffer[0]='\0'; bufsize=2048; if ((rc=eph_getvar(iob,j,&buffer,&bufsize)) == DC1) { strcpy(buffer,"N/A"); } else if (rc) { strcpy(buffer,"FAIL"); } printf("\""); for (i=0;(i= ' ') && (buffer[i] <= 'z')) { printf("%c",buffer[i]); } else { printf("\\%03o",(unsigned char)buffer[i]); } } if (i < bufsize) printf(".."); printf("\"\n"); free(buffer); } return 0; } int listfiles(eph_iob *iob,char *path) { char *buffer; off_t bufsize; int rc; long res,j,max; if ((max=numphotos(iob)) < 0) { return -1; } if (have_folders) printf("%s: ",path); if (max) printf("total %lu\n" "No. Size R P Date and Time Filename\n", max); else printf("\n"); buffer=malloc(32); bufsize=32; for (j=1;j<=max;j++) { printf("%3ld ",j); if ((rc=eph_setint(iob,4,j)) == DC1) { printf("%3ld N/A\n",j); break; } else if (rc) { printf("%3ld FAIL\n",j); break; } if ((rc=eph_getint(iob,12,&res)) == DC1) { printf("%3ld N/A ",j); } else if (rc) { printf("%3ld FAIL ",j); } else { printf("%3ld %7ld ",j,res); } if ((rc=eph_getvar(iob,47,&buffer,&bufsize)) == DC1) { printf("N/A\n"); break; } else if (rc) { printf("FAIL\n"); break; } res=(long)(buffer[12]&0xff)+((long)(buffer[13]&0xff)<<8)+ ((long)(buffer[14]&0xff)<<16)+((long)(buffer[15]&0xff)<<24); printf("%01ld ",res); res=(long)(buffer[16]&0xff)+((long)(buffer[17]&0xff)<<8)+ ((long)(buffer[18]&0xff)<<16)+((long)(buffer[19]&0xff)<<24); printf("%c ",res?'P':'-'); res=(long)(buffer[20]&0xff)+((long)(buffer[21]&0xff)<<8)+ ((long)(buffer[22]&0xff)<<16)+((long)(buffer[23]&0xff)<<24); if (res != -1L) printf("%8s",ctimetz(&res,usetimezone)); else printf("N/A "); if ((rc=eph_getvar(iob,79,&buffer,&bufsize)) == DC1) { printf(" N/A\n"); } else if (rc) { printf(" FAIL\n"); } else { printf(" %s\n",buffer); } } free(buffer); return 0; } int llistfiles(eph_iob *iob, char *path) { char *buffer,*p; unsigned char *ress; off_t bufsize,ressize; int rc; long j,max; long res; if ((max=numphotos(iob)) < 0) { return -1; } if (have_folders) printf("%s: ",path); if (max) printf("total %lu\n" "No. P Size R F Shuttr Date and Time\n", max); else printf("\n"); for (j=1;j<=max;j++) { printf("%3ld ",j); if ((rc=eph_setint(iob,4,j)) == DC1) { printf("N/A\n"); break; } else if (rc) { printf("FAIL\n"); break; } if ((rc=eph_getint(iob,39,&res)) == DC1) { printf("N "); } else if (rc) { printf("F "); } else { printf("%c ",res?'P':'-'); } if ((rc=eph_getint(iob,12,&res)) == DC1) { printf("N/A "); } else if (rc) { printf("FAIL "); } else { printf("%7ld ",res); } buffer=malloc(2048); buffer[0]='\0'; bufsize=2048; if ((rc=eph_setint(iob,4,j)) == DC1) { printf("N/A\n"); break; } else if (rc) { printf("FAIL\n"); break; } if ((rc=eph_getvar(iob,15,&buffer,&bufsize)) == DC1) { printf("N/A\n"); break; } else if (rc) { printf("FAIL\n"); break; } ress=buffer; ressize=bufsize; a12scan(&ress,&ressize); p=a12search("Resolution",ress,ressize); res=-1L; if (p) { if (sscanf(p,"%lu",&res) != 1) res=-1L; } if (res != -1L) printf("%ld ",res); else printf("N "); p=a12search("Flash",ress,ressize); res=-1L; if (p) { if (sscanf(p,"%lu",&res) != 1) res=-1L; } if (res != -1L) printf("%c ",res?'F':'-'); else printf("N "); p=a12search("Shutter",ress,ressize); res=-1L; if (p) { if (sscanf(p,"%lu",&res) != 1) res=-1L; } if (res != -1L) printf("1/%-4ld ",res?1000000L/res:0L); else printf("N/A "); p=a12search("TimeDate",ress,ressize); res=-1L; if (p) { if (sscanf(p,"%lu",&res) != 1) res=-1L; } if (res != -1L) printf("%8s\n",ctimetz(&res,usetimezone)); else printf("N/A\n"); free(buffer); } return 0; } int list(eph_iob *iob,int argc,char *argv[]) { return descend(iob,0,"\\",listfiles); } int llist(eph_iob *iob,int argc,char *argv[]) { return descend(iob,0,"\\",llistfiles); } int cd(eph_iob *iob,int argc,char *argv[]) { return xchdir(iob,argv[1]); } static void reporterror(int errcode,char *errstr) { if ((errcode != ERR_TIMEOUT) || debug) fprintf(stderr,"Error %d: %s\n",errcode,errstr); } void running(off_t count) { if (!quiet && filesize) { printf("%lu: %lu of %lu\r",(unsigned long)frame, (unsigned long)count,filesize); fflush(stdout); } } int storing(char *data,size_t len) { if (fwrite(data,len,1,fp) != 1) { perror(fname); return -1; } return 0; } int retrfile(eph_iob *iob,int argc,char *argv[],int datatype) { char *filenm; char *buffer,*buf8i; off_t bufsize,buf8isize; long length,ilength,tlength,alength; off_t got; time_t pictime; unsigned char *res; off_t ressize; char *p; struct stat st; int dreg=0; #ifndef LOWMEMORY int needfillbuffer=0; #endif buf8isize=32; if ((buf8i=malloc((size_t)buf8isize)) == NULL) { perror("malloc buf8i"); return -1; } (void)sscanf(argv[1],"%ld",&frame); filenm=argv[2]; if (eph_setint(iob,4,frame)) return -1; if (eph_getint(iob,12,&ilength)) return -1; if (ilength < 0) { if (debug) fprintf(stderr, "uh-oh, size of frame in reg12 negative (%ld)," " will interpret as positive\n",ilength); ilength=-ilength; } if (eph_setint(iob,4,frame)) return -1; if (eph_getint(iob,13,&tlength)) return -1; if (datatype == AUDIO) { buf8isize=32; if (eph_setint(iob,4,frame)) return -1; if (eph_getvar(iob,43,&buf8i,&buf8isize) == 0) { alength=(long)(buf8i[4]&0xff)+((long)(buf8i[5]&0xff)<<8)+ ((long)(buf8i[6]&0xff)<<16)+((long)(buf8i[7]&0xff)<<24); } else alength=0; if (debug) printf("Compressed audio length: %lu\n", alength); filesize=length=alength; } else { filesize=length=tlength; if (datatype == IMAGE) { length+=ilength; filesize=ilength; } } pictime=0; buf8isize=32; if (eph_setint(iob,4,frame)) return -1; if (eph_getvar(iob,47,&buf8i,&buf8isize) == 0) { long ilength2; ilength2=(long)(buf8i[0]&0xff)+((long)(buf8i[1]&0xff)<<8)+ ((long)(buf8i[2]&0xff)<<16); if (ilength2 && (ilength == 0L)) { if (debug) fprintf(stderr, "uh-oh, size of frame in reg12 (%ld) " "is zero, will use size field from " "picture summary register (%ld)!\n", ilength,ilength2); ilength=ilength2; } if (ilength == ilength2) { pictime=(long)(buf8i[20]&0xff)+ ((long)(buf8i[21]&0xff)<<8)+ ((long)(buf8i[22]&0xff)<<16)+ ((long)(buf8i[23]&0xff)<<24); } else { if (!quiet) fprintf(stderr, "uh-oh, size of frame in reg12 (%ld) " "does not match size field from " "picture summary register (%ld), ignore " "summary data!\n", ilength,ilength2); } } if (debug) printf("got timestamp from reg47: %lu\n", pictime); free(buf8i); /* What happens next MM PT DT | 1 2 3 4 5 6 -----------+------------++------- N T | SA RT -- || -- WB o !0 I | BA RI -- || -- WB r A | BA RA -- || -- WB m --------+------------++------- a T | SA RT AN || -- WB l 0 I | BA RI AN || -- WB A | SA RT AN || RA WB -----------+------------++------- T | SA RT -- || -- WB !0 I | -- -- -- || RW -- L A | -- -- -- || RW -- o --------+------------++------- w T | SA RT AN || -- WB 0 I | SA RT AN || RW -- A | SA RT AN || RW -- -----------+------------++------- */ /*=== Stage 1: allocate buffer ===*/ bufsize=0; buffer=NULL; #ifdef LOWMEMORY if ((datatype == THUMBNAIL) || (pictime == 0)) bufsize=((tlength-1)/2048+2)*2048; #else if ((pictime == 0) && (datatype == AUDIO)) needfillbuffer=1; if ((datatype == THUMBNAIL) || ((pictime == 0) && (datatype == AUDIO))) bufsize=((tlength-1)/2048+2)*2048; else bufsize=((length-1)/2048+2)*2048; #endif /* ^ we should have had 1 here if we knew strict file size. Although, we do not. All we know is the size of image data chunk, and the size of thumbnail data chunk. For now, we add extra 2048 in hope that extra JPEG data would not be more than that. If it is, the buffer will be automatically realloc()'ed anyway. */ if (bufsize) { buffer=malloc((size_t)bufsize); if (buffer == NULL) { fprintf(stderr,"could not alloc %lu bytes\n", (unsigned long)bufsize); return -1; } /*=== Stage 2: read data into the buffer ===*/ got=bufsize; #ifdef LOWMEMORY dreg=15; #else switch (datatype) { case THUMBNAIL: dreg=15; break; case IMAGE: dreg=14; break; case AUDIO: if (pictime) dreg=44; else dreg=15; break; } #endif if (eph_setint(iob,4,frame)) return -1; if (eph_getvar(iob,dreg,&buffer,&got)) { free(buffer); return -1; } if (!quiet) printf("\n"); } /*=== Stage 3: analyze data in the buffer ===*/ if (pictime == 0) { res=buffer; ressize=bufsize; a12scan(&res,&ressize); p=a12search("TimeDate",res,ressize); pictime=(time_t)-1; if (p) { if (sscanf(p,"%lu",&pictime) != 1) pictime=(time_t)-1; } if (debug) printf("got timestamp from file: %lu\n", pictime); } if (!quiet) { printf("taken %s\n",ctimetz(&pictime,usetimezone)); } /*=== Stage 4: setup output file ===*/ if (strcmp(filenm,"-") == 0) { fp=stdout; } else { if ((stat(filenm,&st) == 0) && (S_ISDIR(st.st_mode))) { int flen; flen=strlen(filenm)+MAXFORMAT+5; fname=malloc((size_t)flen); if (fname == NULL) { if (buffer) free(buffer); return -1; } makename(fname,flen,filenm,datatype,pictime, nameformat,usetimezone); if (!quiet) printf("file \"%s\"\n",fname); } else { fname=malloc(strlen(filenm)+1); if (fname == NULL) { if (buffer) free(buffer); return -1; } strcpy(fname,filenm); } if ((fp=fopen(fname,WRITEMODE)) == NULL) { perror(fname); if (fname) free(fname); fname=NULL; if (buffer) free(buffer); return -1; } } /*=== Stage 5: read data into the buffer or right out to file ===*/ #ifdef LOWMEMORY if (datatype != THUMBNAIL) { if (buffer) free(buffer); buffer=NULL; bufsize=0; #else if (needfillbuffer) { #endif /* we still need to read the data itself */ if (eph_setint(iob,4,frame)) return -1; /* seems that some Agfa model needs setting reg4 again */ dreg=(datatype==AUDIO)?44:14; /* cannot be thumbnail here */ got=bufsize; if (eph_getvar(iob,dreg,buffer?&buffer:NULL,&got)) { file_abort_cleanup(); free(buffer); return -1; } if (!quiet) printf("\n"); } /*=== Stage 6: write out the buffer contents */ #ifdef LOWMEMORY if (datatype == THUMBNAIL) #endif { /* data is still in the buffer, just write it out */ if (fwrite(buffer,(size_t)got,1,fp) != 1) { perror(fname); file_abort_cleanup(); free(buffer); return -1; } } if (fp) { if (fclose(fp) < 0) { perror(fname); } fp=NULL; } if (fname) { if (setutime) { if (setfiletime(fname,pictime,pictime,usetimezone)) perror("setfiletime"); } free(fname); fname=NULL; } if (buffer) free(buffer); return 0; } int image(eph_iob *iob,int argc,char *argv[]) { return retrfile(iob,argc,argv,IMAGE); } int thumbnail(eph_iob *iob,int argc,char *argv[]) { return retrfile(iob,argc,argv,THUMBNAIL); } int audio(eph_iob *iob,int argc,char *argv[]) { return retrfile(iob,argc,argv,AUDIO); } int preview(eph_iob *iob,int argc,char *argv[]) { FILE *fp=NULL; char *buffer=NULL; off_t bufsize; char zero=0; int rc=-1; bufsize=2048; buffer=malloc((size_t)bufsize); if (buffer == NULL) { fprintf(stderr,"could not alloc %lu bytes\n", (unsigned long)bufsize); goto exit; } if (strcmp(argv[1],"-") == 0) fp=stdout; else if ((fp=fopen(argv[1],WRITEMODE)) == NULL) { fprintf(stderr,"could not open file %s: %s\n", argv[1],strerror(ERRNO)); goto exit; } if (eph_action(iob,5,&zero,1)) goto exit; if (eph_setint(iob,4,0L)) goto exit; if (eph_getvar(iob,14,&buffer,&bufsize)) goto exit; if (fwrite(buffer,(size_t)bufsize,1,fp) != 1) { perror(fname); goto exit; } else rc=0; exit: if (buffer) free(buffer); if (fp && !(fp == stdout)) { if (fclose(fp) < 0) { perror(fname); } } return rc; } #ifndef LOWMEMORY int upload(eph_iob *iob,int argc,char *argv[]) { FILE *fp=NULL; char *buffer=NULL; struct stat stbuf; long res; char zero=0; int rc=-1; if (stat(argv[1],&stbuf)) { fprintf(stderr,"upload cannot stat file \"%s\": %s\n", argv[1],strerror(errno)); goto failure; } if ((fp=fopen(argv[1],READMODE)) == NULL) { fprintf(stderr,"upload cannot open file \"%s\": %s\n", argv[1],strerror(errno)); goto failure; } if (stbuf.st_size == (size_t)0) { fprintf(stderr,"upload file \"%s\" has zero length\n", argv[1]); goto failure; } buffer=(char*)malloc((size_t)stbuf.st_size); if (buffer == NULL) { fprintf(stderr,"upload cannot allocate %lu bytes: %s\n", (unsigned long)stbuf.st_size,strerror(errno)); goto failure; } if (fread(buffer,(size_t)stbuf.st_size,1,fp) != 1) { fprintf(stderr,"upload cannot read from %s: %s\n", argv[1],strerror(errno)); goto failure; } if (eph_getint(iob,28,&res)) { fprintf(stderr,"upload cannot get free memory\n"); goto failure; } if (res < stbuf.st_size) { fprintf(stderr,"upload free memory %lu less than file size%lu\n", res,(unsigned long)stbuf.st_size); goto failure; } if (eph_setint(iob,32,0x0FEC000E)) { fprintf(stderr,"upload cannot cast magic spell\n"); goto failure; } frame=0; filesize=stbuf.st_size; if (eph_setvar(iob,29,buffer,stbuf.st_size)) { if (!quiet) printf("\n"); fprintf(stderr,"upload cannot write image\n"); goto failure; } if (!quiet) printf("\n"); if (eph_action(iob,11,&zero,1)) { fprintf(stderr,"upload cannot store image\n"); goto failure; } rc=0; failure: if (buffer) free(buffer); if (fp) fclose(fp); return rc; } #endif /* LOWMEMORY */ int off(eph_iob *iob,int argc,char *argv[]) { switchoff=1; return 0; } /* -------------------------------------------------------------------- */ typedef struct _range { int max; char *bits; } range_t; static int setbit(range_t *range,int index) { register int pos,shift; if (index > range->max) { char *tmp; int newsize; newsize=(index/128+1)*16; tmp=(char *)malloc((size_t)newsize); if (tmp == NULL) return -1; memset(tmp,0,(size_t)newsize); memcpy(tmp,range->bits,(size_t)(range->max)/8); if (range->max) free(range->bits); range->bits=tmp; range->max=newsize*8; } pos=index/8; shift=index%8; range->bits[pos] |= (1< range->max)) return 0; pos=index/8; shift=index%8; return ((range->bits[pos]) & (1<max) free(range->bits); range->max=0; } int iterate(int (*executor)(eph_iob *iob,int argc,char *argv[]), eph_iob *iob,int argc,char *argv[],int intvl,int filearg) { int rc=0; long bot,top,i,step; char buf[16],*p,*intvlarg; struct stat st; range_t range; int reorder=0; if (intvl == 0) return (*executor)(iob,argc,argv); if (intvl < 0) { reorder=1; intvl=-intvl; range.max=0; } if (filearg && (strchr(argv[intvl],',') || strchr(argv[intvl],'-'))) { if (stat(argv[filearg],&st) || !S_ISDIR(st.st_mode)) { fprintf(stderr,"Must specify directory for range\n"); return -1; } } intvlarg=argv[intvl]; argv[intvl]=buf; /* it's a bad taste to modify arg vector, but we won't use this argument anymore, so who cares... */ for (p=strtok(intvlarg,",");p;p=strtok(NULL,",")) { if (strcasecmp(p,"all") == 0) { bot=1; top=-1; } else if (strcasecmp(p,"last") == 0) { bot=-1; top=-1; } else if ((strcasecmp(p+strlen(p)-5,"-last") == 0) && (sscanf(p,"%ld-last",&bot) == 1)) { top=-1; } else if (sscanf(p,"%ld-%ld",&bot,&top) == 2) { /* do nothing */ ; } else if (sscanf(p,"%ld",&bot) == 1) { top=bot; } else { fprintf(stderr,"bad frames interval \"%s\"\n",p); return -1; } if (top < 1) { if ((top=numphotos(iob)) < 0) { fprintf(stderr,"could not get number of frames\n"); return -1; } if (bot < 1) bot=top; if (!quiet) printf("Processing %ld-%ld\n",bot,top); if (top == 0) { if (!quiet) printf("No frames\n"); return 0; } } if (top >= bot) step=1; else step=-1; top+=step; for (i=bot;i!=top;i+=step) { if (reorder) { if (setbit(&range,i)) { fprintf(stderr,"no memory for range\n"); return -1; } } else { sprintf(buf,"%ld",i); if ((rc=(*executor)(iob,argc,argv))) return rc; } } } if (reorder) { for (i=range.max;i>0;i--) if (bitset(&range,i)) { sprintf(buf,"%ld",i); if ((rc=(*executor)(iob,argc,argv))) break; } freebits(&range); } return rc; } /* -------------------------------------------------------------------- */ struct _cmdlist { char *cmd; /* Command name */ int argc; /* No of args for this command */ int intvl; /* Which arg is frame number/range */ int filearg; /* Which arg is the file/directory name */ int (*executor)(eph_iob *iob,int argc,char *argv[]); char *help; } cmdlist[] = { {"", 0,0,0, NULL, "== Query parameters =="}, {"query", 0,0,0, query, "" }, {"count", 0,0,0, count, "" }, {"list", 0,0,0, list, "" }, {"llist", 0,0,0, llist, "" }, {"cd", 1,0,0, cd, "" }, {"geti", 1,0,0, geti, "-" }, {"getv", 1,0,0, getv, "-" }, {"camsum", 0,0,0, camsum, "-" }, {"picsum", 1,1,0, picsum, "-" }, {"allregs", 1,0,0, allregs, "-" }, {"", 0,0,0, NULL, "== Do some actions ==" }, {"protect", 2,1,0, protect, " `On' | `Off'"}, {"erase", 1,-1,0, erase, "" }, {"eraseall", 0,0,0, eraseall, "" }, {"eraselast", 0,0,0, eraselast, "" }, {"snapshot", 0,0,0, snapshot, "" }, {"off", 0,0,0, off, "" }, {"", 0,0,0, NULL, "== Retreive files ==" }, {"image", 2,1,2, image, " " }, {"thumbnail", 2,1,2, thumbnail, " " }, {"audio", 2,1,2, audio, " " }, {"preview", 1,0,0, preview, "" }, #ifndef LOWMEMORY {"", 0,0,0, NULL, "== Upload files ==" }, {"upload", 1,0,0, upload, "" }, #endif {"", 0,0,0, NULL, "== Set parameters ==" }, {"mode", 1,0,0, mode, "`Record' | `Play' | `Thumbnail' | `Next' | `Previous'"}, {"resolution", 1,0,0, resolution, "`Hi' | `Lo' | `Ext' | "}, {"clock", 0,0,0, setclock, "" }, {"shutter", 1,0,0, shutter, "`Auto' | | 1/"}, {"aperture", 1,0,0, aperture, "`Auto' | `Lo' | `Med' | `Hi'"}, {"flash", 1,0,0, flash, "`Auto' | `Force' | `Off' | `AntiRedeye' | `SlowSync'"}, {"id", 1,0,0, setid, "" }, {"autoshut-host",1,0,0, autoshut_host, "" }, {"autoshut-field",1,0,0,autoshut_field, "" }, {"lcd-autoshut",1,0,0, lcd_autoshut, "" }, {"lcd-brightness",1,0,0,lcd_brightness, "1 to 7" }, {"focus", 1,0,0, focus, "`Macro' | `Normal' | `Infinity'"}, {"adjust", 1,0,0, adjust, "`Normal' | `Contrast+' | `Contrast-' | `Brightness+' | `Brightness-'"}, {"metering", 1,0,0, metering, "`Center-weighted' | `Spot' | `Matrix'"}, {"whitebalance",1,0,0, whitebalance, "`Normal' | `Sunny' | `Incandescent' | `Fluorescent' | `Flash' | `Preset' | `Cloudy'" }, {"color", 1,0,0, color, "`On' | `Off'" }, {"dzoom", 1,0,0, dzoom, "`On' | `Off' | "}, {"zoom", 1,0,0, zoom, "" }, {"seti", 2,0,0, seti, "- "}, {"setv", 2,0,0, setv, "- "}, {"cmd", 2,0,0, cmd, "- " }, {"", 0,0,0, NULL, "" }, {NULL, 0,0,0, NULL, NULL } }; /* -------------------------------------------------------------------- */ void showhelp(char *name) { int i; printf("usage: %s [-h] [-V] [-v[v]] [-q] [-z] [-t] [-f timeformat] [-s speed] [-l device] [command [params]] ...\n\n",name); printf("Options:\n\n"); printf("\t-h\t- show this help screen\n"); printf("\t-V\t- show software version number\n"); printf("\t-v\t- increase debugging verbosity\n"); printf("\t-q\t- do not show running download indicator\n"); printf("\t-z\t- suppress timezone conversions (camera's clock is local time)\n"); printf("\t-t\t- set modification time of the files to the time of snapshot\n"); printf("\t-f fmt\t- create file names using strftime(3) with the time of snapshot\n"); printf("\t\t\t fmt = 'd' - name is seconds since the epoch in decimal\n"); printf("\t\t\t fmt = 'x' - name is seconds since the epoch in hex\n"); #ifdef HAVE_STRFTIME printf("\t\t\t fmt = '1' - name is MMDD_CCC (default)\n"); printf("\t\t\t fmt = '2' - name is YYMMDDCC\n"); printf("\t\t\t fmt = '3' - name is YYYY_MM_DD-HH_MM_SS\n"); printf("\t\t\t fmt = '4' - name is YYYY/MM/DD/HH_MM_SS\n"); printf("\t\t\t otherwise make file names using strftime(3),\n"); printf("\t\t\t if fmt contains `%%%%NNNd' then place count there\n"); #endif printf("\t-s baud\t- set communication speed to 9600,19200,38400,57600 or 115200\n"); printf("\t\t\tdefault is %d\n",MAX_SPEED); printf("\t-S baud,baud\t- set \"pseudo\" speed (see manual)\n"); printf("\t-l dev\t- use device name instead of default %s\n\n",device); printf("Commands:\n"); for (i=0;cmdlist[i].cmd;i++) { if (cmdlist[i].help[0] == '-') continue; printf("%-20.20s%s\n",cmdlist[i].cmd,cmdlist[i].help); } printf("EXAMPLE:\n%s id \"Eugene Crosser www.average.org\" query\n",name); } void showversion(char *name) { #ifdef UNIX #if HAVE_UNAME #define OS uts.sysname struct utsname uts; if (uname(&uts)) { strncpy(uts.sysname,"Unix",sizeof(uts.sysname)); uts.sysname[sizeof(uts.sysname)-1]='\0'; } #else #define OS "Generic UNIX" #endif #endif #ifdef DOS #define OS "MS-DOS" #endif #ifdef MSWINDOWS #define OS "Windows 95/NT" #endif #ifndef OS #define OS "Unknown OS" #endif printf("%s version %s (%s) build %s (%s memory model)\n", name,VERSION,OS,__DATE__, #ifdef LOWMEMORY "low" #else "normal" #endif ); printf(" Copyright (c) 1997-2001 Eugene Crosser and Bruce Lightner\n"); printf(" URL: http://www.average.org/digicam/\n"); } int main(int argc,char *argv[]) { int c,i,rc=0; char *cmd; long speed=0L,ttspeed=0L,defttspeed=0L; eph_iob *iob; char *program = argv[0]; #ifdef MS_PROGRAM_NAMES char *q; /* remove program extension */ if ((q = strrchr(program, '.')) != NULL) *q = '\0'; /* remove directory */ if ((q = strrchr(program, '/')) != NULL) program = q + 1; if ((q = strrchr(program, '\\')) != NULL) program = q + 1; #endif #if HAVE_SCHED_SETSCHEDULER && USE_RTPRIO if (geteuid() == 0) { /* Try to set realtime priority */ struct sched_param sp; int rc,minp,maxp; minp=sched_get_priority_min(SCHED_FIFO); maxp=sched_get_priority_max(SCHED_FIFO); sp.sched_priority=minp+(maxp-minp)/2; if ((rc=sched_setscheduler(0,SCHED_FIFO,&sp)) == -1) fprintf(stderr,"failed to set realtime priority: %s\n", strerror(errno)); #if 0 if ((rc=sched_getscheduler(0)) == -1) fprintf(stderr,"getscheduler: %s\n",strerror(errno)); else if (sched_getparam(0,&sp) == -1) fprintf(stderr,"sched_getparm: %s\n", strerror(errno)); else printf("New scheduling policy: %d, prio %d\n", rc,sp.sched_priority); #endif /* Drop supervisor privelege */ (void)seteuid(getuid()); } #endif /* HAVE_SCHED_SETSCHEDULER */ #ifdef DEVVERSION printf("Dev ver: %s\n",rcsid); #endif while ((c=getopt(argc,argv,"l:s:S:f:vqhVzt")) != EOF) switch (c) { case 'l': device=optarg; break; case 's': /* real speed, physical in the line, tell the camera about it. */ speed=atol(optarg); break; case 'S': /* `pseudo' speed, tell this to the UNIX serial driver so that it will set real speed on the chip */ if (sscanf(optarg,"%ld,%ld",&defttspeed,&ttspeed) != 2) { fprintf(stderr,"bad `-S' setting, ignoring\n"); ttspeed=defttspeed=0L; } break; case 'f': nameformat=optarg; break; case 'v': debug++; break; case 'q': quiet=1; break; case 'h': showhelp(program); return 0; case 'V': showversion(program); return 0; case 'z': usetimezone=0; break; case 't': setutime=1; break; default: fprintf(stderr," run \"%s -h\" for help\n",program); return 1; } #ifdef DOS /* MS/DOS has silly assumptions about the timezone if TZ variable is not set. Hope the following will help in most cases, the results should be at least predictable... */ if (getenv("TZ") == NULL) { putenv("TZ=GMT0"); usetimezone = 0; } #endif tzset(); #ifndef UNIX /* Under DOS and Win32, usleep() is done with a local function that does self-calibration on first invokation. That's why the first call may cause overly big delay and break negotiation with the camera. */ usleep(0L); /* calibrate delay loops as required */ #endif #ifdef LOWMEMORY if (atexit(file_abort_cleanup) == -1) perror("error setting atexit function"); #endif #ifdef UNIX if (*device != '/') { char *p; p=device; device=malloc(strlen("/dev/")+strlen(p)+1); strcpy(device,"/dev/"); strcat(device,p); } #endif iob=eph_new(reporterror,NULL,running,storing,debug); if (!iob) { fprintf(stderr,"eph_new failed\n"); return 1; } if (eph_open(iob,device,speed,defttspeed,ttspeed)) { fprintf(stderr,"eph_open failed\n"); return 1; } if ((rc=init(iob))) { fprintf(stderr,"init failed\n"); goto exit; } while ((cmd=argv[optind])) { if (switchoff) { fprintf(stderr,"commands after \"off\" ignored\n"); goto exit; } for (i=0; cmdlist[i].cmd&&strcmp(cmd,cmdlist[i].cmd); i++) /* nothing */ ; if (cmdlist[i].cmd == NULL) { fprintf(stderr,"bad command \"%s\" ignored,",cmd); fprintf(stderr," run \"%s -h\" for help\n",program); optind++; continue; } if ((optind + cmdlist[i].argc) >= argc) { fprintf(stderr,"too few arguments for \"%s\" command\n",cmd); rc=1; goto exit; } if ((rc=iterate(cmdlist[i].executor, iob, cmdlist[i].argc+1, argv+optind, cmdlist[i].intvl, cmdlist[i].filearg))) { fprintf(stderr,"command \"%s\" failed, abort\n",cmd); goto exit; } optind+=cmdlist[i].argc; optind++; } exit: /* On older models, action 04 with zero parameter terminates session but leaves the camera ON. On Olympus 600 (at least) this command not only terminates session but also turns the camera off. So, the "off" command will turn off newer models and *just* terminate session more quickly on older. You may want to terminate the command array by "off" on models like PhotoPC 600 to decrease power consumption when the session is over. */ eph_close(iob,switchoff); eph_free(iob); return rc; } photopc-3.05/a12scan.c 644 2627 62 6101 6751646616 7610 #ifndef LINT static char *rcsid="$Id: a12scan.c,v 1.13 1999/08/01 21:36:54 crosser Exp $"; #endif /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: a12scan.c,v $ Revision 1.13 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 1.12 1999/03/10 22:34:43 crosser make app12 and exif scanning in different files Revision 1.11 1999/03/06 13:37:08 crosser Convert to autoconf-style Revision 1.10 1999/03/06 10:24:16 crosser support Exif Revision 1.9 1999/02/28 22:40:48 crosser Support Exif file format Revision 1.8 1998/11/20 20:14:27 crosser scan APP12 block without vendor name section Revision 1.7 1998/11/19 11:04:31 crosser do cleaner if "not found" Revision 1.6 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 1.5 1998/08/08 22:16:33 crosser Make jscan return the complete app12 contents, don't skip vendor info Revision 1.4 1998/02/08 19:58:38 crosser Support low memory: chunked saving etc. Revision 1.3 1998/01/18 02:16:45 crosser DOS support Revision 1.2 1997/12/24 00:19:13 crosser check return value from jscan Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #ifdef STDC_HEADERS #include #include #endif #include "a12scan.h" int a12scan(unsigned char **buf,off_t *bufsize) { unsigned char *p; off_t length=0; p=*buf; while (p < ((*buf)+(*bufsize))) { while ((p < ((*buf)+(*bufsize))) && (*p != 0xff)) p++; while ((p < ((*buf)+(*bufsize))) && (*p == 0xff)) p++; if (*p == 0xD8) continue; length=(p[1]<<8)+p[2]; if (*p == 0xec) { p+=3; length-=3; break; } p+=length; } if (p >= ((*buf)+(*bufsize))) { (*bufsize)=0; (*buf)=NULL; return -1; } (*bufsize)=length; (*buf)=p; return 0; } unsigned char * a12search(char *key,unsigned char *buf,off_t bufsize) { unsigned char *p=buf; /* skip company name which is model-dependant */ while ((p < (buf+bufsize)) && (*p)) p++; while ((p < (buf+bufsize)) && (*p == '\0')) p++; if (p >= (buf+bufsize)) p=buf; while (p < (buf+bufsize)) { if (strncmp(p,key,strlen(key)) == 0) break; while ((p < (buf+bufsize)) && (*p != '\n')) p++; p++; } if (p >= (buf+bufsize)) return NULL; if (*(p+strlen(key)) != '=') return NULL; return p+strlen(key)+1; } void a12dump(unsigned char *buf,off_t bufsize) { unsigned char *p=buf; printf("%s\n",p); while ((p < (buf+bufsize)) && (*p)) p++; while ((p < (buf+bufsize)) && (*p == '\0')) p++; printf("%s\n",p); } photopc-3.05/a12scan.h 644 2627 62 2523 6751646622 7616 /* $Id: a12scan.h,v 2.3 1999/03/10 22:34:43 crosser Exp $ */ /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: a12scan.h,v $ Revision 2.3 1999/03/10 22:34:43 crosser make app12 and exif scanning in different files Revision 2.2 1999/02/28 22:40:48 crosser Support Exif file format Revision 2.1 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.0 1998/02/13 23:01:13 crosser define type off_t for DOS Revision 1.3 1998/02/08 19:58:38 crosser Support low memory: chunked saving etc. Revision 1.2 1998/01/18 02:16:45 crosser DOS support Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifndef _A12SCAN_H #define _A12SCAN_H #define MAXJPREFIX 8192L #ifdef DOS typedef long off_t; #endif int a12scan(unsigned char **buf,off_t *bufsize); unsigned char *a12search(char *key,unsigned char *buf,off_t bufsize); void a12dump(unsigned char *buf,off_t bufsize); #endif photopc-3.05/fnames.c 644 2627 62 14046 7227253625 7651 #ifndef LINT static char *rcsid="$Id: fnames.c,v 1.7 2001/01/11 06:49:57 crosser Exp $"; #endif /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: fnames.c,v $ Revision 1.7 2001/01/11 06:49:57 crosser minor cleanups on source make manual page in sync with the source Revision 1.6 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 1.5 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 1.4 1999/03/27 23:52:29 crosser remove old check for valid pictm because it's not needed with gltimetz Revision 1.3 1999/03/22 05:59:31 lightner Include for Win32 compile Use gltimetz() instead of gmtime()/localtime() Revision 1.2 1999/03/10 22:34:43 crosser clenup Revision 1.1 1999/03/09 18:36:34 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #include #include "fnames.h" #include "ctimez.h" #if defined(MSWINDOWS) #include #endif #ifdef MSWINDOWS #define MS_PROGRAM_NAMES #define ERRNO GetLastError() #else #define ERRNO errno #endif static char *shortcut[][4] = { { "%m%d_%%03d.jpg", "%y%m%d%%02d.jpg", "%Y_%m_%d-%H_%M_%S.jpg", "%Y/%m/%d/%H_%M_%S.jpg" }, { "%m%d-%%03d.jpg", "%y%m%d%%02d.jpt", /* this is not a typo */ "%Y_%m_%d-%H_%M_%S-t.jpg", "%Y/%m/%d/%H_%M_%S-t.jpg" }, { "%m%d_%%03d.wav", "%y%m%d%%02d.wav", "%Y_%m_%d-%H_%M_%S.wav", "%Y/%m/%d/%H_%M_%S.wav" } }; #define MAXSHORTCUT '4' static int ftype=0; void makename(char *fname,int flen,char *filenm,int datatype, time_t pictime,char *nameformat,int usetimezone) { int count; struct stat st; struct tm *pictm; int hascount=0; int width=0; int maxcount; char *ifslash; char *p; if ((filenm[0] == '\0') || (filenm[strlen(filenm)-1] == '\\') || (filenm[strlen(filenm)-1] == '/' )) { ifslash=""; } else { ifslash="/"; } pictm=gltimetz(&pictime,usetimezone); if (nameformat) { if (strlen(nameformat) == 1) { if (*nameformat == 'd') { ftype=1; nameformat="%010lu"; } else if (*nameformat == 'x') { ftype=1; nameformat="%08lx"; #ifdef HAVE_STRFTIME } else if ((*nameformat >= '1') && (*nameformat <= MAXSHORTCUT)) { ftype=2; nameformat= shortcut[datatype][(*nameformat)-'1']; #endif } else { fprintf(stderr, "invalid shortcut `-f %c', using default\n", *nameformat); nameformat=NULL; } } else { #ifdef HAVE_STRFTIME ftype=2; #else fprintf(stderr, "format `-f %s' unsupported, using default\n", nameformat); nameformat=NULL; #endif } } if (nameformat && (ftype == 2)) { /* see if there is a field for count */ enum {deflt,escaped,pc1,pc2,digit} state=deflt; for (p=nameformat;*p;p++) switch (state) { case deflt: switch (*p) { case '\\': state=escaped; break; case '%': state=pc1; break; default: state=deflt; break; } break; case escaped: state=deflt; break; case pc1: switch (*p) { case '%': state=pc2; break; default: state=deflt; break; } break; case pc2: if ((*p >= '0') && (*p <= '9')) { state=digit; width*=10; width+=(*p-'0'); } else state=deflt; break; case digit: if ((*p >= '0') && (*p <= '9')) { state=digit; width*=10; width+=(*p-'0'); } else state=deflt; if (*p == 'd') hascount++; break; } } if (hascount > 1) { fprintf(stderr,"bad `-f %s' option: more than one count fields\n", nameformat); hascount=0; width=0; } if (hascount && ((width < 1) || (width > 8))) { fprintf(stderr,"bad count field width in `-f %s' option\n", nameformat); hascount=0; width=0; } switch (width) { case 1: maxcount=10; break; case 2: maxcount=100; break; default: maxcount=1000; break; } for (count=1;counttm_mon+1, pictm->tm_mday, (datatype==THUMBNAIL)?"-":"_", count, (datatype==AUDIO)?"wav":"jpg"); if ((stat(fname,&st) < 0) && (ERRNO == ENOENT)) { break; } } else if (ftype == 1) { char timestr[MAXFORMAT+1]; char ext[5]; sprintf(timestr,nameformat,pictime); if (count == 1) ext[0]='\0'; else sprintf(ext,".%03d",count-1); sprintf(fname,"%s%s%s%s", filenm, ifslash, timestr, ext); if ((stat(fname,&st) < 0) && (ERRNO == ENOENT)) { break; } #ifdef HAVE_STRFTIME } else if (ftype == 2) { char timestr[MAXFORMAT+1]; char timestr2[MAXFORMAT+1]; char ext[5]; if (hascount) { (void)strftime(timestr2,(size_t)MAXFORMAT-width, nameformat,pictm); sprintf(timestr,timestr2,count); } else { (void)strftime(timestr,MAXFORMAT, nameformat,pictm); } if ((hascount) || (count == 1)) ext[0]='\0'; else sprintf(ext,".%03d",count-1); sprintf(fname,"%s%s%s%s", filenm, ifslash, timestr, ext); if ((stat(fname,&st) < 0) && (ERRNO == ENOENT)) { break; } #endif /* HAVE_STRFTIME */ } } /* Just for case (we should not have overwritten the buffer) */ fname[flen-1]='\0'; /* OK, now time to create intermediate directories */ #ifdef HAVE_MKDIR for (p=fname+strlen(filenm);*p;p++) if (*p == '/') { *p='\0'; (void)mkdir(fname,0777); *p='/'; } #endif } photopc-3.05/fnames.h 644 2627 62 1634 6751646755 7650 /* $Id: fnames.h,v 1.2 1999/03/10 22:34:43 crosser Exp $ */ /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: fnames.h,v $ Revision 1.2 1999/03/10 22:34:43 crosser clenup Revision 1.1 1999/03/09 18:36:34 crosser Initial revision */ #ifndef FNAMES_H #define FNAMES_H #define MAXFORMAT 200 /* datatype values */ #define IMAGE 0 #define THUMBNAIL 1 #define AUDIO 2 void makename(char *fname,int flen,char *filenm,int datatype, time_t pictime,char *nameformat,int usetimezone); #endif photopc-3.05/ctimez.c 644 2627 62 6611 7012110012 7620 #ifndef LINT static char *rcsid="$Id: ctimez.c,v 1.7 1999/11/09 18:55:03 crosser Exp $"; #endif /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: ctimez.c,v $ Revision 1.7 1999/11/09 18:55:03 crosser work on windows version Revision 1.6 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 1.5 1999/03/27 23:47:05 crosser cosmetic Revision 1.4 1999/03/22 05:59:31 lightner Add gltimetz() routine for Win32 localtime/gmtime() NULL pointer returns Revision 1.3 1999/03/12 23:22:30 crosser clean zone handling Revision 1.2 1999/03/10 22:34:43 crosser notimezone -> usetimezone Revision 1.1 1999/03/09 18:30:22 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #include "ctimez.h" struct tm * gltimetz(time_t *clock,int usetimezone) { struct tm *tm; static struct tm null_tm; if (usetimezone) tm=localtime(clock); else tm=gmtime(clock); if (!tm) { /* Windows can return NULL!! */ null_tm.tm_sec = 0; /* Seconds after minute (0-59) */ null_tm.tm_min = 0; /* Minutes after hour (0-59) */ null_tm.tm_hour = 0; /* Hours since midnight (0-23) */ null_tm.tm_mday = 1; /* Day of month (1-31) */ null_tm.tm_mon = 0; /* Month (0-11; January=0) */ null_tm.tm_year = 0; /* Year (current year minus 1900) */ null_tm.tm_wday = 1; /* Day of week (0-6; Sunday=0) */ null_tm.tm_yday = 0; /* Day of year (0-365; January 1=0) */ null_tm.tm_isdst = 0; /* Always 0 for gmtime */ tm = &null_tm; } return tm; } char * ctimetz(time_t *clock,int usetimezone) { static char tmbuf[80]; struct tm *camtm; char *timefmt; if ((*clock) == (time_t)-1) { strcpy(tmbuf,"N/A"); return tmbuf; } camtm=gltimetz(clock,usetimezone); #ifdef HAVE_STRFTIME if (usetimezone) timefmt="%a %b %d %H:%M:%S %Y %Z"; else timefmt="%a %b %d %H:%M:%S %Y"; (void)strftime(tmbuf,sizeof(tmbuf),timefmt,camtm); #else strncpy(tmbuf,asctime(camtm),sizeof(tmbuf)); tmbuf[sizeof(tmbuf)-1]='\0'; /* paranoia */ tmbuf[strlen(tmbuf)-1]='\0'; /* remove newline */ #endif return tmbuf; } time_t zoneoffset(time_t now) { #ifndef HAVE_TM_GMTOFF struct tm gtm; time_t offset; #endif struct tm ltm; ltm=*localtime(&now); #ifdef HAVE_TM_GMTOFF return ltm.tm_gmtoff; #else /* Compute timezone difference in seconds. This is the difference between gmtime() and locatime() return values. */ gtm=*gmtime(&now); /* Assume we are never more than 24 hours away. */ offset=gtm.tm_yday-ltm.tm_yday; if (offset > 1) offset=-24; else if (offset < -1) offset=24; else offset*=24; offset+=gtm.tm_hour-ltm.tm_hour; offset*=60; offset+=gtm.tm_min-ltm.tm_min; offset*=60; offset+=gtm.tm_sec-ltm.tm_sec; return -offset; #endif } photopc-3.05/ctimez.h 644 2627 62 1750 6751646655 7670 /* $Id: ctimez.h,v 1.4 1999/03/22 05:59:31 lightner Exp $ */ /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: ctimez.h,v $ Revision 1.4 1999/03/22 05:59:31 lightner Add prototype for gltimetz() Revision 1.3 1999/03/12 23:22:30 crosser clean zone handling Revision 1.2 1999/03/10 22:34:43 crosser notimezone -> usetimezone Revision 1.1 1999/03/09 18:30:22 crosser Initial revision */ #ifndef CTIMEZ_H #define CTIMEZ_H struct tm *gltimetz(time_t *clock,int usetimezone); char *ctimetz(time_t *clock,int usetimezone); time_t zoneoffset(time_t now); #endif photopc-3.05/filetime.c 644 2627 62 6532 7024455507 10155 #ifndef LINT static char *rcsid="$Id: filetime.c,v 1.7 1999/12/11 14:10:15 crosser Exp $"; #endif /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: filetime.c,v $ Revision 1.7 1999/12/11 14:10:15 crosser Support sgtty terminal control Proper "fake speed" handling (needed two values) Revision 1.6 1999/10/09 10:52:47 crosser make filetime honor usetimezone flag. set reg4 in every place (I hope) before other registers are used that depend on the frame number. Revision 1.5 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 1.4 1999/03/22 05:59:31 lightner Use gltimetz() instead of gmtime()/localtime() Revision 1.3 1999/03/12 23:22:30 crosser support windows Revision 1.2 1999/03/12 10:06:23 crosser make it work under unix and dos (no windows yet) Revision 1.1 1999/03/11 22:57:35 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef DOS # include # include #else # ifdef HAVE_UTIME_H # include # endif # ifdef HAVE_SYS_UTIME_H # include # endif #endif #include "ctimez.h" #ifndef HAVE_UTIMBUF struct utimbuf { time_t actime; time_t modtime; }; #endif int setfiletime(char *fname,time_t actime,time_t mtime,int usetimezone) { #ifdef DOS int fd,rc; struct tm *ptm; #ifdef __TURBOC__ struct ftime ft; #else unsigned short dosdate,dostime; #endif /* yr = ((lrec.last_mod_file_date >> 9) & 0x7f) + (1980 - YRBASE); mo = ((lrec.last_mod_file_date >> 5) & 0x0f) - 1; dy = (lrec.last_mod_file_date & 0x1f) - 1; hh = (lrec.last_mod_file_time >> 11) & 0x1f; mm = (lrec.last_mod_file_time >> 5) & 0x3f; ss = (lrec.last_mod_file_time & 0x1f) * 2; */ if ((fd=open(fname,O_RDWR)) == -1) return -1; ptm=gltimetz(&mtime,usetimezone); #ifdef __TURBOC__ ft.ft_tsec=ptm->tm_sec/2; ft.ft_min=ptm->tm_min; ft.ft_hour=ptm->tm_hour; ft.ft_day=ptm->tm_mday; ft.ft_month=ptm->tm_mon+1; ft.ft_year=ptm->tm_year-80; rc=setftime(fd,&ft); #else dosdate=(ptm->tm_year-80)<<9; dosdate|=(ptm->tm_mon+1)<<5; dosdate|=(ptm->tm_mday); dostime=(ptm->tm_hour)<<11; dostime|=(ptm->tm_min)<<5; dostime|=(ptm->tm_sec/2); asm("movl %0, %%ebx": : "g" (fd)); asm("movl %0, %%ecx": : "g" (dostime)); asm("movl %0, %%edx": : "g" (dosdate)); asm("movl $0x5701, %eax"); asm("int $0x21": : : "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi"); asm("movl %%eax, %0": : "g" (rc)); #endif close(fd); return rc; #else /* UNIX or Windows */ struct utimbuf utb; if (!usetimezone) { actime-=zoneoffset(actime); mtime-=zoneoffset(mtime); } utb.actime=actime; utb.modtime=mtime; return utime(fname,&utb); #endif } photopc-3.05/filetime.h 644 2627 62 1341 6751646752 10165 /* $Id: filetime.h,v 1.1 1999/03/11 22:57:35 crosser Exp $ */ /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: filetime.h,v $ Revision 1.1 1999/03/11 22:57:35 crosser Initial revision */ #ifndef FILETIME_H #define FILETIME_H int setfiletime(char *fname,time_t actime,time_t mtime,int usetimezone); #endif photopc-3.05/exifscan.c 644 2627 62 21100 7106010266 10151 #ifndef LINT static char *rcsid="$Id: exifscan.c,v 1.5 2000/05/09 13:20:54 crosser Exp $"; #endif /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: exifscan.c,v $ Revision 1.5 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 1.4 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 1.3 1999/03/12 10:06:23 crosser avoid strncmp Revision 1.2 1999/03/10 22:34:43 crosser separate from app12 scan Revision 1.1 1999/03/09 18:19:39 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #ifdef STDC_HEADERS #include #include #endif #include "exifscan.h" int exifscan(unsigned char **buf,off_t *bufsize) { unsigned char *p; off_t length=0; p=*buf; while (p < ((*buf)+(*bufsize))) { while ((p < ((*buf)+(*bufsize))) && (*p != 0xff)) p++; while ((p < ((*buf)+(*bufsize))) && (*p == 0xff)) p++; if (*p == 0xD8) continue; length=(p[1]<<8)+p[2]; if ((*p == 0xe1) && (strcasecmp(p+3,"Exif")==0)) { p+=3; length-=3; break; } p+=length; } if (p >= ((*buf)+(*bufsize))) { (*bufsize)=0; (*buf)=NULL; return -1; } (*bufsize)=length; (*buf)=p; return 0; } static struct _exifdict { int tag; char *name; } exifdict[] = { {0xFE, "NewSubFileType"}, {0x100, "ImageWidth"}, {0x101, "ImageLength"}, {0x102, "BitsPerSample"}, {0x103, "Compression"}, {0x106, "PhotometricInterpretation"}, {0x10A, "FillOrder"}, {0x10D, "DocumentName"}, {0x10E, "ImageDescription"}, {0x10F, "Make"}, {0x110, "Model"}, {0x111, "StripOffsets"}, {0x112, "Orientation"}, {0x115, "SamplesPerPixel"}, {0x116, "RowsPerStrip"}, {0x117, "StripByteCounts"}, {0x11A, "XResolution"}, {0x11B, "YResolution"}, {0x11C, "PlanarConfiguration"}, {0x128, "ResolutionUnit"}, {0x12D, "TransferFunction"}, {0x131, "Software"}, {0x132, "DateTime"}, {0x13B, "Artist"}, {0x13E, "WhitePoint"}, {0x13F, "PrimaryChromaticities"}, {0x156, "TransferRange"}, {0x200, "JPEGProc"}, {0x201, "JPEGInterchangeFormat"}, {0x202, "JPEGInterchangeFormatLength"}, {0x211, "YCbCrCoefficients"}, {0x212, "YCbCrSubSampling"}, {0x213, "YCbCrPositioning"}, {0x214, "ReferenceBlackWhite"}, {0x828D, "CFARepeatPatternDim"}, {0x828E, "CFAPattern"}, {0x828F, "BatteryLevel"}, {0x8298, "Copyright"}, {0x829A, "ExposureTime"}, {0x829D, "FNumber"}, {0x83BB, "IPTC/NAA"}, {0x8769, "ExifOffset"}, {0x8773, "InterColorProfile"}, {0x8822, "ExposureProgram"}, {0x8824, "SpectralSensitivity"}, {0x8825, "GPSInfo"}, {0x8827, "ISOSpeedRatings"}, {0x8828, "OECF"}, {0x9000, "ExifVersion"}, {0x9003, "DateTimeOriginal"}, {0x9004, "DateTimeDigitized"}, {0x9101, "ComponentsConfiguration"}, {0x9102, "CompressedBitsPerPixel"}, {0x9201, "ShutterSpeedValue"}, {0x9202, "ApertureValue"}, {0x9203, "BrightnessValue"}, {0x9204, "ExposureBiasValue"}, {0x9205, "MaxApertureValue"}, {0x9206, "SubjectDistance"}, {0x9207, "MeteringMode"}, {0x9208, "LightSource"}, {0x9209, "Flash"}, {0x920A, "FocalLength"}, {0x927C, "MakerNote"}, {0x9286, "UserComment"}, {0x9290, "SubSecTime"}, {0x9291, "SubSecTimeOriginal"}, {0x9292, "SubSecTimeDigitized"}, {0xA000, "FlashPixVersion"}, {0xA001, "ColorSpace"}, {0xA002, "ExifImageWidth"}, {0xA003, "ExifImageLength"}, {0xA005, "InteroperabilityOffset"}, {0xA20B, "FlashEnergy"}, {0xA20C, "SpatialFrequencyResponse"}, {0xA20E, "FocalPlaneXResolution"}, {0xA20F, "FocalPlaneYResolution"}, {0xA210, "FocalPlaneResolutionUnit"}, {0xA214, "SubjectLocation"}, {0xA215, "ExposureIndex"}, {0xA217, "SensingMethod"}, {0xA300, "FileSource"}, {0xA301, "SceneType"}, {0, NULL} }; static int typlens[] = {1,1,2,4,8,1,1,2,4,8}; static int s2n_intel(unsigned char *data,int length,int sign) { int i,msb,val=0; for (i=0;i buflen) { if (buf) free(buf); buf=(unsigned char*)malloc((size_t)len); } if (buf == NULL) return ""; sprintf(buf,"\"%s\"",data+offset); } else { int k; int sig; len=count*22+3; if (len > buflen) { if (buf) free(buf); buf=(unsigned char*)malloc((size_t)len); } if (buf == NULL) return ""; buf[0]='\0'; if ((typ == 6) || (typ >= 8)) sig=1; else sig=0; if (count > 1) sprintf(buf,"("); for (k=0;k 1) sprintf(buf+strlen(buf),")"); } return buf; } static unsigned char * exifmatch(unsigned char *data,int offset,int tag, int typ,int typlen,int count,void *priv) { int i; int needtag=0; unsigned char *rc; for (i=0;exifdict[i].tag;i++) { if (strcmp(exifdict[i].name,(char*)priv) == 0) { needtag=exifdict[i].tag; break; } } if (tag == 0x8769) { rc=exifwalk(data,offset,exifmatch,priv); if (rc) return rc; } else if (tag == 0xA005) { rc=exifwalk(data,offset,exifmatch,priv); if (rc) return rc; } if (needtag == tag) return exifstr(data,offset,tag,typ,typlen,count); else return NULL; } static unsigned char * exifprt(unsigned char *data,int offset,int tag, int typ,int typlen,int count,void *priv) { unsigned char *rc; int i; char *tagname=NULL,badtag[32]; for (i=0;exifdict[i].tag;i++) { if (exifdict[i].tag == tag) { tagname=exifdict[i].name; break; } } if (tagname == NULL) { sprintf(badtag,"TAG#%d",tag); tagname=badtag; } if (tag == 0x8769) { printf("\n"); rc=exifwalk(data,offset,exifprt,priv); printf("\n"); if (rc) return rc; } else if (tag == 0xA005) { printf("\n"); rc=exifwalk(data,offset,exifprt,priv); printf("\n"); if (rc) return rc; } else { printf("%s=%s\n",tagname, exifstr(data,offset,tag,typ,typlen,count)); } return NULL; } static unsigned char * exifwalk(unsigned char *data,int where, unsigned char *(*each)( unsigned char *data,int offset,int tag, int typ,int typlen,int count,void *priv), void *priv) { unsigned char *rc=NULL; int i; if (where == 0) { switch (data[0]) { case 'I': s2n=s2n_intel; break; case 'M': s2n=s2n_motorola; break; default: return NULL; } where=S2N(data+4,4,0); } else where=S2N(data+where,4,0); for (i=where;i;i=S2N(data+i+2+(12*S2N(data+i,2,0)),4,0)) { int ifsnum=S2N(data+i,2,0); int j; for (j=0;j 10)) continue; typlen=typlens[typ-1]; count=S2N(data+entry+4,4,0); offset=entry+8; if (count*typlen > 4) offset=S2N(data+offset,4,0); if ((rc=(*each)(data,offset,tag,typ, typlen,count,priv))) return rc; } } return NULL; } unsigned char * exifsearch(char *key,unsigned char *buf,off_t bufsize) { if (buf == NULL) return NULL; return exifwalk(buf+6,0,exifmatch,(void*)key); } void exifdump(unsigned char *buf,off_t bufsize) { if (buf == NULL) return; exifwalk(buf+6,0,exifprt,NULL); } photopc-3.05/exifscan.h 644 2627 62 1553 6751646751 10173 /* $Id: exifscan.h,v 1.1 1999/03/09 18:19:39 crosser Exp $ */ /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: exifscan.h,v $ Revision 1.1 1999/03/09 18:19:39 crosser Initial revision */ #ifndef _EXIFSCAN_H #define _EXIFSCAN_H #ifdef DOS typedef long off_t; #endif int exifscan(unsigned char **buf,off_t *bufsize); unsigned char *exifsearch(char *key,unsigned char *buf,off_t bufsize); void exifdump(unsigned char *buf,off_t bufsize); #endif photopc-3.05/comio.c 644 2627 62 37220 6751646651 7513 #ifndef LINT static char *rcsid="$Id: comio.c,v 1.3 1998/10/18 13:18:27 crosser Exp $"; #endif /* $Log: comio.c,v $ Revision 1.3 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 1.2 1998/08/01 13:12:41 lightner Four com ports support Revision 1.1 1998/01/18 02:16:45 crosser Initial revision */ #include #include #define MDMDAT1 0x03F8 /* Address of modem port 1 data */ #define MDMCOM1 0x03FB /* Address of modem port 1 command */ #define MDMSTS1 0x03FD /* Address of modem port 1 status */ #define MDMDAT2 0x02F8 /* Address of modem port 2 data */ #define MDMCOM2 0x02FB /* Address of modem port 2 command */ #define MDMSTS2 0x02FD /* Address of modem port 2 status */ #define MDMDAT3 0x03E8 /* Address of modem port 3 data */ #define MDMCOM3 0x03EB /* Address of modem port 3 command */ #define MDMSTS3 0x03ED /* Address of modem port 3 status */ #define MDMDAT4 0x02E8 /* Address of modem port 4 data */ #define MDMCOM4 0x02EB /* Address of modem port 4 command */ #define MDMSTS4 0x02ED /* Address of modem port 4 status */ #define MDMINTV 0x000C /* Com 1 interrupt vector */ #define MDINTV2 0x000B /* Com 2 interrupt vector */ #define MDMINTO 0x0EF /* Mask to enable IRQ3 for port 1 */ #define MDINTO2 0x0F7 /* Mask to enable IRQ4 for port 2 */ #define MDMINTC 0x010 /* Mask to Disable IRQ4 for port 1 */ #define MDINTC2 0x008 /* Mask to Disable IRQ3 for port 2 */ #define INTCONT 0x0021 /* 8259 interrupt controller ICW2-3 */ #define INTCON1 0x0020 /* Address of 8259 ICW1 */ #define COM_BUFF_SIZE 2048 /* Communications port buffer size */ #define XOFFPT COM_BUFF_SIZE*3/4 /* chars in buff before sending XOFF */ #define XONPT COM_BUFF_SIZE*1/4 /* chars in buff to send XON after XOFF */ #define XOFF 0x13 /* XOFF value */ #define XON 0x11 /* XON value */ /*****************************************************************************/ /* function prototypes */ void TTinit(int port, long speed);/* Initialize the communications system */ int ttopen(); /* Open a port for communications */ int ttclose( void ); /* Close the communications port */ int ttchk( void ); /* Return count of received characters */ void ttoc( unsigned char ); /* Output a character to the com port */ int ttinc( void ); /* Input a character from circular buffer */ void ttflui( void ); /* Flush circular buffer of characters */ int dobaud( long ); /* Set the baud rate for the port */ void coms( int ); /* Establish modem data */ void serini( void ); /* Initialize the com port for interrupts */ void serrst( void ); /* Reset the com port to original settings */ void interrupt serint( void ); /* Com port receiver ISR */ /*****************************************************************************/ /* Global Data */ unsigned int port; /* COM port */ long speed; /* BAUD rate */ char parity[5]; /* Parity setting */ unsigned int databits; /* Number of Data bits */ unsigned int stopbits; /* Number of Stop bits */ /*****************************************************************************/ /* External variables */ /*****************************************************************************/ /* Local Static Data */ static char buffer[COM_BUFF_SIZE];/* Circular buffer */ static char *inptr; /* Pointer to input point of circular buff*/ static char *outptr; /* Pointer to output point of circular buff*/ static int count = 0; /* Number of characters in buffer */ struct mdminfo { /* struct to hold current com port info */ unsigned int mddat; /* 8250 data register */ unsigned int mdstat; /* 8250 line-status register */ unsigned int mdcom; /* 8250 line-control register */ unsigned char mden; /* 8259 IRQ enable mask */ unsigned char mddis; /* 8259 IRQ disable mask */ unsigned char mdintv; /* Interrupt for selected com port */ } modem ; void interrupt (*oldvec)(); /* Vector of previous com interrupt */ int portin = 0; /* Flag to indicate com port is open */ int xofsnt = 0; /* Flag to indicate an XOFF transmitted */ int xofrcv = 0; /* Flag to indicate an XOFF received */ /*****************************************************************************/ /* T T I N I T -- Initialize the communications system */ void TTinit(int new_port, long new_speed) { port = new_port; speed = new_speed; strcpy(parity,"NONE"); databits = 8; stopbits = 0; } /* T T O P E N -- Open the communications port */ ttopen() { if (portin == 0) { /* Ignore call if already open */ switch (port) { case 1: coms(1); /* COM 1 */ break; case 2: coms(2); /* COM 2 */ break; case 3: coms(3); /* COM 3 */ break; case 4: coms(4); /* COM 4 */ break; default: /* others not supported, return error */ return(-1); } dobaud(speed); /* Set baud rate */ serini(); /* enable interrupt handler */ } return(0); /* return success */ } /* T T C L O S E -- Close the communications port */ ttclose() { if (portin != 0) /* Ignore if port is already closed */ serrst(); /* otherwise disable interrupts */ return(0); /* return success */ } /* T T C H K -- Return a count of characters at the serial port */ ttchk() { return( count ); /* return maintained count */ } /* T T O C -- Output a character to the current serial port */ void ttoc( unsigned char c ) { while( (inportb(modem.mdstat) & 0x20) == 0 ) ; /* Wait til transmitter is ready */ outportb(modem.mddat,c); /* then output the character */ } /* T T F L U I -- Clear the input buffer of characters */ void ttflui() { #ifdef XONXOFF if (xofsnt){ /* Check if XON should be sent after XOFF */ xofsnt = 0; /* if so then reset XOFF sent status */ ttoc(XON); /* and send the XON */ } #endif disable(); /* NO interrupts allowed now */ inptr = outptr = buffer; /* Reset input out output pointers */ count = 0; /* Set received characters count to 0 */ enable(); /* Now interrupts are ok */ } /* T T I N C -- Read a character from serial ports circular buffer */ ttinc() { int c; register char * ptr; #ifdef XONXOFF if (count < XONPT && xofsnt){ /* Check if XON should be sent after XOFF */ xofsnt = 0; /* if so then reset XOFF sent status */ ttoc(XON); /* and send the XON */ } #endif while (count == 0) /* If no characters have arrived then */ ; /* wait til one arrives */ ptr = outptr; /* Save address of buffer output point */ c = *ptr++; /* Get this character and increment ptr */ /* See if circular buff should be wrapped */ if (ptr == &buffer[COM_BUFF_SIZE]) ptr = buffer; /* if so then save new output point */ disable(); /* NO interrupts allowed now */ outptr = ptr; /* Save the address of output point */ count--; /* Decrement count of received characters */ enable(); /* Interrupts can continue now */ return(c); /* Return the received character */ } /* D O B A U D -- Set the baud rate for the current port */ dobaud( long baudrate ) { unsigned char portval; unsigned char blo, bhi; switch (baudrate) { /* Get 8250 baud rate divisor values */ case 50: bhi = 0x9; blo = 0x00; break; case 75: bhi = 0x6; blo = 0x00; break; case 110: bhi = 0x4; blo = 0x17; break; case 150: bhi = 0x3; blo = 0x00; break; case 300: bhi = 0x1; blo = 0x80; break; case 600: bhi = 0x0; blo = 0xC0; break; case 1200: bhi = 0x0; blo = 0x60; break; case 1800: bhi = 0x0; blo = 0x40; break; case 2000: bhi = 0x0; blo = 0x3A; break; case 2400: bhi = 0x0; blo = 0x30; break; case 4800: bhi = 0x0; blo = 0x18; break; case 9600: bhi = 0x0; blo = 0x0C; break; case 19200: bhi = 0x0; blo = 0x06; break; case 38400: bhi = 0x0; blo = 0x03; break; case 57600: bhi = 0x0; blo = 0x02; break; case 115200: bhi = 0x0; blo = 0x01; break; default: /* Return failure if baud unsupported */ return(-1); } portval = inportb(modem.mdcom);/* Save current value of command register */ /* In order to set the baud rate the */ /* high bit of command data register is */ outportb(modem.mdcom,portval | 0x80 ); /* set before sending baud data */ outportb(modem.mddat,blo); /* Set LSB Baud-Rate divisor for baud */ outportb(modem.mddat + 1,bhi); /* Set MSB Baud-Rate divisor for baud */ outportb(modem.mdcom,portval); /* Reset original command register value */ return(0); /* Return success */ } /* C O M S -- Set up the modem structure for the specified com port */ void coms( int portid ) { if (portid == 1) { /* Port data for COM 1 */ modem.mddat = MDMDAT1; /* Port 1 Data register */ modem.mdstat = MDMSTS1; /* Port 1 Status register */ modem.mdcom = MDMCOM1; /* Port 1 Command register */ modem.mddis = MDMINTC; /* Port 1 8259 IRQ4 disable mask */ modem.mden = MDMINTO; /* Port 1 8259 IRQ4 enable mask */ modem.mdintv = MDMINTV; /* Port 1 interrupt number */ } else if (portid == 2) { /* Port data for COM 2 */ modem.mddat = MDMDAT2; /* Port 2 Data register */ modem.mdstat = MDMSTS2; /* Port 2 Status register */ modem.mdcom = MDMCOM2; /* Port 2 Command register */ modem.mddis = MDINTC2; /* Port 2 8259 IRQ4 disable mask */ modem.mden = MDINTO2; /* Port 2 8259 IRQ4 enable mask */ modem.mdintv = MDINTV2; /* Port 2 interrupt number */ } else if (portid == 3) { /* Port data for COM 3 */ modem.mddat = MDMDAT3; /* Port 3 Data register */ modem.mdstat = MDMSTS3; /* Port 3 Status register */ modem.mdcom = MDMCOM3; /* Port 3 Command register */ modem.mddis = MDMINTC; /* Port 3 8259 IRQ4 disable mask */ modem.mden = MDMINTO; /* Port 3 8259 IRQ4 enable mask */ modem.mdintv = MDMINTV; /* Port 3 interrupt number */ } else if (portid == 4) { /* Port data for COM 4 */ modem.mddat = MDMDAT4; /* Port 4 Data register */ modem.mdstat = MDMSTS4; /* Port 4 Status register */ modem.mdcom = MDMCOM4; /* Port 4 Command register */ modem.mddis = MDINTC2; /* Port 4 8259 IRQ4 disable mask */ modem.mden = MDINTO2; /* Port 4 8259 IRQ4 enable mask */ modem.mdintv = MDINTV2; /* Port 4 interrupt number */ } } /* S E R I N I -- initialize the serial port for interrupts */ void serini() { unsigned char portval; if (portin == 0) { /* Ignore if already open */ portin = 1; /* save port open status */ inptr = outptr = buffer; /* set circular buffer pointers */ count = 0; /* indicate no characters received */ oldvec=getvect(modem.mdintv);/* save old com interrupt */ setvect(modem.mdintv,serint);/* set SERINT as communications ISR */ portval = 0; /* Byte value to output to the Line */ /* Control Register (LCR) to set the */ /* Parity, Stopbits, Databits */ /* Start out with all bits zero */ if (strcmp(parity,"EVEN") == 0) portval |= 0x8; /* Set bit 3 on for odd parity */ else if (strcmp(parity,"ODD") == 0) portval |= 0x18; /* Set bits 3 and 4 on for even parity */ /* Leave bits 3 and 4 off for no parity */ if (stopbits == 2) /* Set bit 2 on if 2 Stopbits are used */ portval |= 0x4; /* Leave bit 2 off for 1 Stopbit */ if (databits == 6) /* Set bit 0 on for 6 data bits */ portval |= 0x1; else if (databits == 7) /* Set bit 1 on for 7 data bits */ portval |= 0x2; else if (databits == 8) /* Set bits 0 and 1 on for 8 data bits */ portval |= 0x3; /* Leave bits 0 and 1 off for 5 data bits */ outportb(modem.mdcom,portval); /* Output the settings to the LCR */ outportb(modem.mdcom + 1,0xb); /* Assert OUT2, RTS, DTR */ inportb(modem.mddat); /* Clear any left over characters */ outportb(modem.mddat+1,0x1); /* Enable receiver interrupts */ portval = inportb(INTCONT); /* Read 8259 interrupt enable mask */ outportb(INTCONT,modem.mden & portval); /*Set bit on for com IRQ */ } } /* S E R R S T -- Reset serial port interrupts */ void serrst() { unsigned char portval; if (portin != 0) { /* Ignore if interrupts already disabled */ portin = 0; /* save port closed status */ portval = inportb(INTCONT); /* Read 8259 interrupt enable mask */ outportb(INTCONT,modem.mddis | portval);/*Set bit off for com IRQ */ setvect(modem.mdintv,oldvec); /* return original interrupt vector */ } } /* S E R I N T -- Serial interrupt handler, recieves incoming characters */ void interrupt serint() { more: *inptr++=inportb(modem.mddat);/* Quickly read arriving character */ count++; /* Increment received count */ #ifdef XONXOFF if (count > XOFFPT && xofsnt != 1){ /* If buffer almost full then */ ttoc(XOFF); /* send an XOFF */ xofsnt = 1; /* and save XOFF sent status */ } #endif disable(); /* NO interrupts are allowed while */ /* new input pointer is stored */ if (inptr == &buffer[COM_BUFF_SIZE]) /* At end of circular buff? */ inptr = buffer; /* if so then save new output point */ enable(); /* Interrupts ok now */ #define LAST_LOOK #ifdef LAST_LOOK if (inportb(modem.mddat + 5) & 1) /* another character ready? */ goto more; #endif outportb(0x20,0x20); /* send End Of Interrupt to 8259 */ } photopc-3.05/comio.h 644 2627 62 2324 6751646652 7476 /* $Id: comio.h,v 1.2 1998/10/18 13:18:27 crosser Exp $ */ /* $Log: comio.h,v $ Revision 1.2 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 1.1 1998/01/18 02:16:45 crosser Initial revision */ #ifndef _COMIO_H #define _COMIO_H /* function prototypes */ void TTinit(int port, long speed);/* Initialize the communications system */ int ttopen(); /* Open a port for communications */ int ttclose( void ); /* Close the communications port */ int ttchk( void ); /* Return count of received characters */ void ttoc( unsigned char ); /* Output a character to the com port */ int ttinc( void ); /* Input a character from circular buffer */ void ttflui( void ); /* Flush circular buffer of characters */ int dobaud( long ); /* Set the baud rate for the port */ void coms( int ); /* Establish modem data */ void serini( void ); /* Initialize the com port for interrupts */ void serrst( void ); /* Reset the com port to original settings */ void interrupt serint( void ); /* Com port receiver ISR */ #endif photopc-3.05/getopt.h 644 2627 62 10633 6751646766 7722 /* Declarations for getopt. Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _GETOPT_H #define _GETOPT_H 1 #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { #if __STDC__ const char *name; #else char *name; #endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 #if __STDC__ #if defined(__GNU_LIBRARY__) /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int argc, char *const *argv, const char *shortopts); #else /* not __GNU_LIBRARY__ */ extern int getopt (); #endif /* not __GNU_LIBRARY__ */ extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind, int long_only); #else /* not __STDC__ */ extern int getopt (); extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); #endif /* not __STDC__ */ #ifdef __cplusplus } #endif #endif /* _GETOPT_H */ photopc-3.05/usleep.h 644 2627 62 1653 6751647030 7660 /* $Id: usleep.h,v 2.2 1998/10/18 13:18:27 crosser Exp $ */ /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: usleep.h,v $ Revision 2.2 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.1 1998/01/18 02:16:45 crosser DOS support Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 */ #ifndef _USLEEP_H #define _USLEEP_H void usleep(long usecs); #ifdef DOS extern double delay_factor; void start_time(void); unsigned long elasped_usecs(void); #endif #endif photopc-3.05/strcscmp.h 644 2627 62 123 6751647021 10170 #ifndef _STRCSCMP_H #define _STRCSCMP_H int strcasecmp(char *s1, char *s2); #endif photopc-3.05/epinfo.c 644 2627 62 24641 7227711256 7661 #ifndef LINT static char *rcsid="$Id: epinfo.c,v 2.21 2001/01/12 23:26:38 crosser Exp $"; #endif /* Copyright (c) 1997-2001 Eugene G. Crosser Copyright (c) 1998 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: epinfo.c,v $ Revision 2.21 2001/01/12 23:26:38 crosser new release, avoid strncasecmp, change copyright year Revision 2.20 2000/05/09 13:20:54 crosser configure read() with alarm() better. Address signed vs. unsigned arguments other cleanups to make most notorious compilers happy Revision 2.19 1999/11/17 13:48:08 crosser check if need to include getopt.h Revision 2.18 1999/08/01 21:36:54 crosser Modify source to suit ansi2knr (I hate the style that ansi2knr requires but you don't expect me to write another smarter ansi2knr implementation, right?) Revision 2.17 1999/07/29 07:20:12 crosser remove revision.h Revision 2.16 1999/04/28 08:34:34 crosser paranoid stuff Revision 2.15 1999/04/27 20:56:02 lightner Debug command-line file name wildcards under MS-DOS Revision 2.14 1999/04/22 05:01:09 crosser define frc Revision 2.13 1999/04/22 04:54:17 crosser process dos wildcards Revision 2.12 1999/03/27 23:47:23 crosser change gmtime to gltimetz (possible null pointer under Windows) Revision 2.11 1999/03/21 20:22:09 crosser help message typo Revision 2.10 1999/03/13 13:27:43 crosser add tzset Revision 2.9 1999/03/12 23:22:30 crosser clean zone handling Revision 2.8 1999/03/12 10:06:23 crosser new setfiletime Revision 2.7 1999/03/10 22:34:43 crosser lots of new functionality (rename, setutime) etc. Revision 2.6 1999/03/06 13:37:08 crosser Convert to autoconf-style Revision 2.5 1999/02/28 22:40:48 crosser Support Exif file format Revision 2.4 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 2.3 1998/02/13 23:02:40 crosser use proper open mode on DOS Revision 2.2 1998/02/08 19:58:38 crosser Support low memory: chunked saving etc. Revision 2.1 1998/01/18 02:16:45 crosser DOS support Revision 2.0 1998/01/02 19:20:11 crosser Added support for Win32 Revision 1.2 1997/12/24 00:19:13 crosser Do not check vendor identifier Revision 1.1 1997/08/17 08:59:54 crosser Initial revision */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #ifdef STDC_HEADERS #include #include #endif #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef __TURBOC__ #include #endif #include "a12scan.h" #include "exifscan.h" #include "fnames.h" #include "ctimez.h" #include "filetime.h" #ifndef OPTARG_DEFINED #include #endif #ifdef UNIX #ifdef HAVE_UNAME #include #endif #ifdef HAVE_UNISTD_H #include #endif #define READMODE "r" #else #include "strcscmp.h" #define READMODE "rb" #define MS_PROGRAM_NAMES #endif #ifdef DOS #define MS_PROGRAM_NAMES #pragma warn -par #pragma warn -sus #endif static int usetimezone=1; static int setutime=0; static int dorename=0; static char *nameformat=NULL; static char *tag=NULL; void showhelp(char *name) { printf("usage: %s [-h] [-V] [-z] [-r] [-t] [-f fmt] [-T TagName] ...\n\n",name); printf("Options:\n\n"); printf("\t-h\t- show this help screen\n"); printf("\t-V\t- show software version number\n"); printf("\t-z\t- suppress timezone conversions (camera's clock is local time)\n"); printf("\t-r\t- rename files to the timestamp\n"); printf("\t-t\t- set modification time of the files to the time of snapshot\n"); printf("\t-f fmt\t- rename files using strftime(3) with the time of snapshot\n"); printf("\t\t\t fmt = 'd' - name is seconds since the epoch in decimal\n"); printf("\t\t\t fmt = 'x' - name is seconds since the epoch in hex\n"); #ifdef HAVE_STRFTIME printf("\t\t\t fmt = '1' - name is MMDD_CCC (default)\n"); printf("\t\t\t fmt = '2' - name is YYMMDDCC\n"); printf("\t\t\t fmt = '3' - name is YYYY_MM_DD-HH_MM_SS\n"); printf("\t\t\t fmt = '4' - name is YYYY/MM/DD/HH_MM_SS\n"); printf("\t\t\t otherwise make file names using strftime(3),\n"); printf("\t\t\t if fmt contains `%%%%NNNd' then place count there\n"); #endif } void showversion(char *name) { #ifdef UNIX #if HAVE_UNAME #define OS uts.sysname struct utsname uts; if (uname(&uts)) { strncpy(uts.sysname,"Unix",sizeof(uts.sysname)); uts.sysname[sizeof(uts.sysname)-1]='\0'; } #else #define OS "Generic UNIX" #endif #endif #ifdef DOS #define OS "MS-DOS" #endif #ifdef MSWINDOWS #define OS "Windows 95/NT" #endif #ifndef OS #define OS "Unknown OS" #endif printf("%s version %s (%s) build %s (%s memory model)\n", name,VERSION,OS,__DATE__, #ifdef LOWMEMORY "low" #else "normal" #endif ); printf(" Copyright (c) 1997-2001 Eugene Crosser and Bruce Lightner\n"); printf(" URL: http://www.average.org/digicam/\n"); } int main(int argc,char *argv[]) { char *fname; char newname[MAXFORMAT+1]; FILE *fp; struct stat st; unsigned char *buf,*res,*p,*q; off_t bufsize,ressize; int c,rc=0; char *program = argv[0]; enum {NONE,APP12,EXIF} fformat; time_t ptime; struct tm *ptm,ptms; #ifdef __TURBOC__ struct ffblk ffb; int frc; char *w, *pp, fbuf[MAXFORMAT+1]; #endif #ifdef MS_PROGRAM_NAMES /* remove program extension */ if ((q = strrchr(program, '.')) != NULL) *q = '\0'; /* remove directory */ if ((q = strrchr(program, '/')) != NULL) program = q + 1; if ((q = strrchr(program, '\\')) != NULL) program = q + 1; #endif while ((c=getopt(argc,argv,"hVzrtf:T:")) != EOF) switch (c) { case 'f': nameformat=optarg; break; case 'T': tag=optarg; break; case 'z': usetimezone=0; break; case 't': setutime=1; break; case 'r': dorename=1; break; case 'h': showhelp(program); return 0; case 'V': showversion(program); return 0; default: showhelp(program); return 1; } if (!argv[optind]) { showhelp(program); return -1; } #ifdef DOS /* MS/DOS has silly assumptions about the timezone if TZ variable is not set. Hope the following will help in most cases, the results should be at least predictable... */ if (getenv("TZ") == NULL) { putenv("TZ=GMT0"); usetimezone = 0; } #endif tzset(); #ifdef __TURBOC__ while (w=argv[optind]) for (frc=findfirst(argv[optind++],&ffb,0); !frc;frc=findnext(&ffb)) { strncpy(fbuf,w,sizeof(fbuf)-1); fbuf[sizeof(fbuf)-1]='\0'; fname = fbuf; if ((pp=strrchr(fname,'/'))!=NULL) { *++pp = '\0'; strcat(fname,ffb.ff_name); } else if ((pp=strrchr(fname,'\\'))!=NULL) { *++pp = '\0'; strcat(fname,ffb.ff_name); } else if ((pp=strrchr(fname,':'))!=NULL) { *++pp = '\0'; strcat(fname,ffb.ff_name); } else { fname = ffb.ff_name; } #else while ((fname=argv[optind++])) { #endif if ((fp=fopen(fname,READMODE)) == NULL) { perror(fname); rc++; continue; } if (fstat(fileno(fp),&st)) { perror(fname); fclose(fp); rc++; continue; } #ifdef LOWMEMORY if (st.st_size > MAXJPREFIX) bufsize=MAXJPREFIX; else #endif bufsize=st.st_size; buf=malloc((size_t)bufsize); if (buf == NULL) { perror("malloc"); fclose(fp); rc++; continue; } if (fread(buf,(size_t)bufsize,1,fp) != 1) { perror("read"); free(buf); fclose(fp); rc++; continue; } fclose(fp); res=buf; ressize=bufsize; fformat=NONE; if (a12scan(&res,&ressize) == 0) fformat=APP12; else { res=buf; ressize=bufsize; if (exifscan(&res,&ressize) == 0) fformat=EXIF; } if (fformat == NONE) { fprintf(stderr,"No camera-specific information in the file\n"); free(buf); rc++; continue; } if (dorename || setutime) { if (tag) { fprintf(stderr,"-T cannot be used with -r and -t\n"); free(buf); rc++; continue; } if (fformat == APP12) { p=a12search("TimeDate",res,ressize); if ((p == NULL) || (sscanf(p,"%lu",&ptime) != 1)) { fprintf(stderr, "TimeDate key not found\n"); ptime=-1; } } else { p=exifsearch("DateTime",res,ressize); if ((p == NULL) || (sscanf(p,"\"%d:%d:%d %d:%d:%d\"", &ptms.tm_year, &ptms.tm_mon, &ptms.tm_mday, &ptms.tm_hour, &ptms.tm_min, &ptms.tm_sec) != 6)) { fprintf(stderr, "DateTime key not found\n"); ptime=-1; } else { if (ptms.tm_mon) ptms.tm_mon-=1; if (ptms.tm_year) ptms.tm_year-=1900; ptime=mktime(&ptms); ptime+=zoneoffset(ptime); } } if (ptime == -1) { fprintf(stderr,"cannot rename/setutime\n"); free(buf); rc++; continue; } if (dorename) { makename(newname,MAXFORMAT,"",IMAGE, ptime,nameformat,usetimezone); printf("rename %s -> %s\n",fname,newname); #ifdef HAVE_RENAME if (rename(fname,newname)) { perror("rename"); rc++; } else fname=newname; /* for setutime */ #else if (link(fname,newname)) { perror("link"); rc++; } else { if (unlink(fname)) perror("unlink"); fname=newname; /* for setutime */ } #endif } if (setutime) { printf("set modtime %s: %s\n", fname,ctimetz(&ptime,usetimezone)); if (setfiletime(fname,st.st_atime,ptime, usetimezone)) { perror("setfiletime"); rc++; } } } else if (tag && (fformat == APP12) && (strcmp(tag,"DateTime") == 0)) { p=a12search("TimeDate",res,ressize); if (p && (sscanf(p,"%lu",&ptime) == 1)) { ptm=gltimetz(&ptime,0); printf("\"%04d:%02d:%02d %02d:%02d:%02d\"\n", ptm->tm_year+1900, ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec); } else { fprintf(stderr,"TimeDate key not found\n"); free(buf); rc++; continue; } } else if (tag) { if (fformat == APP12) p=a12search(tag,res,ressize); else p=exifsearch(tag,res,ressize); if (p == NULL) { fprintf(stderr,"Key not found\n"); free(buf); rc++; continue; } if ((q=strchr(p,'\n'))) *q='\0'; if ((q=strchr(p,'\r'))) *q='\0'; printf("%s\n",p); } else { if (fformat == APP12) a12dump(res,ressize); else exifdump(res,ressize); } free(buf); } return rc; } photopc-3.05/photopc.1 644 2627 62 44772 7227253626 10004 .\" $Id: photopc.1,v 2.32 2001/01/11 06:49:58 crosser Exp $ .\" .\" Copyright (c) 1997-1999 Eugene G. Crosser .\" Copyright (c) 1998,1999 Bruce D. Lightner (DOS/Windows support) .\" .\" You may distribute and/or use for any purpose modified or unmodified .\" copies of this software if you preserve the copyright notice above. .\" .\" THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY .\" KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE .\" COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE .\" USE OF THIS SOFTWARE. .\" .\" $Log: photopc.1,v $ .\" Revision 2.32 2001/01/11 06:49:58 crosser .\" minor cleanups on source .\" make manual page in sync with the source .\" .\" Revision 2.31 2000/02/17 07:46:17 crosser .\" sync manual page .\" .\" Revision 2.30 1999/12/26 13:59:45 crosser .\" sort frame list for erase command; new version 3.03 .\" .\" Revision 2.29 1999/12/11 14:10:15 crosser .\" Support sgtty terminal control .\" Proper "fake speed" handling (needed two values) .\" .\" Revision 2.28 1999/12/01 21:41:23 crosser .\" add "pseudo" speed .\" .\" Revision 2.27 1999/06/24 04:28:45 crosser .\" note "number of rfames not updated" bug .\" .\" Revision 2.26 1999/06/07 20:05:08 crosser .\" Note on 32Mb card problem on Nikon .\" .\" Revision 2.25 1999/04/28 08:40:45 crosser .\" more Nikon bugs .\" .\" Revision 2.24 1999/03/21 20:22:09 crosser .\" sync format desc with actual program .\" .\" Revision 2.23 1999/03/13 13:10:13 crosser .\" reflect 3.00 changes .\" .\" Revision 2.22 1999/02/28 22:40:48 crosser .\" suggest audio compression is adpcm .\" .\" Revision 2.21 1999/02/26 23:54:42 crosser .\" Correct JFIF vs. Exif vs. JPEG things .\" .\" Revision 2.20 1999/01/17 14:16:50 crosser .\" copyright years .\" .\" Revision 2.19 1999/01/17 13:37:29 crosser .\" fix copyright info .\" .\" Revision 2.18 1998/12/20 21:58:58 crosser .\" Add audio command .\" .\" Revision 2.17 1998/12/06 08:40:34 crosser .\" more comapibility things .\" .\" Revision 2.16 1998/11/20 22:49:46 crosser .\" mention problems with CP900 .\" .\" Revision 2.15 1998/11/20 22:34:10 crosser .\" elaborate on list vs. llist .\" .\" Revision 2.14 1998/10/18 19:07:36 crosser .\" renamed "list" to "llist", make new "list" that works on all models. .\" .\" Revision 2.13 1998/10/18 13:18:27 crosser .\" Put RCS logs and I.D. into the source .\" .\" Revision 2.12 1998/08/08 22:16:33 crosser .\" reflect timezone related things .\" .\" Revision 2.11 1998/08/08 14:00:33 crosser .\" unimportant changes .\" .\" Revision 2.10 1998/07/21 22:56:52 crosser .\" fix CP 900 .\" .\" Revision 2.9 1998/06/07 18:41:40 crosser .\" frame intervals, digital zoom .\" .\" Revision 2.8 1998/06/07 13:55:20 crosser .\" compatibilities and credits .\" .\" Revision 2.7 1998/03/01 18:57:04 crosser .\" preview command .\" .\" Revision 2.6 1998/02/16 06:14:29 lightner .\" Add docs for -V and -z options .\" .\" Revision 2.5 1998/02/13 23:02:40 crosser .\" Point that upload does not work on LOWMEMORY model .\" .\" Revision 2.4 1998/01/27 21:52:55 crosser .\" upload command .\" .\" Revision 2.3 1998/01/18 02:24:31 crosser .\" change copyright .\" .\" Revision 2.2 1998/01/11 21:20:54 crosser .\" off command .\" .\" Revision 2.1 1998/01/04 13:55:57 crosser .\" New commands: protect, list .\" .\" Revision 2.0 1998/01/03 19:54:26 crosser .\" Windows support .\" locktoggle command .\" new -f variants .\" .\" Revision 1.2 1997/12/24 00:19:13 crosser .\" describe new commands .\" claim that we work with other digital cameras (do we really?) .\" .\" Revision 1.1 1997/08/17 08:59:54 crosser .\" Initial revision .\" .TH PHOTOPC 1 "24 May 1997" "PhotoPC manipulation tool" "User Commands" .SH NAME photopc \- utility to control digital cameras based on Sierra Imaging firmware .SH SYNOPSIS photopc [-h] [-V] [-v[v]] [-q] [-z] [-t] [-f timeformat] [-s ] [-S ] [-l ] [command [params] ] ... .SH DESCRIPTION This is a command line tool to manipulate digital still cameras that use certain control protocol, namely Agfa ePhoto line, Epson PhotoPC line, Olympus D-xxxL line, Sanyo and Nikon (at least CoolPix 9xx) cameras. It can set camera parameters, download and erase pictures, e.t.c. It was originally developed for Epson PhotoPC 500, now the author uses it with Olympus D-600L, results with other models may vary. .PP .SH "OPTIONS" .TP 0.5i .B -h This option produces a help screen of all options and commands. .TP 0.5i .B -V This option prints software revision information. .TP 0.5i .B -v This option enables verbose output. Using two -v options increases the level of verbosity. This is primarily meant for debugging. .TP 0.5i .B -q This option sets quiet mode. If it is not specified, the program will show running download progress indicator. .TP 0.5i .B -z This option sets no time-zone processing mode. Use this option if the camera's clock is (should be) set up shifted by the local timezone offset. .TP 0.5i .B -s speed This option allows setting the data rate to use when communicating with the camera. Valid rates are 9600, 19200, 38400, 57600 and 115200 (the default). .\" This is added on request by Detlev Droege .\" who says that on Next/OpenStep (and on other platforms too) `Special .\" serial I/O Cards exist which work on the doubble or quadruple speed .\" than the machine thinks they do' .TP 0.5i .B -S speed On some UNIX systems with some serial hardware/driver combinations you need to "lie" to the driver about the communication speed that you want to use at startup and during the session. Physical startup speed is always 19200. E.g., if on your system speeds up to 19200 are translated one to one, but in order to use 57600 baud you have to specify 50 baud, and you want to run at 57600, you'll need to specify .B photopc -s57600 -S19200,50 .I Another example: if your driver will use physical speed four times as high as you told it to set, and you want to run at default 115200 physical speed, specify .B photopc -S4800,28800 .I .TP 0.5i .B -t Set timestamp of generated files to the time of snapshot. .TP 0.5i .B -f timeformat This option allows to specify the format for automatically generated image file names; the value is used as the format string for strftime(3) function. By default, names of the format "MMDD_NNN.jpg" are generated, where MM is a month, DD is a day, and NNN is a count starting from 001. A good starting point for the timeformat value could be "%Y_%m_%d-%H_%M_%S.jpg". If the format string contains context "%%XXXd" where XXX are digits, it is taken for the count, i.e. if the file with such name is present, next count is tried. If the format string does not contain "%%XXXd" part, the count field, if necessary, is appended at the end of the name. A few single-character formats are used as shortcuts. "x" makes the name of seconds since the epoch in hexadecimal format (8 characters + ".jpg"), "d" - the same in decimal format (10 characters), "1" stands for default format "%m%d_%%03d.jpg", "2" stands for "%y%m%d%%02d.jpg", "3" stands for "%Y_%m_%d-%H_%M_%S.jpg" and 4 stands for "%Y/%m/%d/%H_%M_%S.jpg". The program attempts to create intermediate directories if necessary (and possible). .TP 0.5i .B -l device This allows specifying the serial device to use for communicating with the camera. The default is .I /dev/photopc (which is typically created as a (symbolic) link to the real device, e.g. /dev/ttyS0) in UNIX, and .I COM1: in DOS and Windows. Note that the program does not use UUCP style locks so you need to be certain that no other program, such as uugetty, uucico or mouse manager, is trying to access the same device. .SH COMMANDS After the options, one or more commands can be given in the command line. Some commands accept .B frame-list as a parameter. Frame list is a comma-separated list of tokens (no whitespace allowed), each of the tokens being a word .BR all ", or a single number, or two numbers separated by a dash (-), or a number followed by a dash and a word .B last (without whitespace). .TP 0.5i .B query Display all current camera settings. .TP 0.5i .B count Output the number of pictures stored in the camera. This is intended for use in shell scripts. .TP 0.5i .B list List information about frames stored in the camera. Fields displayed are: frame number, size of image file, protection state, resolution mode, timestamp and filename if available. Faster than .B llist but may not work with some (older) models. WARNING: this command changes current directory on models that support directory tree on the flash media. .TP 0.5i .B llist List more information about frames stored in the camera. Fields displayed are: frame number, protection state, size of image file, resolution mode, flash, shutter and timestamp. Slower than .B list and does not work with models that use .I Exif file format. WARNING: this command changes current directory on models that support directory tree on the flash media. .TP 0.5i .B cd On the models that support multiple directories on the flash media, change current directory as specified. The program chdir's to the first non-empty folder at the beginning. So, your first .B cd command .I must specify full path starting with a slash. If it where unix you could also .BI cd " ../something but here we do not have a way to move up one level. .TP 0.5i .B protect On | Off Change "protected" status of frames. Frame numbering starts at 1. The command will fail if the frame number is omitted, not numeric, or does not correspond to a stored frame. "Protected" frames cannot be erased with "erase" and "eraseall" commands or with the "erase" button on the camera. .TP 0.5i .B erase Erase frames. Frame numbering starts at 1. The command will fail if the frame number is omitted, not numeric, or does not correspond to a stored frame. To avoid unexpected results, list of frames specified for this command is sorted and processed in reverse order. .TP 0.5i .B eraseall Erase all stored frames. .TP 0.5i .B eraselast Erase most recently taken frame. .TP 0.5i .B snapshot Take a picture. .TP 0.5i .B off Switch off the camera. This command only has this effect on some models (notably Olympus D-600L). On other models, it just terminates the session immediately (otherwise the camera would be active several seconds after the last command). On models with big timeout, such as Photopc 600, it may be wise to always issue "off" at the end of command row, to decrease power consumption. All commands going after "off" are ignored. .TP 0.5i .B image Download an image or series of images from the camera to disk file(s) on the host computer. Frame numbering starts at 1. The command will fail if the frame number is omitted, not numeric, or does not correspond to a stored frame. Files are stored in JPEG (JFIF or Exif) format. Image file also contains a thumbnail portion, and set of parameters like the shutter speed, date and time, I.D. string and more. Directory must be specified if frame list is requested. If directory name is specified, downloaded file(s) will get unique names starting with month and date of snapshot, unless -f option is used, in which case unique names according to .B -f option setting. .TP 0.5i .B thumbnail Download a thumbnail image or series of thumbnails from the camera to disk file(s) on the host computer. Frame numbering starts at 1. The command will fail if the frame number is omitted, not numeric, or does not correspond to a stored frame. Files are stored in JPEG (JFIF or Exif) format. If the camera does not keep files in .I EXIF format, then the thumbnail file also contains a set of parameters like the shutter speed, date and time, I.D. string and more. Directory must be specified if frame list is requested. If directory name is specified, downloaded file(s) will get unique names according to .B -f option setting. .TP 0.5i .B audio Download an audio notice file or series of files from the camera to disk file(s) on the host computer. Frame numbering starts at 1. The command will fail if the frame number is omitted, not numeric, or does not correspond to a stored frame. Files are stored with ".wav" extention but the format is .I not RIFF WAV format. It is compressed in some way, probably with some variation of ADPCM. The program stores the raw data as provided by the camera, it is not playable as a normal .I .wav file. Directory must be specified if frame list is requested. If directory name is specified, downloaded file(s) will get unique names according to .B -f option setting. .TP 0.5i .B preview take a `preview' snapshot and save image as a . File is in JPEG (JFIF or Exif) format, and does not contain any additional data, just plain (very low resolution) image. .TP 0.5i .B upload Upload image file into the camera. This command is not enabled in LOWMEMORY version (i.e. under MS/DOS). .B WARNING! You cannot upload arbitrary JPEG file. Depending on the camera model, such attempt may result in the image not uploaded, not viewable, or even the camera "hung" needing to remove the batteries to make it work again. File previously downloaded from the same camera model is always uploadable. Otherwise, your milage may vary. .B photopc program does not perform any checks, so it's up to the user to provide the file in proper format. .TP 0.5i .B mode Record | Play | Thumbnail Set specified operation mode on certain models. .TP 0.5i .B resolution Hi | Lo | Ext | Set the camera to high, low or extended resolution mode. Exact meaning of the modes is model-dependant and may specify different image dimensions and/or JPEG compression rate. .TP 0.5i .B clock Set the camera's internal real-time clock using the current date and time from the host computer. Time of taking a snapshot is included inside the JPEG files produced. Note that the models which display the time on the LCD will then display GMT rather than local time. With .B -z option, time shifted by the timezone offset is set, and the LCD will display local time. Using unshifted (GMT) time in the camera seems a proper way to go. .TP 0.5i .B shutter Set the camera shutter speed. Units can be specified in microseconds or in traditional form like "1/250". Valid interval depends on the model. If a value outside the interval is specified, the camera will set the speed to the nearest margin of the valid interval. Special speed value .B auto will set automatic shutter. Note that this only works while the camera is connected to the host, and automatically turns the flash off. While disconnected, shutter speed is always set automatically. .TP 0.5i .B aperture Auto | Lo | Med | Hi Set the lense aperture on models that support it. .TP 0.5i .B flash Auto | Force | Off | AntiRedeye | SlowSync Set the camera flash mode. .TP 0.5i .B id Set the camera identifier string that is included inside the JPEG files produced. Only few models support this. .TP 0.5i .B autoshut-host Automatically shut off the camera after that many seconds of inactivity while connected to the computer (on the host). .TP 0.5i .B autoshut-field Automatically shut off the camera after that many seconds of inactivity while disconnected from the computer (in the field). .TP 0.5i .B lcd-autoshut Automatically shut off the LCD monitor after that many seconds of inactivity. .TP 0.5i .B lcd-brightness Set LCD brightness to the value (valid values are 1 to 7). .TP 0.5i .B focus Macro | Normal | Infinity Set the lens focusing mode. As far as I can tell, on fixed focus models macro only means force minimum aperture, not change the focal length. Only has effect in the same invocation with "snapshot" command. .TP 0.5i .B adjust Normal | Contrast+ | Contrast- | Brightness+ | Brightness- Set adjustment of picture brightness/contrast. .TP 0.5i .B metering Center-weighted | Spot | Matrix Set auto exposure metering mode. .TP 0.5i .B whitebalance Normal | Sunny | Incandescent | Fluorescent | Flash | Preset | Cloudy Set white balance. .TP 0.5i .B color On | Off Set color or B/W mode. .TP 0.5i .B dzoom On | Off | Set digital zoom on or off. Note that low resolution must be set prior to turning on digital zoom. Numeric values have model-dependant meaning. Only has effect in the same invocation with "snapshot" command. .TP 0.5i .B zoom Set optical zoom value on models that support it. .SH EXAMPLES % photopc query % photopc -f "image%H:%M:%S" eraseall snapshot image 1 . .SH OTHER NOTES The latest version of this tool can be found at ftp://ftp.average.org/pub/photopc/; see also WWW page at http://www.average.org/digicam/. Trademarks are properties of their respective owners. .SH KNOWN BUGS On some models, powersaving timeouts are measured not in seconds but in 1/10 sec units. The program reports them as in seconds. Llist command relies on the format of thumbnail image that does not contain necessary information on some models (e.g. Nikon CP 900), this command does not work for these models. List command, on the contrary, do not display useful data on models that do not return it in the register 47 (e.g. Agfa 780). The program is known to have some timing problems talking to Nikon CP900 when the camera is "napping" in powersaving mode. Until the problem is solved, a workaround is to run the program this way: .B $ photopc && photopc .I Nikon seem to have some other problems too, especially when doing "actions" (e.g. snapshots, erase). Another Nikon problem: if 32Mb (or bigger?) memry card is inserted, the program cannot get the number of frames taken, and if "all" or "NN-last" range is specified for downloading, the program fails. Specify explicit range of frames. Also, with any card, number of frames taken is not updated immediately after the "snapshot" command (the same has been reported for other models). If you find how to find the correct number of frames, please let me know. .SH COPYRIGHT The program is copyrighted by Eugene G. Crosser and freely distributable. See README file for detailes. DOS and Windows support copyright Bruce D. Lightner .SH CREDITS The man page was originally written by Jeff Tranter , who also contributed a few bugfixes. Some information about the serial protocol obtained from Jun-ichiro "itojun" Itoh , Thierry Bousch and other contributors. .SH SEE ALSO epinfo(1), strftime(3), protocol description (protocol.htm in the source distribution). photopc-3.05/epinfo.1 644 2627 62 10160 6751646742 7576 .\" $Id: epinfo.1,v 1.6 1999/04/28 08:40:45 crosser Exp $ .\" .\" Copyright (c) 1997-1999 Eugene G. Crosser .\" Copyright (c) 1998,1999 Bruce D. Lightner (DOS/Windows support) .\" .\" You may distribute and/or use for any purpose modified or unmodified .\" copies of this software if you preserve the copyright notice above. .\" .\" THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY .\" KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE .\" COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE .\" USE OF THIS SOFTWARE. .\" .\" $Log: epinfo.1,v $ .\" Revision 1.6 1999/04/28 08:40:45 crosser .\" remove extra section .\" .\" Revision 1.5 1999/03/21 20:22:09 crosser .\" sync format desc with actual program .\" .\" Revision 1.4 1999/03/13 13:10:13 crosser .\" reflect 3.00 changes .\" .\" Revision 1.3 1999/03/06 10:24:16 crosser .\" support Exif .\" .\" Revision 1.2 1998/10/18 13:18:27 crosser .\" Put RCS logs and I.D. into the source .\" .\" Revision 1.1 1997/08/17 08:59:54 crosser .\" Initial revision .\" .TH EPINFO 1 "24 May 1997" "PhotoPC manipulation tool" "User Commands" .SH NAME epinfo \- extract technical information from digital camera generated files .SH SYNOPSIS epinfo [-h] [-V] [-z] [-r] [-t] [-f fmt] [-T ] ... .SH DESCRIPTION This command extracts the contents of TIFF directory of Exif files or APP12 marker from JFIF files, parses it and optionaly finds specific data inside it. If used without .BR -T ", "-r " and "-t options, dumps the complete block data in human readable format. With .B -r and .B -t options, renames and changes timestamp of the files. .PP .SH "OPTIONS" .TP 0.5i .B -h This option produces a help screen of all options and commands. .TP 0.5i .B -V This option prints software revision information. .TP 0.5i .B -z This option sets no time-zone processing mode. Use this option if the camera's clock is set up shifted by the local timezone offset (as it is when you set it manually to the local time). .TP 0.5i .B -r Rename files, generating new name based on the time of snapshot and .B -f option value. .TP 0.5i .B -t Set timestamp of the files to the time of snapshots. .TP 0.5i .B -f timeformat This option allows to specify the format for automatically generated image file names; the value is used as the format string for strftime(3) function. By default, names of the format "MMDD_NNN.jpg" are generated, where MM is a month, DD is a day, and NNN is a count starting from 001. A good starting point for the timeformat value could be "%Y_%m_%d-%H_%M_%S.jpg". If the format string contains context "%%XXXd" where XXX are digits, it is taken for the count, i.e. if the file with such name is present, next count is tried. If the format string does not contain "%%XXXd" part, the count field, if necessary, is appended at the end of the name. A few single-character formats are used as shortcuts. "x" makes the name of seconds since the epoch in hexadecimal format (8 characters + ".jpg"), "d" - the same in decimal format (10 characters), "1" stands for default format "%m%d_%%03d.jpg", "2" stands for "%y%m%d%%02d.jpg", "3" stands for "%Y_%m_%d-%H_%M_%S.jpg" and 4 stands for "%Y/%m/%d/%H_%M_%S.jpg". The program attempts to create intermediate directories is necessary (and possible). .TP 0.5i .B -T Output the value of this keyword in the information block. Note that keywords are case sensitive. TagName .I DateTime has special meaning: if the file is .IR Exif ", it just prints the value of DateTime tag, and if the format is old .IR APP12 ", it outputs the value of .I TimeDate tag in the same format as Exif .IR DateTime ". .SH ARGUMENTS .TP 0.5i .B ... List of filenames to process. .SH EXAMPLES % epinfo -f3 -rt pic00001.jpg % epinfo -T FNumber 0512_003.jpg .SH OTHER NOTES The latest version of this tool can be found at ftp://ftp.average.org/pub/photopc/; see also WWW page at http://www.average.org/digicam/. Trademarks are properties of their respective owners. .SH COPYRIGHT The program is copyrighted by Eugene G. Crosser and freely distributable. See README file for details. .SH SEE ALSO photopc(1) photopc-3.05/protocol.htm 644 2627 62 47021 7227711260 10600 Serial Protocol of Some Digital Cameras

Disclaimer: This description is completely unofficial. Most of the information presented here is discovered by me, Eugene Crosser, while snooping the serial line and by trial and error. I never had an official protocol description, have never seen any related software source code, and have never done reverse engineering of any related software. This description may be incomplete, inaccurate or completely wrong. You are warned.

Some information is taken from `camediaplay' package by Jun-ichiro Itoh <itojun@itojun.org>, from the findings of Thierry Bousch <bousch%linotte.uucp@topo.math.u-psud.fr> TsuruZoh Tachibanaya <tsuruzoh@butaman.ne.jp> and from other (open) sources and not checked by me.


Serial Protocol of Some Digital Cameras

Several models of digital cameras, namely Epson, Sanyo, Agfa and Olympus cameras, seem to use the same protocol for communication with the host. Follows the description of the high-level protocol they use over the serial line.

Protocol Basics

The host and the camera exchange with data packets and individual bytes. Serial line paramaters used are: 8bit, no parity. No flow control is used. All arithmetic data is transmitted least significant byte first ("little endian").

Protocol Elements

The elementary units of the protocol are:
Initialization ByteNUL 0x00
Action Complete NotificationENQ 0x05
Positive AchnowledgementACK 0x06
Unable to Execute CommandDC1 0x11
Negative Acknowledgement,
also Camera Signature
NAK 0x15
PacketVariable length sequence of bytes
Termination Byte
0xff

Packet structure

The packet has the following structure:
OffsetLengthMeaning
01Packet type
11Packet subtype/sequence
22Length of data
4variableData
-22checksum

Known packet types are:
TypeDescription
0x02Data packet that is not last in sequence
0x03Data packet that is last in sequence
0x1bCommand packet

Data packets that are sent in responce to a single command are numbered starting from zero. If all requested data fits in one packet, it has type 0x03 and sequence 0.

Command packet has subtype 0x43 or 0x53. Only the first command packet in a session has subtype 0x53.

Maximum length of data field in a packet is 2048 bytes, which yields in 2054 total packet length.

Checksum is a simple 16 bit arithmetic sum of all bytes in the data field. As already mentioned above, length and checksum values are transmitted least significant byte first.

Flow of Control

A communication session flow is as follows:
HostCamera
Port speed set to 19200 baud
Host sends init byte 0x00
Camera responds with signature 0x15
Host sends command packet with subtype 0x53 and "set speed" command
Camera sends ACK 0x06
Port speed set to the new value
Host sends command
Camera responds with either ACK plus optionally "action taken" notifier or data packet sequence
Host sends ACK to every data packet
... Command - reply cycle repeated ...
Camera sends 0xff and resets after a few seconds (value is model-dependant) of inactivity

If the camera does not respond to a command in reasonable time, or responds with a NAK, the command can be resent. If the camera does not provide a complete data packet in reasonable time, or the data packet is corrupt (checksum does not match), the host can request resending of the packet by sending NAK instead of ACK.

Command format and codes

Command is a sequence of bytes sent in the data field of a command packet. Command format is as follows:
OffsetLengthDescription
01Command code
11Register number or subcode
2variableOptional argument

Five command codes are known:
CodeArgumentDescription
0int32Set value of integer register
1noneRead value of integer register
2vdataTake action unrelated to registers
3vdataSet value of vdata register
4noneRead value of vdata register

Commands 0 and 3 are replied with a single ACK 0x06. Command 2 is replied with an ACK 0x06 followed by an "action complete" notifier 0x05. Commands 1 and 4 are replied with a sequence of data packets, each of them must be ACK'ed by the host.

Command 0 must be issued with a 4 byte argument containg the new value for the register (bytes in "LSB first" order). Command 2 typically is issued with a single zero byte as an argument. Command 3 is issued with an argument of variable number of bytes. If this is a printable string, it should not include the trailing zero byte.

Camera replies to the command 1 with a single data packet containing 4 bytes of a 32bit integer (in "LSB first" order). Camera replies to the command 4 with a sequence of data packets with variable number of data bytes. Note that if a printable string is returned, it is terminated with a zero byte, and thus may be safely printed or otherwise treated as a normal C language character string.

Registers

The following registers are known (read/writablity info is inaccurate):
No.TypeR/WDescription
1int32R/WResolution: 1 - Std, 2 - Hi, 3 - Ext, other values possible
2int32R/WClock in UNIX time_t format
3int32R/WShutter speed (microseconds), 0 - auto
4int32 WCurrent frame number (or animation number if hi order byte is 0xff)
5int32R/WAperture: 0 - Auto, 1 - Low, 2 - Med, 3 - ?, 4 - Hi
6int32R/WColor mode: 1 - Color, 2 - B/W
7int32R/WFlash mode: 0 - Auto, 1 - Force, 2 - Off, 3 - Anti RedEye, 4 - Slow sync
8int32R/WUnknown (128)
9int32R/WUnknown (128)
10int32R No. of frames in current folder
11int32R No. of frames left
12int32R Length of current frame *
13int32R Length of current thumbnail *
14vdataR Current frame data *
15vdataR Current thumbnail data *
16int32R Battery capacity percentage
17int32R/WCommunication speed 1 - 9600 .. 5 - 115200, 6 - 230400, 256 - 9600 .. 264 - 911600 (sync?)
18int32R Unknown (1)
19int32R/WBright/Contrast: 0 - Normal, 1 - Contrast+, 2 - Contrast-, 3 - Brightnes+, 4 - Brightnes-
20int32R/WWhite balance: 0 - Auto, 1 - Sunny, 2 - Incandescent, 3 - Fluorescent, 5 - Flash, 6- White preset, 255 - Cloudy
21vdataR/WUnused
22vdataR/WCamera I.D.
23int32R/WAutoshut on host timer (seconds)
24int32R/WAutoshut in field timer (seconds)
25vdataR/WSerial No. (string)
26vdataR Version
27vdataR/WModel
28int32R Available memory left
29vdataR/WUpload image data to this register
30int32 WLED: 0 - Off, 1 - On, 2 - Blink
31vdataR Unknown ("\0")
32int32R Put "magic spell" 0x0FEC000E here before uploading image data
33int32R/WFocus mode: 1 - Macro, 2 - Normal, 3 - Infinity/fisheye
34int32R Operation mode: 1 - Off, 2 - Record, 3-Play, 6-Thumbnail
35int32R/WLCD brightness 1 to 7
36int32R Unknown (3)
37vdataR Unknown ("\0")
38int32R LCD autoshut timer (seconds)
39int32R Protection state of current frame *
40int32R True No. of frames taken
41int32R/WLCD date format: 1 - 'YY MM DD, 2 - DD MM 'HH
42vdataR Unknown ("")
43vdataR Audio data description block *
0: expanded .wav length
1: compressed .wav length
3: Unknown (0)
4: Unknown (0)
5: Unknown (0)
6: Unknown (0)
7: Unknown (0)
44vdataR Audio data *
45vdataR Unknown ("")
46vdataR Camera summary data: 32 bytes with copies of 8 other registers
0: Reg 1 (Resolution)
1: Reg 35 (LCD brightness) or Reg 7 (Flash mode)
2: Reg 10 (Frames taken) or Unknown
3: Unknown (0) or Unknown
4: Unknown (0) or Reg 16 (Battery capacity)
5: Unknown (0) or Reg 10 (Frames taken)
6: Unknown (0) or Reg 11 (Frames left)
7: Number of animations taken
47vdataR Picture summary data: 32 bytes or 8 int32's *
0: Hi order byte: unknown, next 3 bytes: Length of current image
1: Length of current thumbnail
2: Audio data length (expanded)
3: Resolution
4: Protection state
5: TimeDate
6: Unknown (0)
7: Animation type: 1 - 10ms, 2 - 20ms
48vdataR Manufacturer
49vdataR Unknown ("")
50int32R Unknown (0)
51int32R/WCard detected: 1 - No, 2 - Yes
52vdataR/WUnknown ("")
53int32R/WLanguage: 3 - english, 4 - french, 5 - german, 6 - italian, 8 - spanish, 10 - dutch
54-59vdataR Unknown ("")
60int32R True No. of frames taken
61-68vdataR Unknown ("")
69vdataR Exposure Compensation 8 bytes
0: compensation value -20 to +20
1: 0
2: 0
3: 0
4: 10
5: 0
6: 0
7: 0
70int32R/WExp. meter: 2 - Center weighted, 3 - Spot, 5 - Multi element matrix
71vdataR Effective zoom in tenths of millimeters: 8 bytes
0: LSB
1: MSB
2: 0
3: 0
4: 10
5: 0
6: 0
7: 0
72int32R/WBitmap: 1 - AEL/WBL, 2 - Fisheye, 4 - Wide, 8 - Manual zoom, 16 - B/W, 256 - 1.25x, 512 - 1.6x, 768 - 2.0x, 1024 - 2.5x, 1280 - off
73-76vdataR Unknown ("")
77int32 WSize of data packet from camera
(default 0x800)
78vdataR Unknown ("")
79vdataR Filename of current frame *
80-81vdataR Unknown ("")
82int32 WUnknown (enable folder features? Write 60 here)
83int32R/WFolder navigation
When read, return number of folders on the card.
When written without data, reset folder system (?)
Or select current folder by its number
84vdataR/WCurrent folder name (may read or set)
85-90vdataR Unknown ("")
91vdataR Current folder I.D. and name
* Note: Marked registers only become useful for reading after setting register 4. If value of 0 assigned to register 4 after doing action 5, subsequent retrieval of picture data gives the "live preview".

For command 2, the second byte is action code not register number. The following action codes are known:
CodeArgumentDescription
0single zero byteErase last picure
1single zero byteErase all picures (but not animations)
2single zero byteTake picture
4single zero byteFinish session immediately
5single zero byteTake preview snapshot (retreivable as frame zero)
6single byteCalibration / testing. Arg value:
1 Calibrate autofocus
3 Test zoom/exposure
4-6 Store 0 in Reg 32
9 Load LCD Brightness (0-31) from Reg 32
10 Load LCD size (25 for Nikon Coolpix 950) from Reg 32
11 LCD Saturation (0-32) from Reg 32
13 LCD Red-Green (0-32) from Reg 32
14 LCD Blue (0-32) from Reg 32
15 Store -1 in Reg 32
16 Multi shot (locks up if lcd is on)
17 Take picture
18 Store -1 in Reg 32
20-23 locks up if lcd is on
24-255 Store -1 in Reg 32
7single zero byteErase current frame *
8single byteSwitch LCD mode. Arg value:
1 - Off
2 - Record
3 - Play
4 - preview thumbnails (?)
5 - Thumbnail (?)
6 - Thumbnail (?)
7 - Next
8 - Previous
9single byteSet protection state of current frame to the value of parameter (binary 0 or 1)*
11single zero byteStore freshly uploaded image into NVRAM
12single byteLCD test. Arg value:
0 - white
1 - gray
2 - black
3 - red
4 - green
5 - blue
6 - test pattern
* Note: actions 7 and 9 only useful after setting register 0x04. Please mail your corrections/additions to <crosser@average.org>
See http://www.average.org/digicam/ for possible updates.


photopc-3.05/usage.htm 644 2627 62 31021 6751647025 10044 Epson PhotoPC Software for Unix/Linux, Windows, and MS-DOS

Epson PhotoPC Software for Unix/Linux, Windows, and MS-DOS

This page describes "freeware" software which may be used to control and retrieve photos from Epson PhotoPC digital cameras under Unix/Linux, Microsoft Windows 95, Windows 98, Windows NT, and MS-DOS. This software also may work with Agfa ePhoto, Olympus D-xxxL/Z, Sanyo, Nikon Coolpix, Toshiba PDR-2, and other digital cameras based on firmware from Sierra Imaging, Inc..

The Camera

The Epson PhotoPC is one of a family of digital cameras based on Fujitsu's SPARCLite microprocessor and Sierra Imaging's chipsets and firmware. The least expensive Epson camera model produces quality photos in JPEG format at a resolution of 640x480 at a moderate price (~$250 "street price"). Other camera versions, including those from Olympus, produce higher-resolution JPEG images, up to 1280x1024 pixels, using a SRL format much like a conventional 35mm film camera, at a price closer to $1,000. All cameras compatible with this software offer a serial port connection to a PC for the purposes of downloading photos from the camera.

Supported camera models include: Agfa ePhoto 780, ePhoto 1280 and ePhoto 1680; Epson PhotoPC "classic", PhotoPC 500, PhotoPC 550 and PhotoPC 600; Nikon CoolPix 900S and CoolPix 900; Olympus D-220L, D-320L, D-340L, C-400L, C-400Z, D-400 Zoom, C-410L, D-500L, D-600L, D-600 Zoom, C-820L, C-840L, C-900 Zoom, C-1000L and C-1400L; Toshiba PDR-2; and Sanyo VPC-G200, VPC-G200EX, VPC-G210 and DSC-X300.

The Software

The software is command-line oriented, and does not make use of a graphical user interface (GIU). By using this software with a "batch file", or a Windows short-cut icon, photos can be quickly downloaded from the camera to a PC via a serial cable, with a minimum of effort.

The software is available for download (in source code form) for Unix/Linux platforms from the Eugene Crosser's (the author's) digital camera Web site, www.average.org/digicam/. A list of compatible digital cameras can be found there. Software for MS-DOS, Microsoft Windows 95/98, and Microsoft Windows NT, in both executable and source code formats, can be found at Bruce Lightner's PhotoPC Web site, www.lightner.net/lightner/bruce/photopc/.

Documentation

Basic features
  • Query the camera
  • Download individual photos
  • Download entire camera
  • Delete individual photos
  • Delete all photos
  • Get photo count
The basic syntax for using photopc is:
  photopc [-h] [-v[v]] [-q] [-s speed] [-l device] [command [params]] ... 
Commands are normally entered at an "MS-DOS prompt". Under Windows, camera control commands can be entered using an "MS-DOS Prompt" window (sometimes referred to as a "DOS box" or "console window"), or invoked using a Windows "short-cut" icon (or a PIF).

To get help on using the program:

  photopc -h
This will print a brief (somewhat bewildering) summary of the program's options and commands. For a complete description of the program's options and commands see the photopc manual page. This file, "photopc.man", is included with the software source package in Unix `man' format.

Specifying the Camera Port

To specify the serial port to which the camera is attached:
  photopc -l device
where device is the name of the serial port (a.k.a. "line") which has the camera attached. Under Windows and/or MS-DOS, the allowable "device" names are "COM1:" and "COM2:". The default serial port is "COM1:". (Note: That's "dash-L" and not "dash-one"!)

Specifying the Serial Port Speed

To specify the speed of the serial port used to communicate with the camera:
  photopc -s speed
where speed is the requested baud rate: 9600, 19200, 38400, 57600 or 115200. The default speed is usually the highest. You may find that with older PCs a slower speed is needed for reliable operation.

Querying the Camera

To query the camera:
  photopc query 
This will dump the entire state of the camera including information like the number of photos taken, the amount of free memory, the current date/time set in the camera, the camera's model and serial number, the user-specified camera setting, etc.

Downloading a Single Photo

To download a single photo:
  photopc image num filename
where num is the number of the image to be downloaded and filename is the name of the file to receive the JPEG image. For example "photopc image 4 photo4.jpg" will download the 4th photo into the file "photo4.jpg".

Downloading the Entire Camera

To download all the photos in the camera:
  photopc image all directory
where directory is the name of the directory to receive the JPEG files.

For example, the command "photopc image all .", will downloaded all images from the camera into the current working directory, into files named "MMDD_CCC.jpg" where "MM" is the month the photo was taken, "DD" is the day of the month the photo was taken, and "CCC" is a sequence number.

The user can control the program's JPEG file naming algorithm using the "-f" option. Two useful options under MS-DOS are:

    -f 1    (image file names are MMDD_CCC.jpg (default))
    -f 2    (image file names are YYMMDDCC.jpg)
where "YY" is a two-digit year, "MM" is a two-digit month, "DD" is a two-digit day of the month (all based on the the time that the photo was taken), and "CC" (or "CCC") is a sequence number. The user actually has complete control over the file naming through the use of "-f" and a format string...the description of which is beyond the scope of this document.

Deleting a Single Photo

To delete a single photo:
  photopc erase num
where num is the number of the photo to be deleted.

Deleting All Photos

To erase all photos from the camera:
  photopc eraseall
This will delete all photos from the camera.

Getting a Photo Count

To get of count of photos in the camera:
  photopc count
This will report the number of photos currently stored in the camera.

Notes

Command/Switch Order

You can use commands in almost any combination. The program "switches" such as "-l" and "-s" can be placed anywhere on the command line. The commands (such as "query" and "image") are executed in the order given on the command line.

For example, to use serial port COM2 at 57600 baud to query the camera, then download all the images in the camera to the directory "/photos" on drive C: (in "YYMMDDCC.jpg" file name format):

  photopc -l com2: query -f 2 image all c:/photos -s 57600
A command such as this can be invoked as part of a Windows 95 "short-cut" icon, allowing quick, automatic downloading of a camera with a single mouse double-click.

Communication Problems

If you have trouble communicating with your camera, try lowering the serial port speed using the "-s" option. (Turning the camera on also solves many camera communication problems! :-)

If you interrupt communication with your camera by aborting the program (e.g., by enter ^C), you may have to turn the camera off and back on in order to restore proper communication.

If you find that the program cannot connect to your PC's serial port under Windows, first verify that no other program is using the serial port.

The MS-DOS version of "photopc" will work under Windows (even Windows 3.1), but often only at a reduced serial port speed. However, after running the MS-DOS version of the program one must first close the "MS-DOS window" (to release the serial port) before switching back to using the Windows version of "photopc".

Time Zones

Your camera has a real-time clock which can be set by the program. This internal clock is used to time-stamp photos as they are taken. By default, the program assumes that the clock in the camera is set to "universal time" (also known as GMT or Zulu time). Therefore, when the program displays times and/or automatically creates file names using photo time-stamps, "universal time" is converted into "local time" according to your computer's "time zone" setting. If you want to set your camera's internal clock to "local time", and not have the software apply a "time zone correction", then add the "no time zone" switch to the program's command line, as follows:
  photopc -z ... 
Under the MS-DOS operating system, the time zone is set using the "TZ" environment variable. The TZ environment variable can be set with the following MS-DOS command:
  set TZ=zzz[+/-]d[d][lll]
where "zzz" is a required three-character string with the name of the current time zone, "[+/-]d[d]" is a required field with an optionally signed number of one or two digits specifying the local time zone's difference from GMT in hours, and "lll"is an optional three-character field with the name of the local time zone during daylight savings time. This command should be placed in your AUTOEXEC.BAT file. For example, the following command sets the time zone to Pacific Time:
  set TZ=PST8PDT

Under MS-DOS, if the TZ environment variable is not set the program will not apply a time zone correction, giving the same program behavior as with the "-z" command line switch. Under MS-DOS, if the TZ variable is set, but does not satisfy the above described syntax, the time zone correction is undefined (i.e., probably wrong).

Under Windows, unless the "-z" command line switch is set, the program always will apply a time zone correction, as defined by the time zone setting in the Windows operating system. However, if the TZ variable is set (using to the above described syntax), then it overrides the Windows time zone setting, and the program will apply a time zone correction as defined by the TZ variable. Beware that if the TZ variable is set under Windows, but does not satisfy the above described syntax, the time zone correction is undefined (i.e., probably wrong).

Software Revision Level

You can determine the revision level of the program by using the following command:
  photopc -V 
Please include this information when reporting program bugs.

Software License

This software is copyright ©1997, 1998 by Eugene G. Crosser. Microsoft Windows and MS-DOS support is copyright ©1997, 1998, 1999 by Bruce D. Lightner.

You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above.

THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE.

Trademarks referenced herein are those of their respective owners.


Bruce D. Lightner, $Id: usage.htm,v 2.7 1999/03/22 06:55:47 lightner Exp $ photopc-3.05/readme.dos 644 2627 62 10044 6751647021 10170 /* $Id: readme.dos,v 1.8 1999/03/22 06:16:24 lightner Exp $ */ /* Copyright (c) 1997,1998 Eugene G. Crosser Copyright (c) 1998,1999 Bruce D. Lightner (DOS/Windows support) You may distribute and/or use for any purpose modified or unmodified copies of this software if you preserve the copyright notice above. THIS SOFTWARE IS PROVIDED AS IS AND COME WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO EVENT WILL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE. */ /* $Log: readme.dos,v $ Revision 1.8 1999/03/22 06:16:24 lightner Fix typo Revision 1.6 1999/01/17 13:33:48 crosser change copyright info Revision 1.5 1998/10/18 13:18:27 crosser Put RCS logs and I.D. into the source Revision 1.4 1998/08/09 17:02:22 crosser notes about the port speed and TZ variable Revision 1.3 1998/08/01 13:12:41 lightner *** empty log message *** Revision 1.2 1998/02/28 09:20:41 lightner no more file size limit Revision 1.1 1998/02/06 00:17:16 lightner Initial revision */ README.DOS This is a 16-bit MS-DOS version of Eugene G. Crosser's "photopc" digital camera software. This software is known to work with Agfa, Epson and Olympus cameras with 80x86-based PC's, laptops, and "palmtops" (e.g., HP200LX) running MS-DOS. The software has been found to run at the camera's fastest serial port speed (i.e., 115200 baud) on newer PCs. However, a reduced serial port speed (using the -s command line option) may be needed for proper operation on older PCs and laptops (and with most "palmtops", due to their slow processors). Note that the program's default serial port speed is 115200 baud. Note that due to the camera design, negotiation always starts at 19200 baud, so if your serial port only runs up to 9600, it won't work even despite 9600 is a valid communication speed for the program. The MS-DOS version also will run in a command window (i.e., "MS-DOS Prompt") under Windows 95 and Windows NT (but often times only at reduced serial port rates). This MS-DOS version was compiled under Borland International's 16-bit 80x86 compiler, Turbo C++ Version 3.00, using the "small" memory model. Refer to the makefile "makefile.dos" for compile instructions. Pay close attention on the `TZ' environment variable definition. If this variable is not set, or set improperly, MS/DOS makes very strange assumtion about your timezone, and result of setting and displaying of the camera internal clock may be unpredictable. LIMITATIONS: The MS-DOS code has been modified to support >64K byte images (using #define LOW_MEMORY). This was achieved by changing the program's logic to write image data to the disk file in 2048-byte chunks, as the data is being read from the camera. The other versions of the software (i.e., Unix/Windows) write the image to disk only after the entire image has been read from the camera (into a large in-memory buffer). The serial I/O package used by the MS-DOS version of "photopc.exe" supports serial ports COM1, COM2, COM3, and COM4, assuming the standard IRQ assignments (i.e., COM1 and COM3 use IRQ4 and COM2 and COM4 use IRQ3). The "photopc.exe" program installs an interrupt handler for the serial port at IRQ3 or IRQ4. This handler is removed on program exit, or if the user terminates the program with ^C or control-break. Other abnormal exits (e.g., hard disk I/O errors) may leave the the handler installed...which is sure to cause problems! This software makes use of a serial I/O package (comio.c) taken from a public-domain SIMTEL archive named "cvt100.zip" (VT100, A Simple VT100 Emulator in Turbo C 1.5 by Jerry Joplin), which was somehow derived from Kermit. These routines do not take advantage of the serial port queues available in modern PC chipsets (i.e., 16550 UARTS). Refer to the file "README" for more information. Please consult the following URL for the latest softweare information: http://www.average.com/digicam/ Trademarks are properties of their respective respected owners. Bruce D. Lightner (lightner@lightner.net) Sat Jul 25 17:37:40 pdt 1998