home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / communic / pcmail / main / call.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  2.3 KB  |  80 lines

  1. /*++
  2. /* NAME
  3. /*      call 3
  4. /* SUMMARY
  5. /*      call remote unix system
  6. /* PROJECT
  7. /*      pc-mail
  8. /* PACKAGE
  9. /*      mail
  10. /* SYNOPSIS
  11. /*      int call()
  12. /* DESCRIPTION
  13. /*      call() is invoked when the user wants to contact the unix host.
  14. /*    It asks for a uucp password. After the user has provided this
  15. /*    the password is erased from the screen and the mail server is called
  16. /*    by the cico file transfer program. Afterwards, the nmail program is 
  17. /*    invoked to extract originator addresses from new mail messages. In 
  18. /*    order to force a new mailbox display the current mail display is junked.
  19. /* FUNCTIONS AND MACROS
  20. /*    kbdinp(), kbdrest(), invoke(), kbdinit(), errdisp(), junk_desk()
  21. /* COMMANDS
  22. /*      cico    remote login, file transfer
  23. /*    nmail    extract originator from new mail
  24. /* AUTHOR(S)
  25. /*      W.Z. Venema
  26. /*      Eindhoven University of Technology
  27. /*      Department of Mathematics and Computer Science
  28. /*      Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
  29. /* CREATION DATE
  30. /*      Sun Apr  5 18:27:18 GMT+1:00 1987
  31. /* LAST MODIFICATION
  32. /*    90/01/22 13:01:16
  33. /* VERSION/RELEASE
  34. /*    2.1
  35. /*--*/
  36.  
  37. #include "defs.h"
  38. #include "path.h"
  39. #include "screen.h"
  40. #include "pager.h"
  41. #include "mail.h"
  42.  
  43. hidden int do_call();                /* forward declarations */
  44.  
  45. /* call - set up dialogue for password */
  46.  
  47. public int call()
  48. {
  49.     static Screen screen[] = {
  50.     STRING,    0,              do_call,int_error,
  51.     0,    0,              0,
  52.     "Press ESC to cancel. Enter password:",
  53.     };
  54.  
  55.     kbdinp(screen);                /* ask password */
  56.     return(S_REDRAW);                /* say screen has changed */
  57. }
  58.  
  59. /* do_call - make the call to a unix host */
  60.  
  61. static int do_call(pwd)
  62. char   *pwd;
  63. {
  64.     register int stat;
  65.  
  66.     clrtoeol();                    /* erase password kludge */
  67.     patience();                    /* this may take some time */
  68.     kbdrest();                    /* reset user tty modes */
  69.     ((stat = invokelp(CICO, "-p", pwd, (char *) 0))    /* try to call host */
  70.      ||(stat = invokelp(NMAIL, (char *) 0)));    /* try to extract originators */
  71.     kbdinit();                    /* set user tty modes */
  72.     junk_desk();                /* force new mailbox display */
  73.     if (stat) {                    /* check error status */
  74.     errdisp(stat);                /* notify user of problem */
  75.     return (S_BREAK | S_REDRAW);        /* redisplay, stop caller */
  76.     } else {
  77.     return (S_BREAK);            /* just stop caller */
  78.     }
  79. }
  80.