home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume12 / cnews / part02 < prev    next >
Text File  |  1987-10-19  |  60KB  |  2,145 lines

  1. Subject:  v12i027:  C News alpha release, Part02/14
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rs@uunet.UU.NET
  5.  
  6. Submitted-by: utzoo!henry (Henry Spencer)
  7. Posting-number: Volume 12, Issue 27
  8. Archive-name: cnews/part02
  9.  
  10.  
  11.  
  12. #! /bin/sh
  13. # This is a shell archive.  Remove anything before this line, then unpack
  14. # it by saving it into a file and typing "sh file".  To overwrite existing
  15. # files, type "sh file -c".  You can also feed this as standard input via
  16. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  17. # will see the following message at the end:
  18. #        "End of archive 2 (of 14)."
  19. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  20. if test -f 'expire/olddate.c' -a "${1}" != "-c" ; then 
  21.   echo shar: Will not clobber existing file \"'expire/olddate.c'\"
  22. else
  23. echo shar: Extracting \"'expire/olddate.c'\" \(458 characters\)
  24. sed "s/^X//" >'expire/olddate.c' <<'END_OF_FILE'
  25. X/*
  26. X * olddate - generate spurious dates for checking news expiry
  27. X */
  28. X
  29. X#include <stdio.h>
  30. X#include <sys/types.h>
  31. X
  32. X#define    DAY    (24L*60L*60L)
  33. X
  34. Xextern time_t time();
  35. Xextern double atof();
  36. X
  37. Xchar *progname;
  38. X
  39. Xmain(argc, argv)
  40. Xint argc;
  41. Xchar *argv[];
  42. X{
  43. X    int c;
  44. X    int errflg = 0;
  45. X
  46. X    progname = argv[0];
  47. X
  48. X    if (argc != 2) {
  49. X        fprintf(stderr, "Usage: %s days\n", progname);
  50. X        exit(2);
  51. X    }
  52. X
  53. X    printf("%ld\n", (time_t)(time((time_t *)NULL) - atof(argv[1])*DAY));
  54. X
  55. X    exit(0);
  56. X}
  57. END_OF_FILE
  58. if test 458 -ne `wc -c <'expire/olddate.c'`; then
  59.     echo shar: \"'expire/olddate.c'\" unpacked with wrong size!
  60. fi
  61. # end of 'expire/olddate.c'
  62. fi
  63. if test -f 'expire/oldfile.c' -a "${1}" != "-c" ; then 
  64.   echo shar: Will not clobber existing file \"'expire/oldfile.c'\"
  65. else
  66. echo shar: Extracting \"'expire/oldfile.c'\" \(707 characters\)
  67. sed "s/^X//" >'expire/oldfile.c' <<'END_OF_FILE'
  68. X/*
  69. X * makeold - make an old file, copying from stdin
  70. X */
  71. X
  72. X#include <stdio.h>
  73. X#include <sys/types.h>
  74. X
  75. X#define    DAY    (24L*60L*60L)
  76. X
  77. Xextern time_t time();
  78. Xextern double atof();
  79. X
  80. Xchar buf[BUFSIZ];
  81. X
  82. Xchar *progname;
  83. X
  84. Xmain(argc, argv)
  85. Xint argc;
  86. Xchar *argv[];
  87. X{
  88. X    int c;
  89. X    int errflg = 0;
  90. X    int n;
  91. X    int d;
  92. X    time_t t[2];
  93. X
  94. X    progname = argv[0];
  95. X
  96. X    if (argc != 3) {
  97. X        fprintf(stderr, "Usage: %s days filename\n", progname);
  98. X        exit(2);
  99. X    }
  100. X
  101. X    d = creat(argv[2], 0666);
  102. X    if (d < 0)
  103. X        error("can't create `%s'", argv[2]);
  104. X
  105. X    while ((n = read(0, buf, sizeof(buf))) > 0)
  106. X        (void) write(d, buf, n);
  107. X
  108. X    (void) close(d);
  109. X
  110. X    t[0] = (time_t)(time((time_t *)NULL) - atof(argv[1])*DAY);
  111. X    t[1] = t[0];
  112. X
  113. X    (void) utime(argv[2], t);
  114. X
  115. X    exit(0);
  116. X}
  117. END_OF_FILE
  118. if test 707 -ne `wc -c <'expire/oldfile.c'`; then
  119.     echo shar: \"'expire/oldfile.c'\" unpacked with wrong size!
  120. fi
  121. # end of 'expire/oldfile.c'
  122. fi
  123. if test -f 'include/newspaths.h' -a "${1}" != "-c" ; then 
  124.   echo shar: Will not clobber existing file \"'include/newspaths.h'\"
  125. else
  126. echo shar: Extracting \"'include/newspaths.h'\" \(546 characters\)
  127. sed "s/^X//" >'include/newspaths.h' <<'END_OF_FILE'
  128. X/*
  129. X * news pathname functions
  130. X */
  131. X
  132. Xextern char *artfile();        /* article pathname, may be relative */
  133. Xextern char *spoolfile();    /* obsolete synonym for artfile() */
  134. Xextern char *fullartfile();    /* article full pathname */
  135. Xextern char *fullspoolfile();    /* obsolete synonym */
  136. Xextern char *ctlfile();        /* control-file name */
  137. Xextern char *libfile();        /* obsolete synonym */
  138. Xextern char *binfile();        /* program pathname */
  139. X
  140. Xextern void cd();        /* chdir() with errunlock() on failure */
  141. X
  142. Xextern void unprivileged();    /* user-supplied privilege dropper */
  143. END_OF_FILE
  144. if test 546 -ne `wc -c <'include/newspaths.h'`; then
  145.     echo shar: \"'include/newspaths.h'\" unpacked with wrong size!
  146. fi
  147. # end of 'include/newspaths.h'
  148. fi
  149. if test -f 'input/README' -a "${1}" != "-c" ; then 
  150.   echo shar: Will not clobber existing file \"'input/README'\"
  151. else
  152. echo shar: Extracting \"'input/README'\" \(472 characters\)
  153. sed "s/^X//" >'input/README' <<'END_OF_FILE'
  154. XThis is the input processing, which starts at rnews (aka cunbatch).  It
  155. Xinvokes newsspool, which actually puts the stuff where it belongs (peeling
  156. Xoff the silly and unnecessary "#! cunbatch" header, if any, as it goes).
  157. X
  158. XNewsrun should be run regularly; it unspools the stuff and feeds it into
  159. Xthe relay subsystem for processing.  Newsrunning can be used to turn this
  160. Xfunction on and off if you want to avoid news processing during busy hours.
  161. X
  162. XNo manual page yet, sorry.
  163. END_OF_FILE
  164. if test 472 -ne `wc -c <'input/README'`; then
  165.     echo shar: \"'input/README'\" unpacked with wrong size!
  166. fi
  167. # end of 'input/README'
  168. fi
  169. if test -f 'input/newsrunning' -a "${1}" != "-c" ; then 
  170.   echo shar: Will not clobber existing file \"'input/newsrunning'\"
  171. else
  172. echo shar: Extracting \"'input/newsrunning'\" \(405 characters\)
  173. sed "s/^X//" >'input/newsrunning' <<'END_OF_FILE'
  174. X#! /bin/sh
  175. X# newsrunning - turn news processing on and off
  176. X
  177. XNEWSCTL=${NEWSCTL-/usr/lib/news}
  178. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}
  179. XNEWSARTS=${NEWSARTS-/usr/spool/news}
  180. XPATH=$NEWSBIN/input:/bin:/usr/bin ; export PATH
  181. XNEWSUMASK=${NEWSUMASK-002}
  182. Xumask NEWSUMASK
  183. X
  184. Xcase "$1"
  185. Xin
  186. X    on)
  187. X    rm -f $NEWSCTL/incoming/stop
  188. X    ;;
  189. X
  190. X    off)
  191. X    >$NEWSCTL/incoming/stop
  192. X    ;;
  193. X
  194. X    *)
  195. X    echo "Usage: $0 on/off" >&2
  196. X    exit 2
  197. X    ;;
  198. Xesac
  199. X
  200. Xexit 0
  201. END_OF_FILE
  202. if test 405 -ne `wc -c <'input/newsrunning'`; then
  203.     echo shar: \"'input/newsrunning'\" unpacked with wrong size!
  204. fi
  205. # end of 'input/newsrunning'
  206. fi
  207. if test -f 'lib.proto/control/sendsys' -a "${1}" != "-c" ; then 
  208.   echo shar: Will not clobber existing file \"'lib.proto/control/sendsys'\"
  209. else
  210. echo shar: Extracting \"'lib.proto/control/sendsys'\" \(474 characters\)
  211. sed "s/^X//" >'lib.proto/control/sendsys' <<'END_OF_FILE'
  212. X#! /bin/sh
  213. X# sendsys - mail sys file to sender identified in stdin's headers
  214. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  215. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  216. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  217. XPATH=$NEWSCTL:$NEWSBIN:/bin:/usr/bin; export PATH
  218. XNEWSADMIN=usenet
  219. X
  220. XSENDER="`newsreply`"
  221. X(echo "Subject: response to your sendsys"; echo ""; cat $NEWSCTL/sys) |
  222. X    mail "$SENDER"
  223. Xecho "news/sys file has been sent to $SENDER." | mail $NEWSADMIN
  224. END_OF_FILE
  225. if test 474 -ne `wc -c <'lib.proto/control/sendsys'`; then
  226.     echo shar: \"'lib.proto/control/sendsys'\" unpacked with wrong size!
  227. fi
  228. # end of 'lib.proto/control/sendsys'
  229. fi
  230. if test -f 'lib.proto/control/senduuname' -a "${1}" != "-c" ; then 
  231.   echo shar: Will not clobber existing file \"'lib.proto/control/senduuname'\"
  232. else
  233. echo shar: Extracting \"'lib.proto/control/senduuname'\" \(459 characters\)
  234. sed "s/^X//" >'lib.proto/control/senduuname' <<'END_OF_FILE'
  235. X#! /bin/sh
  236. X# senduuname - mail `uuname` to sender identified in stdin's headers
  237. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  238. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  239. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  240. XPATH=$NEWSCTL:$NEWSBIN:/bin:/usr/bin; export PATH
  241. XNEWSADMIN=usenet
  242. X
  243. XSENDER="`newsreply`"
  244. X(echo "Subject: response to your senduuname"; echo ""; uuname) | mail "$SENDER"
  245. Xecho "uuname output sent to $SENDER" | mail $NEWSADMIN
  246. END_OF_FILE
  247. if test 459 -ne `wc -c <'lib.proto/control/senduuname'`; then
  248.     echo shar: \"'lib.proto/control/senduuname'\" unpacked with wrong size!
  249. fi
  250. # end of 'lib.proto/control/senduuname'
  251. fi
  252. if test -f 'lib.proto/control/version' -a "${1}" != "-c" ; then 
  253.   echo shar: Will not clobber existing file \"'lib.proto/control/version'\"
  254. else
  255. echo shar: Extracting \"'lib.proto/control/version'\" \(356 characters\)
  256. sed "s/^X//" >'lib.proto/control/version' <<'END_OF_FILE'
  257. X#! /bin/sh
  258. X# version - mail version id to sender identified in stdin's headers
  259. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  260. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  261. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  262. XPATH=$NEWSCTL:$NEWSBIN:/bin:/usr/bin; export PATH
  263. X
  264. XSENDER="`newsreply`"
  265. Xecho "C, Official Alpha Release" | mail "$SENDER"
  266. END_OF_FILE
  267. if test 356 -ne `wc -c <'lib.proto/control/version'`; then
  268.     echo shar: \"'lib.proto/control/version'\" unpacked with wrong size!
  269. fi
  270. # end of 'lib.proto/control/version'
  271. fi
  272. if test -f 'lib.proto/explist' -a "${1}" != "-c" ; then 
  273.   echo shar: Will not clobber existing file \"'lib.proto/explist'\"
  274. else
  275. echo shar: Extracting \"'lib.proto/explist'\" \(450 characters\)
  276. sed "s/^X//" >'lib.proto/explist' <<'END_OF_FILE'
  277. Xutstat                        x    7000    /usr/spool/oldnews
  278. Xnews.lists                    x    37    -
  279. Xcomp.mail.maps                    x    22-22-22    -
  280. Xall.all.mac                    x    0.5-0.5    -
  281. Xall.all.pc,all.all.ibm,comp.protocols.kermit    x    2-2    -
  282. Xcomp.lang.c                    x    0.5-0.5    -
  283. Xjunk                        x    0.5-0.5    -
  284. Xcontrol                        x    0.5-0.5    -
  285. Xto                        x    2    -
  286. Xrec,soc,talk,list.humanist            x    0-0    -
  287. Xcomp.mail.elm                    x    0-0    -
  288. Xmisc                        x    4-4    -
  289. Xsci                        x    5-5    -
  290. Xtor.news.stats                    x    2-2    -
  291. Xcan,ont,tor,ut                    x    5-5    -
  292. Xall                        m    3-7-7    -
  293. Xall                        u    6-6    -
  294. END_OF_FILE
  295. if test 450 -ne `wc -c <'lib.proto/explist'`; then
  296.     echo shar: \"'lib.proto/explist'\" unpacked with wrong size!
  297. fi
  298. # end of 'lib.proto/explist'
  299. fi
  300. if test -f 'libc/Makefile' -a "${1}" != "-c" ; then 
  301.   echo shar: Will not clobber existing file \"'libc/Makefile'\"
  302. else
  303. echo shar: Extracting \"'libc/Makefile'\" \(511 characters\)
  304. sed "s/^X//" >'libc/Makefile' <<'END_OF_FILE'
  305. X# c news local libc makefile - added by Ian Darwin
  306. X
  307. XINCLUDE = ../include
  308. X
  309. X# delete from SRCS the ones that are already in your C library or -llocal
  310. XALLSRCS = closeall.c efopen.c emalloc.c error.c fgetmfs.c getopt.c \
  311. X    memlist.c standard.c warning.c
  312. XSRCS = closeall.c emalloc.c fgetmfs.c memlist.c standard.c putenv.c stdfdopen.c
  313. X
  314. X# RANLIB is ranlib on non-USG systems, echo on USG systems
  315. XRANLIB=ranlib
  316. XRANLIB=echo
  317. X
  318. XCFLAGS = -I$(INCLUDE)
  319. X
  320. Xlibc.a:    $(SRCS)
  321. X    cc $(CFLAGS) -c $?
  322. X    ar ru $@ *.o
  323. X    rm *.o
  324. X    $(RANLIB) $@
  325. END_OF_FILE
  326. if test 511 -ne `wc -c <'libc/Makefile'`; then
  327.     echo shar: \"'libc/Makefile'\" unpacked with wrong size!
  328. fi
  329. # end of 'libc/Makefile'
  330. fi
  331. if test -f 'libc/closeall.3' -a "${1}" != "-c" ; then 
  332.   echo shar: Will not clobber existing file \"'libc/closeall.3'\"
  333. else
  334. echo shar: Extracting \"'libc/closeall.3'\" \(484 characters\)
  335. sed "s/^X//" >'libc/closeall.3' <<'END_OF_FILE'
  336. X.TH CLOSEALL 3 local
  337. X.DA 9 Feb 1982
  338. X.SH NAME
  339. Xcloseall \- close all files
  340. X.SH SYNOPSIS
  341. X.ft B
  342. Xcloseall(leavestd)
  343. X.br
  344. Xint leavestd;
  345. X.ft R
  346. X.SH DESCRIPTION
  347. X.I Closeall
  348. Xcloses all currently-open file descriptors.
  349. XIf
  350. X.I leavestd
  351. Xis non-zero,
  352. Xthe standard input, output, and diagnostic descriptors are left open;
  353. Xotherwise they are closed too.
  354. X.SH SEE ALSO
  355. Xclose(2), standard(3)
  356. X.SH HISTORY
  357. XLocal invention.
  358. X.SH BUGS
  359. XNothing wrong with
  360. X.IR closeall ,
  361. Xbut there ought to be an
  362. X.IR fcloseall .
  363. END_OF_FILE
  364. if test 484 -ne `wc -c <'libc/closeall.3'`; then
  365.     echo shar: \"'libc/closeall.3'\" unpacked with wrong size!
  366. fi
  367. # end of 'libc/closeall.3'
  368. fi
  369. if test -f 'libc/efopen.3' -a "${1}" != "-c" ; then 
  370.   echo shar: Will not clobber existing file \"'libc/efopen.3'\"
  371. else
  372. echo shar: Extracting \"'libc/efopen.3'\" \(529 characters\)
  373. sed "s/^X//" >'libc/efopen.3' <<'END_OF_FILE'
  374. X.TH EFOPEN 3 local
  375. X.DA 24 April 1984
  376. X.SH NAME
  377. Xefopen \- open a stream, checking for errors
  378. X.SH SYNOPSIS
  379. X.nf
  380. X.B FILE *
  381. X.B efopen(file, mode)
  382. X.B char *file;
  383. X.B char *mode;
  384. X.SH DESCRIPTION
  385. X.I Efopen
  386. Xinvokes
  387. X.IR fopen (3)
  388. Xand checks the result for errors.
  389. XIn the absence of errors, it returns the stream pointer;
  390. Xin the presence of errors, it prints a message and exits.
  391. X.SH SEE ALSO
  392. Xfopen(3), error(3)
  393. X.SH DIAGNOSTICS
  394. XExit status, in the event of error, is 1.
  395. X.SH HISTORY
  396. XLocal product, roughly following the one in Kernighan&Pike.
  397. END_OF_FILE
  398. if test 529 -ne `wc -c <'libc/efopen.3'`; then
  399.     echo shar: \"'libc/efopen.3'\" unpacked with wrong size!
  400. fi
  401. # end of 'libc/efopen.3'
  402. fi
  403. if test -f 'libc/efopen.c' -a "${1}" != "-c" ; then 
  404.   echo shar: Will not clobber existing file \"'libc/efopen.c'\"
  405. else
  406. echo shar: Extracting \"'libc/efopen.c'\" \(477 characters\)
  407. sed "s/^X//" >'libc/efopen.c' <<'END_OF_FILE'
  408. X/*
  409. X * efopen - fopen file, exit with message if impossible
  410. X */
  411. X
  412. X#include <stdio.h>
  413. X
  414. Xstatic char message[] = "can't open file \"%s\" mode ";
  415. X
  416. XFILE *
  417. Xefopen(file, mode)
  418. Xchar *file;
  419. Xchar *mode;
  420. X{
  421. X    FILE *fp;
  422. X    char fullmsg[sizeof(message)+10];
  423. X    extern int errno;
  424. X
  425. X    errno = 0;        /* Wipe out residue of earlier errors. */
  426. X    fp = fopen(file, mode);
  427. X    if (fp == NULL) {
  428. X        strcpy(fullmsg, message);
  429. X        strncat(fullmsg, mode, 10);
  430. X        error(fullmsg, file);
  431. X        /* NOTREACHED */
  432. X    }
  433. X    return(fp);
  434. X}
  435. END_OF_FILE
  436. if test 477 -ne `wc -c <'libc/efopen.c'`; then
  437.     echo shar: \"'libc/efopen.c'\" unpacked with wrong size!
  438. fi
  439. # end of 'libc/efopen.c'
  440. fi
  441. if test -f 'libc/memcpy.fast/src/duff.byte.c' -a "${1}" != "-c" ; then 
  442.   echo shar: Will not clobber existing file \"'libc/memcpy.fast/src/duff.byte.c'\"
  443. else
  444. echo shar: Extracting \"'libc/memcpy.fast/src/duff.byte.c'\" \(624 characters\)
  445. sed "s/^X//" >'libc/memcpy.fast/src/duff.byte.c' <<'END_OF_FILE'
  446. Xmemcpy(to, from, count)        /* no alignment assumptions */
  447. Xregister char *from, *to;
  448. Xregister int count;
  449. X{
  450. X    /*
  451. X     * This code uses Duff's Device (tm Tom Duff)
  452. X     * to unroll the copying loop:
  453. X     * while (count-- > 0)
  454. X     *    *to++ = *from++;
  455. X     * Sorry the code is so ugly.
  456. X     */
  457. X    if (count > 0) {
  458. X        register int loops = (count+8-1) >> 3;    /* /8 round up */
  459. X
  460. X        switch (count&(8-1)) {    /* %8 */
  461. X        case 0: do {
  462. X#define COPYBYTE *to++ = *from++
  463. X                COPYBYTE;
  464. X            case 7:    COPYBYTE;
  465. X            case 6:    COPYBYTE;
  466. X            case 5:    COPYBYTE;
  467. X            case 4:    COPYBYTE;
  468. X            case 3:    COPYBYTE;
  469. X            case 2:    COPYBYTE;
  470. X            case 1:    COPYBYTE;
  471. X            } while (--loops > 0);
  472. X        }
  473. X    }
  474. X}
  475. END_OF_FILE
  476. if test 624 -ne `wc -c <'libc/memcpy.fast/src/duff.byte.c'`; then
  477.     echo shar: \"'libc/memcpy.fast/src/duff.byte.c'\" unpacked with wrong size!
  478. fi
  479. # end of 'libc/memcpy.fast/src/duff.byte.c'
  480. fi
  481. if test -f 'libc/memcpy.fast/src/memcpy.c' -a "${1}" != "-c" ; then 
  482.   echo shar: Will not clobber existing file \"'libc/memcpy.fast/src/memcpy.c'\"
  483. else
  484. echo shar: Extracting \"'libc/memcpy.fast/src/memcpy.c'\" \(357 characters\)
  485. sed "s/^X//" >'libc/memcpy.fast/src/memcpy.c' <<'END_OF_FILE'
  486. X#ifndef BYTES
  487. X#define BYTES 10*1024
  488. X#endif
  489. X#ifndef LOOPS
  490. X#define LOOPS 1000
  491. X#endif
  492. X#ifndef FROMALIGN
  493. X#define FROMALIGN 0
  494. X#endif
  495. X#ifndef TOALIGN
  496. X#define TOALIGN 0
  497. X#endif
  498. X
  499. Xmain()        /* time memcpy(3) */
  500. X{
  501. X    register int count = LOOPS;
  502. X    static char from[BYTES], to[BYTES];
  503. X
  504. X    while (count-- > 0)
  505. X        memcpy(to, from, sizeof from - FROMALIGN - TOALIGN);
  506. X    return 0;
  507. X}
  508. END_OF_FILE
  509. if test 357 -ne `wc -c <'libc/memcpy.fast/src/memcpy.c'`; then
  510.     echo shar: \"'libc/memcpy.fast/src/memcpy.c'\" unpacked with wrong size!
  511. fi
  512. # end of 'libc/memcpy.fast/src/memcpy.c'
  513. fi
  514. if test -f 'libc/memcpy.fast/times' -a "${1}" != "-c" ; then 
  515.   echo shar: Will not clobber existing file \"'libc/memcpy.fast/times'\"
  516. else
  517. echo shar: Extracting \"'libc/memcpy.fast/times'\" \(535 characters\)
  518. sed "s/^X//" >'libc/memcpy.fast/times' <<'END_OF_FILE'
  519. XScript started on Sat Feb  8 07:50:49 1986
  520. Xcs% time bcopy.vax
  521. X       12.1 real         6.5 user         0.7 sys  
  522. Xcs% time bcopy.obvious
  523. X       85.5 real        75.0 user         2.4 sys  
  524. Xtimecs%  bcopy.duff
  525. X       28.9 real        27.3 user         1.1 sys  
  526. Xcs% time bcopy.duff.long
  527. X       16.8 real        13.9 user         0.8 sys  
  528. Xcs% time bcopy.duff.double
  529. X       15.6 real        14.5 user         0.7 sys  
  530. Xcs% time bcopy.duff.longs
  531. X        9.4 real         8.2 user         0.6 sys  
  532. Xscript done on Sat Feb  8 09:00:42 1986
  533. END_OF_FILE
  534. if test 535 -ne `wc -c <'libc/memcpy.fast/times'`; then
  535.     echo shar: \"'libc/memcpy.fast/times'\" unpacked with wrong size!
  536. fi
  537. # end of 'libc/memcpy.fast/times'
  538. fi
  539. if test -f 'libc/stdfdopen.c' -a "${1}" != "-c" ; then 
  540.   echo shar: Will not clobber existing file \"'libc/stdfdopen.c'\"
  541. else
  542. echo shar: Extracting \"'libc/stdfdopen.c'\" \(631 characters\)
  543. sed "s/^X//" >'libc/stdfdopen.c' <<'END_OF_FILE'
  544. X/*
  545. X * stdfdopen - ensure that the standard i/o descriptors are open,
  546. X *    to avoid mayhem.
  547. X */
  548. X
  549. X#include <stdio.h>
  550. X#include <errno.h>
  551. X#include <sys/types.h>
  552. X
  553. Xstdfdopen()            /* ensure standard descriptors are open */
  554. X{
  555. X    register int fd;
  556. X
  557. X    for (fd = 0; fd < 3; fd++) {        /* 3 is NSYSFILE on V8 */
  558. X        register int newfd;
  559. X        extern int errno;
  560. X
  561. X        /* TODO: use fstat instead? */
  562. X        newfd = dup(fd);        /* just to check whether it's open */
  563. X        if (newfd < 0 && errno == EBADF)    /* fd is closed */
  564. X            if (open("/dev/null", 2) != fd)    /* open read/write */
  565. X                exit(1);    /* bad news */
  566. X        if (newfd >= 0)            /* fd was open */
  567. X            (void) close(newfd);
  568. X    }
  569. X}
  570. END_OF_FILE
  571. if test 631 -ne `wc -c <'libc/stdfdopen.c'`; then
  572.     echo shar: \"'libc/stdfdopen.c'\" unpacked with wrong size!
  573. fi
  574. # end of 'libc/stdfdopen.c'
  575. fi
  576. if test -f 'libc/strings/memccpy.c' -a "${1}" != "-c" ; then 
  577.   echo shar: Will not clobber existing file \"'libc/strings/memccpy.c'\"
  578. else
  579. echo shar: Extracting \"'libc/strings/memccpy.c'\" \(656 characters\)
  580. sed "s/^X//" >'libc/strings/memccpy.c' <<'END_OF_FILE'
  581. X/*
  582. X * memccpy - copy bytes up to a certain char
  583. X *
  584. X * CHARBITS should be defined only if the compiler lacks "unsigned char".
  585. X * It should be a mask, e.g. 0377 for an 8-bit machine.
  586. X */
  587. X
  588. X#define    NULL    0
  589. X
  590. X#ifndef CHARBITS
  591. X#    define    UNSCHAR(c)    ((unsigned char)(c))
  592. X#else
  593. X#    define    UNSCHAR(c)    ((c)&CHARBITS)
  594. X#endif
  595. X
  596. XVOIDSTAR
  597. Xmemccpy(dst, src, ucharstop, size)
  598. XVOIDSTAR dst;
  599. XCONST VOIDSTAR src;
  600. XSIZET size;
  601. X{
  602. X    register char *d;
  603. X    register CONST char *s;
  604. X    register SIZET n;
  605. X    register int uc;
  606. X
  607. X    if (size <= 0)
  608. X        return(NULL);
  609. X
  610. X    s = src;
  611. X    d = dst;
  612. X    uc = UNSCHAR(ucharstop);
  613. X    for (n = size; n > 0; n--)
  614. X        if (UNSCHAR(*d++ = *s++) == uc)
  615. X            return(d);
  616. X
  617. X    return(NULL);
  618. X}
  619. END_OF_FILE
  620. if test 656 -ne `wc -c <'libc/strings/memccpy.c'`; then
  621.     echo shar: \"'libc/strings/memccpy.c'\" unpacked with wrong size!
  622. fi
  623. # end of 'libc/strings/memccpy.c'
  624. fi
  625. if test -f 'libc/strings/memchr.c' -a "${1}" != "-c" ; then 
  626.   echo shar: Will not clobber existing file \"'libc/strings/memchr.c'\"
  627. else
  628. echo shar: Extracting \"'libc/strings/memchr.c'\" \(595 characters\)
  629. sed "s/^X//" >'libc/strings/memchr.c' <<'END_OF_FILE'
  630. X/*
  631. X * memchr - search for a byte
  632. X *
  633. X * CHARBITS should be defined only if the compiler lacks "unsigned char".
  634. X * It should be a mask, e.g. 0377 for an 8-bit machine.
  635. X */
  636. X
  637. X#define    NULL    0
  638. X
  639. X#ifndef CHARBITS
  640. X#    define    UNSCHAR(c)    ((unsigned char)(c))
  641. X#else
  642. X#    define    UNSCHAR(c)    ((c)&CHARBITS)
  643. X#endif
  644. X
  645. XVOIDSTAR
  646. Xmemchr(s, ucharwanted, size)
  647. XCONST VOIDSTAR s;
  648. Xint ucharwanted;
  649. XSIZET size;
  650. X{
  651. X    register CONST char *scan;
  652. X    register SIZET n;
  653. X    register int uc;
  654. X
  655. X    scan = s;
  656. X    uc = UNSCHAR(ucharwanted);
  657. X    for (n = size; n > 0; n--)
  658. X        if (UNSCHAR(*scan) == uc)
  659. X            return(scan);
  660. X        else
  661. X            scan++;
  662. X
  663. X    return(NULL);
  664. X}
  665. END_OF_FILE
  666. if test 595 -ne `wc -c <'libc/strings/memchr.c'`; then
  667.     echo shar: \"'libc/strings/memchr.c'\" unpacked with wrong size!
  668. fi
  669. # end of 'libc/strings/memchr.c'
  670. fi
  671. if test -f 'libc/strings/memcmp.c' -a "${1}" != "-c" ; then 
  672.   echo shar: Will not clobber existing file \"'libc/strings/memcmp.c'\"
  673. else
  674. echo shar: Extracting \"'libc/strings/memcmp.c'\" \(367 characters\)
  675. sed "s/^X//" >'libc/strings/memcmp.c' <<'END_OF_FILE'
  676. X/*
  677. X * memcmp - compare bytes
  678. X */
  679. X
  680. Xint                /* <0, == 0, >0 */
  681. Xmemcmp(s1, s2, size)
  682. XCONST VOIDSTAR s1;
  683. XCONST VOIDSTAR s2;
  684. XSIZET size;
  685. X{
  686. X    register CONST char *scan1;
  687. X    register CONST char *scan2;
  688. X    register SIZET n;
  689. X
  690. X    scan1 = s1;
  691. X    scan2 = s2;
  692. X    for (n = size; n > 0; n--)
  693. X        if (*scan1 == *scan2) {
  694. X            scan1++;
  695. X            scan2++;
  696. X        } else
  697. X            return(*scan1 - *scan2);
  698. X
  699. X    return(0);
  700. X}
  701. END_OF_FILE
  702. if test 367 -ne `wc -c <'libc/strings/memcmp.c'`; then
  703.     echo shar: \"'libc/strings/memcmp.c'\" unpacked with wrong size!
  704. fi
  705. # end of 'libc/strings/memcmp.c'
  706. fi
  707. if test -f 'libc/strings/memcpy.c' -a "${1}" != "-c" ; then 
  708.   echo shar: Will not clobber existing file \"'libc/strings/memcpy.c'\"
  709. else
  710. echo shar: Extracting \"'libc/strings/memcpy.c'\" \(450 characters\)
  711. sed "s/^X//" >'libc/strings/memcpy.c' <<'END_OF_FILE'
  712. X/*
  713. X * memcpy - copy bytes
  714. X */
  715. X
  716. XVOIDSTAR
  717. Xmemcpy(dst, src, size)
  718. XVOIDSTAR dst;
  719. XCONST VOIDSTAR src;
  720. XSIZET size;
  721. X{
  722. X    register char *d;
  723. X    register CONST char *s;
  724. X    register SIZET n;
  725. X
  726. X    if (size <= 0)
  727. X        return(dst);
  728. X
  729. X    s = src;
  730. X    d = dst;
  731. X    if (s <= d && s + (size-1) >= d) {
  732. X        /* Overlap, must copy right-to-left. */
  733. X        s += size-1;
  734. X        d += size-1;
  735. X        for (n = size; n > 0; n--)
  736. X            *d-- = *s--;
  737. X    } else
  738. X        for (n = size; n > 0; n--)
  739. X            *d++ = *s++;
  740. X
  741. X    return(dst);
  742. X}
  743. END_OF_FILE
  744. if test 450 -ne `wc -c <'libc/strings/memcpy.c'`; then
  745.     echo shar: \"'libc/strings/memcpy.c'\" unpacked with wrong size!
  746. fi
  747. # end of 'libc/strings/memcpy.c'
  748. fi
  749. if test -f 'libc/strings/memset.c' -a "${1}" != "-c" ; then 
  750.   echo shar: Will not clobber existing file \"'libc/strings/memset.c'\"
  751. else
  752. echo shar: Extracting \"'libc/strings/memset.c'\" \(524 characters\)
  753. sed "s/^X//" >'libc/strings/memset.c' <<'END_OF_FILE'
  754. X/*
  755. X * memset - set bytes
  756. X *
  757. X * CHARBITS should be defined only if the compiler lacks "unsigned char".
  758. X * It should be a mask, e.g. 0377 for an 8-bit machine.
  759. X */
  760. X
  761. X#ifndef CHARBITS
  762. X#    define    UNSCHAR(c)    ((unsigned char)(c))
  763. X#else
  764. X#    define    UNSCHAR(c)    ((c)&CHARBITS)
  765. X#endif
  766. X
  767. XVOIDSTAR
  768. Xmemset(s, ucharfill, size)
  769. XCONST VOIDSTAR s;
  770. Xregister int ucharfill;
  771. XSIZET size;
  772. X{
  773. X    register CONST char *scan;
  774. X    register SIZET n;
  775. X    register int uc;
  776. X
  777. X    scan = s;
  778. X    uc = UNSCHAR(ucharfill);
  779. X    for (n = size; n > 0; n--)
  780. X        *scan++ = uc;
  781. X
  782. X    return(s);
  783. X}
  784. END_OF_FILE
  785. if test 524 -ne `wc -c <'libc/strings/memset.c'`; then
  786.     echo shar: \"'libc/strings/memset.c'\" unpacked with wrong size!
  787. fi
  788. # end of 'libc/strings/memset.c'
  789. fi
  790. if test -f 'libc/strings/strchr.c' -a "${1}" != "-c" ; then 
  791.   echo shar: Will not clobber existing file \"'libc/strings/strchr.c'\"
  792. else
  793. echo shar: Extracting \"'libc/strings/strchr.c'\" \(418 characters\)
  794. sed "s/^X//" >'libc/strings/strchr.c' <<'END_OF_FILE'
  795. X/*
  796. X * strchr - find first occurrence of a character in a string
  797. X */
  798. X
  799. X#define    NULL    0
  800. X
  801. Xchar *                /* found char, or NULL if none */
  802. Xstrchr(s, charwanted)
  803. XCONST char *s;
  804. Xregister char charwanted;
  805. X{
  806. X    register CONST char *scan;
  807. X
  808. X    /*
  809. X     * The odd placement of the two tests is so NUL is findable.
  810. X     */
  811. X    for (scan = s; *scan != charwanted;)    /* ++ moved down for opt. */
  812. X        if (*scan++ == '\0')
  813. X            return(NULL);
  814. X    return(scan);
  815. X}
  816. END_OF_FILE
  817. if test 418 -ne `wc -c <'libc/strings/strchr.c'`; then
  818.     echo shar: \"'libc/strings/strchr.c'\" unpacked with wrong size!
  819. fi
  820. # end of 'libc/strings/strchr.c'
  821. fi
  822. if test -f 'libc/strings/strcmp.c' -a "${1}" != "-c" ; then 
  823.   echo shar: Will not clobber existing file \"'libc/strings/strcmp.c'\"
  824. else
  825. echo shar: Extracting \"'libc/strings/strcmp.c'\" \(637 characters\)
  826. sed "s/^X//" >'libc/strings/strcmp.c' <<'END_OF_FILE'
  827. X/*
  828. X * strcmp - compare string s1 to s2
  829. X */
  830. X
  831. Xint                /* <0 for <, 0 for ==, >0 for > */
  832. Xstrcmp(s1, s2)
  833. XCONST char *s1;
  834. XCONST char *s2;
  835. X{
  836. X    register CONST char *scan1;
  837. X    register CONST char *scan2;
  838. X
  839. X    scan1 = s1;
  840. X    scan2 = s2;
  841. X    while (*scan1 != '\0' && *scan1 == *scan2) {
  842. X        scan1++;
  843. X        scan2++;
  844. X    }
  845. X
  846. X    /*
  847. X     * The following case analysis is necessary so that characters
  848. X     * which look negative collate low against normal characters but
  849. X     * high against the end-of-string NUL.
  850. X     */
  851. X    if (*scan1 == '\0' && *scan2 == '\0')
  852. X        return(0);
  853. X    else if (*scan1 == '\0')
  854. X        return(-1);
  855. X    else if (*scan2 == '\0')
  856. X        return(1);
  857. X    else
  858. X        return(*scan1 - *scan2);
  859. X}
  860. END_OF_FILE
  861. if test 637 -ne `wc -c <'libc/strings/strcmp.c'`; then
  862.     echo shar: \"'libc/strings/strcmp.c'\" unpacked with wrong size!
  863. fi
  864. # end of 'libc/strings/strcmp.c'
  865. fi
  866. if test -f 'libc/strings/strcspn.c' -a "${1}" != "-c" ; then 
  867.   echo shar: Will not clobber existing file \"'libc/strings/strcspn.c'\"
  868. else
  869. echo shar: Extracting \"'libc/strings/strcspn.c'\" \(444 characters\)
  870. sed "s/^X//" >'libc/strings/strcspn.c' <<'END_OF_FILE'
  871. X/*
  872. X * strcspn - find length of initial segment of s consisting entirely
  873. X * of characters not from reject
  874. X */
  875. X
  876. XSIZET
  877. Xstrcspn(s, reject)
  878. XCONST char *s;
  879. XCONST char *reject;
  880. X{
  881. X    register CONST char *scan;
  882. X    register CONST char *rscan;
  883. X    register SIZET count;
  884. X
  885. X    count = 0;
  886. X    for (scan = s; *scan != '\0'; scan++) {
  887. X        for (rscan = reject; *rscan != '\0';)    /* ++ moved down. */
  888. X            if (*scan == *rscan++)
  889. X                return(count);
  890. X        count++;
  891. X    }
  892. X    return(count);
  893. X}
  894. END_OF_FILE
  895. if test 444 -ne `wc -c <'libc/strings/strcspn.c'`; then
  896.     echo shar: \"'libc/strings/strcspn.c'\" unpacked with wrong size!
  897. fi
  898. # end of 'libc/strings/strcspn.c'
  899. fi
  900. if test -f 'libc/strings/strncat.c' -a "${1}" != "-c" ; then 
  901.   echo shar: Will not clobber existing file \"'libc/strings/strncat.c'\"
  902. else
  903. echo shar: Extracting \"'libc/strings/strncat.c'\" \(404 characters\)
  904. sed "s/^X//" >'libc/strings/strncat.c' <<'END_OF_FILE'
  905. X/*
  906. X * strncat - append at most n characters of string src to dst
  907. X */
  908. Xchar *                /* dst */
  909. Xstrncat(dst, src, n)
  910. Xchar *dst;
  911. XCONST char *src;
  912. XSIZET n;
  913. X{
  914. X    register char *dscan;
  915. X    register CONST char *sscan;
  916. X    register SIZET count;
  917. X
  918. X    for (dscan = dst; *dscan != '\0'; dscan++)
  919. X        continue;
  920. X    sscan = src;
  921. X    count = n;
  922. X    while (*sscan != '\0' && --count >= 0)
  923. X        *dscan++ = *sscan++;
  924. X    *dscan++ = '\0';
  925. X    return(dst);
  926. X}
  927. END_OF_FILE
  928. if test 404 -ne `wc -c <'libc/strings/strncat.c'`; then
  929.     echo shar: \"'libc/strings/strncat.c'\" unpacked with wrong size!
  930. fi
  931. # end of 'libc/strings/strncat.c'
  932. fi
  933. if test -f 'libc/strings/strncpy.c' -a "${1}" != "-c" ; then 
  934.   echo shar: Will not clobber existing file \"'libc/strings/strncpy.c'\"
  935. else
  936. echo shar: Extracting \"'libc/strings/strncpy.c'\" \(387 characters\)
  937. sed "s/^X//" >'libc/strings/strncpy.c' <<'END_OF_FILE'
  938. X/*
  939. X * strncpy - copy at most n characters of string src to dst
  940. X */
  941. Xchar *                /* dst */
  942. Xstrncpy(dst, src, n)
  943. Xchar *dst;
  944. XCONST char *src;
  945. XSIZET n;
  946. X{
  947. X    register char *dscan;
  948. X    register CONST char *sscan;
  949. X    register SIZET count;
  950. X
  951. X    dscan = dst;
  952. X    sscan = src;
  953. X    count = n;
  954. X    while (--count >= 0 && (*dscan++ = *sscan++) != '\0')
  955. X        continue;
  956. X    while (--count >= 0)
  957. X        *dscan++ = '\0';
  958. X    return(dst);
  959. X}
  960. END_OF_FILE
  961. if test 387 -ne `wc -c <'libc/strings/strncpy.c'`; then
  962.     echo shar: \"'libc/strings/strncpy.c'\" unpacked with wrong size!
  963. fi
  964. # end of 'libc/strings/strncpy.c'
  965. fi
  966. if test -f 'libc/strings/strpbrk.c' -a "${1}" != "-c" ; then 
  967.   echo shar: Will not clobber existing file \"'libc/strings/strpbrk.c'\"
  968. else
  969. echo shar: Extracting \"'libc/strings/strpbrk.c'\" \(422 characters\)
  970. sed "s/^X//" >'libc/strings/strpbrk.c' <<'END_OF_FILE'
  971. X/*
  972. X * strpbrk - find first occurrence of any char from breakat in s
  973. X */
  974. X
  975. X#define    NULL    0
  976. X
  977. Xchar *                /* found char, or NULL if none */
  978. Xstrpbrk(s, breakat)
  979. XCONST char *s;
  980. XCONST char *breakat;
  981. X{
  982. X    register CONST char *sscan;
  983. X    register CONST char *bscan;
  984. X
  985. X    for (sscan = s; *sscan != '\0'; sscan++) {
  986. X        for (bscan = breakat; *bscan != '\0';)    /* ++ moved down. */
  987. X            if (*sscan == *bscan++)
  988. X                return(sscan);
  989. X    }
  990. X    return(NULL);
  991. X}
  992. END_OF_FILE
  993. if test 422 -ne `wc -c <'libc/strings/strpbrk.c'`; then
  994.     echo shar: \"'libc/strings/strpbrk.c'\" unpacked with wrong size!
  995. fi
  996. # end of 'libc/strings/strpbrk.c'
  997. fi
  998. if test -f 'libc/strings/strrchr.c' -a "${1}" != "-c" ; then 
  999.   echo shar: Will not clobber existing file \"'libc/strings/strrchr.c'\"
  1000. else
  1001. echo shar: Extracting \"'libc/strings/strrchr.c'\" \(410 characters\)
  1002. sed "s/^X//" >'libc/strings/strrchr.c' <<'END_OF_FILE'
  1003. X/*
  1004. X * strrchr - find last occurrence of a character in a string
  1005. X */
  1006. X
  1007. X#define    NULL    0
  1008. X
  1009. Xchar *                /* found char, or NULL if none */
  1010. Xstrrchr(s, charwanted)
  1011. XCONST char *s;
  1012. Xregister char charwanted;
  1013. X{
  1014. X    register CONST char *scan;
  1015. X    register CONST char *place;
  1016. X
  1017. X    place = NULL;
  1018. X    for (scan = s; *scan != '\0'; scan++)
  1019. X        if (*scan == charwanted)
  1020. X            place = scan;
  1021. X    if (charwanted == '\0')
  1022. X        return(scan);
  1023. X    return(place);
  1024. X}
  1025. END_OF_FILE
  1026. if test 410 -ne `wc -c <'libc/strings/strrchr.c'`; then
  1027.     echo shar: \"'libc/strings/strrchr.c'\" unpacked with wrong size!
  1028. fi
  1029. # end of 'libc/strings/strrchr.c'
  1030. fi
  1031. if test -f 'libc/strings/strspn.c' -a "${1}" != "-c" ; then 
  1032.   echo shar: Will not clobber existing file \"'libc/strings/strspn.c'\"
  1033. else
  1034. echo shar: Extracting \"'libc/strings/strspn.c'\" \(460 characters\)
  1035. sed "s/^X//" >'libc/strings/strspn.c' <<'END_OF_FILE'
  1036. X/*
  1037. X * strspn - find length of initial segment of s consisting entirely
  1038. X * of characters from accept
  1039. X */
  1040. X
  1041. XSIZET
  1042. Xstrspn(s, accept)
  1043. XCONST char *s;
  1044. XCONST char *accept;
  1045. X{
  1046. X    register CONST char *sscan;
  1047. X    register CONST char *ascan;
  1048. X    register SIZET count;
  1049. X
  1050. X    count = 0;
  1051. X    for (sscan = s; *sscan != '\0'; sscan++) {
  1052. X        for (ascan = accept; *ascan != '\0'; ascan++)
  1053. X            if (*sscan == *ascan)
  1054. X                break;
  1055. X        if (*ascan == '\0')
  1056. X            return(count);
  1057. X        count++;
  1058. X    }
  1059. X    return(count);
  1060. X}
  1061. END_OF_FILE
  1062. if test 460 -ne `wc -c <'libc/strings/strspn.c'`; then
  1063.     echo shar: \"'libc/strings/strspn.c'\" unpacked with wrong size!
  1064. fi
  1065. # end of 'libc/strings/strspn.c'
  1066. fi
  1067. if test -f 'libc/strings/strstr.c' -a "${1}" != "-c" ; then 
  1068.   echo shar: Will not clobber existing file \"'libc/strings/strstr.c'\"
  1069. else
  1070. echo shar: Extracting \"'libc/strings/strstr.c'\" \(635 characters\)
  1071. sed "s/^X//" >'libc/strings/strstr.c' <<'END_OF_FILE'
  1072. X/*
  1073. X * strstr - find first occurrence of wanted in s
  1074. X */
  1075. X
  1076. X#define    NULL    0
  1077. X
  1078. Xchar *                /* found string, or NULL if none */
  1079. Xstrstr(s, wanted)
  1080. XCONST char *s;
  1081. XCONST char *wanted;
  1082. X{
  1083. X    register CONST char *scan;
  1084. X    register SIZET len;
  1085. X    register char firstc;
  1086. X    extern int strcmp();
  1087. X    extern SIZET strlen();
  1088. X
  1089. X    /*
  1090. X     * The odd placement of the two tests is so "" is findable.
  1091. X     * Also, we inline the first char for speed.
  1092. X     * The ++ on scan has been moved down for optimization.
  1093. X     */
  1094. X    firstc = *wanted;
  1095. X    len = strlen(wanted);
  1096. X    for (scan = s; *scan != firstc || strncmp(scan, wanted, len) != 0; )
  1097. X        if (*scan++ == '\0')
  1098. X            return(NULL);
  1099. X    return(scan);
  1100. X}
  1101. END_OF_FILE
  1102. if test 635 -ne `wc -c <'libc/strings/strstr.c'`; then
  1103.     echo shar: \"'libc/strings/strstr.c'\" unpacked with wrong size!
  1104. fi
  1105. # end of 'libc/strings/strstr.c'
  1106. fi
  1107. if test -f 'libc/warning.c' -a "${1}" != "-c" ; then 
  1108.   echo shar: Will not clobber existing file \"'libc/warning.c'\"
  1109. else
  1110. echo shar: Extracting \"'libc/warning.c'\" \(591 characters\)
  1111. sed "s/^X//" >'libc/warning.c' <<'END_OF_FILE'
  1112. X/*
  1113. X * warning - print best error message possible and clear errno
  1114. X */
  1115. X
  1116. X#include <stdio.h>
  1117. X
  1118. Xwarning(s1, s2)
  1119. Xchar *s1;
  1120. Xchar *s2;
  1121. X{
  1122. X    char *cmdname;
  1123. X    extern int errno, sys_nerr;
  1124. X    extern char *sys_errlist[];
  1125. X    extern char *progname;
  1126. X    extern char *getenv();
  1127. X
  1128. X    cmdname = getenv("CMDNAME");
  1129. X    if (cmdname != NULL && *cmdname != '\0')
  1130. X        fprintf(stderr, "%s:", cmdname);    /* No space after :. */
  1131. X    if (progname != NULL)
  1132. X        fprintf(stderr, "%s: ", progname);
  1133. X    fprintf(stderr, s1, s2);
  1134. X    if (errno > 0 && errno < sys_nerr)
  1135. X        fprintf(stderr, " (%s)", sys_errlist[errno]);
  1136. X    fprintf(stderr, "\n");
  1137. X    errno = 0;
  1138. X}
  1139. END_OF_FILE
  1140. if test 591 -ne `wc -c <'libc/warning.c'`; then
  1141.     echo shar: \"'libc/warning.c'\" unpacked with wrong size!
  1142. fi
  1143. # end of 'libc/warning.c'
  1144. fi
  1145. if test -f 'libcnews/makefile' -a "${1}" != "-c" ; then 
  1146.   echo shar: Will not clobber existing file \"'libcnews/makefile'\"
  1147. else
  1148. echo shar: Extracting \"'libcnews/makefile'\" \(390 characters\)
  1149. sed "s/^X//" >'libcnews/makefile' <<'END_OF_FILE'
  1150. X# libcnews makefile
  1151. X
  1152. XCFLAGS= -O -I../include -p # -pg -Dvoid=int -DCHARBITS=0377
  1153. XLIB=libcnews.a
  1154. X
  1155. X$(LIB): readline.c lock.c ngmatch.c path.c strlower.c time.c
  1156. X    $(CC) $(CFLAGS) -c $?
  1157. X    ar rv $(LIB) *.o
  1158. X    rm *.o
  1159. X    ranlib $(LIB)
  1160. X
  1161. X# header dependencies for libcnews.a
  1162. Xlock.o: ../include/news.h
  1163. Xngmatch.o: ../include/news.h
  1164. Xpath.o: ../include/news.h ../include/newspaths.h
  1165. Xtime.o: ../include/news.h
  1166. END_OF_FILE
  1167. if test 390 -ne `wc -c <'libcnews/makefile'`; then
  1168.     echo shar: \"'libcnews/makefile'\" unpacked with wrong size!
  1169. fi
  1170. # end of 'libcnews/makefile'
  1171. fi
  1172. if test -f 'libcnews/time.c' -a "${1}" != "-c" ; then 
  1173.   echo shar: Will not clobber existing file \"'libcnews/time.c'\"
  1174. else
  1175. echo shar: Extracting \"'libcnews/time.c'\" \(651 characters\)
  1176. sed "s/^X//" >'libcnews/time.c' <<'END_OF_FILE'
  1177. X/*
  1178. X * time utilities
  1179. X */
  1180. X
  1181. X#include <stdio.h>
  1182. X#include <sys/types.h>
  1183. X#include "news.h"
  1184. X
  1185. X/*
  1186. X * Write a timestamp of the form "Jun 12 12:34:56" on fp.
  1187. X * N.B.: no trailing newline is written.
  1188. X */
  1189. Xtimestamp(fp, timep, ctmp)
  1190. XFILE *fp;
  1191. Xtime_t *timep;    /* if non-null, return time() here for later use */
  1192. Xchar **ctmp;    /* if non-null, return ctime(&now) here for later use (needed?) */
  1193. X{
  1194. X    char *prtime;
  1195. X    time_t now;
  1196. X    char *ctime();
  1197. X    time_t time();
  1198. X
  1199. X    now = time(&now);
  1200. X    if (timep != NULL)
  1201. X        *timep = now;
  1202. X    prtime = ctime(&now);
  1203. X    if (ctmp != NULL)
  1204. X        *ctmp = prtime;
  1205. X    /* .15 excludes yyyy\n\0; + 4 omits day-of-week */
  1206. X    (void) fprintf(fp, "%.15s", prtime + 4);
  1207. X}
  1208. END_OF_FILE
  1209. if test 651 -ne `wc -c <'libcnews/time.c'`; then
  1210.     echo shar: \"'libcnews/time.c'\" unpacked with wrong size!
  1211. fi
  1212. # end of 'libcnews/time.c'
  1213. fi
  1214. if test -f 'newsbin.proto/control/ihave' -a "${1}" != "-c" ; then 
  1215.   echo shar: Will not clobber existing file \"'newsbin.proto/control/ihave'\"
  1216. else
  1217. echo shar: Extracting \"'newsbin.proto/control/ihave'\" \(348 characters\)
  1218. sed "s/^X//" >'newsbin.proto/control/ihave' <<'END_OF_FILE'
  1219. X#! /bin/sh
  1220. X# ihave - stub for unimplemented I-have/send-me protocol
  1221. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  1222. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  1223. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  1224. XPATH=$NEWSCTL:$NEWSBIN:/bin:/usr/bin; export PATH
  1225. X
  1226. XSENDER="`newsreply`"
  1227. Xecho I-have/send-me not implemented | mail "$SENDER"
  1228. END_OF_FILE
  1229. if test 348 -ne `wc -c <'newsbin.proto/control/ihave'`; then
  1230.     echo shar: \"'newsbin.proto/control/ihave'\" unpacked with wrong size!
  1231. fi
  1232. # end of 'newsbin.proto/control/ihave'
  1233. fi
  1234. if test -f 'newsbin.proto/control/rmgroup.man' -a "${1}" != "-c" ; then 
  1235.   echo shar: Will not clobber existing file \"'newsbin.proto/control/rmgroup.man'\"
  1236. else
  1237. echo shar: Extracting \"'newsbin.proto/control/rmgroup.man'\" \(321 characters\)
  1238. sed "s/^X//" >'newsbin.proto/control/rmgroup.man' <<'END_OF_FILE'
  1239. X#! /bin/sh
  1240. X# rmgroup group - snuff group
  1241. XF=/tmp/nc$$
  1242. Xadmin=usenet
  1243. X
  1244. Xcat >$F
  1245. XSENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  1246. Xcase "$SENDER" in
  1247. X"")
  1248. X    SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//'`"
  1249. X    ;;
  1250. Xesac
  1251. X
  1252. X# tell the local usenet administrator to do it by hand
  1253. Xecho "rmgroup $1 says $SENDER" | mail $admin
  1254. X
  1255. Xrm -f $F*
  1256. END_OF_FILE
  1257. if test 321 -ne `wc -c <'newsbin.proto/control/rmgroup.man'`; then
  1258.     echo shar: \"'newsbin.proto/control/rmgroup.man'\" unpacked with wrong size!
  1259. fi
  1260. # end of 'newsbin.proto/control/rmgroup.man'
  1261. fi
  1262. if test -f 'newsbin.proto/control/sendme' -a "${1}" != "-c" ; then 
  1263.   echo shar: Will not clobber existing file \"'newsbin.proto/control/sendme'\"
  1264. else
  1265. echo shar: Extracting \"'newsbin.proto/control/sendme'\" \(348 characters\)
  1266. sed "s/^X//" >'newsbin.proto/control/sendme' <<'END_OF_FILE'
  1267. X#! /bin/sh
  1268. X# ihave - stub for unimplemented I-have/send-me protocol
  1269. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  1270. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  1271. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  1272. XPATH=$NEWSCTL:$NEWSBIN:/bin:/usr/bin; export PATH
  1273. X
  1274. XSENDER="`newsreply`"
  1275. Xecho I-have/send-me not implemented | mail "$SENDER"
  1276. END_OF_FILE
  1277. if test 348 -ne `wc -c <'newsbin.proto/control/sendme'`; then
  1278.     echo shar: \"'newsbin.proto/control/sendme'\" unpacked with wrong size!
  1279. fi
  1280. # end of 'newsbin.proto/control/sendme'
  1281. fi
  1282. if test -f 'newsbin.proto/control/sendsys' -a "${1}" != "-c" ; then 
  1283.   echo shar: Will not clobber existing file \"'newsbin.proto/control/sendsys'\"
  1284. else
  1285. echo shar: Extracting \"'newsbin.proto/control/sendsys'\" \(474 characters\)
  1286. sed "s/^X//" >'newsbin.proto/control/sendsys' <<'END_OF_FILE'
  1287. X#! /bin/sh
  1288. X# sendsys - mail sys file to sender identified in stdin's headers
  1289. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  1290. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  1291. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  1292. XPATH=$NEWSCTL:$NEWSBIN:/bin:/usr/bin; export PATH
  1293. XNEWSADMIN=usenet
  1294. X
  1295. XSENDER="`newsreply`"
  1296. X(echo "Subject: response to your sendsys"; echo ""; cat $NEWSCTL/sys) |
  1297. X    mail "$SENDER"
  1298. Xecho "news/sys file has been sent to $SENDER." | mail $NEWSADMIN
  1299. END_OF_FILE
  1300. if test 474 -ne `wc -c <'newsbin.proto/control/sendsys'`; then
  1301.     echo shar: \"'newsbin.proto/control/sendsys'\" unpacked with wrong size!
  1302. fi
  1303. # end of 'newsbin.proto/control/sendsys'
  1304. fi
  1305. if test -f 'newsbin.proto/control/senduuname' -a "${1}" != "-c" ; then 
  1306.   echo shar: Will not clobber existing file \"'newsbin.proto/control/senduuname'\"
  1307. else
  1308. echo shar: Extracting \"'newsbin.proto/control/senduuname'\" \(459 characters\)
  1309. sed "s/^X//" >'newsbin.proto/control/senduuname' <<'END_OF_FILE'
  1310. X#! /bin/sh
  1311. X# senduuname - mail `uuname` to sender identified in stdin's headers
  1312. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  1313. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  1314. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  1315. XPATH=$NEWSCTL:$NEWSBIN:/bin:/usr/bin; export PATH
  1316. XNEWSADMIN=usenet
  1317. X
  1318. XSENDER="`newsreply`"
  1319. X(echo "Subject: response to your senduuname"; echo ""; uuname) | mail "$SENDER"
  1320. Xecho "uuname output sent to $SENDER" | mail $NEWSADMIN
  1321. END_OF_FILE
  1322. if test 459 -ne `wc -c <'newsbin.proto/control/senduuname'`; then
  1323.     echo shar: \"'newsbin.proto/control/senduuname'\" unpacked with wrong size!
  1324. fi
  1325. # end of 'newsbin.proto/control/senduuname'
  1326. fi
  1327. if test -f 'newsbin.proto/control/version' -a "${1}" != "-c" ; then 
  1328.   echo shar: Will not clobber existing file \"'newsbin.proto/control/version'\"
  1329. else
  1330. echo shar: Extracting \"'newsbin.proto/control/version'\" \(356 characters\)
  1331. sed "s/^X//" >'newsbin.proto/control/version' <<'END_OF_FILE'
  1332. X#! /bin/sh
  1333. X# version - mail version id to sender identified in stdin's headers
  1334. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  1335. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  1336. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  1337. XPATH=$NEWSCTL:$NEWSBIN:/bin:/usr/bin; export PATH
  1338. X
  1339. XSENDER="`newsreply`"
  1340. Xecho "C, Official Alpha Release" | mail "$SENDER"
  1341. END_OF_FILE
  1342. if test 356 -ne `wc -c <'newsbin.proto/control/version'`; then
  1343.     echo shar: \"'newsbin.proto/control/version'\" unpacked with wrong size!
  1344. fi
  1345. # end of 'newsbin.proto/control/version'
  1346. fi
  1347. if test -f 'newsbin.proto/newsreply.from' -a "${1}" != "-c" ; then 
  1348.   echo shar: Will not clobber existing file \"'newsbin.proto/newsreply.from'\"
  1349. else
  1350. echo shar: Extracting \"'newsbin.proto/newsreply.from'\" \(344 characters\)
  1351. sed "s/^X//" >'newsbin.proto/newsreply.from' <<'END_OF_FILE'
  1352. X#! /bin/sh
  1353. X# newsreply - print return address from news article on stdin
  1354. X# This version assumes a domain mailer (user@host.domain works)
  1355. XF=/tmp/nc$$
  1356. X
  1357. Xcat >$F
  1358. X
  1359. XSENDER="`grep '^Reply-To:' $F | sed 's/^[^:]*://
  1360. Xs/ (.*)//
  1361. X1q' `"
  1362. Xcase "$SENDER" in
  1363. X"")
  1364. X    SENDER="`grep '^From:' $F | sed 's/^[^:]*://
  1365. Xs/ (.*)//
  1366. X1q' `"
  1367. X    ;;
  1368. Xesac
  1369. X
  1370. Xecho "$SENDER"
  1371. Xrm -f $F
  1372. END_OF_FILE
  1373. if test 344 -ne `wc -c <'newsbin.proto/newsreply.from'`; then
  1374.     echo shar: \"'newsbin.proto/newsreply.from'\" unpacked with wrong size!
  1375. fi
  1376. # end of 'newsbin.proto/newsreply.from'
  1377. fi
  1378. if test -f 'newsbin.proto/tear' -a "${1}" != "-c" ; then 
  1379.   echo shar: Will not clobber existing file \"'newsbin.proto/tear'\"
  1380. else
  1381. echo shar: Extracting \"'newsbin.proto/tear'\" \(416 characters\)
  1382. sed "s/^X//" >'newsbin.proto/tear' <<'END_OF_FILE'
  1383. X#! /bin/sh
  1384. X# tear prefix [file...] - tear RFC822 header and body apart (prefix: /tmp/in$$)
  1385. XPATH=/bin:/usr/bin; export PATH
  1386. X
  1387. Xhdr=${1-/tmp/in0}hdr
  1388. Xbody=${1-/tmp/in0}body
  1389. Xshift
  1390. X>>$hdr                    # create files just in case
  1391. X>>$body
  1392. Xexec awk '
  1393. XBEGIN { hdrpat="/^([ \t]|[^ \t]*:)/" }
  1394. Xinbody == 0 && $0 ~ /^([ \t]|[^ \t]*:)/ { print $0 >"'$hdr'" }
  1395. Xinbody != 0 || $0 !~ /^([ \t]|[^ \t]*:)/ { inbody = 1; print $0 >"'$body'" }
  1396. X' $*
  1397. END_OF_FILE
  1398. if test 416 -ne `wc -c <'newsbin.proto/tear'`; then
  1399.     echo shar: \"'newsbin.proto/tear'\" unpacked with wrong size!
  1400. fi
  1401. # end of 'newsbin.proto/tear'
  1402. fi
  1403. if test -f 'rna/at.h' -a "${1}" != "-c" ; then 
  1404.   echo shar: Will not clobber existing file \"'rna/at.h'\"
  1405. else
  1406. echo shar: Extracting \"'rna/at.h'\" \(557 characters\)
  1407. sed "s/^X//" >'rna/at.h' <<'END_OF_FILE'
  1408. X#define SECINWEEK    604800L
  1409. X#define SECINDAY     86400L
  1410. X#define SECINHOUR      3600L
  1411. X#define SECINMIN        60L
  1412. X#define    DAYSTO1983    (10*365 + 3*366)
  1413. X#define MAXTIME        0x7fffffffL
  1414. X
  1415. X/*
  1416. X * frequencies
  1417. X */
  1418. X#define HOURLY        1
  1419. X#define DAILY        2
  1420. X#define WEEKLY        3
  1421. X#define MONTHLY        4
  1422. X#define BOOT        5
  1423. X#define BATCHTIME    6    /* not really a frequency - just looks like one */
  1424. X
  1425. X/*
  1426. X * time types recognised
  1427. X */
  1428. X#define DAYS        0    /* days only */
  1429. X#define TIMES        1    /* days, times */
  1430. X#define FULL        2    /* days, times, frequencies */
  1431. X#define STIMES        3    /* days, times - be silent about errors */
  1432. END_OF_FILE
  1433. if test 557 -ne `wc -c <'rna/at.h'`; then
  1434.     echo shar: \"'rna/at.h'\" unpacked with wrong size!
  1435. fi
  1436. # end of 'rna/at.h'
  1437. fi
  1438. if test -f 'rna/lib/strpbrk.c' -a "${1}" != "-c" ; then 
  1439.   echo shar: Will not clobber existing file \"'rna/lib/strpbrk.c'\"
  1440. else
  1441. echo shar: Extracting \"'rna/lib/strpbrk.c'\" \(376 characters\)
  1442. sed "s/^X//" >'rna/lib/strpbrk.c' <<'END_OF_FILE'
  1443. X/*
  1444. X * Return ptr to first occurance of any character from `brkset'
  1445. X * in the character string `string'; NULL if none exists.
  1446. X */
  1447. X
  1448. X#define    NULL    (char *) 0
  1449. X
  1450. Xchar *
  1451. Xstrpbrk(string, brkset)
  1452. Xregister char *string, *brkset;
  1453. X{
  1454. X    register char *p;
  1455. X
  1456. X    do {
  1457. X        for(p=brkset; *p != '\0' && *p != *string; ++p)
  1458. X            ;
  1459. X        if(*p != '\0')
  1460. X            return(string);
  1461. X    }
  1462. X    while(*string++);
  1463. X    return(NULL);
  1464. X}
  1465. END_OF_FILE
  1466. if test 376 -ne `wc -c <'rna/lib/strpbrk.c'`; then
  1467.     echo shar: \"'rna/lib/strpbrk.c'\" unpacked with wrong size!
  1468. fi
  1469. # end of 'rna/lib/strpbrk.c'
  1470. fi
  1471. if test -f 'rna/man/uusend.8' -a "${1}" != "-c" ; then 
  1472.   echo shar: Will not clobber existing file \"'rna/man/uusend.8'\"
  1473. else
  1474. echo shar: Extracting \"'rna/man/uusend.8'\" \(432 characters\)
  1475. sed "s/^X//" >'rna/man/uusend.8' <<'END_OF_FILE'
  1476. X.TH UUSEND 8
  1477. X.SH NAME
  1478. Xuusend \- send news articles via mail
  1479. X.SH SYNOPSIS
  1480. X.B /usr/lib/news/uusend
  1481. Xdestination
  1482. X.SH DESCRIPTION
  1483. X.I uusend
  1484. Xreads an article from standard input,
  1485. Xprepends an `N' to each line of the article,
  1486. Xand then mails the article to
  1487. X.IR destination .
  1488. X.P
  1489. X.IR uurec (8)
  1490. Xis used at the destination host to unpackage the article
  1491. Xand pass it to
  1492. X.IR postnews (1).
  1493. X.SH SEE ALSO
  1494. Xpostnews(1), readnews(1),
  1495. Xuurec(8), smail(8).
  1496. END_OF_FILE
  1497. if test 432 -ne `wc -c <'rna/man/uusend.8'`; then
  1498.     echo shar: \"'rna/man/uusend.8'\" unpacked with wrong size!
  1499. fi
  1500. # end of 'rna/man/uusend.8'
  1501. fi
  1502. if test -f 'rna/notes/Cover.pd' -a "${1}" != "-c" ; then 
  1503.   echo shar: Will not clobber existing file \"'rna/notes/Cover.pd'\"
  1504. else
  1505. echo shar: Extracting \"'rna/notes/Cover.pd'\" \(643 characters\)
  1506. sed "s/^X//" >'rna/notes/Cover.pd' <<'END_OF_FILE'
  1507. XFrom decvax!mulga!michaelr:elecvax Mon Jul 16 04:25:19 1984
  1508. XFrom: decvax!mulga!michaelr:elecvax
  1509. XReceived: by decvax.UUCP (4.12/1.0)
  1510. X    id AA25742; Mon, 16 Jul 84 03:56:35 edt
  1511. XReceived: by mulga.OZ (4.3)
  1512. X    id AA06943; Mon, 16 Jul 84 14:19:46 EST
  1513. XTo: decvax!utcsstat!geoff:mulga
  1514. XSubject: Re: your news re-write
  1515. X
  1516. XYes, my news re-write is in the public domain.
  1517. XI couldn't sell it if I wanted to, since it was developed under an
  1518. Xeducational license.
  1519. X
  1520. XPlease distribute it freely as you wish.
  1521. X
  1522. XMichael Rourke
  1523. XUniversity of New South Wales, Kensington, N.S.W. 2033 AUSTRALIA
  1524. XPhone:    +61 2 662 2781    Netaddr: {decvax,vax135,sfjec}!mulga!michaelr:elecvax
  1525. X
  1526. X
  1527. END_OF_FILE
  1528. if test 643 -ne `wc -c <'rna/notes/Cover.pd'`; then
  1529.     echo shar: \"'rna/notes/Cover.pd'\" unpacked with wrong size!
  1530. fi
  1531. # end of 'rna/notes/Cover.pd'
  1532. fi
  1533. if test -f 'rna/uusend.c' -a "${1}" != "-c" ; then 
  1534.   echo shar: Will not clobber existing file \"'rna/uusend.c'\"
  1535. else
  1536. echo shar: Extracting \"'rna/uusend.c'\" \(749 characters\)
  1537. sed "s/^X//" >'rna/uusend.c' <<'END_OF_FILE'
  1538. X/*
  1539. X * send article on standard input to remote host via mail
  1540. X */
  1541. X
  1542. X#include "defs.h"
  1543. X
  1544. Xchar mail[]         = FASTMAIL;
  1545. X
  1546. Xmain(argc, argv)
  1547. Xint argc;
  1548. Xchar *argv[];
  1549. X{
  1550. X    register int c, lastc;
  1551. X    register FILE    *out;
  1552. X
  1553. X    if (argc != 2) {
  1554. X        fprintf(stderr, "Usage: uusend address\n");
  1555. X        exit(1);
  1556. X    }
  1557. X    if ((out = tmpfile()) == NULL) {
  1558. X        fprintf(stderr, "uusend: can't create tempfile\n");
  1559. X        exit(1);
  1560. X    }
  1561. X
  1562. X    fprintf(out, "Subject: network news article\n");
  1563. X    fprintf(out, "\n");
  1564. X
  1565. X    lastc = '\n';
  1566. X    while ((c = getc(stdin)) != EOF) {
  1567. X        if (lastc == '\n')
  1568. X            putc('N', out);
  1569. X        putc(lastc = c, out);
  1570. X    }
  1571. X
  1572. X    rewind(out);
  1573. X    fclose(stdin);
  1574. X    dup(fileno(out));
  1575. X    close(fileno(out));
  1576. X
  1577. X    execl(mail, strrchr(mail, '/') + 1, argv[1], 0);
  1578. X    fprintf(stderr, "uusend: can't exec %s\n", mail);
  1579. X}
  1580. X
  1581. X
  1582. END_OF_FILE
  1583. if test 749 -ne `wc -c <'rna/uusend.c'`; then
  1584.     echo shar: \"'rna/uusend.c'\" unpacked with wrong size!
  1585. fi
  1586. # end of 'rna/uusend.c'
  1587. fi
  1588. if test -f 'rnews/TODO' -a "${1}" != "-c" ; then 
  1589.   echo shar: Will not clobber existing file \"'rnews/TODO'\"
  1590. else
  1591. echo shar: Extracting \"'rnews/TODO'\" \(576 characters\)
  1592. sed "s/^X//" >'rnews/TODO' <<'END_OF_FILE'
  1593. Xprevent cross-posting across universes: on receipt,
  1594. X    use first universe in $NEWSCTL/universes only
  1595. Xmodify Path: on reading instead of on writing (in headers.c)?
  1596. Xavoid array overruns: use malloc for string storage
  1597. X
  1598. Xremove embarrassing comments
  1599. Xmore packaging effort a la Horton
  1600. X
  1601. Xtest long headers: >512 bytes, >1024 bytes
  1602. Xtest and read all code (including sh scripts) before release
  1603. X
  1604. XD news idea:
  1605. X    read batch into memory (assumes VM); compose whole article in memory,
  1606. X    write it all at once, using the right name for the first group.
  1607. X    insist on reading from disk? probably not.
  1608. END_OF_FILE
  1609. if test 576 -ne `wc -c <'rnews/TODO'`; then
  1610.     echo shar: \"'rnews/TODO'\" unpacked with wrong size!
  1611. fi
  1612. # end of 'rnews/TODO'
  1613. fi
  1614. if test -f 'rnews/checkdir.c' -a "${1}" != "-c" ; then 
  1615.   echo shar: Will not clobber existing file \"'rnews/checkdir.c'\"
  1616. else
  1617. echo shar: Extracting \"'rnews/checkdir.c'\" \(562 characters\)
  1618. sed "s/^X//" >'rnews/checkdir.c' <<'END_OF_FILE'
  1619. X/*
  1620. X * checkdir - make the directories implied by `name'
  1621. X */
  1622. X
  1623. X#include <stdio.h>
  1624. X#include <sys/types.h>
  1625. X#include "news.h"
  1626. X
  1627. Xint
  1628. Xcheckdir(name, uid, gid)
  1629. Xregister char *name;
  1630. X{
  1631. X    register char *cp;
  1632. X
  1633. X    for (cp = name; *cp != '\0'; cp++)
  1634. X        if (*cp == '/') {
  1635. X            *cp = '\0';
  1636. X            if (access(name, 01) < 0) {    /* can't search */
  1637. X                char *cbuf = emalloc((unsigned)STRLEN("mkdir ") +
  1638. X                    strlen(name) + 1);
  1639. X
  1640. X                (void) sprintf(cbuf, "mkdir %s", name);
  1641. X                (void) system(cbuf);
  1642. X                free(cbuf);
  1643. X                (void) chown(name, uid, gid);
  1644. X            }
  1645. X            *cp = '/';
  1646. X        }
  1647. X    return cp[-1] == '/';
  1648. X}
  1649. END_OF_FILE
  1650. if test 562 -ne `wc -c <'rnews/checkdir.c'`; then
  1651.     echo shar: \"'rnews/checkdir.c'\" unpacked with wrong size!
  1652. fi
  1653. # end of 'rnews/checkdir.c'
  1654. fi
  1655. if test -f 'rnews/io.c' -a "${1}" != "-c" ; then 
  1656.   echo shar: Will not clobber existing file \"'rnews/io.c'\"
  1657. else
  1658. echo shar: Extracting \"'rnews/io.c'\" \(491 characters\)
  1659. sed "s/^X//" >'rnews/io.c' <<'END_OF_FILE'
  1660. X/*
  1661. X * common i/o operations
  1662. X */
  1663. X
  1664. X#include <stdio.h>
  1665. X#include <sys/types.h>
  1666. X#include "news.h"
  1667. X
  1668. XFILE *
  1669. Xfopenwclex(name, mode)    /* open name; close-on-exec if OK, else warning */
  1670. Xchar *name, *mode;
  1671. X{
  1672. X    register FILE *fp;
  1673. X
  1674. X    if ((fp = fopenclex(name, mode)) == NULL)
  1675. X        warning("can't open %s", name);
  1676. X    return fp;
  1677. X}
  1678. X
  1679. XFILE *
  1680. Xfopenclex(file, mode)        /* open file and if OK, close-on-exec */
  1681. Xchar *file, *mode;
  1682. X{
  1683. X    register FILE *fp;
  1684. X
  1685. X    if ((fp = fopen(file, mode)) != NULL)
  1686. X        fclsexec(fp);
  1687. X    return fp;
  1688. X}
  1689. END_OF_FILE
  1690. if test 491 -ne `wc -c <'rnews/io.c'`; then
  1691.     echo shar: \"'rnews/io.c'\" unpacked with wrong size!
  1692. fi
  1693. # end of 'rnews/io.c'
  1694. fi
  1695. if test -f 'rnews/sh/tear' -a "${1}" != "-c" ; then 
  1696.   echo shar: Will not clobber existing file \"'rnews/sh/tear'\"
  1697. else
  1698. echo shar: Extracting \"'rnews/sh/tear'\" \(416 characters\)
  1699. sed "s/^X//" >'rnews/sh/tear' <<'END_OF_FILE'
  1700. X#! /bin/sh
  1701. X# tear prefix [file...] - tear RFC822 header and body apart (prefix: /tmp/in$$)
  1702. XPATH=/bin:/usr/bin; export PATH
  1703. X
  1704. Xhdr=${1-/tmp/in0}hdr
  1705. Xbody=${1-/tmp/in0}body
  1706. Xshift
  1707. X>>$hdr                    # create files just in case
  1708. X>>$body
  1709. Xexec awk '
  1710. XBEGIN { hdrpat="/^([ \t]|[^ \t]*:)/" }
  1711. Xinbody == 0 && $0 ~ /^([ \t]|[^ \t]*:)/ { print $0 >"'$hdr'" }
  1712. Xinbody != 0 || $0 !~ /^([ \t]|[^ \t]*:)/ { inbody = 1; print $0 >"'$body'" }
  1713. X' $*
  1714. END_OF_FILE
  1715. if test 416 -ne `wc -c <'rnews/sh/tear'`; then
  1716.     echo shar: \"'rnews/sh/tear'\" unpacked with wrong size!
  1717. fi
  1718. # end of 'rnews/sh/tear'
  1719. fi
  1720. if test -f 'rnews/tear' -a "${1}" != "-c" ; then 
  1721.   echo shar: Will not clobber existing file \"'rnews/tear'\"
  1722. else
  1723. echo shar: Extracting \"'rnews/tear'\" \(416 characters\)
  1724. sed "s/^X//" >'rnews/tear' <<'END_OF_FILE'
  1725. X#! /bin/sh
  1726. X# tear prefix [file...] - tear RFC822 header and body apart (prefix: /tmp/in$$)
  1727. XPATH=/bin:/usr/bin; export PATH
  1728. X
  1729. Xhdr=${1-/tmp/in0}hdr
  1730. Xbody=${1-/tmp/in0}body
  1731. Xshift
  1732. X>>$hdr                    # create files just in case
  1733. X>>$body
  1734. Xexec awk '
  1735. XBEGIN { hdrpat="/^([ \t]|[^ \t]*:)/" }
  1736. Xinbody == 0 && $0 ~ /^([ \t]|[^ \t]*:)/ { print $0 >"'$hdr'" }
  1737. Xinbody != 0 || $0 !~ /^([ \t]|[^ \t]*:)/ { inbody = 1; print $0 >"'$body'" }
  1738. X' $*
  1739. END_OF_FILE
  1740. if test 416 -ne `wc -c <'rnews/tear'`; then
  1741.     echo shar: \"'rnews/tear'\" unpacked with wrong size!
  1742. fi
  1743. # end of 'rnews/tear'
  1744. fi
  1745. if test -f 'rnews/test/demo/arts/art1' -a "${1}" != "-c" ; then 
  1746.   echo shar: Will not clobber existing file \"'rnews/test/demo/arts/art1'\"
  1747. else
  1748. echo shar: Extracting \"'rnews/test/demo/arts/art1'\" \(633 characters\)
  1749. sed "s/^X//" >'rnews/test/demo/arts/art1' <<'END_OF_FILE'
  1750. XNewsgroups: net.slug,net.wretched,net.general
  1751. XPath: rabbit!alice!npoiv!npois!hou5f!hou5b!hou5c!hou5e!hou5a!hou5d!hogpc!houxe!lime!we13!otuxa!ll1!sb1!burl!mhuxv!mhuxi!mhuxj!mhuxt!eagle!harpo!decvax!decwrl!amd70!rocksvax!bimmler
  1752. XFrom: bimmler@rocksvax.UuCp
  1753. XSubject: Re: Re: RE: re: rE: Orphaned Response
  1754. XMessage-ID: <123@drugs.ca>
  1755. XDate-Received: the epoch
  1756. XRelay-Version: version A; site rti.uucp
  1757. XPosting-Version: version A+; site trt.uucp
  1758. X
  1759. X> *NONE*:*:0:root
  1760. X> daemon:*:1:daemon,uucp
  1761. X> sys:*:2:bin,sys
  1762. X> bin70:*:3:
  1763. X> uucp70:*:4:
  1764. X> general:*:5:adams,al
  1765. X
  1766. XI agree!
  1767. X-- 
  1768. XSluggola Slimebreath, Cretins Unlimited.
  1769. X<insert silly graphics here>
  1770. END_OF_FILE
  1771. if test 633 -ne `wc -c <'rnews/test/demo/arts/art1'`; then
  1772.     echo shar: \"'rnews/test/demo/arts/art1'\" unpacked with wrong size!
  1773. fi
  1774. # end of 'rnews/test/demo/arts/art1'
  1775. fi
  1776. if test -f 'rnews/test/demo/arts/art4' -a "${1}" != "-c" ; then 
  1777.   echo shar: Will not clobber existing file \"'rnews/test/demo/arts/art4'\"
  1778. else
  1779. echo shar: Extracting \"'rnews/test/demo/arts/art4'\" \(554 characters\)
  1780. sed "s/^X//" >'rnews/test/demo/arts/art4' <<'END_OF_FILE'
  1781. XNewsgroups: alt.bozos,bozos.unix
  1782. XPath: uw-muskrat!ucbvax!decvax!decwrl!ucbvax!anode!cathode!bozos
  1783. XDate: Tue May  3 21:35:59
  1784. XMessage-Id: <8305040716.AA21555@LBL-CLAMS.BARFA>
  1785. XVia: BRL-UNIX
  1786. XVia: Twi-UNIX@Somehost
  1787. XVia: Twenex-20@Elsewhere
  1788. XVia: Godknows@Where
  1789. XFrom: The UNIX Bozos
  1790. XRealaid-by: Twit.UUCP
  1791. XNonconformant-to: Any RFC's you've ever read.
  1792. XLost-by: MIT-BOZOS
  1793. XFound-by: MIT-OZ
  1794. XMessage-Id: <8305040716.AA21549@MIT-OZ.BARFA>
  1795. XRemailed-to: UW-MUSKRAT@LBL-CLAMS.BARFA
  1796. XEventually-for: your eyes only.
  1797. XSubject: And now for something completely different...
  1798. X
  1799. END_OF_FILE
  1800. if test 554 -ne `wc -c <'rnews/test/demo/arts/art4'`; then
  1801.     echo shar: \"'rnews/test/demo/arts/art4'\" unpacked with wrong size!
  1802. fi
  1803. # end of 'rnews/test/demo/arts/art4'
  1804. fi
  1805. if test -f 'rnews/test/demo/arts/art5' -a "${1}" != "-c" ; then 
  1806.   echo shar: Will not clobber existing file \"'rnews/test/demo/arts/art5'\"
  1807. else
  1808. echo shar: Extracting \"'rnews/test/demo/arts/art5'\" \(463 characters\)
  1809. sed "s/^X//" >'rnews/test/demo/arts/art5' <<'END_OF_FILE'
  1810. XPath: ucbvax!decvax!decwrl!anode!bnode!cnode!slime
  1811. XDate: Wed May  4 12:13:14
  1812. XMessage-Id: <8301829293.AA839282@CNODE.UUCP>
  1813. XVia: CNODE.UUCP
  1814. XVia: BNODE.UUCP
  1815. XVia: Anode.Electron
  1816. XVia: DecWhirl
  1817. XVia: DecHax
  1818. XNewsgroups: newt.toad
  1819. XSubject: Re: And now for something completely different...
  1820. X
  1821. XThe greatest thing since Monty Boa! I loved it. Thank you.
  1822. XWhen can we expect the next installment???
  1823. X
  1824. XNot afraid to sign my real name,
  1825. XThanks (as they say) in advance,
  1826. X
  1827. XHandy Solo
  1828. END_OF_FILE
  1829. if test 463 -ne `wc -c <'rnews/test/demo/arts/art5'`; then
  1830.     echo shar: \"'rnews/test/demo/arts/art5'\" unpacked with wrong size!
  1831. fi
  1832. # end of 'rnews/test/demo/arts/art5'
  1833. fi
  1834. if test -f 'rnews/test/demo/arts/art6' -a "${1}" != "-c" ; then 
  1835.   echo shar: Will not clobber existing file \"'rnews/test/demo/arts/art6'\"
  1836. else
  1837. echo shar: Extracting \"'rnews/test/demo/arts/art6'\" \(471 characters\)
  1838. sed "s/^X//" >'rnews/test/demo/arts/art6' <<'END_OF_FILE'
  1839. XPath: ucbvax!decvax!decwrl!anode!bnode!cnode!demon
  1840. XDate: Wed May  4 12:13:14
  1841. XMessage-Id: <8301829294.AA839282@CNODE.UUCP>
  1842. XVia: CNODE.UUCP
  1843. XVia: BNODE.UUCP
  1844. XVia: Anode.Photon
  1845. XVia: DecWhirl
  1846. XVia: DecHax
  1847. XApparantly-for: /dev/null
  1848. XNewsgroups: newt.toad
  1849. XSubject: Re: And now for something completely different...
  1850. X
  1851. XIt stank. What a waste of my damn long-distance UUCP phone bill.
  1852. XThis sort of dreck belongs in the bit bucket, not on a public
  1853. Xnetwork like plaNET.
  1854. X
  1855. XThe Mad Flamer.
  1856. END_OF_FILE
  1857. if test 471 -ne `wc -c <'rnews/test/demo/arts/art6'`; then
  1858.     echo shar: \"'rnews/test/demo/arts/art6'\" unpacked with wrong size!
  1859. fi
  1860. # end of 'rnews/test/demo/arts/art6'
  1861. fi
  1862. if test -f 'rnews/test/lib/nukehist' -a "${1}" != "-c" ; then 
  1863.   echo shar: Will not clobber existing file \"'rnews/test/lib/nukehist'\"
  1864. else
  1865. echo shar: Extracting \"'rnews/test/lib/nukehist'\" \(427 characters\)
  1866. sed "s/^X//" >'rnews/test/lib/nukehist' <<'END_OF_FILE'
  1867. X#! /bin/sh
  1868. X# nukehist - zero history files, unlock, snuff mon.out's, zero logs
  1869. X>history
  1870. X>history.pag
  1871. X>history.dir
  1872. X>log
  1873. X>errlog
  1874. Xrm -f LOCK mon.out
  1875. Xcd ../spool
  1876. Xrm -f .tmp* core mon.out gmon.out
  1877. Xcd net            # clean out old articles
  1878. Xrm -rf unix-wizards; mkdir unix-wizards    # special case for speed
  1879. Xrm -rf unix; mkdir unix    # special case for speed
  1880. Xrm -rf lan; mkdir lan    # special case for speed
  1881. Xrm -f */* */*/*        # remove previous runs
  1882. END_OF_FILE
  1883. if test 427 -ne `wc -c <'rnews/test/lib/nukehist'`; then
  1884.     echo shar: \"'rnews/test/lib/nukehist'\" unpacked with wrong size!
  1885. fi
  1886. # end of 'rnews/test/lib/nukehist'
  1887. fi
  1888. if test -f 'rnews/vers/usg/gethostname.c' -a "${1}" != "-c" ; then 
  1889.   echo shar: Will not clobber existing file \"'rnews/vers/usg/gethostname.c'\"
  1890. else
  1891. echo shar: Extracting \"'rnews/vers/usg/gethostname.c'\" \(340 characters\)
  1892. sed "s/^X//" >'rnews/vers/usg/gethostname.c' <<'END_OF_FILE'
  1893. X/*
  1894. X * Uglix gethostname simulation
  1895. X */
  1896. X
  1897. X#include <sys/types.h>
  1898. X#include <sys/utsname.h>
  1899. X
  1900. X#define min(a, b) ((a) < (b)? (a): (b))
  1901. X
  1902. Xint
  1903. Xgethostname(buf, size)
  1904. Xchar *buf;
  1905. Xint size;
  1906. X{
  1907. X    struct utsname ugnm;
  1908. X    char *strncpy();
  1909. X
  1910. X    if (uname(&ugnm) < 0)
  1911. X        return -1;
  1912. X    (void) strncpy(buf, ugnm.nodename, min(sizeof ugnm.nodename, size));
  1913. X    return 0;
  1914. X}
  1915. END_OF_FILE
  1916. if test 340 -ne `wc -c <'rnews/vers/usg/gethostname.c'`; then
  1917.     echo shar: \"'rnews/vers/usg/gethostname.c'\" unpacked with wrong size!
  1918. fi
  1919. # end of 'rnews/vers/usg/gethostname.c'
  1920. fi
  1921. if test -f 'rnews/vers/usg/getwd.c' -a "${1}" != "-c" ; then 
  1922.   echo shar: Will not clobber existing file \"'rnews/vers/usg/getwd.c'\"
  1923. else
  1924. echo shar: Extracting \"'rnews/vers/usg/getwd.c'\" \(436 characters\)
  1925. sed "s/^X//" >'rnews/vers/usg/getwd.c' <<'END_OF_FILE'
  1926. X/*
  1927. X * 4.2bsd getwd simulation
  1928. X */
  1929. X
  1930. X#include <stdio.h>
  1931. X
  1932. X#define MAXWD 1024        /* limited by 4.2 getwd(2) */
  1933. X
  1934. Xchar *
  1935. Xgetwd(path)
  1936. Xchar *path;
  1937. X{
  1938. X    char *nlp;
  1939. X    FILE *fp;
  1940. X    FILE *popen();
  1941. X    char *rindex();
  1942. X
  1943. X    fp = popen("PATH=/bin:/usr/bin pwd", "r");
  1944. X    if (fp == NULL)
  1945. X        return 0;
  1946. X    if (fgets(path, MAXWD, fp) == NULL) {
  1947. X        (void) pclose(fp);
  1948. X        return 0;
  1949. X    }
  1950. X    if ((nlp = rindex(path, '\n')) != NULL)
  1951. X        *nlp = '\0';
  1952. X    (void) pclose(fp);
  1953. X    return path;
  1954. X}
  1955. END_OF_FILE
  1956. if test 436 -ne `wc -c <'rnews/vers/usg/getwd.c'`; then
  1957.     echo shar: \"'rnews/vers/usg/getwd.c'\" unpacked with wrong size!
  1958. fi
  1959. # end of 'rnews/vers/usg/getwd.c'
  1960. fi
  1961. if test -f 'rnews/vers/usg/mkdir.c' -a "${1}" != "-c" ; then 
  1962.   echo shar: Will not clobber existing file \"'rnews/vers/usg/mkdir.c'\"
  1963. else
  1964. echo shar: Extracting \"'rnews/vers/usg/mkdir.c'\" \(368 characters\)
  1965. sed "s/^X//" >'rnews/vers/usg/mkdir.c' <<'END_OF_FILE'
  1966. X/*
  1967. X * 4.2BSD mkdir simulation
  1968. X */
  1969. X
  1970. X#include <stdio.h>
  1971. X
  1972. Xint
  1973. Xmkdir(dir, mode)
  1974. Xchar *dir;
  1975. Xint mode;
  1976. X{
  1977. X    int ret;
  1978. X    char cbuf[BUFSIZ];
  1979. X    char *sprintf();
  1980. X
  1981. X    (void) sprintf(cbuf, "mkdir %s", dir);
  1982. X    ret = system(cbuf);
  1983. X    if (mode != 0777) {    /* needs special attention */
  1984. X        int oldmask = umask(0);
  1985. X
  1986. X        (void) umask(oldmask);
  1987. X        (void) chmod(dir, mode & ~oldmask);
  1988. X    }
  1989. X    return ret;
  1990. X}
  1991. END_OF_FILE
  1992. if test 368 -ne `wc -c <'rnews/vers/usg/mkdir.c'`; then
  1993.     echo shar: \"'rnews/vers/usg/mkdir.c'\" unpacked with wrong size!
  1994. fi
  1995. # end of 'rnews/vers/usg/mkdir.c'
  1996. fi
  1997. if test -f 'rnews/vers/v7/getwd.c' -a "${1}" != "-c" ; then 
  1998.   echo shar: Will not clobber existing file \"'rnews/vers/v7/getwd.c'\"
  1999. else
  2000. echo shar: Extracting \"'rnews/vers/v7/getwd.c'\" \(436 characters\)
  2001. sed "s/^X//" >'rnews/vers/v7/getwd.c' <<'END_OF_FILE'
  2002. X/*
  2003. X * 4.2bsd getwd simulation
  2004. X */
  2005. X
  2006. X#include <stdio.h>
  2007. X
  2008. X#define MAXWD 1024        /* limited by 4.2 getwd(2) */
  2009. X
  2010. Xchar *
  2011. Xgetwd(path)
  2012. Xchar *path;
  2013. X{
  2014. X    char *nlp;
  2015. X    FILE *fp;
  2016. X    FILE *popen();
  2017. X    char *rindex();
  2018. X
  2019. X    fp = popen("PATH=/bin:/usr/bin pwd", "r");
  2020. X    if (fp == NULL)
  2021. X        return 0;
  2022. X    if (fgets(path, MAXWD, fp) == NULL) {
  2023. X        (void) pclose(fp);
  2024. X        return 0;
  2025. X    }
  2026. X    if ((nlp = rindex(path, '\n')) != NULL)
  2027. X        *nlp = '\0';
  2028. X    (void) pclose(fp);
  2029. X    return path;
  2030. X}
  2031. END_OF_FILE
  2032. if test 436 -ne `wc -c <'rnews/vers/v7/getwd.c'`; then
  2033.     echo shar: \"'rnews/vers/v7/getwd.c'\" unpacked with wrong size!
  2034. fi
  2035. # end of 'rnews/vers/v7/getwd.c'
  2036. fi
  2037. if test -f 'rnews/vers/v7/mkdir.c' -a "${1}" != "-c" ; then 
  2038.   echo shar: Will not clobber existing file \"'rnews/vers/v7/mkdir.c'\"
  2039. else
  2040. echo shar: Extracting \"'rnews/vers/v7/mkdir.c'\" \(368 characters\)
  2041. sed "s/^X//" >'rnews/vers/v7/mkdir.c' <<'END_OF_FILE'
  2042. X/*
  2043. X * 4.2BSD mkdir simulation
  2044. X */
  2045. X
  2046. X#include <stdio.h>
  2047. X
  2048. Xint
  2049. Xmkdir(dir, mode)
  2050. Xchar *dir;
  2051. Xint mode;
  2052. X{
  2053. X    int ret;
  2054. X    char cbuf[BUFSIZ];
  2055. X    char *sprintf();
  2056. X
  2057. X    (void) sprintf(cbuf, "mkdir %s", dir);
  2058. X    ret = system(cbuf);
  2059. X    if (mode != 0777) {    /* needs special attention */
  2060. X        int oldmask = umask(0);
  2061. X
  2062. X        (void) umask(oldmask);
  2063. X        (void) chmod(dir, mode & ~oldmask);
  2064. X    }
  2065. X    return ret;
  2066. X}
  2067. END_OF_FILE
  2068. if test 368 -ne `wc -c <'rnews/vers/v7/mkdir.c'`; then
  2069.     echo shar: \"'rnews/vers/v7/mkdir.c'\" unpacked with wrong size!
  2070. fi
  2071. # end of 'rnews/vers/v7/mkdir.c'
  2072. fi
  2073. if test -f 'rnews/vers/v8/gethostname.c' -a "${1}" != "-c" ; then 
  2074.   echo shar: Will not clobber existing file \"'rnews/vers/v8/gethostname.c'\"
  2075. else
  2076. echo shar: Extracting \"'rnews/vers/v8/gethostname.c'\" \(340 characters\)
  2077. sed "s/^X//" >'rnews/vers/v8/gethostname.c' <<'END_OF_FILE'
  2078. X/*
  2079. X * Uglix gethostname simulation
  2080. X */
  2081. X
  2082. X#include <sys/types.h>
  2083. X#include <sys/utsname.h>
  2084. X
  2085. X#define min(a, b) ((a) < (b)? (a): (b))
  2086. X
  2087. Xint
  2088. Xgethostname(buf, size)
  2089. Xchar *buf;
  2090. Xint size;
  2091. X{
  2092. X    struct utsname ugnm;
  2093. X    char *strncpy();
  2094. X
  2095. X    if (uname(&ugnm) < 0)
  2096. X        return -1;
  2097. X    (void) strncpy(buf, ugnm.nodename, min(sizeof ugnm.nodename, size));
  2098. X    return 0;
  2099. X}
  2100. END_OF_FILE
  2101. if test 340 -ne `wc -c <'rnews/vers/v8/gethostname.c'`; then
  2102.     echo shar: \"'rnews/vers/v8/gethostname.c'\" unpacked with wrong size!
  2103. fi
  2104. # end of 'rnews/vers/v8/gethostname.c'
  2105. fi
  2106. if test -f 'rnews/vers/v8/mkdir.c' -a "${1}" != "-c" ; then 
  2107.   echo shar: Will not clobber existing file \"'rnews/vers/v8/mkdir.c'\"
  2108. else
  2109. echo shar: Extracting \"'rnews/vers/v8/mkdir.c'\" \(368 characters\)
  2110. sed "s/^X//" >'rnews/vers/v8/mkdir.c' <<'END_OF_FILE'
  2111. X/*
  2112. X * 4.2BSD mkdir simulation
  2113. X */
  2114. X
  2115. X#include <stdio.h>
  2116. X
  2117. Xint
  2118. Xmkdir(dir, mode)
  2119. Xchar *dir;
  2120. Xint mode;
  2121. X{
  2122. X    int ret;
  2123. X    char cbuf[BUFSIZ];
  2124. X    char *sprintf();
  2125. X
  2126. X    (void) sprintf(cbuf, "mkdir %s", dir);
  2127. X    ret = system(cbuf);
  2128. X    if (mode != 0777) {    /* needs special attention */
  2129. X        int oldmask = umask(0);
  2130. X
  2131. X        (void) umask(oldmask);
  2132. X        (void) chmod(dir, mode & ~oldmask);
  2133. X    }
  2134. X    return ret;
  2135. X}
  2136. END_OF_FILE
  2137. if test 368 -ne `wc -c <'rnews/vers/v8/mkdir.c'`; then
  2138.     echo shar: \"'rnews/vers/v8/mkdir.c'\" unpacked with wrong size!
  2139. fi
  2140. # end of 'rnews/vers/v8/mkdir.c'
  2141. fi
  2142. echo shar: End of archive 2 \(of 14\).
  2143. ##  End of shell archive.
  2144. exit 0
  2145.