Commits

Palmer, 2E0EOL committed c8d99e3

Code from SVN daybodep-0.4.3 tag, recovered from .tar release

  • Participants
  • Parent commits bbcad3d
  • Tags daybodep-0.4.3

Comments (0)

Files changed (14)

 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 #
-# Daybo Logic
-# 13 Forest Close,
-# Newport,
-# Isle of Wight,
-# England.
+# Daybo Logic,
+# 57 Alderwood Parc,
+# Penryn,
+# Kernow,
+# United Kingdom
+#
+# TR10 8RL
+
 #
 # Makefile for GNU compatible environments.
 #
 endif
 
 NULL_DEVICE=/dev/null
-FILES=daybodep$(C) daybodep_stringlist$(C) daybodep_checksum$(C) daybodep_strsimple$(C) daybodep_license$(C)
-OBJS=daybodep$(O) daybodep_stringlist$(O) daybodep_checksum$(O) daybodep_strsimple$(O) daybodep_license$(O)
+FILES=daybodep$(C) daybodep_stderr$(C) daybodep_stringlist$(C) daybodep_checksum$(C) daybodep_strsimple$(C) daybodep_license$(C)
+OBJS=daybodep$(O) daybodep_stderr$(O) daybodep_stringlist$(O) daybodep_checksum$(O) daybodep_strsimple$(O) daybodep_license$(O)
 MYLIBS=
 
 # I can't use CFLAGS from within a CFLAGS definition because GNU Make is
 daybodep$(O) : daybodep$(C) daybodep$(H)
 	$(CC) $(CFLAGS) daybodep$(C)
 
+daybodep_stderr$(O) : daybodep_stderr$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep_stderr$(C)
+
 daybodep_stringlist$(O) : daybodep_stringlist$(C) daybodep$(H)
 	$(CC) $(CFLAGS) daybodep_stringlist$(C)
 

File Makefile.bor

-#
-#   Daybo Logic Dependency tool
-#   Copyright (C) 2001-2003  David Duncan Ross Palmer, Daybo Logic.
-#
-#   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
-#
-#
-# Daybo Logic
-# 13 Forest Close,
-# Newport,
-# Isle of Wight,
-# England.
-#
-# Makefile for Borland C++ (define B16 to force 16-bit compile) otherwise
-# 32-bit mode is used by default.
-#
-
-!ifdef OVERCHAT
-!include ../MasterMake.bor
-!endif
-
-C=.c
-CPP=.cpp
-H=.h
-O=.obj
-E=.exe
-NULL_DEVICE=nul
-ERASE=erase
-FILES=daybodep$(C) daybodep_stringlist$(C) daybodep_checksum$(C) daybodep_strsimple$(C) daybodep_license$(C)
-OBJS=daybodep$(O) daybodep_stringlist$(O) daybodep_checksum$(O) daybodep_strsimple$(O) daybodep_license$(O)
-MYLIBS=
-
-!ifdef OVERCHAT
-CFLAGS=$(MASTER_CFLAGS) $(ANSI)
-LFLAGS=$(MASTER_LFLAGS)
-!else   # Not in OverChat tree
-!ifdef DEBUG
-CFLAGS=-DDEBUG -D__WIN32__ -v -c -A
-LFLAGS=-DDEBUG -D__WIN32__ -v
-!else
-CFLAGS=-DNDEBUG -D__WIN32__ -O1 -c -A
-LFLAGS=-DNDEBUG -D__WIN32__ -O1
-!endif
-!endif
-
-!ifdef OS
-CFLAGS=$(CFLAGS)
-!else
-CFLAGS=$(CFLAGS)
-!endif
-
-TARGET=daybodep$(E)
-
-!ifndef OVERCHAT
-!ifdef B16
-CC=bcc
-!else
-CC=bcc32
-!endif
-!endif
-
-all : $(TARGET)
-	@echo "==> Building daybodep <=="
-
-$(TARGET) : $(OBJS)
-	$(CC) $(LFLAGS) -e$(TARGET) $(OBJS)
-
-daybodep$(O) : daybodep$(C) daybodep$(H)
-	$(CC) $(CFLAGS) daybodep$(C)
-
-daybodep_stringlist$(O) : daybodep_stringlist$(C) daybodep$(H)
-	$(CC) $(CFLAGS) daybodep_stringlist$(C)
-
-daybodep_checksum$(O) : daybodep_checksum$(C) daybodep$(H)
-	$(CC) $(CFLAGS) daybodep_checksum$(C)
-
-daybodep_strsimple$(O) : daybodep_strsimple$(C) daybodep$(H)
-	$(CC) $(CFLAGS) daybodep_strsimple$(C)
-
-daybodep_license$(O) : daybodep_license$(C) daybodep$(H)
-	$(CC) $(CFLAGS) daybodep_license$(C)
-
-clean:
-	@echo "==> Clean daybodep <=="
-	-@$(ERASE) daybodep$(O)
-	-@$(ERASE) daybodep_stringlist$(O)
-   -@$(ERASE) daybodep_checksum$(O)
-   -@$(ERASE) daybodep_strsimple$(O)
-   -@$(ERASE) daybodep_license$(O)
-	-@$(ERASE) *.tds
-   -@$(ERASE) *.bak
-	-@$(ERASE) $(TARGET)
-
-test : all
-	rem Test the license is NULL terminated
-	$(TARGET) --license > $(NULL_DEVICE)
-   $(TARGET) --version
-   dir $(TARGET)
+#
+#   Daybo Logic Dependency tool
+#   Copyright (C) 2001-2003  David Duncan Ross Palmer, Daybo Logic.
+#
+#   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
+#
+#
+# Daybo Logic,
+# 57 Alderwood Parc,
+# Penryn,
+# Kernow,
+# United Kingdom
+#
+# TR10 8RL
+#
+#
+# Makefile for Borland C++ (define B16 to force 16-bit compile) otherwise
+# 32-bit mode is used by default.
+#
+
+!ifdef OVERCHAT
+!include ../MasterMake.bor
+!endif
+
+C=.c
+CPP=.cpp
+H=.h
+O=.obj
+E=.exe
+NULL_DEVICE=nul
+ERASE=erase
+FILES=daybodep$(C) daybodep_stderr$(C) daybodep_stringlist$(C) daybodep_checksum$(C) daybodep_strsimple$(C) daybodep_license$(C)
+OBJS=daybodep$(O) daybodep_stderr$(O) daybodep_stringlist$(O) daybodep_checksum$(O) daybodep_strsimple$(O) daybodep_license$(O)
+MYLIBS=
+
+!ifdef OVERCHAT
+CFLAGS=$(MASTER_CFLAGS) $(ANSI)
+LFLAGS=$(MASTER_LFLAGS)
+!else   # Not in OverChat tree
+!ifdef DEBUG
+CFLAGS=-DDEBUG -D__WIN32__ -v -c -A
+LFLAGS=-DDEBUG -D__WIN32__ -v
+!else
+CFLAGS=-DNDEBUG -D__WIN32__ -O1 -c -A
+LFLAGS=-DNDEBUG -D__WIN32__ -O1
+!endif
+!endif
+
+!ifdef OS
+CFLAGS=$(CFLAGS)
+!else
+CFLAGS=$(CFLAGS)
+!endif
+
+TARGET=daybodep$(E)
+
+!ifndef OVERCHAT
+!ifdef B16
+CC=bcc
+!else
+CC=bcc32
+!endif
+!endif
+
+all : $(TARGET)
+	-upx32 -v -9 $(TARGET)
+	-upx32 -t $(TARGET)
+
+$(TARGET) : $(OBJS)
+	$(CC) $(LFLAGS) -e$(TARGET) $(OBJS)
+
+daybodep$(O) : daybodep$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep$(C)
+
+daybodep_stderr$(O) : daybodep_stderr$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep_stderr$(C)
+
+daybodep_stringlist$(O) : daybodep_stringlist$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep_stringlist$(C)
+
+daybodep_checksum$(O) : daybodep_checksum$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep_checksum$(C)
+
+daybodep_strsimple$(O) : daybodep_strsimple$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep_strsimple$(C)
+
+daybodep_license$(O) : daybodep_license$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep_license$(C)
+
+clean:
+	@echo "==> Clean daybodep <=="
+	-@if exist daybodep$(O) $(ERASE) daybodep$(O)
+	-@if exist daybodep_stderr$(O) $(ERASE) daybodep_stderr$(O)
+	-@if exist daybodep_stringlist$(O) $(ERASE) daybodep_stringlist$(O)
+	-@if exist daybodep_checksum$(O) $(ERASE) daybodep_checksum$(O)
+	-@if exist daybodep_strsimple$(O) $(ERASE) daybodep_strsimple$(O)
+	-@if exist daybodep_license$(O) $(ERASE) daybodep_license$(O)
+	-@if exist daybodep.tds $(ERASE) daybodep.tds
+	-@if exist *.bak $(ERASE) *.bak
+	-@if exist daybodep.il? $(ERASE) daybodep.il?
+	-@if exist $(TARGET) $(ERASE) $(TARGET)
+
+test : all
+	rem Test the license is NULL terminated
+	$(TARGET) --license > $(NULL_DEVICE)
+	$(TARGET) --version
+	dir $(TARGET)

File Makefile.bsd

 #
 #   Daybo Logic Dependency tool
-#   Copyright (C) 2001,2002  David Duncan Ross Palmer, Daybo Logic.
+#   Copyright (C) 2001-2003  David Duncan Ross Palmer, Daybo Logic.
 #
 #   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
 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 #
-# Daybo Logic
-# 13 Forest Close,
-# Newport,
-# Isle of Wight,
-# England.
+# Daybo Logic,
+# 57 Alderwood Parc,
+# Penryn,
+# Kernow,
+# United Kingdom
 #
-# Makefile for GNU compatible environments.
+# TR10 8RL
+
 #
-
-.ifdef OVERCHAT
-include ../MasterMake.gnu
-.endif
+# Makefile for BSD compatible environments.
+#
 
 C=.c
 CPP=.cpp
 H=.h
 O=.o
 E=
+
 ERASE=rm -f
-FILES=daybodep$(CPP) daybodep_stringlist$(CPP)
-OBJS=daybodep$(O) daybodep_stringlist$(O)
+
+NULL_DEVICE=/dev/null
+FILES=daybodep$(C) daybodep_stderr$(C) daybodep_stringlist$(C) daybodep_checksum$(C) daybodep_strsimple$(C) daybodep_license$(C)
+OBJS=daybodep$(O) daybodep_stderr$(O) daybodep_stringlist$(O) daybodep_checksum$(O) daybodep_strsimple$(O) daybodep_license$(O)
 MYLIBS=
 
-.ifdef OVERCHAT
+# I can't use CFLAGS from within a CFLAGS definition because GNU Make is
+# retarded and Borland make owns it's backside.  So that's why a lot of
+# these flags are repeated.
 
-CFLAGS=$(MASTER_CFLAGS) $(ANSI)
-LFLAGS=$(MASTER_LFLAGS)
-
-.else   # Not in OverChat tree
-
-.ifdef DEBUG
+!ifdef DEBUG
 CFLAGS=-D__UNIX__ -g -c -ansi -pedantic -Wall
 LFLAGS=-D__UNIX__ -g
-.else
+!else
 CFLAGS=-D__UNIX__ -O1 -c -ansi -pedantic -Wall
 LFLAGS=-D__UNIX__ -O1
-.endif
+!endif
 
-CPPC=g++
+CPPC=c++
+CC=cc
 
-.endif
 
 TARGET=daybodep$(E)
 
 all : bmsg $(TARGET)
 
 $(TARGET) : $(OBJS)
-	$(CPPC) $(LFLAGS) -o $(TARGET) $(OBJS)
+	$(CC) $(LFLAGS) -o $(TARGET) $(OBJS)
+	size $(TARGET)
 
-daybodep$(O) : daybodep$(CPP)
-	$(CPPC) $(CFLAGS) daybodep$(CPP)
+daybodep$(O) : daybodep$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep$(C)
 
-daybodep_stringlist$(O) : daybodep_stringlist$(CPP)
-	$(CPPC) $(CFLAGS) daybodep_stringlist$(CPP)
+daybodep_stderr$(O) : daybodep_stderr$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep_stderr$(C)
+
+daybodep_stringlist$(O) : daybodep_stringlist$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep_stringlist$(C)
+
+daybodep_checksum$(O) : daybodep_checksum$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep_checksum$(C)
+
+daybodep_strsimple$(O) : daybodep_strsimple$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep_strsimple$(C)
+
+daybodep_license$(O) : daybodep_license$(C) daybodep$(H)
+	$(CC) $(CFLAGS) daybodep_license$(C)
 
 bmsg:
 	@echo "==> Building daybodep <==="
 
 clean:
 	@echo "==> Clean daybodep <=="
-	-@$(ERASE) daybodep$(O) $(TARGET) daybodep_stringlist$(O)
+	-@$(ERASE) $(TARGET) $(OBJS)
 
 depend:
 	@echo "Cannot generate dependencies of self"
 
-# You need root to do these things
+test : all
+	./$(TARGET) --license > $(NULL_DEVICE)  # Make sure license is terminated with a NULL character
+	./$(TARGET) --version
+
+# You need root to do these things, note: not used by OverChat
 
 install : $(TARGET)
-	@echo "==> Installing daybodep <==="
+	@echo "==> Installing daybodep <===" 
 	@cp -v -f $(TARGET) /usr/local/bin
 
 deinstall : uninstall   #Alias
 
 uninstall:
 	@echo "===> Uninstalling daybodep <==="
-	@rm -v -f /usr/local/bin/$(TARGET)
+	@$(ERASE) /usr/local/bin/$(TARGET)

File Makefile_oc.bor

 #
 #
 # Daybo Logic
-# 13 Forest Close,
-# Newport,
-# Isle of Wight,
-# England.
+# 57 Alderwood Parc,
+# Penryn,
+# Kernow,
+# United Kingdom
+#
+# TR10 8RL
+#
 #
 # This is just a makefile wrapper for use in the OverChat tree
 

File Makefile_oc.gnu

 #
 #
 # Daybo Logic
-# 13 Forest Close,
-# Newport,
-# Isle of Wight,
-# England.
+# 57 Alderwood Parc,
+# Penryn,
+# Kernow,
+# United Kingdom
+#
+# TR10 8RL
+#
 #
 # This file is a wrapper for GNUmakefile for OverChat
 
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
-  Daybo Logic
-  13 Forest Close,
-  Newport,
-  Isle of Wight,
-  England.
+  Daybo Logic,
+  57 Alderwood Parc,
+  Penryn,
+  Kernow,
+  United Kingdom
+
+  TR10 8RL
 
 The Daybo Logic dependency program is simply a method to help out on
 systems which don't support autodependencies.  Autodependencies are
    Only headers which are always used should have dependencies though
    daybodep.
 
+-nse (--no-stderr) = This option disables the use of the stderr stream.
+     If this switch is selected, errors will be printed onto the standard
+     output (which has been redirected to your dependency listing file
+     under normal use of the program.  Therefore this is only provided
+     for people who may wish the errors to be listed in the dependency file
+     for viewing after the build.  This is especially useful for long builds
+     where stderr output is lost in the mists of time.  You may find it
+     more useful to redirect stderr to another log or better yet, to a
+     line printer on long builds.
+
 This program is Copyright Daybo Logic and subject to the GNU GPL.
 For more information visit http://www.daybologic.co.uk
 It will help you build large projects.
 
 
   Daybo Logic
-  13 Forest Close,
-  Newport,
-  Isle of Wight,
-  England.
+  57 Alderwood Parc,
+  Penryn,
+  Kernow,
+  United Kingdom.
+
+  TR10 8RL
 */
 
 #include <assert.h>
 static const char OptMsgVerbose[] = "Verbose mode";
 static const char OptMsgHelp[] = "Help requested";
 static const char OptMsgSystem[] = "Creating system header dependencies";
+static const char OptMsgNse[] = "Redirecting errors to stdout";
 
 /* Variables */
 static struct {
   bool Version;
   bool License;
   bool System;
+  bool Nse;
 } Options;
 
-struct string_list FileNames, ResponseFiles, Paths;
+static struct string_list FileNames, ResponseFiles, Paths;
+
+static int ArgC; /* File level command-line argument count */
+static char** ArgV; /* File level command-line vector */
 
 /* General Functions */
 static void CClassGlobalConstruct(void); /* To be called from main() only */
 static void Version(void);
 static void License(void);
 static void Help(void);
-static bool ParseOptions(int ArgC, char* ArgV[]);
+static bool ParseOptions(void);
 static void DisplayChosenOptions(void);
-static void CvtResponse(void);
+static bool CvtResponse(void);
 static unsigned int DoDependencyLoop(void);
 static void StripTrailingWhitespace(char* TheString, char TheWhitespace); /* Strips trailing characters */
 static bool FileExists(const char* Filename);
 static char LastChar(const char* Str);
 
 /* Functions which are not generally called directly (subfunctions etc) */
-static void CvtResponse2(FILE* PFS); /* Called by CvtResponse() */
+static bool CvtResponse2(FILE* PFS); /* Called by CvtResponse() */
 static bool LookDeps(const char* FileName, FILE* PFS, struct string_list*); /* Called by DoDependencyLoop() */
 static char* LookInclude(char* Line);
 static void PrintDeps(const char* FileName, const struct string_list* DepList);
 {
   unsigned int failCount;
 
+  /* Copy the arguments to the file level so that everybody can benefit */
+  ArgC = argc;
+  ArgV = argv;
+
   /* Deal with static C "classes" */
   CClassGlobalConstruct();
   atexit(CClassGlobalDestruct);
 
-  if ( !ParseOptions(argc, argv) )
+  if ( !ParseOptions() )
     return RET_BADPARAMS;
 
   if ( Options.Verbose ) {
     Help();
 
   /* This will convert the response files into normal files */
-  CvtResponse();
+  if ( !CvtResponse() )
+    return RET_DEPGENFAIL;
 
   failCount = DoDependencyLoop();
   if ( failCount ) {
-    printf("ERROR: Dependency generation for %u fil%s failed!\n", failCount, (failCount==1) ? "e" : "es");
+    fprintf(GetStandardError(), "%s: Error! Dependency generation for %u fil%s failed!\n", ArgV[0], failCount, (failCount==1) ? "e" : "es");
     return RET_DEPGENFAIL;
   }
 
 /*-------------------------------------------------------------------------*/
 static void Title(const char* ProgramName)
 {
-  puts("Daybo Logic dependency generator by DDRP <Overlord@DayboLogic.co.uk>");
+  puts("Daybo Logic dependency generator by DDRP <daybologic.co.uk/mailddrp>");
   puts("Copyright (C) 2001-2003 Daybo Logic http://www.daybologic.co.uk");
   puts("daybodep comes with ABSOLUTELY NO WARRANTY; for details visit our site.");
   puts("This is free software, and you are welcome to redistribute it");
   puts("-h or --help causes this message to be displayed");
   puts("-ver or --version displays the version number and build date of the program");
   puts("-l or --license displays the GNU General Public License");
-  puts("-s to --system makes system headers explicit dependencies too");
+  puts("-s or --system makes system headers explicit dependencies too");
+  puts("-nse or --no-stderr makes errors print to the standard output");
   puts("-I<path> sets a path for headers when dependencies are in multiple dirs");
   puts("filenames list source files to scan for dependencies");
   puts("Response files must start with \'@\' and list one file per line");
   puts("the output to a file, for example: ./daybodep source.c > .depend");
 }
 /*-------------------------------------------------------------------------*/
-static bool ParseOptions(int ArgC, char* ArgV[])
+static bool ParseOptions()
 {
   int argn;
   bool noArguments = false; /* Don't accept arguments (-- code sent) */
+  const char* errPtr = NULL; /* Set to an error if you want one printed */
+  const char* argument = NULL; /* Argument printed by error messages */
+
+  /* These errors can be set in errPtr */
+  const char errBlankPathSpec[] = "%s: Error! Blank path spec not allowed\n";
+  const char errNotMemPath[] = "%s: Error! Not enough memory to store path - \"%s\"\n";
+  const char errNotMemResp[] = "%s: Error! Not enough memory to store response file - \"%s\"\n";
+  const char errNotMemFilename[] = "%s: Error! Not enough memory to store filename - \"%s\"\n";
+  const char errInvalidOpt[] = "%s: Error! Invalid option - \"%s\"\n";
+  const char errBadRespSpec[] = "%s: Error! Bad response specification - @\n";
 
   const static struct {
     const char *longOptStr, *shortOptStr;
     { "--version", "-ver", &Options.Version, NULL },
     { "--license", "-l", &Options.License, NULL },
     { "--system", "-s", &Options.System, OptMsgSystem },
+    { "--no-stderr", "-nse", &Options.Nse, OptMsgNse },
     { NULL, NULL, NULL, NULL } /* Keep this last! */
   };
 
     if ( strncmp(ArgV[argn], "-I", 2) == 0 ) {
       /* Found a path */
       if ( ArgV[argn][2] == '\0' ) {
-        puts("Blank path spec not allowed");
-        return false;
+        errPtr = errBlankPathSpec;
+        continue;
       }
       if ( !Paths.Add(&Paths, ArgV[argn]+2) ) { /* Add this path */
-        printf("# Warning: Not enough memory to store path - \"%s\"\n", ArgV[argn]+2);
+        errPtr = errNotMemPath;
+        argument = ArgV[argn]+2;
         continue;
       }
     }
         if ( TESTARG(optionTable, j, ArgV[argn]) ) {
           *(optionTable[j].flagAddr) = true; /* Set flag */
           matched = true;
+          break;
         }
         j++; /* Next optionTable element */
       }
       if ( !matched ) {
         /* Found an invalid option "--blah or something" */
-        printf("Invalid option - \"%s\"\n", ArgV[argn]);
-        return false;
+        errPtr = errInvalidOpt;
+        argument = ArgV[argn];
+        continue;
       }
     }
     else if ( ArgV[argn][0] == '@' ) {
       if ( ArgV[argn][1] == '\0' ) {
-        puts("Bad response specification - @");
-        return false;
+        errPtr = errBadRespSpec;
+        argument = ArgV[argn];
+        continue;
       }
       /* Valid response filename, add to list of response files */
       if ( !ResponseFiles.Add(&ResponseFiles, ArgV[argn]+1) ) { /* Add (skipping @ symbol) */
-        printf("# Warning: Not enough memory to store responsefile \"%s\"\n", ArgV[argn]+1);
+        errPtr = errNotMemResp;
+        argument = ArgV[argn]+1;
         continue;
       }
     }
     else { /* Filename on the command line */
       if ( !FileNames.Add(&FileNames, ArgV[argn]) ) {
-        printf("# Warning! Not enough memory to store filename \"%s\"\n", ArgV[argn]);
+        errPtr = errNotMemFilename;
+        argument = ArgV[argn];
         continue;
       }
     }
   }
 
+  /* Set the outfor for errors before printing any */
+  if ( Options.Nse ) /* No stderr? */
+    SetStandardError(stdout); /* Use stdout instead */
+
+  /* now check for errors */
+  if ( errPtr ) { /* Something is wrong */
+    if ( errPtr == errBlankPathSpec )
+      fprintf(GetStandardError(), errPtr, ArgV[0]);
+    else
+      fprintf(GetStandardError(), errPtr, ArgV[0], argument);
+
+    return false;
+  }
   return true; /* No problem */
 }
 /*-------------------------------------------------------------------------*/
   if ( Options.System )
     puts(OptMsgSystem);
 
+  if ( Options.Nse )
+    puts(OptMsgNse);
+
   fputc((int)'\n', stdout); /* Seperate */
 
   /* Command line response files */
   return;
 }
 /*-------------------------------------------------------------------------*/
-static void CvtResponse()
+static bool CvtResponse()
 {
   FILE* pfs;
   const char* fn;
         CvtResponse2(pfs);
         fclose(pfs);
       }
-      else
-        printf("# Warning! Cannot open response file \"%s\"\n", fn);
+      else {
+        fprintf(GetStandardError(), "%s: Error! Cannot open response file \"%s\"\n", ArgV[0], fn);
+        return false;
+      }
     }
   }
-  return;
+  return true;
 }
 /*-------------------------------------------------------------------------*/
 static unsigned int DoDependencyLoop()
         S_StringList_Destruct(&deps);
       }
       else {
-        printf("Cannot open \"%s\"\n", fn);
+        printf("%s: Error! Cannot open \"%s\"\n", ArgV[0], fn);
         failures++;
       }
     }
 static bool ResolvePathDep(const char* FileName, char* PathOut, size_t PathSz)
 {
   unsigned int i, c;
-  PathOut[0] = '\0';
 
   if ( FileExists(FileName) ) {
+    PathOut[0] = '\0';
     strncat(PathOut, FileName, PathSz);
     return true;
   }
   c = Paths.Count(&Paths);
   for ( i = 0U; i < c; i++ ) {
     const char* currPath = Paths.GetString(&Paths, i);
+    PathOut[0] = '\0';
     strncat(PathOut, currPath, PathSz);
 #ifdef __UNIX__
     if ( LastChar(PathOut) != '/' )
   return lastChar;
 }
 /*-------------------------------------------------------------------------*/
-static void CvtResponse2(FILE* PFS)
+static bool CvtResponse2(FILE* PFS)
 {
   char fn[MAX_LINE_BUFF]; /* A pretty huge absolute limit on a filename */
 
   while ( fgets(fn, sizeof(fn), PFS) == fn ) {
     StripTrailingWhitespace(fn, '\n'); /* Strip end of line characters */
 
-    if ( !FileNames.Add(&FileNames, fn) )
-      printf("# Warning! Not enough memory to store filename - \"%s\"\n", fn);
+    if ( !FileNames.Add(&FileNames, fn) ) {
+      fprintf(GetStandardError(), "%s: Error! Not enough memory to store filename - \"%s\"\n", ArgV[0], fn);
+      return false;
+    }
   }
+  return true;
 }
 /*-------------------------------------------------------------------------*/
 static bool LookDeps(const char* FileName, FILE* PFS, struct string_list* deps)
       if ( ResolvePathDep(includeFile, includePath, sizeof(includePath)) ) {
         if( !deps->StringExists(deps, includePath) ){ /*dependancy not added*/
           if ( !deps->Add(deps, includePath) )
-            printf("# Not enough mem, dep lost - %s\n", includeFile);
+            fprintf(GetStandardError(), "%s: Warning! Not enough mem, dep lost - %s\n", ArgV[0], includeFile);
           fh = fopen(includePath, "rt");
-          if(fh){   /* find dependencies of dependancy */
+          if(fh){ /* find dependencies of dependancy */
             LookDeps(includePath, fh, deps);
             fclose(fh);
           }
-          else
-            printf("# Cannot open \"%s\" which was included in \"%s\"\n",
-                    includePath, FileName);
+          else {
+            fprintf(
+              GetStandardError(),
+              "%s: Warning! Cannot open \"%s\" which was included in \"%s\"\n",
+              ArgV[0],
+              includePath,
+              FileName
+            );
+          }
         }
       }
+      else
+        fprintf(GetStandardError(), "%s: Warning! The following dependency cannot be found with the given include path - \"%s\"\n", ArgV[0], includeFile);
     }
   }
 
 
 
   Daybo Logic
-  13 Forest Close,
-  Newport,
-  Isle of Wight,
-  England.
+  57 Alderwood Parc,
+  Penryn,
+  Kernow,
+  United Kingdom.
+
+  TR10 8RL
 */
 
 #ifndef __INC_DAYBODEP_H
 /* Version information */
 #define VER_MAJ   (0)
 #define VER_MIN   (4)
-#define VER_PATCH (2)
-#define VER_STAMP (20030225) /* Keep this up to date with releases, it's format should be obvious, YYYYMMDD */
+#define VER_PATCH (3)
+#define VER_STAMP (20030914) /* Keep this up to date with releases, it's format should be obvious, YYYYMMDD */
 
 /* Maximum size of a buffer for reading from a file line by line */
 #define MAX_LINE_BUFF (1024)
 /*-------------------------------------------------------------------------*/
 extern const char LicenseData[]; /* Text of the GNU GPL (license), in daybodep_license.c */
 /*-------------------------------------------------------------------------*/
+/*
+  Function to set the standard error stream.  The old version is returned.
+  Passing NULL will reset the value to 'stderr', the default.
+*/
+FILE* SetStandardError(FILE* NewStandardError);
+
+/*
+  Function to get the standard error, use this in calls to fprintf() and
+  friends.  It never returns NULL, so no need for any annoying tests.
+*/
+FILE* GetStandardError(void);
+/*-------------------------------------------------------------------------*/
 #endif /*!__INC_DAYBODEP_H*/

File daybodep_checksum.c

+/*
+    Daybo Logic Dependency tool
+    Copyright (C) 2001-2003  David Duncan Ross Palmer, Daybo Logic.
+
+    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
+
+
+  Daybo Logic,
+  57 Alderwood Parc,
+  Penryn,
+  Kernow,
+  United Kingdom.
+
+  TR10 8RL
+*/
+
 #include <assert.h>
 #include <stddef.h>
 #include <string.h>
+#include <stdio.h>
 #ifdef HDRSTOP
 # pragma hdrstop
 #endif /*HDRSTOP*/

File daybodep_license.c

   prevent a segmentation fault.
 */
 
+#include <stdio.h>
+#ifdef HDRSTOP
+# pragma hdrstop
+#endif /*HDRSTOP*/
+
 #include "daybodep.h"
 
 const char LicenseData[] = {

File daybodep_stderr.c

+/*
+    Daybo Logic Dependency tool
+    Copyright (C) 2001-2003  David Duncan Ross Palmer, Daybo Logic.
+
+    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
+
+
+  Daybo Logic
+  57 Alderwood Parc,
+  Penryn,
+  Kernow,
+  United Kingdom
+
+  TR10 8RL
+*/
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#ifdef HDRSTOP
+# pragma hdrstop
+#endif /*HDRSTOP*/
+
+#include "daybodep.h"
+/*-------------------------------------------------------------------------*/
+static FILE* standardError;
+/*-------------------------------------------------------------------------*/
+FILE* SetStandardError(FILE* NewStandardError)
+{
+  FILE* oldStdErr;
+
+  if ( !standardError ) standardError = stderr; /* Initialisation */
+
+  oldStdErr = standardError; /* Save old value */
+  if ( NewStandardError )
+    standardError = NewStandardError;
+  else
+    standardError = stderr;
+
+  return oldStdErr;
+}
+/*-------------------------------------------------------------------------*/
+FILE* GetStandardError()
+{
+  if ( !standardError ) standardError = stderr; /* Initialisation */
+  return standardError;
+}
+/*-------------------------------------------------------------------------*/

File daybodep_stringlist.c

     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
-  Daybo Logic
-  13 Forest Close,
-  Newport,
-  Isle of Wight,
-  England.
+  Daybo Logic,
+  57 Alderwood Parc,
+  Penryn,
+  Kernow,
+  United Kingdom
+
+  TR10 8RL
 */
 
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stdio.h>
 #ifdef HDRSTOP
 # pragma hdrstop
 #endif /*HDRSTOP*/

File daybodep_strsimple.c

 
 
   Daybo Logic
-  13 Forest Close,
-  Newport,
-  Isle of Wight,
-  England.
+  57 Alderwood Parc,
+  Penryn,
+  Kernow,
+  United Kingdom
+
+  TR10 8RL
 */
 
 #include <string.h>
 #include <stdlib.h>
 #include <assert.h>
+#include <stdio.h>
 #ifdef HDRSTOP
 # pragma hdrstop
 #endif /*HDRSTOP*/

File daybodep_template.c

+/*
+    Daybo Logic Dependency tool
+    Copyright (C) 2001-2003  David Duncan Ross Palmer, Daybo Logic.
+
+    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
+
+
+  Daybo Logic
+  57 Alderwood Parc,
+  Penryn,
+  Kernow,
+  United Kingdom
+
+  TR10 8RL
+*/
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#ifdef HDRSTOP
+# pragma hdrstop
+#endif /*HDRSTOP*/
+
+#include "daybodep.h"
+/*-------------------------------------------------------------------------*/
+/*
+  Remove this line after copying the file
+*/
+#error ("Do not compile this file")
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------*/