home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / test / 15155 < prev    next >
Encoding:
Text File  |  1992-11-17  |  2.6 KB  |  139 lines

  1. Newsgroups: alt.test
  2. Path: sparky!uunet!utcsri!torn!nott!bnrgate!bcars267!news
  3. From: gakusei@bmerh136.bnr.ca (Andre Roy)
  4. Subject: **************** TO: RANDY BYERS *********************
  5. Message-ID: <1992Nov16.211237.27796@bnr.ca>
  6. Sender: news@bnr.ca (usenet)
  7. Nntp-Posting-Host: bmerh272
  8. Organization: Bell-Northern Research Ltd.
  9. Distribution: ont
  10. Date: Mon, 16 Nov 1992 21:12:37 GMT
  11. Lines: 126
  12.  
  13.  
  14. Randy - how's it going?  I'm going to try to get a ride to Waterloo this
  15. weekend.  I need you to save the following on the descartes - and maybe
  16. on your Amiga as well.  The following is the source for a coding program,
  17. and a program that will prepare that output for posting, and another
  18. for "unpreparing" it.  Please Reply - telling me that you have got these
  19. files.  Try compiling them on the descartes (use vi to split it into 3 files).
  20. I'll tell you how to use them, and how to code and decode news, as well as
  21. the password that will be used.
  22.  
  23. Thanks!
  24.  
  25. Chris
  26.  
  27. Programs follow:
  28.  
  29.  
  30. /*********************
  31. * PREPARE.C
  32. **********************/
  33.  
  34.  
  35. #include <stdio.h>
  36. #include <string.h>
  37.  
  38. void main(argc,argv)
  39. int argc;
  40. char * argv[];
  41. {
  42.    int c,d;
  43.    int in=0;
  44.  
  45.    while ((c=getchar()) != EOF) {
  46.       if (c<34) {
  47.          if (!in) {
  48.             in = 1;
  49.             printf("!");
  50.             d+=1;
  51.          } /* if */
  52.          printf("%c",c+34);
  53.          d+=1;
  54.       } else {
  55.          if (in) {
  56.             printf("!");
  57.             in = 0;
  58.             d += 1;
  59.          } /* if */
  60.          printf("%c",c);
  61.          d+=1;
  62.       } /* if */
  63.       if (d>70) {
  64.          printf("\n");
  65.          d = 0;
  66.       } /* if */
  67.    } /* while */
  68. } /* main */
  69. /************************
  70. * CODE.C
  71. ************************/
  72.  
  73. #include <stdio.h>
  74. #include <string.h>
  75.  
  76.  
  77. int eor(c1,c2)
  78. int c1,c2;
  79. {
  80.    int ret;
  81.  
  82.    ret = (c1|c2) - (c1&c2);
  83.    return(ret);
  84. }  
  85.  
  86. void main(argc,argv) 
  87. int argc;
  88. char * argv[];
  89. {
  90.    char c;
  91.    int d=0,e;
  92.    char string[100];
  93.    int stringlen;
  94.  
  95.    strcpy(string,argv[1]);
  96.    stringlen = strlen(string);
  97.  
  98.    for(e=0;e<stringlen;++e) {
  99.       string[e] = string[e]+e;
  100.    } /* for */
  101.  
  102.  
  103.    while ( (c=getchar()) != EOF) {
  104.       printf("%c",eor(c,string[d]));
  105.       if (++d >= stringlen) {
  106.          d = 0;
  107.       } /* if */
  108.    } /* while */
  109. } /* main */
  110.  
  111. /*********************
  112. * UNPREP.C
  113. *********************/
  114.  
  115. #include <stdio.h>
  116. #include <string.h>
  117.  
  118. void main(argc,argv)
  119. int argc;
  120. char * argv[];
  121. {
  122.    int c,d;
  123.    int in=0;
  124.  
  125.    while ((c=getchar()) != EOF) {
  126.       if (c == '\n') {
  127.          ;
  128.       } else if (c == '!') {
  129.          in = (in+1)%2;
  130.       } else { 
  131.          if (in) {
  132.             printf("%c",c-34);
  133.          } else {
  134.             printf("%c",c);
  135.          } /* if */
  136.       } /* if */
  137.    } /* while */
  138. } /* main */
  139.