/***************************************
 *                                     *
 * Programm: DeviceList ausgeben       *
 * =================================== *
 *                                     *
 * Autor:  Datum:      Kommentar:      *
 * ------  ----------  ----------      *
 * Wgb     14.07.1988                  *
 *                                     *
 * Compiler Optionen:                  *
 *    cc DeviceList.c                  *
 *                                     *
 * Linker Optionen:                    *
 *    ln DeviceList.o -lm -lc          *
 *                                     *
 ***************************************/

#include <libraries/dosextens.h>
#include <libraries/filehandler.h>

extern struct DosLibrary *DOSBase;

char *Types[] =
   {
   "Device:\n",
   "Directory:\n",
   "Volume:\n"
   };


main()
   {
   int i, j;
   char *Add;

   struct RootNode   *Root;
   struct DosInfo    *Info;
   struct DeviceList *List, *DevList;
   struct FileLock   *Lock;


   Root = (struct RootNode   *)DOSBase->dl_Root;
   Info = (struct DosInfo    *)BADDR(Root->rn_Info);
   List = (struct DeviceList *)BADDR(Info->di_DevInfo);

   for(i=2; i>-1; i--)
      {
      printf(Types[i]);

      DevList = List;

      while(DevList->dl_Next)
         {
         if (DevList->dl_Type == i)
            {
            Add = (char *)BADDR(DevList->dl_Name);

            for(j=1; j<=Add[0]; j++)
               printf("%c", Add[j]);

            printf(", ");
            }
         DevList = (struct DeviceList *)BADDR(DevList->dl_Next);
         }

      printf("\n\n");
      }

   }

