home *** CD-ROM | disk | FTP | other *** search
/ NetComm Communications 5 / NetComm.iso / resource / netcomm / wcomm / disk2 / refresh.sy_ / refresh.bin
Encoding:
Text File  |  1994-10-24  |  2.0 KB  |  102 lines

  1. mlocal := 0;
  2. mhost  := 1;
  3. msync  := 2;
  4.  
  5. new string str
  6. new string send
  7. new integer hvn
  8.  
  9. hvn := 0;
  10.  
  11. message "Checking..."
  12. transmit "^M"
  13. pause 1
  14. transmit "echo -\\-\\-\\-^M"
  15. waitfor "---", 7
  16. if not waitfor then
  17.    message "Logging in..."
  18.    execute "login.scr"
  19. endif
  20.  
  21. message "Initializing..."
  22.  
  23. transmit "^M''sh^M"
  24. abortrequest := 1
  25. pause 2
  26. ok := shexec("umask 000 ; PMD=${PMDIR-$HOME/.pmail}")
  27. if (ok != 0) then
  28.    abort("Error initializing host");
  29.    exit;
  30. endif
  31.  
  32. ok := shexec("if [ -f $PMD/id.018 ] ; then _rc=ok ; else _rc=err ; fi")
  33.  
  34. ok := gettext(str, "echo $_rc", 40)
  35. if (ok != 0) then
  36.    abort("Error reading host return code");
  37.    exit;
  38. endif
  39.  
  40. if ( strstr(str,"ok") != 0 )  then
  41.    ok := shexec("cd $PMD")
  42.    if (ok != 0) then
  43.       abort("Error changing to pmail directory");
  44.       exit;
  45.    endif
  46. else
  47.    message "Placing files on host..."
  48.    ok := shexec("if [ ! -d $PMD ] ; then mkdir $PMD ; fi")
  49.    if (ok != 0) then
  50.       abort("Error creating pmail directory");
  51.       exit;
  52.    endif
  53.    ok := shexec("cd $PMD")
  54.    if (ok != 0) then
  55.       abort("Error changing to new pmail directory");
  56.       exit;
  57.    endif
  58.  
  59.    readfile("create.sh", str)
  60.    ok := puttext(str, "cat > create.sh", 100)
  61.    if (ok != 0) then
  62.       abort("Error putting create.sh");
  63.       exit;
  64.    endif
  65.  
  66.    ok := shexec("sh create.sh")
  67.    if (ok != 0) then
  68.       abort("Error executing create.sh");
  69.       exit;
  70.    endif
  71. endif
  72.  
  73. if (dofolders != 0) then
  74.    strcpy(send, "PMF=${PMFOLDERS-")
  75.    strcat(send, folders)
  76.    strcat(send, "} ")
  77.    ok := shexec(send)
  78.    if (ok != 0) then
  79.       abort("Error setting folders directory");
  80.       exit;
  81.    endif
  82. endif
  83.  
  84. if (dodownloadaliases != 0) then
  85.    execute "alias.sys";
  86. endif
  87.  
  88. if (doupdate != 0) then
  89.    execute "get.sys";
  90. endif
  91.  
  92. if (dosendnewmail != 0) then
  93.   execute "send.sys";
  94. endif
  95.  
  96. if ((doupdatefolders != 0) or (dosyncfolders != 0)) then
  97.    execute "folders.sys";
  98. endif
  99. transmit "^M^D^M"
  100. execute "logout.sys"
  101. exit
  102.