home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d109 / uupc.lha / UUpc / Source / LOCAL / host.c < prev    next >
C/C++ Source or Header  |  1987-10-28  |  1KB  |  104 lines

  1. /*        host.c
  2.  
  3.         Amiga host 
  4.  
  5. Maintenance Notes:
  6.   25Aug87 - if dcp, set the condition code returned by dcpmain - Jal
  7.  
  8. */
  9.  
  10. #include <stdio.h>
  11. #include "host.h"
  12.  
  13. #include <ctype.h>
  14. #include <setjmp.h>
  15. #include <errno.h>
  16.  
  17. static char *curdir;
  18. char * getcwd();
  19. int chdir();
  20. int    debuglevel;        /* debuginglevel */
  21.  
  22. jmp_buf    dcpexit;
  23.  
  24. main( argc, argv )
  25. int    argc;
  26. char *argv[];
  27. {
  28.     int returnCode = 0;
  29.  
  30.     /* Amiga specific prolog */
  31.  
  32.     loadenv();
  33.     curdir = getcwd( NULL, 0 );
  34.  
  35. #ifdef CWDSPOOL
  36.     chdir( spooldir );
  37. #endif
  38.  
  39.     /* setup longjmp for error exit's */
  40.     if ( setjmp( dcpexit ) == 0 ) {
  41. #if MAIN == dcpmain
  42.     returnCode = MAIN( argc, argv );
  43. #else
  44.         MAIN( argc, argv );
  45. #endif
  46.     }
  47.  
  48.     /* Amiga specific epilog */
  49.  
  50.     exitenv();
  51.     chdir( curdir );
  52.     exit( returnCode );
  53.  
  54. }
  55.  
  56.  
  57. /* canonical name conversio routines
  58.  
  59.     inportpath    canonical -> host
  60.     exportpath    host -> canonical
  61.  
  62.     host        your local pathname format
  63.     canonical    unix style
  64. */
  65.  
  66. importpath( host, canon )
  67. char * host;
  68. char * canon;
  69. {
  70.     extern char *pubdir;
  71.  
  72.     *host = '\0';
  73.  
  74.     if ( *canon == '~' )
  75.       {
  76.         if ( canon[1] == '/' )
  77.            strcpy( host, pubdir );
  78.         else
  79.            {
  80.             strcpy( host, home );
  81.             strcat( host, "/" );
  82.            }
  83.       }
  84.  
  85.     strcat( host, canon );
  86.  
  87.         if ( *host == '/' )
  88.       *host = ':';
  89.  
  90. }
  91.  
  92. exportpath( canon, host )
  93. char * host;
  94. char * canon;
  95. {
  96.     strcpy( canon, host );
  97.     if ( *canon == ':' )
  98.        *canon = '/';
  99. }
  100.  
  101.  
  102.  
  103.  
  104.