home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / COMMS / PSIONMAI / PMFULLSO / SUNMAIL / TALKTOP1.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-06  |  2.4 KB  |  54 lines

  1. /* this program builds up a talktopop config file.
  2.    If the file exists it uses the information if there as a default, 
  3.    otherwise it tries to give some sensible information */
  4. #include "talktopop.h"
  5. #include <stdio.h>
  6. #include <string.h>
  7. #include <pwd.h>
  8. char popserver[100] ;
  9. char popname [100] ;
  10. char protname [100] ;
  11. char uname[100] ;
  12. char passwd[100] ;
  13. int filestartno = 0 ;
  14. int dodel = FALSE ;
  15. int direction = FALSE ;
  16. int verbose = FALSE ;
  17. int maxsize = MAXSIZE ;
  18. int maxemail = MAXCOUNT ;
  19. int hnset, pwset, unset ;
  20.  
  21. main ()
  22. {
  23.     confinit() ;
  24.     readconf() ;
  25.     newconf() ;
  26.     writeconf() ;
  27. }
  28.  
  29. newconf()
  30. {
  31.     char tmp[1024] ;
  32.     /* say hi etc. */
  33.     printf("This program builds or modifies you %s configuration file\n", POPCONF) ;
  34.     printf("If the %s file exists it uses the data in that file for defaults\n") ;
  35.     printf("Otherwise it provides its own.\n") ;
  36.     printf("Where a value is given in brackets (e.g. [tim]) you just have to\n") ;
  37.     printf("hit return to accept this of enter a new value if you want to change it\n") ;
  38.     printf("In the password field if there is an existing value you want to remove just enter -\n") ;
  39.     /* get the users name */
  40.     getuname(uname) ;
  41.     getstr(uname, "your username", FALSE) ;
  42.     printf("WARNING. If you enter a password it will be stored in clear\ntext format in a configuration file. This is a potential security\nhole. If you chose not to enter a password you will be prompted\nfor it each time you run talktopop\n") ;
  43.     getstr(passwd, "your password", TRUE) ;
  44.     getstr(popserver, "the name of the machine running the POP-3 server", FALSE) ;
  45.     getno(&filestartno, "the number you want to use as the starting point for retrieved file names") ;
  46.     getyn("true if you want talktopop to delete emails from the mailbox once they are downloaded, false if you want them to be kept", &dodel) ;
  47.     getyn("true if you want talktopop to retrieve emails from the start of your mailbox, false if you want it to retrieve them from the end", &direction) ;
  48.     getyn("true if you want talktopop to be verbose, false otherwise", &verbose) ;
  49.     getno(&maxsize, "the maximum email size (in bytes) to be downloaded") ;
  50.     getno(&maxemail, "the maximum number of emails to be downloaded to the psion") ;
  51.     getstr(popname, "the name of the pop-3 server in the services file / map", FALSE) ;
  52.     getstr(protname, "the name of the transport mechanism used to talk to pop (Leave as tcp unless you REALY know better)", FALSE) ;
  53. }
  54.