cvs-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Cvs-cvs] ccvs/windows-NT ChangeLog dirent.c dirent.h


From: Derek Robert Price
Subject: [Cvs-cvs] ccvs/windows-NT ChangeLog dirent.c dirent.h
Date: Tue, 11 Jul 2006 16:24:21 +0000

CVSROOT:        /cvsroot/cvs
Module name:    ccvs
Changes by:     Derek Robert Price <dprice>     06/07/11 16:24:21

Modified files:
        windows-NT     : ChangeLog dirent.c dirent.h 

Log message:
        * dirent.h: Mark clearly as public domain.
        * dirent.c: Likewise, plus some cleanup.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/ChangeLog?cvsroot=cvs&r1=1.379&r2=1.380
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/dirent.c?cvsroot=cvs&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ccvs/windows-NT/dirent.h?cvsroot=cvs&r1=1.3&r2=1.4

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/ChangeLog,v
retrieving revision 1.379
retrieving revision 1.380
diff -u -b -r1.379 -r1.380
--- ChangeLog   11 Jul 2006 13:29:09 -0000      1.379
+++ ChangeLog   11 Jul 2006 16:24:21 -0000      1.380
@@ -1,5 +1,8 @@
 2006-07-11  Derek Price  <address@hidden>
 
+       * dirent.h: Mark clearly as public domain.
+       * dirent.c: Likewise, plus some cleanup.
+
        * dirent.h: Remove #include <config.h>.
        (struct dirent): Remove unimplemented d_ino since POSIX declares it an
        extension.  Add d_namlen.

Index: dirent.c
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/dirent.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- dirent.c    11 Jul 2006 12:35:09 -0000      1.2
+++ dirent.c    11 Jul 2006 16:24:21 -0000      1.3
@@ -1,24 +1,19 @@
 /*  dirent.c - portable directory routines
-    Copyright (C) 1990 by Thorsten Ohl, address@hidden
-    Copyright (C) 2006 The Free Software Foundation, Inc.
-
-    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 1, 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.  */
-
-/* Everything non trivial in this code is from: @(#)msd_dir.c 1.4
-   87/11/06.  A public domain implementation of BSD directory routines
-   for MS-DOS.  Written by Michael Rendell ({uunet,address@hidden),
-   August 1897 */
-
-/* Minor adaptations made in 2006 by Derek R. Price <address@hidden> to
- * appear to be <dirent.c> as opposed to its former incarnation as <ndir.c>.
+ *
+ * This file is in the public domain.
+ *
+ * Everything non trivial in this code came originally from: @(#)msd_dir.c 1.4
+ * 87/11/06, a public domain implementation of BSD directory routines for
+ * MS-DOS, written by Michael Rendell ({uunet,address@hidden),
+ * August 1987.
+ *
+ * Converted to CVS's "windows-NT/ndir.c" in 1990 by Thorsten Ohl
+ * <address@hidden>.
+ *
+ * Minor adaptations made in 2006 by Derek R. Price <address@hidden>, with
+ * Windows API oversight by Jim Hyslop <address@hidden>, to meet the
+ * POSIX.1 <dirent.h> API with some GNU extensions (as opposed to its
+ * intermediate incarnation as CVS's "windows-NT/ndir.c").
  */
 
 #ifdef HAVE_CONFIG_H
@@ -29,20 +24,17 @@
 #include <sys/types.h>
 #include <dirent.h>
 
+/* System (WOE32) Includes.  */
+#include <dos.h>
 #include <io.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 
-#include <dos.h>
+/* GNULIB Includes.  */
 #include "xalloc.h"
 
-static void free_dircontents (struct _dircontents *);
-
-/* find ALL files! */
-#define ATTRIBUTES     (_A_RDONLY | _A_HIDDEN | _A_SYSTEM | _A_SUBDIR)
-
 
 
 DIR *
@@ -67,11 +59,9 @@
        slash = "/";    /* save to insert slash between path and "*.*" */
     }
 
-  strcat (strcat (strcpy (name_buf, name), slash), "*.*");
-
-  dirp = xmalloc (sizeof (DIR));
-  if (!dirp) return NULL;
+  sprintf (name_buf, "%s%s%s", name, slash, "*.*");
 
+  dirp = xmalloc (sizeof DIR);
   dirp->dd_loc = 0;
   dirp->dd_contents = dirp->dd_cp = NULL;
 
@@ -83,7 +73,7 @@
 
   do
     {
-      dp = xmalloc (sizeof (struct _dircontents));
+      dp = xmalloc (sizeof struct _dircontents);
       dp->_d_length = strlen (find_buf.name);
       dp->_d_entry = xmalloc (dp->_d_length + 1);
       memcpy (dp->_d_entry, find_buf.name, dp->_d_length + 1);
@@ -105,6 +95,24 @@
 }
 
 
+
+/* Garbage collection */
+static void
+free_dircontents (struct _dircontents *dp)
+{
+  struct _dircontents *odp;
+
+  while (dp)
+    {
+      if (dp->_d_entry)
+       free (dp->_d_entry);
+      dp = (odp = dp)->_d_next;
+      free (odp);
+    }
+}
+
+
+
 int
 closedir (DIR *dirp)
 {
@@ -151,6 +159,7 @@
 }
 
 
+
 void
 seekdir (DIR *dirp, long off)
 {
@@ -166,6 +175,7 @@
 }
 
 
+
 long
 telldir (DIR *dirp)
 {
@@ -173,27 +183,8 @@
 }
 
 
-/* Garbage collection */
-
-static void
-free_dircontents (struct _dircontents *dp)
-{
-  struct _dircontents *odp;
-
-  while (dp)
-    {
-      if (dp->_d_entry)
-       free (dp->_d_entry);
-      dp = (odp = dp)->_d_next;
-      free (odp);
-    }
-}
-
 
 #ifdef TEST
-
-void main (int argc, char *argv[]);
-
 void
 main (int argc, char *argv[])
 {
@@ -218,5 +209,4 @@
 
   printf ("done.\n");
 }
-
 #endif /* TEST */

Index: dirent.h
===================================================================
RCS file: /cvsroot/cvs/ccvs/windows-NT/dirent.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- dirent.h    11 Jul 2006 13:29:09 -0000      1.3
+++ dirent.h    11 Jul 2006 16:24:21 -0000      1.4
@@ -1,25 +1,19 @@
 /*  dirent.h - portable directory routines
-    Copyright (C) 1990 by Thorsten Ohl, address@hidden
-    Copyright (C) 2006 The Free Software Foundation, Inc.
-
-    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 1, 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.  */
-
-/* Everything non trivial in this code is taken from: @(#)msd_dir.c 1.4
-   87/11/06.  A public domain implementation of BSD directory routines
-   for MS-DOS.  Written by Michael Rendell ({uunet,address@hidden),
-   August 1897 */
-
-/* Minor adaptations made in 2006 by Derek R. Price <address@hidden> to
- * comply with the POSIX.1 <dirent.h> specification, as opposed to its former
- * incarnation as <ndir.h>.
+ *
+ * This file is in the public domain.
+ *
+ * Everything non trivial in this code came originally from: @(#)msd_dir.c 1.4
+ * 87/11/06, a public domain implementation of BSD directory routines for
+ * MS-DOS, written by Michael Rendell ({uunet,address@hidden),
+ * August 1987.
+ *
+ * Converted to CVS's "windows-NT/ndir.c" in 1990 by Thorsten Ohl
+ * <address@hidden>.
+ *
+ * Minor adaptations made in 2006 by Derek R. Price <address@hidden>, with
+ * Windows API oversight by Jim Hyslop <address@hidden>, to meet the
+ * POSIX.1 <dirent.h> API with some GNU extensions (as opposed to its
+ * intermediate incarnation as CVS's "windows-NT/ndir.h").
  */
 
 #ifndef WINDOWSNT_DIRENT_H_INCLUDED




reply via email to

[Prev in Thread] Current Thread [Next in Thread]