home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / GNU / MAK358AS.ZIP / MSD_DIR.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-22  |  2.1 KB  |  64 lines

  1. /*  msd_dir.c - portable directory routines
  2.     Copyright (C) 1990 by Thorsten Ohl, ohl@gnu.ai.mit.edu
  3.  
  4.     This program is free software; you can redistribute it and/or modify
  5.     it under the terms of the GNU General Public License as published by
  6.     the Free Software Foundation; either version 1, or (at your option)
  7.     any later version.
  8.  
  9.     This program is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU General Public License
  15.     along with this program; if not, write to the Free Software
  16.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18.     IMPORTANT:
  19.  
  20.     This code is not an official part of the GNU project and the
  21.     author is not affiliated to the Free Software Foundation.
  22.     He just likes their code and spirit.
  23.  
  24.     $Header: e:/gnu/make/RCS/msd_dir.h'v 2.0 90/06/29 00:35:36 tho Stable $
  25.  */
  26.  
  27. /* Everything non trivial in this code is taken from: @(#)msd_dir.c 1.4
  28.    87/11/06.  A public domain implementation of BSD directory routines
  29.    for MS-DOS.  Written by Michael Rendell ({uunet,utai}michael@garfield),
  30.    August 1897 */
  31.  
  32.  
  33. #define    rewinddir(dirp)    seekdir(dirp, 0L)
  34.  
  35. #define    MAXNAMLEN    12
  36.  
  37. struct direct
  38. {
  39.   ino_t d_ino;            /* a bit of a farce */
  40.   int d_reclen;            /* more farce */
  41.   int d_namlen;            /* length of d_name */
  42.   char d_name[MAXNAMLEN + 1];    /* garentee null termination */
  43. };
  44.  
  45. struct _dircontents
  46. {
  47.   char *_d_entry;
  48.   struct _dircontents *_d_next;
  49. };
  50.  
  51. typedef struct _dirdesc
  52. {
  53.   int dd_id;            /* uniquely identify each open directory */
  54.   long dd_loc;            /* where we are in directory entry is this */
  55.   struct _dircontents *dd_contents;    /* pointer to contents of dir */
  56.   struct _dircontents *dd_cp;    /* pointer to current position */
  57. } DIR;
  58.  
  59. extern void seekdir (DIR *, long);
  60. extern long telldir (DIR *);
  61. extern DIR *opendir (char *);
  62. extern void closedir (DIR *);
  63. extern struct direct *readdir (DIR *);
  64.