Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ndir.h

Go to the documentation of this file.
00001 /*  ndir.c - portable directory routines
00002     Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
00003 
00004     This program is free software; you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation; either version 1, or (at your option)
00007     any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.  */
00013 
00014 /* Everything non trivial in this code is taken from: @(#)msd_dir.c 1.4
00015    87/11/06.  A public domain implementation of BSD directory routines
00016    for MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
00017    August 1897 */
00018 
00019 /*
00020  * Modified for WinCvs : Alexandre Parenteau <aubonbeurre@geocities.com> --- March 1998
00021  */
00022 
00023 #if _MSC_VER > 1000
00024 #pragma once
00025 #endif
00026 
00027 #ifndef _NDIR_H
00028 #define _NDIR_H
00029 
00030 #include <sys/types.h>  /* ino_t definition */
00031 
00032 #define rewinddir(dirp) seekdir(dirp, 0L)
00033 
00034 /* 255 is said to be big enough for Windows NT.  The more elegant
00035    solution would be declaring d_name as one byte long and allocating
00036    it to the actual size needed.  */
00037 #define MAXNAMLEN       255
00038 
00039 struct direct
00040 {
00041   ino_t d_ino;                  /* a bit of a farce */
00042   int d_reclen;                 /* more farce */
00043   int d_namlen;                 /* length of d_name */
00044   char d_name[MAXNAMLEN + 1];   /* garentee null termination */
00045 };
00046 
00047 struct _dircontents
00048 {
00049   char *_d_entry;
00050   struct _dircontents *_d_next;
00051 };
00052 
00053 typedef struct _dirdesc
00054 {
00055   int dd_id;                    /* uniquely identify each open directory */
00056   long dd_loc;                  /* where we are in directory entry is this */
00057   struct _dircontents *dd_contents;     /* pointer to contents of dir */
00058   struct _dircontents *dd_cp;   /* pointer to current position */
00059 } DIR;
00060 
00061 #ifdef __cplusplus
00062 extern "C" {
00063 #endif /* __cplusplus */
00064 
00065 extern void seekdir (DIR *, long);
00066 extern long telldir (DIR *);
00067 extern DIR *opendir (const char *);
00068 extern void closedir (DIR *);
00069 extern struct direct *readdir (DIR *);
00070 
00071 #ifdef __cplusplus
00072 }
00073 #endif /* __cplusplus */
00074 
00075 
00076 /* 
00077  * Local Variables:
00078  * mode:C
00079  * ChangeLog:ChangeLog
00080  * compile-command:make
00081  * End:
00082  */
00083 #endif /* _NDIR_H */

Generated on Tue Jun 24 01:27:46 2008 for Advanced Strategic Command by  doxygen 1.4.2