/*
ENUMDRV.C -- uses currdir() in CURRDIR.C
*/

#include <stdlib.h>
#include <stdio.h>

#include "currdir.h"

void fail(char *s) { puts(s); exit(1); }

main()
{
    CDS far *dir;
    int i;
#ifdef __TURBOC__
    int lastdrv = setdisk(getdisk());
#else
    int currdrv, lastdrv;
    _dos_getdrive(&currdrv);
    _dos_setdrive(currdrv, &lastdrv);
#endif
    for (i=0; i<lastdrv; i++)
        if (! (dir = currdir(i)))
            fail("can't get current directory structure");
        else if (dir->flags)    /* is this a valid drive? */
        {
            printf("%c\t%-50Fs", 'A' + i, dir->current_path);
            if (dir->flags & NETWORK) printf("NETWORK ");
            if (dir->flags & JOIN) printf("JOIN ");
            if (dir->flags & SUBST) printf("SUBST");
            putchar('\n');
        }
    return 0;
}
