]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - gnu/libexec/uucp/contrib/uucomp.shar
This commit was generated by cvs2svn to compensate for changes in r50276,
[FreeBSD/FreeBSD.git] / gnu / libexec / uucp / contrib / uucomp.shar
1 #! /bin/sh
2 #
3 # Created by shar, version 0.5 - 04/10/91
4 #
5 # This is a shell archive, meaning:
6 # 1. Remove everything about the #! /bin/sh line.
7 # 2. Save the resulting text in a file.
8 # 3. Execute the file with /bin/sh to create:
9 #
10 #        length  name
11 #        ------  -------------------------------------
12 #           128  uucomp-1.1/Compress
13 #           264  uucomp-1.1/Copyright
14 #           410  uucomp-1.1/INTERNALS
15 #          1069  uucomp-1.1/Makefile
16 #          3528  uucomp-1.1/README
17 #           632  uucomp-1.1/crmail.c
18 #           632  uucomp-1.1/crnews.c
19 #           108  uucomp-1.1/tags
20 #          3506  uucomp-1.1/uucomp.c
21 #           383  uucomp-1.1/uucomp.h
22 #
23
24 if test ! -d uucomp-1.1 ; then
25    mkdir uucomp-1.1
26 fi
27 #
28 # Archive number 1
29 # This archive created Tue Sep 28 20:21:14 1993
30 #
31
32 echo "shar: extracting uucomp-1.1/Compress - (128 characters)"
33 if test -f 'uucomp-1.1/Compress' ; then
34    echo shar: will not over-write existing file uucomp-1.1/Compress
35 else
36 sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/Compress'
37 Xfor i in $*
38 Xdo
39 X       if [ -d /usr/spool/uucp/$i ]
40 X       then
41 X#              echo Looking at $i
42 X               cd /usr/spool/uucp/$i
43 X               /usr/bin/uucomp C.*
44 X       fi
45 Xdone
46 SHAR_EOF
47 if test 128 -ne "`wc -c < 'uucomp-1.1/Compress'`" ; then
48    echo "shar: ***** error transmitting file uucomp-1.1/Compress (should have been 128 characters, but was "`wc -c < 'uucomp-1.1/Compress'`" characters) *****"
49 fi
50 fi
51
52 touch 0715110393 uucomp-1.1/Compress
53 chmod 0700 uucomp-1.1/Compress
54
55 echo "shar: extracting uucomp-1.1/Copyright - (264 characters)"
56 if test -f 'uucomp-1.1/Copyright' ; then
57    echo shar: will not over-write existing file uucomp-1.1/Copyright
58 else
59 sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/Copyright'
60 X
61 X/*
62 X * 
63 X * Copyright 1993 by Ed Carp (erc@apple.com)  All rights reserved.
64 X * 
65 X * Permission is hereby granted for any non-commercial use of this
66 X * program, as long as this copyright notice remains intact.  Commercial
67 X * users may contact me - I'm easy.
68 X * 
69 X */
70 X
71 SHAR_EOF
72 if test 264 -ne "`wc -c < 'uucomp-1.1/Copyright'`" ; then
73    echo "shar: ***** error transmitting file uucomp-1.1/Copyright (should have been 264 characters, but was "`wc -c < 'uucomp-1.1/Copyright'`" characters) *****"
74 fi
75 fi
76
77 touch 0715174993 uucomp-1.1/Copyright
78 chmod 0600 uucomp-1.1/Copyright
79
80 echo "shar: extracting uucomp-1.1/INTERNALS - (410 characters)"
81 if test -f 'uucomp-1.1/INTERNALS' ; then
82    echo shar: will not over-write existing file uucomp-1.1/INTERNALS
83 else
84 sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/INTERNALS'
85 XThis is the basic workflow for uucomp:
86 X
87 Xfor (every argv)
88 Xdo
89 X       if not "C." file skip
90 X       if open fail, skip
91 X       read 1 line from C. file
92 X       grab second and 10th field (second is data file name,
93 X               10th is command name)
94 X       if open fail on second field, skip
95 X       if 10th field isn't "rmail" or "rnews", skip
96 X       execute "gzip -9" on second field
97 X       change "rmail" and "rnews" to "crmail" and "crnews", respectively
98 X               in C. file
99 Xdone
100 SHAR_EOF
101 if test 410 -ne "`wc -c < 'uucomp-1.1/INTERNALS'`" ; then
102    echo "shar: ***** error transmitting file uucomp-1.1/INTERNALS (should have been 410 characters, but was "`wc -c < 'uucomp-1.1/INTERNALS'`" characters) *****"
103 fi
104 fi
105
106 touch 0715174693 uucomp-1.1/INTERNALS
107 chmod 0600 uucomp-1.1/INTERNALS
108
109 echo "shar: extracting uucomp-1.1/Makefile - (1069 characters)"
110 if test -f 'uucomp-1.1/Makefile' ; then
111    echo shar: will not over-write existing file uucomp-1.1/Makefile
112 else
113 sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/Makefile'
114 X#
115 X# Makefile generated with genmake - version 1.1  08/22/92
116 X#
117 X# genmake is Copyright 1991 by Edwin R. Carp
118 X#
119 X# GENMAKE -B/usr/bin -tsp [files]
120 X#
121 X
122 XCC = gcc -O6
123 XCFLAGS =  $(INCLUDE)
124 XSOURCES = crmail.c crnews.c uucomp.c 
125 XOBJECTS = crmail.o crnews.o uucomp.o 
126 XPROGRAMS = /usr/bin/crmail /usr/bin/crnews /usr/bin/uucomp 
127 X
128 Xall: $(PROGRAMS) tags
129 X
130 X/usr/bin/crmail: crmail.o 
131 X       $(CC) $(CFLAGS) -o crmail crmail.o $(LDFLAGS)  -O
132 X       strip crmail
133 X       chmod 755 crmail
134 X       mv crmail /usr/bin
135 X
136 X/usr/bin/crnews: crnews.o 
137 X       $(CC) $(CFLAGS) -o crnews crnews.o $(LDFLAGS)  -O
138 X       strip crnews
139 X       chmod 755 crnews
140 X       mv crnews /usr/bin
141 X
142 X/usr/bin/uucomp: uucomp.o 
143 X       $(CC) $(CFLAGS) -o uucomp uucomp.o $(LDFLAGS)  -O
144 X       strip uucomp
145 X       chmod 755 uucomp
146 X       mv uucomp /usr/bin
147 X
148 Xclean:
149 X       /bin/rm -f $(OBJECTS) MAKELOG eddep makedep
150 X
151 Xclobber:
152 X       /bin/rm -f $(OBJECTS) $(PROGRAMS) MAKELOG eddep makedep *~ *.bak *.BAK
153 X       /bin/rm -f tags
154 X
155 Xhidden:
156 X       echo "make all > MAKELOG 2>&1 &"|/bin/sh
157 X
158 Xmakefile:
159 X       genmake -B/usr/bin -tsp $(SOURCES) &
160 X
161 Xmakeall:
162 X       genmake -B/usr/bin -tsp *.c &
163 X
164 Xtags:  $(SOURCES)
165 X       ctags $(SOURCES) > tags
166 X
167 SHAR_EOF
168 if test 1069 -ne "`wc -c < 'uucomp-1.1/Makefile'`" ; then
169    echo "shar: ***** error transmitting file uucomp-1.1/Makefile (should have been 1069 characters, but was "`wc -c < 'uucomp-1.1/Makefile'`" characters) *****"
170 fi
171 fi
172
173 touch 0714235093 uucomp-1.1/Makefile
174 chmod 0600 uucomp-1.1/Makefile
175
176 echo "shar: extracting uucomp-1.1/README - (3528 characters)"
177 if test -f 'uucomp-1.1/README' ; then
178    echo shar: will not over-write existing file uucomp-1.1/README
179 else
180 sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/README'
181 XLike most people these days, I'm looking for ways to make my computing
182 Xenvironment more efficient.  This environment consists of a 486, a 386,
183 Xand a 386SL laptop, all of which run Taylor uucp under Linux.  The 386
184 Xlaptop gets used a lot, since it goes wherever I go and I answer a lot
185 Xof news and email every day.  Often, I must use other people's facilities
186 X(phone lines and such) to send out replies and post news if I'm not at home.
187 XSince it's not fair to the client for them to pay for my zone calls back
188 Xto my home in Fremont, I place the calls on my phone card.  Unfortunately,
189 XPacBell is very proud of the services they offer, especially in regards
190 Xto this convenience of automatically charging calls to my house wherever I
191 Xmay be.  Considering that this can be very expensive to do, I searched for
192 Xa way to cut my phone bill down to something I could afford to pay each
193 Xmonth without fainting every time I saw the bill.
194 X
195 XThe first thing I did was to go out and plunk $195 for a 14.4KB modem.
196 XThat helped, but C-News is very slow on my laptop, and batching articles
197 Xis even slower, and email (of course) isn't batched at all.  Even with
198 XMNP5 compression turned on, this doesn't make for a very efficient setup,
199 Xeven at high speeds.
200 X
201 XPlaying around with uucp told me that the line turnaround wasn't that much
202 Xoverhead, nor was sending the C./X. files (the execute files) - the real
203 Xoverhead was sending out uncompressed news and especially email, since
204 XI subscribe to several mailing lists and digests can run quite large.
205 X
206 XI looked at uubatch, but the most current version I could find (1.05) was
207 Xnot compatible with Taylor uucp (and I had no other alternative), so I
208 Xdecided to write my own.  Experiments with "gzip -9" convinced me that
209 Xthat was the way to go, since gzip gives email and news 60 to 75 percent
210 Xcompression, which would tend to cut one's phone bill significantly.
211 X
212 XYou hold in your mailbox (or news reader) the end result of that effort.
213 XBear in mind that (1) this is a "first cut" and while it is unlikely that
214 Xthere are very many bugs, there are certainly places where the programs could
215 Xbe improved and tuned.  Suggestions and comments are welcome!
216 X
217 XTo install:
218 X
219 X       1.      Feed this to shar.
220 X       2.      Look at the Makefile.  Make sure that the paths for
221 X               things are set up correctly.
222 X       3.      Look at uucomp.h and make sure that the path and
223 X               options for COMPRESS/UNCOMPRESS are set up properly.
224 X       3.      Type "make".  This will make uucomp, crmail, and crnews
225 X               and will place them in /usr/bin.  Move Compress into
226 X               /usr/lib/uucp.
227 X       4.      Make an entry in crontab to do
228 X                       /usr/lib/uucp/Compress site1 site2 site3...
229 X               occasionally.  It is suggested that this be done fairly
230 X               frequently.  Alternately, you could set up a login shell
231 X               for selected sites to run uucomp every time that site
232 X               logged in.
233 X       5.      Don't forget to add /usr/bin/crmail and /usr/bin/crnews
234 X               to the list of programs allowed to be executed in your
235 X               Permissions file (if running HDB UUCP), or whatever is
236 X               appropriate for your version of uucp.
237 X
238 XEnjoy!  Any questions or comments can be sent to erc@apple.com.
239 X
240 XNote:  This is tuned for Taylor uucp, but would not be particularly
241 Xdifficult to adapt to other version of uucp.  See the file INTERNALS for
242 Xdetails of how this works.
243 X
244 XJuly 15, 1993
245 XEd Carp
246 Xerc@apple.com
247 X------------------------------------------------------------------------------
248 XChanges since 1.0:
249 X
250 X      Version  Date            Description
251 X
252 X       1.1     08/04/93        Added sanity check in C. file (check that
253 X                               'E' is first char in file, otherwise skip)
254 SHAR_EOF
255 if test 3528 -ne "`wc -c < 'uucomp-1.1/README'`" ; then
256    echo "shar: ***** error transmitting file uucomp-1.1/README (should have been 3528 characters, but was "`wc -c < 'uucomp-1.1/README'`" characters) *****"
257 fi
258 fi
259
260 touch 0804224993 uucomp-1.1/README
261 chmod 0600 uucomp-1.1/README
262
263 echo "shar: extracting uucomp-1.1/crmail.c - (632 characters)"
264 if test -f 'uucomp-1.1/crmail.c' ; then
265    echo shar: will not over-write existing file uucomp-1.1/crmail.c
266 else
267 sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/crmail.c'
268 X/*
269 X * crmail - get compressed mail from host, uncompress
270 X * WARNING: This may be insecure!
271 X */
272 X
273 X/*
274 X * 
275 X * Copyright 1993 by Ed Carp (erc@apple.com)  All rights reserved.
276 X * 
277 X * Permission is hereby granted for any non-commercial use of this
278 X * program, as long as this copyright notice remains intact.  Commercial
279 X * users may contact me - I'm easy.
280 X * 
281 X */
282 X
283 X#include <stdio.h>
284 X#include "uucomp.h"
285 Xmain (argc, argv)
286 Xint argc;
287 Xchar **argv;
288 X{
289 X  char cmd[1024];
290 X  int i;
291 X
292 X  sprintf (cmd, "%s|%s ", UNCOMPRESS, RMAIL);
293 X  for (i = 1; i < argc; i++)
294 X  {
295 X    strcat (cmd, argv[i]);
296 X    strcat (cmd, " ");
297 X  }
298 X  system (cmd);
299 X  exit (0);
300 X}
301 SHAR_EOF
302 if test 632 -ne "`wc -c < 'uucomp-1.1/crmail.c'`" ; then
303    echo "shar: ***** error transmitting file uucomp-1.1/crmail.c (should have been 632 characters, but was "`wc -c < 'uucomp-1.1/crmail.c'`" characters) *****"
304 fi
305 fi
306
307 touch 0715195493 uucomp-1.1/crmail.c
308 chmod 0600 uucomp-1.1/crmail.c
309
310 echo "shar: extracting uucomp-1.1/crnews.c - (632 characters)"
311 if test -f 'uucomp-1.1/crnews.c' ; then
312    echo shar: will not over-write existing file uucomp-1.1/crnews.c
313 else
314 sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/crnews.c'
315 X/*
316 X * crnews - get compressed news from host, uncompress
317 X * WARNING: This may be insecure!
318 X */
319 X
320 X/*
321 X * 
322 X * Copyright 1993 by Ed Carp (erc@apple.com)  All rights reserved.
323 X * 
324 X * Permission is hereby granted for any non-commercial use of this
325 X * program, as long as this copyright notice remains intact.  Commercial
326 X * users may contact me - I'm easy.
327 X * 
328 X */
329 X
330 X#include <stdio.h>
331 X#include "uucomp.h"
332 Xmain (argc, argv)
333 Xint argc;
334 Xchar **argv;
335 X{
336 X  char cmd[1024];
337 X  int i;
338 X
339 X  sprintf (cmd, "%s|%s ", UNCOMPRESS, RNEWS);
340 X  for (i = 1; i < argc; i++)
341 X  {
342 X    strcat (cmd, argv[i]);
343 X    strcat (cmd, " ");
344 X  }
345 X  system (cmd);
346 X  exit (0);
347 X}
348 SHAR_EOF
349 if test 632 -ne "`wc -c < 'uucomp-1.1/crnews.c'`" ; then
350    echo "shar: ***** error transmitting file uucomp-1.1/crnews.c (should have been 632 characters, but was "`wc -c < 'uucomp-1.1/crnews.c'`" characters) *****"
351 fi
352 fi
353
354 touch 0715195593 uucomp-1.1/crnews.c
355 chmod 0600 uucomp-1.1/crnews.c
356
357 echo "shar: extracting uucomp-1.1/tags - (108 characters)"
358 if test -f 'uucomp-1.1/tags' ; then
359    echo shar: will not over-write existing file uucomp-1.1/tags
360 else
361 sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/tags'
362 Xmain   crmail.c        /^main (argc, argv)$/
363 Xmain   crnews.c        /^main (argc, argv)$/
364 Xmain   uucomp.c        /^main (argc, argv)$/
365 SHAR_EOF
366 if test 108 -ne "`wc -c < 'uucomp-1.1/tags'`" ; then
367    echo "shar: ***** error transmitting file uucomp-1.1/tags (should have been 108 characters, but was "`wc -c < 'uucomp-1.1/tags'`" characters) *****"
368 fi
369 fi
370
371 touch 0804224993 uucomp-1.1/tags
372 chmod 0600 uucomp-1.1/tags
373
374 echo "shar: extracting uucomp-1.1/uucomp.c - (3506 characters)"
375 if test -f 'uucomp-1.1/uucomp.c' ; then
376    echo shar: will not over-write existing file uucomp-1.1/uucomp.c
377 else
378 sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/uucomp.c'
379 X/*
380 X * uucomp - compress outgoing news/mail
381 X * 
382 X * usage: uucomp C.*
383 X * 
384 X * This works for Taylor uucp (available from prep.ai.mit.edu:/pub/gnu/uucp*),
385 X * but I don't promise it works for anyone else's uucp package.  Basically, this
386 X * is a quick-n-dirty hack to get compressed mail and news to a uucp site.  This
387 X * becomes important when you're on the other end of a 1200 baud packet radio
388 X * link, where the throughput can be 60 CPS (or lower).  It also tends to hide
389 X * any nasties that people might want to say to you, since the packets *are*
390 X * public readable.  Yes, I looked at uubatch, but it was too complicated for
391 X * me to figure out <grin>, and it didn't work with Taylor-uucp.  This is almost
392 X * too simple to work...
393 X * 
394 X * To use this little guy, do something like this in the .bashrc or .profile
395 X * or .cshrc of the uucp's login shell:
396 X * 
397 X * cd /usr/spool/uucp/<wherever the C. and D. files are kept>
398 X * /usr/bin/uucomp C.*
399 X * exec /usr/lib/uucp/uucico
400 X * 
401 X * This program was written by Ed Carp (erc@apple.com).  It can be used for any
402 X * non-commercial purpose.  This software is freely redistributable.
403 X */
404 X
405 X/*
406 X * 
407 X * Copyright 1993 by Ed Carp (erc@apple.com)  All rights reserved.
408 X * 
409 X * Permission is hereby granted for any non-commercial use of this
410 X * program, as long as this copyright notice remains intact.  Commercial
411 X * users may contact me - I'm easy.
412 X * 
413 X */
414 X
415 X#include <stdio.h>
416 X#include "uucomp.h"
417 X#undef NULL
418 X#define NULL (0)
419 Xmain (argc, argv)
420 Xint argc;
421 Xchar **argv;
422 X{
423 X  int i, j, sw, ctr = 0, errflag = 0, mctr = 0, nctr = 0, skipctr = 0;
424 X  char scr[64], rcmd[10], line[1024], lineout[1024];
425 X  char *strtok (), *ptr, *lineptr, compfile[32];
426 X  FILE *in;
427 X
428 X  printf ("uucomp 1.1 08/04/93 ... by erc@apple.com\nscanning %d files.", argc - 1);
429 X  for (i = 1; i < argc; i++)
430 X  {
431 X    if (strncmp (argv[i], "C.", 2) != 0)
432 X    {
433 X      skipctr++;
434 X      continue;
435 X    }
436 X    if ((in = fopen (argv[i], "r+")) == (FILE *) NULL)
437 X    {
438 X      skipctr++;
439 X      continue;
440 X    }
441 X    fgets (line, 1022, in);
442 X    if(*line != 'E')
443 X    {
444 X      skipctr++;
445 X      continue;
446 X    }
447 X    line[strlen (line) - 1] = NULL;
448 X    rewind (in);
449 X    *lineout = NULL;
450 X    lineptr = line;
451 X    sw = errflag = 0;
452 X    printf (".");
453 X    fflush (stdout);
454 X    for (j = 0;; j++)
455 X    {
456 X      ptr = strtok (lineptr, " ");
457 X      if (ptr == NULL)
458 X       break;
459 X      lineptr = NULL;
460 X      if (j == 1)
461 X      {
462 X       if (access (ptr, 4) == EOF)
463 X       {
464 X#ifdef DEBUG
465 X         printf ("skip: file '%s' doesn't exist\n", ptr);
466 X#endif
467 X         errflag = 1;
468 X         break;                       /*
469 X                                       * skip it if the data file isn't
470 X                                       * there yet 
471 X                                       */
472 X       }
473 X       strcpy (compfile, ptr);
474 X      }
475 X      if (j == 9)
476 X      {
477 X       if (strcmp (ptr, "rmail") != 0 && strcmp (ptr, "rnews") != 0)
478 X       {
479 X#ifdef DEBUG
480 X         printf ("skip: '%s' wrong command\n", ptr);
481 X#endif
482 X         errflag = 1;
483 X         break;
484 X       }
485 X       if (strcmp (ptr, "rmail") == 0)
486 X         mctr++;
487 X       if (strcmp (ptr, "rnews") == 0)
488 X         nctr++;
489 X       sw = 1;
490 X       strcat (lineout, "c");
491 X      }
492 X      strcat (lineout, ptr);
493 X      strcat (lineout, " ");
494 X    }
495 X    if (errflag == 1)
496 X    {
497 X      skipctr++;
498 X      fclose (in);
499 X      continue;
500 X    }
501 X    fprintf (in, "%s\n", lineout);
502 X    fclose (in);
503 X    sprintf (line,
504 X            "%s -fc > /tmp/uucomp.%d < %s;cp /tmp/uucomp.%d %s",
505 X            COMPRESS, getpid (), compfile, getpid (), compfile);
506 X    system (line);
507 X    ctr++;
508 X  }
509 X  sprintf (line, "/tmp/uucomp.%d", getpid ());
510 X  unlink (line);
511 X  printf ("\n%d skipped, %d compressed (%d mail, %d news).\n",
512 X         skipctr, ctr, mctr, nctr);
513 X  exit (0);
514 X}
515 SHAR_EOF
516 if test 3506 -ne "`wc -c < 'uucomp-1.1/uucomp.c'`" ; then
517    echo "shar: ***** error transmitting file uucomp-1.1/uucomp.c (should have been 3506 characters, but was "`wc -c < 'uucomp-1.1/uucomp.c'`" characters) *****"
518 fi
519 fi
520
521 touch 0804224693 uucomp-1.1/uucomp.c
522 chmod 0600 uucomp-1.1/uucomp.c
523
524 echo "shar: extracting uucomp-1.1/uucomp.h - (383 characters)"
525 if test -f 'uucomp-1.1/uucomp.h' ; then
526    echo shar: will not over-write existing file uucomp-1.1/uucomp.h
527 else
528 sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/uucomp.h'
529 X/*
530 X * 
531 X * Copyright 1993 by Ed Carp (erc@apple.com)  All rights reserved.
532 X * 
533 X * Permission is hereby granted for any non-commercial use of this
534 X * program, as long as this copyright notice remains intact.  Commercial
535 X * users may contact me - I'm easy.
536 X * 
537 X */
538 X
539 X#define COMPRESS "/usr/bin/gzip -9c"
540 X#define UNCOMPRESS "/usr/bin/gzip -dc"
541 X#define RMAIL "rmail"
542 X#define RNEWS "rnews"
543 SHAR_EOF
544 if test 383 -ne "`wc -c < 'uucomp-1.1/uucomp.h'`" ; then
545    echo "shar: ***** error transmitting file uucomp-1.1/uucomp.h (should have been 383 characters, but was "`wc -c < 'uucomp-1.1/uucomp.h'`" characters) *****"
546 fi
547 fi
548
549 touch 0715190293 uucomp-1.1/uucomp.h
550 chmod 0600 uucomp-1.1/uucomp.h
551 echo End of all shell archives
552 exit 0