home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / dirutl / di11.arc / DI.H < prev    next >
Text File  |  1988-01-16  |  3KB  |  49 lines

  1. #define TRUE -1
  2. #define FALSE 0
  3. #define FLAGSPECS "-/"    /* Characters that designate flags */
  4. #define MAX_ATTS 21    /* Maximum number of attribute words + 1 */
  5. #define ENTRY_INC 100    /* Increment that entry array is realloc()ed in */
  6. #define NO_AT 0xff    /* Value that an attribute word can not have */
  7. #define FA_REALDIR 0x80    /* Specifies psuedo-attrib of all dir entries except
  8.                "." and ".." */
  9. #define ExTest(Test,Mess) if (Test) {fputs(Mess,stderr); exit(2);}
  10. #define MORE_ROWS 23    /* Number of lines printed before pause */
  11. #define CPDir(S) (S[0] == '.' && (S[1] == '\0' || S[1] == '.'))    /* Current
  12.                 or Parent Dir: True if S = "." or ".." */
  13. #define UpCase(C) ('a' <= (C) && (C) <= 'z' ? (C) + 'A' - 'a' : (C))    /* If
  14.   C is a lower case letter, returns it in upper case; otherwise returns C */
  15. #define DriveSpeced(P) (P[0] != '\0' && P[1] == ':')    /* True if P has at
  16.     least two letters and the second one is ':'.  If P is a path, this
  17.     means that a drive is specified in the path */
  18. #define Sign(x) ((x) > 0 ? 1 : (x) < 0 ? -1 : 0)  /* Signum function of x */
  19. typedef struct ffblk * Entry;    /* Ptr to struct used by findfirst/next() */
  20. typedef struct LinkedList {    /* List of directories/files to print */
  21.    char Name[MAXPATH];
  22.    struct LinkedList *Next;
  23. } NameNode;
  24. typedef struct {    /* Directory listing specs */
  25.        LineEnts;    /* Number of entries/line to print in wide mode */
  26.    char ListType,    /* Type of listing to print */
  27.         Sort;    /* Type of sort to be done before sorting by name */
  28.    int PrintFree;    /* Whether to print free space in heading */
  29.    int PrintHeaders;    /* Whether to print headers */
  30.    int RecSearch;    /* Whether to do a recursive search of dirs */
  31. } ListType;
  32. typedef struct {    /* List of directory entries */
  33.    Entry *Entries;    /* Array of pointers to ffblk */
  34.    NumEnts;        /* Number of entries */
  35. } EntryListType;
  36. void *MallocT(unsigned Size);    /* Memory allocation routines that test */
  37. void *CallocT(unsigned NElem, unsigned Size);    /* whether there was */
  38. void *ReallocT(void *Ptr, unsigned Size);    /*enough memory */
  39. char *AttribWtoS(char A);
  40. char *Insert(char *Target,char *Source,int Pos);
  41. void SortList(EntryListType *EntryList,char Sort);
  42. void GetArgs(int argc,char *argv[],int Attribs[],ListType *ListSpec,
  43.  NameNode **Files);
  44. void GetEntries(EntryListType *EntryList,int Attribs[],char Name[],int PrntCW);
  45. void PrintHeader(NameNode *Files,int PrintFree);
  46. void PrintList(EntryListType *EntryList,ListType *ListSpec,char *Dir);
  47. GetEnvParams(int *Cnt,char *Vars[],char *Name);
  48. More(int Lines);
  49.