home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / HPFSLS.ZOO / lsea.c < prev    next >
C/C++ Source or Header  |  1992-02-17  |  2KB  |  58 lines

  1. /*
  2.  * Stampa gli attributi estesi.
  3.  * (C)1990 by redmax@alessia.dei.unipd.it (Massimo A. Santin)
  4.  * $Log:    lsea.c $
  5.  * Revision 1.1  91/05/08  20:00:55  Unknown
  6.  * Initial revision
  7.  * 
  8.  */
  9.  
  10. #include "ls.h"
  11.  
  12. static char rcsid[] = "$Header: d:/usr/utils/ls/rcs/lsea.c 1.1 91/05/08 20:00:55 Unknown Exp $";
  13.  
  14. void ls_ea(char* name, int level)
  15. {
  16.    #ifdef OS2_ONLY
  17.  
  18.    SEL sel;
  19.    PDENA1 pdena1;
  20.    ULONG ulCount;
  21.    USHORT offset = 0;
  22.    int exist_attribute = 0;
  23.    char *full_path;
  24.    int j;
  25.  
  26.    full_path = (char *) malloc(CCHMAXPATHCOMP);
  27.    getcwd(full_path, CCHMAXPATHCOMP);
  28.    strcat(full_path, "/");
  29.    strcat(full_path, name);
  30.  
  31.    DosAllocSeg(0, &sel, SEG_NONSHARED);
  32.    pdena1 = MAKEP(sel, 0);
  33.    ulCount = 0xFFFFFFFF;
  34.    exist_attribute = ! DosEnumAttribute(
  35.          ENUMEA_REFTYPE_PATH,       /* path supplied */
  36.          full_path,                 /* filename      */
  37.          1L,                        /* starts enum. with first attr.      */
  38.          pdena1,                    /* buffer address                     */
  39.          65536L,                    /* buffer size                        */
  40.          &ulCount,                  /* number of attributes to retrieve   */
  41.          ENUMEA_LEVEL_NO_VALUE,     /* type of request                    */
  42.          0L
  43.    );
  44.    if (exist_attribute) {
  45.     while (ulCount--) {           /* while there are attribute names    */
  46.         for (j = 0; j < level * 2; j++)
  47.             putchar(' ');
  48.          printf("  ea \"%s\" (%d bytes)\n", pdena1->szName, (int) ((USHORT) pdena1->cbValue));
  49.             offset += sizeof(DENA1) + pdena1->cbName;
  50.          pdena1 = MAKEP(sel, offset);
  51.         }
  52.    }
  53.    DosFreeSeg(sel);
  54.    free((void *) full_path);
  55.  
  56.    #endif
  57. } /* ls_ea */
  58.