about summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2011-06-11 12:12:46 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2011-06-11 12:12:46 -0400
commit279010bc0791556e63b4951d83a2c45252142b80 (patch)
tree2f0ca07764a555764bb1f5a628a3468e88bf0c59 /lib
parent0b30d0d375231ff07227872f2d1d25f005e43e98 (diff)
downloadlynx-snapshots-279010bc0791556e63b4951d83a2c45252142b80.tar.gz
snapshot of project "lynx", label v2_8_8dev_9a
Diffstat (limited to 'lib')
-rw-r--r--lib/dirent.c283
-rw-r--r--lib/dirent.h53
2 files changed, 0 insertions, 336 deletions
diff --git a/lib/dirent.c b/lib/dirent.c
deleted file mode 100644
index 8b8f08f4..00000000
--- a/lib/dirent.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
- * $LynxId: dirent.c,v 1.4 2010/10/31 17:56:17 tom Exp $
- *
- * dir.c for MS-DOS by Samuel Lam <skl@van-bc.UUCP>, June/87 
- */
-
-/* #ifdef WIN32 */
-/* 
- * @(#)dir.c 1.4 87/11/06 Public Domain. 
- * 
- *  A public domain implementation of BSD directory routines for 
- *  MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield), 
- *  August 1897 
- *  Ported to OS/2 by Kai Uwe Rommel 
- *  December 1989, February 1990 
- *  Ported to Windows NT 22 May 91 
- *    other mods Summer '92 brianmo@microsoft.com 
- *  opendirx() was horribly written, very inefficient, and did not take care
- *    of all cases.  It is still not too clean, but it is far more efficient.
- *    Changes made by Gordon Chaffee (chaffee@bugs-bunny.cs.berkeley.edu)
- */
-
-/*Includes: 
- *    crt 
- */
-#ifdef HAVE_CONFIG_H
-#include "lynx_cfg.h"
-#endif
-
-#include <windows.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys\types.h>
-#include <sys\stat.h>
-
-#include "dirent.h"
-
-#define stat _stat
-
-/* 
- *    NT specific 
- */
-#include <stdio.h>
-
-/* 
- *    random typedefs 
- */
-#define HDIR        HANDLE
-#define HFILE       HANDLE
-#define PHFILE      PHANDLE
-
-#ifndef INVALID_HANDLE_VALUE
-#define INVALID_HANDLE_VALUE ((HDIR) 0xffffffff)
-#endif
-
-/* 
- *    local functions 
- */
-static char *getdirent(char *);
-static void free_dircontents(struct _dircontents *);
-
-static HDIR FindHandle;
-static WIN32_FIND_DATA FileFindData;
-
-static struct dirent dp;
-
-DIR *opendirx(char *name, char *pattern)
-{
-    struct stat statb;
-    DIR *dirp;
-    char c;
-    char *s;
-    struct _dircontents *dp;
-    int len;
-    int unc;
-    char path[OFS_MAXPATHNAME];
-    register char *ip, *op;
-
-    for (ip = name, op = path;; op++, ip++) {
-	*op = *ip;
-	if (*ip == '\0') {
-	    break;
-	}
-    }
-    len = ip - name;
-    if (len > 0) {
-	unc = ((path[0] == '\\' || path[0] == '/') &&
-	       (path[1] == '\\' || path[1] == '/'));
-	c = path[len - 1];
-	if (unc) {
-	    if (c != '\\' && c != '/') {
-		path[len] = '/';
-		len++;
-		path[len] = '\0';
-	    }
-	} else {
-	    if ((c == '\\' || c == '/') && (len > 1)) {
-		len--;
-		path[len] = '\0';
-
-		if (path[len - 1] == ':') {
-		    path[len] = '/';
-		    len++;
-		    path[len] = '.';
-		    len++;
-		    path[len] = '\0';
-		}
-	    } else if (c == ':') {
-		path[len] = '.';
-		len++;
-		path[len] = '\0';
-	    }
-	}
-    } else {
-	unc = 0;
-	path[0] = '.';
-	path[1] = '\0';
-	len = 1;
-    }
-
-    if (stat(path, &statb) < 0 || (statb.st_mode & S_IFMT) != S_IFDIR) {
-	return NULL;
-    }
-    dirp = malloc(sizeof(DIR));
-
-    if (dirp == NULL) {
-	return dirp;
-    }
-    c = path[len - 1];
-    if (c == '.') {
-	if (len == 1) {
-	    len--;
-	} else {
-	    c = path[len - 2];
-	    if (c == '\\' || c == ':') {
-		len--;
-	    } else {
-		path[len] = '/';
-		len++;
-	    }
-	}
-    } else if (!unc && ((len != 1) || (c != '\\' && c != '/'))) {
-	path[len] = '/';
-	len++;
-    }
-    strcpy(path + len, pattern);
-
-    dirp->dd_loc = 0;
-    dirp->dd_contents = dirp->dd_cp = NULL;
-
-    if ((s = getdirent(path)) == NULL) {
-	return dirp;
-    }
-    do {
-	if (((dp = malloc(sizeof(struct _dircontents))) == NULL) ||
-	      ((dp->_d_entry = malloc(strlen(s) + 1)) == NULL)) {
-	    if (dp)
-		free(dp);
-	    free_dircontents(dirp->dd_contents);
-
-	    return NULL;
-	}
-	if (dirp->dd_contents)
-	    dirp->dd_cp = dirp->dd_cp->_d_next = dp;
-	else
-	    dirp->dd_contents = dirp->dd_cp = dp;
-
-	strcpy(dp->_d_entry, s);
-	dp->_d_next = NULL;
-
-    }
-    while ((s = getdirent(NULL)) != NULL);
-
-    dirp->dd_cp = dirp->dd_contents;
-    return dirp;
-}
-
-DIR *opendir(char *name)
-{
-    return opendirx(name, "*");
-}
-
-void closedir(DIR *dirp)
-{
-    free_dircontents(dirp->dd_contents);
-    free(dirp);
-}
-
-struct dirent *readdir(DIR *dirp)
-{
-    /* static struct dirent dp; */
-    if (dirp->dd_cp == NULL)
-	return NULL;
-
-    /*strcpy(dp.d_name,dirp->dd_cp->_d_entry); */
-
-    dp.d_name = dirp->dd_cp->_d_entry;
-
-    dp.d_namlen = dp.d_reclen =
-	strlen(dp.d_name);
-
-    dp.d_ino = (ino_t) (dirp->dd_loc + 1);	/* fake the inode */
-
-    dirp->dd_cp = dirp->dd_cp->_d_next;
-    dirp->dd_loc++;
-
-    return &dp;
-}
-
-void seekdir(DIR *dirp, long off)
-{
-    long i = off;
-    struct _dircontents *dp;
-
-    if (off >= 0) {
-	for (dp = dirp->dd_contents; --i >= 0 && dp; dp = dp->_d_next) ;
-
-	dirp->dd_loc = off - (i + 1);
-	dirp->dd_cp = dp;
-    }
-}
-
-long telldir(DIR *dirp)
-{
-    return dirp->dd_loc;
-}
-
-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);
-    }
-}
-/* end of "free_dircontents" */
-
-static char *getdirent(char *dir)
-{
-    int got_dirent;
-
-    if (dir != NULL) {		/* get first entry */
-	if ((FindHandle = FindFirstFile(dir, &FileFindData))
-	    == INVALID_HANDLE_VALUE) {
-	    return NULL;
-	}
-	got_dirent = 1;
-    } else			/* get next entry */
-	got_dirent = FindNextFile(FindHandle, &FileFindData);
-
-    if (got_dirent)
-	return FileFindData.cFileName;
-    else {
-	FindClose(FindHandle);
-	return NULL;
-    }
-}
-/* end of getdirent() */
-
-struct passwd *_cdecl getpwnam(char *name)
-{
-    return NULL;
-}
-
-struct passwd *_cdecl getpwuid(int uid)
-{
-    return NULL;
-}
-
-int getuid()
-{
-    return 0;
-}
-
-void _cdecl endpwent(void)
-{
-}
-
-/* #endif */
diff --git a/lib/dirent.h b/lib/dirent.h
deleted file mode 100644
index db598492..00000000
--- a/lib/dirent.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 
- * @(#) dirent.h 2.0 17 Jun 91   Public Domain. 
- * 
- *  A public domain implementation of BSD directory routines for 
- *  MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield), 
- *  August 1987 
- * 
- *  Enhanced and ported to OS/2 by Kai Uwe Rommel; added scandir() prototype 
- *  December 1989, February 1990 
- *  Change of MAXPATHLEN for HPFS, October 1990 
- *   
- *  Unenhanced and ported to Windows NT by Bill Gallagher 
- *  17 Jun 91 
- *  changed d_name to char * instead of array, removed non-std extensions 
- *  
- *  Cleanup, other hackery, Summer '92, Brian Moran , brianmo@microsoft.com 
- */
-
-#ifndef _DIRENT
-#define _DIRENT
-
-#include <direct.h>
-
-struct dirent {
-    ino_t d_ino;		/* a bit of a farce */
-    short d_reclen;		/* more farce */
-    short d_namlen;		/* length of d_name */
-    char *d_name;
-};
-
-struct _dircontents {
-    char *_d_entry;
-    struct _dircontents *_d_next;
-};
-
-typedef struct _dirdesc {
-    int dd_id;			/* uniquely identify each open directory */
-    long dd_loc;		/* where we are in directory entry */
-    struct _dircontents *dd_contents;	/* pointer to contents of dir */
-    struct _dircontents *dd_cp;	/* pointer to current position */
-} DIR;
-
-extern DIR *opendir(char *);
-extern struct dirent *readdir(DIR *);
-extern void seekdir(DIR *, long);
-extern long telldir(DIR *);
-extern void closedir(DIR *);
-
-#define rewinddir(dirp) seekdir(dirp, 0L)
-
-#endif /* _DIRENT */
-
-/* end of dirent.h */
ref='/akspecs/aerc/commit/widgets/directories.go?h=0.4.0&id=b60999c39e11bf4d1e236f2b10a2f895b44d23fb'>b60999c ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149