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