Commits

Palmer, 2E0EOL committed 3b6094c

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

Comments (0)

Files changed (8)

-Main code - David Duncan Ross Palmer <http://www.daybologic.co.uk/mailddrp>
+Main code
+  - David Duncan Ross Palmer <http://www.daybologic.co.uk/mailddrp>
 
-C++ advice - Adam Gooch <gooch411@hotmail.com>
+C++ advice and recursive dependencies
+  - Adam Gooch <gooch411@hotmail.com>
 H=.h
 O=.o
 E=
+
+ifdef OVERCHAT
+ERASE=perl ../tools/erase.pl
+else
 ERASE=rm -f
+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)
 
 uninstall:
 	@echo "===> Uninstalling daybodep <==="
-	@rm -v -f /usr/local/bin/$(TARGET)
+	@$(ERASE) /usr/local/bin/$(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
+# 13 Forest Close,
+# Newport,
+# Isle of Wight,
+# England.
+#
+# This is just a makefile wrapper for use in the OverChat tree
+
+OVERCHAT=1
+!include Makefile.bor
+

bsdmach.sh

-#!/bin/sh
-#   Daybo Logic Dependency tool
-#   Copyright (C) 2001,2002  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.
-
-uname
-echo "==> Manually correcting for BSD type system <=="
-rm Makefile
-ln -s Makefile.bsd Makefile
 
 /* Functions which are not generally called directly (subfunctions etc) */
 static void CvtResponse2(FILE* PFS); /* Called by CvtResponse() */
-static bool LookDeps(const char* FileName, FILE* PFS); /* Called by DoDependencyLoop() */
+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);
 static char* SourceToObject(const char* SourceFileName); /* Warning: Result must be freed */
         return false;
       }
       if ( !Paths.Add(&Paths, ArgV[argn]+2) ) { /* Add this path */
-        printf("Warning: Not enough memory to store path - \"%s\"\n", ArgV[argn]+2);
+        printf("# Warning: Not enough memory to store path - \"%s\"\n", ArgV[argn]+2);
         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);
+        printf("# Warning: Not enough memory to store responsefile \"%s\"\n", 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]);
+        printf("# Warning! Not enough memory to store filename \"%s\"\n", ArgV[argn]);
         continue;
       }
     }
         fclose(pfs);
       }
       else
-        printf("Warning! Cannot open response file \"%s\"\n", fn);
+        printf("# Warning! Cannot open response file \"%s\"\n", fn);
     }
   }
   return;
       /* Got a filename to scan */
       fh = fopen(fn, "rt");
       if ( fh ) {
-        if ( !LookDeps(fn, fh) )
+        struct string_list deps;
+        S_StringList_Construct(&deps);
+        if ( !LookDeps(fn, fh, &deps) )
           failures++;
         fclose(fh);
+        PrintDeps(fn, &deps);
+        S_StringList_Destruct(&deps);
       }
       else {
         printf("Cannot open \"%s\"\n", 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);
+      printf("# Warning! Not enough memory to store filename - \"%s\"\n", fn);
   }
 }
 /*-------------------------------------------------------------------------*/
-static bool LookDeps(const char* FileName, FILE* PFS)
+static bool LookDeps(const char* FileName, FILE* PFS, struct string_list* deps)
 {
   char linebuff[MAX_LINE_BUFF];
-  struct string_list deps;
-
-  S_StringList_Construct(&deps);
   rewind(PFS);
   while ( fgets(linebuff, sizeof(linebuff), PFS) == linebuff ) {
     char* includeFile;
     includeFile = LookInclude(linebuff);
     if ( includeFile ) {
       char includePath[MAX_LINE_BUFF];
+      FILE* fh;
       if ( ResolvePathDep(includeFile, includePath, sizeof(includePath)) ) {
-        if ( !deps.Add(&deps, includePath) )
-          printf("# Not enough mem, dep lost - %s\n", includeFile);
+        if( !deps->StringExists(deps, includePath) ){ /*dependancy not added*/
+          if ( !deps->Add(deps, includePath) )
+            printf("# Not enough mem, dep lost - %s\n", includeFile);
+          fh = fopen(includePath, "rt");
+          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);
+        }
       }
     }
   }
 
-  PrintDeps(FileName, &deps);
-  S_StringList_Destruct(&deps);
   return true;
 }
 /*-------------------------------------------------------------------------*/
 /* Version information */
 #define VER_MAJ   (0)
 #define VER_MIN   (4)
-#define VER_PATCH (1)
-#define VER_STAMP (20030128) /* Keep this up to date with releases, it's format should be obvious, YYYYMMDD */
+#define VER_PATCH (2)
+#define VER_STAMP (20030225) /* 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)
   void (*Clear)(struct string_list* Obj); /* Delete all strings */
   const char* (*GetString)(const struct string_list* Obj, const unsigned int Pos);
   bool (*DelByPos)(struct string_list* Obj, const unsigned int Pos);
+  bool (*StringExists)(struct string_list* Obj, const char* S);
 };
 
 void S_StringList_Construct(struct string_list* Obj); /* Object constructor */

daybodep_stringlist.c

 static void l_Clear(struct string_list* Obj);
 static const char* l_GetString(const struct string_list* Obj, const unsigned int Pos);
 static bool l_DelByPos(struct string_list* Obj, const unsigned int Pos);
+static bool l_StringExists(struct string_list* Obj, const char* S);
 /*-------------------------------------------------------------------------*/
 static bool VerifyNode(struct string_list_node* PStringListNode)
 {
   Obj->Clear = l_Clear;
   Obj->GetString = l_GetString;
   Obj->DelByPos = l_DelByPos;
+  Obj->StringExists = l_StringExists;
 }
 /*-------------------------------------------------------------------------*/
 void S_StringList_Destruct(struct string_list* Obj)
   return;
 }
 /*-------------------------------------------------------------------------*/
+static bool l_StringExists(struct string_list* Obj, const char* S)
+{
+  struct string_list_node* n;
+
+  assert(Obj && S);
+  for(n = Obj->base; n; n = n->next)
+    if( !strcmp(S, n->dynamicString) )
+      return true;
+  return false;
+}
+/*-------------------------------------------------------------------------*/
 static bool l_Add(struct string_list* Obj, const char* NewString)
 {
   struct string_list_node* newNode;

gnumach.sh

-#!/bin/sh
-#   Daybo Logic Dependency tool
-#   Copyright (C) 2001,2002  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.
-
-uname
-echo "==> Manually correcting for GNU type system <=="
-rm Makefile
-ln -s Makefile.gnu Makefile