home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / 1988 / 06_07 / trick / home.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-24  |  868 b   |  34 lines

  1. /* ------------------------------------------------- */
  2. /*                   home.c                          */
  3. /*    macht das Stammverzeichnis zum aktuellen       */
  4. /*    Verzeichnis                                    */
  5. /* ------------------------------------------------- */
  6.  
  7. #include <stdio.h>
  8. #include <dos.h>
  9.  
  10. char *getenv( char *);
  11.  
  12. main()
  13. {
  14.   char *home,temp;
  15.   union REGS reg;
  16.  
  17.   if((home = getenv("HOME")) != NULL )
  18.   {
  19.     temp = (*home | 0x20) - 97;
  20.     reg.h.ah = 0x0e;                    /* set drive */
  21.     reg.h.dl = temp;
  22.     intdos( ®,® );
  23.     if( chdir(home) == -1 )
  24.     {
  25.       fprintf(stdout,"error: can't log to %s\n",home);
  26.       exit(1);
  27.     }
  28.   }
  29.   else
  30.     fprintf(stdout,"not set\n");
  31. }
  32. /* ------------------------------------------------- */
  33. /*              Ende von home.c                      */
  34.