mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-25 13:57:15 +00:00
Patch from Ralf Corsepius <corsepiu@faw.uni-ulm.de> to reorganize
the build-tools layout to simplify it. This script reorganizes and simpilfies the build-tools subdirectories. It moves all source-files and scripts to c/build-tools/. This will enable use to use this directory directly to refer to the build-tools instead of copying them around in a "preinstall" step in future. However, RTEMS's autoconf Makefile.ins and *.cfg files are not yet prepared to apply this approach and therefore require additional work.
This commit is contained in:
@@ -5,7 +5,31 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL = @ACLOCAL@ -I $(RTEMS_TOPdir)/aclocal
|
||||
|
||||
SUBDIRS = scripts src
|
||||
bin_PROGRAMS=cklength eolstrip packhex unhex
|
||||
|
||||
cklength_SOURCES = cklength.c
|
||||
eolstrip_SOURCES = eolstrip.c
|
||||
packhex_SOURCES = packhex.c
|
||||
unhex_SOURCES = unhex.c
|
||||
|
||||
bin_SCRIPTS=\
|
||||
install-if-change \
|
||||
lock-directory \
|
||||
unlock-directory \
|
||||
rcs-clean
|
||||
|
||||
noinst_SCRIPTS = search-id.sh
|
||||
|
||||
#
|
||||
# HACK: Install to build directory
|
||||
#
|
||||
install-exec-local: $(bin_PROGRAMS) $(bin_SCRIPTS)
|
||||
if test -n "${RTEMS_BSP}"; then \
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
$(INSTALL_SCRIPT) $(bin_SCRIPTS) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
$(INSTALL_PROGRAM) $(bin_PROGRAMS) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
fi
|
||||
|
||||
preinstall: install-exec-local
|
||||
|
||||
include $(top_srcdir)/../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../automake/local.am
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
@@ -76,21 +75,71 @@ VERSION = @VERSION@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL = @ACLOCAL@ -I $(RTEMS_TOPdir)/aclocal
|
||||
|
||||
SUBDIRS = scripts src
|
||||
bin_PROGRAMS = cklength eolstrip packhex unhex
|
||||
|
||||
cklength_SOURCES = cklength.c
|
||||
eolstrip_SOURCES = eolstrip.c
|
||||
packhex_SOURCES = packhex.c
|
||||
unhex_SOURCES = unhex.c
|
||||
|
||||
bin_SCRIPTS = install-if-change lock-directory unlock-directory rcs-clean
|
||||
|
||||
|
||||
noinst_SCRIPTS = search-id.sh
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
|
||||
CONFIG_HEADER = ./src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = install-if-change lock-directory rcs-clean \
|
||||
unlock-directory
|
||||
bin_PROGRAMS = cklength$(EXEEXT) eolstrip$(EXEEXT) packhex$(EXEEXT) \
|
||||
unhex$(EXEEXT)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I.
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
cklength_OBJECTS = cklength.o
|
||||
cklength_LDADD = $(LDADD)
|
||||
cklength_DEPENDENCIES =
|
||||
cklength_LDFLAGS =
|
||||
eolstrip_OBJECTS = eolstrip.o
|
||||
eolstrip_LDADD = $(LDADD)
|
||||
eolstrip_DEPENDENCIES =
|
||||
eolstrip_LDFLAGS =
|
||||
packhex_OBJECTS = packhex.o
|
||||
packhex_LDADD = $(LDADD)
|
||||
packhex_DEPENDENCIES =
|
||||
packhex_LDFLAGS =
|
||||
unhex_OBJECTS = unhex.o
|
||||
unhex_LDADD = $(LDADD)
|
||||
unhex_DEPENDENCIES =
|
||||
unhex_LDFLAGS =
|
||||
SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS)
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = README ./stamp-h.in Makefile.am Makefile.in aclocal.m4 \
|
||||
config.h.in configure configure.in install-if-change.in \
|
||||
lock-directory.in rcs-clean.in unlock-directory.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/cklength.P .deps/eolstrip.P .deps/packhex.P \
|
||||
.deps/unhex.P
|
||||
SOURCES = $(cklength_SOURCES) $(eolstrip_SOURCES) $(packhex_SOURCES) $(unhex_SOURCES)
|
||||
OBJECTS = $(cklength_OBJECTS) $(eolstrip_OBJECTS) $(packhex_OBJECTS) $(unhex_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/../../automake/subdirs.am $(top_srcdir)/../../automake/local.am
|
||||
.SUFFIXES: .S .c .o .s
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/../../automake/local.am
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
@@ -105,59 +154,116 @@ config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
config.h: stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h; \
|
||||
$(MAKE) stamp-h; \
|
||||
else :; fi
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h 2> /dev/null
|
||||
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
|
||||
|
||||
@SET_MAKE@
|
||||
mostlyclean-hdr:
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
clean-hdr:
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
test "$$subdir" = "." && dot_seen=yes; \
|
||||
done; \
|
||||
test "$$dot_seen" = "no" && rev=". $$rev"; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
install-if-change: $(top_builddir)/config.status install-if-change.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
lock-directory: $(top_builddir)/config.status lock-directory.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
rcs-clean: $(top_builddir)/config.status rcs-clean.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
unlock-directory: $(top_builddir)/config.status unlock-directory.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
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
|
||||
|
||||
.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:
|
||||
|
||||
cklength$(EXEEXT): $(cklength_OBJECTS) $(cklength_DEPENDENCIES)
|
||||
@rm -f cklength$(EXEEXT)
|
||||
$(LINK) $(cklength_LDFLAGS) $(cklength_OBJECTS) $(cklength_LDADD) $(LIBS)
|
||||
|
||||
eolstrip$(EXEEXT): $(eolstrip_OBJECTS) $(eolstrip_DEPENDENCIES)
|
||||
@rm -f eolstrip$(EXEEXT)
|
||||
$(LINK) $(eolstrip_LDFLAGS) $(eolstrip_OBJECTS) $(eolstrip_LDADD) $(LIBS)
|
||||
|
||||
packhex$(EXEEXT): $(packhex_OBJECTS) $(packhex_DEPENDENCIES)
|
||||
@rm -f packhex$(EXEEXT)
|
||||
$(LINK) $(packhex_LDFLAGS) $(packhex_OBJECTS) $(packhex_LDADD) $(LIBS)
|
||||
|
||||
unhex$(EXEEXT): $(unhex_OBJECTS) $(unhex_DEPENDENCIES)
|
||||
@rm -f unhex$(EXEEXT)
|
||||
$(LINK) $(unhex_LDFLAGS) $(unhex_OBJECTS) $(unhex_LDADD) $(LIBS)
|
||||
|
||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else :; fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-binSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
@@ -170,20 +276,15 @@ ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
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:
|
||||
|
||||
@@ -247,41 +348,67 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-recursive
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-recursive
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-recursive
|
||||
install-exec-am:
|
||||
install-exec: install-exec-recursive
|
||||
installcheck: installcheck-am
|
||||
all-recursive-am: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
install-exec-am: install-binPROGRAMS install-binSCRIPTS \
|
||||
install-exec-local
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-recursive
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-recursive
|
||||
uninstall-am:
|
||||
uninstall: uninstall-recursive
|
||||
all-am: Makefile
|
||||
all-redirect: all-recursive
|
||||
install: install-am
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(PROGRAMS) $(SCRIPTS) config.h
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(bindir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
@@ -293,78 +420,60 @@ distclean-generic:
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-tags mostlyclean-generic
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
|
||||
mostlyclean-compile mostlyclean-tags mostlyclean-depend \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-tags clean-generic mostlyclean-am
|
||||
clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-recursive
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-tags distclean-generic clean-am
|
||||
distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
|
||||
distclean-tags distclean-depend distclean-generic \
|
||||
clean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
distclean: distclean-am
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-tags \
|
||||
maintainer-clean-depend 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-recursive
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: install-data-recursive uninstall-data-recursive \
|
||||
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
|
||||
uninstalldirs-recursive all-recursive check-recursive \
|
||||
installcheck-recursive info-recursive dvi-recursive \
|
||||
mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs-am \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile uninstall-binSCRIPTS install-binSCRIPTS tags \
|
||||
mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
|
||||
distdir mostlyclean-depend distclean-depend clean-depend \
|
||||
maintainer-clean-depend info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck all-recursive-am install-exec-local \
|
||||
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
|
||||
|
||||
|
||||
preinstall-recursive \
|
||||
debug-recursive debug_install-recursive \
|
||||
profile-recursive profile_install-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
#
|
||||
# HACK: Install to build directory
|
||||
#
|
||||
install-exec-local: $(bin_PROGRAMS) $(bin_SCRIPTS)
|
||||
if test -n "${RTEMS_BSP}"; then \
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
$(INSTALL_SCRIPT) $(bin_SCRIPTS) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
$(INSTALL_PROGRAM) $(bin_PROGRAMS) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
fi
|
||||
|
||||
debug: debug-recursive
|
||||
|
||||
debug_install: debug_install-recursive
|
||||
|
||||
profile: profile-recursive
|
||||
|
||||
profile_install: profile_install-recursive
|
||||
|
||||
preinstall: preinstall-recursive
|
||||
|
||||
.PHONY: \
|
||||
debug debug-recursive \
|
||||
debug_install \
|
||||
profile profile-recursive \
|
||||
profile_install \
|
||||
preinstall preinstall-recursive
|
||||
preinstall: install-exec-local
|
||||
|
||||
debug-am:
|
||||
|
||||
|
||||
28
c/build-tools/configure
vendored
28
c/build-tools/configure
vendored
@@ -453,7 +453,7 @@ 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=scripts
|
||||
ac_unique_file=README
|
||||
|
||||
# Find the source files, if location was not specified.
|
||||
if test -z "$srcdir"; then
|
||||
@@ -1357,13 +1357,11 @@ ac_given_srcdir=$srcdir
|
||||
ac_given_INSTALL="$INSTALL"
|
||||
|
||||
trap 'rm -fr `echo "Makefile
|
||||
src/Makefile
|
||||
scripts/Makefile
|
||||
scripts/install-if-change
|
||||
scripts/lock-directory
|
||||
scripts/rcs-clean
|
||||
scripts/unlock-directory
|
||||
src/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
install-if-change
|
||||
lock-directory
|
||||
rcs-clean
|
||||
unlock-directory
|
||||
config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
@@ -1459,12 +1457,10 @@ EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
CONFIG_FILES=\${CONFIG_FILES-"Makefile
|
||||
src/Makefile
|
||||
scripts/Makefile
|
||||
scripts/install-if-change
|
||||
scripts/lock-directory
|
||||
scripts/rcs-clean
|
||||
scripts/unlock-directory
|
||||
install-if-change
|
||||
lock-directory
|
||||
rcs-clean
|
||||
unlock-directory
|
||||
"}
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
@@ -1546,7 +1542,7 @@ ac_eD='%g'
|
||||
if test "${CONFIG_HEADERS+set}" != set; then
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
CONFIG_HEADERS="src/config.h"
|
||||
CONFIG_HEADERS="config.h"
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
fi
|
||||
@@ -1637,7 +1633,7 @@ cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
test -z "$CONFIG_HEADERS" || echo timestamp > src/stamp-h
|
||||
test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
AC_PREREQ(2.13)
|
||||
AC_INIT(scripts)
|
||||
AC_INIT(README)
|
||||
AC_CONFIG_AUX_DIR(../..)
|
||||
RTEMS_TOP(../..)
|
||||
|
||||
@@ -17,14 +17,12 @@ AC_CHECK_FUNCS(strerror)
|
||||
|
||||
RTEMS_PATH_KSH
|
||||
|
||||
AM_CONFIG_HEADER(src/config.h)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
src/Makefile
|
||||
scripts/Makefile
|
||||
scripts/install-if-change
|
||||
scripts/lock-directory
|
||||
scripts/rcs-clean
|
||||
scripts/unlock-directory
|
||||
install-if-change
|
||||
lock-directory
|
||||
rcs-clean
|
||||
unlock-directory
|
||||
)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
# FIXME: Is this subdirectory still in use ?
|
||||
## SUBDIRS = msdos
|
||||
include $(top_srcdir)/../../automake/local.am
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = ../../..
|
||||
subdir = c/build-tools/os
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
RTEMS_ROOT = $(top_srcdir)/@RTEMS_TOPdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/directory.cfg
|
||||
|
||||
SUB_DIRS=$(wildcard $(RTEMS_HOST))
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
@@ -1,7 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
# FIXME: Is this subdirectory still in use?
|
||||
include $(top_srcdir)/../../automake/local.am
|
||||
@@ -1,49 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = ../../../..
|
||||
subdir = c/build-tools/os/msdos
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
RTEMS_ROOT = $(top_srcdir)/@RTEMS_TOPdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
DESTDIR=$(PROJECT_RELEASE)/build-tools
|
||||
|
||||
INSTALLED=$(DESTDIR)/ifc.exe \
|
||||
$(DESTDIR)/cklength.exe \
|
||||
$(DESTDIR)/fixtimer.exe
|
||||
|
||||
all: $(DESTDIR) $(PGMS) install
|
||||
|
||||
$(DESTDIR):
|
||||
@top_srcdir@/mkinstalldirs $@
|
||||
|
||||
install: $(INSTALLED)
|
||||
|
||||
# Install the programs
|
||||
$(DESTDIR)/ifc.exe: ifc_exe.uue
|
||||
uudecode <ifc_exe.uue
|
||||
mv ifc.exe $(DESTDIR)/ifc.exe
|
||||
|
||||
$(DESTDIR)/cklength.exe: cklength.uue
|
||||
uudecode <cklength.uue
|
||||
mv cklength.exe $(DESTDIR)/cklength.exe
|
||||
|
||||
$(DESTDIR)/fixtimer.exe: fixtimer.uue
|
||||
uudecode <fixtimer.uue
|
||||
mv fixtimer.exe $(DESTDIR)/fixtimer.exe
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
@@ -1,12 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
ifc is an MS-DOS executable which is equivalent to the program
|
||||
install-if-change. It was compiled using Borland C 2.00.
|
||||
|
||||
cklength is a precompiled version of the program cklength.c from
|
||||
the main source tree.
|
||||
|
||||
fixtimer is a program to restore the clock if the program does not
|
||||
exit cleanly.
|
||||
@@ -1,286 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
begin 664 cklength
|
||||
M?T5,1@$" 0 " ( ! $,% #0 "T8 T "
|
||||
M!0 H !H %P 8 T $ - "@ H 4 P
|
||||
M -0 !$ ! ! ! 7
|
||||
M2P %TL % $ $ !=, (73 &\ %? < 0
|
||||
M @ %U A=0 (@ !P O=7-R+VQI8B]L9"YS
|
||||
M;RXQ $, !6 20 #P
|
||||
M #@ $4 /0 !P !# &@
|
||||
M A 30 #\ *0 $X !" D
|
||||
M $@ W $8 )@ "
|
||||
M ! %( 4P Z *@ 00
|
||||
M $H 'P $L !5 3P L .P %0 H
|
||||
M-@ #$ P 40
|
||||
M
|
||||
M
|
||||
M G
|
||||
M '0 C ; N
|
||||
M "( -0 E #D R - !X
|
||||
M "T ,P !$ *P
|
||||
M ^ "\ 3 % !'
|
||||
M 0#4 , $ $ Z # "
|
||||
M ! U0 P P 0BT , 0 $*W #
|
||||
M % !"S P !@ 0P4 , < $32
|
||||
M # ( !$^ P "0 1/L , H $3
|
||||
M] # + !% P # A=, , T
|
||||
M (74 # . "%]@ P #P ACP , !
|
||||
M (9" # 1 P $@ ,
|
||||
M !, # 4 P %0
|
||||
M , !8 # 7 P &
|
||||
M , !D ! (8. 2 " !$_0 $0 "P !8
|
||||
M 0P4 =!( < = (8U 2 (@ "&$0 $@
|
||||
M "< 1/L !$ H U (8O 2 / "&0@ $$0
|
||||
M$0 $4 AB8 !( !. (9# 01 1 5P "',@
|
||||
M$0#_\0 %P 1+ 2!( < !B $2> $@2 ' 9P !$8@
|
||||
M "H$@ !P &\ AD8 !0"$ !$ !T (73 1 /_Q B@ "
|
||||
M&*0 $@ ) A@( !( "7 (8% 2
|
||||
MG !$T@ $@ " *( ACT !!$ ! "J (9$ 01 1
|
||||
M M "&E@ )@$0 $0 , AB !( #' (8\ 01
|
||||
M 0 S0 "%U $0#_\0 -8 0[H !0!( < #> (9&
|
||||
M 4 1 1 Y "&E@ )@$0 $0 /$ AC@ !( #W (8
|
||||
M+ 2 _P "&" $@ 04 AD, !"$ !$ $-
|
||||
M (<N 01 1 !$P "&+ $@ 1H 1 H !8!( <
|
||||
M $@ (8_ 01 0 !,P "'+P $$0 $0 3H AC( !(
|
||||
M $_ (<P 01 1 !1@ "&&@ $@ 4P AS$
|
||||
M!!$ !$ %3 (8^ 01 0 !9P "&0@ $0#_\0 6X A?8
|
||||
M !$ __$ &( (87 2 !C@ "&1 $$0 $0 9<
|
||||
M 1,( /!( < &I $3\ 1 * !M@ !%TL $0#_\0
|
||||
M ;T 10 !!$ P '* $2, $@2 ' !SP "&(P $@
|
||||
M =8 0R( !( < 'H $3^ 1 + !]0 !#10 '4
|
||||
M$@ !P ?H AD !!$ ! (& (8= 2 "#0 !$^
|
||||
M $@ "0 A, AA0 !( 9V5T;W!T %]?1%1/4E],25-47U\
|
||||
M7W-T87)T ')E860 871O:0!?7T-43U)?3$E35%]? '-T<G1O; !P<F]G;F%M
|
||||
M90!V9G!R:6YT9@!?96YV:7)O;@!?96YD %=R:71E %)E860 9V5T<&%R;0!?
|
||||
M:6]B %]'3$]"04Q?3T9&4T547U1!0DQ%7P!A8F]R= !A=&5X:70 97AI= !?
|
||||
M:6YI= !V97)B;W-E %]S>7-?;F5R<@!S>7-?97)R;&ES= !F8VQO<V4 55-!
|
||||
M1T4 7T193D%-24, <')O8V5S<P!?7VEO8@!?<WES7V5R<FQI<W0 =W)I=&4
|
||||
M<W1R<F-H<@!?97AI= !E;G9I<F]N &5R<FYO '-T<F-H<@!E<G)O<@!R97!O
|
||||
M<G1?;&EN95]L96YG=&@ ;W!T:6YD &]P96X ;W!T87)G &9G971S &]P=&5R
|
||||
M<@!R97!O<G1?;&EN95]N=6UB97)S %]E9&%T80!?4%)/0T5$55)%7TQ)3DM!
|
||||
M1T5?5$%"3$5? &9O<&5N '-Y<U]N97)R %]?9&]?9VQO8F%L7V1T;W)S %]?
|
||||
M0U1/4E]%3D1?7P!?971E>'0 7VQI8E]V97)S:6]N $]P96X 9F9L=7-H %]?
|
||||
M9&]?9VQO8F%L7V-T;W)S %]?1%1/4E]%3D1?7P!M86EN &QI;F5?;&5N9W1H
|
||||
M '-T<FQE;@!?9FEN:0!F<')I;G1F &QI8F,N<V\N,0 AD, C$P
|
||||
M AS$ !#$P AS !!$P AR\ _$P AD8 U
|
||||
M$P " AD0 !($P AI8 P$P A@( K%0 A@4
|
||||
M L%0 A@@ Y%0 A@L X%0 A@X :%0
|
||||
M AA$ >%0 AA0 !5%0 AA< !'%0 AAH !"%0
|
||||
M AAT !3%0 AB Q%0 AB, !.%0 AB8 B
|
||||
M%0 ABD J%0 ABP \%0 AB\ @%0 AC(
|
||||
M ! %0 AC4 =%0 AC@ W%0 "\$" X .@0*(#H$2<
|
||||
M(Z @@) 0* 20$ !0 !"]@$ 1 !$D!(CX$ 0O(! 0 !P $
|
||||
M "0$ 0DA $94L( *4 J $E 1 "A< (:6$N$,U"+ $ "D! 0 !"
|
||||
MYP$ ! $+H 0 ('#X @! $0 1-0"(^R HK__$H #9(2(^S0 F $
|
||||
M@*(@ * F4$" E@)@!)(0( "2 F $T ) "X"B( 2O__]E *@ 9*2@ "
|
||||
M@ ,$0 1!$ $2B$B/LH2I@ M $ !&?P@ 0 *"$/_PRO__]T 0 $1$
|
||||
M $1 $+!D!(C"(''X B!Z G>._F*@0 !BB$" L! @ - &0 ! $+!DA @
|
||||
M+Q, (: HB $H !- B80@0@ $T 9 - "80B0 B !T")A"!$ (;0 B$(
|
||||
MT"9 !$ (? (B#$(0 AB< (8E "&%0 19 0 !22$ 90 !"KI02H:"
|
||||
MHC__ H ,X"B(&PB@ 1$0 AQ2 F HB!N@*(@/P* "J HB!. H '- $
|
||||
M(/@0O__P%0 10* !. HB!V H 'M $H/00O__J%0 14 0IO0 B# E!
|
||||
M"!$ (: HJ( "+__XM0B(0 3 !%$0@ $ (N2$F&H$+__W14 $70!"#X
|
||||
M@* ")!@/_\0O__7T"0@^("@ B08#__T"0@^- $X/R H (D& __Q"__\_0
|
||||
M).#\@* ")!@/_\0O__+T"2@]!"__\FB$" !@*1@ "* L1 "'%0 AA$
|
||||
M (:0$B$X$P 19(28<A $)VU *@\$ 0F60$" !DA "- "(+R1*B "T 9
|
||||
M"("B( "@ 1(0 A] "8+R1*B "0 #] &0 B HC__(H K 0/__0!""\
|
||||
MD (@ = D(+R1*B "T 9 "("B( 2O__SDA $(''X B!Z G>.]F) 0 !@3
|
||||
M !%0 !"6I(28="JD@ $H !Z80( 1& $P 19(28=A !%E! &* 0
|
||||
M( &H![WX)0 ABT (:0$ 4DA B $ 0DV4$ 5@*(@ * #4! 0 !"
|
||||
M2Y 0 !2B C__$0 AM "(0" I$ (!( *X"DX 2@ +$0 AA, $60%*$X
|
||||
MDA)A^$ 0C64$ 8T 6@^("B( "@ B$0 AM "(/2 HB H !Q, $60
|
||||
M%*$XDA)B )00 !! $(HE@>]^- %H/B HB H $A$ (;0 B#\@*(@ *
|
||||
M D3 !%D!2A.)(28AB4$ 00 !"&Y80 !$0@ (I@3@ 1, $60%*$XDA)B
|
||||
M($ 0A24$ 0I@3@ 1"__\B@!" !0 !"&Y 0 !6P$" @<?@"('H "=X[^0
|
||||
M\B>@2/0GH$SV)Z!0^">@5/HGH%@1 "&0 !"$I 2(2@1' LBX "!$0 "
|
||||
MC@ ( H !*('H$P1 "'\@(@N. 'H$@5 "&-0 AI 6H3@3 !%DA)B*$
|
||||
M0?/4 J$(D!:A.)(0 !! $(!E! $8"F8 "@ :$0 A@2 !*0$B$X$0
|
||||
MAM "(1" ID (-H #!$ (85 "&E!*B6)<N8 *0%J$X$P 19(28C! $'=
|
||||
MU + "A" X1 "&D!(A.!, $62$F(X0 !!UI00 !D0@ '$0 AI 2(3@3
|
||||
M !%0 !!T)(28E 1 "&0 !!W) 2(3@1# @(X " * !41" @(X " *
|
||||
M R IF H !1$ $41 !%$( Y(2(EB2$B)P?___M) 0( ! $&MD!
|
||||
M&9 0( 3 !%?___KI(28GA $'+ 0 (''X B!Z G>._F* 0 !@1 !%
|
||||
MD!(BD$ 0<;23 @*(@ !* F0$ 0$0@ !, $62$F*@?___G)00 ! 0
|
||||
M@ :L! &9(0( ! $&\E! @ + 0 B I@ 9!H !("F !H$@ 1 0 ("F
|
||||
M0!H2@ ($0@ !, $62$F*XE! $'___XF6$ :,( !Q, $62$F+0E!
|
||||
M&Y80 !E___^"F! &H''X B!Z G>._F* 0 !B0$ 0DA &4 0:*4$ :
|
||||
ML! "("F/_\2@ ($1@ !, $62$F+PE! $)80 !E___]PF! &H''X B!
|
||||
MZ G>._F* 0 !B0$ 0DA &4 09.4$ :L! "("F/_\2@ ($1@ !,
|
||||
M $62$F,0E! $)80 !E___]>F! &H''X B!Z G>._F* 0 !B0$ 0DA
|
||||
M&4 0824$ :L! "("F/_\2@ ($1@ !, $62$F,PE! $)80 !E___],
|
||||
MF! &H''X B!Z G>._F!$ $32 B/X@*)@ * F@$B/XT 0 )_" "@
|
||||
M!" $T 0 ("B( 2O__[ 0 (''X B!Z G>._F)WCOZ"!Z G>._F!$
|
||||
M $34 B/L@**__Q* V2$B/LT )@!("B( "@ )E! @ )8"8 22$" D@)@
|
||||
M!- "0 N HB $K___90"H &2DH H #!$ $01 !$HA(C[*$J8 +0! 1
|
||||
MG\( $ "@A#_\,K___= $ !$1 !$0 !!$) 2(PB!Q^ (@>@ (''X B!
|
||||
MZ G>._H(''X B!Z _____P #_____ ! '5S
|
||||
M86=E.B @8VML96YG=&@@(%L@+78@72!;(&%R9R N+BX@72!F:6QE<RXN+B *
|
||||
M(" @(" @(" @(" @+6P@;&5N9W1H(" @+2T@;6%X:6UU;2!L:6YE(&QE;F=T
|
||||
M: H@(" @(" @(" @(" M;B @(" @(" @(" M+2!R97!O<G0@;&EN92!N=6UB
|
||||
M97)S(&9O<B!O9F9E;F1I;F<@;&EN97,*(" @(" @(" @(" @+4X@(" @(" @
|
||||
M(" @+2T@<F5P;W)T(&QI;F4@;G5M8F5R<R!A;F0@;&5N9W1H(&9O<B!O9F9E
|
||||
M;F1I;F<@;&EN97,*(" @(" @(" @(" @+78@(" @(" @(" @+2T@=F5R8F]S
|
||||
M90H*4')I;G0@=&AE(&YA;64@;V8@9FEL97,@=VAI8V@@:&%V92!A="!L96%S
|
||||
M=" Q(&QI;F4@=VAI8V@@97AC965D<R!T:&4*;6%X:6UU;2!L:6YE(&QE;F=T
|
||||
M:"X@(%1H92!D969A=6QT(&UA>&EM=6T@;&EN92!L96YG=&@@:7,@.# N"@
|
||||
M &PZ;DYV *"5D*2!I<R!I;&QE9V%L(&QI;F4@;&5N9W1H"@ E<P
|
||||
M '( 56YA8FQE('1O(&]P96X@9FEL92 H)7,I"@ E
|
||||
M<PH %1/3R!,3TY'.B5D.B E<PH "5D.B E9 H )60*
|
||||
M E<SH@ " H)7,I"@ ("AU;FMN;W=N(&5R<FYO/25D*0H "@
|
||||
M !F871A;"!E<G)O<BP@97AI=&EN9P !E>&ET:6YG &9A=&%L(&5R
|
||||
M<F]R+"!A8F]R=&EN9P # Q,C,T-38W.#DM G)7,G(&ES(&YO="!A
|
||||
M(&YU;6)E<@ E<R!C86X@;VYL>2!B92 E;&0 E<R!M=7-T(&)E
|
||||
M(&)E='=E96X@)6QD(&%N9" E;&0 &]P96XH)R5S)RP@,'@E>"P@,"5O*2!F
|
||||
M86EL960 <F5A9"@E9"P@,'@E>"P@)60I(&9A:6QE9 !W<FET
|
||||
M92@E9"P@,'@E>"P@)60I(&9A:6QE9 (74 $ (; # !$T@
|
||||
M - $3X 0 0#H !0 !"+0 * ")0 8 0-4 "P
|
||||
M ! 5 , A?8 @ .0 4 !P !< 0LP
|
||||
M!P !"MP ( !. D ,
|
||||
M # P,+__\P$ #
|
||||
M \,+__\ $ # !(,+__[0$ # !4,+__Z@$ # !@,+__YP$
|
||||
M # !L,+__Y $ # !X,+__X0$ # "$,+__W@$ # "0,+__
|
||||
MVP$ # "<,+__V $ # "H,+__U0$ # "T,+__T@$ # #
|
||||
M,+__SP$ # #,,+__S $ # #8,+__R0$ # #D,+__Q@$ #
|
||||
M #P,+__PP$ # #\,+__P $ # $(,+__O0$ ! $4"
|
||||
M % $
|
||||
M 0 __$ $ U # ! ! .@ P @ 0-4
|
||||
M , , $(M # $ !"MP P !0
|
||||
M 0LP , 8 $,% # ' !$T@ P "
|
||||
M 1/@ , D $3[ # * !$_0 P
|
||||
M"P 10 , P (73 # - "%U
|
||||
M P #@ A?8 , \ (8\ # 0 "&0@
|
||||
M P $0 , !( # 3
|
||||
M P % , !4 # 6
|
||||
M P %P , !@ # 9
|
||||
M #P ! #_\0 !8 0 __$ B $
|
||||
M /_Q +0 !$U @ " $, 0R( < !2 (8\
|
||||
M ! 0 8 ! #_\0 &L 0T4 < !Z
|
||||
M $ /_Q A ! #_\0 (\ 1-$ ( < "E
|
||||
M $31 ' M "&00 0 $ ,( 0 __$
|
||||
M #) (8. 2 T !$_0 $0 "P -X 0P4 =!(
|
||||
M < #E (8U 2 Z@ "&$0 $@ .\ 1/L
|
||||
M !$ H #] (8O 2 !! "&0@ $$0 $0 0T AB8
|
||||
M !( $6 (9# 01 1 !'P "',@ $0#_\0 20
|
||||
M 1+ 2!( < $J $2> $@2 ' !+P !$8@ "H$@ !P
|
||||
M 3< AD8 !0"$ !$ $\ (73 1 /_Q !4@ "&*0 $@
|
||||
M 5@ A@( !( %? (8% 2 !9 !$T@
|
||||
M$@ " 6H ACT !!$ ! %R (9$ 01 1 !? "&E@
|
||||
M )@$0 $0 8@ AB !( &/ (8\ 01 0 !E0 "
|
||||
M%U $0#_\0 9X 0[H !0!( < &F (9& 4 1 1 !
|
||||
MK "&E@ )@$0 $0 ;D AC@ !( &_ (8+ 2
|
||||
M !QP "&" $@ <T AD, !"$ !$ '5 (<N 01
|
||||
M 1 !VP "&+ $@ >( 1 H !8!( < 'H (8_
|
||||
M 01 0 !^P "'+P $$0 $0 @( AC( !( (' (<
|
||||
MP 01 1 "#@ "&&@ $@ A0 AS$ !!$ !$ (;
|
||||
M (8^ 01 0 "+P "&0@ $0#_\0 C8 A?8 !$ __$
|
||||
M )0 (87 2 "5@ "&1 $$0 $0 E\ 1,( /!(
|
||||
M < )Q $3\ 1 * "?@ !%TL $0#_\0 H4 10
|
||||
M!!$ P *2 $2, $@2 ' "EP "&(P $@ IX 0R(
|
||||
M !( < *P $3^ 1 + "O0 !#10 '4$@ !P L(
|
||||
M AD !!$ ! +. (8= 2 "U0 !$^ $@ "0
|
||||
M ML AA0 !( 9V\S,B]C:VQE;F=T: !C<G1I+G, =F%L=65S+5AA
|
||||
M+F, 8W)T<W1U9F8N8P!?7V1O7V=L;V)A;%]C=&]R<U]A=7@ 9V-C,E]C;VUP
|
||||
M:6QE9"X 9F]R8V5?=&]?9&%T80!C:VQE;F=T:"YC &=C8S)?8V]M<&EL960N
|
||||
M &QI8F=C8S(N8P!C<G1S='5F9BYC %]?9&]?9VQO8F%L7V-T;W)S7V%U> !G
|
||||
M8V,R7V-O;7!I;&5D+@!F;W)C95]T;U]D871A &-R=&XN<P!G971O<'0 7U]$
|
||||
M5$]27TQ)4U1?7P!?<W1A<G0 <F5A9 !A=&]I %]?0U1/4E],25-47U\ <W1R
|
||||
M=&]L '!R;V=N86UE '9F<')I;G1F %]E;G9I<F]N %]E;F0 5W)I=&4 4F5A
|
||||
M9 !G971P87)M %]I;V( 7T=,3T)!3%]/1D93151?5$%"3$5? &%B;W)T &%T
|
||||
M97AI= !E>&ET %]I;FET '9E<F)O<V4 7W-Y<U]N97)R '-Y<U]E<G)L:7-T
|
||||
M &9C;&]S90!54T%'10!?1%E.04U)0P!P<F]C97-S %]?:6]B %]S>7-?97)R
|
||||
M;&ES= !W<FET90!S=')R8VAR %]E>&ET &5N=FER;VX 97)R;F\ <W1R8VAR
|
||||
M &5R<F]R ')E<&]R=%]L:6YE7VQE;F=T: !O<'1I;F0 ;W!E;@!O<'1A<F<
|
||||
M9F=E=', ;W!T97)R ')E<&]R=%]L:6YE7VYU;6)E<G, 7V5D871A %]04D]#
|
||||
M14154D5?3$E.2T%'15]404),15\ 9F]P96X <WES7VYE<G( 7U]D;U]G;&]B
|
||||
M86Q?9'1O<G, 7U]#5$]27T5.1%]? %]E=&5X= !?;&EB7W9E<G-I;VX 3W!E
|
||||
M;@!F9FQU<V@ 7U]D;U]G;&]B86Q?8W1O<G, 7U]$5$]27T5.1%]? &UA:6X
|
||||
M;&EN95]L96YG=&@ <W1R;&5N %]F:6YI &9P<FEN=&8 $ %
|
||||
MFP UD "]D # %$X ((X
|
||||
M $8\ ! *",I4W5N3U,@-2XS($=E;F5R:6,@4V5P=&5M
|
||||
M8F5R(#$Y.3, &%S.B!30S,N,"!E87)L>2!A8V-E<W,@,#$@4V5P(#$Y.3,*
|
||||
M $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N,"!E87)L>2!A8V-E<W,@,#$@
|
||||
M4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N,"!E87)L>2!A
|
||||
M8V-E<W,@,#$@4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N
|
||||
M,"!E87)L>2!A8V-E<W,@,#$@4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C,
|
||||
M;&0Z("A31U4I(%-U;D]3+T5,1B H3$LM,2XS*0 0 "D 8?
|
||||
M"V0 1,( (60 1,( +3P /(
|
||||
M 7H <( EX L(
|
||||
M SH !$H !5H !=(
|
||||
M !EH !LX !SX !
|
||||
MX8 !]( "#( ".8
|
||||
M "5( "<( "D8 "G8
|
||||
M "R( #&8 $GH %+(
|
||||
M & %.8 ) %0X -< %3H #0 %
|
||||
M6H #4 %9( #8 %;X #< %>8 #@
|
||||
M %A( #D %CX #H %FH $8 %IX
|
||||
M %T( &T %]( "X &"20 !\L 1,( "YI;G1E
|
||||
M<G +FAA<V@ +F1Y;G-Y;0 N9'EN<W1R "YR96QA+F)S<P N<F5L82YP;'0
|
||||
M+G1E>'0 +FEN:70 +F9I;FD +F-T;W)S "YD=&]R<P N<F]D871A "YG;W0
|
||||
M+F1Y;F%M:6, +G!L= N9&%T80 N8G-S "YS>6UT86( +G-T<G1A8@ N<W1A
|
||||
M8BYI;F1E> N8V]M;65N= N<W1A8@ N<VAS=')T86( +G-T86(N:6YD97AS
|
||||
M='( +G-T86)S='( '9A;'5E<RU882YC "\Q,#DS+V]N,3 Y,U]W<R]U<W(O
|
||||
M<W)C+VQI8B]L:6)C+P!P;W)T+V=E;B]V86QU97,M6&$N8P %AT(#L@5CTR
|
||||
M+C +VYE="]M;W)G86YA+W5S<C$O<G1E;7,M,RXU+C P+V,O8G5I;&0M=&]O
|
||||
M;',O<W)C "]U<W(O8V-S+VQI8B]V86QU97,M6&$N;P ;&EB9V-C,BYC "]U
|
||||
M<W(T+T=.050O9V-C+3(N-BXS+P N+VQI8F=C8S(N8P!G8V,R7V-O;7!I;&5D
|
||||
M+@!I;G0Z=#$]<C$[+3(Q-#<T.#,V-#@[,C$T-S0X,S8T-SL 8VAA<CIT,CUR
|
||||
M,CLP.S$R-SL ;&]N9R!I;G0Z=#,]<C$[+3(Q-#<T.#,V-#@[,C$T-S0X,S8T
|
||||
M-SL =6YS:6=N960@:6YT.G0T/7(Q.S [+3$[ &QO;F<@=6YS:6=N960@:6YT
|
||||
M.G0U/7(Q.S [+3$[ &QO;F<@;&]N9R!I;G0Z=#8]<C$[,#$P,# P,# P,# P
|
||||
M,# P,# P,# P,# [,#<W-S<W-S<W-S<W-S<W-S<W-S<W-SL ;&]N9R!L;VYG
|
||||
M('5N<VEG;F5D(&EN=#IT-SUR,3LP,# P,# P,# P,# P.S Q-S<W-S<W-S<W
|
||||
M-S<W-S<W-S<W-S<W.P!S:&]R="!I;G0Z=#@]<C$[+3,R-S8X.S,R-S8W.P!S
|
||||
M:&]R="!U;G-I9VYE9"!I;G0Z=#D]<C$[,#LV-34S-3L <VEG;F5D(&-H87(Z
|
||||
M=#$P/7(Q.RTQ,C@[,3(W.P!U;G-I9VYE9"!C:&%R.G0Q,3UR,3LP.S(U-3L
|
||||
M9FQO870Z=#$R/7(Q.S0[,#L 9&]U8FQE.G0Q,SUR,3LX.S [ &QO;F<@9&]U
|
||||
M8FQE.G0Q-#UR,3LX.S [ &-O;7!L97@@:6YT.G0Q-3US.')E86PZ,2PP+#,R
|
||||
M.VEM86<Z,2PS,BPS,CL[ &-O;7!L97@@9FQO870Z=#$V/7(Q-CLT.S [ &-O
|
||||
M;7!L97@@9&]U8FQE.G0Q-SUR,3<[.#LP.P!C;VUP;&5X(&QO;F<@9&]U8FQE
|
||||
M.G0Q.#UR,3@[.#LP.P!V;VED.G0Q.3TQ.0!A<F-H7W1Y<&4Z5#(P/65!4D-(
|
||||
M7S,R0DE4.C L05)#2%\V-$))5#HQ+#L <F5G7V-L87-S.E0R,3UE3D]?4D5'
|
||||
M4SHP+$=%3D5204Q?4D5'4SHQ+$907U)%1U,Z,BQ!3$Q?4D5'4SHS+$Q)35]2
|
||||
M14=?0TQ!4U-%4SHT+#L ;6%C:&EN95]M;V1E.E0R,CUE5D])1&UO9&4Z,"Q1
|
||||
M26UO9&4Z,2Q(26UO9&4Z,BQ04TEM;V1E.C,L4TEM;V1E.C0L4$1);6]D93HU
|
||||
M+$1);6]D93HV+%1);6]D93HW+$]);6]D93HX+%%&;6]D93HY+$A&;6]D93HQ
|
||||
M,"Q4449M;V1E.C$Q+%-&;6]D93HQ,BQ$1FUO9&4Z,3,L6$9M;V1E.C$T+%1&
|
||||
M;6]D93HQ-2Q30VUO9&4Z,38L1$-M;V1E.C$W+%A#;6]D93HQ."Q40VUO9&4Z
|
||||
M,3DL0U%);6]D93HR,"Q#2$EM;V1E.C(Q+$-326UO9&4Z,C(L0T1);6]D93HR
|
||||
M,RQ#5$EM;V1E.C(T+$-/26UO9&4Z,C4L0DQ+;6]D93HR-BQ#0VUO9&4Z,C<L
|
||||
M0T-8;6]D93HR."Q#0U].3T]6;6]D93HR.2Q#0UA?3D]/5FUO9&4Z,S L0T-&
|
||||
M4&UO9&4Z,S$L0T-&4$5M;V1E.C,R+$U!6%]-04-(24Y%7TU/1$4Z,S,L.P!M
|
||||
M;V1E7V-L87-S.E0R,SUE34]$15]204Y$3TTZ,"Q-3T1%7TE.5#HQ+$U/1$5?
|
||||
M1DQ/050Z,BQ-3T1%7U!!4E1)04Q?24Y4.C,L34]$15]#0SHT+$U/1$5?0T]-
|
||||
M4$Q%6%])3E0Z-2Q-3T1%7T-/35!,15A?1DQ/050Z-BQ-05A?34]$15]#3$%3
|
||||
M4SHW+#L <'1R9&EF9E]T.G0Q '-I>F5?=#IT- !W8VAA<E]T.G0S %51271Y
|
||||
M<&4Z=#$Q %-)='EP93IT,0!54TET>7!E.G0T $1)='EP93IT-@!51$ET>7!E
|
||||
M.G0W %-&='EP93IT,3( 1$9T>7!E.G0Q,P!W;W)D7W1Y<&4Z=#$ 1$ES=')U
|
||||
M8W0Z5#(T/7,X:&EG:#HQ+# L,S([;&]W.C$L,S(L,S([.P!$275N:6]N.G0R
|
||||
M-3UU.',Z,C0L,"PV-#ML;#HV+# L-C0[.P!F=6YC7W!T<CIT,C8]*C(W/68Q
|
||||
M.0!?7V1O7V=L;V)A;%]D=&]R<SI&,3D
|
||||
M $ ! @ ! -0 #4 $0
|
||||
M 0 ) !0 ( 0#H Z FP #
|
||||
M 0 $ #P L " $#5 U0 5@ ! !H $
|
||||
M $ !< # @ !"+0 BT ")0 0
|
||||
M ? ! ( 0K< *W %0 # $0 0 , *0
|
||||
M 0 " $+, "S #D P \ $ # #, !
|
||||
M!@ !#!0 P4 '- ! Y 0 8 1-(
|
||||
M 32 )@ 0 /P $ & $3X $^
|
||||
M , $ $4 ! !@ !$^P !/L "
|
||||
M ! !, 0 8 1/T 3] @
|
||||
M 0 4P $ " $4 % -+ (
|
||||
M %L ! P "%TP !=, ! ! 0
|
||||
M !@ !@ , A=0 74 (@ $ 0 ( :0
|
||||
M $ ' (7V %]@ $8 $ # &X !
|
||||
M P "&/ !CP % ! !T " , AD(
|
||||
M 9" \ @ >0 ( &0@
|
||||
M 90 $P "D $ $ ($ # !]8 "XP
|
||||
M 0 ") 0 B/ $@
|
||||
M 0 , E0 $ (H0 $; !
|
||||
M )X ! ".@ !^ ! P
|
||||
M "D P EF ,8 $ K@
|
||||
M , )EX "; ! +T #
|
||||
= ";Y &'P 0 !
|
||||
|
||||
end
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <dos.h>
|
||||
|
||||
#define IO_RTC 0x70 /* RTC */
|
||||
|
||||
#define RTC_SEC 0x00 /* seconds */
|
||||
#define RTC_MIN 0x02 /* minutes */
|
||||
#define RTC_HRS 0x04 /* hours */
|
||||
#define RTC_WDAY 0x06 /* week day */
|
||||
#define RTC_DAY 0x07 /* day of month */
|
||||
#define RTC_MONTH 0x08 /* month of year */
|
||||
#define RTC_YEAR 0x09 /* month of year */
|
||||
#define RTC_STATUSA 0x0a /* status register A */
|
||||
#define RTCSA_TUP 0x80 /* time update, don't look now */
|
||||
|
||||
#define RTC_STATUSB 0x0b /* status register B */
|
||||
|
||||
#define RTC_DIAG 0x0e /* status register E - bios diagnostic */
|
||||
#define RTCDG_BITS "\020\010clock_battery\007ROM_cksum\006config_unit\005memory_size\004fixed_disk\003invalid_time"
|
||||
|
||||
|
||||
|
||||
/* convert 2 digit BCD number */
|
||||
static int bcd( unsigned int i )
|
||||
{
|
||||
return ((i/16)*10 + (i%16));
|
||||
}
|
||||
|
||||
static unsigned int rtcin( unsigned int what )
|
||||
{
|
||||
outportb( IO_RTC, what );
|
||||
return inportb( IO_RTC+1 );
|
||||
}
|
||||
|
||||
|
||||
void fix_date( void )
|
||||
{
|
||||
int s;
|
||||
struct date date;
|
||||
struct time time;
|
||||
|
||||
/* initialize brain-dead battery powered clock */
|
||||
outportb( IO_RTC, RTC_STATUSA );
|
||||
outportb( IO_RTC+1, 0x26 );
|
||||
outportb( IO_RTC, RTC_STATUSB );
|
||||
outportb( IO_RTC+1, 2 );
|
||||
|
||||
outportb( IO_RTC, RTC_DIAG );
|
||||
s = inportb( IO_RTC+1 );
|
||||
if (s) printf("RTC BIOS diagnostic error %b\n", s, RTCDG_BITS);
|
||||
|
||||
/* check for presence of clock */
|
||||
s = rtcin(RTC_STATUSA);
|
||||
if ( s == 0xff || s == 0 ) {
|
||||
printf( "Real-time clock not found\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* ready for a read? */
|
||||
while ((s & RTCSA_TUP) == RTCSA_TUP)
|
||||
s = rtcin(RTC_STATUSA);
|
||||
|
||||
date.da_year = bcd(rtcin(RTC_YEAR)) + 1900; /* year */
|
||||
if ( date.da_year < 1970) date.da_year += 100;
|
||||
date.da_year -= 1980;
|
||||
date.da_mon = bcd(rtcin(RTC_MONTH)); /* month */
|
||||
date.da_day = bcd(rtcin(RTC_DAY)); /* day */
|
||||
|
||||
(void)bcd(rtcin(RTC_WDAY)); /* weekday */
|
||||
|
||||
time.ti_hour = bcd(rtcin(RTC_HRS)); /* hour */
|
||||
time.ti_min = bcd(rtcin(RTC_MIN)); /* minutes */
|
||||
time.ti_sec = bcd(rtcin(RTC_SEC)); /* seconds */
|
||||
time.ti_hund = 0;
|
||||
|
||||
setdate( & date );
|
||||
settime( & time );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fix_timer( void )
|
||||
{
|
||||
#define PIT_PORT 0x40
|
||||
#define TIMER_CNTR0 (PIT_PORT + 0) /* timer 0 counter port */
|
||||
#define TIMER_MODE (PIT_PORT + 3) /* timer mode port */
|
||||
#define TIMER_SEL0 0x00 /* select counter 0 */
|
||||
#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
|
||||
#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
|
||||
|
||||
/* set timer 0 to generate interrupts every period */
|
||||
outportb( TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT );
|
||||
outportb( TIMER_CNTR0, 0 ); /* counter low */
|
||||
outportb( TIMER_CNTR0, 0 ); /* counter high */
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* Make timer count at correct pace */
|
||||
fix_timer();
|
||||
|
||||
/* Fix the date */
|
||||
fix_date();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
begin 664 fixtimer.exe
|
||||
M35IF 0X 0 @ T __^; 8 (@ $ ^R!R:@$
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M "Z3 $NB1;X ;0PS2&++@( BQXL ([:HY( C :0
|
||||
M (D>C ")+JP QP:6 /__Z#0!Q#Z* (O'B]BY_W\F@3TX-W49)HM5 H#Z/740
|
||||
M@.;?_P:6 (#^674$_P:6 /*NXV%#)C@%==: S8#WV8D.B@"Y 0#3XX/#"(/C
|
||||
M^(D>C@",VBOJBSY\ H'_ )S![\ HD^? *!Q^P$<B@#/GH"<B*Q!-/O1SOO
|
||||
M<AF#/GP" '0'@SYZ @!U#K\ $#OO=P>+_>L#Z2$!B]\#VHD>I ")'J@ H9
|
||||
M*]B.P+1*5\TA7]/G^H[2B^?[,\ NC@;X ;^F!+GL!"O/\ZH._Q:8!.BU NB=
|
||||
M [0 S1J)%I@ B0Z: /\6G 3_-H@ _S:& /\VA #H%P)0Z%H"+HX>^ 'H? .
|
||||
M_Q::!#/ B_"Y+P"0_ ($@-0 1N+X+3<-D'0*N1D D+HO .B+ (OLM$R*1@+-
|
||||
M(;D. )"Z2 #IAP >N US2&)'G0 C 9V +@$-<TAB1YX (P&>@"X!37-(8D>
|
||||
M? ",!GX N 8US2&)'H C :" +@ )8S*CMJZ6 '-(1_#'K@ )<46= #-(1\>
|
||||
MN 0EQ19X ,TA'QZX!27%%GP S2$?'K@&)<46@ #-(1_#QP:6 R\.T0+L"
|
||||
M ,TAP[D> )"Z5@ NCA[X >CI_[@# %#H*?\ %6+[(M&!+$$T^BZ"@#WXHM6
|
||||
M!('B#P #PNL 7<-5B^R*1@3F<.1QM #K %W#58OL@^P(5K *YG"P)N9QL OF
|
||||
M<+ "YG&P#N9PY'&T (OP"_9T#[BR 5!6N)0!4.B<"8/$!K@* %#HM?]9B_"!
|
||||
M_O\ = 0+]G4+N/P!4.A^"5GIJ0#K"K@* %#HE/]9B_"+QB6 #V '3LN D
|
||||
M4.B _UE0Z%__605L!XE&^(%^^+('?02#1OAD@6[XO >X" !0Z%W_65#H//]9
|
||||
MB$;[N < 4.A-_UE0Z"S_68A&^K@& %#H/?]94.@<_UFX! !0Z##_65#H#_]9
|
||||
MB$;]N ( 4.@@_UE0Z/_^68A&_#/ 4.@1_UE0Z/#^68A&_\9&_@"-1OA0Z'H1
|
||||
M68U&_%#HA1%97HOE7<.P-.9#L #F0+ YD##Z/#_Z.S^,\#K ,-5B^Q6BW8$
|
||||
M"_9\%(/^6'8#OE< B388 HJ$&@*8ENL-]]Z#_B-WZL<&& +__XO&HY0 N/__
|
||||
MZP!>7<(" ,-5B^SK"HL>?@+1X_^7I@2A?@+_#GX""\!UZ_\6= +_%G8"_Q9X
|
||||
M O]V!.AZ_5E=PP "Z/!JH#+HP>K /\C@:0 +Z #+D)JQ C,6'UI.+
|
||||
M-HH @\8"N0$ @#Z2 -R$8X&C "+_K%_,L#RKN-V@/%_@^P"N $ \,#P27^
|
||||
M_XO\*_AR8(OGC,".V(S0CL!12?.D,L"JCMV'\H?9B\.+T$/H&0!W!W) Z!(
|
||||
M=_D\('0(/ UT!#P)=>@RP.OD"\!T!T*J"L!U 4.&X#+ ^>,5K$DL(G0/!"(\
|
||||
M7'4'@#PB=0*L20OVP^E^_5D#RBZ.'JP#B1Z$ $,#VXOTB^PKZW+FB^6)+H8
|
||||
MXPZ)=@"#Q0(VK K X/IT\#/ B48 +O\FJ@.+#HH 4>A' 5F+^ O ="0>'@>.
|
||||
M'HP ,_;\\Z0?B_@&_S:. .@I 8/$ HO8!Z.( O =0/I$?TSP+G__XD_@\,"
|
||||
M\JXF. 5U](D'PU6+[(,^?@(@=06X 0#K%8M&!(L>?@+1XXF'I@3_!GX",\#K
|
||||
M %W#58OL5E>+?@2+10:CZ 0[QW4(QP;H! ZQ"+=02+'N@$B7<$H>@$B40&
|
||||
M7UY=PU6+[%97BWX$BT8&*06+-0/WBT8&0(D$B7P"H>8$.\=U!HDVY@3K"(O^
|
||||
M WX&B74"B\8%! #K %]>7<-5B^Q6BT8$,](E__^!X@ 4E#H] !968OP@_[_
|
||||
M=00SP.L8H>8$B40"BT8$0(D$B3;F!*'F! 4$ .L 7EW#58OL5HM&!#/2)?__
|
||||
M@>( %)0Z+< 65F+\(/^_W4$,\#K%8DVZ@2)-N8$BT8$0(D$B\8%! #K %Y=
|
||||
MPU6+[%97BWX$"_]U!#/ ZUJ+QP4+ "7X_XOX@S[J! !U!U?HH?]9ZT*+-N@$
|
||||
MB\8+P'0QBP2+UX/"*#O"<@E75N@-_UE9ZR2+!#O'<@Y6Z-'^6?\$B\8%! #K
|
||||
M$(MT!CLVZ 1USU?H(O]9ZP!?7EW#58OLBT8$B]2!Z@ !.\)S!Z.> #/ ZPO'
|
||||
M!I0 " "X___K %W#58OLBT8$BU8& P:> (/2 (O(@<$ 8/2 O2=0H[S',&
|
||||
MAP:> .L+QP:4 @ N/__ZP!=PU6+[/]V!.B?_UGK %W#58OLBT8$F5)0Z++_
|
||||
MB^7K %W#58OL@^P"5E>+7@2+-XO&B4;^BUX$]T<"0 !T!(O&ZQ^+7@2+?PKK
|
||||
M"XO?1X _"G4#_T;^B\9."\!U[HM&_NL 7UZ+Y5W" @!5B^Q6BW8$5NA3!%D+
|
||||
MP'0%N/__ZTR#?@H!=1"#/ !^"U;HE?^9*48&&58(@60"7_['! BT0(B40*
|
||||
M_W8*_W8(_W8&BD0$F%#HW *#Q B#^O]U"CW__W4%N/__ZP(SP.L 7EW#58OL
|
||||
M@^P$5HMV!%;H[ -9"\!T"+K__[C__^L_N $ 4#/ 4%"*1 284.B8 H/$"(E6
|
||||
M_HE&_(,\ 'X9BU;^BT;\4E!6Z!#_F8O8B\I86BO#&]'K!HM6_HM&_.L 7HOE
|
||||
M7<-5B^RX $2+7@3-(;@ '($T>+1T.L 7<-5B^Q65XM^"HMV!(M$#CO&=0R#
|
||||
M?@@"?P:!__]_=@:X___IJ@"#/NH# '4/N) ".\9U",<&Z@,! .L4@S[H P!U
|
||||
M#;B CO&=0;'!N@# 0"#/ !T#[@! % SP%!05NC&_H/$"/=$ @0 = ?_= CH
|
||||
M"PQ9@60"\__'1 8 (O&!04 B40(B40*@WX( G0_"_]V.\<&= +$"(-^!@!U
|
||||
M&%?H6?U9B48&"\!T!X%, @0 ZP6X___K&XM&!HE$"HE$"(E\!H-^" %U!8%,
|
||||
M @@ ,\#K %]>7<-65[\$ +Z NL0]T0" P!T!5;HG )93X/&$ O_=>Q?7L-5
|
||||
MB^R![(H 5E>+1@A /0( <P4SP.GV (M>!-'C]X? P" =!+_=@C_=@;_=@3H
|
||||
MXP"#Q ;IUP"+7@31XX&GP /__8M&!HF&?/^+1@B)AGC_C;9^_^MM_XYX_XN>
|
||||
M?/__AGS_B@>(AGO_/ IU!,8$#4:*AGO_B 1&C89^_XO6*]"!^H ?#Z-AG[_
|
||||
MB_XK^%>-AG[_4/]V!.A[ (/$!HF&=O\[QW0;@[YV_P!S!;C__^L-BT8(*X9X
|
||||
M_P.&=O\KQ^M/C;9^_X.^>/\ = /IB?^-AG[_B_XK^(O'"\!V+E>-AG[_4/]V
|
||||
M!.@M (/$!HF&=O\[QW07@[YV_P!S!;C__^L)BT8( X9V_RO'ZP6+1@CK %]>
|
||||
MB^5=PU6+[(M>!-'C]X? P (=!"X @!0,\!04/]V!.@H (OEM$"+7@2+3@B+
|
||||
M5@;-(7(/4(M>!-'C@8_ P 06.L&4.@%^>L 7<-5B^R+7@31XX&GP /__;1"
|
||||
MBD8*BUX$BTX(BU8&S2%R NL'4.C;^)GK %W#58OL@^PB5E<&BWX*'@>+7@B#
|
||||
M^R1W6(#[ G)3BT8,BTX."\E]$8!^!@!T"\8%+4?WV??8@]D C7;>XP^1*]+W
|
||||
M\Y'W\X@41N,)Z_$KTO?SB!1&"\!U]8U.WO?9 \[\3HH$+ IS! 0ZZP,"1@2J
|
||||
MXN^P *H'BT8*ZP!?7HOE7<(, %6+[(-^" IU!HM&!)GK!8M&!#/24E#_=@;_
|
||||
M=@BP 5"P85#H7/_K %W#58OL_W8&_W8$_W8(_W8*L !0L&%0Z$#_ZP!=PU6+
|
||||
M[/]V!O]V!/]V"/]V"H-^"@IU!;@! .L",\!0L&%0Z!G_ZP!=P[KL ^L#NO$#
|
||||
MN04 D+1 NP( S2&Y)P"0NO8#M$#-(>EM]E6+[%97BW8$BT0..\9T!;C__^MF
|
||||
M@SP ?"WW1 (( '4,BT0*B]:#P@4[PG46QP0 (M$"HO6@\(%.\)U!HM$"(E$
|
||||
M"C/ ZS2+? 8#/$<I/%>+1 B)1 I0BD0$F%#H$OV#Q 8[QW01]T0" )U"H%,
|
||||
M A N/__ZP0SP.L 7UY=PU6+[+AK#5"XD )0_W8$C48&4.A, NL 7<-5B^R+
|
||||
M7@;_#_]V!HI&!)A0Z 8 B^7K %W#58OL@^P"5HMV!HI&!(A&__\$?3:*1O__
|
||||
M1 J+7 J(1__W1 (( '0;@'[_"G0&@'[_#74/5N@9_UD+P'0&N/__Z>D BD;_
|
||||
MM #IX0#_#/=$ I =0?W1 (" '4+@4P"$ "X___IQ@"!3 ( 8-\!@!T)H,\
|
||||
M '015NC7_ED+P'0&N/__Z:< ZPJX__^+5 8KPHD$Z7W_Z94 @S[J P!U.;B0
|
||||
M CO&=3**1 284.@)^UD+P'4%@60"__VX )0]T0" )T!;@" .L",\!0,\!0
|
||||
M5NC]^H/$".F/_X!^_PIU'_=$ D =1BX 0!0N!X$4(I$!)A0Z.#\@\0&/0$
|
||||
M=1BX 0!0C48$4(I$!)A0Z,C\@\0&/0$ =!'W1 ( G4*@4P"$ "X___K!XI&
|
||||
M_[0 ZP!>B^5=PU6+[%:+=@2XD )05NC!_EE9ZP!>7<-5B^R#[ )65XMV!(M^
|
||||
M!D?W1 (( '0CZP+K $^+QPO =!56BUX(_T8(B@>84.B+_EE9/?__=>+I=0#W
|
||||
M1 ) '0W@WP& '0QBT0&.\=S*H,\ '0-5NBT_5D+P'0$,\#K4T]7_W8(BD0$
|
||||
MF%#H(?R#Q :)1OXK?O[K-^L"ZP!/B\<+P'0L_P1]%8M>"/]&"(H'_T0*BUP*
|
||||
MB$?_M #K#E:+7@C_1@C_-^CZ_5E9/?__=<N+Q^L 7UZ+Y5W"!@#_)IX$58OL
|
||||
MBU8$N00/NR<$_(K&TNC7JHK&(L77JHK"TNC7JHK"(L77JNL 7<(" %6+[('L
|
||||
ME@!65\=&J@ QD:M4.LX5[G__S+ \J[WT4E?PX@%1_Y.K7XB4U%2!HU&KBOX
|
||||
MC4:N4%?_=@C_5@K&1JU0 7ZJC7ZN!UI96\,&_(U^KHF^;/^+OFS_BW8&K K
|
||||
M=!$\)700B 5'_DZM?^_HN?_KZNEU!(FV>/^L/"5TYXF^;/\SR8F.=O^)CFK_
|
||||
MB(YU_\>&</___\>&<O___^L!K#+DB]"+V(#K((#[8'-'BI\W!(O#/1< =@/I
|
||||
M'02+V-'C+O^G& ]C#TL/I ]7#\D/TP\5$!\0+Q"*#V00/Q!#$$<0Z1";$3P1
|
||||
M7!'_$BP3+!,L$W8/@ _IX0. _0!W^(..:O\!ZYN _0!W[(..:O\"ZX^ _0!W
|
||||
MX("^=?\K= 2(EG7_Z7S_@Z9J_]^U!>ER_X..:O\@M07I:/^ _0!W1/>&:O\"
|
||||
M '4A@XYJ_PBU >E1_^F( XM^!(L%@T8$ H#] G,)B89P_[4#Z3?_@/T$=>&)
|
||||
MAG+__L7I*?^ _01ST[4$Z1__DBPPF(#] G<;M0*'AG#_"\!\TM'@B]#1X-'@
|
||||
M \(!AG#_Z?O^@/T$=:6'AG+_"\!\M-'@B]#1X-'@ \(!AG+_Z=W^@XYJ_Q"U
|
||||
M!>G3_H&.:O\ 8.F:O_OM07IP_Z#IFK_[X&.:O^ +4%Z;/^MPCK"K<*ZPNW
|
||||
M$+/I MK&AG7_ ,:&;_\ B)9N_XM^!(L%,]+K$;<*QH9O_P&(EF[_BWX$BP69
|
||||
M1T>)=@;WAFK_$ !T!(L51T>)?@2-OGO_"\!U,PO2=2^#OG+_ '4MB[YL_XN.
|
||||
M</_C&X/Y_W06BX9J_R4( '0$LC#K K(@BL+HMOWB^>GI_8..:O\$4E!7BL>8
|
||||
M4(J&;_]04^B0^18'BY9R_PO2?P/I% 'I(0&(EF[_B78&C;YZ_XM>!/\W0T.)
|
||||
M7@3WAFK_( !T#_\W0T.)7@06!^@7_; ZJA8'Z _]Q@4 QH9O_P"#IFK_^XV.
|
||||
M>O\K^8?/BY9R_SO1?P*+T>F^ (EV!HB6;O^+?@2+!8-&! (6!XV^>_\RY(D%
|
||||
MN0$ Z=@ B78&B)9N_XM^!/>&:O\@ '4,BSV#1@0"'@<+_^L*Q#V#1@0$C, +
|
||||
MQW4%'@>_( 3HVOP[CG+_=@2+CG+_Z9D B78&B)9N_XM^!(N.<O\+R7T#N08
|
||||
M5U&-GGO_4U*X 0 CAFK_4(N&:O^I@ !T"K@" ,=&_@0 ZQ>I %T"K@( ,=&
|
||||
M_@H ZPC'1OX( +@& %#H-_R+1OX!1@06!XV^>__WAFK_" !T$XN6</\+TGX+
|
||||
MZ%O\*]%^!(F6=O^*AG7_"L!T%": /2UT#H.N=O\!@Y9V_P!/)H@%Z#3\B_>+
|
||||
MOFS_BYYP_[@% ".&:O\]!0!U%HJF;O^ _&]U$(.^=O\ ?P;'AG;_ 0#K'Y"
|
||||
M_'AT!8#\6'44@XYJ_T!+2X.N=O\"?0;'AG;_ #CG;_]X9J_P( =0SK!K @
|
||||
MZ.'[2SO9?_;WAFK_0 !T#+ PZ,_[BH9N_^C(^XN6=O\+TGXG*\HKVB:*!#PM
|
||||
M= @\('0$/"MU!R:LZ*C[24N'RN,'L##HG?OB^8?*XQ$KV2:LB 5'_DZM?P/H
|
||||
MD/OB\0O;?@F+R[ @Z'O[XOGIKON)=@:+?@3WAFK_( !U"HL]@T8$ AX'ZP;$
|
||||
M/8-&! 2X4 J1JT#1JHFB07I??N+MGC_B[YL_[ EZ#S[K K =?B ?JU0?0/H
|
||||
M-OL'BT:JZP!?7HOE7<(( %6+[%97BW8$@S[H! !T'(L>Z 2+?P:+'N@$B7<&
|
||||
MB74$B7P&H>@$B40$ZPJ)-N@$B70$B70&7UY=PU6+[(/L E97BW8&BWX$BP0!
|
||||
M!:'F!#O&=0:)/N8$ZPV+! /&B4;^BU[^B7\"5NA-\5E?7HOE7<-6H>H$.P;F
|
||||
M!'42_S;J!.C:\EDSP*/F!*/J!.L[BQ[F!(MW O<$ 0!U(E;H&?%9.S;J!'4*
|
||||
M,\"CY@2CZ@3K!HM$ J/F!%;HH_)9ZPS_-N8$Z)GR68DVY@1>PU6+[(/L E97
|
||||
MBW8$_PR+! /&B4;^BWP"]P4! '44.S;J!'0.BP0!!8M>_HE_ HOWZP56Z +_
|
||||
M68M>_O<' 0!U"?]V_E;H*O]965]>B^5=PU6+[%:+=@0+]G4"ZQ>+Q@7\_XOP
|
||||
M.S;F!'4%Z#S_ZP56Z(__65Y=PU6+[%:T*XMV!(L,BU0"S2%>7<-5B^Q6M"V+
|
||||
M=@2+#(M4 LTA7EW# !4=7)B;RU#("T@0V]P>7)I9VAT("AC
|
||||
M*2 Q.3@X($)O<FQA;F0@26YT;"X 3G5L;"!P;VEN=&5R(&%S<VEG;FUE;G0-
|
||||
M"D1I=FED92!E<G)O<@T*06)N;W)M86P@<')O9W)A;2!T97)M:6YA=&EO;@T*
|
||||
M .P$[ 3L
|
||||
M!
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M 4E1#($))3U,@9&EA9VYO<W1I8R!E<G)O<B E
|
||||
M8@H $ AC;&]C:U]B871T97)Y!U)/35]C:W-U;09C;VYF:6=?=6YI= 5M96UO
|
||||
M<GE?<VEZ901F:7AE9%]D:7-K VEN=F%L:61?=&EM90!296%L+71I;64@8VQO
|
||||
M8VL@;F]T(&9O=6YD"@ $P("! 4&" @(%!4%$_\6!1$"____________
|
||||
M_____P4%_____________________P__(P+_#_____\3__\" @4/ O___Q/_
|
||||
M_________R/_____(_\3_P!Z WH#>@, 0 D" ( "
|
||||
M * @$ "0 @ @(" H ( $," P
|
||||
M + " !" @0 # @ #_ T ( _P
|
||||
M . " /\ #P @ #_ , _P
|
||||
M ! # /\ @ P #_ , ,
|
||||
M_P $ # /\ !0 P #_ 8 ,
|
||||
M _P ' # /\ " P #_
|
||||
MD , _P * # /\ "P P$@ B "( 2@ J#_
|
||||
M______________________________________\ <')I;G0@<V-A;F8@
|
||||
M.B!F;&]A=&EN9R!P;VEN="!F;W)M871S(&YO="!L:6YK960-"@ - "AN=6QL
|
||||
M*0 P,3(S-#4V-S@Y04)#1$5& !04 105%!04% ( % ,$% D%!04%!04%!044
|
||||
M%!04%!04%!04% \7#P@4%!0'%!84%!04%!04%!0-%!04%!04%!04%! *#P\/
|
||||
G" H4% 84$@L.%!01% P4% T4%!04%!04 -(!T@'9 50+60M9"UD+
|
||||
|
||||
end
|
||||
@@ -1,331 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <process.h>
|
||||
|
||||
#include <io.h>
|
||||
|
||||
void * xmalloc( int size )
|
||||
{
|
||||
void * p = (void *)malloc( size );
|
||||
if ( !p ) {
|
||||
fprintf( stderr, "out of memory\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
return p;
|
||||
}
|
||||
void * xrealloc( void * old, int size )
|
||||
{
|
||||
void * p = (void *)realloc( old, size );
|
||||
if ( !p ) {
|
||||
fprintf( stderr, "out of memory\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
char ** argv_fix( int * argc, char ** argv )
|
||||
{
|
||||
char ** new = NULL;
|
||||
int max = 20;
|
||||
int cnt = 0;
|
||||
int j;
|
||||
|
||||
for ( j = 1; argv[j]; ++j )
|
||||
if ( argv[j][0] == '@' && access(argv[j]+1,0)==0 )
|
||||
break;
|
||||
if ( argv[j] == NULL )
|
||||
return argv;
|
||||
|
||||
new = (char **)xmalloc( max * sizeof *new );
|
||||
new[cnt++] = *argv++;
|
||||
for ( ; *argv; ++argv ) {
|
||||
if ( cnt >= max )
|
||||
new = (char **)realloc( new, (max*=2) * sizeof *new );
|
||||
|
||||
if ( argv[0][0] != '@' || access(argv[0]+1,0) ) {
|
||||
new[cnt++] = *argv;
|
||||
} else {
|
||||
char line[ 1000 ];
|
||||
FILE * f = fopen( argv[0]+1, "r" );
|
||||
if ( !f ) {
|
||||
perror( argv[0]+1 );
|
||||
exit( 2 );
|
||||
}
|
||||
while ( fgets( line, sizeof line, f ) ) {
|
||||
int len = strlen( line );
|
||||
/* delete trailing newlines */
|
||||
while ( line[len-1] == '\n' || line[len-1] == '\r' )
|
||||
line[--len] = '\0';
|
||||
if ( cnt >= max )
|
||||
new = (char **)xrealloc( new, (max*=2) * sizeof *new );
|
||||
new[cnt] = (char *)xmalloc( len+1 );
|
||||
strcpy( new[cnt], line );
|
||||
++cnt;
|
||||
}
|
||||
fclose( f );
|
||||
}
|
||||
}
|
||||
if ( cnt >= max )
|
||||
new = (char **)xrealloc( new, (max+1) * sizeof *new );
|
||||
new[cnt] = NULL;
|
||||
*argc = cnt;
|
||||
return new;
|
||||
}
|
||||
|
||||
|
||||
const char * USAGE =
|
||||
"usage: $progname [ -cNvmV ] file [ file ... ] dest-directory-or-file\n"
|
||||
" -v -- verbose\n"
|
||||
" -V suffix -- suffix to append to targets (before any . suffix)\n"
|
||||
" eg: -V _g would change 'foo' to 'foo_g' and\n"
|
||||
" 'libfoo.a' to 'libfoo_g.a'\n"
|
||||
" -m mode -- mode for new file(s)\n"
|
||||
" -c -- copy instead of move (always on)\n"
|
||||
" -N -- copy only if source is newer than target\n"
|
||||
;
|
||||
|
||||
void fatal( char * msg )
|
||||
{
|
||||
if ( msg )
|
||||
fprintf( stderr, "%s\n", msg );
|
||||
fprintf( stderr, "%s", USAGE );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
char * basename( char * f )
|
||||
{
|
||||
char * b = strrchr( f, '/' );
|
||||
if ( b ) ++b;
|
||||
else b = f;
|
||||
return b;
|
||||
}
|
||||
|
||||
#include <sys/stat.h>
|
||||
int is_dir( char * path )
|
||||
{
|
||||
struct stat buf;
|
||||
if ( stat( path, &buf ) )
|
||||
return 0;
|
||||
return buf.st_mode & S_IFDIR;
|
||||
}
|
||||
int is_file( char * path )
|
||||
{
|
||||
struct stat buf;
|
||||
if ( stat( path, &buf ) )
|
||||
return 0;
|
||||
return buf.st_mode & S_IFREG;
|
||||
}
|
||||
int newer( char * p1, char * p2 )
|
||||
{
|
||||
struct stat buf1;
|
||||
struct stat buf2;
|
||||
if ( stat( p1, &buf1 ) )
|
||||
return 0;
|
||||
if ( stat( p2, &buf2 ) )
|
||||
return 0;
|
||||
return buf1.st_mtime > buf2.st_mtime;
|
||||
}
|
||||
|
||||
int filecopy( char * d, char * s, int preserve_time )
|
||||
{
|
||||
#if 0
|
||||
int status;
|
||||
char * argv[ 5 ];
|
||||
argv[0] = "cp";
|
||||
argv[1] = "-p";
|
||||
argv[2] = s;
|
||||
argv[3] = d;
|
||||
argv[4] = NULL;
|
||||
status = spawnvp( P_WAIT, argv[0], argv );
|
||||
if ( status )
|
||||
perror( "cp" );
|
||||
return status;
|
||||
#else
|
||||
FILE * fs;
|
||||
FILE * fd;
|
||||
char buffer[ 8192 ];
|
||||
int n;
|
||||
struct ftime When;
|
||||
struct stat Stat;
|
||||
|
||||
fs = fopen( s, "rb" );
|
||||
if ( fs == NULL ) {
|
||||
perror( s );
|
||||
return 1;
|
||||
}
|
||||
fd = fopen( d, "wb" );
|
||||
if ( fd == NULL ) {
|
||||
perror( d );
|
||||
fclose( fs );
|
||||
return 2;
|
||||
}
|
||||
|
||||
if ( preserve_time )
|
||||
if ( getftime( fileno(fs), &When ) ) {
|
||||
perror( s );
|
||||
preserve_time = 0;
|
||||
}
|
||||
|
||||
do {
|
||||
n = fread( buffer, 1, sizeof buffer, fs );
|
||||
if ( n > 0 )
|
||||
if ( fwrite( buffer, 1, n, fd ) < 0 ) {
|
||||
perror( d );
|
||||
return 3;
|
||||
}
|
||||
} while ( n > 0 );
|
||||
|
||||
fclose( fs );
|
||||
|
||||
/* Fix time stamp */
|
||||
if ( preserve_time )
|
||||
if ( setftime( fileno(fd), &When ) ) {
|
||||
perror( s );
|
||||
preserve_time = 0;
|
||||
}
|
||||
fclose( fd );
|
||||
|
||||
/* Fix access rights */
|
||||
if ( stat( s, &Stat ) )
|
||||
perror( s );
|
||||
else if ( chmod( d, Stat.st_mode ) )
|
||||
perror( d );
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main( int argc, char * argv[] )
|
||||
{
|
||||
char * progname;
|
||||
int verbose = 0;
|
||||
int only_if_newer= 0;
|
||||
char * suffix = NULL;
|
||||
char * mode = NULL;
|
||||
char * dest;
|
||||
char ** pp;
|
||||
|
||||
argv = argv_fix( &argc, argv );
|
||||
|
||||
progname = basename( *argv++ );
|
||||
|
||||
/* process the options */
|
||||
while ( argv[0] && argv[0][0] == '-' ) {
|
||||
switch ( argv[0][1] ) {
|
||||
case 'N':
|
||||
++argv;
|
||||
only_if_newer = 1;
|
||||
break;
|
||||
case 'c':
|
||||
++argv;
|
||||
/* We always copy, regardless */
|
||||
break;
|
||||
case 'v':
|
||||
++argv;
|
||||
verbose = 1;
|
||||
break;
|
||||
case 'V':
|
||||
++argv;
|
||||
suffix = *argv;
|
||||
++argv;
|
||||
break;
|
||||
case 'm':
|
||||
++argv;
|
||||
mode = *argv;
|
||||
++argv;
|
||||
break;
|
||||
default:
|
||||
fatal( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
/* Separate source file(s) from dest directory or file */
|
||||
#if 0
|
||||
if ( !argv[0] || !argv[1] )
|
||||
fatal( "missing files or invalid destination" );
|
||||
#else
|
||||
/* We used to require at least one file; not any more */
|
||||
if ( !argv[0] )
|
||||
fatal( "missing files or invalid destination" );
|
||||
if ( !argv[1] )
|
||||
return 0;
|
||||
#endif
|
||||
for ( pp = argv; *pp; ++pp )
|
||||
continue;
|
||||
--pp;
|
||||
dest = *pp;
|
||||
*pp = NULL;
|
||||
|
||||
/* Process the arguments */
|
||||
for (; *argv; ++argv ) {
|
||||
char * f = *argv;
|
||||
char * leaf = basename( f );
|
||||
char target[ 128 ];
|
||||
|
||||
strcpy( target, dest );
|
||||
|
||||
if ( is_dir( target ) ) {
|
||||
strcat( target, "/" );
|
||||
/* if we were given a suffix, then add it as appropriate */
|
||||
if ( suffix ) {
|
||||
char * dot = strchr( leaf, '.' );
|
||||
if ( dot ) {
|
||||
strncat( target, leaf, dot-leaf );
|
||||
strcat( target, suffix );
|
||||
strcat( target, dot );
|
||||
if ( verbose )
|
||||
printf( "%s: %s will be installed as %s",
|
||||
progname, f, strrchr(target,'/')+1 );
|
||||
} else {
|
||||
strcat( target, leaf );
|
||||
strcat( target, suffix );
|
||||
}
|
||||
} else {
|
||||
strcat( target, leaf );
|
||||
}
|
||||
}
|
||||
|
||||
if ( access( f, 0 ) ) {
|
||||
char buf[200];
|
||||
sprintf( buf, "cannot read %s", f );
|
||||
fatal( buf );
|
||||
}
|
||||
|
||||
if ( only_if_newer && is_file( target ) && !newer( f, target ) ) {
|
||||
if ( verbose )
|
||||
printf( "'%s' not newer than '%s'\n", f, target );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( verbose )
|
||||
printf( "rm -f %s\n", target );
|
||||
if ( chmod( target, 0777 ) )
|
||||
if ( verbose )
|
||||
perror( target );
|
||||
if ( unlink( target ) )
|
||||
if ( verbose )
|
||||
perror( target );
|
||||
if ( verbose )
|
||||
printf( "cp -p %s %s\n", f, target );
|
||||
if ( filecopy( target, f, 1 ) )
|
||||
return 1;
|
||||
if ( mode ) {
|
||||
char buf[ 255 ];
|
||||
sprintf( buf, "chmod %s %s\n", mode, target );
|
||||
if ( verbose )
|
||||
printf( "%s\n", buf );
|
||||
system( buf );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
begin 664 ifc.exe
|
||||
M(VEN8VQU9&4@/'-T9&EO+F@^#0HC:6YC;'5D92 \<W1R:6YG+F@^#0HC:6YC
|
||||
M;'5D92 \<')O8V5S<RYH/@T*#0HC:6YC;'5D92 \:6\N:#X-"@T*=F]I9" J
|
||||
M('AM86QL;V,H(&EN="!S:7IE("D-"GL-"B @("!V;VED("H@<" ]("AV;VED
|
||||
M("HI;6%L;&]C*"!S:7IE("D[#0H@(" @:68@*" A<" I("![#0H)9G!R:6YT
|
||||
M9B@@<W1D97)R+" B;W5T(&]F(&UE;6]R>5QN(B I.PT*"65X:70H(#$@*3L-
|
||||
M"B @("!]#0H@(" @<F5T=7)N(' [#0I]#0IV;VED("H@>')E86QL;V,H('9O
|
||||
M:60@*B!O;&0L(&EN="!S:7IE("D-"GL-"B @("!V;VED("H@<" ]("AV;VED
|
||||
M("HI<F5A;&QO8R@@;VQD+"!S:7IE("D[#0H@(" @:68@*" A<" I("![#0H)
|
||||
M9G!R:6YT9B@@<W1D97)R+" B;W5T(&]F(&UE;6]R>5QN(B I.PT*"65X:70H
|
||||
M(#$@*3L-"B @("!]#0H@(" @<F5T=7)N(' [#0I]#0H-"F-H87(@*BH@87)G
|
||||
M=E]F:7@H(&EN=" J(&%R9V,L(&-H87(@*BH@87)G=B I#0I[#0H@(" @8VAA
|
||||
M<B J*B!N97<@/2!.54Q,.PT*(" @(&EN=" @(" @;6%X(#T@,C [#0H@(" @
|
||||
M:6YT"2 @("!C;G0@/2 P.PT*(" @(&EN= D@(" @:CL-"@T*(" @(&9O<B H
|
||||
M(&H@/2 Q.R!A<F=V6VI=.R K*VH@*0T*"6EF("@@87)G=EMJ75LP72 ]/2 G
|
||||
M0"<@)B8@86-C97-S*&%R9W9;:ETK,2PP*3T]," I#0H)(" @(&)R96%K.PT*
|
||||
M(" @(&EF("@@87)G=EMJ72 ]/2!.54Q,("D-"@ER971U<FX@87)G=CL-"@T*
|
||||
M(" @(&YE=R ]("AC:&%R("HJ*7AM86QL;V,H(&UA>" J('-I>F5O9B J;F5W
|
||||
M("D[#0H@(" @;F5W6V-N="LK72 ]("IA<F=V*RL[#0H@(" @9F]R("@@.R J
|
||||
M87)G=CL@*RMA<F=V("D@('L-"@EI9B H(&-N=" ^/2!M87@@*0T*"2 @("!N
|
||||
M97<@/2 H8VAA<B J*BER96%L;&]C*"!N97<L("AM87@J/3(I("H@<VEZ96]F
|
||||
M("IN97<@*3L-"@D@(" @#0H):68@*"!A<F=V6S!=6S!=("$]("= )R!\?"!A
|
||||
M8V-E<W,H87)G=ELP72LQ+# I("D@('L-"@D@(" @;F5W6V-N="LK72 ]("IA
|
||||
M<F=V.PT*"7T@96QS92R(B I.PT*"2 @("!I
|
||||
M9B H("%F("D@('L-"@D)<&5R<F]R*"!A<F=V6S!=*S$@*3L-"@D)97AI="@@
|
||||
M,B I.PT*"2 @("!]#0H)(" @('=H:6QE("@@9F=E=',H(&QI;F4L('-I>F5O
|
||||
M9B!L:6YE+"!F("D@*2 @>PT*"0EI;G0@;&5N(#T@<W1R;&5N*"!L:6YE("D[
|
||||
M#0H)"2\J(&1E;&5T92!T<F%I;&EN9R!N97=L:6YE<R J+PT*"0EW:&EL92 H
|
||||
M(&QI;F5;;&5N+3%=(#T]("=<;B<@?'P@;&EN95ML96XM,5T@/3T@)UQR)R I
|
||||
M#0H)"2 @("!L:6YE6RTM;&5N72 ]("=<,"<[#0H)"6EF("@@8VYT(#X](&UA
|
||||
M>" I#0H)"2 @("!N97<@/2 H8VAA<B J*BEX<F5A;&QO8R@@;F5W+" H;6%X
|
||||
M*CTR*2 J('-I>F5O9B J;F5W("D[#0H)"6YE=UMC;G1=(#T@*&-H87(@*BEX
|
||||
M;6%L;&]C*"!L96XK,2 I.PT*"0ES=')C<'DH(&YE=UMC;G1=+"!L:6YE("D[
|
||||
M#0H)"2LK8VYT.PT*"2 @("!]#0H)(" @(&9C;&]S92@@9B I.PT*"7T)#0H@
|
||||
M(" @?0T*(" @(&EF("@@8VYT(#X](&UA>" I#0H);F5W(#T@*&-H87(@*BHI
|
||||
M>')E86QL;V,H(&YE=RP@*&UA>"LQ*2 J('-I>F5O9B J;F5W("D[#0H@(" @
|
||||
M;F5W6V-N=%T@/2!.54Q,.PT*(" @("IA<F=C(#T@8VYT.PT*(" @(')E='5R
|
||||
M;B!N97<[#0I]#0H-"@T*8V]N<W0@8VAA<B J(%5304=%(#T@#0HB=7-A9V4Z
|
||||
M("1P<F]G;F%M92!;("UC3G9M5B!=(&9I;&4@6R!F:6QE("XN+B!=(&1E<W0M
|
||||
M9&ER96-T;W)Y+6]R+69I;&5<;B(-"B(@(" @(" @("UV(" @(" @(" @("TM
|
||||
M('9E<F)O<V5<;B(-"B(@(" @(" @("U6('-U9F9I>" @("TM('-U9F9I>"!T
|
||||
M;R!A<'!E;F0@=&\@=&%R9V5T<R H8F5F;W)E(&%N>2 N('-U9F9I>"E<;B(-
|
||||
M"B(@(" @(" @(" @(" @(" @(" @(" @("!E9SH@+58@7V<@=V]U;&0@8VAA
|
||||
M;F=E("=F;V\G('1O("=F;V]?9R<@86YD7&XB#0HB(" @(" @(" @(" @(" @
|
||||
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" G;&EB9F]O+F$G('1O
|
||||
M("=L:6)F;V]?9RYA)UQN(@T*(B @(" @(" @+6T@;6]D92 @(" @+2T@;6]D
|
||||
M92!F;W(@;F5W(&9I;&4H<RE<;B(-"B(@(" @(" @("UC(" @(" @(" @("TM
|
||||
M(&-O<'D@:6YS=&5A9"!O9B!M;W9E("AA;'=A>7,@;VXI7&XB#0HB(" @(" @
|
||||
M(" M3B @(" @(" @(" M+2!C;W!Y(&]N;'D@:68@<V]U<F-E(&ES(&YE=V5R
|
||||
M('1H86X@=&%R9V5T7&XB#0H[#0H-"G9O:60@9F%T86PH(&-H87(@*B!M<V<@
|
||||
M*0T*>PT*(" @(&EF("@@;7-G("D-"@EF<')I;G1F*"!S=&1E<G(L("(E<UQN
|
||||
M(BP@;7-G("D[#0H@(" @9G!R:6YT9B@@<W1D97)R+" B)7,B+"!54T%'12 I
|
||||
M.PT*(" @(&5X:70H(#$@*3L-"GT-"@T*8VAA<B J(&)A<V5N86UE*"!C:&%R
|
||||
M("H@9B I#0I[#0H@(" @8VAA<B J(&(@/2!S=')R8VAR*"!F+" G+R<@*3L-
|
||||
M"B @("!I9B H(&(@*0DK*V([#0H@(" @96QS90EB(#T@9CL-"B @("!R971U
|
||||
M<FX@8CL-"GT-"@T*(VEN8VQU9&4@/'-Y<R]S=&%T+F@^#0II;G0@:7-?9&ER
|
||||
M*"!C:&%R("H@<&%T:" I#0I[#0H@(" @<W1R=6-T('-T870@8G5F.PT*(" @
|
||||
M(&EF("@@<W1A="@@<&%T:"P@)F)U9B I("D-"@ER971U<FX@,#L-"B @("!R
|
||||
M971U<FX@8G5F+G-T7VUO9&4@)B!37TE&1$E2.PT*?0T*:6YT(&ES7V9I;&4H
|
||||
M(&-H87(@*B!P871H("D-"GL-"B @("!S=')U8W0@<W1A="!B=68[#0H@(" @
|
||||
M:68@*"!S=&%T*"!P871H+" F8G5F("D@*0T*"7)E='5R;B P.PT*(" @(')E
|
||||
M='5R;B!B=68N<W1?;6]D92 F(%-?249214<[#0I]#0II;G0@;F5W97(H(&-H
|
||||
M87(@*B!P,2P@8VAA<B J(' R("D-"GL-"B @("!S=')U8W0@<W1A="!B=68Q
|
||||
M.PT*(" @('-T<G5C="!S=&%T(&)U9C([#0H@(" @:68@*"!S=&%T*"!P,2P@
|
||||
M)F)U9C$@*2 I#0H)<F5T=7)N(# [#0H@(" @:68@*"!S=&%T*"!P,BP@)F)U
|
||||
M9C(@*2 I#0H)<F5T=7)N(# [#0H@(" @<F5T=7)N(&)U9C$N<W1?;71I;64@
|
||||
M/B!B=68R+G-T7VUT:6UE.PT*?0T*#0II;G0@9FEL96-O<'DH(&-H87(@*B!D
|
||||
M+"!C:&%R("H@<RP@:6YT('!R97-E<G9E7W1I;64@*0T*>PT*(VEF(# -"B @
|
||||
M("!I;G0)"7-T871U<SL-"B @("!C:&%R(" @(" @*B!A<F=V6R U(%T[#0H@
|
||||
M(" @87)G=ELP72 ](")C<"([#0H@(" @87)G=ELQ72 ]("(M<"([#0H@(" @
|
||||
M87)G=ELR72 ](',[#0H@(" @87)G=ELS72 ](&0[#0H@(" @87)G=ELT72 ]
|
||||
M($Y53$P[#0H@(" @<W1A='5S(#T@<W!A=VYV<"@@4%]704E4+"!A<F=V6S!=
|
||||
M+"!A<F=V("D[#0H@(" @:68@*"!S=&%T=7,@*0T*"7!E<G)O<B@@(F-P(B I
|
||||
M.PT*(" @(')E='5R;B!S=&%T=7,[#0HC96QS90T*(" @($9)3$4@(" @(" J
|
||||
M(&9S.PT*(" @($9)3$4@(" @(" J(&9D.PT*(" @(&-H87()8G5F9F5R6R X
|
||||
M,3DR(%T[#0H@(" @:6YT"0EN.PT*(" @('-T<G5C="!F=&EM90E7:&5N.PT*
|
||||
M(" @('-T<G5C="!S=&%T"0E3=&%T.PT*#0H@(" @9G,@/2!F;W!E;B@@<RP@
|
||||
M(G)B(B I.PT*(" @(&EF("@@9G,@/3T@3E5,3" I("![#0H)<&5R<F]R*"!S
|
||||
M("D[#0H)<F5T=7)N(#$[#0H@(" @?0T*(" @(&9D(#T@9F]P96XH(&0L(")W
|
||||
M8B(@*3L-"B @("!I9B H(&9D(#T]($Y53$P@*2 @>PT*"7!E<G)O<B@@9" I
|
||||
M.PT*"69C;&]S92@@9G,@*3L-"@ER971U<FX@,CL-"B @("!]#0H-"B @("!I
|
||||
M9B H('!R97-E<G9E7W1I;64@*0T*"6EF("@@9V5T9G1I;64H(&9I;&5N;RAF
|
||||
M<RDL("97:&5N("D@*2 @>PT*"2 @("!P97)R;W(H(',@*3L-"@D@(" @<')E
|
||||
M<V5R=F5?=&EM92 ](# [#0H)?0T*#0H@(" @9&\@>PT*"6X@/2!F<F5A9"@@
|
||||
M8G5F9F5R+" Q+"!S:7IE;V8@8G5F9F5R+"!F<R I.PT*"6EF("@@;B ^(# @
|
||||
M*0T*"2 @("!I9B H(&9W<FET92@@8G5F9F5R+" Q+"!N+"!F9" I(#P@," I
|
||||
M("![#0H)"7!E<G)O<B@@9" I.PT*"0ER971U<FX@,SL-"@D@(" @?0T*(" @
|
||||
M('T@=VAI;&4@*"!N(#X@," I.R @(" -"@T*(" @(&9C;&]S92@@9G,@*3L-
|
||||
M"@T*(" @("\J($9I>"!T:6UE('-T86UP("HO#0H@(" @:68@*"!P<F5S97)V
|
||||
M95]T:6UE("D-"@EI9B H('-E=&9T:6UE*"!F:6QE;F\H9F0I+" F5VAE;B I
|
||||
M("D@('L-"@D@(" @<&5R<F]R*"!S("D[#0H)(" @('!R97-E<G9E7W1I;64@
|
||||
M/2 P.PT*"7T-"B @("!F8VQO<V4H(&9D("D[#0H-"B @(" O*B!&:7@@86-C
|
||||
M97-S(')I9VAT<R J+PT*(" @(&EF("@@<W1A="@@<RP@)E-T870@*2 I#0H)
|
||||
M<&5R<F]R*"!S("D[#0H@(" @96QS92!I9B H(&-H;6]D*"!D+"!3=&%T+G-T
|
||||
M7VUO9&4@*2 I#0H)<&5R<F]R*"!D("D[#0H-"B @("!R971U<FX@,#L-"B-E
|
||||
M;F1I9@T*?0T*#0H-"@T*#0H-"FEN="!M86EN*"!I;G0@87)G8RP@8VAA<B J
|
||||
M(&%R9W9;72 I#0I[#0H@(" @8VAA<B J"7!R;V=N86UE.PT*(" @(&EN= D)
|
||||
M=F5R8F]S92 ](# [#0H@(" @:6YT"0EO;FQY7VEF7VYE=V5R/2 P.PT*(" @
|
||||
M(&-H87(@*@ES=69F:7@@(#T@3E5,3#L-"B @("!C:&%R("H);6]D90D]($Y5
|
||||
M3$P[#0H@(" @8VAA<B J( ED97-T.PT*(" @(&-H87(@*BH)<' [#0H-"B @
|
||||
M("!A<F=V(#T@87)G=E]F:7@H("9A<F=C+"!A<F=V("D[#0H-"B @("!P<F]G
|
||||
M;F%M92 ](&)A<V5N86UE*" J87)G=BLK("D[#0H-"B @(" O*B!P<F]C97-S
|
||||
M('1H92!O<'1I;VYS("HO#0H@(" @=VAI;&4@*"!A<F=V6S!=(" F)B @87)G
|
||||
M=ELP75LP72 ]/2 G+2<@*2 @>PT*"7-W:71C:" H(&%R9W9;,%U;,5T@*2 @
|
||||
M>PT*"2 @("!C87-E("=.)SH-"@D@(" @(" @("LK87)G=CL-"@D);VYL>5]I
|
||||
M9E]N97=E<B ](#$[#0H)"6)R96%K.PT*"2 @("!C87-E("=C)SH-"@D@(" @
|
||||
M(" @("LK87)G=CL-"@D)+RH@5V4@86QW87ES(&-O<'DL(')E9V%R9&QE<W,@
|
||||
M*B\-"@D)8G)E86L[#0H)(" @(&-A<V4@)W8G.@T*"0DK*V%R9W8[#0H)"79E
|
||||
M<F)O<V4@/2 Q.PT*"0EB<F5A:SL-"@D@(" @8V%S92 G5B<Z#0H)"2LK87)G
|
||||
M=CL-"@D)<W5F9FEX(#T@*F%R9W8[#0H)"2LK87)G=CL-"@D)8G)E86L[#0H)
|
||||
M(" @(&-A<V4@)VTG.@T*"0DK*V%R9W8[#0H)"6UO9&4@/2 J87)G=CL-"@D)
|
||||
M*RMA<F=V.PT*"0EB<F5A:SL-"@D@(" @9&5F875L=#H-"@D)9F%T86PH($Y5
|
||||
M3$P@*3L-"@E]#0H@(" @?0T*#0H@(" @+RH@4V5P87)A=&4@<V]U<F-E(&9I
|
||||
M;&4H<RD@9G)O;2!D97-T(&1I<F5C=&]R>2!O<B!F:6QE("HO#0HC:68@, T*
|
||||
M(" @(&EF("@@(6%R9W9;,%T@?'P@(6%R9W9;,5T@*0T*"69A=&%L*" B;6ES
|
||||
M<VEN9R!F:6QE<R!O<B!I;G9A;&ED(&1E<W1I;F%T:6]N(B I.PT*(V5L<V4-
|
||||
M"B @(" O*B!792!U<V5D('1O(')E<75I<F4@870@;&5A<W0@;VYE(&9I;&4[
|
||||
M(&YO="!A;GD@;6]R92 J+PT*(" @(&EF("@@(6%R9W9;,%T@*0T*"69A=&%L
|
||||
M*" B;6ES<VEN9R!F:6QE<R!O<B!I;G9A;&ED(&1E<W1I;F%T:6]N(B I.PT*
|
||||
M(" @(&EF("@@(6%R9W9;,5T@*0T*"7)E='5R;B P.PT*(V5N9&EF#0H@(" @
|
||||
M9F]R("@@<' @/2!A<F=V.R J<' [("LK<' @*0T*"6-O;G1I;G5E.PT*(" @
|
||||
M("TM<' [#0H@(" @9&5S=" ]("IP<#L-"B @(" J<' @/2!.54Q,.PT*#0H@
|
||||
M(" @+RH@4')O8V5S<R!T:&4@87)G=6UE;G1S("HO#0H@(" @9F]R("@[("IA
|
||||
M<F=V.R K*V%R9W8@*2 @>PT*"6-H87(@*B!F(#T@*F%R9W8[#0H)8VAA<B J
|
||||
M(&QE868@/2!B87-E;F%M92@@9B I.PT*"6-H87(@=&%R9V5T6R Q,C@@73L-
|
||||
M"@T*"7-T<F-P>2@@=&%R9V5T+"!D97-T("D[#0H-"@EI9B H(&ES7V1I<B@@
|
||||
M=&%R9V5T("D@*2 @>PT*"2 @("!S=')C870H('1A<F=E="P@(B\B("D[#0H)
|
||||
M(" @("\J(&EF('=E('=E<F4@9VEV96X@82!S=69F:7@L('1H96X@861D(&ET
|
||||
M(&%S(&%P<')O<')I871E("HO#0H)(" @(&EF("@@<W5F9FEX("D@('L-"@D)
|
||||
M8VAA<B J(&1O=" ]('-T<F-H<B@@;&5A9BP@)RXG("D[#0H)"6EF("@@9&]T
|
||||
M("D@('L-"@D)(" @('-T<FYC870H('1A<F=E="P@;&5A9BP@9&]T+6QE868@
|
||||
M*3L-"@D)(" @('-T<F-A="@@=&%R9V5T+"!S=69F:7@@*3L-"@D)(" @('-T
|
||||
M<F-A="@@=&%R9V5T+"!D;W0@*3L-"@D)(" @(&EF("@@=F5R8F]S92 I#0H)
|
||||
M"0EP<FEN=&8H("(E<SH@)7,@=VEL;"!B92!I;G-T86QL960@87,@)7,B+ T*
|
||||
M"0D)(" @(" @('!R;V=N86UE+"!F+"!S=')R8VAR*'1A<F=E="PG+R<I*S$@
|
||||
M*3L-"@D)?2!E;'-E('L-"@D)(" @('-T<F-A="@@=&%R9V5T+"!L96%F("D[
|
||||
M#0H)"2 @("!S=')C870H('1A<F=E="P@<W5F9FEX("D[#0H)"7T-"@D@(" @
|
||||
M?2!E;'-E('L-"@D)<W1R8V%T*"!T87)G970L(&QE868@*3L-"@D@(" @?0T*
|
||||
M"7T-"@T*"6EF("@@86-C97-S*"!F+" P("D@*2 @>PT*"2 @("!C:&%R(&)U
|
||||
M9ELR,#!=.PT*"2 @("!S<')I;G1F*"!B=68L(")C86YN;W0@<F5A9" E<R(L
|
||||
M(&8@*3L-"@D@(" @9F%T86PH(&)U9B I.PT*"7T-"@T*"6EF("@@;VYL>5]I
|
||||
M9E]N97=E<B F)B!I<U]F:6QE*"!T87)G970@*2 F)B A;F5W97(H(&8L('1A
|
||||
M<F=E=" I("D@('L-"@D@(" @:68@*"!V97)B;W-E("D-"@D)<')I;G1F*" B
|
||||
M)R5S)R!N;W0@;F5W97(@=&AA;B G)7,G7&XB+"!F+"!T87)G970@*3L-"@D@
|
||||
M(" @8V]N=&EN=64[#0H)?0T*#0H):68@*"!V97)B;W-E("D-"@D@(" @<')I
|
||||
M;G1F*" B<FT@+68@)7-<;B(L('1A<F=E=" I.PT*"6EF("@@8VAM;V0H('1A
|
||||
M<F=E="P@,#<W-R I("D-"@D@(" @:68@*"!V97)B;W-E("D-"@D)<&5R<F]R
|
||||
M*"!T87)G970@*3L-"@EI9B H('5N;&EN:R@@=&%R9V5T("D@*0T*"2 @("!I
|
||||
M9B H('9E<F)O<V4@*0T*"0EP97)R;W(H('1A<F=E=" I.PT*"6EF("@@=F5R
|
||||
M8F]S92 I#0H)(" @('!R:6YT9B@@(F-P("UP("5S("5S7&XB+"!F+"!T87)G
|
||||
M970@*3L-"@EI9B H(&9I;&5C;W!Y*"!T87)G970L(&8L(#$@*2 I#0H)(" @
|
||||
M(')E='5R;B Q.PT*"6EF("@@;6]D92 I("![#0H)(" @(&-H87(@8G5F6R R
|
||||
M-34@73L-"@D@(" @<W!R:6YT9B@@8G5F+" B8VAM;V0@)7,@)7-<;B(L(&UO
|
||||
M9&4L('1A<F=E=" I.PT*"2 @("!I9B H('9E<F)O<V4@*0T*"0EP<FEN=&8H
|
||||
M("(E<UQN(BP@8G5F("D[#0H)(" @('-Y<W1E;2@@8G5F("D[#0H)?0T*(" @
|
||||
:('T-"@T*(" @(')E='5R;B P.PT*?0T*#0IE
|
||||
|
||||
end
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_SCRIPTS=\
|
||||
install-if-change \
|
||||
lock-directory \
|
||||
unlock-directory \
|
||||
rcs-clean
|
||||
|
||||
noinst_SCRIPTS = search-id.sh
|
||||
|
||||
#
|
||||
# HACK: install to the build-tree
|
||||
#
|
||||
install-exec-local: $(bin_SCRIPTS)
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
$(INSTALL_SCRIPT) $(bin_SCRIPTS) \
|
||||
$(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
|
||||
preinstall: install-exec-local
|
||||
|
||||
include $(top_srcdir)/../../automake/local.am
|
||||
@@ -1,258 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
EXEEXT = @EXEEXT@
|
||||
KSH = @KSH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
PACKAGE = @PACKAGE@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
RTEMS_ROOT = @RTEMS_ROOT@
|
||||
RTEMS_TOPdir = @RTEMS_TOPdir@
|
||||
VERSION = @VERSION@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_SCRIPTS = install-if-change lock-directory unlock-directory rcs-clean
|
||||
|
||||
|
||||
noinst_SCRIPTS = search-id.sh
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
|
||||
CONFIG_HEADER = ../src/config.h
|
||||
CONFIG_CLEAN_FILES = install-if-change lock-directory rcs-clean \
|
||||
unlock-directory
|
||||
SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS)
|
||||
|
||||
DIST_COMMON = README Makefile.am Makefile.in install-if-change.in \
|
||||
lock-directory.in rcs-clean.in unlock-directory.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/../../automake/local.am
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
install-if-change: $(top_builddir)/config.status install-if-change.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
lock-directory: $(top_builddir)/config.status lock-directory.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
rcs-clean: $(top_builddir)/config.status rcs-clean.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
unlock-directory: $(top_builddir)/config.status unlock-directory.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else :; fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-binSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = scripts
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign scripts/Makefile
|
||||
@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
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-binSCRIPTS install-exec-local
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-binSCRIPTS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(SCRIPTS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
|
||||
|
||||
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-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-generic clean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: uninstall-binSCRIPTS install-binSCRIPTS tags distdir info-am \
|
||||
info dvi-am dvi check check-am installcheck-am installcheck \
|
||||
install-exec-local 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
|
||||
|
||||
|
||||
#
|
||||
# HACK: install to the build-tree
|
||||
#
|
||||
install-exec-local: $(bin_SCRIPTS)
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
$(INSTALL_SCRIPT) $(bin_SCRIPTS) \
|
||||
$(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
|
||||
preinstall: install-exec-local
|
||||
|
||||
debug-am:
|
||||
|
||||
debug: debug-am
|
||||
|
||||
debug_install-am:
|
||||
|
||||
debug_install: debug_install-am
|
||||
|
||||
.PHONY: debug debug_install debug-am
|
||||
|
||||
profile-am:
|
||||
|
||||
profile: profile-am
|
||||
|
||||
profile_install-am:
|
||||
|
||||
profile_install: profile_install-am
|
||||
|
||||
.PHONY: profile profile_install profile-am
|
||||
|
||||
preinstall-am:
|
||||
|
||||
preinstall: preinstall-am
|
||||
|
||||
.PHONY: preinstall preinstall-am
|
||||
|
||||
# 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:
|
||||
@@ -1,24 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
Misc. support tools for RTEMS workspaces.
|
||||
More will be added later as they are converted from Teamware
|
||||
to CVS.
|
||||
|
||||
install-if-change
|
||||
Smart install script that also can append suffixes as it
|
||||
installs (suffixes used for debug and profile variants).
|
||||
Requires bash or ksh.
|
||||
|
||||
rcs-clean
|
||||
deletes all files from the current directory that can be
|
||||
re-created from RCS. Careful to not delete locked files.
|
||||
May be used by 'gmake clobber'
|
||||
|
||||
lock-directory
|
||||
unlock-directory
|
||||
traverse a directory structure making it unwritable.
|
||||
Useful to keep people from accidentally overwriting
|
||||
"released" trees if they get confused about which
|
||||
module they have loaded.
|
||||
@@ -1,142 +0,0 @@
|
||||
#!@KSH@ -p
|
||||
#
|
||||
# Either bash or ksh will be ok for this; requires (( )) arithmetic
|
||||
# (-p above just says to not parse $ENV file; makes it faster for
|
||||
# those of us who set $ENV)
|
||||
#
|
||||
# install files if they have changed by running 'cmp', then 'install'
|
||||
# as necessary.
|
||||
#
|
||||
# Optionally, can append a suffix before last existing suffix (if any)
|
||||
#
|
||||
# NOTE
|
||||
# We avoid using typical install(1M) programs since they have
|
||||
# large variability across systems and we also need to support ou
|
||||
# -V option.
|
||||
# So we just copy and chmod by hand.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
progname=`basename $0`
|
||||
#progname=${0##*/} # fast basename hack for ksh, bash
|
||||
|
||||
USAGE=\
|
||||
"usage: $progname [ -vmV ] file [ file ... ] dest-directory-or-file
|
||||
-v -- verbose
|
||||
-V suffix -- suffix to append to targets (before any . suffix)
|
||||
eg: -V _g would change 'foo' to 'foo_g' and
|
||||
'libfoo.a' to 'libfoo_g.a'
|
||||
-m mode -- mode for new file(s)"
|
||||
|
||||
fatal() {
|
||||
if [ "$1" ]
|
||||
then
|
||||
echo $* >&2
|
||||
fi
|
||||
echo "$USAGE" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
#
|
||||
# process the options
|
||||
#
|
||||
|
||||
verbose=""
|
||||
suffix=""
|
||||
mode=""
|
||||
|
||||
while getopts vm:V: OPT
|
||||
do
|
||||
case "$OPT" in
|
||||
v)
|
||||
verbose="yes";;
|
||||
V)
|
||||
eval suffix=$OPTARG;;
|
||||
m)
|
||||
mode="$OPTARG";;
|
||||
*)
|
||||
fatal
|
||||
esac
|
||||
done
|
||||
|
||||
shiftcount=`expr $OPTIND - 1`
|
||||
shift $shiftcount
|
||||
|
||||
args=$*
|
||||
|
||||
#
|
||||
# Separate source file(s) from dest directory or file
|
||||
#
|
||||
|
||||
files=""
|
||||
dest=""
|
||||
for d in $args
|
||||
do
|
||||
files="$files $dest"
|
||||
dest=$d
|
||||
done
|
||||
|
||||
if [ ! "$files" ] || [ ! "$dest" ]
|
||||
then
|
||||
fatal "missing files or invalid destination"
|
||||
fi
|
||||
|
||||
#
|
||||
# Process the arguments
|
||||
#
|
||||
|
||||
targets=""
|
||||
for f in $files
|
||||
do
|
||||
# leaf=`basename $f`
|
||||
leaf=${f##*/} # fast basename hack for ksh, bash
|
||||
|
||||
target=$dest
|
||||
if [ -d $dest ]
|
||||
then
|
||||
# if we were given a suffix, then add it as appropriate
|
||||
if [ "$suffix" ]
|
||||
then
|
||||
case $f in
|
||||
*.*)
|
||||
# leaf=`echo $leaf |
|
||||
# /bin/sed "s/\([~\.]*\)\.\(.*\)$/\1$suffix.\2/"`
|
||||
# ksh,bash hack for above sed script
|
||||
leaf=${leaf%%.*}$suffix.${leaf#*.}
|
||||
|
||||
[ "$verbose" = "yes" ] &&
|
||||
echo "$progname: $f will be installed as $leaf"
|
||||
;;
|
||||
*)
|
||||
leaf=$leaf$suffix;;
|
||||
esac
|
||||
fi
|
||||
target=$target/$leaf
|
||||
fi
|
||||
|
||||
[ ! -r $f ] && fatal "can not read $f"
|
||||
|
||||
if cmp -s $f $target
|
||||
then
|
||||
[ "$verbose" = "yes" ] && echo "'$f' not newer than '$target'"
|
||||
else
|
||||
[ "$verbose" = "yes" ] && echo "rm -f $target"
|
||||
rm -f $target
|
||||
echo "cp -p $f $target"
|
||||
cp -p $f $target || exit 1
|
||||
targets="$targets $target" # keep list for chmod below
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$mode" -a "$targets" ]
|
||||
then
|
||||
[ "$verbose" = "yes" ] && echo "chmod $mode $targets"
|
||||
chmod $mode $targets
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables: ***
|
||||
# mode:ksh ***
|
||||
# End: ***
|
||||
@@ -1,43 +0,0 @@
|
||||
#!@KSH@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Make a directory write protected
|
||||
# Used to write protect the install point after a build
|
||||
# to prevent inadvertant overwriting.
|
||||
#
|
||||
|
||||
# is a particular command available on this machine?
|
||||
#
|
||||
cmd_avail()
|
||||
{
|
||||
set -- `type $1 2>&1`
|
||||
if [ "$2" = "not" -a "$3" = "found" ] || [ "$3" = "not" -a "$4" = "found" ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
lock_directory() {
|
||||
l_dir=$1/. # get any symlink out of the way using '.'
|
||||
if [ -d $l_dir ]
|
||||
then
|
||||
find $l_dir -type d -perm -0200 -print | $XARGS chmod -w
|
||||
fi
|
||||
}
|
||||
|
||||
# Use gnu xargs if available; faster, more reliable in general
|
||||
XARGS=xargs
|
||||
cmd_avail gxargs && XARGS=gxargs
|
||||
|
||||
for dir
|
||||
do
|
||||
lock_directory $dir
|
||||
done
|
||||
|
||||
# Local Variables: ***
|
||||
# mode:ksh ***
|
||||
# End: ***
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
#!@KSH@ -p
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Delete all files from the current directory that can be recreated
|
||||
# via RCS 'co' commonds
|
||||
# Used by 'make clobber'
|
||||
#
|
||||
|
||||
progname=${0##*/} # fast basename hack for ksh, bash
|
||||
|
||||
USAGE=\
|
||||
"usage: $progname [ -v ]"
|
||||
|
||||
fatal() {
|
||||
if [ "$1" ]
|
||||
then
|
||||
echo $* >&2
|
||||
fi
|
||||
echo "$USAGE" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
#
|
||||
# process the options
|
||||
#
|
||||
|
||||
verbose=""
|
||||
|
||||
while getopts v OPT
|
||||
do
|
||||
case "$OPT" in
|
||||
v)
|
||||
verbose="yes";;
|
||||
*)
|
||||
fatal
|
||||
esac
|
||||
done
|
||||
|
||||
let $((shiftcount = $OPTIND - 1))
|
||||
shift $shiftcount
|
||||
|
||||
args=$*
|
||||
[ "$args" ] && fatal
|
||||
|
||||
[ -d RCS/. ] || exit 0
|
||||
|
||||
# there is probably a better way to do this
|
||||
|
||||
rcs_files=`echo RCS/*,v | sed -e 's?RCS/??g' -e's/,v//g'`
|
||||
|
||||
kills=""
|
||||
for f in $rcs_files
|
||||
do
|
||||
# build list of all files in RCS/*,v that are *not* locked
|
||||
if [ -f $f ] && [ ! -w $f ] && [ -f RCS/$f,v ]
|
||||
then
|
||||
locked=`rlog -L -R $f`
|
||||
[ "$locked" = "" ] && kills="$kills $f"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$kills" ]
|
||||
then
|
||||
[ "$verbose" ] && echo rm -f $kills
|
||||
rm -f $kills
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables: ***
|
||||
# mode:ksh ***
|
||||
# End: ***
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
find $1 -type f -a ! -name "*.scn" -a ! -name "bsp_specs" -a \
|
||||
-print > /tmp/$$.0
|
||||
find $1 -type f -a ! -name "*.scn" -a ! -name "bsp_specs" -a \
|
||||
-exec grep -l '$Id' {} \; > /tmp/$$.1
|
||||
|
||||
diff /tmp/$$.0 /tmp/$$.1 > /tmp/$$.2
|
||||
|
||||
grep "<" /tmp/$$.2 | sed 's/< //' >&1
|
||||
|
||||
rm -f /tmp/$$*
|
||||
@@ -1,41 +0,0 @@
|
||||
#!@KSH@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Unlock a directory processed by lock_directory
|
||||
#
|
||||
|
||||
# is a particular command available on this machine?
|
||||
#
|
||||
cmd_avail()
|
||||
{
|
||||
set -- `type $1 2>&1`
|
||||
if [ "$2" = "not" -a "$3" = "found" ] || [ "$3" = "not" -a "$4" = "found" ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
unlock_directory() {
|
||||
ul_dir=$1/. # get any symlink out of the way using '.'
|
||||
if [ -d $ul_dir ]
|
||||
then
|
||||
find $ul_dir -type d ! -perm -0222 -print | $XARGS -t chmod +w
|
||||
fi
|
||||
}
|
||||
|
||||
# Use gnu xargs if available; faster, more reliable in general
|
||||
XARGS=xargs
|
||||
cmd_avail gxargs && XARGS=gxargs
|
||||
|
||||
for dir
|
||||
do
|
||||
unlock_directory $dir
|
||||
done
|
||||
|
||||
# Local Variables: ***
|
||||
# mode:ksh ***
|
||||
# End: ***
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_PROGRAMS=cklength eolstrip packhex unhex
|
||||
|
||||
cklength_SOURCES = cklength.c
|
||||
eolstrip_SOURCES = eolstrip.c
|
||||
packhex_SOURCES = packhex.c
|
||||
unhex_SOURCES = unhex.c
|
||||
|
||||
#
|
||||
# HACK: install to the build-tree
|
||||
#
|
||||
install-exec-local: $(bin_PROGRAMS)
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
$(INSTALL_PROGRAM) $(bin_PROGRAMS) \
|
||||
$(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
|
||||
preinstall: install-exec-local
|
||||
|
||||
include $(top_srcdir)/../../automake/local.am
|
||||
@@ -1,424 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
EXEEXT = @EXEEXT@
|
||||
KSH = @KSH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
PACKAGE = @PACKAGE@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
RTEMS_ROOT = @RTEMS_ROOT@
|
||||
RTEMS_TOPdir = @RTEMS_TOPdir@
|
||||
VERSION = @VERSION@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_PROGRAMS = cklength eolstrip packhex unhex
|
||||
|
||||
cklength_SOURCES = cklength.c
|
||||
eolstrip_SOURCES = eolstrip.c
|
||||
packhex_SOURCES = packhex.c
|
||||
unhex_SOURCES = unhex.c
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
bin_PROGRAMS = cklength$(EXEEXT) eolstrip$(EXEEXT) packhex$(EXEEXT) \
|
||||
unhex$(EXEEXT)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I.
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
cklength_OBJECTS = cklength.o
|
||||
cklength_LDADD = $(LDADD)
|
||||
cklength_DEPENDENCIES =
|
||||
cklength_LDFLAGS =
|
||||
eolstrip_OBJECTS = eolstrip.o
|
||||
eolstrip_LDADD = $(LDADD)
|
||||
eolstrip_DEPENDENCIES =
|
||||
eolstrip_LDFLAGS =
|
||||
packhex_OBJECTS = packhex.o
|
||||
packhex_LDADD = $(LDADD)
|
||||
packhex_DEPENDENCIES =
|
||||
packhex_LDFLAGS =
|
||||
unhex_OBJECTS = unhex.o
|
||||
unhex_LDADD = $(LDADD)
|
||||
unhex_DEPENDENCIES =
|
||||
unhex_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = ./stamp-h.in Makefile.am Makefile.in config.h.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/cklength.P .deps/eolstrip.P .deps/packhex.P \
|
||||
.deps/unhex.P
|
||||
SOURCES = $(cklength_SOURCES) $(eolstrip_SOURCES) $(packhex_SOURCES) $(unhex_SOURCES)
|
||||
OBJECTS = $(cklength_OBJECTS) $(eolstrip_OBJECTS) $(packhex_OBJECTS) $(unhex_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .o .s
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/../../automake/local.am
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
config.h: stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h; \
|
||||
$(MAKE) stamp-h; \
|
||||
else :; fi
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=src/config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h 2> /dev/null
|
||||
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
|
||||
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
|
||||
|
||||
.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:
|
||||
|
||||
cklength$(EXEEXT): $(cklength_OBJECTS) $(cklength_DEPENDENCIES)
|
||||
@rm -f cklength$(EXEEXT)
|
||||
$(LINK) $(cklength_LDFLAGS) $(cklength_OBJECTS) $(cklength_LDADD) $(LIBS)
|
||||
|
||||
eolstrip$(EXEEXT): $(eolstrip_OBJECTS) $(eolstrip_DEPENDENCIES)
|
||||
@rm -f eolstrip$(EXEEXT)
|
||||
$(LINK) $(eolstrip_LDFLAGS) $(eolstrip_OBJECTS) $(eolstrip_LDADD) $(LIBS)
|
||||
|
||||
packhex$(EXEEXT): $(packhex_OBJECTS) $(packhex_DEPENDENCIES)
|
||||
@rm -f packhex$(EXEEXT)
|
||||
$(LINK) $(packhex_LDFLAGS) $(packhex_OBJECTS) $(packhex_LDADD) $(LIBS)
|
||||
|
||||
unhex$(EXEEXT): $(unhex_OBJECTS) $(unhex_DEPENDENCIES)
|
||||
@rm -f unhex$(EXEEXT)
|
||||
$(LINK) $(unhex_LDFLAGS) $(unhex_OBJECTS) $(unhex_LDADD) $(LIBS)
|
||||
|
||||
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 = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = src
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign src/Makefile
|
||||
@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
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
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-binPROGRAMS install-exec-local
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-binPROGRAMS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(PROGRAMS) config.h
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
|
||||
|
||||
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-binPROGRAMS \
|
||||
mostlyclean-compile mostlyclean-tags mostlyclean-depend \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
|
||||
distclean-tags distclean-depend distclean-generic \
|
||||
clean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-tags \
|
||||
maintainer-clean-depend maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
|
||||
distclean-depend clean-depend maintainer-clean-depend info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
|
||||
install-exec-local 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
|
||||
|
||||
|
||||
#
|
||||
# HACK: install to the build-tree
|
||||
#
|
||||
install-exec-local: $(bin_PROGRAMS)
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
$(INSTALL_PROGRAM) $(bin_PROGRAMS) \
|
||||
$(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
|
||||
preinstall: install-exec-local
|
||||
|
||||
debug-am:
|
||||
|
||||
debug: debug-am
|
||||
|
||||
debug_install-am:
|
||||
|
||||
debug_install: debug_install-am
|
||||
|
||||
.PHONY: debug debug_install debug-am
|
||||
|
||||
profile-am:
|
||||
|
||||
profile: profile-am
|
||||
|
||||
profile_install-am:
|
||||
|
||||
profile_install: profile_install-am
|
||||
|
||||
.PHONY: profile profile_install profile-am
|
||||
|
||||
preinstall-am:
|
||||
|
||||
preinstall: preinstall-am
|
||||
|
||||
.PHONY: preinstall preinstall-am
|
||||
|
||||
# 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:
|
||||
@@ -1,377 +0,0 @@
|
||||
/*
|
||||
* cklength - check the length of lines in a file
|
||||
*
|
||||
* This program check to see if the files passed to it on the command line
|
||||
* contain a line which exceeds the maximum allowable length. The default
|
||||
* maximum line length is 80.
|
||||
*
|
||||
* usage: cklength [ -v ] [ arg ... ] files...
|
||||
* -l length -- maximum line length
|
||||
* -v -- verbose
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define GETOPTARGS "l:nNv"
|
||||
|
||||
char *USAGE = "\
|
||||
usage: cklength [ -v ] [ arg ... ] files... \n\
|
||||
-l length -- maximum line length\n\
|
||||
-n -- report line numbers for offending lines\n\
|
||||
-N -- report line numbers and length for offending lines\n\
|
||||
-v -- verbose\n\
|
||||
\n\
|
||||
Print the name of files which have at least 1 line which exceeds the\n\
|
||||
maximum line length. The default maximum line length is 80.\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef VMS
|
||||
#ifndef HAVE_STRERROR
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
|
||||
#define strerror( _err ) \
|
||||
((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
|
||||
|
||||
#else /* HAVE_STRERROR */
|
||||
char *strerror ();
|
||||
#endif
|
||||
#else /* VMS */
|
||||
char *strerror (int,...);
|
||||
#endif
|
||||
|
||||
|
||||
#define BUFFER_SIZE 512
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1
|
||||
#define Failed(x) (((int) (x)) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
/*
|
||||
* Definitions for unsigned "ints"; especially for use in data structures
|
||||
* that will be shared among (potentially) different cpu's (we punt on
|
||||
* byte ordering problems tho)
|
||||
*/
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
int verbose = FALSE; /* be verbose */
|
||||
int report_line_numbers = FALSE; /* report line numbers of offenders */
|
||||
int report_line_length = FALSE; /* report line length of offenders */
|
||||
|
||||
int line_length = 80; /* maximum allowable line length */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind, opterr;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
int process(char *arg);
|
||||
void error(int errn, ...);
|
||||
long getparm(char *s, long min, long max, char *msg);
|
||||
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#define stol(p) strtol(p, (char **) NULL, 0)
|
||||
int Open(), Read(), Write();
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
register int c;
|
||||
int showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
opterr = 0; /* we'll report all errors */
|
||||
while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'l': /* line length */
|
||||
line_length = atoi( optarg );
|
||||
if ( line_length < 0 || line_length > BUFFER_SIZE )
|
||||
error(ERR_FATAL, "(%d) is illegal line length\n",line_length);
|
||||
break;
|
||||
|
||||
case 'n': /* toggle report_line_numbers */
|
||||
report_line_numbers = ! report_line_numbers;
|
||||
break;
|
||||
|
||||
case 'N': /* toggle both reports */
|
||||
report_line_numbers = ! report_line_numbers;
|
||||
report_line_length = ! report_line_length;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* traverse and process the arguments
|
||||
*/
|
||||
|
||||
for ( ; argv[optind]; optind++)
|
||||
if (Failed(process(argv[optind])))
|
||||
rc = FAILURE;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* process(arg)
|
||||
*/
|
||||
|
||||
int
|
||||
process(char *arg)
|
||||
{
|
||||
FILE *in;
|
||||
char *bptr;
|
||||
char buffer[ BUFFER_SIZE ];
|
||||
int line_number;
|
||||
int length;
|
||||
int count;
|
||||
int rc = SUCCESS; /* succeed by default */
|
||||
|
||||
in = fopen( arg, "r" );
|
||||
if (!in)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
|
||||
count = 0;
|
||||
|
||||
for ( line_number=1 ; ; line_number++ ) {
|
||||
bptr = fgets( buffer, BUFFER_SIZE, in );
|
||||
if (!bptr)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Don't count the carriage return.
|
||||
*/
|
||||
|
||||
length = strlen( buffer ) - 1;
|
||||
|
||||
if ( length <= line_length )
|
||||
continue;
|
||||
|
||||
if ( count == 0 ) {
|
||||
fprintf( stderr, "%s\n", arg );
|
||||
if ( !report_line_numbers )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( verbose )
|
||||
fprintf( stderr, "TOO LONG:%d: %s\n", line_number, buffer );
|
||||
|
||||
if ( report_line_numbers ) {
|
||||
if ( report_line_length )
|
||||
fprintf( stderr, "%d: %d\n" , line_number, length );
|
||||
else
|
||||
fprintf( stderr, "%d\n" , line_number );
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
}
|
||||
|
||||
fclose( in );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_FATAL bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
(void) fprintf(stderr, " (%s)\n", strerror(local_errno));
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long
|
||||
getparm(char *s,
|
||||
long min,
|
||||
long max,
|
||||
char *msg)
|
||||
{
|
||||
long val;
|
||||
|
||||
if ( ! strchr("0123456789-", *s))
|
||||
{
|
||||
error(ERR_FATAL, "'%s' is not a number", s);
|
||||
return min;
|
||||
}
|
||||
|
||||
val = strtol(s, (char **) NULL, 0);
|
||||
if ((val < min) || (val > max))
|
||||
{
|
||||
if (min == max)
|
||||
error(ERR_FATAL, "%s can only be %ld", s, min);
|
||||
else
|
||||
error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open()
|
||||
* Perform open(2), returning the file descriptor. Prints
|
||||
* error message if open fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Open(char *file,
|
||||
int oflag,
|
||||
int mode)
|
||||
{
|
||||
int O_fd;
|
||||
|
||||
if (Failed(O_fd = open(file, oflag, mode)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"open('%s', 0x%x, 0%o) failed", file, oflag, mode
|
||||
);
|
||||
|
||||
return O_fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read()
|
||||
* Perform read(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Read(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = read(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"read(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write()
|
||||
* Perform write(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Write(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = write(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"write(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
/* src/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#undef HAVE_STRERROR
|
||||
@@ -1,366 +0,0 @@
|
||||
/*
|
||||
* eolstrip - strip white space from end of lines
|
||||
*
|
||||
* This program strips the white space from the end of every line in the
|
||||
* specified program.
|
||||
*
|
||||
* usage: eolstrip [ -v ] [ arg ... ] files...
|
||||
* -v -- verbose
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define GETOPTARGS "vt"
|
||||
|
||||
char *USAGE = "\
|
||||
usage: cklength [ -v ] [ arg ... ] files... \n\
|
||||
-v -- verbose\n\
|
||||
-t -- test only .. DO NOT OVERWRITE FILE!!!\n\
|
||||
\n\
|
||||
Strip the white space from the end of every line on the list of files.\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef VMS
|
||||
#ifndef HAVE_STRERROR
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
|
||||
#define strerror( _err ) \
|
||||
((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
|
||||
|
||||
#else /* HAVE_STRERROR */
|
||||
char *strerror ();
|
||||
#endif
|
||||
#else /* VMS */
|
||||
char *strerror (int,...);
|
||||
#endif
|
||||
|
||||
|
||||
#define BUFFER_SIZE 2048
|
||||
#define MAX_PATH 2048
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1
|
||||
#define Failed(x) (((int) (x)) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
/*
|
||||
* Definitions for unsigned "ints"; especially for use in data structures
|
||||
* that will be shared among (potentially) different cpu's (we punt on
|
||||
* byte ordering problems tho)
|
||||
*/
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
int verbose = FALSE; /* be verbose */
|
||||
int test_only = FALSE; /* test only */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind, opterr;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
int process(char *arg);
|
||||
void error(int errn, ...);
|
||||
long getparm(char *s, long min, long max, char *msg);
|
||||
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#define stol(p) strtol(p, (char **) NULL, 0)
|
||||
int Open(), Read(), Write();
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
register int c;
|
||||
int showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
opterr = 0; /* we'll report all errors */
|
||||
while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 't': /* toggle test only mode */
|
||||
test_only = ! test_only;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* traverse and process the arguments
|
||||
*/
|
||||
|
||||
for ( ; argv[optind]; optind++)
|
||||
if (Failed(process(argv[optind])))
|
||||
rc = FAILURE;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* process(arg)
|
||||
*/
|
||||
|
||||
int
|
||||
process(char *arg)
|
||||
{
|
||||
FILE *in;
|
||||
FILE *out = (FILE *) 0;
|
||||
char outname[ MAX_PATH ];
|
||||
char *bptr;
|
||||
char buffer[ BUFFER_SIZE ];
|
||||
int length;
|
||||
int line_number;
|
||||
int rc = SUCCESS; /* succeed by default */
|
||||
|
||||
in = fopen( arg, "r" );
|
||||
if (!in)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
|
||||
if ( !test_only ) {
|
||||
sprintf( outname, "%s.eoltmp", arg );
|
||||
|
||||
out = fopen( outname, "w" );
|
||||
if (!out)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
}
|
||||
|
||||
if ( verbose )
|
||||
fprintf( stderr, "Processing %s\n", arg );
|
||||
|
||||
for ( line_number=1 ; ; line_number++ ) {
|
||||
bptr = fgets( buffer, BUFFER_SIZE, in );
|
||||
if (!bptr)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Don't count the carriage return.
|
||||
*/
|
||||
|
||||
length = strlen( buffer ) - 1;
|
||||
|
||||
if ( buffer[ length ] != '\n' )
|
||||
error(ERR_ERRNO|ERR_FATAL, "Line %d too long in %s\n", line_number, arg);
|
||||
|
||||
while ( isspace( (int) buffer[ length ] ) )
|
||||
buffer[ length-- ] = '\0';
|
||||
|
||||
if ( test_only ) {
|
||||
fprintf( stderr, "%s\n", arg );
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf( out, "%s\n", buffer );
|
||||
}
|
||||
|
||||
fclose( in );
|
||||
if ( !test_only ) {
|
||||
fclose( out );
|
||||
rename( outname, arg );
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_FATAL bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
(void) fprintf(stderr, " (%s)\n", strerror(local_errno));
|
||||
else
|
||||
(void) fprintf(stderr, "\n");
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long
|
||||
getparm(char *s,
|
||||
long min,
|
||||
long max,
|
||||
char *msg)
|
||||
{
|
||||
long val;
|
||||
|
||||
if ( ! strchr("0123456789-", *s))
|
||||
{
|
||||
error(ERR_FATAL, "'%s' is not a number", s);
|
||||
return min;
|
||||
}
|
||||
|
||||
val = strtol(s, (char **) NULL, 0);
|
||||
if ((val < min) || (val > max))
|
||||
{
|
||||
if (min == max)
|
||||
error(ERR_FATAL, "%s can only be %ld", s, min);
|
||||
else
|
||||
error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open()
|
||||
* Perform open(2), returning the file descriptor. Prints
|
||||
* error message if open fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Open(char *file,
|
||||
int oflag,
|
||||
int mode)
|
||||
{
|
||||
int O_fd;
|
||||
|
||||
if (Failed(O_fd = open(file, oflag, mode)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"open('%s', 0x%x, 0%o) failed", file, oflag, mode
|
||||
);
|
||||
|
||||
return O_fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read()
|
||||
* Perform read(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Read(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = read(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"read(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write()
|
||||
* Perform write(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Write(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = write(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"write(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
@@ -1,565 +0,0 @@
|
||||
|
||||
/***** P A C K H E X . C ************************************************
|
||||
*
|
||||
* Packhex is a hex-file compaction utility. It attempts to concatenate
|
||||
* hex records to produce more size-efficient packaging.
|
||||
*
|
||||
* Limitations: Input files must be correctly formatted. This utility
|
||||
* is not robust enough to detect hex-record formatting
|
||||
* errors.
|
||||
*
|
||||
* Published: May 1993 Embedded Systems Programming magazine
|
||||
* "Creating Faster Hex Files"
|
||||
*
|
||||
* URL: ESP magazine: http://www.embedded.com
|
||||
* Source Code: ftp://ftp.mfi.com/pub/espmag/1993/pakhex.zip
|
||||
*
|
||||
* Author: Mark Gringrich
|
||||
*
|
||||
* Compiler: Microsoft C 6.0
|
||||
* cl /F 1000 packhex.c
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/* #define SMALLER_RECORDS */
|
||||
#ifdef SMALLER_RECORDS
|
||||
#define MAX_LEN_S1_RECS 128
|
||||
#define MAX_LEN_S2_RECS 128
|
||||
#define MAX_LEN_S3_RECS 128
|
||||
#else
|
||||
#define MAX_LEN_S1_RECS 252
|
||||
#define MAX_LEN_S2_RECS 251
|
||||
#define MAX_LEN_S3_RECS 250
|
||||
#endif
|
||||
|
||||
|
||||
/*--------------------------------- includes ---------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef VMS
|
||||
#ifndef HAVE_STRERROR
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
|
||||
#define strerror( _err ) \
|
||||
((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
|
||||
|
||||
#else /* HAVE_STRERROR */
|
||||
char *strerror ();
|
||||
#endif
|
||||
#else /* VMS */
|
||||
char *strerror (int,...);
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) && !defined(EXIT_FAILURE)
|
||||
#define EXIT_FAILURE -1
|
||||
#define EXIT_SUCCESS 0
|
||||
#endif
|
||||
|
||||
/*--------------------------------- defines ----------------------------------*/
|
||||
|
||||
#define YES 1
|
||||
#define MAX_LINE_SIZE 600
|
||||
#define EOS '\0'
|
||||
|
||||
|
||||
/*---------------------------------- macros ----------------------------------*/
|
||||
|
||||
/* Convert ASCII hexadecimal digit to value. */
|
||||
|
||||
#define HEX_DIGIT( C ) ( ( ( ( C ) > '9' ) ? ( C ) + 25 : ( C ) ) & 0xF )
|
||||
|
||||
|
||||
/*--------------------------------- typedefs ---------------------------------*/
|
||||
|
||||
typedef unsigned char Boolean;
|
||||
typedef unsigned char Uchar;
|
||||
typedef unsigned int Uint;
|
||||
typedef unsigned long Ulong;
|
||||
|
||||
typedef struct /* Functions and constant returning Hex-record vital stats. */
|
||||
{
|
||||
Boolean ( *is_data_record )( char * );
|
||||
Ulong ( *get_address )( char * );
|
||||
Uint ( *get_data_count )( char * );
|
||||
const Uint max_data_count;
|
||||
char *( *get_data_start )( char * );
|
||||
void ( *put_data_record )( Uint, Ulong, char * );
|
||||
} Rec_vitals;
|
||||
|
||||
|
||||
/*--------------------------- function prototypes ----------------------------*/
|
||||
|
||||
Rec_vitals * identify_first_data_record( char *, int );
|
||||
Ulong get_ndigit_hex( char *, int );
|
||||
|
||||
|
||||
/*----------------------------- Intel Hex format -----------------------------*/
|
||||
|
||||
/*
|
||||
* Intel Hex data-record layout
|
||||
*
|
||||
* :aabbbbccd...dee
|
||||
*
|
||||
* : - header character
|
||||
* aa - record data byte count, a 2-digit hex value
|
||||
* bbbb - record address, a 4-digit hex value
|
||||
* cc - record type, a 2-digit hex value:
|
||||
* "00" is a data record
|
||||
* "01" is an end-of-data record
|
||||
* "02" is an extended-address record
|
||||
* "03" is a start record
|
||||
* d...d - data (always an even number of chars)
|
||||
* ee - record checksum, a 2-digit hex value
|
||||
* checksum = 2's complement
|
||||
* [ (sum of bytes: aabbbbccd...d) modulo 256 ]
|
||||
*/
|
||||
|
||||
|
||||
Boolean is_intel_data_rec( char * rec_str )
|
||||
{
|
||||
return( ( rec_str[ 0 ] == ':' ) && ( rec_str[ 8 ] == '0' ) );
|
||||
}
|
||||
|
||||
Uint get_intel_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 1, 2 ) );
|
||||
}
|
||||
|
||||
Ulong get_intel_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 3, 4 ) );
|
||||
}
|
||||
|
||||
char * get_intel_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 9 );
|
||||
}
|
||||
|
||||
void put_intel_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = count + ( address >> 8 & 0xff ) + ( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
":%02X%04lX00%s%02X\n", count, address, data_str, (~sum + 1) & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals intel_hex =
|
||||
{
|
||||
is_intel_data_rec,
|
||||
get_intel_rec_address,
|
||||
get_intel_rec_data_count,
|
||||
255, /* Maximum data bytes in a record. */
|
||||
get_intel_rec_data_start,
|
||||
put_intel_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S1-record format ------------------------*/
|
||||
|
||||
/*
|
||||
* Motorola S-record data-record layout
|
||||
*
|
||||
* Sabbc...cd...dee
|
||||
*
|
||||
* S - header character
|
||||
* a - record type, a 1-digit value:
|
||||
* "0" is a header record
|
||||
* "1" is a 2-byte-address data record
|
||||
* "2" is a 3-byte-address data record
|
||||
* "3" is a 4-byte-address data record
|
||||
* "7" is a 4-byte-address end-of-data record
|
||||
* "8" is a 3-byte-address end-of-data record
|
||||
* "9" is a 2-byte-address end-of-data record
|
||||
* bb - record length in bytes, a 2-digit hex value
|
||||
* (record length doesn't count the header/type
|
||||
* chars and checksum byte)
|
||||
* c...c - record address, a 4-, 6-, or 8-digit value,
|
||||
* depending on record type
|
||||
* d...d - data (always an even number of chars)
|
||||
* ee - record checksum, a 2-digit hex value
|
||||
* checksum = 1's complement
|
||||
* [ (sum of all bytes: bbc..cd...d) modulo 256 ]
|
||||
*/
|
||||
|
||||
#define S1_COUNT_OFFSET 3
|
||||
|
||||
|
||||
Boolean is_moto_s1_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '1' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s1_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S1_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s1_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 4 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s1_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 8 );
|
||||
}
|
||||
|
||||
void put_moto_s1_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S1_COUNT_OFFSET + count +
|
||||
( address >> 8 & 0xff ) + ( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S1%02X%04lX%s%02X\n",
|
||||
count + S1_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s1_rec =
|
||||
{
|
||||
is_moto_s1_data_rec,
|
||||
get_moto_s1_rec_address,
|
||||
get_moto_s1_rec_data_count,
|
||||
MAX_LEN_S1_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s1_rec_data_start,
|
||||
put_moto_s1_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S2-record format ------------------------*/
|
||||
|
||||
#define S2_COUNT_OFFSET 4
|
||||
|
||||
Boolean is_moto_s2_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '2' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s2_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S2_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s2_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 6 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s2_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 10 );
|
||||
}
|
||||
|
||||
void put_moto_s2_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S2_COUNT_OFFSET + count + ( address >> 16 & 0xff ) +
|
||||
( address >> 8 & 0xff ) +
|
||||
( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S2%02X%06lX%s%02X\n",
|
||||
count + S2_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s2_rec =
|
||||
{
|
||||
is_moto_s2_data_rec,
|
||||
get_moto_s2_rec_address,
|
||||
get_moto_s2_rec_data_count,
|
||||
MAX_LEN_S2_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s2_rec_data_start,
|
||||
put_moto_s2_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S3-record format ------------------------*/
|
||||
|
||||
#define S3_COUNT_OFFSET 5
|
||||
|
||||
Boolean is_moto_s3_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '3' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s3_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S3_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s3_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 8 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s3_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 12 );
|
||||
}
|
||||
|
||||
void put_moto_s3_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S3_COUNT_OFFSET + count + ( address >> 24 & 0xff ) +
|
||||
( address >> 16 & 0xff ) +
|
||||
( address >> 8 & 0xff ) +
|
||||
( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S3%02X%08lX%s%02X\n",
|
||||
count + S3_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s3_rec =
|
||||
{
|
||||
is_moto_s3_data_rec,
|
||||
get_moto_s3_rec_address,
|
||||
get_moto_s3_rec_data_count,
|
||||
MAX_LEN_S3_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s3_rec_data_start,
|
||||
put_moto_s3_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*-------------------- Put your favorite hex format here ---------------------*/
|
||||
|
||||
/*
|
||||
* * * * The following is a template for an additional hex format: * * *
|
||||
*
|
||||
*
|
||||
* Boolean is_X_data_rec( char * rec_str ) {}
|
||||
*
|
||||
* Uint get_X_rec_data_count( char * rec_str ) {}
|
||||
*
|
||||
* Ulong get_X_rec_address( char * rec_str ) {}
|
||||
*
|
||||
* char * get_X_rec_data_start( char * rec_str ) {}
|
||||
*
|
||||
* void put_X_data_rec( Uint count, Ulong address, char * data_str ) {}
|
||||
*
|
||||
* Rec_vitals X_rec =
|
||||
* {
|
||||
* is_X_data_rec,
|
||||
* get_X_rec_address,
|
||||
* get_X_rec_data_count,
|
||||
* MAXIMUM DATA BYTES IN A RECORD,
|
||||
* get_X_rec_data_start,
|
||||
* put_X_data_rec
|
||||
* };
|
||||
*
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
* Put address of additional Rec_vitals structures
|
||||
* in this array, before the NULL entry.
|
||||
*/
|
||||
|
||||
Rec_vitals *formats[] =
|
||||
{
|
||||
&intel_hex,
|
||||
&motorola_s1_rec,
|
||||
&motorola_s2_rec,
|
||||
&motorola_s3_rec,
|
||||
( Rec_vitals * ) NULL
|
||||
};
|
||||
|
||||
|
||||
/**** main *****************************************************************
|
||||
*
|
||||
*
|
||||
* Expects: Nothing (no command-line parameters).
|
||||
*
|
||||
* Returns: Exit status (EXIT_SUCCESS or EXIT_FAILURE).
|
||||
*
|
||||
* Reads hex records on the standard input and attempts to
|
||||
* splice adjacent data fields together. Results appear on
|
||||
* the standard output.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
|
||||
char inbuff[ MAX_LINE_SIZE ], outbuff[ MAX_LINE_SIZE ];
|
||||
char *in_dptr, *out_dptr;
|
||||
int d_total, d_count, d_excess, n;
|
||||
int length;
|
||||
Ulong in_rec_addr, out_rec_addr = 0;
|
||||
Rec_vitals *rptr;
|
||||
|
||||
|
||||
/* Sift through file until first hex record is identified. */
|
||||
|
||||
rptr = identify_first_data_record( inbuff, MAX_LINE_SIZE );
|
||||
if ( rptr == NULL )
|
||||
{
|
||||
fputs( "No hex records found.\n", stderr );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
|
||||
/* Attempt data-record splicing until end-of-file is reached. */
|
||||
d_total = 0;
|
||||
for (;;) {
|
||||
if ( rptr->is_data_record( inbuff ) == YES )
|
||||
{ /* Input record is a data record. */
|
||||
d_count = rptr->get_data_count( inbuff );
|
||||
in_rec_addr = rptr->get_address( inbuff );
|
||||
in_dptr = rptr->get_data_start( inbuff );
|
||||
|
||||
if ( d_total == 0 || in_rec_addr != out_rec_addr + d_total )
|
||||
{ /* Begin a new output record. */
|
||||
if ( d_total != 0 )
|
||||
rptr->put_data_record( d_total, out_rec_addr, outbuff );
|
||||
out_dptr = outbuff;
|
||||
n = d_total = d_count;
|
||||
out_rec_addr = in_rec_addr;
|
||||
}
|
||||
else if
|
||||
( ( d_excess = d_total + d_count - rptr->max_data_count ) > 0 )
|
||||
{ /* Output a maximum-length record, then start a new record. */
|
||||
strncat( outbuff, in_dptr, 2 * ( d_count - d_excess ) );
|
||||
rptr->put_data_record(
|
||||
rptr->max_data_count, out_rec_addr, outbuff
|
||||
);
|
||||
in_dptr += 2 * ( d_count - d_excess );
|
||||
out_dptr = outbuff;
|
||||
n = d_total = d_excess;
|
||||
out_rec_addr += rptr->max_data_count;
|
||||
}
|
||||
else
|
||||
{ /* Append input record's data field with accumulated data. */
|
||||
out_dptr = outbuff + ( 2 * d_total );
|
||||
d_total += n = d_count;
|
||||
}
|
||||
strncpy( out_dptr, in_dptr, 2 * n );
|
||||
out_dptr[ 2 * n ] = EOS;
|
||||
}
|
||||
else
|
||||
{ /* Not a data record;
|
||||
* flush accumulated data then echo non-data record.
|
||||
*/
|
||||
if ( d_total != 0 )
|
||||
{
|
||||
rptr->put_data_record( d_total, out_rec_addr, outbuff );
|
||||
d_total = 0;
|
||||
}
|
||||
puts( inbuff );
|
||||
}
|
||||
|
||||
inbuff[ MAX_LINE_SIZE - 1 ] = '\0';
|
||||
if ( !fgets( inbuff, MAX_LINE_SIZE, stdin ) )
|
||||
break;
|
||||
if ( inbuff[ MAX_LINE_SIZE - 1 ] ) {
|
||||
fprintf( stderr, "Input line too long" );
|
||||
exit( 1 );
|
||||
}
|
||||
length = strlen(inbuff);
|
||||
inbuff[length - 1] = '\0';
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ( EXIT_SUCCESS );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**** identify_first_data_record *******************************************
|
||||
*
|
||||
* Expects: Pointer to hex-record line buffer.
|
||||
*
|
||||
* Returns: Pointer to hex-record structure (NULL if no match found).
|
||||
*
|
||||
* Reads the standard input, line by line, searching for a valid
|
||||
* record header character. If a valid header is found, a pointer
|
||||
* to the hex-record's type structure is returned, otherwise NULL.
|
||||
*
|
||||
* The input-stream pointer is left pointing to the first valid hex record.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
Rec_vitals * identify_first_data_record( char * buff_ptr, int max_length )
|
||||
{
|
||||
Rec_vitals ** ptr;
|
||||
int length;
|
||||
|
||||
|
||||
|
||||
for ( ;; ) {
|
||||
|
||||
buff_ptr[ max_length - 1 ] = '\0';
|
||||
if ( !fgets( buff_ptr, max_length, stdin ) )
|
||||
break;
|
||||
if ( buff_ptr[ max_length - 1 ] ) {
|
||||
fprintf( stderr, "Input line too long" );
|
||||
exit( 1 );
|
||||
}
|
||||
length = strlen(buff_ptr);
|
||||
buff_ptr[length - 1] = '\0';
|
||||
|
||||
for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ )
|
||||
if ( ( *ptr )->is_data_record( buff_ptr ) == YES )
|
||||
return( *ptr ); /* Successful return. */
|
||||
|
||||
puts( buff_ptr ); /* Echo non-hex-record line. */
|
||||
}
|
||||
|
||||
return( ( Rec_vitals * ) NULL ); /* Unsuccessful return. */
|
||||
}
|
||||
|
||||
|
||||
/**** get_ndigit_hex *******************************************************
|
||||
*
|
||||
* Expects: Pointer to first ASCII hexadecimal digit, number of digits.
|
||||
*
|
||||
* Returns: Value of hexadecimal string as an unsigned long.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
Ulong get_ndigit_hex( char * cptr, int digits )
|
||||
{
|
||||
Ulong value;
|
||||
|
||||
for ( value = 0 ; --digits >= 0 ; cptr++ )
|
||||
value = ( value * 16L ) + HEX_DIGIT( *cptr );
|
||||
|
||||
return( value );
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
timestamp
|
||||
@@ -1,738 +0,0 @@
|
||||
/*
|
||||
* unhex
|
||||
* convert a hex file to binary equivalent. If more than one file name
|
||||
* is given, then the output will be logically concatenated together.
|
||||
* stdin and stdout are defaults. Verbose will enable checksum output.
|
||||
*
|
||||
* Supported input formats are Intel hex, Motorola S records, and TI 'B'
|
||||
* records.
|
||||
*
|
||||
* Intel hex input format is
|
||||
* Byte
|
||||
* 1 Colon :
|
||||
* 2..3 Record length, eg: "20"
|
||||
* 4..7 load address nibbles
|
||||
* 8..9 record type: "00" (data) or "02" base addr
|
||||
* 10..x data bytes in ascii-hex
|
||||
* x+1..x+2 cksum (2's compl of (len+addr+data))
|
||||
* x+3 \n -- newline
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
char *USAGE = "\
|
||||
usage: unhex [-va] [ -o file ] [ file [file ... ] ]\n\
|
||||
-v -- verbose\n\
|
||||
-a base -- 1st byte of output corresponds to this address\n\
|
||||
-l -- linear, just writes data out\n\
|
||||
-o file -- output file; must not be input file\n\
|
||||
-F k_bits -- \"holes\" in input will be filled with 0xFF's\n\
|
||||
up to \"k_bits\" * 1024 bits\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef VMS
|
||||
#ifndef HAVE_STRERROR
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
|
||||
#define strerror( _err ) \
|
||||
((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
|
||||
|
||||
#else /* HAVE_STRERROR */
|
||||
char *strerror ();
|
||||
#endif
|
||||
#else /* VMS */
|
||||
char *strerror (int,...);
|
||||
#endif
|
||||
|
||||
|
||||
#define OK 0
|
||||
#define FAILURE (-1)
|
||||
#define Failed(x) ((x) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
typedef char bool;
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* Pick out designated bytes
|
||||
*/
|
||||
|
||||
#define B0(x) ((x) & 0xff)
|
||||
#define B1(x) B0((x) >> 8)
|
||||
#define B2(x) B0((x) >> 16)
|
||||
#define B3(x) B0((x) >> 24)
|
||||
|
||||
typedef struct buffer_rec {
|
||||
u32 dl_destaddr;
|
||||
u32 dl_jumpaddr;
|
||||
int dl_count;
|
||||
u8 dl_buf[512];
|
||||
} buffer_rec;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
bool verbose = FALSE; /* be verbose */
|
||||
bool linear = FALSE; /* just write out linear data */
|
||||
char *outfilename = "-"; /* default output is stdout */
|
||||
u32 base = 0L; /* base address */
|
||||
u32 FFfill = 0L; /* how far to fill w 0xFF's */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
void error(int errn, ...);
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* error is fatal; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* error is fatal; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#ifdef HAVE_STRTOUL
|
||||
#define stol(p) strtoul(p, (char **) NULL, 0)
|
||||
#else
|
||||
#define stol(p) strtol(p, (char **) NULL, 0)
|
||||
#endif
|
||||
|
||||
int unhex(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_Intel_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_S_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_TI_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
void write_record(buffer_rec *tb, FILE *fp);
|
||||
int getnibble(char **p);
|
||||
int getbyte(char **p);
|
||||
long getNbytes(char **p, int n);
|
||||
void badformat(char *s, char *fname, char *msg);
|
||||
|
||||
#define get1bytes(p) ((int) getbyte(p))
|
||||
#define get2bytes(p) ((int) getNbytes(p, 2))
|
||||
#define get3bytes(p) getNbytes(p, 3)
|
||||
#define get4bytes(p) getNbytes(p, 4)
|
||||
|
||||
char *BADADDR = "Invalid record address";
|
||||
char *BADLEN = "Invalid record length";
|
||||
char *BADBASE = "Bad base or starting address";
|
||||
char *BADFMT = "Unrecognized record type";
|
||||
char *BADDATA = "Invalid data byte";
|
||||
char *BADCSUM = "Invalid checksum";
|
||||
char *MISCSUM = "Checksum mismatch";
|
||||
char *BADTYPE = "Unrecognized record type";
|
||||
char *MISTYPE = "Incompatible record types";
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
register int c;
|
||||
bool showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
FILE *outfp, *infp;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
progname = argv[0];
|
||||
while ((c = getopt(argc, argv, "F:a:o:vl")) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'a': /* base address */
|
||||
base = stol(optarg);
|
||||
break;
|
||||
|
||||
case 'l': /* linear output */
|
||||
linear = TRUE;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case 'o': /* output file */
|
||||
outfilename = optarg;
|
||||
break;
|
||||
|
||||
case 'F': /* 0xFF fill amount (bytes) */
|
||||
FFfill = stol(optarg) * 1024L / 8L;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (linear && (base != 0))
|
||||
{
|
||||
error(0, "-l and -a may not be specified in combination");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (STREQ(outfilename, "-"))
|
||||
{
|
||||
outfp = stdout;
|
||||
outfilename = "stdout";
|
||||
}
|
||||
else
|
||||
if ((outfp = fopen(outfilename, "w")) == (FILE *) NULL)
|
||||
{
|
||||
error(-1, "couldn't open '%s' for output", outfilename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now process the input files (or stdin, if none specified)
|
||||
*/
|
||||
|
||||
if (argv[optind] == (char *) NULL) /* just stdin */
|
||||
exit(unhex(stdin, "stdin", outfp, outfilename));
|
||||
else
|
||||
for (; (optarg = argv[optind]); optind++)
|
||||
{
|
||||
if (STREQ(optarg, "-"))
|
||||
rc += unhex(stdin, "stdin", outfp, outfilename);
|
||||
else
|
||||
{
|
||||
if ((infp = fopen(optarg, "r")) == (FILE *) NULL)
|
||||
{
|
||||
error(-1, "couldn't open '%s' for input", optarg);
|
||||
exit(1);
|
||||
}
|
||||
rc += unhex(infp, optarg, outfp, outfilename);
|
||||
}
|
||||
}
|
||||
|
||||
return(rc);
|
||||
}
|
||||
|
||||
u16 filesum;
|
||||
|
||||
int
|
||||
unhex(FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
int c;
|
||||
|
||||
filesum = 0;
|
||||
|
||||
/*
|
||||
* Make sure holes will be filled with 0xFF's if requested. We
|
||||
* do this the easy way by just filling the file with FF's before
|
||||
* getting started. To do it more optimally would be quite a bit
|
||||
* more difficult since the user can skip around as much as he/she
|
||||
* likes in the input hex file addressing.
|
||||
*
|
||||
* We'll clean this up later (after this program has run) with
|
||||
* 'stripffs'
|
||||
*/
|
||||
|
||||
if (FFfill)
|
||||
{
|
||||
(void) fseek(ofp, 0, 0);
|
||||
for (c = FFfill; c > 0; c--)
|
||||
(void) fputc(0xFF, ofp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the first char from file and determine record types
|
||||
*/
|
||||
|
||||
if ((c = getc(ifp)) != EOF)
|
||||
{
|
||||
ungetc(c, ifp);
|
||||
switch(c)
|
||||
{
|
||||
case 'S':
|
||||
convert_S_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
case ':':
|
||||
convert_Intel_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
case '9':
|
||||
case 'B':
|
||||
convert_TI_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
char tmp[2];
|
||||
tmp[0] = c; tmp[1] = 0;
|
||||
badformat(tmp, inm, BADFMT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "'%s' checksum is 0x%04x\n", inm, filesum);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_Intel_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
u8 cksum;
|
||||
int incksum;
|
||||
int c;
|
||||
int rectype; /* record type */
|
||||
int len; /* data length of current line */
|
||||
u32 addr;
|
||||
u32 base_address = 0;
|
||||
bool endrecord = FALSE;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
p = &buff[0];
|
||||
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
if (*p != ':')
|
||||
badformat(p, inm, BADFMT);
|
||||
p++;
|
||||
|
||||
if ((len = getbyte(&p)) == -1) /* record len */
|
||||
badformat(buff, inm, BADLEN);
|
||||
|
||||
if ((addr = get2bytes(&p)) == -1L) /* record addr */
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
rectype = getbyte(&p);
|
||||
|
||||
cksum = len + B0(addr) + B1(addr) + rectype;
|
||||
|
||||
switch (rectype)
|
||||
{
|
||||
case 0x00: /* normal data record */
|
||||
tb.dl_destaddr = base_address + addr;
|
||||
while (len--)
|
||||
{
|
||||
if ((c = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADDATA);
|
||||
cksum += c;
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x01: /* execution start address */
|
||||
base_address = addr;
|
||||
endrecord = TRUE;
|
||||
break;
|
||||
|
||||
case 0x02: /* new base */
|
||||
if ((base_address = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADBASE);
|
||||
cksum += B0(base_address) + B1(base_address);
|
||||
base_address <<= 4;
|
||||
break;
|
||||
|
||||
case 0x03: /* seg/off execution start address */
|
||||
{
|
||||
u32 seg, off;
|
||||
|
||||
seg = get2bytes(&p);
|
||||
off = get2bytes(&p);
|
||||
if ((seg == -1L) || (off == -1L))
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
cksum += B0(seg) + B1(seg) + B0(off) + B1(off);
|
||||
|
||||
tb.dl_jumpaddr = (seg << 4) + off;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
error(0, "unknown Intel-hex record type: 0x%02x", rectype);
|
||||
badformat(buff, inm, BADTYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify checksums are correct in file.
|
||||
*/
|
||||
|
||||
cksum = (-cksum) & 0xff;
|
||||
if ((incksum = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADCSUM);
|
||||
if (((u8) incksum) != cksum)
|
||||
badformat(buff, inm, MISCSUM);
|
||||
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_S_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
u8 cksum;
|
||||
int incksum;
|
||||
int c;
|
||||
int len; /* data length of current line */
|
||||
int rectype; /* record type */
|
||||
u32 addr;
|
||||
bool endrecord = FALSE;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
p = &buff[0];
|
||||
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
if (*p != 'S')
|
||||
badformat(p, inm, BADFMT);
|
||||
p++;
|
||||
|
||||
if ((rectype = getnibble(&p)) == -1) /* record type */
|
||||
badformat(buff, inm, BADTYPE);
|
||||
|
||||
if ((len = getbyte(&p)) == -1) /* record len */
|
||||
badformat(buff, inm, BADLEN);
|
||||
cksum = len;
|
||||
|
||||
switch (rectype)
|
||||
{
|
||||
case 0x00: /* comment field, ignored */
|
||||
goto write_it;
|
||||
|
||||
case 0x01: /* data record, 16 bit addr */
|
||||
if ((addr = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 3;
|
||||
goto doit;
|
||||
|
||||
case 0x02: /* ... 24 bit addr */
|
||||
if ((addr = get3bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 4;
|
||||
goto doit;
|
||||
|
||||
case 0x03: /* ... 32 bit addr */
|
||||
if ((addr = get4bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 5;
|
||||
doit:
|
||||
cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
|
||||
|
||||
tb.dl_destaddr = addr;
|
||||
while (len--)
|
||||
{
|
||||
if ((c = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADDATA);
|
||||
cksum += c;
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x07: /* 32 bit end record */
|
||||
if ((addr = get4bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
goto end_rec;
|
||||
|
||||
case 0x08: /* 24 bit end record */
|
||||
if ((addr = get3bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
goto end_rec;
|
||||
|
||||
case 0x09: /* 16 bit end record */
|
||||
if ((addr = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
end_rec:
|
||||
cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
|
||||
tb.dl_jumpaddr = addr;
|
||||
break;
|
||||
|
||||
default:
|
||||
error(0, "unknown Motorola-S record type: 0x%02x", rectype);
|
||||
badformat(buff, inm, BADTYPE);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify checksums are correct in file.
|
||||
*/
|
||||
|
||||
cksum = (~cksum) & 0xff;
|
||||
if ((incksum = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADCSUM);
|
||||
if (((u8) incksum) != cksum)
|
||||
badformat(buff, inm, MISCSUM);
|
||||
|
||||
write_it:
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_TI_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
int c;
|
||||
bool endrecord = FALSE;
|
||||
bool eol;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
p = &buff[0];
|
||||
eol = FALSE;
|
||||
while ( ! eol && ! endrecord)
|
||||
{
|
||||
switch (*p++)
|
||||
{
|
||||
case '9':
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
tb.dl_destaddr = get2bytes(&p);
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
c = getbyte(&p);
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
c = getbyte(&p);
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
eol = TRUE;
|
||||
break;
|
||||
|
||||
case ':':
|
||||
endrecord = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
badformat(p, inm, BADFMT);
|
||||
}
|
||||
}
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
write_record(buffer_rec *tb,
|
||||
FILE *fp)
|
||||
{
|
||||
if ( ! linear)
|
||||
{
|
||||
if (tb->dl_destaddr < base)
|
||||
error(ERR_FATAL, "record at address 0x%x precedes base of 0x%x",
|
||||
tb->dl_destaddr, base);
|
||||
(void) fseek(fp, tb->dl_destaddr - base, 0);
|
||||
}
|
||||
|
||||
(void) fwrite(tb->dl_buf, tb->dl_count, 1, fp);
|
||||
tb->dl_destaddr += tb->dl_count;
|
||||
tb->dl_count = 0;
|
||||
}
|
||||
|
||||
int
|
||||
getnibble(char **p)
|
||||
{
|
||||
register int val;
|
||||
|
||||
**p = toupper(**p);
|
||||
switch (**p)
|
||||
{
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
val = **p - '0';
|
||||
break;
|
||||
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
val = 10 + (**p - 'A');
|
||||
break;
|
||||
|
||||
default:
|
||||
return(-1);
|
||||
}
|
||||
*p += 1;
|
||||
|
||||
return(val & 0x0f);
|
||||
}
|
||||
|
||||
int
|
||||
getbyte(char **p)
|
||||
{
|
||||
int n0, n1;
|
||||
|
||||
if ((n0 = getnibble(p)) == -1)
|
||||
return(-1);
|
||||
if ((n1 = getnibble(p)) == -1)
|
||||
return(-1);
|
||||
|
||||
return(((n0 << 4) + n1) & 0xff);
|
||||
}
|
||||
|
||||
long
|
||||
getNbytes(char **p,
|
||||
int n)
|
||||
{
|
||||
int t;
|
||||
u32 val = 0;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
if ((t = getbyte(p)) == -1)
|
||||
return(-1L);
|
||||
val <<= 8;
|
||||
val += t;
|
||||
}
|
||||
|
||||
return(val);
|
||||
}
|
||||
|
||||
void
|
||||
badformat(char *s,
|
||||
char *fname,
|
||||
char *msg)
|
||||
{
|
||||
if (s[strlen(s)-1] == '\n') /* get rid of newline */
|
||||
s[strlen(s)-1] = '\0';
|
||||
error(0, "line '%s'::\n\tfrom file '%s'; %s", s, fname, msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_EXIT bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
(void) fprintf(stderr, " (%s)\n", strerror(local_errno));
|
||||
else
|
||||
(void) fprintf(stderr, "\n");
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,31 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL = @ACLOCAL@ -I $(RTEMS_TOPdir)/aclocal
|
||||
|
||||
SUBDIRS = scripts src
|
||||
bin_PROGRAMS=cklength eolstrip packhex unhex
|
||||
|
||||
cklength_SOURCES = cklength.c
|
||||
eolstrip_SOURCES = eolstrip.c
|
||||
packhex_SOURCES = packhex.c
|
||||
unhex_SOURCES = unhex.c
|
||||
|
||||
bin_SCRIPTS=\
|
||||
install-if-change \
|
||||
lock-directory \
|
||||
unlock-directory \
|
||||
rcs-clean
|
||||
|
||||
noinst_SCRIPTS = search-id.sh
|
||||
|
||||
#
|
||||
# HACK: Install to build directory
|
||||
#
|
||||
install-exec-local: $(bin_PROGRAMS) $(bin_SCRIPTS)
|
||||
if test -n "${RTEMS_BSP}"; then \
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
$(INSTALL_SCRIPT) $(bin_SCRIPTS) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
$(INSTALL_PROGRAM) $(bin_PROGRAMS) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
fi
|
||||
|
||||
preinstall: install-exec-local
|
||||
|
||||
include $(top_srcdir)/../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../automake/local.am
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
@@ -76,21 +75,71 @@ VERSION = @VERSION@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
ACLOCAL = @ACLOCAL@ -I $(RTEMS_TOPdir)/aclocal
|
||||
|
||||
SUBDIRS = scripts src
|
||||
bin_PROGRAMS = cklength eolstrip packhex unhex
|
||||
|
||||
cklength_SOURCES = cklength.c
|
||||
eolstrip_SOURCES = eolstrip.c
|
||||
packhex_SOURCES = packhex.c
|
||||
unhex_SOURCES = unhex.c
|
||||
|
||||
bin_SCRIPTS = install-if-change lock-directory unlock-directory rcs-clean
|
||||
|
||||
|
||||
noinst_SCRIPTS = search-id.sh
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
|
||||
CONFIG_HEADER = ./src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = install-if-change lock-directory rcs-clean \
|
||||
unlock-directory
|
||||
bin_PROGRAMS = cklength$(EXEEXT) eolstrip$(EXEEXT) packhex$(EXEEXT) \
|
||||
unhex$(EXEEXT)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I.
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
cklength_OBJECTS = cklength.o
|
||||
cklength_LDADD = $(LDADD)
|
||||
cklength_DEPENDENCIES =
|
||||
cklength_LDFLAGS =
|
||||
eolstrip_OBJECTS = eolstrip.o
|
||||
eolstrip_LDADD = $(LDADD)
|
||||
eolstrip_DEPENDENCIES =
|
||||
eolstrip_LDFLAGS =
|
||||
packhex_OBJECTS = packhex.o
|
||||
packhex_LDADD = $(LDADD)
|
||||
packhex_DEPENDENCIES =
|
||||
packhex_LDFLAGS =
|
||||
unhex_OBJECTS = unhex.o
|
||||
unhex_LDADD = $(LDADD)
|
||||
unhex_DEPENDENCIES =
|
||||
unhex_LDFLAGS =
|
||||
SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS)
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = README ./stamp-h.in Makefile.am Makefile.in aclocal.m4 \
|
||||
config.h.in configure configure.in install-if-change.in \
|
||||
lock-directory.in rcs-clean.in unlock-directory.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/cklength.P .deps/eolstrip.P .deps/packhex.P \
|
||||
.deps/unhex.P
|
||||
SOURCES = $(cklength_SOURCES) $(eolstrip_SOURCES) $(packhex_SOURCES) $(unhex_SOURCES)
|
||||
OBJECTS = $(cklength_OBJECTS) $(eolstrip_OBJECTS) $(packhex_OBJECTS) $(unhex_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/../../automake/subdirs.am $(top_srcdir)/../../automake/local.am
|
||||
.SUFFIXES: .S .c .o .s
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/../../automake/local.am
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
@@ -105,59 +154,116 @@ config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
config.h: stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h; \
|
||||
$(MAKE) stamp-h; \
|
||||
else :; fi
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h 2> /dev/null
|
||||
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
|
||||
|
||||
@SET_MAKE@
|
||||
mostlyclean-hdr:
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
clean-hdr:
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
test "$$subdir" = "." && dot_seen=yes; \
|
||||
done; \
|
||||
test "$$dot_seen" = "no" && rev=". $$rev"; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
install-if-change: $(top_builddir)/config.status install-if-change.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
lock-directory: $(top_builddir)/config.status lock-directory.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
rcs-clean: $(top_builddir)/config.status rcs-clean.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
unlock-directory: $(top_builddir)/config.status unlock-directory.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
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
|
||||
|
||||
.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:
|
||||
|
||||
cklength$(EXEEXT): $(cklength_OBJECTS) $(cklength_DEPENDENCIES)
|
||||
@rm -f cklength$(EXEEXT)
|
||||
$(LINK) $(cklength_LDFLAGS) $(cklength_OBJECTS) $(cklength_LDADD) $(LIBS)
|
||||
|
||||
eolstrip$(EXEEXT): $(eolstrip_OBJECTS) $(eolstrip_DEPENDENCIES)
|
||||
@rm -f eolstrip$(EXEEXT)
|
||||
$(LINK) $(eolstrip_LDFLAGS) $(eolstrip_OBJECTS) $(eolstrip_LDADD) $(LIBS)
|
||||
|
||||
packhex$(EXEEXT): $(packhex_OBJECTS) $(packhex_DEPENDENCIES)
|
||||
@rm -f packhex$(EXEEXT)
|
||||
$(LINK) $(packhex_LDFLAGS) $(packhex_OBJECTS) $(packhex_LDADD) $(LIBS)
|
||||
|
||||
unhex$(EXEEXT): $(unhex_OBJECTS) $(unhex_DEPENDENCIES)
|
||||
@rm -f unhex$(EXEEXT)
|
||||
$(LINK) $(unhex_LDFLAGS) $(unhex_OBJECTS) $(unhex_LDADD) $(LIBS)
|
||||
|
||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else :; fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-binSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
@@ -170,20 +276,15 @@ ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
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:
|
||||
|
||||
@@ -247,41 +348,67 @@ distdir: $(DISTFILES)
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-recursive
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-recursive
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-recursive
|
||||
install-exec-am:
|
||||
install-exec: install-exec-recursive
|
||||
installcheck: installcheck-am
|
||||
all-recursive-am: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
install-exec-am: install-binPROGRAMS install-binSCRIPTS \
|
||||
install-exec-local
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-recursive
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-recursive
|
||||
uninstall-am:
|
||||
uninstall: uninstall-recursive
|
||||
all-am: Makefile
|
||||
all-redirect: all-recursive
|
||||
install: install-am
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(PROGRAMS) $(SCRIPTS) config.h
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(bindir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
@@ -293,78 +420,60 @@ distclean-generic:
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-tags mostlyclean-generic
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
|
||||
mostlyclean-compile mostlyclean-tags mostlyclean-depend \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-tags clean-generic mostlyclean-am
|
||||
clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-recursive
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-tags distclean-generic clean-am
|
||||
distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
|
||||
distclean-tags distclean-depend distclean-generic \
|
||||
clean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
distclean: distclean-am
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-tags \
|
||||
maintainer-clean-depend 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-recursive
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: install-data-recursive uninstall-data-recursive \
|
||||
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
|
||||
uninstalldirs-recursive all-recursive check-recursive \
|
||||
installcheck-recursive info-recursive dvi-recursive \
|
||||
mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs-am \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile uninstall-binSCRIPTS install-binSCRIPTS tags \
|
||||
mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
|
||||
distdir mostlyclean-depend distclean-depend clean-depend \
|
||||
maintainer-clean-depend info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck all-recursive-am install-exec-local \
|
||||
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
|
||||
|
||||
|
||||
preinstall-recursive \
|
||||
debug-recursive debug_install-recursive \
|
||||
profile-recursive profile_install-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
#
|
||||
# HACK: Install to build directory
|
||||
#
|
||||
install-exec-local: $(bin_PROGRAMS) $(bin_SCRIPTS)
|
||||
if test -n "${RTEMS_BSP}"; then \
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
$(INSTALL_SCRIPT) $(bin_SCRIPTS) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
$(INSTALL_PROGRAM) $(bin_PROGRAMS) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools; \
|
||||
fi
|
||||
|
||||
debug: debug-recursive
|
||||
|
||||
debug_install: debug_install-recursive
|
||||
|
||||
profile: profile-recursive
|
||||
|
||||
profile_install: profile_install-recursive
|
||||
|
||||
preinstall: preinstall-recursive
|
||||
|
||||
.PHONY: \
|
||||
debug debug-recursive \
|
||||
debug_install \
|
||||
profile profile-recursive \
|
||||
profile_install \
|
||||
preinstall preinstall-recursive
|
||||
preinstall: install-exec-local
|
||||
|
||||
debug-am:
|
||||
|
||||
|
||||
28
tools/build/configure
vendored
28
tools/build/configure
vendored
@@ -453,7 +453,7 @@ 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=scripts
|
||||
ac_unique_file=README
|
||||
|
||||
# Find the source files, if location was not specified.
|
||||
if test -z "$srcdir"; then
|
||||
@@ -1357,13 +1357,11 @@ ac_given_srcdir=$srcdir
|
||||
ac_given_INSTALL="$INSTALL"
|
||||
|
||||
trap 'rm -fr `echo "Makefile
|
||||
src/Makefile
|
||||
scripts/Makefile
|
||||
scripts/install-if-change
|
||||
scripts/lock-directory
|
||||
scripts/rcs-clean
|
||||
scripts/unlock-directory
|
||||
src/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
install-if-change
|
||||
lock-directory
|
||||
rcs-clean
|
||||
unlock-directory
|
||||
config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
@@ -1459,12 +1457,10 @@ EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
CONFIG_FILES=\${CONFIG_FILES-"Makefile
|
||||
src/Makefile
|
||||
scripts/Makefile
|
||||
scripts/install-if-change
|
||||
scripts/lock-directory
|
||||
scripts/rcs-clean
|
||||
scripts/unlock-directory
|
||||
install-if-change
|
||||
lock-directory
|
||||
rcs-clean
|
||||
unlock-directory
|
||||
"}
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
@@ -1546,7 +1542,7 @@ ac_eD='%g'
|
||||
if test "${CONFIG_HEADERS+set}" != set; then
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
CONFIG_HEADERS="src/config.h"
|
||||
CONFIG_HEADERS="config.h"
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
fi
|
||||
@@ -1637,7 +1633,7 @@ cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
test -z "$CONFIG_HEADERS" || echo timestamp > src/stamp-h
|
||||
test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
AC_PREREQ(2.13)
|
||||
AC_INIT(scripts)
|
||||
AC_INIT(README)
|
||||
AC_CONFIG_AUX_DIR(../..)
|
||||
RTEMS_TOP(../..)
|
||||
|
||||
@@ -17,14 +17,12 @@ AC_CHECK_FUNCS(strerror)
|
||||
|
||||
RTEMS_PATH_KSH
|
||||
|
||||
AM_CONFIG_HEADER(src/config.h)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
src/Makefile
|
||||
scripts/Makefile
|
||||
scripts/install-if-change
|
||||
scripts/lock-directory
|
||||
scripts/rcs-clean
|
||||
scripts/unlock-directory
|
||||
install-if-change
|
||||
lock-directory
|
||||
rcs-clean
|
||||
unlock-directory
|
||||
)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
# FIXME: Is this subdirectory still in use ?
|
||||
## SUBDIRS = msdos
|
||||
include $(top_srcdir)/../../automake/local.am
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = ../../..
|
||||
subdir = c/build-tools/os
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
RTEMS_ROOT = $(top_srcdir)/@RTEMS_TOPdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/directory.cfg
|
||||
|
||||
SUB_DIRS=$(wildcard $(RTEMS_HOST))
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
@@ -1,7 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
# FIXME: Is this subdirectory still in use?
|
||||
include $(top_srcdir)/../../automake/local.am
|
||||
@@ -1,49 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = ../../../..
|
||||
subdir = c/build-tools/os/msdos
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
RTEMS_ROOT = $(top_srcdir)/@RTEMS_TOPdir@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||
include $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
DESTDIR=$(PROJECT_RELEASE)/build-tools
|
||||
|
||||
INSTALLED=$(DESTDIR)/ifc.exe \
|
||||
$(DESTDIR)/cklength.exe \
|
||||
$(DESTDIR)/fixtimer.exe
|
||||
|
||||
all: $(DESTDIR) $(PGMS) install
|
||||
|
||||
$(DESTDIR):
|
||||
@top_srcdir@/mkinstalldirs $@
|
||||
|
||||
install: $(INSTALLED)
|
||||
|
||||
# Install the programs
|
||||
$(DESTDIR)/ifc.exe: ifc_exe.uue
|
||||
uudecode <ifc_exe.uue
|
||||
mv ifc.exe $(DESTDIR)/ifc.exe
|
||||
|
||||
$(DESTDIR)/cklength.exe: cklength.uue
|
||||
uudecode <cklength.uue
|
||||
mv cklength.exe $(DESTDIR)/cklength.exe
|
||||
|
||||
$(DESTDIR)/fixtimer.exe: fixtimer.uue
|
||||
uudecode <fixtimer.uue
|
||||
mv fixtimer.exe $(DESTDIR)/fixtimer.exe
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
@@ -1,12 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
ifc is an MS-DOS executable which is equivalent to the program
|
||||
install-if-change. It was compiled using Borland C 2.00.
|
||||
|
||||
cklength is a precompiled version of the program cklength.c from
|
||||
the main source tree.
|
||||
|
||||
fixtimer is a program to restore the clock if the program does not
|
||||
exit cleanly.
|
||||
@@ -1,286 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
begin 664 cklength
|
||||
M?T5,1@$" 0 " ( ! $,% #0 "T8 T "
|
||||
M!0 H !H %P 8 T $ - "@ H 4 P
|
||||
M -0 !$ ! ! ! 7
|
||||
M2P %TL % $ $ !=, (73 &\ %? < 0
|
||||
M @ %U A=0 (@ !P O=7-R+VQI8B]L9"YS
|
||||
M;RXQ $, !6 20 #P
|
||||
M #@ $4 /0 !P !# &@
|
||||
M A 30 #\ *0 $X !" D
|
||||
M $@ W $8 )@ "
|
||||
M ! %( 4P Z *@ 00
|
||||
M $H 'P $L !5 3P L .P %0 H
|
||||
M-@ #$ P 40
|
||||
M
|
||||
M
|
||||
M G
|
||||
M '0 C ; N
|
||||
M "( -0 E #D R - !X
|
||||
M "T ,P !$ *P
|
||||
M ^ "\ 3 % !'
|
||||
M 0#4 , $ $ Z # "
|
||||
M ! U0 P P 0BT , 0 $*W #
|
||||
M % !"S P !@ 0P4 , < $32
|
||||
M # ( !$^ P "0 1/L , H $3
|
||||
M] # + !% P # A=, , T
|
||||
M (74 # . "%]@ P #P ACP , !
|
||||
M (9" # 1 P $@ ,
|
||||
M !, # 4 P %0
|
||||
M , !8 # 7 P &
|
||||
M , !D ! (8. 2 " !$_0 $0 "P !8
|
||||
M 0P4 =!( < = (8U 2 (@ "&$0 $@
|
||||
M "< 1/L !$ H U (8O 2 / "&0@ $$0
|
||||
M$0 $4 AB8 !( !. (9# 01 1 5P "',@
|
||||
M$0#_\0 %P 1+ 2!( < !B $2> $@2 ' 9P !$8@
|
||||
M "H$@ !P &\ AD8 !0"$ !$ !T (73 1 /_Q B@ "
|
||||
M&*0 $@ ) A@( !( "7 (8% 2
|
||||
MG !$T@ $@ " *( ACT !!$ ! "J (9$ 01 1
|
||||
M M "&E@ )@$0 $0 , AB !( #' (8\ 01
|
||||
M 0 S0 "%U $0#_\0 -8 0[H !0!( < #> (9&
|
||||
M 4 1 1 Y "&E@ )@$0 $0 /$ AC@ !( #W (8
|
||||
M+ 2 _P "&" $@ 04 AD, !"$ !$ $-
|
||||
M (<N 01 1 !$P "&+ $@ 1H 1 H !8!( <
|
||||
M $@ (8_ 01 0 !,P "'+P $$0 $0 3H AC( !(
|
||||
M $_ (<P 01 1 !1@ "&&@ $@ 4P AS$
|
||||
M!!$ !$ %3 (8^ 01 0 !9P "&0@ $0#_\0 6X A?8
|
||||
M !$ __$ &( (87 2 !C@ "&1 $$0 $0 9<
|
||||
M 1,( /!( < &I $3\ 1 * !M@ !%TL $0#_\0
|
||||
M ;T 10 !!$ P '* $2, $@2 ' !SP "&(P $@
|
||||
M =8 0R( !( < 'H $3^ 1 + !]0 !#10 '4
|
||||
M$@ !P ?H AD !!$ ! (& (8= 2 "#0 !$^
|
||||
M $@ "0 A, AA0 !( 9V5T;W!T %]?1%1/4E],25-47U\
|
||||
M7W-T87)T ')E860 871O:0!?7T-43U)?3$E35%]? '-T<G1O; !P<F]G;F%M
|
||||
M90!V9G!R:6YT9@!?96YV:7)O;@!?96YD %=R:71E %)E860 9V5T<&%R;0!?
|
||||
M:6]B %]'3$]"04Q?3T9&4T547U1!0DQ%7P!A8F]R= !A=&5X:70 97AI= !?
|
||||
M:6YI= !V97)B;W-E %]S>7-?;F5R<@!S>7-?97)R;&ES= !F8VQO<V4 55-!
|
||||
M1T4 7T193D%-24, <')O8V5S<P!?7VEO8@!?<WES7V5R<FQI<W0 =W)I=&4
|
||||
M<W1R<F-H<@!?97AI= !E;G9I<F]N &5R<FYO '-T<F-H<@!E<G)O<@!R97!O
|
||||
M<G1?;&EN95]L96YG=&@ ;W!T:6YD &]P96X ;W!T87)G &9G971S &]P=&5R
|
||||
M<@!R97!O<G1?;&EN95]N=6UB97)S %]E9&%T80!?4%)/0T5$55)%7TQ)3DM!
|
||||
M1T5?5$%"3$5? &9O<&5N '-Y<U]N97)R %]?9&]?9VQO8F%L7V1T;W)S %]?
|
||||
M0U1/4E]%3D1?7P!?971E>'0 7VQI8E]V97)S:6]N $]P96X 9F9L=7-H %]?
|
||||
M9&]?9VQO8F%L7V-T;W)S %]?1%1/4E]%3D1?7P!M86EN &QI;F5?;&5N9W1H
|
||||
M '-T<FQE;@!?9FEN:0!F<')I;G1F &QI8F,N<V\N,0 AD, C$P
|
||||
M AS$ !#$P AS !!$P AR\ _$P AD8 U
|
||||
M$P " AD0 !($P AI8 P$P A@( K%0 A@4
|
||||
M L%0 A@@ Y%0 A@L X%0 A@X :%0
|
||||
M AA$ >%0 AA0 !5%0 AA< !'%0 AAH !"%0
|
||||
M AAT !3%0 AB Q%0 AB, !.%0 AB8 B
|
||||
M%0 ABD J%0 ABP \%0 AB\ @%0 AC(
|
||||
M ! %0 AC4 =%0 AC@ W%0 "\$" X .@0*(#H$2<
|
||||
M(Z @@) 0* 20$ !0 !"]@$ 1 !$D!(CX$ 0O(! 0 !P $
|
||||
M "0$ 0DA $94L( *4 J $E 1 "A< (:6$N$,U"+ $ "D! 0 !"
|
||||
MYP$ ! $+H 0 ('#X @! $0 1-0"(^R HK__$H #9(2(^S0 F $
|
||||
M@*(@ * F4$" E@)@!)(0( "2 F $T ) "X"B( 2O__]E *@ 9*2@ "
|
||||
M@ ,$0 1!$ $2B$B/LH2I@ M $ !&?P@ 0 *"$/_PRO__]T 0 $1$
|
||||
M $1 $+!D!(C"(''X B!Z G>._F*@0 !BB$" L! @ - &0 ! $+!DA @
|
||||
M+Q, (: HB $H !- B80@0@ $T 9 - "80B0 B !T")A"!$ (;0 B$(
|
||||
MT"9 !$ (? (B#$(0 AB< (8E "&%0 19 0 !22$ 90 !"KI02H:"
|
||||
MHC__ H ,X"B(&PB@ 1$0 AQ2 F HB!N@*(@/P* "J HB!. H '- $
|
||||
M(/@0O__P%0 10* !. HB!V H 'M $H/00O__J%0 14 0IO0 B# E!
|
||||
M"!$ (: HJ( "+__XM0B(0 3 !%$0@ $ (N2$F&H$+__W14 $70!"#X
|
||||
M@* ")!@/_\0O__7T"0@^("@ B08#__T"0@^- $X/R H (D& __Q"__\_0
|
||||
M).#\@* ")!@/_\0O__+T"2@]!"__\FB$" !@*1@ "* L1 "'%0 AA$
|
||||
M (:0$B$X$P 19(28<A $)VU *@\$ 0F60$" !DA "- "(+R1*B "T 9
|
||||
M"("B( "@ 1(0 A] "8+R1*B "0 #] &0 B HC__(H K 0/__0!""\
|
||||
MD (@ = D(+R1*B "T 9 "("B( 2O__SDA $(''X B!Z G>.]F) 0 !@3
|
||||
M !%0 !"6I(28="JD@ $H !Z80( 1& $P 19(28=A !%E! &* 0
|
||||
M( &H![WX)0 ABT (:0$ 4DA B $ 0DV4$ 5@*(@ * #4! 0 !"
|
||||
M2Y 0 !2B C__$0 AM "(0" I$ (!( *X"DX 2@ +$0 AA, $60%*$X
|
||||
MDA)A^$ 0C64$ 8T 6@^("B( "@ B$0 AM "(/2 HB H !Q, $60
|
||||
M%*$XDA)B )00 !! $(HE@>]^- %H/B HB H $A$ (;0 B#\@*(@ *
|
||||
M D3 !%D!2A.)(28AB4$ 00 !"&Y80 !$0@ (I@3@ 1, $60%*$XDA)B
|
||||
M($ 0A24$ 0I@3@ 1"__\B@!" !0 !"&Y 0 !6P$" @<?@"('H "=X[^0
|
||||
M\B>@2/0GH$SV)Z!0^">@5/HGH%@1 "&0 !"$I 2(2@1' LBX "!$0 "
|
||||
MC@ ( H !*('H$P1 "'\@(@N. 'H$@5 "&-0 AI 6H3@3 !%DA)B*$
|
||||
M0?/4 J$(D!:A.)(0 !! $(!E! $8"F8 "@ :$0 A@2 !*0$B$X$0
|
||||
MAM "(1" ID (-H #!$ (85 "&E!*B6)<N8 *0%J$X$P 19(28C! $'=
|
||||
MU + "A" X1 "&D!(A.!, $62$F(X0 !!UI00 !D0@ '$0 AI 2(3@3
|
||||
M !%0 !!T)(28E 1 "&0 !!W) 2(3@1# @(X " * !41" @(X " *
|
||||
M R IF H !1$ $41 !%$( Y(2(EB2$B)P?___M) 0( ! $&MD!
|
||||
M&9 0( 3 !%?___KI(28GA $'+ 0 (''X B!Z G>._F* 0 !@1 !%
|
||||
MD!(BD$ 0<;23 @*(@ !* F0$ 0$0@ !, $62$F*@?___G)00 ! 0
|
||||
M@ :L! &9(0( ! $&\E! @ + 0 B I@ 9!H !("F !H$@ 1 0 ("F
|
||||
M0!H2@ ($0@ !, $62$F*XE! $'___XF6$ :,( !Q, $62$F+0E!
|
||||
M&Y80 !E___^"F! &H''X B!Z G>._F* 0 !B0$ 0DA &4 0:*4$ :
|
||||
ML! "("F/_\2@ ($1@ !, $62$F+PE! $)80 !E___]PF! &H''X B!
|
||||
MZ G>._F* 0 !B0$ 0DA &4 09.4$ :L! "("F/_\2@ ($1@ !,
|
||||
M $62$F,0E! $)80 !E___]>F! &H''X B!Z G>._F* 0 !B0$ 0DA
|
||||
M&4 0824$ :L! "("F/_\2@ ($1@ !, $62$F,PE! $)80 !E___],
|
||||
MF! &H''X B!Z G>._F!$ $32 B/X@*)@ * F@$B/XT 0 )_" "@
|
||||
M!" $T 0 ("B( 2O__[ 0 (''X B!Z G>._F)WCOZ"!Z G>._F!$
|
||||
M $34 B/L@**__Q* V2$B/LT )@!("B( "@ )E! @ )8"8 22$" D@)@
|
||||
M!- "0 N HB $K___90"H &2DH H #!$ $01 !$HA(C[*$J8 +0! 1
|
||||
MG\( $ "@A#_\,K___= $ !$1 !$0 !!$) 2(PB!Q^ (@>@ (''X B!
|
||||
MZ G>._H(''X B!Z _____P #_____ ! '5S
|
||||
M86=E.B @8VML96YG=&@@(%L@+78@72!;(&%R9R N+BX@72!F:6QE<RXN+B *
|
||||
M(" @(" @(" @(" @+6P@;&5N9W1H(" @+2T@;6%X:6UU;2!L:6YE(&QE;F=T
|
||||
M: H@(" @(" @(" @(" M;B @(" @(" @(" M+2!R97!O<G0@;&EN92!N=6UB
|
||||
M97)S(&9O<B!O9F9E;F1I;F<@;&EN97,*(" @(" @(" @(" @+4X@(" @(" @
|
||||
M(" @+2T@<F5P;W)T(&QI;F4@;G5M8F5R<R!A;F0@;&5N9W1H(&9O<B!O9F9E
|
||||
M;F1I;F<@;&EN97,*(" @(" @(" @(" @+78@(" @(" @(" @+2T@=F5R8F]S
|
||||
M90H*4')I;G0@=&AE(&YA;64@;V8@9FEL97,@=VAI8V@@:&%V92!A="!L96%S
|
||||
M=" Q(&QI;F4@=VAI8V@@97AC965D<R!T:&4*;6%X:6UU;2!L:6YE(&QE;F=T
|
||||
M:"X@(%1H92!D969A=6QT(&UA>&EM=6T@;&EN92!L96YG=&@@:7,@.# N"@
|
||||
M &PZ;DYV *"5D*2!I<R!I;&QE9V%L(&QI;F4@;&5N9W1H"@ E<P
|
||||
M '( 56YA8FQE('1O(&]P96X@9FEL92 H)7,I"@ E
|
||||
M<PH %1/3R!,3TY'.B5D.B E<PH "5D.B E9 H )60*
|
||||
M E<SH@ " H)7,I"@ ("AU;FMN;W=N(&5R<FYO/25D*0H "@
|
||||
M !F871A;"!E<G)O<BP@97AI=&EN9P !E>&ET:6YG &9A=&%L(&5R
|
||||
M<F]R+"!A8F]R=&EN9P # Q,C,T-38W.#DM G)7,G(&ES(&YO="!A
|
||||
M(&YU;6)E<@ E<R!C86X@;VYL>2!B92 E;&0 E<R!M=7-T(&)E
|
||||
M(&)E='=E96X@)6QD(&%N9" E;&0 &]P96XH)R5S)RP@,'@E>"P@,"5O*2!F
|
||||
M86EL960 <F5A9"@E9"P@,'@E>"P@)60I(&9A:6QE9 !W<FET
|
||||
M92@E9"P@,'@E>"P@)60I(&9A:6QE9 (74 $ (; # !$T@
|
||||
M - $3X 0 0#H !0 !"+0 * ")0 8 0-4 "P
|
||||
M ! 5 , A?8 @ .0 4 !P !< 0LP
|
||||
M!P !"MP ( !. D ,
|
||||
M # P,+__\P$ #
|
||||
M \,+__\ $ # !(,+__[0$ # !4,+__Z@$ # !@,+__YP$
|
||||
M # !L,+__Y $ # !X,+__X0$ # "$,+__W@$ # "0,+__
|
||||
MVP$ # "<,+__V $ # "H,+__U0$ # "T,+__T@$ # #
|
||||
M,+__SP$ # #,,+__S $ # #8,+__R0$ # #D,+__Q@$ #
|
||||
M #P,+__PP$ # #\,+__P $ # $(,+__O0$ ! $4"
|
||||
M % $
|
||||
M 0 __$ $ U # ! ! .@ P @ 0-4
|
||||
M , , $(M # $ !"MP P !0
|
||||
M 0LP , 8 $,% # ' !$T@ P "
|
||||
M 1/@ , D $3[ # * !$_0 P
|
||||
M"P 10 , P (73 # - "%U
|
||||
M P #@ A?8 , \ (8\ # 0 "&0@
|
||||
M P $0 , !( # 3
|
||||
M P % , !4 # 6
|
||||
M P %P , !@ # 9
|
||||
M #P ! #_\0 !8 0 __$ B $
|
||||
M /_Q +0 !$U @ " $, 0R( < !2 (8\
|
||||
M ! 0 8 ! #_\0 &L 0T4 < !Z
|
||||
M $ /_Q A ! #_\0 (\ 1-$ ( < "E
|
||||
M $31 ' M "&00 0 $ ,( 0 __$
|
||||
M #) (8. 2 T !$_0 $0 "P -X 0P4 =!(
|
||||
M < #E (8U 2 Z@ "&$0 $@ .\ 1/L
|
||||
M !$ H #] (8O 2 !! "&0@ $$0 $0 0T AB8
|
||||
M !( $6 (9# 01 1 !'P "',@ $0#_\0 20
|
||||
M 1+ 2!( < $J $2> $@2 ' !+P !$8@ "H$@ !P
|
||||
M 3< AD8 !0"$ !$ $\ (73 1 /_Q !4@ "&*0 $@
|
||||
M 5@ A@( !( %? (8% 2 !9 !$T@
|
||||
M$@ " 6H ACT !!$ ! %R (9$ 01 1 !? "&E@
|
||||
M )@$0 $0 8@ AB !( &/ (8\ 01 0 !E0 "
|
||||
M%U $0#_\0 9X 0[H !0!( < &F (9& 4 1 1 !
|
||||
MK "&E@ )@$0 $0 ;D AC@ !( &_ (8+ 2
|
||||
M !QP "&" $@ <T AD, !"$ !$ '5 (<N 01
|
||||
M 1 !VP "&+ $@ >( 1 H !8!( < 'H (8_
|
||||
M 01 0 !^P "'+P $$0 $0 @( AC( !( (' (<
|
||||
MP 01 1 "#@ "&&@ $@ A0 AS$ !!$ !$ (;
|
||||
M (8^ 01 0 "+P "&0@ $0#_\0 C8 A?8 !$ __$
|
||||
M )0 (87 2 "5@ "&1 $$0 $0 E\ 1,( /!(
|
||||
M < )Q $3\ 1 * "?@ !%TL $0#_\0 H4 10
|
||||
M!!$ P *2 $2, $@2 ' "EP "&(P $@ IX 0R(
|
||||
M !( < *P $3^ 1 + "O0 !#10 '4$@ !P L(
|
||||
M AD !!$ ! +. (8= 2 "U0 !$^ $@ "0
|
||||
M ML AA0 !( 9V\S,B]C:VQE;F=T: !C<G1I+G, =F%L=65S+5AA
|
||||
M+F, 8W)T<W1U9F8N8P!?7V1O7V=L;V)A;%]C=&]R<U]A=7@ 9V-C,E]C;VUP
|
||||
M:6QE9"X 9F]R8V5?=&]?9&%T80!C:VQE;F=T:"YC &=C8S)?8V]M<&EL960N
|
||||
M &QI8F=C8S(N8P!C<G1S='5F9BYC %]?9&]?9VQO8F%L7V-T;W)S7V%U> !G
|
||||
M8V,R7V-O;7!I;&5D+@!F;W)C95]T;U]D871A &-R=&XN<P!G971O<'0 7U]$
|
||||
M5$]27TQ)4U1?7P!?<W1A<G0 <F5A9 !A=&]I %]?0U1/4E],25-47U\ <W1R
|
||||
M=&]L '!R;V=N86UE '9F<')I;G1F %]E;G9I<F]N %]E;F0 5W)I=&4 4F5A
|
||||
M9 !G971P87)M %]I;V( 7T=,3T)!3%]/1D93151?5$%"3$5? &%B;W)T &%T
|
||||
M97AI= !E>&ET %]I;FET '9E<F)O<V4 7W-Y<U]N97)R '-Y<U]E<G)L:7-T
|
||||
M &9C;&]S90!54T%'10!?1%E.04U)0P!P<F]C97-S %]?:6]B %]S>7-?97)R
|
||||
M;&ES= !W<FET90!S=')R8VAR %]E>&ET &5N=FER;VX 97)R;F\ <W1R8VAR
|
||||
M &5R<F]R ')E<&]R=%]L:6YE7VQE;F=T: !O<'1I;F0 ;W!E;@!O<'1A<F<
|
||||
M9F=E=', ;W!T97)R ')E<&]R=%]L:6YE7VYU;6)E<G, 7V5D871A %]04D]#
|
||||
M14154D5?3$E.2T%'15]404),15\ 9F]P96X <WES7VYE<G( 7U]D;U]G;&]B
|
||||
M86Q?9'1O<G, 7U]#5$]27T5.1%]? %]E=&5X= !?;&EB7W9E<G-I;VX 3W!E
|
||||
M;@!F9FQU<V@ 7U]D;U]G;&]B86Q?8W1O<G, 7U]$5$]27T5.1%]? &UA:6X
|
||||
M;&EN95]L96YG=&@ <W1R;&5N %]F:6YI &9P<FEN=&8 $ %
|
||||
MFP UD "]D # %$X ((X
|
||||
M $8\ ! *",I4W5N3U,@-2XS($=E;F5R:6,@4V5P=&5M
|
||||
M8F5R(#$Y.3, &%S.B!30S,N,"!E87)L>2!A8V-E<W,@,#$@4V5P(#$Y.3,*
|
||||
M $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N,"!E87)L>2!A8V-E<W,@,#$@
|
||||
M4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N,"!E87)L>2!A
|
||||
M8V-E<W,@,#$@4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C, &%S.B!30S,N
|
||||
M,"!E87)L>2!A8V-E<W,@,#$@4V5P(#$Y.3,* $=#0SH@*$=.52D@,BXV+C,
|
||||
M;&0Z("A31U4I(%-U;D]3+T5,1B H3$LM,2XS*0 0 "D 8?
|
||||
M"V0 1,( (60 1,( +3P /(
|
||||
M 7H <( EX L(
|
||||
M SH !$H !5H !=(
|
||||
M !EH !LX !SX !
|
||||
MX8 !]( "#( ".8
|
||||
M "5( "<( "D8 "G8
|
||||
M "R( #&8 $GH %+(
|
||||
M & %.8 ) %0X -< %3H #0 %
|
||||
M6H #4 %9( #8 %;X #< %>8 #@
|
||||
M %A( #D %CX #H %FH $8 %IX
|
||||
M %T( &T %]( "X &"20 !\L 1,( "YI;G1E
|
||||
M<G +FAA<V@ +F1Y;G-Y;0 N9'EN<W1R "YR96QA+F)S<P N<F5L82YP;'0
|
||||
M+G1E>'0 +FEN:70 +F9I;FD +F-T;W)S "YD=&]R<P N<F]D871A "YG;W0
|
||||
M+F1Y;F%M:6, +G!L= N9&%T80 N8G-S "YS>6UT86( +G-T<G1A8@ N<W1A
|
||||
M8BYI;F1E> N8V]M;65N= N<W1A8@ N<VAS=')T86( +G-T86(N:6YD97AS
|
||||
M='( +G-T86)S='( '9A;'5E<RU882YC "\Q,#DS+V]N,3 Y,U]W<R]U<W(O
|
||||
M<W)C+VQI8B]L:6)C+P!P;W)T+V=E;B]V86QU97,M6&$N8P %AT(#L@5CTR
|
||||
M+C +VYE="]M;W)G86YA+W5S<C$O<G1E;7,M,RXU+C P+V,O8G5I;&0M=&]O
|
||||
M;',O<W)C "]U<W(O8V-S+VQI8B]V86QU97,M6&$N;P ;&EB9V-C,BYC "]U
|
||||
M<W(T+T=.050O9V-C+3(N-BXS+P N+VQI8F=C8S(N8P!G8V,R7V-O;7!I;&5D
|
||||
M+@!I;G0Z=#$]<C$[+3(Q-#<T.#,V-#@[,C$T-S0X,S8T-SL 8VAA<CIT,CUR
|
||||
M,CLP.S$R-SL ;&]N9R!I;G0Z=#,]<C$[+3(Q-#<T.#,V-#@[,C$T-S0X,S8T
|
||||
M-SL =6YS:6=N960@:6YT.G0T/7(Q.S [+3$[ &QO;F<@=6YS:6=N960@:6YT
|
||||
M.G0U/7(Q.S [+3$[ &QO;F<@;&]N9R!I;G0Z=#8]<C$[,#$P,# P,# P,# P
|
||||
M,# P,# P,# P,# [,#<W-S<W-S<W-S<W-S<W-S<W-S<W-SL ;&]N9R!L;VYG
|
||||
M('5N<VEG;F5D(&EN=#IT-SUR,3LP,# P,# P,# P,# P.S Q-S<W-S<W-S<W
|
||||
M-S<W-S<W-S<W-S<W.P!S:&]R="!I;G0Z=#@]<C$[+3,R-S8X.S,R-S8W.P!S
|
||||
M:&]R="!U;G-I9VYE9"!I;G0Z=#D]<C$[,#LV-34S-3L <VEG;F5D(&-H87(Z
|
||||
M=#$P/7(Q.RTQ,C@[,3(W.P!U;G-I9VYE9"!C:&%R.G0Q,3UR,3LP.S(U-3L
|
||||
M9FQO870Z=#$R/7(Q.S0[,#L 9&]U8FQE.G0Q,SUR,3LX.S [ &QO;F<@9&]U
|
||||
M8FQE.G0Q-#UR,3LX.S [ &-O;7!L97@@:6YT.G0Q-3US.')E86PZ,2PP+#,R
|
||||
M.VEM86<Z,2PS,BPS,CL[ &-O;7!L97@@9FQO870Z=#$V/7(Q-CLT.S [ &-O
|
||||
M;7!L97@@9&]U8FQE.G0Q-SUR,3<[.#LP.P!C;VUP;&5X(&QO;F<@9&]U8FQE
|
||||
M.G0Q.#UR,3@[.#LP.P!V;VED.G0Q.3TQ.0!A<F-H7W1Y<&4Z5#(P/65!4D-(
|
||||
M7S,R0DE4.C L05)#2%\V-$))5#HQ+#L <F5G7V-L87-S.E0R,3UE3D]?4D5'
|
||||
M4SHP+$=%3D5204Q?4D5'4SHQ+$907U)%1U,Z,BQ!3$Q?4D5'4SHS+$Q)35]2
|
||||
M14=?0TQ!4U-%4SHT+#L ;6%C:&EN95]M;V1E.E0R,CUE5D])1&UO9&4Z,"Q1
|
||||
M26UO9&4Z,2Q(26UO9&4Z,BQ04TEM;V1E.C,L4TEM;V1E.C0L4$1);6]D93HU
|
||||
M+$1);6]D93HV+%1);6]D93HW+$]);6]D93HX+%%&;6]D93HY+$A&;6]D93HQ
|
||||
M,"Q4449M;V1E.C$Q+%-&;6]D93HQ,BQ$1FUO9&4Z,3,L6$9M;V1E.C$T+%1&
|
||||
M;6]D93HQ-2Q30VUO9&4Z,38L1$-M;V1E.C$W+%A#;6]D93HQ."Q40VUO9&4Z
|
||||
M,3DL0U%);6]D93HR,"Q#2$EM;V1E.C(Q+$-326UO9&4Z,C(L0T1);6]D93HR
|
||||
M,RQ#5$EM;V1E.C(T+$-/26UO9&4Z,C4L0DQ+;6]D93HR-BQ#0VUO9&4Z,C<L
|
||||
M0T-8;6]D93HR."Q#0U].3T]6;6]D93HR.2Q#0UA?3D]/5FUO9&4Z,S L0T-&
|
||||
M4&UO9&4Z,S$L0T-&4$5M;V1E.C,R+$U!6%]-04-(24Y%7TU/1$4Z,S,L.P!M
|
||||
M;V1E7V-L87-S.E0R,SUE34]$15]204Y$3TTZ,"Q-3T1%7TE.5#HQ+$U/1$5?
|
||||
M1DQ/050Z,BQ-3T1%7U!!4E1)04Q?24Y4.C,L34]$15]#0SHT+$U/1$5?0T]-
|
||||
M4$Q%6%])3E0Z-2Q-3T1%7T-/35!,15A?1DQ/050Z-BQ-05A?34]$15]#3$%3
|
||||
M4SHW+#L <'1R9&EF9E]T.G0Q '-I>F5?=#IT- !W8VAA<E]T.G0S %51271Y
|
||||
M<&4Z=#$Q %-)='EP93IT,0!54TET>7!E.G0T $1)='EP93IT-@!51$ET>7!E
|
||||
M.G0W %-&='EP93IT,3( 1$9T>7!E.G0Q,P!W;W)D7W1Y<&4Z=#$ 1$ES=')U
|
||||
M8W0Z5#(T/7,X:&EG:#HQ+# L,S([;&]W.C$L,S(L,S([.P!$275N:6]N.G0R
|
||||
M-3UU.',Z,C0L,"PV-#ML;#HV+# L-C0[.P!F=6YC7W!T<CIT,C8]*C(W/68Q
|
||||
M.0!?7V1O7V=L;V)A;%]D=&]R<SI&,3D
|
||||
M $ ! @ ! -0 #4 $0
|
||||
M 0 ) !0 ( 0#H Z FP #
|
||||
M 0 $ #P L " $#5 U0 5@ ! !H $
|
||||
M $ !< # @ !"+0 BT ")0 0
|
||||
M ? ! ( 0K< *W %0 # $0 0 , *0
|
||||
M 0 " $+, "S #D P \ $ # #, !
|
||||
M!@ !#!0 P4 '- ! Y 0 8 1-(
|
||||
M 32 )@ 0 /P $ & $3X $^
|
||||
M , $ $4 ! !@ !$^P !/L "
|
||||
M ! !, 0 8 1/T 3] @
|
||||
M 0 4P $ " $4 % -+ (
|
||||
M %L ! P "%TP !=, ! ! 0
|
||||
M !@ !@ , A=0 74 (@ $ 0 ( :0
|
||||
M $ ' (7V %]@ $8 $ # &X !
|
||||
M P "&/ !CP % ! !T " , AD(
|
||||
M 9" \ @ >0 ( &0@
|
||||
M 90 $P "D $ $ ($ # !]8 "XP
|
||||
M 0 ") 0 B/ $@
|
||||
M 0 , E0 $ (H0 $; !
|
||||
M )X ! ".@ !^ ! P
|
||||
M "D P EF ,8 $ K@
|
||||
M , )EX "; ! +T #
|
||||
= ";Y &'P 0 !
|
||||
|
||||
end
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <dos.h>
|
||||
|
||||
#define IO_RTC 0x70 /* RTC */
|
||||
|
||||
#define RTC_SEC 0x00 /* seconds */
|
||||
#define RTC_MIN 0x02 /* minutes */
|
||||
#define RTC_HRS 0x04 /* hours */
|
||||
#define RTC_WDAY 0x06 /* week day */
|
||||
#define RTC_DAY 0x07 /* day of month */
|
||||
#define RTC_MONTH 0x08 /* month of year */
|
||||
#define RTC_YEAR 0x09 /* month of year */
|
||||
#define RTC_STATUSA 0x0a /* status register A */
|
||||
#define RTCSA_TUP 0x80 /* time update, don't look now */
|
||||
|
||||
#define RTC_STATUSB 0x0b /* status register B */
|
||||
|
||||
#define RTC_DIAG 0x0e /* status register E - bios diagnostic */
|
||||
#define RTCDG_BITS "\020\010clock_battery\007ROM_cksum\006config_unit\005memory_size\004fixed_disk\003invalid_time"
|
||||
|
||||
|
||||
|
||||
/* convert 2 digit BCD number */
|
||||
static int bcd( unsigned int i )
|
||||
{
|
||||
return ((i/16)*10 + (i%16));
|
||||
}
|
||||
|
||||
static unsigned int rtcin( unsigned int what )
|
||||
{
|
||||
outportb( IO_RTC, what );
|
||||
return inportb( IO_RTC+1 );
|
||||
}
|
||||
|
||||
|
||||
void fix_date( void )
|
||||
{
|
||||
int s;
|
||||
struct date date;
|
||||
struct time time;
|
||||
|
||||
/* initialize brain-dead battery powered clock */
|
||||
outportb( IO_RTC, RTC_STATUSA );
|
||||
outportb( IO_RTC+1, 0x26 );
|
||||
outportb( IO_RTC, RTC_STATUSB );
|
||||
outportb( IO_RTC+1, 2 );
|
||||
|
||||
outportb( IO_RTC, RTC_DIAG );
|
||||
s = inportb( IO_RTC+1 );
|
||||
if (s) printf("RTC BIOS diagnostic error %b\n", s, RTCDG_BITS);
|
||||
|
||||
/* check for presence of clock */
|
||||
s = rtcin(RTC_STATUSA);
|
||||
if ( s == 0xff || s == 0 ) {
|
||||
printf( "Real-time clock not found\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
/* ready for a read? */
|
||||
while ((s & RTCSA_TUP) == RTCSA_TUP)
|
||||
s = rtcin(RTC_STATUSA);
|
||||
|
||||
date.da_year = bcd(rtcin(RTC_YEAR)) + 1900; /* year */
|
||||
if ( date.da_year < 1970) date.da_year += 100;
|
||||
date.da_year -= 1980;
|
||||
date.da_mon = bcd(rtcin(RTC_MONTH)); /* month */
|
||||
date.da_day = bcd(rtcin(RTC_DAY)); /* day */
|
||||
|
||||
(void)bcd(rtcin(RTC_WDAY)); /* weekday */
|
||||
|
||||
time.ti_hour = bcd(rtcin(RTC_HRS)); /* hour */
|
||||
time.ti_min = bcd(rtcin(RTC_MIN)); /* minutes */
|
||||
time.ti_sec = bcd(rtcin(RTC_SEC)); /* seconds */
|
||||
time.ti_hund = 0;
|
||||
|
||||
setdate( & date );
|
||||
settime( & time );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fix_timer( void )
|
||||
{
|
||||
#define PIT_PORT 0x40
|
||||
#define TIMER_CNTR0 (PIT_PORT + 0) /* timer 0 counter port */
|
||||
#define TIMER_MODE (PIT_PORT + 3) /* timer mode port */
|
||||
#define TIMER_SEL0 0x00 /* select counter 0 */
|
||||
#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
|
||||
#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
|
||||
|
||||
/* set timer 0 to generate interrupts every period */
|
||||
outportb( TIMER_MODE, TIMER_SEL0|TIMER_RATEGEN|TIMER_16BIT );
|
||||
outportb( TIMER_CNTR0, 0 ); /* counter low */
|
||||
outportb( TIMER_CNTR0, 0 ); /* counter high */
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* Make timer count at correct pace */
|
||||
fix_timer();
|
||||
|
||||
/* Fix the date */
|
||||
fix_date();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
begin 664 fixtimer.exe
|
||||
M35IF 0X 0 @ T __^; 8 (@ $ ^R!R:@$
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M "Z3 $NB1;X ;0PS2&++@( BQXL ([:HY( C :0
|
||||
M (D>C ")+JP QP:6 /__Z#0!Q#Z* (O'B]BY_W\F@3TX-W49)HM5 H#Z/740
|
||||
M@.;?_P:6 (#^674$_P:6 /*NXV%#)C@%==: S8#WV8D.B@"Y 0#3XX/#"(/C
|
||||
M^(D>C@",VBOJBSY\ H'_ )S![\ HD^? *!Q^P$<B@#/GH"<B*Q!-/O1SOO
|
||||
M<AF#/GP" '0'@SYZ @!U#K\ $#OO=P>+_>L#Z2$!B]\#VHD>I ")'J@ H9
|
||||
M*]B.P+1*5\TA7]/G^H[2B^?[,\ NC@;X ;^F!+GL!"O/\ZH._Q:8!.BU NB=
|
||||
M [0 S1J)%I@ B0Z: /\6G 3_-H@ _S:& /\VA #H%P)0Z%H"+HX>^ 'H? .
|
||||
M_Q::!#/ B_"Y+P"0_ ($@-0 1N+X+3<-D'0*N1D D+HO .B+ (OLM$R*1@+-
|
||||
M(;D. )"Z2 #IAP >N US2&)'G0 C 9V +@$-<TAB1YX (P&>@"X!37-(8D>
|
||||
M? ",!GX N 8US2&)'H C :" +@ )8S*CMJZ6 '-(1_#'K@ )<46= #-(1\>
|
||||
MN 0EQ19X ,TA'QZX!27%%GP S2$?'K@&)<46@ #-(1_#QP:6 R\.T0+L"
|
||||
M ,TAP[D> )"Z5@ NCA[X >CI_[@# %#H*?\ %6+[(M&!+$$T^BZ"@#WXHM6
|
||||
M!('B#P #PNL 7<-5B^R*1@3F<.1QM #K %W#58OL@^P(5K *YG"P)N9QL OF
|
||||
M<+ "YG&P#N9PY'&T (OP"_9T#[BR 5!6N)0!4.B<"8/$!K@* %#HM?]9B_"!
|
||||
M_O\ = 0+]G4+N/P!4.A^"5GIJ0#K"K@* %#HE/]9B_"+QB6 #V '3LN D
|
||||
M4.B _UE0Z%__605L!XE&^(%^^+('?02#1OAD@6[XO >X" !0Z%W_65#H//]9
|
||||
MB$;[N < 4.A-_UE0Z"S_68A&^K@& %#H/?]94.@<_UFX! !0Z##_65#H#_]9
|
||||
MB$;]N ( 4.@@_UE0Z/_^68A&_#/ 4.@1_UE0Z/#^68A&_\9&_@"-1OA0Z'H1
|
||||
M68U&_%#HA1%97HOE7<.P-.9#L #F0+ YD##Z/#_Z.S^,\#K ,-5B^Q6BW8$
|
||||
M"_9\%(/^6'8#OE< B388 HJ$&@*8ENL-]]Z#_B-WZL<&& +__XO&HY0 N/__
|
||||
MZP!>7<(" ,-5B^SK"HL>?@+1X_^7I@2A?@+_#GX""\!UZ_\6= +_%G8"_Q9X
|
||||
M O]V!.AZ_5E=PP "Z/!JH#+HP>K /\C@:0 +Z #+D)JQ C,6'UI.+
|
||||
M-HH @\8"N0$ @#Z2 -R$8X&C "+_K%_,L#RKN-V@/%_@^P"N $ \,#P27^
|
||||
M_XO\*_AR8(OGC,".V(S0CL!12?.D,L"JCMV'\H?9B\.+T$/H&0!W!W) Z!(
|
||||
M=_D\('0(/ UT!#P)=>@RP.OD"\!T!T*J"L!U 4.&X#+ ^>,5K$DL(G0/!"(\
|
||||
M7'4'@#PB=0*L20OVP^E^_5D#RBZ.'JP#B1Z$ $,#VXOTB^PKZW+FB^6)+H8
|
||||
MXPZ)=@"#Q0(VK K X/IT\#/ B48 +O\FJ@.+#HH 4>A' 5F+^ O ="0>'@>.
|
||||
M'HP ,_;\\Z0?B_@&_S:. .@I 8/$ HO8!Z.( O =0/I$?TSP+G__XD_@\,"
|
||||
M\JXF. 5U](D'PU6+[(,^?@(@=06X 0#K%8M&!(L>?@+1XXF'I@3_!GX",\#K
|
||||
M %W#58OL5E>+?@2+10:CZ 0[QW4(QP;H! ZQ"+=02+'N@$B7<$H>@$B40&
|
||||
M7UY=PU6+[%97BWX$BT8&*06+-0/WBT8&0(D$B7P"H>8$.\=U!HDVY@3K"(O^
|
||||
M WX&B74"B\8%! #K %]>7<-5B^Q6BT8$,](E__^!X@ 4E#H] !968OP@_[_
|
||||
M=00SP.L8H>8$B40"BT8$0(D$B3;F!*'F! 4$ .L 7EW#58OL5HM&!#/2)?__
|
||||
M@>( %)0Z+< 65F+\(/^_W4$,\#K%8DVZ@2)-N8$BT8$0(D$B\8%! #K %Y=
|
||||
MPU6+[%97BWX$"_]U!#/ ZUJ+QP4+ "7X_XOX@S[J! !U!U?HH?]9ZT*+-N@$
|
||||
MB\8+P'0QBP2+UX/"*#O"<@E75N@-_UE9ZR2+!#O'<@Y6Z-'^6?\$B\8%! #K
|
||||
M$(MT!CLVZ 1USU?H(O]9ZP!?7EW#58OLBT8$B]2!Z@ !.\)S!Z.> #/ ZPO'
|
||||
M!I0 " "X___K %W#58OLBT8$BU8& P:> (/2 (O(@<$ 8/2 O2=0H[S',&
|
||||
MAP:> .L+QP:4 @ N/__ZP!=PU6+[/]V!.B?_UGK %W#58OLBT8$F5)0Z++_
|
||||
MB^7K %W#58OL@^P"5E>+7@2+-XO&B4;^BUX$]T<"0 !T!(O&ZQ^+7@2+?PKK
|
||||
M"XO?1X _"G4#_T;^B\9."\!U[HM&_NL 7UZ+Y5W" @!5B^Q6BW8$5NA3!%D+
|
||||
MP'0%N/__ZTR#?@H!=1"#/ !^"U;HE?^9*48&&58(@60"7_['! BT0(B40*
|
||||
M_W8*_W8(_W8&BD0$F%#HW *#Q B#^O]U"CW__W4%N/__ZP(SP.L 7EW#58OL
|
||||
M@^P$5HMV!%;H[ -9"\!T"+K__[C__^L_N $ 4#/ 4%"*1 284.B8 H/$"(E6
|
||||
M_HE&_(,\ 'X9BU;^BT;\4E!6Z!#_F8O8B\I86BO#&]'K!HM6_HM&_.L 7HOE
|
||||
M7<-5B^RX $2+7@3-(;@ '($T>+1T.L 7<-5B^Q65XM^"HMV!(M$#CO&=0R#
|
||||
M?@@"?P:!__]_=@:X___IJ@"#/NH# '4/N) ".\9U",<&Z@,! .L4@S[H P!U
|
||||
M#;B CO&=0;'!N@# 0"#/ !T#[@! % SP%!05NC&_H/$"/=$ @0 = ?_= CH
|
||||
M"PQ9@60"\__'1 8 (O&!04 B40(B40*@WX( G0_"_]V.\<&= +$"(-^!@!U
|
||||
M&%?H6?U9B48&"\!T!X%, @0 ZP6X___K&XM&!HE$"HE$"(E\!H-^" %U!8%,
|
||||
M @@ ,\#K %]>7<-65[\$ +Z NL0]T0" P!T!5;HG )93X/&$ O_=>Q?7L-5
|
||||
MB^R![(H 5E>+1@A /0( <P4SP.GV (M>!-'C]X? P" =!+_=@C_=@;_=@3H
|
||||
MXP"#Q ;IUP"+7@31XX&GP /__8M&!HF&?/^+1@B)AGC_C;9^_^MM_XYX_XN>
|
||||
M?/__AGS_B@>(AGO_/ IU!,8$#4:*AGO_B 1&C89^_XO6*]"!^H ?#Z-AG[_
|
||||
MB_XK^%>-AG[_4/]V!.A[ (/$!HF&=O\[QW0;@[YV_P!S!;C__^L-BT8(*X9X
|
||||
M_P.&=O\KQ^M/C;9^_X.^>/\ = /IB?^-AG[_B_XK^(O'"\!V+E>-AG[_4/]V
|
||||
M!.@M (/$!HF&=O\[QW07@[YV_P!S!;C__^L)BT8( X9V_RO'ZP6+1@CK %]>
|
||||
MB^5=PU6+[(M>!-'C]X? P (=!"X @!0,\!04/]V!.@H (OEM$"+7@2+3@B+
|
||||
M5@;-(7(/4(M>!-'C@8_ P 06.L&4.@%^>L 7<-5B^R+7@31XX&GP /__;1"
|
||||
MBD8*BUX$BTX(BU8&S2%R NL'4.C;^)GK %W#58OL@^PB5E<&BWX*'@>+7@B#
|
||||
M^R1W6(#[ G)3BT8,BTX."\E]$8!^!@!T"\8%+4?WV??8@]D C7;>XP^1*]+W
|
||||
M\Y'W\X@41N,)Z_$KTO?SB!1&"\!U]8U.WO?9 \[\3HH$+ IS! 0ZZP,"1@2J
|
||||
MXN^P *H'BT8*ZP!?7HOE7<(, %6+[(-^" IU!HM&!)GK!8M&!#/24E#_=@;_
|
||||
M=@BP 5"P85#H7/_K %W#58OL_W8&_W8$_W8(_W8*L !0L&%0Z$#_ZP!=PU6+
|
||||
M[/]V!O]V!/]V"/]V"H-^"@IU!;@! .L",\!0L&%0Z!G_ZP!=P[KL ^L#NO$#
|
||||
MN04 D+1 NP( S2&Y)P"0NO8#M$#-(>EM]E6+[%97BW8$BT0..\9T!;C__^MF
|
||||
M@SP ?"WW1 (( '4,BT0*B]:#P@4[PG46QP0 (M$"HO6@\(%.\)U!HM$"(E$
|
||||
M"C/ ZS2+? 8#/$<I/%>+1 B)1 I0BD0$F%#H$OV#Q 8[QW01]T0" )U"H%,
|
||||
M A N/__ZP0SP.L 7UY=PU6+[+AK#5"XD )0_W8$C48&4.A, NL 7<-5B^R+
|
||||
M7@;_#_]V!HI&!)A0Z 8 B^7K %W#58OL@^P"5HMV!HI&!(A&__\$?3:*1O__
|
||||
M1 J+7 J(1__W1 (( '0;@'[_"G0&@'[_#74/5N@9_UD+P'0&N/__Z>D BD;_
|
||||
MM #IX0#_#/=$ I =0?W1 (" '4+@4P"$ "X___IQ@"!3 ( 8-\!@!T)H,\
|
||||
M '015NC7_ED+P'0&N/__Z:< ZPJX__^+5 8KPHD$Z7W_Z94 @S[J P!U.;B0
|
||||
M CO&=3**1 284.@)^UD+P'4%@60"__VX )0]T0" )T!;@" .L",\!0,\!0
|
||||
M5NC]^H/$".F/_X!^_PIU'_=$ D =1BX 0!0N!X$4(I$!)A0Z.#\@\0&/0$
|
||||
M=1BX 0!0C48$4(I$!)A0Z,C\@\0&/0$ =!'W1 ( G4*@4P"$ "X___K!XI&
|
||||
M_[0 ZP!>B^5=PU6+[%:+=@2XD )05NC!_EE9ZP!>7<-5B^R#[ )65XMV!(M^
|
||||
M!D?W1 (( '0CZP+K $^+QPO =!56BUX(_T8(B@>84.B+_EE9/?__=>+I=0#W
|
||||
M1 ) '0W@WP& '0QBT0&.\=S*H,\ '0-5NBT_5D+P'0$,\#K4T]7_W8(BD0$
|
||||
MF%#H(?R#Q :)1OXK?O[K-^L"ZP!/B\<+P'0L_P1]%8M>"/]&"(H'_T0*BUP*
|
||||
MB$?_M #K#E:+7@C_1@C_-^CZ_5E9/?__=<N+Q^L 7UZ+Y5W"!@#_)IX$58OL
|
||||
MBU8$N00/NR<$_(K&TNC7JHK&(L77JHK"TNC7JHK"(L77JNL 7<(" %6+[('L
|
||||
ME@!65\=&J@ QD:M4.LX5[G__S+ \J[WT4E?PX@%1_Y.K7XB4U%2!HU&KBOX
|
||||
MC4:N4%?_=@C_5@K&1JU0 7ZJC7ZN!UI96\,&_(U^KHF^;/^+OFS_BW8&K K
|
||||
M=!$\)700B 5'_DZM?^_HN?_KZNEU!(FV>/^L/"5TYXF^;/\SR8F.=O^)CFK_
|
||||
MB(YU_\>&</___\>&<O___^L!K#+DB]"+V(#K((#[8'-'BI\W!(O#/1< =@/I
|
||||
M'02+V-'C+O^G& ]C#TL/I ]7#\D/TP\5$!\0+Q"*#V00/Q!#$$<0Z1";$3P1
|
||||
M7!'_$BP3+!,L$W8/@ _IX0. _0!W^(..:O\!ZYN _0!W[(..:O\"ZX^ _0!W
|
||||
MX("^=?\K= 2(EG7_Z7S_@Z9J_]^U!>ER_X..:O\@M07I:/^ _0!W1/>&:O\"
|
||||
M '4A@XYJ_PBU >E1_^F( XM^!(L%@T8$ H#] G,)B89P_[4#Z3?_@/T$=>&)
|
||||
MAG+__L7I*?^ _01ST[4$Z1__DBPPF(#] G<;M0*'AG#_"\!\TM'@B]#1X-'@
|
||||
M \(!AG#_Z?O^@/T$=:6'AG+_"\!\M-'@B]#1X-'@ \(!AG+_Z=W^@XYJ_Q"U
|
||||
M!>G3_H&.:O\ 8.F:O_OM07IP_Z#IFK_[X&.:O^ +4%Z;/^MPCK"K<*ZPNW
|
||||
M$+/I MK&AG7_ ,:&;_\ B)9N_XM^!(L%,]+K$;<*QH9O_P&(EF[_BWX$BP69
|
||||
M1T>)=@;WAFK_$ !T!(L51T>)?@2-OGO_"\!U,PO2=2^#OG+_ '4MB[YL_XN.
|
||||
M</_C&X/Y_W06BX9J_R4( '0$LC#K K(@BL+HMOWB^>GI_8..:O\$4E!7BL>8
|
||||
M4(J&;_]04^B0^18'BY9R_PO2?P/I% 'I(0&(EF[_B78&C;YZ_XM>!/\W0T.)
|
||||
M7@3WAFK_( !T#_\W0T.)7@06!^@7_; ZJA8'Z _]Q@4 QH9O_P"#IFK_^XV.
|
||||
M>O\K^8?/BY9R_SO1?P*+T>F^ (EV!HB6;O^+?@2+!8-&! (6!XV^>_\RY(D%
|
||||
MN0$ Z=@ B78&B)9N_XM^!/>&:O\@ '4,BSV#1@0"'@<+_^L*Q#V#1@0$C, +
|
||||
MQW4%'@>_( 3HVOP[CG+_=@2+CG+_Z9D B78&B)9N_XM^!(N.<O\+R7T#N08
|
||||
M5U&-GGO_4U*X 0 CAFK_4(N&:O^I@ !T"K@" ,=&_@0 ZQ>I %T"K@( ,=&
|
||||
M_@H ZPC'1OX( +@& %#H-_R+1OX!1@06!XV^>__WAFK_" !T$XN6</\+TGX+
|
||||
MZ%O\*]%^!(F6=O^*AG7_"L!T%": /2UT#H.N=O\!@Y9V_P!/)H@%Z#3\B_>+
|
||||
MOFS_BYYP_[@% ".&:O\]!0!U%HJF;O^ _&]U$(.^=O\ ?P;'AG;_ 0#K'Y"
|
||||
M_'AT!8#\6'44@XYJ_T!+2X.N=O\"?0;'AG;_ #CG;_]X9J_P( =0SK!K @
|
||||
MZ.'[2SO9?_;WAFK_0 !T#+ PZ,_[BH9N_^C(^XN6=O\+TGXG*\HKVB:*!#PM
|
||||
M= @\('0$/"MU!R:LZ*C[24N'RN,'L##HG?OB^8?*XQ$KV2:LB 5'_DZM?P/H
|
||||
MD/OB\0O;?@F+R[ @Z'O[XOGIKON)=@:+?@3WAFK_( !U"HL]@T8$ AX'ZP;$
|
||||
M/8-&! 2X4 J1JT#1JHFB07I??N+MGC_B[YL_[ EZ#S[K K =?B ?JU0?0/H
|
||||
M-OL'BT:JZP!?7HOE7<(( %6+[%97BW8$@S[H! !T'(L>Z 2+?P:+'N@$B7<&
|
||||
MB74$B7P&H>@$B40$ZPJ)-N@$B70$B70&7UY=PU6+[(/L E97BW8&BWX$BP0!
|
||||
M!:'F!#O&=0:)/N8$ZPV+! /&B4;^BU[^B7\"5NA-\5E?7HOE7<-6H>H$.P;F
|
||||
M!'42_S;J!.C:\EDSP*/F!*/J!.L[BQ[F!(MW O<$ 0!U(E;H&?%9.S;J!'4*
|
||||
M,\"CY@2CZ@3K!HM$ J/F!%;HH_)9ZPS_-N8$Z)GR68DVY@1>PU6+[(/L E97
|
||||
MBW8$_PR+! /&B4;^BWP"]P4! '44.S;J!'0.BP0!!8M>_HE_ HOWZP56Z +_
|
||||
M68M>_O<' 0!U"?]V_E;H*O]965]>B^5=PU6+[%:+=@0+]G4"ZQ>+Q@7\_XOP
|
||||
M.S;F!'4%Z#S_ZP56Z(__65Y=PU6+[%:T*XMV!(L,BU0"S2%>7<-5B^Q6M"V+
|
||||
M=@2+#(M4 LTA7EW# !4=7)B;RU#("T@0V]P>7)I9VAT("AC
|
||||
M*2 Q.3@X($)O<FQA;F0@26YT;"X 3G5L;"!P;VEN=&5R(&%S<VEG;FUE;G0-
|
||||
M"D1I=FED92!E<G)O<@T*06)N;W)M86P@<')O9W)A;2!T97)M:6YA=&EO;@T*
|
||||
M .P$[ 3L
|
||||
M!
|
||||
M
|
||||
M
|
||||
M
|
||||
M
|
||||
M 4E1#($))3U,@9&EA9VYO<W1I8R!E<G)O<B E
|
||||
M8@H $ AC;&]C:U]B871T97)Y!U)/35]C:W-U;09C;VYF:6=?=6YI= 5M96UO
|
||||
M<GE?<VEZ901F:7AE9%]D:7-K VEN=F%L:61?=&EM90!296%L+71I;64@8VQO
|
||||
M8VL@;F]T(&9O=6YD"@ $P("! 4&" @(%!4%$_\6!1$"____________
|
||||
M_____P4%_____________________P__(P+_#_____\3__\" @4/ O___Q/_
|
||||
M_________R/_____(_\3_P!Z WH#>@, 0 D" ( "
|
||||
M * @$ "0 @ @(" H ( $," P
|
||||
M + " !" @0 # @ #_ T ( _P
|
||||
M . " /\ #P @ #_ , _P
|
||||
M ! # /\ @ P #_ , ,
|
||||
M_P $ # /\ !0 P #_ 8 ,
|
||||
M _P ' # /\ " P #_
|
||||
MD , _P * # /\ "P P$@ B "( 2@ J#_
|
||||
M______________________________________\ <')I;G0@<V-A;F8@
|
||||
M.B!F;&]A=&EN9R!P;VEN="!F;W)M871S(&YO="!L:6YK960-"@ - "AN=6QL
|
||||
M*0 P,3(S-#4V-S@Y04)#1$5& !04 105%!04% ( % ,$% D%!04%!04%!044
|
||||
M%!04%!04%!04% \7#P@4%!0'%!84%!04%!04%!0-%!04%!04%!04%! *#P\/
|
||||
G" H4% 84$@L.%!01% P4% T4%!04%!04 -(!T@'9 50+60M9"UD+
|
||||
|
||||
end
|
||||
@@ -1,331 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <process.h>
|
||||
|
||||
#include <io.h>
|
||||
|
||||
void * xmalloc( int size )
|
||||
{
|
||||
void * p = (void *)malloc( size );
|
||||
if ( !p ) {
|
||||
fprintf( stderr, "out of memory\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
return p;
|
||||
}
|
||||
void * xrealloc( void * old, int size )
|
||||
{
|
||||
void * p = (void *)realloc( old, size );
|
||||
if ( !p ) {
|
||||
fprintf( stderr, "out of memory\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
char ** argv_fix( int * argc, char ** argv )
|
||||
{
|
||||
char ** new = NULL;
|
||||
int max = 20;
|
||||
int cnt = 0;
|
||||
int j;
|
||||
|
||||
for ( j = 1; argv[j]; ++j )
|
||||
if ( argv[j][0] == '@' && access(argv[j]+1,0)==0 )
|
||||
break;
|
||||
if ( argv[j] == NULL )
|
||||
return argv;
|
||||
|
||||
new = (char **)xmalloc( max * sizeof *new );
|
||||
new[cnt++] = *argv++;
|
||||
for ( ; *argv; ++argv ) {
|
||||
if ( cnt >= max )
|
||||
new = (char **)realloc( new, (max*=2) * sizeof *new );
|
||||
|
||||
if ( argv[0][0] != '@' || access(argv[0]+1,0) ) {
|
||||
new[cnt++] = *argv;
|
||||
} else {
|
||||
char line[ 1000 ];
|
||||
FILE * f = fopen( argv[0]+1, "r" );
|
||||
if ( !f ) {
|
||||
perror( argv[0]+1 );
|
||||
exit( 2 );
|
||||
}
|
||||
while ( fgets( line, sizeof line, f ) ) {
|
||||
int len = strlen( line );
|
||||
/* delete trailing newlines */
|
||||
while ( line[len-1] == '\n' || line[len-1] == '\r' )
|
||||
line[--len] = '\0';
|
||||
if ( cnt >= max )
|
||||
new = (char **)xrealloc( new, (max*=2) * sizeof *new );
|
||||
new[cnt] = (char *)xmalloc( len+1 );
|
||||
strcpy( new[cnt], line );
|
||||
++cnt;
|
||||
}
|
||||
fclose( f );
|
||||
}
|
||||
}
|
||||
if ( cnt >= max )
|
||||
new = (char **)xrealloc( new, (max+1) * sizeof *new );
|
||||
new[cnt] = NULL;
|
||||
*argc = cnt;
|
||||
return new;
|
||||
}
|
||||
|
||||
|
||||
const char * USAGE =
|
||||
"usage: $progname [ -cNvmV ] file [ file ... ] dest-directory-or-file\n"
|
||||
" -v -- verbose\n"
|
||||
" -V suffix -- suffix to append to targets (before any . suffix)\n"
|
||||
" eg: -V _g would change 'foo' to 'foo_g' and\n"
|
||||
" 'libfoo.a' to 'libfoo_g.a'\n"
|
||||
" -m mode -- mode for new file(s)\n"
|
||||
" -c -- copy instead of move (always on)\n"
|
||||
" -N -- copy only if source is newer than target\n"
|
||||
;
|
||||
|
||||
void fatal( char * msg )
|
||||
{
|
||||
if ( msg )
|
||||
fprintf( stderr, "%s\n", msg );
|
||||
fprintf( stderr, "%s", USAGE );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
char * basename( char * f )
|
||||
{
|
||||
char * b = strrchr( f, '/' );
|
||||
if ( b ) ++b;
|
||||
else b = f;
|
||||
return b;
|
||||
}
|
||||
|
||||
#include <sys/stat.h>
|
||||
int is_dir( char * path )
|
||||
{
|
||||
struct stat buf;
|
||||
if ( stat( path, &buf ) )
|
||||
return 0;
|
||||
return buf.st_mode & S_IFDIR;
|
||||
}
|
||||
int is_file( char * path )
|
||||
{
|
||||
struct stat buf;
|
||||
if ( stat( path, &buf ) )
|
||||
return 0;
|
||||
return buf.st_mode & S_IFREG;
|
||||
}
|
||||
int newer( char * p1, char * p2 )
|
||||
{
|
||||
struct stat buf1;
|
||||
struct stat buf2;
|
||||
if ( stat( p1, &buf1 ) )
|
||||
return 0;
|
||||
if ( stat( p2, &buf2 ) )
|
||||
return 0;
|
||||
return buf1.st_mtime > buf2.st_mtime;
|
||||
}
|
||||
|
||||
int filecopy( char * d, char * s, int preserve_time )
|
||||
{
|
||||
#if 0
|
||||
int status;
|
||||
char * argv[ 5 ];
|
||||
argv[0] = "cp";
|
||||
argv[1] = "-p";
|
||||
argv[2] = s;
|
||||
argv[3] = d;
|
||||
argv[4] = NULL;
|
||||
status = spawnvp( P_WAIT, argv[0], argv );
|
||||
if ( status )
|
||||
perror( "cp" );
|
||||
return status;
|
||||
#else
|
||||
FILE * fs;
|
||||
FILE * fd;
|
||||
char buffer[ 8192 ];
|
||||
int n;
|
||||
struct ftime When;
|
||||
struct stat Stat;
|
||||
|
||||
fs = fopen( s, "rb" );
|
||||
if ( fs == NULL ) {
|
||||
perror( s );
|
||||
return 1;
|
||||
}
|
||||
fd = fopen( d, "wb" );
|
||||
if ( fd == NULL ) {
|
||||
perror( d );
|
||||
fclose( fs );
|
||||
return 2;
|
||||
}
|
||||
|
||||
if ( preserve_time )
|
||||
if ( getftime( fileno(fs), &When ) ) {
|
||||
perror( s );
|
||||
preserve_time = 0;
|
||||
}
|
||||
|
||||
do {
|
||||
n = fread( buffer, 1, sizeof buffer, fs );
|
||||
if ( n > 0 )
|
||||
if ( fwrite( buffer, 1, n, fd ) < 0 ) {
|
||||
perror( d );
|
||||
return 3;
|
||||
}
|
||||
} while ( n > 0 );
|
||||
|
||||
fclose( fs );
|
||||
|
||||
/* Fix time stamp */
|
||||
if ( preserve_time )
|
||||
if ( setftime( fileno(fd), &When ) ) {
|
||||
perror( s );
|
||||
preserve_time = 0;
|
||||
}
|
||||
fclose( fd );
|
||||
|
||||
/* Fix access rights */
|
||||
if ( stat( s, &Stat ) )
|
||||
perror( s );
|
||||
else if ( chmod( d, Stat.st_mode ) )
|
||||
perror( d );
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main( int argc, char * argv[] )
|
||||
{
|
||||
char * progname;
|
||||
int verbose = 0;
|
||||
int only_if_newer= 0;
|
||||
char * suffix = NULL;
|
||||
char * mode = NULL;
|
||||
char * dest;
|
||||
char ** pp;
|
||||
|
||||
argv = argv_fix( &argc, argv );
|
||||
|
||||
progname = basename( *argv++ );
|
||||
|
||||
/* process the options */
|
||||
while ( argv[0] && argv[0][0] == '-' ) {
|
||||
switch ( argv[0][1] ) {
|
||||
case 'N':
|
||||
++argv;
|
||||
only_if_newer = 1;
|
||||
break;
|
||||
case 'c':
|
||||
++argv;
|
||||
/* We always copy, regardless */
|
||||
break;
|
||||
case 'v':
|
||||
++argv;
|
||||
verbose = 1;
|
||||
break;
|
||||
case 'V':
|
||||
++argv;
|
||||
suffix = *argv;
|
||||
++argv;
|
||||
break;
|
||||
case 'm':
|
||||
++argv;
|
||||
mode = *argv;
|
||||
++argv;
|
||||
break;
|
||||
default:
|
||||
fatal( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
/* Separate source file(s) from dest directory or file */
|
||||
#if 0
|
||||
if ( !argv[0] || !argv[1] )
|
||||
fatal( "missing files or invalid destination" );
|
||||
#else
|
||||
/* We used to require at least one file; not any more */
|
||||
if ( !argv[0] )
|
||||
fatal( "missing files or invalid destination" );
|
||||
if ( !argv[1] )
|
||||
return 0;
|
||||
#endif
|
||||
for ( pp = argv; *pp; ++pp )
|
||||
continue;
|
||||
--pp;
|
||||
dest = *pp;
|
||||
*pp = NULL;
|
||||
|
||||
/* Process the arguments */
|
||||
for (; *argv; ++argv ) {
|
||||
char * f = *argv;
|
||||
char * leaf = basename( f );
|
||||
char target[ 128 ];
|
||||
|
||||
strcpy( target, dest );
|
||||
|
||||
if ( is_dir( target ) ) {
|
||||
strcat( target, "/" );
|
||||
/* if we were given a suffix, then add it as appropriate */
|
||||
if ( suffix ) {
|
||||
char * dot = strchr( leaf, '.' );
|
||||
if ( dot ) {
|
||||
strncat( target, leaf, dot-leaf );
|
||||
strcat( target, suffix );
|
||||
strcat( target, dot );
|
||||
if ( verbose )
|
||||
printf( "%s: %s will be installed as %s",
|
||||
progname, f, strrchr(target,'/')+1 );
|
||||
} else {
|
||||
strcat( target, leaf );
|
||||
strcat( target, suffix );
|
||||
}
|
||||
} else {
|
||||
strcat( target, leaf );
|
||||
}
|
||||
}
|
||||
|
||||
if ( access( f, 0 ) ) {
|
||||
char buf[200];
|
||||
sprintf( buf, "cannot read %s", f );
|
||||
fatal( buf );
|
||||
}
|
||||
|
||||
if ( only_if_newer && is_file( target ) && !newer( f, target ) ) {
|
||||
if ( verbose )
|
||||
printf( "'%s' not newer than '%s'\n", f, target );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( verbose )
|
||||
printf( "rm -f %s\n", target );
|
||||
if ( chmod( target, 0777 ) )
|
||||
if ( verbose )
|
||||
perror( target );
|
||||
if ( unlink( target ) )
|
||||
if ( verbose )
|
||||
perror( target );
|
||||
if ( verbose )
|
||||
printf( "cp -p %s %s\n", f, target );
|
||||
if ( filecopy( target, f, 1 ) )
|
||||
return 1;
|
||||
if ( mode ) {
|
||||
char buf[ 255 ];
|
||||
sprintf( buf, "chmod %s %s\n", mode, target );
|
||||
if ( verbose )
|
||||
printf( "%s\n", buf );
|
||||
system( buf );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
begin 664 ifc.exe
|
||||
M(VEN8VQU9&4@/'-T9&EO+F@^#0HC:6YC;'5D92 \<W1R:6YG+F@^#0HC:6YC
|
||||
M;'5D92 \<')O8V5S<RYH/@T*#0HC:6YC;'5D92 \:6\N:#X-"@T*=F]I9" J
|
||||
M('AM86QL;V,H(&EN="!S:7IE("D-"GL-"B @("!V;VED("H@<" ]("AV;VED
|
||||
M("HI;6%L;&]C*"!S:7IE("D[#0H@(" @:68@*" A<" I("![#0H)9G!R:6YT
|
||||
M9B@@<W1D97)R+" B;W5T(&]F(&UE;6]R>5QN(B I.PT*"65X:70H(#$@*3L-
|
||||
M"B @("!]#0H@(" @<F5T=7)N(' [#0I]#0IV;VED("H@>')E86QL;V,H('9O
|
||||
M:60@*B!O;&0L(&EN="!S:7IE("D-"GL-"B @("!V;VED("H@<" ]("AV;VED
|
||||
M("HI<F5A;&QO8R@@;VQD+"!S:7IE("D[#0H@(" @:68@*" A<" I("![#0H)
|
||||
M9G!R:6YT9B@@<W1D97)R+" B;W5T(&]F(&UE;6]R>5QN(B I.PT*"65X:70H
|
||||
M(#$@*3L-"B @("!]#0H@(" @<F5T=7)N(' [#0I]#0H-"F-H87(@*BH@87)G
|
||||
M=E]F:7@H(&EN=" J(&%R9V,L(&-H87(@*BH@87)G=B I#0I[#0H@(" @8VAA
|
||||
M<B J*B!N97<@/2!.54Q,.PT*(" @(&EN=" @(" @;6%X(#T@,C [#0H@(" @
|
||||
M:6YT"2 @("!C;G0@/2 P.PT*(" @(&EN= D@(" @:CL-"@T*(" @(&9O<B H
|
||||
M(&H@/2 Q.R!A<F=V6VI=.R K*VH@*0T*"6EF("@@87)G=EMJ75LP72 ]/2 G
|
||||
M0"<@)B8@86-C97-S*&%R9W9;:ETK,2PP*3T]," I#0H)(" @(&)R96%K.PT*
|
||||
M(" @(&EF("@@87)G=EMJ72 ]/2!.54Q,("D-"@ER971U<FX@87)G=CL-"@T*
|
||||
M(" @(&YE=R ]("AC:&%R("HJ*7AM86QL;V,H(&UA>" J('-I>F5O9B J;F5W
|
||||
M("D[#0H@(" @;F5W6V-N="LK72 ]("IA<F=V*RL[#0H@(" @9F]R("@@.R J
|
||||
M87)G=CL@*RMA<F=V("D@('L-"@EI9B H(&-N=" ^/2!M87@@*0T*"2 @("!N
|
||||
M97<@/2 H8VAA<B J*BER96%L;&]C*"!N97<L("AM87@J/3(I("H@<VEZ96]F
|
||||
M("IN97<@*3L-"@D@(" @#0H):68@*"!A<F=V6S!=6S!=("$]("= )R!\?"!A
|
||||
M8V-E<W,H87)G=ELP72LQ+# I("D@('L-"@D@(" @;F5W6V-N="LK72 ]("IA
|
||||
M<F=V.PT*"7T@96QS92R(B I.PT*"2 @("!I
|
||||
M9B H("%F("D@('L-"@D)<&5R<F]R*"!A<F=V6S!=*S$@*3L-"@D)97AI="@@
|
||||
M,B I.PT*"2 @("!]#0H)(" @('=H:6QE("@@9F=E=',H(&QI;F4L('-I>F5O
|
||||
M9B!L:6YE+"!F("D@*2 @>PT*"0EI;G0@;&5N(#T@<W1R;&5N*"!L:6YE("D[
|
||||
M#0H)"2\J(&1E;&5T92!T<F%I;&EN9R!N97=L:6YE<R J+PT*"0EW:&EL92 H
|
||||
M(&QI;F5;;&5N+3%=(#T]("=<;B<@?'P@;&EN95ML96XM,5T@/3T@)UQR)R I
|
||||
M#0H)"2 @("!L:6YE6RTM;&5N72 ]("=<,"<[#0H)"6EF("@@8VYT(#X](&UA
|
||||
M>" I#0H)"2 @("!N97<@/2 H8VAA<B J*BEX<F5A;&QO8R@@;F5W+" H;6%X
|
||||
M*CTR*2 J('-I>F5O9B J;F5W("D[#0H)"6YE=UMC;G1=(#T@*&-H87(@*BEX
|
||||
M;6%L;&]C*"!L96XK,2 I.PT*"0ES=')C<'DH(&YE=UMC;G1=+"!L:6YE("D[
|
||||
M#0H)"2LK8VYT.PT*"2 @("!]#0H)(" @(&9C;&]S92@@9B I.PT*"7T)#0H@
|
||||
M(" @?0T*(" @(&EF("@@8VYT(#X](&UA>" I#0H);F5W(#T@*&-H87(@*BHI
|
||||
M>')E86QL;V,H(&YE=RP@*&UA>"LQ*2 J('-I>F5O9B J;F5W("D[#0H@(" @
|
||||
M;F5W6V-N=%T@/2!.54Q,.PT*(" @("IA<F=C(#T@8VYT.PT*(" @(')E='5R
|
||||
M;B!N97<[#0I]#0H-"@T*8V]N<W0@8VAA<B J(%5304=%(#T@#0HB=7-A9V4Z
|
||||
M("1P<F]G;F%M92!;("UC3G9M5B!=(&9I;&4@6R!F:6QE("XN+B!=(&1E<W0M
|
||||
M9&ER96-T;W)Y+6]R+69I;&5<;B(-"B(@(" @(" @("UV(" @(" @(" @("TM
|
||||
M('9E<F)O<V5<;B(-"B(@(" @(" @("U6('-U9F9I>" @("TM('-U9F9I>"!T
|
||||
M;R!A<'!E;F0@=&\@=&%R9V5T<R H8F5F;W)E(&%N>2 N('-U9F9I>"E<;B(-
|
||||
M"B(@(" @(" @(" @(" @(" @(" @(" @("!E9SH@+58@7V<@=V]U;&0@8VAA
|
||||
M;F=E("=F;V\G('1O("=F;V]?9R<@86YD7&XB#0HB(" @(" @(" @(" @(" @
|
||||
M(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" G;&EB9F]O+F$G('1O
|
||||
M("=L:6)F;V]?9RYA)UQN(@T*(B @(" @(" @+6T@;6]D92 @(" @+2T@;6]D
|
||||
M92!F;W(@;F5W(&9I;&4H<RE<;B(-"B(@(" @(" @("UC(" @(" @(" @("TM
|
||||
M(&-O<'D@:6YS=&5A9"!O9B!M;W9E("AA;'=A>7,@;VXI7&XB#0HB(" @(" @
|
||||
M(" M3B @(" @(" @(" M+2!C;W!Y(&]N;'D@:68@<V]U<F-E(&ES(&YE=V5R
|
||||
M('1H86X@=&%R9V5T7&XB#0H[#0H-"G9O:60@9F%T86PH(&-H87(@*B!M<V<@
|
||||
M*0T*>PT*(" @(&EF("@@;7-G("D-"@EF<')I;G1F*"!S=&1E<G(L("(E<UQN
|
||||
M(BP@;7-G("D[#0H@(" @9G!R:6YT9B@@<W1D97)R+" B)7,B+"!54T%'12 I
|
||||
M.PT*(" @(&5X:70H(#$@*3L-"GT-"@T*8VAA<B J(&)A<V5N86UE*"!C:&%R
|
||||
M("H@9B I#0I[#0H@(" @8VAA<B J(&(@/2!S=')R8VAR*"!F+" G+R<@*3L-
|
||||
M"B @("!I9B H(&(@*0DK*V([#0H@(" @96QS90EB(#T@9CL-"B @("!R971U
|
||||
M<FX@8CL-"GT-"@T*(VEN8VQU9&4@/'-Y<R]S=&%T+F@^#0II;G0@:7-?9&ER
|
||||
M*"!C:&%R("H@<&%T:" I#0I[#0H@(" @<W1R=6-T('-T870@8G5F.PT*(" @
|
||||
M(&EF("@@<W1A="@@<&%T:"P@)F)U9B I("D-"@ER971U<FX@,#L-"B @("!R
|
||||
M971U<FX@8G5F+G-T7VUO9&4@)B!37TE&1$E2.PT*?0T*:6YT(&ES7V9I;&4H
|
||||
M(&-H87(@*B!P871H("D-"GL-"B @("!S=')U8W0@<W1A="!B=68[#0H@(" @
|
||||
M:68@*"!S=&%T*"!P871H+" F8G5F("D@*0T*"7)E='5R;B P.PT*(" @(')E
|
||||
M='5R;B!B=68N<W1?;6]D92 F(%-?249214<[#0I]#0II;G0@;F5W97(H(&-H
|
||||
M87(@*B!P,2P@8VAA<B J(' R("D-"GL-"B @("!S=')U8W0@<W1A="!B=68Q
|
||||
M.PT*(" @('-T<G5C="!S=&%T(&)U9C([#0H@(" @:68@*"!S=&%T*"!P,2P@
|
||||
M)F)U9C$@*2 I#0H)<F5T=7)N(# [#0H@(" @:68@*"!S=&%T*"!P,BP@)F)U
|
||||
M9C(@*2 I#0H)<F5T=7)N(# [#0H@(" @<F5T=7)N(&)U9C$N<W1?;71I;64@
|
||||
M/B!B=68R+G-T7VUT:6UE.PT*?0T*#0II;G0@9FEL96-O<'DH(&-H87(@*B!D
|
||||
M+"!C:&%R("H@<RP@:6YT('!R97-E<G9E7W1I;64@*0T*>PT*(VEF(# -"B @
|
||||
M("!I;G0)"7-T871U<SL-"B @("!C:&%R(" @(" @*B!A<F=V6R U(%T[#0H@
|
||||
M(" @87)G=ELP72 ](")C<"([#0H@(" @87)G=ELQ72 ]("(M<"([#0H@(" @
|
||||
M87)G=ELR72 ](',[#0H@(" @87)G=ELS72 ](&0[#0H@(" @87)G=ELT72 ]
|
||||
M($Y53$P[#0H@(" @<W1A='5S(#T@<W!A=VYV<"@@4%]704E4+"!A<F=V6S!=
|
||||
M+"!A<F=V("D[#0H@(" @:68@*"!S=&%T=7,@*0T*"7!E<G)O<B@@(F-P(B I
|
||||
M.PT*(" @(')E='5R;B!S=&%T=7,[#0HC96QS90T*(" @($9)3$4@(" @(" J
|
||||
M(&9S.PT*(" @($9)3$4@(" @(" J(&9D.PT*(" @(&-H87()8G5F9F5R6R X
|
||||
M,3DR(%T[#0H@(" @:6YT"0EN.PT*(" @('-T<G5C="!F=&EM90E7:&5N.PT*
|
||||
M(" @('-T<G5C="!S=&%T"0E3=&%T.PT*#0H@(" @9G,@/2!F;W!E;B@@<RP@
|
||||
M(G)B(B I.PT*(" @(&EF("@@9G,@/3T@3E5,3" I("![#0H)<&5R<F]R*"!S
|
||||
M("D[#0H)<F5T=7)N(#$[#0H@(" @?0T*(" @(&9D(#T@9F]P96XH(&0L(")W
|
||||
M8B(@*3L-"B @("!I9B H(&9D(#T]($Y53$P@*2 @>PT*"7!E<G)O<B@@9" I
|
||||
M.PT*"69C;&]S92@@9G,@*3L-"@ER971U<FX@,CL-"B @("!]#0H-"B @("!I
|
||||
M9B H('!R97-E<G9E7W1I;64@*0T*"6EF("@@9V5T9G1I;64H(&9I;&5N;RAF
|
||||
M<RDL("97:&5N("D@*2 @>PT*"2 @("!P97)R;W(H(',@*3L-"@D@(" @<')E
|
||||
M<V5R=F5?=&EM92 ](# [#0H)?0T*#0H@(" @9&\@>PT*"6X@/2!F<F5A9"@@
|
||||
M8G5F9F5R+" Q+"!S:7IE;V8@8G5F9F5R+"!F<R I.PT*"6EF("@@;B ^(# @
|
||||
M*0T*"2 @("!I9B H(&9W<FET92@@8G5F9F5R+" Q+"!N+"!F9" I(#P@," I
|
||||
M("![#0H)"7!E<G)O<B@@9" I.PT*"0ER971U<FX@,SL-"@D@(" @?0T*(" @
|
||||
M('T@=VAI;&4@*"!N(#X@," I.R @(" -"@T*(" @(&9C;&]S92@@9G,@*3L-
|
||||
M"@T*(" @("\J($9I>"!T:6UE('-T86UP("HO#0H@(" @:68@*"!P<F5S97)V
|
||||
M95]T:6UE("D-"@EI9B H('-E=&9T:6UE*"!F:6QE;F\H9F0I+" F5VAE;B I
|
||||
M("D@('L-"@D@(" @<&5R<F]R*"!S("D[#0H)(" @('!R97-E<G9E7W1I;64@
|
||||
M/2 P.PT*"7T-"B @("!F8VQO<V4H(&9D("D[#0H-"B @(" O*B!&:7@@86-C
|
||||
M97-S(')I9VAT<R J+PT*(" @(&EF("@@<W1A="@@<RP@)E-T870@*2 I#0H)
|
||||
M<&5R<F]R*"!S("D[#0H@(" @96QS92!I9B H(&-H;6]D*"!D+"!3=&%T+G-T
|
||||
M7VUO9&4@*2 I#0H)<&5R<F]R*"!D("D[#0H-"B @("!R971U<FX@,#L-"B-E
|
||||
M;F1I9@T*?0T*#0H-"@T*#0H-"FEN="!M86EN*"!I;G0@87)G8RP@8VAA<B J
|
||||
M(&%R9W9;72 I#0I[#0H@(" @8VAA<B J"7!R;V=N86UE.PT*(" @(&EN= D)
|
||||
M=F5R8F]S92 ](# [#0H@(" @:6YT"0EO;FQY7VEF7VYE=V5R/2 P.PT*(" @
|
||||
M(&-H87(@*@ES=69F:7@@(#T@3E5,3#L-"B @("!C:&%R("H);6]D90D]($Y5
|
||||
M3$P[#0H@(" @8VAA<B J( ED97-T.PT*(" @(&-H87(@*BH)<' [#0H-"B @
|
||||
M("!A<F=V(#T@87)G=E]F:7@H("9A<F=C+"!A<F=V("D[#0H-"B @("!P<F]G
|
||||
M;F%M92 ](&)A<V5N86UE*" J87)G=BLK("D[#0H-"B @(" O*B!P<F]C97-S
|
||||
M('1H92!O<'1I;VYS("HO#0H@(" @=VAI;&4@*"!A<F=V6S!=(" F)B @87)G
|
||||
M=ELP75LP72 ]/2 G+2<@*2 @>PT*"7-W:71C:" H(&%R9W9;,%U;,5T@*2 @
|
||||
M>PT*"2 @("!C87-E("=.)SH-"@D@(" @(" @("LK87)G=CL-"@D);VYL>5]I
|
||||
M9E]N97=E<B ](#$[#0H)"6)R96%K.PT*"2 @("!C87-E("=C)SH-"@D@(" @
|
||||
M(" @("LK87)G=CL-"@D)+RH@5V4@86QW87ES(&-O<'DL(')E9V%R9&QE<W,@
|
||||
M*B\-"@D)8G)E86L[#0H)(" @(&-A<V4@)W8G.@T*"0DK*V%R9W8[#0H)"79E
|
||||
M<F)O<V4@/2 Q.PT*"0EB<F5A:SL-"@D@(" @8V%S92 G5B<Z#0H)"2LK87)G
|
||||
M=CL-"@D)<W5F9FEX(#T@*F%R9W8[#0H)"2LK87)G=CL-"@D)8G)E86L[#0H)
|
||||
M(" @(&-A<V4@)VTG.@T*"0DK*V%R9W8[#0H)"6UO9&4@/2 J87)G=CL-"@D)
|
||||
M*RMA<F=V.PT*"0EB<F5A:SL-"@D@(" @9&5F875L=#H-"@D)9F%T86PH($Y5
|
||||
M3$P@*3L-"@E]#0H@(" @?0T*#0H@(" @+RH@4V5P87)A=&4@<V]U<F-E(&9I
|
||||
M;&4H<RD@9G)O;2!D97-T(&1I<F5C=&]R>2!O<B!F:6QE("HO#0HC:68@, T*
|
||||
M(" @(&EF("@@(6%R9W9;,%T@?'P@(6%R9W9;,5T@*0T*"69A=&%L*" B;6ES
|
||||
M<VEN9R!F:6QE<R!O<B!I;G9A;&ED(&1E<W1I;F%T:6]N(B I.PT*(V5L<V4-
|
||||
M"B @(" O*B!792!U<V5D('1O(')E<75I<F4@870@;&5A<W0@;VYE(&9I;&4[
|
||||
M(&YO="!A;GD@;6]R92 J+PT*(" @(&EF("@@(6%R9W9;,%T@*0T*"69A=&%L
|
||||
M*" B;6ES<VEN9R!F:6QE<R!O<B!I;G9A;&ED(&1E<W1I;F%T:6]N(B I.PT*
|
||||
M(" @(&EF("@@(6%R9W9;,5T@*0T*"7)E='5R;B P.PT*(V5N9&EF#0H@(" @
|
||||
M9F]R("@@<' @/2!A<F=V.R J<' [("LK<' @*0T*"6-O;G1I;G5E.PT*(" @
|
||||
M("TM<' [#0H@(" @9&5S=" ]("IP<#L-"B @(" J<' @/2!.54Q,.PT*#0H@
|
||||
M(" @+RH@4')O8V5S<R!T:&4@87)G=6UE;G1S("HO#0H@(" @9F]R("@[("IA
|
||||
M<F=V.R K*V%R9W8@*2 @>PT*"6-H87(@*B!F(#T@*F%R9W8[#0H)8VAA<B J
|
||||
M(&QE868@/2!B87-E;F%M92@@9B I.PT*"6-H87(@=&%R9V5T6R Q,C@@73L-
|
||||
M"@T*"7-T<F-P>2@@=&%R9V5T+"!D97-T("D[#0H-"@EI9B H(&ES7V1I<B@@
|
||||
M=&%R9V5T("D@*2 @>PT*"2 @("!S=')C870H('1A<F=E="P@(B\B("D[#0H)
|
||||
M(" @("\J(&EF('=E('=E<F4@9VEV96X@82!S=69F:7@L('1H96X@861D(&ET
|
||||
M(&%S(&%P<')O<')I871E("HO#0H)(" @(&EF("@@<W5F9FEX("D@('L-"@D)
|
||||
M8VAA<B J(&1O=" ]('-T<F-H<B@@;&5A9BP@)RXG("D[#0H)"6EF("@@9&]T
|
||||
M("D@('L-"@D)(" @('-T<FYC870H('1A<F=E="P@;&5A9BP@9&]T+6QE868@
|
||||
M*3L-"@D)(" @('-T<F-A="@@=&%R9V5T+"!S=69F:7@@*3L-"@D)(" @('-T
|
||||
M<F-A="@@=&%R9V5T+"!D;W0@*3L-"@D)(" @(&EF("@@=F5R8F]S92 I#0H)
|
||||
M"0EP<FEN=&8H("(E<SH@)7,@=VEL;"!B92!I;G-T86QL960@87,@)7,B+ T*
|
||||
M"0D)(" @(" @('!R;V=N86UE+"!F+"!S=')R8VAR*'1A<F=E="PG+R<I*S$@
|
||||
M*3L-"@D)?2!E;'-E('L-"@D)(" @('-T<F-A="@@=&%R9V5T+"!L96%F("D[
|
||||
M#0H)"2 @("!S=')C870H('1A<F=E="P@<W5F9FEX("D[#0H)"7T-"@D@(" @
|
||||
M?2!E;'-E('L-"@D)<W1R8V%T*"!T87)G970L(&QE868@*3L-"@D@(" @?0T*
|
||||
M"7T-"@T*"6EF("@@86-C97-S*"!F+" P("D@*2 @>PT*"2 @("!C:&%R(&)U
|
||||
M9ELR,#!=.PT*"2 @("!S<')I;G1F*"!B=68L(")C86YN;W0@<F5A9" E<R(L
|
||||
M(&8@*3L-"@D@(" @9F%T86PH(&)U9B I.PT*"7T-"@T*"6EF("@@;VYL>5]I
|
||||
M9E]N97=E<B F)B!I<U]F:6QE*"!T87)G970@*2 F)B A;F5W97(H(&8L('1A
|
||||
M<F=E=" I("D@('L-"@D@(" @:68@*"!V97)B;W-E("D-"@D)<')I;G1F*" B
|
||||
M)R5S)R!N;W0@;F5W97(@=&AA;B G)7,G7&XB+"!F+"!T87)G970@*3L-"@D@
|
||||
M(" @8V]N=&EN=64[#0H)?0T*#0H):68@*"!V97)B;W-E("D-"@D@(" @<')I
|
||||
M;G1F*" B<FT@+68@)7-<;B(L('1A<F=E=" I.PT*"6EF("@@8VAM;V0H('1A
|
||||
M<F=E="P@,#<W-R I("D-"@D@(" @:68@*"!V97)B;W-E("D-"@D)<&5R<F]R
|
||||
M*"!T87)G970@*3L-"@EI9B H('5N;&EN:R@@=&%R9V5T("D@*0T*"2 @("!I
|
||||
M9B H('9E<F)O<V4@*0T*"0EP97)R;W(H('1A<F=E=" I.PT*"6EF("@@=F5R
|
||||
M8F]S92 I#0H)(" @('!R:6YT9B@@(F-P("UP("5S("5S7&XB+"!F+"!T87)G
|
||||
M970@*3L-"@EI9B H(&9I;&5C;W!Y*"!T87)G970L(&8L(#$@*2 I#0H)(" @
|
||||
M(')E='5R;B Q.PT*"6EF("@@;6]D92 I("![#0H)(" @(&-H87(@8G5F6R R
|
||||
M-34@73L-"@D@(" @<W!R:6YT9B@@8G5F+" B8VAM;V0@)7,@)7-<;B(L(&UO
|
||||
M9&4L('1A<F=E=" I.PT*"2 @("!I9B H('9E<F)O<V4@*0T*"0EP<FEN=&8H
|
||||
M("(E<UQN(BP@8G5F("D[#0H)(" @('-Y<W1E;2@@8G5F("D[#0H)?0T*(" @
|
||||
:('T-"@T*(" @(')E='5R;B P.PT*?0T*#0IE
|
||||
|
||||
end
|
||||
@@ -1,25 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_SCRIPTS=\
|
||||
install-if-change \
|
||||
lock-directory \
|
||||
unlock-directory \
|
||||
rcs-clean
|
||||
|
||||
noinst_SCRIPTS = search-id.sh
|
||||
|
||||
#
|
||||
# HACK: install to the build-tree
|
||||
#
|
||||
install-exec-local: $(bin_SCRIPTS)
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
$(INSTALL_SCRIPT) $(bin_SCRIPTS) \
|
||||
$(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
|
||||
preinstall: install-exec-local
|
||||
|
||||
include $(top_srcdir)/../../automake/local.am
|
||||
@@ -1,258 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
EXEEXT = @EXEEXT@
|
||||
KSH = @KSH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
PACKAGE = @PACKAGE@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
RTEMS_ROOT = @RTEMS_ROOT@
|
||||
RTEMS_TOPdir = @RTEMS_TOPdir@
|
||||
VERSION = @VERSION@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_SCRIPTS = install-if-change lock-directory unlock-directory rcs-clean
|
||||
|
||||
|
||||
noinst_SCRIPTS = search-id.sh
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
|
||||
CONFIG_HEADER = ../src/config.h
|
||||
CONFIG_CLEAN_FILES = install-if-change lock-directory rcs-clean \
|
||||
unlock-directory
|
||||
SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS)
|
||||
|
||||
DIST_COMMON = README Makefile.am Makefile.in install-if-change.in \
|
||||
lock-directory.in rcs-clean.in unlock-directory.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/../../automake/local.am
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign scripts/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
install-if-change: $(top_builddir)/config.status install-if-change.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
lock-directory: $(top_builddir)/config.status lock-directory.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
rcs-clean: $(top_builddir)/config.status rcs-clean.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
unlock-directory: $(top_builddir)/config.status unlock-directory.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else :; fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-binSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = scripts
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign scripts/Makefile
|
||||
@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
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-binSCRIPTS install-exec-local
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-binSCRIPTS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(SCRIPTS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
|
||||
|
||||
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-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-generic clean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: uninstall-binSCRIPTS install-binSCRIPTS tags distdir info-am \
|
||||
info dvi-am dvi check check-am installcheck-am installcheck \
|
||||
install-exec-local 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
|
||||
|
||||
|
||||
#
|
||||
# HACK: install to the build-tree
|
||||
#
|
||||
install-exec-local: $(bin_SCRIPTS)
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
$(INSTALL_SCRIPT) $(bin_SCRIPTS) \
|
||||
$(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
|
||||
preinstall: install-exec-local
|
||||
|
||||
debug-am:
|
||||
|
||||
debug: debug-am
|
||||
|
||||
debug_install-am:
|
||||
|
||||
debug_install: debug_install-am
|
||||
|
||||
.PHONY: debug debug_install debug-am
|
||||
|
||||
profile-am:
|
||||
|
||||
profile: profile-am
|
||||
|
||||
profile_install-am:
|
||||
|
||||
profile_install: profile_install-am
|
||||
|
||||
.PHONY: profile profile_install profile-am
|
||||
|
||||
preinstall-am:
|
||||
|
||||
preinstall: preinstall-am
|
||||
|
||||
.PHONY: preinstall preinstall-am
|
||||
|
||||
# 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:
|
||||
@@ -1,24 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
Misc. support tools for RTEMS workspaces.
|
||||
More will be added later as they are converted from Teamware
|
||||
to CVS.
|
||||
|
||||
install-if-change
|
||||
Smart install script that also can append suffixes as it
|
||||
installs (suffixes used for debug and profile variants).
|
||||
Requires bash or ksh.
|
||||
|
||||
rcs-clean
|
||||
deletes all files from the current directory that can be
|
||||
re-created from RCS. Careful to not delete locked files.
|
||||
May be used by 'gmake clobber'
|
||||
|
||||
lock-directory
|
||||
unlock-directory
|
||||
traverse a directory structure making it unwritable.
|
||||
Useful to keep people from accidentally overwriting
|
||||
"released" trees if they get confused about which
|
||||
module they have loaded.
|
||||
@@ -1,142 +0,0 @@
|
||||
#!@KSH@ -p
|
||||
#
|
||||
# Either bash or ksh will be ok for this; requires (( )) arithmetic
|
||||
# (-p above just says to not parse $ENV file; makes it faster for
|
||||
# those of us who set $ENV)
|
||||
#
|
||||
# install files if they have changed by running 'cmp', then 'install'
|
||||
# as necessary.
|
||||
#
|
||||
# Optionally, can append a suffix before last existing suffix (if any)
|
||||
#
|
||||
# NOTE
|
||||
# We avoid using typical install(1M) programs since they have
|
||||
# large variability across systems and we also need to support ou
|
||||
# -V option.
|
||||
# So we just copy and chmod by hand.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
progname=`basename $0`
|
||||
#progname=${0##*/} # fast basename hack for ksh, bash
|
||||
|
||||
USAGE=\
|
||||
"usage: $progname [ -vmV ] file [ file ... ] dest-directory-or-file
|
||||
-v -- verbose
|
||||
-V suffix -- suffix to append to targets (before any . suffix)
|
||||
eg: -V _g would change 'foo' to 'foo_g' and
|
||||
'libfoo.a' to 'libfoo_g.a'
|
||||
-m mode -- mode for new file(s)"
|
||||
|
||||
fatal() {
|
||||
if [ "$1" ]
|
||||
then
|
||||
echo $* >&2
|
||||
fi
|
||||
echo "$USAGE" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
#
|
||||
# process the options
|
||||
#
|
||||
|
||||
verbose=""
|
||||
suffix=""
|
||||
mode=""
|
||||
|
||||
while getopts vm:V: OPT
|
||||
do
|
||||
case "$OPT" in
|
||||
v)
|
||||
verbose="yes";;
|
||||
V)
|
||||
eval suffix=$OPTARG;;
|
||||
m)
|
||||
mode="$OPTARG";;
|
||||
*)
|
||||
fatal
|
||||
esac
|
||||
done
|
||||
|
||||
shiftcount=`expr $OPTIND - 1`
|
||||
shift $shiftcount
|
||||
|
||||
args=$*
|
||||
|
||||
#
|
||||
# Separate source file(s) from dest directory or file
|
||||
#
|
||||
|
||||
files=""
|
||||
dest=""
|
||||
for d in $args
|
||||
do
|
||||
files="$files $dest"
|
||||
dest=$d
|
||||
done
|
||||
|
||||
if [ ! "$files" ] || [ ! "$dest" ]
|
||||
then
|
||||
fatal "missing files or invalid destination"
|
||||
fi
|
||||
|
||||
#
|
||||
# Process the arguments
|
||||
#
|
||||
|
||||
targets=""
|
||||
for f in $files
|
||||
do
|
||||
# leaf=`basename $f`
|
||||
leaf=${f##*/} # fast basename hack for ksh, bash
|
||||
|
||||
target=$dest
|
||||
if [ -d $dest ]
|
||||
then
|
||||
# if we were given a suffix, then add it as appropriate
|
||||
if [ "$suffix" ]
|
||||
then
|
||||
case $f in
|
||||
*.*)
|
||||
# leaf=`echo $leaf |
|
||||
# /bin/sed "s/\([~\.]*\)\.\(.*\)$/\1$suffix.\2/"`
|
||||
# ksh,bash hack for above sed script
|
||||
leaf=${leaf%%.*}$suffix.${leaf#*.}
|
||||
|
||||
[ "$verbose" = "yes" ] &&
|
||||
echo "$progname: $f will be installed as $leaf"
|
||||
;;
|
||||
*)
|
||||
leaf=$leaf$suffix;;
|
||||
esac
|
||||
fi
|
||||
target=$target/$leaf
|
||||
fi
|
||||
|
||||
[ ! -r $f ] && fatal "can not read $f"
|
||||
|
||||
if cmp -s $f $target
|
||||
then
|
||||
[ "$verbose" = "yes" ] && echo "'$f' not newer than '$target'"
|
||||
else
|
||||
[ "$verbose" = "yes" ] && echo "rm -f $target"
|
||||
rm -f $target
|
||||
echo "cp -p $f $target"
|
||||
cp -p $f $target || exit 1
|
||||
targets="$targets $target" # keep list for chmod below
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$mode" -a "$targets" ]
|
||||
then
|
||||
[ "$verbose" = "yes" ] && echo "chmod $mode $targets"
|
||||
chmod $mode $targets
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables: ***
|
||||
# mode:ksh ***
|
||||
# End: ***
|
||||
@@ -1,43 +0,0 @@
|
||||
#!@KSH@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Make a directory write protected
|
||||
# Used to write protect the install point after a build
|
||||
# to prevent inadvertant overwriting.
|
||||
#
|
||||
|
||||
# is a particular command available on this machine?
|
||||
#
|
||||
cmd_avail()
|
||||
{
|
||||
set -- `type $1 2>&1`
|
||||
if [ "$2" = "not" -a "$3" = "found" ] || [ "$3" = "not" -a "$4" = "found" ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
lock_directory() {
|
||||
l_dir=$1/. # get any symlink out of the way using '.'
|
||||
if [ -d $l_dir ]
|
||||
then
|
||||
find $l_dir -type d -perm -0200 -print | $XARGS chmod -w
|
||||
fi
|
||||
}
|
||||
|
||||
# Use gnu xargs if available; faster, more reliable in general
|
||||
XARGS=xargs
|
||||
cmd_avail gxargs && XARGS=gxargs
|
||||
|
||||
for dir
|
||||
do
|
||||
lock_directory $dir
|
||||
done
|
||||
|
||||
# Local Variables: ***
|
||||
# mode:ksh ***
|
||||
# End: ***
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
#!@KSH@ -p
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Delete all files from the current directory that can be recreated
|
||||
# via RCS 'co' commonds
|
||||
# Used by 'make clobber'
|
||||
#
|
||||
|
||||
progname=${0##*/} # fast basename hack for ksh, bash
|
||||
|
||||
USAGE=\
|
||||
"usage: $progname [ -v ]"
|
||||
|
||||
fatal() {
|
||||
if [ "$1" ]
|
||||
then
|
||||
echo $* >&2
|
||||
fi
|
||||
echo "$USAGE" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
#
|
||||
# process the options
|
||||
#
|
||||
|
||||
verbose=""
|
||||
|
||||
while getopts v OPT
|
||||
do
|
||||
case "$OPT" in
|
||||
v)
|
||||
verbose="yes";;
|
||||
*)
|
||||
fatal
|
||||
esac
|
||||
done
|
||||
|
||||
let $((shiftcount = $OPTIND - 1))
|
||||
shift $shiftcount
|
||||
|
||||
args=$*
|
||||
[ "$args" ] && fatal
|
||||
|
||||
[ -d RCS/. ] || exit 0
|
||||
|
||||
# there is probably a better way to do this
|
||||
|
||||
rcs_files=`echo RCS/*,v | sed -e 's?RCS/??g' -e's/,v//g'`
|
||||
|
||||
kills=""
|
||||
for f in $rcs_files
|
||||
do
|
||||
# build list of all files in RCS/*,v that are *not* locked
|
||||
if [ -f $f ] && [ ! -w $f ] && [ -f RCS/$f,v ]
|
||||
then
|
||||
locked=`rlog -L -R $f`
|
||||
[ "$locked" = "" ] && kills="$kills $f"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$kills" ]
|
||||
then
|
||||
[ "$verbose" ] && echo rm -f $kills
|
||||
rm -f $kills
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables: ***
|
||||
# mode:ksh ***
|
||||
# End: ***
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
find $1 -type f -a ! -name "*.scn" -a ! -name "bsp_specs" -a \
|
||||
-print > /tmp/$$.0
|
||||
find $1 -type f -a ! -name "*.scn" -a ! -name "bsp_specs" -a \
|
||||
-exec grep -l '$Id' {} \; > /tmp/$$.1
|
||||
|
||||
diff /tmp/$$.0 /tmp/$$.1 > /tmp/$$.2
|
||||
|
||||
grep "<" /tmp/$$.2 | sed 's/< //' >&1
|
||||
|
||||
rm -f /tmp/$$*
|
||||
@@ -1,41 +0,0 @@
|
||||
#!@KSH@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Unlock a directory processed by lock_directory
|
||||
#
|
||||
|
||||
# is a particular command available on this machine?
|
||||
#
|
||||
cmd_avail()
|
||||
{
|
||||
set -- `type $1 2>&1`
|
||||
if [ "$2" = "not" -a "$3" = "found" ] || [ "$3" = "not" -a "$4" = "found" ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
unlock_directory() {
|
||||
ul_dir=$1/. # get any symlink out of the way using '.'
|
||||
if [ -d $ul_dir ]
|
||||
then
|
||||
find $ul_dir -type d ! -perm -0222 -print | $XARGS -t chmod +w
|
||||
fi
|
||||
}
|
||||
|
||||
# Use gnu xargs if available; faster, more reliable in general
|
||||
XARGS=xargs
|
||||
cmd_avail gxargs && XARGS=gxargs
|
||||
|
||||
for dir
|
||||
do
|
||||
unlock_directory $dir
|
||||
done
|
||||
|
||||
# Local Variables: ***
|
||||
# mode:ksh ***
|
||||
# End: ***
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_PROGRAMS=cklength eolstrip packhex unhex
|
||||
|
||||
cklength_SOURCES = cklength.c
|
||||
eolstrip_SOURCES = eolstrip.c
|
||||
packhex_SOURCES = packhex.c
|
||||
unhex_SOURCES = unhex.c
|
||||
|
||||
#
|
||||
# HACK: install to the build-tree
|
||||
#
|
||||
install-exec-local: $(bin_PROGRAMS)
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
$(INSTALL_PROGRAM) $(bin_PROGRAMS) \
|
||||
$(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
|
||||
preinstall: install-exec-local
|
||||
|
||||
include $(top_srcdir)/../../automake/local.am
|
||||
@@ -1,424 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
EXEEXT = @EXEEXT@
|
||||
KSH = @KSH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
PACKAGE = @PACKAGE@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
RTEMS_ROOT = @RTEMS_ROOT@
|
||||
RTEMS_TOPdir = @RTEMS_TOPdir@
|
||||
VERSION = @VERSION@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
bin_PROGRAMS = cklength eolstrip packhex unhex
|
||||
|
||||
cklength_SOURCES = cklength.c
|
||||
eolstrip_SOURCES = eolstrip.c
|
||||
packhex_SOURCES = packhex.c
|
||||
unhex_SOURCES = unhex.c
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
bin_PROGRAMS = cklength$(EXEEXT) eolstrip$(EXEEXT) packhex$(EXEEXT) \
|
||||
unhex$(EXEEXT)
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I.
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
cklength_OBJECTS = cklength.o
|
||||
cklength_LDADD = $(LDADD)
|
||||
cklength_DEPENDENCIES =
|
||||
cklength_LDFLAGS =
|
||||
eolstrip_OBJECTS = eolstrip.o
|
||||
eolstrip_LDADD = $(LDADD)
|
||||
eolstrip_DEPENDENCIES =
|
||||
eolstrip_LDFLAGS =
|
||||
packhex_OBJECTS = packhex.o
|
||||
packhex_LDADD = $(LDADD)
|
||||
packhex_DEPENDENCIES =
|
||||
packhex_LDFLAGS =
|
||||
unhex_OBJECTS = unhex.o
|
||||
unhex_LDADD = $(LDADD)
|
||||
unhex_DEPENDENCIES =
|
||||
unhex_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = ./stamp-h.in Makefile.am Makefile.in config.h.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/cklength.P .deps/eolstrip.P .deps/packhex.P \
|
||||
.deps/unhex.P
|
||||
SOURCES = $(cklength_SOURCES) $(eolstrip_SOURCES) $(packhex_SOURCES) $(unhex_SOURCES)
|
||||
OBJECTS = $(cklength_OBJECTS) $(eolstrip_OBJECTS) $(packhex_OBJECTS) $(unhex_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .o .s
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/../../automake/local.am
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
config.h: stamp-h
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h; \
|
||||
$(MAKE) stamp-h; \
|
||||
else :; fi
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=src/config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h 2> /dev/null
|
||||
$(srcdir)/config.h.in: $(srcdir)/stamp-h.in
|
||||
@if test ! -f $@; then \
|
||||
rm -f $(srcdir)/stamp-h.in; \
|
||||
$(MAKE) $(srcdir)/stamp-h.in; \
|
||||
else :; fi
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
|
||||
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
|
||||
|
||||
.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:
|
||||
|
||||
cklength$(EXEEXT): $(cklength_OBJECTS) $(cklength_DEPENDENCIES)
|
||||
@rm -f cklength$(EXEEXT)
|
||||
$(LINK) $(cklength_LDFLAGS) $(cklength_OBJECTS) $(cklength_LDADD) $(LIBS)
|
||||
|
||||
eolstrip$(EXEEXT): $(eolstrip_OBJECTS) $(eolstrip_DEPENDENCIES)
|
||||
@rm -f eolstrip$(EXEEXT)
|
||||
$(LINK) $(eolstrip_LDFLAGS) $(eolstrip_OBJECTS) $(eolstrip_LDADD) $(LIBS)
|
||||
|
||||
packhex$(EXEEXT): $(packhex_OBJECTS) $(packhex_DEPENDENCIES)
|
||||
@rm -f packhex$(EXEEXT)
|
||||
$(LINK) $(packhex_LDFLAGS) $(packhex_OBJECTS) $(packhex_LDADD) $(LIBS)
|
||||
|
||||
unhex$(EXEEXT): $(unhex_OBJECTS) $(unhex_DEPENDENCIES)
|
||||
@rm -f unhex$(EXEEXT)
|
||||
$(LINK) $(unhex_LDFLAGS) $(unhex_OBJECTS) $(unhex_LDADD) $(LIBS)
|
||||
|
||||
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 = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = src
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign src/Makefile
|
||||
@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
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
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-binPROGRAMS install-exec-local
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-binPROGRAMS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(PROGRAMS) config.h
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
|
||||
|
||||
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-binPROGRAMS \
|
||||
mostlyclean-compile mostlyclean-tags mostlyclean-depend \
|
||||
mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-tags \
|
||||
clean-depend clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
|
||||
distclean-tags distclean-depend distclean-generic \
|
||||
clean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
|
||||
maintainer-clean-compile maintainer-clean-tags \
|
||||
maintainer-clean-depend maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
|
||||
distclean-depend clean-depend maintainer-clean-depend info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck all-recursive-am \
|
||||
install-exec-local 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
|
||||
|
||||
|
||||
#
|
||||
# HACK: install to the build-tree
|
||||
#
|
||||
install-exec-local: $(bin_PROGRAMS)
|
||||
$(mkinstalldirs) $(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
$(INSTALL_PROGRAM) $(bin_PROGRAMS) \
|
||||
$(PROJECT_ROOT)/${RTEMS_BSP}/build-tools
|
||||
|
||||
preinstall: install-exec-local
|
||||
|
||||
debug-am:
|
||||
|
||||
debug: debug-am
|
||||
|
||||
debug_install-am:
|
||||
|
||||
debug_install: debug_install-am
|
||||
|
||||
.PHONY: debug debug_install debug-am
|
||||
|
||||
profile-am:
|
||||
|
||||
profile: profile-am
|
||||
|
||||
profile_install-am:
|
||||
|
||||
profile_install: profile_install-am
|
||||
|
||||
.PHONY: profile profile_install profile-am
|
||||
|
||||
preinstall-am:
|
||||
|
||||
preinstall: preinstall-am
|
||||
|
||||
.PHONY: preinstall preinstall-am
|
||||
|
||||
# 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:
|
||||
@@ -1,377 +0,0 @@
|
||||
/*
|
||||
* cklength - check the length of lines in a file
|
||||
*
|
||||
* This program check to see if the files passed to it on the command line
|
||||
* contain a line which exceeds the maximum allowable length. The default
|
||||
* maximum line length is 80.
|
||||
*
|
||||
* usage: cklength [ -v ] [ arg ... ] files...
|
||||
* -l length -- maximum line length
|
||||
* -v -- verbose
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define GETOPTARGS "l:nNv"
|
||||
|
||||
char *USAGE = "\
|
||||
usage: cklength [ -v ] [ arg ... ] files... \n\
|
||||
-l length -- maximum line length\n\
|
||||
-n -- report line numbers for offending lines\n\
|
||||
-N -- report line numbers and length for offending lines\n\
|
||||
-v -- verbose\n\
|
||||
\n\
|
||||
Print the name of files which have at least 1 line which exceeds the\n\
|
||||
maximum line length. The default maximum line length is 80.\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef VMS
|
||||
#ifndef HAVE_STRERROR
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
|
||||
#define strerror( _err ) \
|
||||
((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
|
||||
|
||||
#else /* HAVE_STRERROR */
|
||||
char *strerror ();
|
||||
#endif
|
||||
#else /* VMS */
|
||||
char *strerror (int,...);
|
||||
#endif
|
||||
|
||||
|
||||
#define BUFFER_SIZE 512
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1
|
||||
#define Failed(x) (((int) (x)) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
/*
|
||||
* Definitions for unsigned "ints"; especially for use in data structures
|
||||
* that will be shared among (potentially) different cpu's (we punt on
|
||||
* byte ordering problems tho)
|
||||
*/
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
int verbose = FALSE; /* be verbose */
|
||||
int report_line_numbers = FALSE; /* report line numbers of offenders */
|
||||
int report_line_length = FALSE; /* report line length of offenders */
|
||||
|
||||
int line_length = 80; /* maximum allowable line length */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind, opterr;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
int process(char *arg);
|
||||
void error(int errn, ...);
|
||||
long getparm(char *s, long min, long max, char *msg);
|
||||
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#define stol(p) strtol(p, (char **) NULL, 0)
|
||||
int Open(), Read(), Write();
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
register int c;
|
||||
int showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
opterr = 0; /* we'll report all errors */
|
||||
while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'l': /* line length */
|
||||
line_length = atoi( optarg );
|
||||
if ( line_length < 0 || line_length > BUFFER_SIZE )
|
||||
error(ERR_FATAL, "(%d) is illegal line length\n",line_length);
|
||||
break;
|
||||
|
||||
case 'n': /* toggle report_line_numbers */
|
||||
report_line_numbers = ! report_line_numbers;
|
||||
break;
|
||||
|
||||
case 'N': /* toggle both reports */
|
||||
report_line_numbers = ! report_line_numbers;
|
||||
report_line_length = ! report_line_length;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* traverse and process the arguments
|
||||
*/
|
||||
|
||||
for ( ; argv[optind]; optind++)
|
||||
if (Failed(process(argv[optind])))
|
||||
rc = FAILURE;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* process(arg)
|
||||
*/
|
||||
|
||||
int
|
||||
process(char *arg)
|
||||
{
|
||||
FILE *in;
|
||||
char *bptr;
|
||||
char buffer[ BUFFER_SIZE ];
|
||||
int line_number;
|
||||
int length;
|
||||
int count;
|
||||
int rc = SUCCESS; /* succeed by default */
|
||||
|
||||
in = fopen( arg, "r" );
|
||||
if (!in)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
|
||||
count = 0;
|
||||
|
||||
for ( line_number=1 ; ; line_number++ ) {
|
||||
bptr = fgets( buffer, BUFFER_SIZE, in );
|
||||
if (!bptr)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Don't count the carriage return.
|
||||
*/
|
||||
|
||||
length = strlen( buffer ) - 1;
|
||||
|
||||
if ( length <= line_length )
|
||||
continue;
|
||||
|
||||
if ( count == 0 ) {
|
||||
fprintf( stderr, "%s\n", arg );
|
||||
if ( !report_line_numbers )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( verbose )
|
||||
fprintf( stderr, "TOO LONG:%d: %s\n", line_number, buffer );
|
||||
|
||||
if ( report_line_numbers ) {
|
||||
if ( report_line_length )
|
||||
fprintf( stderr, "%d: %d\n" , line_number, length );
|
||||
else
|
||||
fprintf( stderr, "%d\n" , line_number );
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
}
|
||||
|
||||
fclose( in );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_FATAL bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
(void) fprintf(stderr, " (%s)\n", strerror(local_errno));
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long
|
||||
getparm(char *s,
|
||||
long min,
|
||||
long max,
|
||||
char *msg)
|
||||
{
|
||||
long val;
|
||||
|
||||
if ( ! strchr("0123456789-", *s))
|
||||
{
|
||||
error(ERR_FATAL, "'%s' is not a number", s);
|
||||
return min;
|
||||
}
|
||||
|
||||
val = strtol(s, (char **) NULL, 0);
|
||||
if ((val < min) || (val > max))
|
||||
{
|
||||
if (min == max)
|
||||
error(ERR_FATAL, "%s can only be %ld", s, min);
|
||||
else
|
||||
error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open()
|
||||
* Perform open(2), returning the file descriptor. Prints
|
||||
* error message if open fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Open(char *file,
|
||||
int oflag,
|
||||
int mode)
|
||||
{
|
||||
int O_fd;
|
||||
|
||||
if (Failed(O_fd = open(file, oflag, mode)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"open('%s', 0x%x, 0%o) failed", file, oflag, mode
|
||||
);
|
||||
|
||||
return O_fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read()
|
||||
* Perform read(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Read(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = read(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"read(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write()
|
||||
* Perform write(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Write(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = write(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"write(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
/* src/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#undef HAVE_STRERROR
|
||||
@@ -1,366 +0,0 @@
|
||||
/*
|
||||
* eolstrip - strip white space from end of lines
|
||||
*
|
||||
* This program strips the white space from the end of every line in the
|
||||
* specified program.
|
||||
*
|
||||
* usage: eolstrip [ -v ] [ arg ... ] files...
|
||||
* -v -- verbose
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define GETOPTARGS "vt"
|
||||
|
||||
char *USAGE = "\
|
||||
usage: cklength [ -v ] [ arg ... ] files... \n\
|
||||
-v -- verbose\n\
|
||||
-t -- test only .. DO NOT OVERWRITE FILE!!!\n\
|
||||
\n\
|
||||
Strip the white space from the end of every line on the list of files.\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef VMS
|
||||
#ifndef HAVE_STRERROR
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
|
||||
#define strerror( _err ) \
|
||||
((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
|
||||
|
||||
#else /* HAVE_STRERROR */
|
||||
char *strerror ();
|
||||
#endif
|
||||
#else /* VMS */
|
||||
char *strerror (int,...);
|
||||
#endif
|
||||
|
||||
|
||||
#define BUFFER_SIZE 2048
|
||||
#define MAX_PATH 2048
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1
|
||||
#define Failed(x) (((int) (x)) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
/*
|
||||
* Definitions for unsigned "ints"; especially for use in data structures
|
||||
* that will be shared among (potentially) different cpu's (we punt on
|
||||
* byte ordering problems tho)
|
||||
*/
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
int verbose = FALSE; /* be verbose */
|
||||
int test_only = FALSE; /* test only */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind, opterr;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
int process(char *arg);
|
||||
void error(int errn, ...);
|
||||
long getparm(char *s, long min, long max, char *msg);
|
||||
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#define stol(p) strtol(p, (char **) NULL, 0)
|
||||
int Open(), Read(), Write();
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
register int c;
|
||||
int showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
opterr = 0; /* we'll report all errors */
|
||||
while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 't': /* toggle test only mode */
|
||||
test_only = ! test_only;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* traverse and process the arguments
|
||||
*/
|
||||
|
||||
for ( ; argv[optind]; optind++)
|
||||
if (Failed(process(argv[optind])))
|
||||
rc = FAILURE;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* process(arg)
|
||||
*/
|
||||
|
||||
int
|
||||
process(char *arg)
|
||||
{
|
||||
FILE *in;
|
||||
FILE *out = (FILE *) 0;
|
||||
char outname[ MAX_PATH ];
|
||||
char *bptr;
|
||||
char buffer[ BUFFER_SIZE ];
|
||||
int length;
|
||||
int line_number;
|
||||
int rc = SUCCESS; /* succeed by default */
|
||||
|
||||
in = fopen( arg, "r" );
|
||||
if (!in)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
|
||||
if ( !test_only ) {
|
||||
sprintf( outname, "%s.eoltmp", arg );
|
||||
|
||||
out = fopen( outname, "w" );
|
||||
if (!out)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
}
|
||||
|
||||
if ( verbose )
|
||||
fprintf( stderr, "Processing %s\n", arg );
|
||||
|
||||
for ( line_number=1 ; ; line_number++ ) {
|
||||
bptr = fgets( buffer, BUFFER_SIZE, in );
|
||||
if (!bptr)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Don't count the carriage return.
|
||||
*/
|
||||
|
||||
length = strlen( buffer ) - 1;
|
||||
|
||||
if ( buffer[ length ] != '\n' )
|
||||
error(ERR_ERRNO|ERR_FATAL, "Line %d too long in %s\n", line_number, arg);
|
||||
|
||||
while ( isspace( (int) buffer[ length ] ) )
|
||||
buffer[ length-- ] = '\0';
|
||||
|
||||
if ( test_only ) {
|
||||
fprintf( stderr, "%s\n", arg );
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf( out, "%s\n", buffer );
|
||||
}
|
||||
|
||||
fclose( in );
|
||||
if ( !test_only ) {
|
||||
fclose( out );
|
||||
rename( outname, arg );
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_FATAL bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
(void) fprintf(stderr, " (%s)\n", strerror(local_errno));
|
||||
else
|
||||
(void) fprintf(stderr, "\n");
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long
|
||||
getparm(char *s,
|
||||
long min,
|
||||
long max,
|
||||
char *msg)
|
||||
{
|
||||
long val;
|
||||
|
||||
if ( ! strchr("0123456789-", *s))
|
||||
{
|
||||
error(ERR_FATAL, "'%s' is not a number", s);
|
||||
return min;
|
||||
}
|
||||
|
||||
val = strtol(s, (char **) NULL, 0);
|
||||
if ((val < min) || (val > max))
|
||||
{
|
||||
if (min == max)
|
||||
error(ERR_FATAL, "%s can only be %ld", s, min);
|
||||
else
|
||||
error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open()
|
||||
* Perform open(2), returning the file descriptor. Prints
|
||||
* error message if open fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Open(char *file,
|
||||
int oflag,
|
||||
int mode)
|
||||
{
|
||||
int O_fd;
|
||||
|
||||
if (Failed(O_fd = open(file, oflag, mode)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"open('%s', 0x%x, 0%o) failed", file, oflag, mode
|
||||
);
|
||||
|
||||
return O_fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read()
|
||||
* Perform read(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Read(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = read(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"read(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write()
|
||||
* Perform write(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Write(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = write(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"write(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
@@ -1,565 +0,0 @@
|
||||
|
||||
/***** P A C K H E X . C ************************************************
|
||||
*
|
||||
* Packhex is a hex-file compaction utility. It attempts to concatenate
|
||||
* hex records to produce more size-efficient packaging.
|
||||
*
|
||||
* Limitations: Input files must be correctly formatted. This utility
|
||||
* is not robust enough to detect hex-record formatting
|
||||
* errors.
|
||||
*
|
||||
* Published: May 1993 Embedded Systems Programming magazine
|
||||
* "Creating Faster Hex Files"
|
||||
*
|
||||
* URL: ESP magazine: http://www.embedded.com
|
||||
* Source Code: ftp://ftp.mfi.com/pub/espmag/1993/pakhex.zip
|
||||
*
|
||||
* Author: Mark Gringrich
|
||||
*
|
||||
* Compiler: Microsoft C 6.0
|
||||
* cl /F 1000 packhex.c
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/* #define SMALLER_RECORDS */
|
||||
#ifdef SMALLER_RECORDS
|
||||
#define MAX_LEN_S1_RECS 128
|
||||
#define MAX_LEN_S2_RECS 128
|
||||
#define MAX_LEN_S3_RECS 128
|
||||
#else
|
||||
#define MAX_LEN_S1_RECS 252
|
||||
#define MAX_LEN_S2_RECS 251
|
||||
#define MAX_LEN_S3_RECS 250
|
||||
#endif
|
||||
|
||||
|
||||
/*--------------------------------- includes ---------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef VMS
|
||||
#ifndef HAVE_STRERROR
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
|
||||
#define strerror( _err ) \
|
||||
((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
|
||||
|
||||
#else /* HAVE_STRERROR */
|
||||
char *strerror ();
|
||||
#endif
|
||||
#else /* VMS */
|
||||
char *strerror (int,...);
|
||||
#endif
|
||||
|
||||
#if defined(__unix__) && !defined(EXIT_FAILURE)
|
||||
#define EXIT_FAILURE -1
|
||||
#define EXIT_SUCCESS 0
|
||||
#endif
|
||||
|
||||
/*--------------------------------- defines ----------------------------------*/
|
||||
|
||||
#define YES 1
|
||||
#define MAX_LINE_SIZE 600
|
||||
#define EOS '\0'
|
||||
|
||||
|
||||
/*---------------------------------- macros ----------------------------------*/
|
||||
|
||||
/* Convert ASCII hexadecimal digit to value. */
|
||||
|
||||
#define HEX_DIGIT( C ) ( ( ( ( C ) > '9' ) ? ( C ) + 25 : ( C ) ) & 0xF )
|
||||
|
||||
|
||||
/*--------------------------------- typedefs ---------------------------------*/
|
||||
|
||||
typedef unsigned char Boolean;
|
||||
typedef unsigned char Uchar;
|
||||
typedef unsigned int Uint;
|
||||
typedef unsigned long Ulong;
|
||||
|
||||
typedef struct /* Functions and constant returning Hex-record vital stats. */
|
||||
{
|
||||
Boolean ( *is_data_record )( char * );
|
||||
Ulong ( *get_address )( char * );
|
||||
Uint ( *get_data_count )( char * );
|
||||
const Uint max_data_count;
|
||||
char *( *get_data_start )( char * );
|
||||
void ( *put_data_record )( Uint, Ulong, char * );
|
||||
} Rec_vitals;
|
||||
|
||||
|
||||
/*--------------------------- function prototypes ----------------------------*/
|
||||
|
||||
Rec_vitals * identify_first_data_record( char *, int );
|
||||
Ulong get_ndigit_hex( char *, int );
|
||||
|
||||
|
||||
/*----------------------------- Intel Hex format -----------------------------*/
|
||||
|
||||
/*
|
||||
* Intel Hex data-record layout
|
||||
*
|
||||
* :aabbbbccd...dee
|
||||
*
|
||||
* : - header character
|
||||
* aa - record data byte count, a 2-digit hex value
|
||||
* bbbb - record address, a 4-digit hex value
|
||||
* cc - record type, a 2-digit hex value:
|
||||
* "00" is a data record
|
||||
* "01" is an end-of-data record
|
||||
* "02" is an extended-address record
|
||||
* "03" is a start record
|
||||
* d...d - data (always an even number of chars)
|
||||
* ee - record checksum, a 2-digit hex value
|
||||
* checksum = 2's complement
|
||||
* [ (sum of bytes: aabbbbccd...d) modulo 256 ]
|
||||
*/
|
||||
|
||||
|
||||
Boolean is_intel_data_rec( char * rec_str )
|
||||
{
|
||||
return( ( rec_str[ 0 ] == ':' ) && ( rec_str[ 8 ] == '0' ) );
|
||||
}
|
||||
|
||||
Uint get_intel_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 1, 2 ) );
|
||||
}
|
||||
|
||||
Ulong get_intel_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 3, 4 ) );
|
||||
}
|
||||
|
||||
char * get_intel_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 9 );
|
||||
}
|
||||
|
||||
void put_intel_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = count + ( address >> 8 & 0xff ) + ( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
":%02X%04lX00%s%02X\n", count, address, data_str, (~sum + 1) & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals intel_hex =
|
||||
{
|
||||
is_intel_data_rec,
|
||||
get_intel_rec_address,
|
||||
get_intel_rec_data_count,
|
||||
255, /* Maximum data bytes in a record. */
|
||||
get_intel_rec_data_start,
|
||||
put_intel_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S1-record format ------------------------*/
|
||||
|
||||
/*
|
||||
* Motorola S-record data-record layout
|
||||
*
|
||||
* Sabbc...cd...dee
|
||||
*
|
||||
* S - header character
|
||||
* a - record type, a 1-digit value:
|
||||
* "0" is a header record
|
||||
* "1" is a 2-byte-address data record
|
||||
* "2" is a 3-byte-address data record
|
||||
* "3" is a 4-byte-address data record
|
||||
* "7" is a 4-byte-address end-of-data record
|
||||
* "8" is a 3-byte-address end-of-data record
|
||||
* "9" is a 2-byte-address end-of-data record
|
||||
* bb - record length in bytes, a 2-digit hex value
|
||||
* (record length doesn't count the header/type
|
||||
* chars and checksum byte)
|
||||
* c...c - record address, a 4-, 6-, or 8-digit value,
|
||||
* depending on record type
|
||||
* d...d - data (always an even number of chars)
|
||||
* ee - record checksum, a 2-digit hex value
|
||||
* checksum = 1's complement
|
||||
* [ (sum of all bytes: bbc..cd...d) modulo 256 ]
|
||||
*/
|
||||
|
||||
#define S1_COUNT_OFFSET 3
|
||||
|
||||
|
||||
Boolean is_moto_s1_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '1' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s1_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S1_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s1_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 4 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s1_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 8 );
|
||||
}
|
||||
|
||||
void put_moto_s1_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S1_COUNT_OFFSET + count +
|
||||
( address >> 8 & 0xff ) + ( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S1%02X%04lX%s%02X\n",
|
||||
count + S1_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s1_rec =
|
||||
{
|
||||
is_moto_s1_data_rec,
|
||||
get_moto_s1_rec_address,
|
||||
get_moto_s1_rec_data_count,
|
||||
MAX_LEN_S1_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s1_rec_data_start,
|
||||
put_moto_s1_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S2-record format ------------------------*/
|
||||
|
||||
#define S2_COUNT_OFFSET 4
|
||||
|
||||
Boolean is_moto_s2_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '2' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s2_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S2_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s2_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 6 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s2_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 10 );
|
||||
}
|
||||
|
||||
void put_moto_s2_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S2_COUNT_OFFSET + count + ( address >> 16 & 0xff ) +
|
||||
( address >> 8 & 0xff ) +
|
||||
( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S2%02X%06lX%s%02X\n",
|
||||
count + S2_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s2_rec =
|
||||
{
|
||||
is_moto_s2_data_rec,
|
||||
get_moto_s2_rec_address,
|
||||
get_moto_s2_rec_data_count,
|
||||
MAX_LEN_S2_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s2_rec_data_start,
|
||||
put_moto_s2_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S3-record format ------------------------*/
|
||||
|
||||
#define S3_COUNT_OFFSET 5
|
||||
|
||||
Boolean is_moto_s3_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '3' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s3_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S3_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s3_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 8 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s3_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 12 );
|
||||
}
|
||||
|
||||
void put_moto_s3_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S3_COUNT_OFFSET + count + ( address >> 24 & 0xff ) +
|
||||
( address >> 16 & 0xff ) +
|
||||
( address >> 8 & 0xff ) +
|
||||
( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S3%02X%08lX%s%02X\n",
|
||||
count + S3_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s3_rec =
|
||||
{
|
||||
is_moto_s3_data_rec,
|
||||
get_moto_s3_rec_address,
|
||||
get_moto_s3_rec_data_count,
|
||||
MAX_LEN_S3_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s3_rec_data_start,
|
||||
put_moto_s3_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*-------------------- Put your favorite hex format here ---------------------*/
|
||||
|
||||
/*
|
||||
* * * * The following is a template for an additional hex format: * * *
|
||||
*
|
||||
*
|
||||
* Boolean is_X_data_rec( char * rec_str ) {}
|
||||
*
|
||||
* Uint get_X_rec_data_count( char * rec_str ) {}
|
||||
*
|
||||
* Ulong get_X_rec_address( char * rec_str ) {}
|
||||
*
|
||||
* char * get_X_rec_data_start( char * rec_str ) {}
|
||||
*
|
||||
* void put_X_data_rec( Uint count, Ulong address, char * data_str ) {}
|
||||
*
|
||||
* Rec_vitals X_rec =
|
||||
* {
|
||||
* is_X_data_rec,
|
||||
* get_X_rec_address,
|
||||
* get_X_rec_data_count,
|
||||
* MAXIMUM DATA BYTES IN A RECORD,
|
||||
* get_X_rec_data_start,
|
||||
* put_X_data_rec
|
||||
* };
|
||||
*
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
* Put address of additional Rec_vitals structures
|
||||
* in this array, before the NULL entry.
|
||||
*/
|
||||
|
||||
Rec_vitals *formats[] =
|
||||
{
|
||||
&intel_hex,
|
||||
&motorola_s1_rec,
|
||||
&motorola_s2_rec,
|
||||
&motorola_s3_rec,
|
||||
( Rec_vitals * ) NULL
|
||||
};
|
||||
|
||||
|
||||
/**** main *****************************************************************
|
||||
*
|
||||
*
|
||||
* Expects: Nothing (no command-line parameters).
|
||||
*
|
||||
* Returns: Exit status (EXIT_SUCCESS or EXIT_FAILURE).
|
||||
*
|
||||
* Reads hex records on the standard input and attempts to
|
||||
* splice adjacent data fields together. Results appear on
|
||||
* the standard output.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
|
||||
char inbuff[ MAX_LINE_SIZE ], outbuff[ MAX_LINE_SIZE ];
|
||||
char *in_dptr, *out_dptr;
|
||||
int d_total, d_count, d_excess, n;
|
||||
int length;
|
||||
Ulong in_rec_addr, out_rec_addr = 0;
|
||||
Rec_vitals *rptr;
|
||||
|
||||
|
||||
/* Sift through file until first hex record is identified. */
|
||||
|
||||
rptr = identify_first_data_record( inbuff, MAX_LINE_SIZE );
|
||||
if ( rptr == NULL )
|
||||
{
|
||||
fputs( "No hex records found.\n", stderr );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
|
||||
/* Attempt data-record splicing until end-of-file is reached. */
|
||||
d_total = 0;
|
||||
for (;;) {
|
||||
if ( rptr->is_data_record( inbuff ) == YES )
|
||||
{ /* Input record is a data record. */
|
||||
d_count = rptr->get_data_count( inbuff );
|
||||
in_rec_addr = rptr->get_address( inbuff );
|
||||
in_dptr = rptr->get_data_start( inbuff );
|
||||
|
||||
if ( d_total == 0 || in_rec_addr != out_rec_addr + d_total )
|
||||
{ /* Begin a new output record. */
|
||||
if ( d_total != 0 )
|
||||
rptr->put_data_record( d_total, out_rec_addr, outbuff );
|
||||
out_dptr = outbuff;
|
||||
n = d_total = d_count;
|
||||
out_rec_addr = in_rec_addr;
|
||||
}
|
||||
else if
|
||||
( ( d_excess = d_total + d_count - rptr->max_data_count ) > 0 )
|
||||
{ /* Output a maximum-length record, then start a new record. */
|
||||
strncat( outbuff, in_dptr, 2 * ( d_count - d_excess ) );
|
||||
rptr->put_data_record(
|
||||
rptr->max_data_count, out_rec_addr, outbuff
|
||||
);
|
||||
in_dptr += 2 * ( d_count - d_excess );
|
||||
out_dptr = outbuff;
|
||||
n = d_total = d_excess;
|
||||
out_rec_addr += rptr->max_data_count;
|
||||
}
|
||||
else
|
||||
{ /* Append input record's data field with accumulated data. */
|
||||
out_dptr = outbuff + ( 2 * d_total );
|
||||
d_total += n = d_count;
|
||||
}
|
||||
strncpy( out_dptr, in_dptr, 2 * n );
|
||||
out_dptr[ 2 * n ] = EOS;
|
||||
}
|
||||
else
|
||||
{ /* Not a data record;
|
||||
* flush accumulated data then echo non-data record.
|
||||
*/
|
||||
if ( d_total != 0 )
|
||||
{
|
||||
rptr->put_data_record( d_total, out_rec_addr, outbuff );
|
||||
d_total = 0;
|
||||
}
|
||||
puts( inbuff );
|
||||
}
|
||||
|
||||
inbuff[ MAX_LINE_SIZE - 1 ] = '\0';
|
||||
if ( !fgets( inbuff, MAX_LINE_SIZE, stdin ) )
|
||||
break;
|
||||
if ( inbuff[ MAX_LINE_SIZE - 1 ] ) {
|
||||
fprintf( stderr, "Input line too long" );
|
||||
exit( 1 );
|
||||
}
|
||||
length = strlen(inbuff);
|
||||
inbuff[length - 1] = '\0';
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ( EXIT_SUCCESS );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**** identify_first_data_record *******************************************
|
||||
*
|
||||
* Expects: Pointer to hex-record line buffer.
|
||||
*
|
||||
* Returns: Pointer to hex-record structure (NULL if no match found).
|
||||
*
|
||||
* Reads the standard input, line by line, searching for a valid
|
||||
* record header character. If a valid header is found, a pointer
|
||||
* to the hex-record's type structure is returned, otherwise NULL.
|
||||
*
|
||||
* The input-stream pointer is left pointing to the first valid hex record.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
Rec_vitals * identify_first_data_record( char * buff_ptr, int max_length )
|
||||
{
|
||||
Rec_vitals ** ptr;
|
||||
int length;
|
||||
|
||||
|
||||
|
||||
for ( ;; ) {
|
||||
|
||||
buff_ptr[ max_length - 1 ] = '\0';
|
||||
if ( !fgets( buff_ptr, max_length, stdin ) )
|
||||
break;
|
||||
if ( buff_ptr[ max_length - 1 ] ) {
|
||||
fprintf( stderr, "Input line too long" );
|
||||
exit( 1 );
|
||||
}
|
||||
length = strlen(buff_ptr);
|
||||
buff_ptr[length - 1] = '\0';
|
||||
|
||||
for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ )
|
||||
if ( ( *ptr )->is_data_record( buff_ptr ) == YES )
|
||||
return( *ptr ); /* Successful return. */
|
||||
|
||||
puts( buff_ptr ); /* Echo non-hex-record line. */
|
||||
}
|
||||
|
||||
return( ( Rec_vitals * ) NULL ); /* Unsuccessful return. */
|
||||
}
|
||||
|
||||
|
||||
/**** get_ndigit_hex *******************************************************
|
||||
*
|
||||
* Expects: Pointer to first ASCII hexadecimal digit, number of digits.
|
||||
*
|
||||
* Returns: Value of hexadecimal string as an unsigned long.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
Ulong get_ndigit_hex( char * cptr, int digits )
|
||||
{
|
||||
Ulong value;
|
||||
|
||||
for ( value = 0 ; --digits >= 0 ; cptr++ )
|
||||
value = ( value * 16L ) + HEX_DIGIT( *cptr );
|
||||
|
||||
return( value );
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
timestamp
|
||||
@@ -1,738 +0,0 @@
|
||||
/*
|
||||
* unhex
|
||||
* convert a hex file to binary equivalent. If more than one file name
|
||||
* is given, then the output will be logically concatenated together.
|
||||
* stdin and stdout are defaults. Verbose will enable checksum output.
|
||||
*
|
||||
* Supported input formats are Intel hex, Motorola S records, and TI 'B'
|
||||
* records.
|
||||
*
|
||||
* Intel hex input format is
|
||||
* Byte
|
||||
* 1 Colon :
|
||||
* 2..3 Record length, eg: "20"
|
||||
* 4..7 load address nibbles
|
||||
* 8..9 record type: "00" (data) or "02" base addr
|
||||
* 10..x data bytes in ascii-hex
|
||||
* x+1..x+2 cksum (2's compl of (len+addr+data))
|
||||
* x+3 \n -- newline
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
char *USAGE = "\
|
||||
usage: unhex [-va] [ -o file ] [ file [file ... ] ]\n\
|
||||
-v -- verbose\n\
|
||||
-a base -- 1st byte of output corresponds to this address\n\
|
||||
-l -- linear, just writes data out\n\
|
||||
-o file -- output file; must not be input file\n\
|
||||
-F k_bits -- \"holes\" in input will be filled with 0xFF's\n\
|
||||
up to \"k_bits\" * 1024 bits\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef VMS
|
||||
#ifndef HAVE_STRERROR
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
|
||||
#define strerror( _err ) \
|
||||
((_err) < sys_nerr) ? sys_errlist [(_err)] : "unknown error"
|
||||
|
||||
#else /* HAVE_STRERROR */
|
||||
char *strerror ();
|
||||
#endif
|
||||
#else /* VMS */
|
||||
char *strerror (int,...);
|
||||
#endif
|
||||
|
||||
|
||||
#define OK 0
|
||||
#define FAILURE (-1)
|
||||
#define Failed(x) ((x) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
typedef char bool;
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* Pick out designated bytes
|
||||
*/
|
||||
|
||||
#define B0(x) ((x) & 0xff)
|
||||
#define B1(x) B0((x) >> 8)
|
||||
#define B2(x) B0((x) >> 16)
|
||||
#define B3(x) B0((x) >> 24)
|
||||
|
||||
typedef struct buffer_rec {
|
||||
u32 dl_destaddr;
|
||||
u32 dl_jumpaddr;
|
||||
int dl_count;
|
||||
u8 dl_buf[512];
|
||||
} buffer_rec;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
bool verbose = FALSE; /* be verbose */
|
||||
bool linear = FALSE; /* just write out linear data */
|
||||
char *outfilename = "-"; /* default output is stdout */
|
||||
u32 base = 0L; /* base address */
|
||||
u32 FFfill = 0L; /* how far to fill w 0xFF's */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
void error(int errn, ...);
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* error is fatal; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* error is fatal; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#ifdef HAVE_STRTOUL
|
||||
#define stol(p) strtoul(p, (char **) NULL, 0)
|
||||
#else
|
||||
#define stol(p) strtol(p, (char **) NULL, 0)
|
||||
#endif
|
||||
|
||||
int unhex(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_Intel_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_S_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_TI_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
void write_record(buffer_rec *tb, FILE *fp);
|
||||
int getnibble(char **p);
|
||||
int getbyte(char **p);
|
||||
long getNbytes(char **p, int n);
|
||||
void badformat(char *s, char *fname, char *msg);
|
||||
|
||||
#define get1bytes(p) ((int) getbyte(p))
|
||||
#define get2bytes(p) ((int) getNbytes(p, 2))
|
||||
#define get3bytes(p) getNbytes(p, 3)
|
||||
#define get4bytes(p) getNbytes(p, 4)
|
||||
|
||||
char *BADADDR = "Invalid record address";
|
||||
char *BADLEN = "Invalid record length";
|
||||
char *BADBASE = "Bad base or starting address";
|
||||
char *BADFMT = "Unrecognized record type";
|
||||
char *BADDATA = "Invalid data byte";
|
||||
char *BADCSUM = "Invalid checksum";
|
||||
char *MISCSUM = "Checksum mismatch";
|
||||
char *BADTYPE = "Unrecognized record type";
|
||||
char *MISTYPE = "Incompatible record types";
|
||||
|
||||
int main(
|
||||
int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
register int c;
|
||||
bool showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
FILE *outfp, *infp;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
progname = argv[0];
|
||||
while ((c = getopt(argc, argv, "F:a:o:vl")) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'a': /* base address */
|
||||
base = stol(optarg);
|
||||
break;
|
||||
|
||||
case 'l': /* linear output */
|
||||
linear = TRUE;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case 'o': /* output file */
|
||||
outfilename = optarg;
|
||||
break;
|
||||
|
||||
case 'F': /* 0xFF fill amount (bytes) */
|
||||
FFfill = stol(optarg) * 1024L / 8L;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (linear && (base != 0))
|
||||
{
|
||||
error(0, "-l and -a may not be specified in combination");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (STREQ(outfilename, "-"))
|
||||
{
|
||||
outfp = stdout;
|
||||
outfilename = "stdout";
|
||||
}
|
||||
else
|
||||
if ((outfp = fopen(outfilename, "w")) == (FILE *) NULL)
|
||||
{
|
||||
error(-1, "couldn't open '%s' for output", outfilename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now process the input files (or stdin, if none specified)
|
||||
*/
|
||||
|
||||
if (argv[optind] == (char *) NULL) /* just stdin */
|
||||
exit(unhex(stdin, "stdin", outfp, outfilename));
|
||||
else
|
||||
for (; (optarg = argv[optind]); optind++)
|
||||
{
|
||||
if (STREQ(optarg, "-"))
|
||||
rc += unhex(stdin, "stdin", outfp, outfilename);
|
||||
else
|
||||
{
|
||||
if ((infp = fopen(optarg, "r")) == (FILE *) NULL)
|
||||
{
|
||||
error(-1, "couldn't open '%s' for input", optarg);
|
||||
exit(1);
|
||||
}
|
||||
rc += unhex(infp, optarg, outfp, outfilename);
|
||||
}
|
||||
}
|
||||
|
||||
return(rc);
|
||||
}
|
||||
|
||||
u16 filesum;
|
||||
|
||||
int
|
||||
unhex(FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
int c;
|
||||
|
||||
filesum = 0;
|
||||
|
||||
/*
|
||||
* Make sure holes will be filled with 0xFF's if requested. We
|
||||
* do this the easy way by just filling the file with FF's before
|
||||
* getting started. To do it more optimally would be quite a bit
|
||||
* more difficult since the user can skip around as much as he/she
|
||||
* likes in the input hex file addressing.
|
||||
*
|
||||
* We'll clean this up later (after this program has run) with
|
||||
* 'stripffs'
|
||||
*/
|
||||
|
||||
if (FFfill)
|
||||
{
|
||||
(void) fseek(ofp, 0, 0);
|
||||
for (c = FFfill; c > 0; c--)
|
||||
(void) fputc(0xFF, ofp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the first char from file and determine record types
|
||||
*/
|
||||
|
||||
if ((c = getc(ifp)) != EOF)
|
||||
{
|
||||
ungetc(c, ifp);
|
||||
switch(c)
|
||||
{
|
||||
case 'S':
|
||||
convert_S_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
case ':':
|
||||
convert_Intel_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
case '9':
|
||||
case 'B':
|
||||
convert_TI_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
char tmp[2];
|
||||
tmp[0] = c; tmp[1] = 0;
|
||||
badformat(tmp, inm, BADFMT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "'%s' checksum is 0x%04x\n", inm, filesum);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_Intel_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
u8 cksum;
|
||||
int incksum;
|
||||
int c;
|
||||
int rectype; /* record type */
|
||||
int len; /* data length of current line */
|
||||
u32 addr;
|
||||
u32 base_address = 0;
|
||||
bool endrecord = FALSE;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
p = &buff[0];
|
||||
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
if (*p != ':')
|
||||
badformat(p, inm, BADFMT);
|
||||
p++;
|
||||
|
||||
if ((len = getbyte(&p)) == -1) /* record len */
|
||||
badformat(buff, inm, BADLEN);
|
||||
|
||||
if ((addr = get2bytes(&p)) == -1L) /* record addr */
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
rectype = getbyte(&p);
|
||||
|
||||
cksum = len + B0(addr) + B1(addr) + rectype;
|
||||
|
||||
switch (rectype)
|
||||
{
|
||||
case 0x00: /* normal data record */
|
||||
tb.dl_destaddr = base_address + addr;
|
||||
while (len--)
|
||||
{
|
||||
if ((c = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADDATA);
|
||||
cksum += c;
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x01: /* execution start address */
|
||||
base_address = addr;
|
||||
endrecord = TRUE;
|
||||
break;
|
||||
|
||||
case 0x02: /* new base */
|
||||
if ((base_address = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADBASE);
|
||||
cksum += B0(base_address) + B1(base_address);
|
||||
base_address <<= 4;
|
||||
break;
|
||||
|
||||
case 0x03: /* seg/off execution start address */
|
||||
{
|
||||
u32 seg, off;
|
||||
|
||||
seg = get2bytes(&p);
|
||||
off = get2bytes(&p);
|
||||
if ((seg == -1L) || (off == -1L))
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
cksum += B0(seg) + B1(seg) + B0(off) + B1(off);
|
||||
|
||||
tb.dl_jumpaddr = (seg << 4) + off;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
error(0, "unknown Intel-hex record type: 0x%02x", rectype);
|
||||
badformat(buff, inm, BADTYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify checksums are correct in file.
|
||||
*/
|
||||
|
||||
cksum = (-cksum) & 0xff;
|
||||
if ((incksum = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADCSUM);
|
||||
if (((u8) incksum) != cksum)
|
||||
badformat(buff, inm, MISCSUM);
|
||||
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_S_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
u8 cksum;
|
||||
int incksum;
|
||||
int c;
|
||||
int len; /* data length of current line */
|
||||
int rectype; /* record type */
|
||||
u32 addr;
|
||||
bool endrecord = FALSE;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
p = &buff[0];
|
||||
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
if (*p != 'S')
|
||||
badformat(p, inm, BADFMT);
|
||||
p++;
|
||||
|
||||
if ((rectype = getnibble(&p)) == -1) /* record type */
|
||||
badformat(buff, inm, BADTYPE);
|
||||
|
||||
if ((len = getbyte(&p)) == -1) /* record len */
|
||||
badformat(buff, inm, BADLEN);
|
||||
cksum = len;
|
||||
|
||||
switch (rectype)
|
||||
{
|
||||
case 0x00: /* comment field, ignored */
|
||||
goto write_it;
|
||||
|
||||
case 0x01: /* data record, 16 bit addr */
|
||||
if ((addr = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 3;
|
||||
goto doit;
|
||||
|
||||
case 0x02: /* ... 24 bit addr */
|
||||
if ((addr = get3bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 4;
|
||||
goto doit;
|
||||
|
||||
case 0x03: /* ... 32 bit addr */
|
||||
if ((addr = get4bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 5;
|
||||
doit:
|
||||
cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
|
||||
|
||||
tb.dl_destaddr = addr;
|
||||
while (len--)
|
||||
{
|
||||
if ((c = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADDATA);
|
||||
cksum += c;
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x07: /* 32 bit end record */
|
||||
if ((addr = get4bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
goto end_rec;
|
||||
|
||||
case 0x08: /* 24 bit end record */
|
||||
if ((addr = get3bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
goto end_rec;
|
||||
|
||||
case 0x09: /* 16 bit end record */
|
||||
if ((addr = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
end_rec:
|
||||
cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
|
||||
tb.dl_jumpaddr = addr;
|
||||
break;
|
||||
|
||||
default:
|
||||
error(0, "unknown Motorola-S record type: 0x%02x", rectype);
|
||||
badformat(buff, inm, BADTYPE);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify checksums are correct in file.
|
||||
*/
|
||||
|
||||
cksum = (~cksum) & 0xff;
|
||||
if ((incksum = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADCSUM);
|
||||
if (((u8) incksum) != cksum)
|
||||
badformat(buff, inm, MISCSUM);
|
||||
|
||||
write_it:
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_TI_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
int c;
|
||||
bool endrecord = FALSE;
|
||||
bool eol;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
p = &buff[0];
|
||||
eol = FALSE;
|
||||
while ( ! eol && ! endrecord)
|
||||
{
|
||||
switch (*p++)
|
||||
{
|
||||
case '9':
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
tb.dl_destaddr = get2bytes(&p);
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
c = getbyte(&p);
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
c = getbyte(&p);
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
eol = TRUE;
|
||||
break;
|
||||
|
||||
case ':':
|
||||
endrecord = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
badformat(p, inm, BADFMT);
|
||||
}
|
||||
}
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
write_record(buffer_rec *tb,
|
||||
FILE *fp)
|
||||
{
|
||||
if ( ! linear)
|
||||
{
|
||||
if (tb->dl_destaddr < base)
|
||||
error(ERR_FATAL, "record at address 0x%x precedes base of 0x%x",
|
||||
tb->dl_destaddr, base);
|
||||
(void) fseek(fp, tb->dl_destaddr - base, 0);
|
||||
}
|
||||
|
||||
(void) fwrite(tb->dl_buf, tb->dl_count, 1, fp);
|
||||
tb->dl_destaddr += tb->dl_count;
|
||||
tb->dl_count = 0;
|
||||
}
|
||||
|
||||
int
|
||||
getnibble(char **p)
|
||||
{
|
||||
register int val;
|
||||
|
||||
**p = toupper(**p);
|
||||
switch (**p)
|
||||
{
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
val = **p - '0';
|
||||
break;
|
||||
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
val = 10 + (**p - 'A');
|
||||
break;
|
||||
|
||||
default:
|
||||
return(-1);
|
||||
}
|
||||
*p += 1;
|
||||
|
||||
return(val & 0x0f);
|
||||
}
|
||||
|
||||
int
|
||||
getbyte(char **p)
|
||||
{
|
||||
int n0, n1;
|
||||
|
||||
if ((n0 = getnibble(p)) == -1)
|
||||
return(-1);
|
||||
if ((n1 = getnibble(p)) == -1)
|
||||
return(-1);
|
||||
|
||||
return(((n0 << 4) + n1) & 0xff);
|
||||
}
|
||||
|
||||
long
|
||||
getNbytes(char **p,
|
||||
int n)
|
||||
{
|
||||
int t;
|
||||
u32 val = 0;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
if ((t = getbyte(p)) == -1)
|
||||
return(-1L);
|
||||
val <<= 8;
|
||||
val += t;
|
||||
}
|
||||
|
||||
return(val);
|
||||
}
|
||||
|
||||
void
|
||||
badformat(char *s,
|
||||
char *fname,
|
||||
char *msg)
|
||||
{
|
||||
if (s[strlen(s)-1] == '\n') /* get rid of newline */
|
||||
s[strlen(s)-1] = '\0';
|
||||
error(0, "line '%s'::\n\tfrom file '%s'; %s", s, fname, msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_EXIT bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
(void) fprintf(stderr, " (%s)\n", strerror(local_errno));
|
||||
else
|
||||
(void) fprintf(stderr, "\n");
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user