home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/stat.h>
-
-
- main(int argc, char *argv[])
- {
- struct stat st;
- int a, b, c, size;
- FILE *in;
-
- if (argc!=2) { fprintf(stderr, "Usage: uue filename\n"); exit(1); }
-
- in=fopen(argv[1], "r");
- if (in==NULL) { fprintf(stderr, "Can't open %s\n",argv[1]); exit(1); }
- if (stat(argv[1], &st)==-1)
- { fprintf(stderr, "Can't stat %s\n",argv[1]); exit(1); }
-
- /* Send command to start up remote decoder */
- printf("stty cbreak -echo\n./uud > %s\n", argv[1]);
-
- /* Send size, as short */
- size= st.st_size; printf("%d\n", size);
-
- while (size) {
- c= fgetc(in);
-
- /* Send c as two printable ASCII characters */
- a= ((c & 0xff) >> 4) | '@';
- b= (c & 0x0f) | '@';
- putchar(a); putchar(b); size--;
- }
-
- /* Send command to restore terminal */
- printf("stty -cbreak echo\n");
- }
-