Index: Makefile =================================================================== RCS file: Makefile diff -N Makefile --- /dev/null Tue May 5 16:32:27 1998 +++ Makefile Fri Oct 26 11:28:49 2001 @@ -0,0 +1,23 @@ +.EXPORT_ALL_VARIABLES: + +SUBDIRS = $(shell \ + find -type d -maxdepth 1 ! -name . ! -name CVS -printf "%f\n" \ + ) + +define make_subdirs + for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done +endef + +all: $(SUBDIRS) + @$(make_subdirs) + +install: $(SUBDIRS) + @$(make_subdirs) + +clean: $(SUBDIRS) + @$(make_subdirs) || true + find -name "*.gdb" -exec rm -vf \{} \; \ + -exec sh -c "f=\{}; n=\$${f%.gdb}; test -f \$$n && rm -vf \$$n" \; + +distclean: clean + Index: flatfsd/Makefile =================================================================== RCS file: /usr/local/cvsroot/user/flatfsd/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- flatfsd/Makefile 2001/08/30 04:13:52 1.1.1.1 +++ flatfsd/Makefile 2001/08/30 04:19:39 1.2 @@ -6,11 +6,8 @@ all: $(EXEC) $(EXEC): $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) + $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LDLIBS) -romfs: - $(ROMFSINST) /bin/$(EXEC) - clean: - -rm -f $(EXEC) *.elf *.gdb *.o + rm -f $(EXEC) *.elf *.coff *.gdb *.o Index: flatfsd/flatfs.c =================================================================== RCS file: /usr/local/cvsroot/user/flatfsd/flatfs.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- flatfsd/flatfs.c 2001/08/30 04:13:52 1.1.1.1 +++ flatfsd/flatfs.c 2001/08/30 05:51:49 1.2 @@ -17,7 +17,7 @@ #include #include -#include +// #include #include #include "flatfs.h" @@ -247,7 +247,7 @@ if (write(fdflat, &st.st_mode, size) != size) return(-11); total += size; - sum += chksum(&st.st_mode, size); + sum += chksum((unsigned char *)&st.st_mode, size); /* Write the contents of the file. */ size = st.st_size; Index: flatfsd/newfs.c =================================================================== RCS file: /usr/local/cvsroot/user/flatfsd/newfs.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- flatfsd/newfs.c 2001/08/30 04:13:52 1.1.1.1 +++ flatfsd/newfs.c 2001/08/30 05:51:49 1.2 @@ -19,7 +19,7 @@ #include #include -#include +// #include #include #include "flatfs.h" Index: gdbserver/Makefile =================================================================== RCS file: /usr/local/cvsroot/user/gdbserver/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- gdbserver/Makefile 2001/09/05 21:34:46 1.1.1.1 +++ gdbserver/Makefile 2001/09/05 23:00:53 1.2 @@ -1,33 +1,3 @@ - -ifdef CONFIG_COLDFIRE -CFLAGS += -DBUILD_WITHOUT_PIC_CODE=1 -endif - -# This file was generated automatically by configure. Do not edit. -#VPATH = . -links = xm.h tm.h nm.h -host_alias = i686-pc-linux-gnu -host_cpu = i686 -host_vendor = pc -host_os = linux-gnu -host_canonical = i686-pc-linux-gnu -target_alias = m68k-elf -target_cpu = m68k -target_vendor = unknown -target_os = elf -target_canonical = m68k-unknown-elf -build_alias = i686-pc-linux-gnu -build_cpu = i686 -build_vendor = pc -build_os = linux-gnu -build_canonical = i686-pc-linux-gnu -target_makefile_frag = ../config/m68k/monitor.mt -host_makefile_frag = ../config/i386/linux.mh -gxx_include_dir = ${prefix}/include/g++- -enable_shared = no -enable_version_specific_runtime_libs = no -gcc_version_trigger = -gcc_version = #Copyright 1989, 90, 91, 92, 93, 94, 95, 96, 1997 #Free Software Foundation, Inc. @@ -46,238 +16,40 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -prefix = -program_transform_name = -e s,^,m68k-elf-, -exec_prefix = $(prefix) -bindir = ${exec_prefix}/bin -libdir = ${exec_prefix}/lib -tooldir = $(exec_prefix)/m68k-elf - -datadir = ${prefix}/share -mandir = ${prefix}/man -man1dir = $(mandir)/man1 -man2dir = $(mandir)/man2 -man3dir = $(mandir)/man3 -man4dir = $(mandir)/man4 -man5dir = $(mandir)/man5 -man6dir = $(mandir)/man6 -man7dir = $(mandir)/man7 -man8dir = $(mandir)/man8 -man9dir = $(mandir)/man9 -infodir = ${prefix}/info -includedir = ${prefix}/include - -FLTFLAGS = -s 32768 - -SHELL = /bin/sh - -INSTALL = `cd $(srcdir)/../..;pwd`/install-sh -c -INSTALL_PROGRAM = $(INSTALL) -INSTALL_DATA = $(INSTALL) - -#AR = ar -AR_FLAGS = qv -#RANLIB = ranlib - -# If you are compiling with GCC, make sure that either 1) You use the -# -traditional flag, or 2) You have the fixed include files where GCC -# can reach them. Otherwise the ioctl calls in inflow.c -# will be incorrectly compiled. The "fixincludes" script in the gcc -# distribution will fix your include files up. -#CC=cc -#CC=gcc -traditional -#GCC=gcc - -# Directory containing source files. Don't clean up the spacing, -# this exact string is matched for by the "configure" script. -srcdir = . - -# It is also possible that you will need to add -I/usr/include/sys to the -# CFLAGS section if your system doesn't have fcntl.h in /usr/include (which -# is where it should be according to Posix). - -# Set this up with gcc if you have gnu ld and the loader will print out -# line numbers for undefinded refs. -#CC-LD=gcc -static -#CC-LD=${CC} - -# Where is the "include" directory? Traditionally ../include or ./include -#INCLUDE_DIR = ${srcdir}/../../include -#INCLUDE_DEP = $$(INCLUDE_DIR) - -# Where are the BFD library? -BFD_DIR = bfd -BFD = $(BFD_DIR)/libbfd.a -BFD_SRC = $(srcdir)/$(BFD_DIR) -BFD_CFLAGS = -I$(BFD_DIR) -I$(BFD_SRC) - -# Where is the source dir for the READLINE library? Traditionally in .. or . -# (For the binary library built from it, we use ${READLINE_DIR}${subdir}.) -#READLINE_DIR = ${srcdir}/../readline -#READLINE_DEP = $$(READLINE_DIR) - -# All the includes used for CFLAGS and for lint. -# -I. for config files. -# -I${srcdir} possibly for regex.h also. -# -I${srcdir}/config for more generic config files. -#INCLUDE_CFLAGS = -I. -I${srcdir} -I${srcdir}/.. -I${srcdir}/../config -I$(INCLUDE_DIR) -INCLUDE_CFLAGS = -Igdb -Iinclude -Iconfig -I. - -# M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS -# from the config/ directory. -GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS} -#PROFILE_CFLAGS = -pg - -# CFLAGS is specifically reserved for setting from the command line -# when running make. I.E. "make CFLAGS=-Wmissing-prototypes". -#CFLAGS = -g -O2 -# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros. -INTERNAL_CFLAGS = ${CFLAGS} ${GLOBAL_CFLAGS} ${PROFILE_CFLAGS} \ - ${BFD_CFLAGS} ${INCLUDE_CFLAGS} +CFLAGS += -Iinclude -I. -Igdb -Ibfd -Iconfig -# LDFLAGS is specifically reserved for setting from the command line -# when running make. +# CFLAGS += -DDEBUG=1 -# Perhaps should come from parent Makefile VERSION = gdbserver-4.12.3 -DIST=gdb - -LINT=/usr/5bin/lint -LINTFLAGS= $(BFD_CFLAGS) - -# Host and target-dependent makefile fragments come in here. -#### -# Target: Motorola m68k embedded (EST emulator, rom68k and bug monitors) -TDEPFILES= m68k-tdep.o monitor.o remote-est.o cpu32bug-rom.o rom68k-rom.o abug-rom.o dbug-rom.o dsrec.o -TM_FILE= tm-monitor.h -# Host: Intel 386 running GNU/Linux - -XM_FILE= xm-linux.h -XDEPFILES= ser-tcp.o - -NAT_FILE= nm-linux.h -# NATDEPFILES= infptrace.o solib.o inftarg.o fork-child.o corelow.o core-aout.o core-regset.o i386v-nat.o i386v4-nat.o -# End of host and target-dependent makefile fragments - -# All source files that go into linking GDB remote server. - -SFILES = $(srcdir)/low-lynx.c $(srcdir)/low-sparc.c $(srcdir)/low-sun3.c \ - $(srcdir)/low-hppabsd.c \ - $(srcdir)/utils.c $(srcdir)/server.c $(srcdir)/remote-utils.c - -DEPFILES = $(GDBSERVER_DEPFILES) -SOURCES = $(SFILES) $(ALLDEPFILES) -TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS} +OBJS = utils.o low-linux.o server.o remote-utils.o -OBS = utils.o low-linux.o server.o remote-utils.o - -# Prevent Sun make from putting in the machine type. Setting -# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1. -.c.o: - ${CC} -c ${INTERNAL_CFLAGS} $< - all: gdbserver gdbreplay -# Traditionally "install" depends on "all". But it may be useful -# not to; for example, if the user has made some trivial change to a -# source file and doesn't care about rebuilding or just wants to save the -# time it takes for make to check that all is up to date. -# install-only is intended to address that need. -install: all install-only -install-only: - n=`echo gdbserver | sed '$(program_transform_name)'`; \ - if [ x$$n = x ]; then n=gdbserver; else true; fi; \ - $(INSTALL_PROGRAM) gdbserver $(bindir)/$$n; \ - $(INSTALL_DATA) $(srcdir)/gdbserver.1 $(man1dir)/$$n.1 - -uninstall: force - n=`echo gdbserver | sed '$(program_transform_name)'`; \ - if [ x$$n = x ]; then n=gdbserver; else true; fi; \ - rm -f $(bindir)/$$n $(man1dir)/$$n.1 - -installcheck: -check: -info dvi: -install-info: -clean-info: - -gdbserver: $(OBS) ${ADD_DEPS} ${CDEPS} +gdbserver: $(OBJS) rm -f gdbserver - $(CC) $(LDFLAGS) -o $@ $(OBS) $(GDBSERVER_LIBS) $(LDLIBS) + $(LD) $(LDFLAGS) -o gdbserver $(OBJS) $(LDLIBS) -gdbreplay: gdbreplay.o +gdbreplay: $(OBJS) gdbreplay.o rm -f gdbreplay - $(CC) $(LDFLAGS) -o $@ gdbreplay.o $(XM_CLIBX) $(LDLIBS) - -romfs: - $(ROMFSINST) -e CONFIG_USER_GDBSERVER_GDBSERVER /bin/gdbserver - $(ROMFSINST) -e CONFIG_USER_GDBSERVER_GDBREPLAY /bin/gdbreplay - -config.status: - @echo "You must configure gdbserver. Look at the README file for details." - @false - -# Put the proper machine-specific files first, so M-. on a machine -# specific routine gets the one for the correct machine. -# The xyzzy stuff below deals with empty DEPFILES -TAGS: ${TAGFILES} - etags `find ${srcdir}/../config -name $(TM_FILE) -print` \ - `find ${srcdir}/../config -name ${XM_FILE} -print` \ - `find ${srcdir}/../config -name ${NAT_FILE} -print` \ - `for i in yzzy ${DEPFILES}; do \ - if [ x$$i != xyzzy ]; then \ - echo ${srcdir}/$$i | sed -e 's/\.o$$/\.c/' ; \ - fi; \ - done` \ - ${TAGFILES} -tags: TAGS + $(LD) $(LDFLAGS) -o gdbreplay gdbreplay.o $(LDLIBS) clean: - rm -f *.elf *.gdb *.o ${ADD_FILES} *~ - rm -f gdbreplay gdbserver core make.log + rm -f *.o *~ *.gdb + rm -f gdbserver gdbreplay core make.log distclean: clean - rm -f nm.h tm.h xm.h config.status - rm -f Makefile -maintainer-clean realclean: clean - rm -f nm.h tm.h xm.h config.status - rm -f Makefile - -STAGESTUFF=${OBS} ${TSOBS} ${NTSOBS} ${ADD_FILES} init.c init.o version.c gdb - -force: - -version.c: +version.c: Makefile echo 'char *version = "$(VERSION)";' >version.c - -# GNU Make has an annoying habit of putting *all* the Makefile variables -# into the environment, unless you include this target as a circumvention. -# Rumor is that this will be fixed (and this target can be removed) -# in GNU Make 4.0. -.NOEXPORT: - -# GNU Make 3.63 has a different problem: it keeps tacking command line -# overrides onto the definition of $(MAKE). This variable setting -# will remove them. -MAKEOVERRIDES= - -## This is ugly, but I don't want GNU make to put these variables in -## the environment. Older makes will see this as a set of targets -## with no dependencies and no actions. -unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET : - -server.o : ${srcdir}/server.c ${srcdir}/server.h -remote-utils.o : ${srcdir}/remote-utils.c ${srcdir}/server.h -low-linux.o : ${srcdir}/low-linux.c ${srcdir}/server.h -low-lynx.o : ${srcdir}/low-lynx.c ${srcdir}/server.h -low-sim.o : ${srcdir}/low-sim.c ${srcdir}/server.h -low-sparc.o : $(srcdir)/low-sparc.c $(srcdir)/server.h -low-sun3.o : $(srcdir)/low-sun3.c $(srcdir)/server.h -low-hppabsd.o : $(srcdir)/low-hppabsd.c $(srcdir)/server.h -utils.o : ${srcdir}/utils.c ${srcdir}/server.h -# This is the end of "Makefile.in". +server.o : server.c server.h +remote-utils.o : remote-utils.c server.h +low-linux.o : low-linux.c server.h +low-lynx.o : low-lynx.c server.h +low-sim.o : low-sim.c server.h +low-sparc.o : low-sparc.c server.h +low-sun3.o : low-sun3.c server.h +low-hppabsd.o : low-hppabsd.c server.h +utils.o : utils.c server.h Index: gdbserver/Makefile.in =================================================================== RCS file: Makefile.in diff -N Makefile.in --- /tmp/cvsBo8Y9s Fri Oct 26 11:28:49 2001 +++ gdbserver/Makefile.in Tue May 5 16:32:27 1998 @@ -1,241 +0,0 @@ -#Copyright 1989, 90, 91, 92, 93, 94, 95, 96, 1997 -#Free Software Foundation, Inc. - -# This file is part of GDB. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -prefix = /usr/local - -program_transform_name = -exec_prefix = $(prefix) -bindir = $(exec_prefix)/bin -libdir = $(exec_prefix)/lib -tooldir = $(libdir)/$(target_alias) - -datadir = $(prefix)/share -mandir = $(prefix)/man -man1dir = $(mandir)/man1 -man2dir = $(mandir)/man2 -man3dir = $(mandir)/man3 -man4dir = $(mandir)/man4 -man5dir = $(mandir)/man5 -man6dir = $(mandir)/man6 -man7dir = $(mandir)/man7 -man8dir = $(mandir)/man8 -man9dir = $(mandir)/man9 -infodir = $(prefix)/info -includedir = $(prefix)/include - -SHELL = /bin/sh - -INSTALL = `cd $(srcdir)/../..;pwd`/install-sh -c -INSTALL_PROGRAM = $(INSTALL) -INSTALL_DATA = $(INSTALL) - -AR = ar -AR_FLAGS = qv -RANLIB = ranlib - -# If you are compiling with GCC, make sure that either 1) You use the -# -traditional flag, or 2) You have the fixed include files where GCC -# can reach them. Otherwise the ioctl calls in inflow.c -# will be incorrectly compiled. The "fixincludes" script in the gcc -# distribution will fix your include files up. -#CC=cc -#CC=gcc -traditional -GCC=gcc - -# Directory containing source files. Don't clean up the spacing, -# this exact string is matched for by the "configure" script. -srcdir = . - -# It is also possible that you will need to add -I/usr/include/sys to the -# CFLAGS section if your system doesn't have fcntl.h in /usr/include (which -# is where it should be according to Posix). - -# Set this up with gcc if you have gnu ld and the loader will print out -# line numbers for undefinded refs. -#CC-LD=gcc -static -CC-LD=${CC} - -# Where is the "include" directory? Traditionally ../include or ./include -INCLUDE_DIR = ${srcdir}/../../include -INCLUDE_DEP = $$(INCLUDE_DIR) - -# Where are the BFD library? -BFD_DIR = ../../bfd -BFD = $(BFD_DIR)/libbfd.a -BFD_SRC = $(srcdir)/$(BFD_DIR) -BFD_CFLAGS = -I$(BFD_DIR) -I$(BFD_SRC) - -# Where is the source dir for the READLINE library? Traditionally in .. or . -# (For the binary library built from it, we use ${READLINE_DIR}${subdir}.) -READLINE_DIR = ${srcdir}/../readline -READLINE_DEP = $$(READLINE_DIR) - -# All the includes used for CFLAGS and for lint. -# -I. for config files. -# -I${srcdir} possibly for regex.h also. -# -I${srcdir}/config for more generic config files. -INCLUDE_CFLAGS = -I. -I${srcdir} -I${srcdir}/.. -I${srcdir}/../config -I$(INCLUDE_DIR) - -# M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS -# from the config/ directory. -GLOBAL_CFLAGS = ${MT_CFLAGS} ${MH_CFLAGS} -#PROFILE_CFLAGS = -pg - -# CFLAGS is specifically reserved for setting from the command line -# when running make. I.E. "make CFLAGS=-Wmissing-prototypes". -CFLAGS = -g -# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros. -INTERNAL_CFLAGS = ${CFLAGS} ${GLOBAL_CFLAGS} ${PROFILE_CFLAGS} \ - ${BFD_CFLAGS} ${INCLUDE_CFLAGS} - -# LDFLAGS is specifically reserved for setting from the command line -# when running make. - -# Perhaps should come from parent Makefile -VERSION = gdbserver-4.12.3 -DIST=gdb - -LINT=/usr/5bin/lint -LINTFLAGS= $(BFD_CFLAGS) - -# Host and target-dependent makefile fragments come in here. -#### -# End of host and target-dependent makefile fragments - -# All source files that go into linking GDB remote server. - -SFILES = $(srcdir)/low-lynx.c $(srcdir)/low-sparc.c $(srcdir)/low-sun3.c \ - $(srcdir)/low-hppabsd.c \ - $(srcdir)/utils.c $(srcdir)/server.c $(srcdir)/remote-utils.c - -DEPFILES = $(GDBSERVER_DEPFILES) - -SOURCES = $(SFILES) $(ALLDEPFILES) -TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS} - -OBS = utils.o $(GDBSERVER_DEPFILES) server.o remote-utils.o - -# Prevent Sun make from putting in the machine type. Setting -# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1. -.c.o: - ${CC} -c ${INTERNAL_CFLAGS} $< - -all: gdbserver gdbreplay - -# Traditionally "install" depends on "all". But it may be useful -# not to; for example, if the user has made some trivial change to a -# source file and doesn't care about rebuilding or just wants to save the -# time it takes for make to check that all is up to date. -# install-only is intended to address that need. -install: all install-only -install-only: - n=`echo gdbserver | sed '$(program_transform_name)'`; \ - if [ x$$n = x ]; then n=gdbserver; else true; fi; \ - $(INSTALL_PROGRAM) gdbserver $(bindir)/$$n; \ - $(INSTALL_DATA) $(srcdir)/gdbserver.1 $(man1dir)/$$n.1 - -uninstall: force - n=`echo gdbserver | sed '$(program_transform_name)'`; \ - if [ x$$n = x ]; then n=gdbserver; else true; fi; \ - rm -f $(bindir)/$$n $(man1dir)/$$n.1 - -installcheck: -check: -info dvi: -install-info: -clean-info: - -gdbserver: $(OBS) ${ADD_DEPS} ${CDEPS} - rm -f gdbserver - ${CC-LD} $(GLOBAL_CFLAGS) $(LDFLAGS) -o gdbserver $(OBS) \ - $(GDBSERVER_LIBS) $(XM_CLIBS) - -gdbreplay: gdbreplay.o - rm -f gdbreplay - ${CC-LD} $(GLOBAL_CFLAGS) $(LDFLAGS) -o gdbreplay gdbreplay.o \ - $(XM_CLIBS) - -config.status: - @echo "You must configure gdbserver. Look at the README file for details." - @false - -# Put the proper machine-specific files first, so M-. on a machine -# specific routine gets the one for the correct machine. -# The xyzzy stuff below deals with empty DEPFILES -TAGS: ${TAGFILES} - etags `find ${srcdir}/../config -name $(TM_FILE) -print` \ - `find ${srcdir}/../config -name ${XM_FILE} -print` \ - `find ${srcdir}/../config -name ${NAT_FILE} -print` \ - `for i in yzzy ${DEPFILES}; do \ - if [ x$$i != xyzzy ]; then \ - echo ${srcdir}/$$i | sed -e 's/\.o$$/\.c/' ; \ - fi; \ - done` \ - ${TAGFILES} -tags: TAGS - -clean: - rm -f *.o ${ADD_FILES} *~ - rm -f gdbserver core make.log - -distclean: clean - rm -f nm.h tm.h xm.h config.status - rm -f Makefile - -maintainer-clean realclean: clean - rm -f nm.h tm.h xm.h config.status - rm -f Makefile - -STAGESTUFF=${OBS} ${TSOBS} ${NTSOBS} ${ADD_FILES} init.c init.o version.c gdb - -Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) - $(SHELL) ./config.status - -force: - -version.c: Makefile - echo 'char *version = "$(VERSION)";' >version.c - -# GNU Make has an annoying habit of putting *all* the Makefile variables -# into the environment, unless you include this target as a circumvention. -# Rumor is that this will be fixed (and this target can be removed) -# in GNU Make 4.0. -.NOEXPORT: - -# GNU Make 3.63 has a different problem: it keeps tacking command line -# overrides onto the definition of $(MAKE). This variable setting -# will remove them. -MAKEOVERRIDES= - -## This is ugly, but I don't want GNU make to put these variables in -## the environment. Older makes will see this as a set of targets -## with no dependencies and no actions. -unexport CHILLFLAGS CHILL_LIB CHILL_FOR_TARGET : - -server.o : ${srcdir}/server.c ${srcdir}/server.h -remote-utils.o : ${srcdir}/remote-utils.c ${srcdir}/server.h -low-linux.o : ${srcdir}/low-linux.c ${srcdir}/server.h -low-lynx.o : ${srcdir}/low-lynx.c ${srcdir}/server.h -low-sim.o : ${srcdir}/low-sim.c ${srcdir}/server.h -low-sparc.o : $(srcdir)/low-sparc.c $(srcdir)/server.h -low-sun3.o : $(srcdir)/low-sun3.c $(srcdir)/server.h -low-hppabsd.o : $(srcdir)/low-hppabsd.c $(srcdir)/server.h -utils.o : ${srcdir}/utils.c ${srcdir}/server.h - -# This is the end of "Makefile.in". Index: gdbserver/config.status =================================================================== RCS file: config.status diff -N config.status --- /tmp/cvs1cGkeO Fri Oct 26 11:28:49 2001 +++ gdbserver/config.status Tue May 5 16:32:27 1998 @@ -1,5 +0,0 @@ -#!/bin/sh -# This file was generated automatically by configure. Do not edit. -# This directory was configured as follows: -../../configure --host=i686-pc-linux-gnu --target=m68k-elf --norecursion -# using "../config/i386/linux.mh" and "../config/m68k/monitor.mt" Index: gdbserver/configure.in =================================================================== RCS file: configure.in diff -N configure.in --- /tmp/cvs34yHi9 Fri Oct 26 11:28:49 2001 +++ gdbserver/configure.in Tue May 5 16:32:27 1998 @@ -1,100 +0,0 @@ -srcname="Remote GDB server" -srctrigger=server.c -gdb_serial_driver=../ser-unix.c - -# per-host: - -. ${srcdir}/../configure.host - -echo "gdbserver/configure.in: host is $host, target is $target" - -if [ ! -f ${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh ]; then - echo '***' "GDB remote does not support host ${host}" 1>&2 - exit 1 -fi - -# We really shouldn't depend on there being a space after XM_FILE= ... -hostfile=`awk '$1 == "XM_FILE=" { print $2 }' <${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh` - -# per-target: - -. ${srcdir}/../configure.tgt - -echo "gdbserver/configure.in: host_cpu is $host_cpu, target_cpu is $target_cpu" - -if [ ! -f ${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt ]; then - echo '***' "GDB remote does not support target ${target}" 1>&2 - exit 1 -fi - -if [ -z "${removing}" ] ; then - cat ${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh ${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt | awk '$1 == "#msg" { - print substr($0,6)}' -fi - -# We really shouldn't depend on there being a space after TM_FILE= ... -targetfile=`awk '$1 == "TM_FILE=" { print $2 }' <${srcdir}/../config/${gdb_target_cpu}/${gdb_target}.mt` - -if [ "${target}" = "${host}" ] ; then - nativefile=`awk '$1 == "NAT_FILE=" { print $2 }' <${srcdir}/../config/${gdb_host_cpu}/${gdb_host}.mh` -fi - -host_makefile_frag=../config/${gdb_host_cpu}/${gdb_host}.mh -target_makefile_frag=../config/${gdb_target_cpu}/${gdb_target}.mt - -# If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile -# (NAT_FILE) is not set in the ?config/* file, we don't make the -# corresponding links. But we have to remove the xm.h files and tm.h -# files anyway, e.g. when switching from "configure host" to -# "configure none". - -files= -links= -rm -f xm.h -rm -f ser-hardwire.c -if [ "${hostfile}" != "" ]; then - if [ -f ${srcdir}/../config/${hostfile} ]; then - files="${files} ../config/${hostfile}" - else - files="${files} ../config/${gdb_host_cpu}/${hostfile}" - fi - links="${links} xm.h" - -# files="${files} ${gdb_serial_driver}" -# links="${links} ser-hardwire.c" -fi -rm -f tm.h -if [ "${targetfile}" != "" ]; then - if [ -f ${srcdir}/../config/${targetfile} ]; then - files="${files} ../config/${targetfile}" - else - files="${files} ../config/${gdb_target_cpu}/${targetfile}" - fi - links="${links} tm.h" -fi -rm -f nm.h -if [ "${nativefile}" != "" ]; then - if [ -f ${srcdir}/../config/${nativefile} ]; then - files="${files} ../config/${nativefile}" - else - files="${files} ../config/${gdb_host_cpu}/${nativefile}" - fi - links="${links} nm.h" -# temporary scaffolding until all hosts have the host/target/native -# split in place. -else - files="${files} ../config/nm-empty.h" - links="${links} nm.h" -fi - -if [ ${target_cpu} = "sparclite" ]; then - configdirs="${configdirs} sparclite" -fi - -# post-target: - -if [ "${nativefile}" = "" ] ; then - sed -e '/^NATDEPFILES= /s//# NATDEPFILES= /' \ - < Makefile > Makefile.tem - mv -f Makefile.tem Makefile -fi Index: gdbserver/low-linux.c =================================================================== RCS file: /usr/local/cvsroot/user/gdbserver/low-linux.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- gdbserver/low-linux.c 2001/09/05 21:34:46 1.1.1.1 +++ gdbserver/low-linux.c 2001/09/05 23:00:53 1.2 @@ -52,7 +52,8 @@ #include -#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) +#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)) && \ + ! defined(__UCLIBC__) #include #endif @@ -505,7 +506,7 @@ */ unsigned int x; x = data_start - (code_end - code_start); - sprintf(buf,"Text=%p;Data=%p;Bss=%p;", code_start, x, x); + sprintf(buf,"Text=%x;Data=%x;Bss=%x;", code_start, x, x); } void Index: gdbserver/remote-utils.c =================================================================== RCS file: /usr/local/cvsroot/user/gdbserver/remote-utils.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- gdbserver/remote-utils.c 2001/09/05 21:34:46 1.1.1.1 +++ gdbserver/remote-utils.c 2001/09/05 23:00:53 1.2 @@ -171,6 +171,8 @@ return a - '0'; else if (a >= 'a' && a <= 'f') return a - 'a' + 10; + else if (a >= 'A' && a <= 'F') + return a - 'A' + 10; else error ("Reply contains invalid hex digit"); } @@ -219,6 +221,8 @@ *p = '\0'; /* Send it over and over until we get a positive ack. */ + + DPRINTF("putpkt buf2 \"%s\"\n", buf2); do { Index: gdbserver/server.c =================================================================== RCS file: /usr/local/cvsroot/user/gdbserver/server.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- gdbserver/server.c 2001/09/05 21:34:46 1.1.1.1 +++ gdbserver/server.c 2001/09/05 23:00:53 1.2 @@ -96,6 +96,7 @@ unsigned char sig; i = 0; ch = own_buf[i++]; + DPRINTF("Got packet %c\n", ch); switch (ch) { case 'd': Index: gdbserver/server.h =================================================================== RCS file: /usr/local/cvsroot/user/gdbserver/server.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- gdbserver/server.h 2001/09/05 21:34:46 1.1.1.1 +++ gdbserver/server.h 2001/09/05 23:00:53 1.2 @@ -74,3 +74,10 @@ /* Functions from low-linux.c */ void show_area(void); void send_area(char *buf); + +#ifdef DEBUG + #define DPRINTF(fmt...) fprintf(stderr, fmt) +#else + #define DPRINTF(fmt...) +#endif + Index: gdbserver/utils.c =================================================================== RCS file: /usr/local/cvsroot/user/gdbserver/utils.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- gdbserver/utils.c 2001/09/05 21:34:46 1.1.1.1 +++ gdbserver/utils.c 2001/09/05 23:00:53 1.2 @@ -85,7 +85,7 @@ } #endif fprintf (stderr, "\n"); - longjmp(toplevel, 1); + longjmp(*(__jmp_buf *)&toplevel, 1); } /* Print an error message and exit reporting failure. Index: inetd/Makefile =================================================================== RCS file: /usr/local/cvsroot/user/inetd/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- inetd/Makefile 2001/08/30 04:13:52 1.1.1.1 +++ inetd/Makefile 2001/08/30 04:58:57 1.2 @@ -1,11 +1,14 @@ SERVICES = \"/etc/services\" INETD_CONF = \"/etc/inetd.conf\" +# HAVE_CFGREAD=y EXEC = inetd OBJS = inetd.o -ifeq ($(ARCHITECTURE),x86) -OBJS += config.o +ifeq ($(HAVE_CFGREAD),y) + CFLAGS += -DHAVE_CFGREAD +else + OBJS += config.o endif CFLAGS += -DSERVICES=$(SERVICES) -DINETD_CONF=$(INETD_CONF) Index: inetd/config.c =================================================================== RCS file: /usr/local/cvsroot/user/inetd/config.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- inetd/config.c 2001/08/30 04:13:52 1.1.1.1 +++ inetd/config.c 2001/08/30 04:58:57 1.2 @@ -46,7 +46,6 @@ char *ebuf; char *p; int i; - int j; if (!fp) { errno = EIO; @@ -86,7 +85,7 @@ strncpy(search, var, sizeof(search)); fseek(fp, 0, SEEK_SET); - while (ret = cfgread(fp)) { + while ((ret = cfgread(fp)) != 0) { if (!strcmp(ret[0], search)) return ret; } return (void *)0; Index: inetd/inetd.c =================================================================== RCS file: /usr/local/cvsroot/user/inetd/inetd.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- inetd/inetd.c 2001/08/30 04:13:52 1.1.1.1 +++ inetd/inetd.c 2001/08/30 04:58:57 1.2 @@ -36,7 +36,7 @@ #include #include -#ifdef __UCLIBC__ +#ifdef HAVE_READCFG #include #else #include "cfgfile.h" @@ -53,7 +53,9 @@ static void read_config(void); -#ifndef __UCLIBC__ +#ifdef __UCLIBC__ +__sighandler_t __signal (int sig, __sighandler_t handler, int flags); +#else __sighandler_t __signal (int sig, __sighandler_t handler, int flags) { @@ -105,7 +107,6 @@ static inline int reap_child(int pid) { - char buf[64]; int reaped = 0; struct stService *p; @@ -265,7 +266,6 @@ } static inline void stop_services(void) { - int s; struct stService *p; struct server_sockaddr; @@ -488,6 +488,7 @@ #endif } +int main(int argc, char *argv[], char *env[]) { #ifdef EMBED @@ -515,4 +516,5 @@ run(); /* not reached */ + return 0; } Index: init/Makefile =================================================================== RCS file: /usr/local/cvsroot/user/init/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- init/Makefile 2001/08/30 04:13:52 1.1.1.1 +++ init/Makefile 2001/08/30 04:15:10 1.2 @@ -5,6 +5,8 @@ EXEC2 = expand OBJS2 = expand.o +EXECS = $(EXEC1) $(EXEC2) + ifdef BUILD_SMALL CFLAGS += -DCONFIG_SMALL endif Index: init/pathnames.h =================================================================== RCS file: /usr/local/cvsroot/user/init/pathnames.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- init/pathnames.h 2001/08/30 04:13:52 1.1.1.1 +++ init/pathnames.h 2001/08/30 04:15:10 1.2 @@ -11,11 +11,7 @@ #endif #ifndef SBINDIR -#ifdef CONFIG_COLDFIRE -# define SBINDIR "/bin" -#else -# define SBINDIR "/sbin" -#endif +#define SBINDIR "/sbin" #endif #define _PATH_BSHELL "/bin/sh" Index: init/simpleinit.c =================================================================== RCS file: /usr/local/cvsroot/user/init/simpleinit.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- init/simpleinit.c 2001/08/30 04:13:52 1.1.1.1 +++ init/simpleinit.c 2001/08/30 04:15:10 1.2 @@ -23,7 +23,7 @@ #include #endif -#include +// #include #include "pathnames.h" @@ -49,6 +49,21 @@ #define ever (;;) +#if (__GNU_LIBRARY__ > 5) || defined(__dietlibc__) + #include + #define init_reboot(magic) reboot(magic) +#else + #define init_reboot(magic) reboot(0xfee1dead, 672274793, magic) +#endif + +#ifndef RB_HALT_SYSTEM +static const int RB_HALT_SYSTEM = 0xcdef0123; +static const int RB_ENABLE_CAD = 0x89abcdef; +static const int RB_DISABLE_CAD = 0; +#define RB_POWER_OFF 0x4321fedc +static const int RB_AUTOBOOT = 0x01234567; +#endif + struct initline { pid_t pid; char tty[10]; @@ -573,10 +588,10 @@ if((pid = vfork()) == 0) { /* reboot properly... */ execl(_PATH_REBOOT, _PATH_REBOOT, (char *)0); - reboot(0xfee1dead, 672274793, 0x1234567); + init_reboot(RB_AUTOBOOT); } else if(pid < 0) /* fork failed, try the hard way... */ - reboot(0xfee1dead, 672274793, 0x1234567); + init_reboot(RB_AUTOBOOT); } #ifdef INCLUDE_TIMEZONE Index: login/Makefile =================================================================== RCS file: /usr/local/cvsroot/user/login/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- login/Makefile 2001/09/05 21:30:22 1.1.1.1 +++ login/Makefile 2001/09/05 21:33:31 1.2 @@ -5,12 +5,9 @@ PASSWD = passwd PASSWDOBJS = passwd.o -ifdef BUILD_NETtel +ifneq ($(strip $(BUILD_NETtel)$(BUILD_NETtel1500)),) CFLAGS += -DCONFIG_NETtel endif -ifdef BUILD_NETtel1500 -CFLAGS += -DCONFIG_NETtel -endif ifeq ($(ARCHITECTURE),x86) LDLIBS += $(LIBCRYPT) @@ -19,10 +16,10 @@ all: $(LOGIN) $(PASSWD) $(LOGIN): $(LOGINOBJS) - $(CC) $(LDFLAGS) -o $@ $(LOGINOBJS) $(LDLIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(LOGINOBJS) $(LDLIBS) $(PASSWD): $(PASSWDOBJS) - $(CC) $(LDFLAGS) -o $@ $(PASSWDOBJS) $(LDLIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(PASSWDOBJS) $(LDLIBS) romfs: $(ROMFSINST) -e CONFIG_USER_LOGIN_LOGIN /bin/login Index: login/login.c =================================================================== RCS file: /usr/local/cvsroot/user/login/login.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- login/login.c 2001/09/05 21:30:22 1.1.1.1 +++ login/login.c 2001/09/05 21:33:31 1.2 @@ -19,6 +19,8 @@ #include #include +#include "passwd_file.h" + /* Delay bad password exit. * * This doesn't really accomplish anything I guess.. @@ -73,17 +75,13 @@ { char *realpwd, *gotpwd; -#ifdef CONFIG_NETtel - gotpwd = getpass("Login: root\nPassword: "); - realpwd = getrealpass("/etc/config/config"); -#else struct utsname name; if (uname(&name)==-1) { perror("Error: "); exit(0); } printf("Welcome to uClinux %s, running on a %s processor,\n", name.release, name.machine); gotpwd = getpass("Enter root password: "); - realpwd = getrealpass("/etc/passwd"); -#endif + realpwd = getrealpass(PASSWDFILE); + if (gotpwd && realpwd) { if (strcmp(crypt(gotpwd, realpwd), realpwd) == 0) execlp("sh", "sh", Index: login/passwd.c =================================================================== RCS file: /usr/local/cvsroot/user/login/passwd.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- login/passwd.c 2001/09/05 21:30:22 1.1.1.1 +++ login/passwd.c 2001/10/04 21:40:10 1.3 @@ -17,20 +17,12 @@ #include #include +#include "passwd_file.h" + /*****************************************************************************/ char *version = "v1.0.2"; - -#ifdef CONFIG_NETtel -#define WORK_DIR "/etc/config/" -#define PASSWDFILE WORK_DIR "config" -#else -#define WORK_DIR "/var/" -#define PASSWDFILE WORK_DIR "passwd" -#endif - - #define MAX_CONFIG_LINE_SIZE 300 #define FLATFSD_PID_FILE "/var/log/flatfsd.pid" @@ -49,12 +41,15 @@ while (n==1) { - strcpy(password1, getpass("Enter new Unix password: ")); + strncpy(password1, getpass("Enter new Unix password: "), + sizeof(password1)); cryptmode = "ab"; - strcpy(password2, getpass("Re-enter new Unix password: ")); + strncpy(password2, getpass("Re-enter new Unix password: "), + sizeof(password2)); if (strcmp(password1,password2) == 0) { - strcpy(password2, crypt(password1,cryptmode)); + strncpy(password2, crypt(password1,cryptmode), + sizeof(password2)); writeConfig(PASSWDFILE, "passwd", password2); commitChanges(); n=0; @@ -65,6 +60,7 @@ n=1; } } + return 0; } /*****************************************************************************/ @@ -114,7 +110,7 @@ fclose(in); if (value != NULL) { - sprintf(tmp, "%s %s\n\0", keyword, value); + sprintf(tmp, "%s %s\n", keyword, value); fputs(tmp, out); } @@ -129,16 +125,21 @@ int commitChanges() { -#ifdef CONFIG_NETtel + int ret_code = 0; +#ifdef FLASH_PASSWD pid_t pid; FILE *in; + printf("Committing changes..."); + fflush(stdout); + /* get the pid of flatfsd */ in = fopen(FLATFSD_PID_FILE, "r"); if(!in) { /* couldn't access flatfsd pid file */ - return -1; + ret_code = -1; + goto exit; } if(fread(&pid, sizeof(pid_t), 1, in) > 0) { @@ -146,15 +147,19 @@ } else { /* no data read from file */ fclose(in); - return -1; + ret_code = -1; + goto exit; } fclose(in); /* send that pid signal 10 */ if((kill(pid, 10)) == -1) { - return -1; + ret_code = -1; + goto exit; } - return 0; +exit: + printf(" %s.\n", ret_code ? "Error" : "OK"); #endif + return ret_code; } Index: login/passwd_file.h =================================================================== RCS file: passwd_file.h diff -N passwd_file.h --- /dev/null Tue May 5 16:32:27 1998 +++ login/passwd_file.h Fri Oct 26 11:28:49 2001 @@ -0,0 +1,23 @@ +#ifndef __PASSWD_FILE_H +#define __PASSWD_FILE_H + +// The kernel configuration gets included by other header files. +// This prevents us from checking any CONFIG_* symbols defined +// through CFLAGS in Makefile. +#include + +#if defined(CONFIG_NETtel) || defined(CONFIG_eLIA) \ + || defined(CONFIG_SUPERBTLAP) +#define FLASH_PASSWD +#endif + +#ifdef FLASH_PASSWD +#define WORK_DIR "/etc/config/" +#define PASSWDFILE WORK_DIR "config" +#else +#define WORK_DIR "/var/" +#define PASSWDFILE WORK_DIR "passwd" +#endif + +#endif + Index: netflash/Makefile =================================================================== RCS file: /usr/local/cvsroot/user/netflash/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- netflash/Makefile 2001/08/30 04:13:52 1.1.1.1 +++ netflash/Makefile 2001/08/30 05:42:00 1.2 @@ -2,6 +2,9 @@ EXEC = netflash OBJS = netflash.o tftpmain.o tftp.o tftpsubs.o http.o +# CONFIG_USER_NETFLASH_WITH_FTP = y +# CONFIG_USER_NETFLASH_VERSION = y + ifdef CONFIG_USER_NETFLASH_WITH_FTP CFLAGS += -DFTP OBJS += cmds.o cmdtab.o domacro.o ftp.o glob.o ftpmain.o ruserpass.o Index: netflash/netflash.c =================================================================== RCS file: /usr/local/cvsroot/user/netflash/netflash.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- netflash/netflash.c 2001/08/30 04:13:52 1.1.1.1 +++ netflash/netflash.c 2001/08/30 05:42:00 1.2 @@ -33,7 +33,7 @@ #include #include -#include +// #include #ifdef CONFIG_USER_NETFLASH_VERSION #include "versioning.h" Index: netflash/tftp.c =================================================================== RCS file: /usr/local/cvsroot/user/netflash/tftp.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- netflash/tftp.c 2001/08/30 04:13:52 1.1.1.1 +++ netflash/tftp.c 2001/08/30 05:42:00 1.2 @@ -52,16 +52,22 @@ jmp_buf tftptoplevel; jmp_buf tftptimeoutbuf; -tftptimer() +struct tftphdr; +struct tftphdr *tftpw_init(void); +struct tftphdr *tftpr_init(void); +FILE *local_fdopen(int fd, char *flags); + +void +tftptimer(int signo) { signal(SIGALRM, tftptimer); tftptimeout += tftprexmtval; if (tftptimeout >= tftpmaxtimeout) { printf("Transfer timed out.\n"); - longjmp(tftptoplevel, -1); + longjmp(*(__jmp_buf *)&tftptoplevel, -1); } - longjmp(tftptimeoutbuf, 1); + longjmp(*(__jmp_buf *)&tftptimeoutbuf, 1); } #if 0 @@ -207,7 +213,8 @@ send_ack: if (tftptrace) tftptpacket("sent", ap, size); - if (sendto(tftpf, tftpackbuf, size, 0, (caddr_t)&tftpsin, + if (sendto(tftpf, tftpackbuf, size, 0, + (const struct sockaddr *)&tftpsin, sizeof (tftpsin)) != size) { alarm(0); perror("tftp: sendto"); @@ -219,7 +226,7 @@ do { fromlen = sizeof (from); n = recvfrom(tftpf, dp, PKTSIZE, 0, - (caddr_t)&from, &fromlen); + (struct sockaddr *)&from, &fromlen); } while (n <= 0); alarm(0); if (n < 0) { @@ -266,7 +273,8 @@ abort: /* ok to ack, since user */ ap->th_opcode = htons((u_short)ACK); /* has seen err msg */ ap->th_block = htons((u_short)block); - (void) sendto(tftpf, tftpackbuf, 4, 0, &tftpsin, sizeof (tftpsin)); + (void) sendto(tftpf, tftpackbuf, 4, 0, + (struct sockaddr *)&tftpsin, sizeof (tftpsin)); tftpwrite_behind(file, convert); /* flush last buffer */ local_fclose(file); tftpstopclock(); @@ -339,7 +347,8 @@ length = strlen(pe->e_msg) + 4; if (tftptrace) tftptpacket("sent", tp, length); - if (sendto(tftpf, tftpackbuf, length, 0, &tftpsin, sizeof (tftpsin)) != length) + if (sendto(tftpf, tftpackbuf, length, 0, + (const struct sockaddr *)&tftpsin, sizeof (tftpsin)) != length) perror("nak"); } Index: netflash/tftpmain.c =================================================================== RCS file: /usr/local/cvsroot/user/netflash/tftpmain.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- netflash/tftpmain.c 2001/08/30 04:13:52 1.1.1.1 +++ netflash/tftpmain.c 2001/08/30 05:42:00 1.2 @@ -58,7 +58,7 @@ char *tftpmargv[20]; char *tftpprompt = "tftp"; jmp_buf tftptoplevel; -int tftpintr(); +void tftpintr(int signo); #ifndef EMBED struct servent *tftpsp; #endif @@ -139,7 +139,7 @@ } bzero((char *)&sin, sizeof (sin)); sin.sin_family = AF_INET; - if (bind(tftpf, &sin, sizeof (sin)) < 0) { + if (bind(tftpf, (struct sockaddr *)&sin, sizeof (sin)) < 0) { perror("tftp: bind"); exit(1); } @@ -168,7 +168,10 @@ if (argc < 2) { strcpy(tftpline, "Connect "); printf("(to) "); - gets(&tftpline[strlen(tftpline)]); + fgets(&tftpline[strlen(tftpline)], + sizeof(tftpline) - strlen(tftpline), stdin); + if (strlen(tftpline) && tftpline[strlen(tftpline) - 1] == '\n') + tftpline[strlen(tftpline) - 1] = '\0'; tftpmakeargv(); argc = tftpmargc; argv = tftpmargv; @@ -288,7 +291,10 @@ if (argc < 2) { strcpy(tftpline, "send "); printf("(file) "); - gets(&tftpline[strlen(tftpline)]); + fgets(&tftpline[strlen(tftpline)], + sizeof(tftpline) - strlen(tftpline), stdin); + if (strlen(tftpline) && tftpline[strlen(tftpline) - 1] == '\n') + tftpline[strlen(tftpline) - 1] = '\0'; tftpmakeargv(); argc = tftpmargc; argv = tftpmargv; @@ -380,7 +386,10 @@ if (argc < 2) { strcpy(tftpline, "get "); printf("(files) "); - gets(&tftpline[strlen(tftpline)]); + fgets(&tftpline[strlen(tftpline)], + sizeof(tftpline) - strlen(tftpline), stdin); + if (strlen(tftpline) && tftpline[strlen(tftpline) - 1] == '\n') + tftpline[strlen(tftpline) - 1] = '\0'; tftpmakeargv(); argc = tftpmargc; argv = tftpmargv; @@ -465,7 +474,10 @@ if (argc < 2) { strcpy(tftpline, "Rexmt-timeout "); printf("(value) "); - gets(&tftpline[strlen(tftpline)]); + fgets(&tftpline[strlen(tftpline)], + sizeof(tftpline) - strlen(tftpline), stdin); + if (strlen(tftpline) && tftpline[strlen(tftpline) - 1] == '\n') + tftpline[strlen(tftpline) - 1] = '\0'; tftpmakeargv(); argc = tftpmargc; argv = tftpmargv; @@ -493,7 +505,10 @@ if (argc < 2) { strcpy(tftpline, "Maximum-timeout "); printf("(value) "); - gets(&tftpline[strlen(tftpline)]); + fgets(&tftpline[strlen(tftpline)], + sizeof(tftpline) - strlen(tftpline), stdin); + if (strlen(tftpline) && tftpline[strlen(tftpline) - 1] == '\n') + tftpline[strlen(tftpline) - 1] = '\0'; tftpmakeargv(); argc = tftpmargc; argv = tftpmargv; @@ -523,11 +538,12 @@ } #endif -tftpintr() +void +tftpintr(int signo) { signal(SIGALRM, SIG_IGN); alarm(0); - longjmp(tftptoplevel, -1); + longjmp(*(__jmp_buf *)&tftptoplevel, -1); } char * @@ -560,7 +576,7 @@ putchar('\n'); for (;;) { printf("%s> ", prompt); - if (gets(tftpline) == 0) { + if (fgets(tftpline, sizeof(tftpline), stdin) == NULL) { if (feof(stdin)) { tftpquit(); } else { Index: netflash/tftpsubs.c =================================================================== RCS file: /usr/local/cvsroot/user/netflash/tftpsubs.c,v retrieving revision 1.1.1.1 retrieving revision 1.3 diff -u -r1.1.1.1 -r1.3 --- netflash/tftpsubs.c 2001/08/30 04:13:52 1.1.1.1 +++ netflash/tftpsubs.c 2001/08/30 05:53:45 1.3 @@ -56,11 +56,13 @@ static int newline = 0; /* fillbuf: in middle of newline expansion */ static int prevchar = -1; /* putbuf: previous char (cr check) */ -struct tftphdr *tftprpw_init(); +struct tftphdr; -struct tftphdr *tftpw_init() { return tftprw_init(0); } /* write-behind */ -struct tftphdr *tftpr_init() { return tftprw_init(1); } /* read-ahead */ +struct tftphdr *tftprw_init(int); +struct tftphdr *tftpw_init(void) { return tftprw_init(0); } /* write-behind */ +struct tftphdr *tftpr_init(void) { return tftprw_init(1); } /* read-ahead */ + struct tftphdr * tftprw_init(x) /* init for either read-ahead or write-behind */ int x; /* zero for write-behind, one for read-head */ @@ -242,7 +244,7 @@ j++; fromlen = sizeof from; (void) recvfrom(f, rbuf, sizeof (rbuf), 0, - (caddr_t)&from, &fromlen); + (const struct sockaddr *)&from, &fromlen); } else { return(j); } Index: sertest/Makefile =================================================================== RCS file: Makefile diff -N Makefile --- /dev/null Tue May 5 16:32:27 1998 +++ sertest/Makefile Fri Oct 26 11:28:49 2001 @@ -0,0 +1,11 @@ +ENC_OBJS = serialtest.o + +EXE=sertest + +all: $(EXE) + +$(EXE): $(ENC_OBJS) + $(CC) $(LDFLAGS) $(ENC_OBJS) -o $(EXE) $(LDLIBS) + +clean: + rm -rf $(EXE) *.o *~ *.gdb Index: sertest/README.txt =================================================================== RCS file: README.txt diff -N README.txt --- /dev/null Tue May 5 16:32:27 1998 +++ sertest/README.txt Fri Oct 26 11:28:49 2001 @@ -0,0 +1,57 @@ + +A small program to test a serialport +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +It simply sends a string of data over a serial cable, on the other side +the data is echoed back if it was correct, when received it is once again +checked. + +"Server" side - echoes back received data if ok +"Client" side - starts sending data and checks echoed data for errors + +The program uses default /dev/ttyS0 and 115200 bps, if you need other +setting simply change defines in serialtest.c and recompile. + +tar xvzf sertest.tgz +cd sertest +'make' + + +Start the application (as root) on server side with + +./sertest -e +which waits for 127 chars (0,1,2,3...) and when all are received it +checks that they look ok. Then it echoes it back to the initiator. + + +On the 'client' side start (as root) + +./sertest +which will start sending 127 characters on the serial port. After getting +the echo response back it checks the data for errors and then sends +another chunk of data if the received data was ok. + + +As soon as either side sees any errors it will stop. +If you see this happening try using another computer, preferably a +stationary (some laptops has strange voltage levels on their serial +port...) + + +If errors occur on either of the serialports the program is stopped. + +* When using older Ericsson modules like P9A and below there are quite often + trashed data on the modules uart (especially when running at higher speeds). + +* Old computer (e.g i386/486) with 'bad' IRQ setttings for + serial port might cause trashed data on the uart. + +* Especially when running on a some laptops we have experienced errors + after just a couple of seconds when running this program. + +* We have never seen any problems on a stationary computer. + +--- + +brgds +Axis Bluetooth Team Index: sertest/serialtest.c =================================================================== RCS file: serialtest.c diff -N serialtest.c --- /dev/null Tue May 5 16:32:27 1998 +++ sertest/serialtest.c Fri Oct 26 11:28:49 2001 @@ -0,0 +1,227 @@ +/* + * serialtest.c -- Simple test prog for testing serial ports + * + * Copyright (C) 2000 Axis Communications AB + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * + */ + +#include /* socket, bind, accept */ +#include /* open */ +#include +#include +#include /* stdin, stdout, stderr */ +#include +#include +#include +#include /* timeval */ +#include +#include /* memset used by FD_ZERO */ + +#ifdef DEBUG + #define DPRINTF(fmt...) printf(fmt) + #define DFLUSH() fflush(stdout) +#else + #define DPRINTF(fmt...) + #define DFLUSH() +#endif + + +#define DEFAULT_DEV "/dev/ttyS0" +#define DEFAULT_SPEED 115200 + +int translate_speed(int spd); +void fd_setup(int fd, int speed, int flow); + +int main(int argc, char **argv) +{ + int serfd; + int i, j, c=0, error=0, len, do_echo = 0; + char txdata[127]; + char rxdata[256]; + + if (argc>2) { + printf("wrong syntax ! ./sertest [-e]"); + exit(1); + } + + if (argc == 2) { + if ((strcmp("-e", argv[1]))==0) + do_echo=1; + else + printf("wrong syntax ! ./sertest [-e]\n"); + } + + printf("Opening %s\n", DEFAULT_DEV); + serfd = open(DEFAULT_DEV, O_RDWR); + + if (serfd < 0) + exit(1); + + fd_setup(serfd, DEFAULT_SPEED, 1); + + for (i=0;i<127;i++) + txdata[i]=i+64; + + if (!do_echo) { + while (!error) { + len = 0; + i=0; + DPRINTF("-%d- Sending data..", c++); + printf("."); fflush(stdout); + write(serfd, txdata, 127); + DPRINTF("done.\n"); + + /* wait for 127 chars */ + while (len < 127) { + j = len; + len += read(serfd, rxdata+len, 127); + DPRINTF("Got [%d/127]...\n", len); + for (i = len - j; i > 0; i--) { + DPRINTF("%c", *(rxdata + len - i)); + } + DPRINTF("\n"); + DFLUSH(); + } + + /* now compare the received data */ + DPRINTF("Got response, comparing... "); + + if (memcmp(rxdata, rxdata, 127) == 0) { + DPRINTF("OK."); + printf("+\b"); + } else { + error = 1; + printf("?"); + DPRINTF("Error"); + } + DPRINTF("\n"); + fflush(stdout); + } + } else { + DPRINTF("Running as echo server.\n"); + while (!error) { + len = 0; + + printf(":"); fflush(stdout); + + /* wait for 127 chars */ + while (len < 127) { + j = len; + len += read(serfd, rxdata+len, 127); + DPRINTF("Got [%d/127]...\n", len); + for (i = len - j; i > 0; i--) { + DPRINTF("%c", *(rxdata + len - i)); + } + DPRINTF("\n"); + DFLUSH(); + } + + /* now compare the received data */ + DPRINTF("-%d- Checking RX data... ", c++); + + if (memcmp(txdata, rxdata, 127) == 0) { + DPRINTF("OK...echoing."); + printf("+\b"); + write(serfd, rxdata, 127); + } else { + printf("?"); + DPRINTF("ERROR"); + error = 1; + } + DPRINTF("\n"); + fflush(stdout); + } + } + + DPRINTF("Not OK !\n"); + for (i=0;i<127;i++) + DPRINTF("%c", txdata[i]); + + DPRINTF("\n"); + + exit(1); +} + +int translate_speed(int spd) +{ + int speed_c = 0; + + switch(spd) + { + case 9600: + speed_c = B9600; + break; + case 19200: + speed_c = B19200; + break; + case 38400: + speed_c = B38400; + break; + case 57600: + speed_c = B57600; + break; + case 115200: + speed_c = B115200; + break; + case 230400: + speed_c = B230400; + break; + case 460800: + speed_c = B460800; + break; + default: + printf("Bad baudrate %d.\n", spd); + break; + } + return speed_c; +} + +void fd_setup(int fd, int speed, int flow) +{ + struct termios t; + + if (fd < 0) { + perror("fd_setup"); + exit(1); + } + + if (tcgetattr(fd, &t) < 0) { + perror("tcgetattr"); + exit(1); + } + + cfmakeraw(&t); + + t.c_cflag &= ~CBAUD; + t.c_cflag |= translate_speed(speed) | CS8 | CLOCAL; + t.c_oflag = 0; /* turn off output processing */ + t.c_lflag = 0; /* no local modes */ + + if (flow) + t.c_cflag |= CRTSCTS; + else + t.c_cflag &= ~CRTSCTS; + + if (tcsetattr(fd, TCSANOW, &t) < 0) { + perror("fd_setup : tcsetattr"); + exit(1); + } + return; +} +