Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Examples  

my_dir.h

Go to the documentation of this file.
00001 /*! \file my_dir.h
00002     Header file for dir.c.
00003  */
00004 
00005 #ifdef __cplusplus
00006 extern "C" {
00007 #endif
00008 
00009 
00010 #ifndef DIR_HD
00011 
00012 #include <sys/types.h>
00013 #include <dirent.h>
00014 #include <stdlib.h>
00015 #include <sys/stat.h>
00016 
00017 #ifdef LINUX
00018 #include <string.h>
00019 #endif
00020 
00021 #ifdef SUN
00022 #include <strings.h>
00023 #endif
00024 
00025   /*! \brief Maximum number of characters for a file name.
00026    */
00027 
00028   #define FILE_NUMBER 10
00029 
00030   /*! \brief Data structure used to store directory's entries.
00031    */
00032 
00033   struct file_list {
00034                      /*! \brief Array of zero terminated strings of characters. It contains all the directory's entries. */
00035                      char **list;
00036 
00037                      /*! \brief Total number of allocated strings in the array 'list'. */
00038                      int  total_alloc;
00039 
00040                      /*! \brief Number of entries in the directory (less ot equal to 'total_alloc') */
00041                      int  num;
00042                    }; 
00043 
00044   /*! \brief Return code for base_dir_name(): the function did not find the base name.
00045    */
00046   #define BASE_DIR_NOT_FOUND  0
00047 
00048   /*! \brief Return code for base_dir_name(): can not allocate memory.
00049    */
00050   #define BASE_DIR_NO_MEM     1
00051 
00052   /*! \brief Return code for base_dir_name(): the function found the base name.
00053    */
00054   #define BASE_DIR_FOUND      2
00055 
00056 
00057   int read_directory (char *dir_name, struct file_list *flist);
00058   int read_directory_only (char *dir_name, struct file_list *flist_out);
00059   void free_file_list(struct file_list *flist);
00060   int base_dir_name (char *dirname, char **res);
00061 
00062   #define DIR_HD
00063 #endif
00064 
00065 #ifdef __cplusplus
00066 }
00067 #endif
00068 
00069 

Generated on Thu Apr 3 16:23:43 2003 for Common_C_libraries by doxygen1.3-rc1