home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / b / bmh02src.zip / POST.C < prev    next >
C/C++ Source or Header  |  1992-08-18  |  1KB  |  67 lines

  1. /*
  2.    post.c : Copyright Paul Healy, EI9GL, 1992.
  3.  
  4.    920816 : Created.
  5. */
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <time.h>
  9. #include <ctype.h>
  10. #include <string.h>
  11. #include "mailer.h"
  12. #include "current.h"
  13. #include "help.h"
  14. #include "rc.h"
  15.  
  16. #ifdef BMH
  17. #define main post_main
  18. #endif
  19.  
  20. static void
  21. copyright(int argc, char *argv[])
  22. {
  23.    if ( (argc > 1) && (strcmp(argv[1], "-help") == 0) ) {
  24.       fprintf(stderr, "Usage: post (post news)\n\n");
  25.       version();
  26.       fprintf(stderr, "\n%s%s%s%s",
  27.          "post is derived from the NOS NR0D NNTP server/client:\n",
  28.          "Copyright 1990 Jeffrey R. Comstock, All Rights Reserved.\n",
  29.          "Permission granted for non-commercial copying and use, provided\n",
  30.          "this notice is retained.");
  31.       exit(0);
  32.       }
  33. }
  34.  
  35. int
  36. main(int argc, char *argv[])
  37. {
  38.    char filename[256];
  39.    FILE *fp;
  40.  
  41.    copyright(argc, argv);
  42.  
  43.    if (loadconfig()==-1)
  44.       return -1;
  45.  
  46.    if ((fp = tempfile("post", filename, "w")) == NULL)
  47.       return -1;
  48.    
  49.    if ( strchr(currentfolder(NULL), '/') != NULL ) {
  50.       char group[256];
  51.       fprintf(fp, "Newsgroup: %s\nSubject: \n--------\n",
  52.          dir2news(strcpy(group, currentfolder(NULL))) );
  53.       }
  54.    else 
  55.       fprintf(fp, "Newsgroup: \nSubject: \n--------\n");
  56.  
  57.    dosignature(fp);
  58.    fclose(fp);
  59.  
  60.    if (call_ed("post", filename) == -1)
  61.       return -1;
  62.  
  63.    return dowhatnow("post", filename, AG_NNTP);
  64. }
  65.  
  66.  
  67.