home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume19 / nn / part15 < prev    next >
Text File  |  1989-06-22  |  37KB  |  1,680 lines

  1. Subject:  v19i076:  NN, a Usenet news reader, Part15/15
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: storm@texas.dk (Kim F. Storm)
  7. Posting-number: Volume 19, Issue 76
  8. Archive-name: nn/part15
  9.  
  10. #!/bin/sh
  11. # this is part 15 of a multipart archive
  12. # do not concatenate these parts, unpack them in order with /bin/sh
  13. # file term.c continued
  14. #
  15. CurArch=15
  16. if test ! -r s2_seq_.tmp
  17. then echo "Please unpack part 1 first!"
  18.      exit 1; fi
  19. ( read Scheck
  20.   if test "$Scheck" != $CurArch
  21.   then echo "Please unpack part $Scheck next!"
  22.        exit 1;
  23.   else exit 0; fi
  24. ) < s2_seq_.tmp || exit 1
  25. echo "x - Continuing file term.c"
  26. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' >> term.c
  27. X            if ((comp_used = (*completion)(buf, i)) == 0) {
  28. X            ding();
  29. X            continue;
  30. X            }
  31. X            if (comp_used < 0) {
  32. X            comp_used = 0;
  33. X            goto no_completion;
  34. X            }
  35. X            comp_len = 0;
  36. X        }
  37. X        if (c == help_key) {
  38. X            if ((*completion)((char *)NULL, 1)) {
  39. X            gotoxy(prompt_length+i, prompt_line); fl;
  40. X            did_help = 1;
  41. X            }
  42. X            continue;
  43. X        }
  44. X        
  45. X        if (comp_len) {
  46. X            i -= comp_len;
  47. X            while (--comp_len >= 0) putchar(BS);
  48. X            clrline();
  49. X            comp_len = 0;
  50. X        }
  51. X        
  52. X        switch ( (*completion)((char *)NULL, 0) ) {
  53. X
  54. X         case 0:    /* no possible completion */
  55. X            comp_used = 0;
  56. X            ding();
  57. X            continue;
  58. X            
  59. X         case 2:    /* whole new alternative */
  60. X            while (--i >= 0) putchar(BS);
  61. X            clrline();
  62. X            /* fall thru */
  63. X
  64. X         case 1:    /* completion */
  65. X            comp_len = i;
  66. X            while (c = buf[i]) {
  67. X            if (i == max) break;
  68. X            putchar(c);
  69. X            i++;
  70. X            }
  71. X            fl;
  72. X            comp_len = i - comp_len;
  73. X            continue;
  74. X        }
  75. X        }
  76. X
  77. X        if (comp_used) {
  78. X        (*completion)(buf, -1);
  79. X        if (did_help) clrmsg(i);
  80. X        comp_len = comp_used = 0;
  81. X        }
  82. X    }
  83. X    
  84. X     no_completion:
  85. X
  86. X    if (c == CR || c == NL) {
  87. X        buf[i] = NUL;
  88. X        break;
  89. X    }
  90. X    
  91. X    if (c == erase_key) {
  92. X        if (i <= 0) continue;
  93. X        i--;
  94. X        putchar(BS);
  95. X        putchar(' ');
  96. X        putchar(BS);
  97. X        fl;
  98. X        continue;
  99. X    }
  100. X
  101. X    if (c == delword_key) {
  102. X        if (i <= 0) continue;
  103. X        buf[i-1] = 'X';
  104. X        while (i > 0 && isalnum(buf[i-1])) { putchar(BS); i--; }
  105. X        clrline();
  106. X        continue;
  107. X    }
  108. X    
  109. X    if (c == kill_key) {
  110. X        while (i > 0) { putchar(BS); i--; }
  111. X        clrline();
  112. X        if (hit_count == 1 && dflt) {
  113. X        c = comp1_key;
  114. X        goto kill_prefill_hack;
  115. X        }
  116. X        continue;
  117. X    }
  118. X    
  119. X    if (c == K_interrupt) {
  120. X        ret_val = NULL;
  121. X        break;
  122. X    }
  123. X    
  124. X    if (c < SP) continue;
  125. X    
  126. X    if (i == max) continue;
  127. X
  128. X    if (i > 0 && buf[i-1] == '/' && (c == '/' || c == '+')) {
  129. X        while (i > 0) { putchar(BS); i--; }
  130. X        clrline();
  131. X    }        
  132. X
  133. X    putchar(c);
  134. X    fl;
  135. X
  136. X    buf[i] = c;
  137. X    i++;
  138. X    }
  139. X out:
  140. X    enable_stop = ostop;
  141. X    do_macro_processing = 1;
  142. X    return ret_val;
  143. X}
  144. X
  145. Xexport int list_offset = 0;
  146. X
  147. Xlist_completion(str)
  148. Xchar *str;
  149. X{
  150. X    static int cols, line;
  151. X    
  152. X    if (str == NULL) {
  153. X    cols = Columns;
  154. X    line = prompt_line + 1;
  155. X    
  156. X    gotoxy(0, line);
  157. X    clrpage(line);
  158. X    return 1;
  159. X    }
  160. X
  161. X    str += list_offset;
  162. X    
  163. X    for (;;) {
  164. X    cols -= strlen(str);
  165. X    if (cols >= 0) {
  166. X        printf("%s%s", str, cols > 0 ? " " : "");
  167. X        cols--;
  168. X        return 1;
  169. X    }
  170. X    if (line >= Lines - 1) return 0;
  171. X    line++;
  172. X    cols = Columns;
  173. X    gotoxy(0, line);
  174. X    if (line == Lines - 1) cols--;
  175. X    }
  176. X}
  177. X
  178. Xyes(must_answer)
  179. Xint must_answer;
  180. X{
  181. X    int c, help = 1, in_macro = 0;
  182. X
  183. X    switch (m_yes()) {
  184. X     case 0:
  185. X    break;
  186. X     case 1:
  187. X    return 0;
  188. X     case 2:
  189. X    return 1;
  190. X     case 3:
  191. X    do_macro_processing = 0;
  192. X        in_macro++;
  193. X    break;
  194. X    }
  195. X
  196. X    for (;;) {
  197. X    if (!is_raw) {
  198. X        raw();
  199. X        c = get_c();
  200. X        no_raw();
  201. X    } else
  202. X        c = get_c();
  203. X
  204. X    if (c == 'y' || c == 'Y') {
  205. X        c = 1;
  206. X        break;
  207. X    }
  208. X    
  209. X    if (must_answer == 0 && (c == SP || c == CR || c == NL)) break;
  210. X    if (c == 'n' || c == 'N') {
  211. X        c = 0;
  212. X        break;
  213. X    }    
  214. X    if (c == K_interrupt) {
  215. X        c = -1;
  216. X        break;
  217. X    }
  218. X    if (help) {
  219. X        fputs(" y=YES n=NO", stdout);
  220. X        prompt_length += 11;
  221. X        help = 0;
  222. X    }
  223. X    }
  224. X
  225. X    if (in_macro) {
  226. X    if (c <= 0) m_break();
  227. X    do_macro_processing = 1;
  228. X    }
  229. X    
  230. X    return c;
  231. X}
  232. X
  233. X
  234. Xding()
  235. X{
  236. X    putp(bell);
  237. X    fl;
  238. X}
  239. X
  240. X
  241. Xdisplay_file(name, modes)
  242. Xchar *name;
  243. Xint modes;
  244. X{
  245. X    FILE *f;
  246. X    register c, stand_on;
  247. X    int was_raw, linecnt, headln_cnt, hdline, no_conf;
  248. X    char headline[128];
  249. X    
  250. X    headline[0] = 0;
  251. X    hdline = 0;
  252. X    no_conf = 0;
  253. X    
  254. X    headln_cnt = -1;
  255. X    
  256. X    was_raw = is_raw;
  257. X
  258. X    no_raw();
  259. X
  260. X    if (modes & CLEAR_DISPLAY) {
  261. X    gotoxy(0,0);
  262. X    clrdisp();
  263. X    }
  264. X    
  265. X    linecnt = Lines - 1;
  266. X
  267. Xchain:    
  268. X
  269. X    f = open_file(relative(lib_directory, name), OPEN_READ);
  270. X    if (f == NULL)
  271. X    printf("\r\n\nFile %s is not available\n\n", name);
  272. X    else {
  273. X    stand_on = 0;
  274. X    
  275. X    while ((c = getc(f)) != EOF) {
  276. X#ifdef HAVE_JOBCONTROL
  277. X        if (s_redraw) {
  278. X        no_conf = 1;
  279. X        break;
  280. X        }
  281. X#endif        
  282. X        no_conf = 0;
  283. X        if (c == '\1') {
  284. X        if (STANDOUT) {
  285. X            putp(stand_on ? exit_standout_mode : enter_standout_mode);
  286. X            stand_on = !stand_on;
  287. X        }
  288. X        continue;
  289. X        }
  290. X        if (c == '\2') {
  291. X        headln_cnt = 0;
  292. X        continue;
  293. X        }
  294. X        if (c == '\3') {
  295. X        headln_cnt = 0;
  296. X        while ((c = getc(f)) != EOF && c != NL)
  297. X            headline[headln_cnt++] = c;
  298. X        headline[headln_cnt++] = NUL;
  299. X        name = headline;
  300. X        fclose(f);
  301. X        goto chain;
  302. X        }
  303. X
  304. X        if (headln_cnt >= 0)
  305. X        headline[headln_cnt++] = c;
  306. X
  307. X        if (hdline) {
  308. X        puts(headline);
  309. X        hdline = 0;
  310. X        linecnt--;
  311. X        }
  312. X        
  313. X        putchar(c);
  314. X        if (c == NL) {
  315. X        if (headln_cnt >= 0) {
  316. X            headline[--headln_cnt] = 0;
  317. X            headln_cnt = -1;
  318. X        }
  319. X        if (--linecnt == 0) {
  320. X            no_conf = 1;
  321. X            if (any_key(0) == K_interrupt) 
  322. X            break;
  323. X            linecnt = Lines - 1;
  324. X            if (modes & CLEAR_DISPLAY) {
  325. X            gotoxy(0,0);
  326. X            clrdisp();
  327. X            }
  328. X            hdline = headline[0];
  329. X        }
  330. X        }
  331. X    }
  332. X    
  333. X    if (stand_on) putp(exit_standout_mode);
  334. X    fclose(f);
  335. X    }
  336. X
  337. X    if (was_raw) raw();
  338. X
  339. X    prompt_line = Lines-1;    /* move prompt to last line */
  340. X    
  341. X    if (!no_conf && (modes & CONFIRMATION)) 
  342. X    any_key(prompt_line);
  343. X}
  344. X
  345. X
  346. X/*VARARGS*/
  347. Xuser_error(va_alist)
  348. Xva_dcl
  349. X{
  350. X    char *fmt;
  351. X    va_list ap;
  352. X    
  353. X    no_raw();
  354. X    clrdisp();
  355. X    fl;
  356. X
  357. X    va_start(ap);
  358. X    fmt = va_arg1(char *);
  359. X    
  360. X    vprintf(fmt, va_args2toN);
  361. X    putchar(NL);
  362. X
  363. X    va_end(ap);
  364. X    nn_exit(1);
  365. X}
  366. X
  367. X/*VARARGS*/
  368. Xmsg(va_alist)
  369. Xva_dcl
  370. X{
  371. X    va_list ap;
  372. X    
  373. X    va_start(ap);
  374. X    vmsg(va_args1toN);
  375. X    va_end(ap);
  376. X}
  377. X
  378. Xvmsg(va_tail)
  379. Xva_tdcl
  380. X{
  381. X    static char errmsg[512] = "";
  382. X    char *fmt;
  383. X    
  384. X    fmt = va_arg1(char *);
  385. X    
  386. X    if (fmt) vsprintf(errmsg, fmt, va_args2toN);
  387. X
  388. X    gotoxy(0, Lines-1);
  389. X    fputs(errmsg, stdout);
  390. X    clrline();
  391. X    any_message = 1;
  392. X    
  393. X    gotoxy(prompt_length, prompt_line);
  394. X    fl;
  395. X}
  396. X
  397. Xclrmsg(col)
  398. Xint col;
  399. X{
  400. X    gotoxy(0, prompt_line + 1);
  401. X    clrpage(prompt_line + 1);
  402. X    if (col >= 0)
  403. X    gotoxy(prompt_length + col, prompt_line);
  404. X    fl;
  405. X    any_message = 0;
  406. X}
  407. X
  408. X
  409. X/*VARARGS*/
  410. Xprompt(va_alist)
  411. Xva_dcl
  412. X{
  413. X    register char *cp;
  414. X    int stand_on;
  415. X    char *fmt;
  416. X    static char cur_p[FILENAME];
  417. X    va_list ap;
  418. X    
  419. X    va_start(ap);
  420. X    
  421. X    fmt = va_arg1(char *);
  422. X
  423. X    if (fmt == P_VERSION) {
  424. X    gotoxy(0, prompt_line + 1);
  425. X    print_version("Release %R.%V, Patch Level %P, Compilation %U ");
  426. X    clrline();
  427. X    any_message++;
  428. X    
  429. X    if (prompt_line >= 0)
  430. X        gotoxy(prompt_length, prompt_line);
  431. X    return;
  432. X    }
  433. X    
  434. X    if (prompt_line >= 0)
  435. X    gotoxy(0, prompt_line);
  436. X
  437. X    if (fmt == P_MOVE) {
  438. X    clrline();
  439. X    return;
  440. X    }
  441. X
  442. X    if (fmt != P_REDRAW) 
  443. X    vsprintf(cur_p, fmt, va_args2toN);
  444. X
  445. X    putchar('\r');
  446. X    
  447. X    for (cp = cur_p, stand_on = 0, prompt_length = 0; *cp; cp++) {
  448. X    if (*cp == '\1') {
  449. X        if (cp[1] != '\1') {
  450. X        if (STANDOUT) {
  451. X            putp(stand_on ? exit_standout_mode : enter_standout_mode);
  452. X            stand_on = !stand_on;
  453. X            prompt_length += cookie_size;
  454. X        }
  455. X        continue;
  456. X        }
  457. X        cp++;
  458. X    } else
  459. X    if (*cp == '\2') {
  460. X        time_t t;
  461. X        char   *timestr;
  462. X        
  463. X#ifdef STATISTICS
  464. X        tick_usage(&t, (time_t *)NULL);
  465. X#endif        
  466. X
  467. X        if (show_current_time) {
  468. X#ifndef STATISTICS        
  469. X        time(&t);
  470. X#endif
  471. X
  472. X        timestr = ctime(&t) + 11;
  473. X        timestr[5] = NUL;
  474. X
  475. X        printf("-- %s ", timestr);
  476. X        prompt_length += 9;
  477. X        }
  478. X
  479. X        if (unread_mail(t)) {
  480. X        printf("Mail ");
  481. X        prompt_length += 5;
  482. X        }
  483. X        
  484. X        continue;
  485. X    }
  486. X
  487. X    putchar(*cp);
  488. X    prompt_length ++;
  489. X    }
  490. X    if (stand_on) {
  491. X    putp(exit_standout_mode);
  492. X    prompt_length += cookie_size;
  493. X    }
  494. X    
  495. X    clrline();
  496. X}
  497. X
  498. X
  499. Xany_key(line)
  500. Xint line;
  501. X{
  502. X    int was_raw, c, dmp;
  503. X
  504. X    was_raw = is_raw;
  505. X    if (!is_raw) raw();
  506. X    if (line == 0)
  507. X    line = -1;
  508. X    else
  509. X    if (line < 0)
  510. X        line = Lines + line;
  511. X    
  512. X    if (line != 10000)
  513. X    so_printxy(0, line, "Hit any key to continue");
  514. X
  515. X    clrline();
  516. X    
  517. X    dmp = do_macro_processing;
  518. X    do_macro_processing = 0;
  519. X    c = get_c();
  520. X    do_macro_processing = dmp;
  521. X
  522. X    if (!was_raw) no_raw();
  523. X    
  524. X    return c;
  525. X}
  526. X
  527. X
  528. Xstatic pg_fline, pg_width, pg_maxw, pg_line, pg_col, pg_quit;
  529. X
  530. Xpg_init(first_line, cols)
  531. Xint first_line, cols;
  532. X{
  533. X    pg_fline = first_line;
  534. X    pg_line = pg_fline - 1;
  535. X    pg_quit = pg_col = 0;
  536. X    pg_width = Columns / cols;
  537. X    pg_maxw = pg_width * (cols - 1);
  538. X}
  539. X
  540. Xpg_next()
  541. X{
  542. X    int c;
  543. X    
  544. X    pg_line++;
  545. X    if (pg_line < Lines) {
  546. X    gotoxy(pg_col, pg_line);
  547. X    if (pg_line == Lines - 1 && pg_col == pg_maxw) {
  548. X        c = any_key(0);
  549. X        gotoxy(0, pg_fline);
  550. X        clrpage(pg_fline);
  551. X        pg_col = 0;
  552. X        pg_line = pg_fline;
  553. X        if (c == K_interrupt) {
  554. X        pg_quit = 1;
  555. X        return -1;
  556. X        }
  557. X        return 1;
  558. X    }
  559. X    } else {
  560. X    pg_line = pg_fline;
  561. X    pg_col += pg_width;
  562. X    gotoxy(pg_col, pg_line);
  563. X    }
  564. X    return 0;
  565. X}
  566. X
  567. Xpg_indent(pos)
  568. Xint pos;
  569. X{
  570. X    gotoxy(pg_col + pos, pg_line);
  571. X}
  572. X
  573. Xpg_end()
  574. X{
  575. X    if (pg_quit == 0 && pg_next() == 0)
  576. X    any_key(0);
  577. X}
  578. X
  579. X    
  580. Xuser_delay(ticks)
  581. Xint ticks;
  582. X{
  583. X    if (ticks <= 0 || conf_dont_sleep) {
  584. X    printf(" <>");
  585. X    any_key(10000);
  586. X    } else {
  587. X    fl;
  588. X    sleep(ticks);
  589. X    }
  590. X}
  591. X
  592. NO_NEWS_IS_GOOD_NEWS
  593. echo "File term.c is complete"
  594. chmod 0644 term.c || echo "restore of term.c fails"
  595. set `wc -c term.c`;Sum=$1
  596. if test "$Sum" != "23957"
  597. then echo original size 23957, current size $Sum;fi
  598. echo "x - extracting term.h (Text)"
  599. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > term.h &&
  600. X/*
  601. X * terminal interface
  602. X */
  603. X
  604. X
  605. Xextern init_term();
  606. Xextern home();
  607. Xextern gotoxy();
  608. Xextern clrdisp(), clrpage();
  609. Xextern clrline();
  610. X
  611. Xextern so_gotoxy(), so_printf(), so_end();
  612. X
  613. Xextern int Lines, Columns;
  614. Xextern int cookie_size;
  615. Xextern int WRAP, STANDOUT;
  616. X
  617. Xextern char *get_s();
  618. X
  619. X#define    NONE        (char *)NULL /* no default string etc. */
  620. X
  621. X#define    NO_COMPLETION    ((int (*)()) 0)
  622. X#define    GET_S_BUFFER    256     /* if caller want to reuse get_s buffer */
  623. X
  624. Xextern get_c();
  625. X
  626. X/*
  627. X *    prompt_line = ...
  628. X *    prompt( [P_COMMAND], ] [ format [, arg1 ... , arg4] ] );
  629. X *
  630. X *    P_MOVE:        just move to prompt line
  631. X *    P_REDRAW:    redraw prompt
  632. X *      P_VERSION:    print version on prompt line
  633. X */
  634. X
  635. X
  636. Xextern prompt();
  637. X
  638. Xint prompt_line;    /* prompt line */
  639. X
  640. X#define    P_MOVE        (char *)1
  641. X#define P_REDRAW    (char *)5
  642. X#define    P_VERSION    (char *)9
  643. X
  644. X
  645. Xextern display_file();
  646. X
  647. X#define    CLEAR_DISPLAY    0x01
  648. X#define    CONFIRMATION    0x02
  649. NO_NEWS_IS_GOOD_NEWS
  650. chmod 0644 term.h || echo "restore of term.h fails"
  651. set `wc -c term.h`;Sum=$1
  652. if test "$Sum" != "880"
  653. then echo original size 880, current size $Sum;fi
  654. echo "x - extracting unshar.c (Text)"
  655. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > unshar.c &&
  656. X/****************************************************************
  657. X * unshar.c: Unpackage one or more shell archive files
  658. X *
  659. X * Description:    unshar is a filter which removes the front part
  660. X *        of a file and passes the rest to the 'sh' command.
  661. X *        It understands phrases like "cut here", and also
  662. X *        knows about shell comment characters and the Unix
  663. X *        commands "echo", "cat", and "sed".
  664. X *
  665. X * HISTORY
  666. X *  27-July-88  Kim F. Storm (storm@texas.dk) Texas Instruments, Denmark
  667. X *    Adapted to :unshar command in nn
  668. X *    Added static to function declarations
  669. X *    Removed all unused functions, i.e. not useful as stand-alone pgm.
  670. X * 29-Jan-85  Michael Mauldin (mlm) at Carnegie-Mellon University
  671. X *    Created.
  672. X ****************************************************************/
  673. X
  674. X#include "config.h"
  675. X
  676. X
  677. X/****************************************************************
  678. X * position: position 'fil' at the start of the shell command
  679. X * portion of a shell archive file.
  680. X * Kim Storm: removed static variables
  681. X ****************************************************************/
  682. X
  683. Xunshar_position (fil)
  684. XFILE *fil;
  685. X{
  686. X    char buf[BUFSIZ];
  687. X    long pos, ftell ();
  688. X    
  689. X    /* Results from star matcher */
  690. X    char res1[BUFSIZ], res2[BUFSIZ], res3[BUFSIZ], res4[BUFSIZ];
  691. X    char *result[4];
  692. X    
  693. X    result[0] = res1, result[1] = res2, result[2] = res3, result[3] = res4 ;
  694. X    
  695. X    /*  rewind (fil);  */
  696. X    
  697. X    while (1) {
  698. X    /* Record position of the start of this line */
  699. X    pos = ftell (fil);
  700. X    
  701. X    /* Read next line, fail if no more */
  702. X    if (fgets (buf, BUFSIZ, fil) == NULL) {
  703. X        msg("no shell commands in file");
  704. X        return (0);
  705. X    }
  706. X    
  707. X    /* Bail out if we see C preprocessor commands or C comments */
  708. X    if (stlmatch (buf, "#include")    || stlmatch (buf, "# include") ||
  709. X        stlmatch (buf, "#define")    || stlmatch (buf, "# define") ||
  710. X        stlmatch (buf, "#ifdef")    || stlmatch (buf, "# ifdef") ||
  711. X        stlmatch (buf, "#ifndef")    || stlmatch (buf, "# ifndef") ||
  712. X        stlmatch (buf, "/*"))
  713. X        {
  714. X        msg("file looks like raw C code, not a shar file");
  715. X        return (0);
  716. X        }
  717. X    
  718. X    /* Does this line start with a shell command or comment */
  719. X    if (stlmatch (buf, "#")    || 
  720. X        stlmatch (buf, ":") ||
  721. X        stlmatch (buf, "echo ") ||
  722. X        stlmatch (buf, "sed ") ||
  723. X        stlmatch (buf, "cat ")) 
  724. X    { 
  725. X        fseek (fil, pos, 0);
  726. X        return (1); 
  727. X    }
  728. X    
  729. X    /* Does this line say "Cut here" */
  730. X    if (smatch (buf, "*CUT*HERE*", result) ||
  731. X        smatch (buf, "*cut*here*", result) ||
  732. X        smatch (buf, "*TEAR*HERE*", result) ||
  733. X        smatch (buf, "*tear*here*", result) ||
  734. X        smatch (buf, "*CUT*CUT*", result) ||
  735. X        smatch (buf, "*cut*cut*", result))
  736. X    {
  737. X        /* Read next line after "cut here", skipping blank lines */
  738. X        while (1) {
  739. X        pos = ftell (fil);
  740. X        
  741. X        if (fgets (buf, BUFSIZ, fil) == NULL) { 
  742. X            msg("no shell commands after 'cut'");
  743. X            return (0);
  744. X        }
  745. X        
  746. X        if (*buf != '\n') break;
  747. X        }
  748. X        
  749. X        /* 
  750. X         * Win if line starts with a comment character of 
  751. X         * lower case letter 
  752. X         */
  753. X        if (*buf == '#' ||
  754. X        *buf == ':' ||
  755. X        (('a' <= *buf) && ('z' >= *buf))) {
  756. X        fseek (fil, pos, 0);
  757. X        return (1);
  758. X        }
  759. X        
  760. X        /* Cut here message lied to us */      
  761. X        msg("invalid data after CUT line");
  762. X        return (0);
  763. X    }
  764. X    }
  765. X}
  766. X
  767. X/*****************************************************************
  768. X * stlmatch  --  match leftmost part of string
  769. X *
  770. X * Usage:  i = stlmatch (big,small)
  771. X *    int i;
  772. X *    char *small, *big;
  773. X *
  774. X * Returns 1 iff initial characters of big match small exactly;
  775. X * else 0.
  776. X *
  777. X * HISTORY
  778. X * 18-May-82 Michael Mauldin (mlm) at Carnegie-Mellon University
  779. X *      Ripped out of CMU lib for Rog-O-Matic portability
  780. X * 20-Nov-79  Steven Shafer (sas) at Carnegie-Mellon University
  781. X *    Rewritten for VAX from Ken Greer's routine.
  782. X *
  783. X *  Originally from klg (Ken Greer) on IUS/SUS UNIX
  784. X *****************************************************************/
  785. X
  786. Xstatic int   stlmatch (big, small)
  787. Xchar *small, *big;
  788. X{ register char *s, *b;
  789. X  s = small;
  790. X  b = big;
  791. X  do
  792. X  { if (*s == '\0')
  793. X      return (1);
  794. X  }
  795. X  while (*s++ == *b++);
  796. X  return (0);
  797. X}
  798. X
  799. X/*****************************************************************
  800. X * smatch: Given a data string and a pattern containing one or
  801. X * more embedded stars (*) (which match any number of characters)
  802. X * return true if the match succeeds, and set res[i] to the
  803. X * characters matched by the 'i'th *.
  804. X *****************************************************************/
  805. X
  806. Xstatic smatch (dat, pat, res)
  807. Xregister char *dat, *pat, **res;
  808. X{ register char *star = 0, *starend, *resp;
  809. X  int nres = 0;
  810. X
  811. X  while (1)
  812. X  { if (*pat == '*')
  813. X    { star = ++pat;                  /* Pattern after * */
  814. X      starend = dat;                  /* Data after * match */
  815. X      resp = res[nres++];              /* Result string */
  816. X      *resp = '\0';                  /* Initially null */
  817. X    }
  818. X    else if (*dat == *pat)              /* Characters match */
  819. X    { if (*pat == '\0')              /* Pattern matches */
  820. X    return (1);
  821. X      pat++;                      /* Try next position */
  822. X      dat++;
  823. X    }
  824. X    else
  825. X    { if (*dat == '\0')              /* Pattern fails - no more */
  826. X    return (0);                  /* data */
  827. X      if (star == 0)                  /* Pattern fails - no * to */
  828. X    return (0);                  /* adjust */
  829. X      pat = star;                  /* Restart pattern after * */
  830. X      *resp++ = *starend;              /* Copy character to result */
  831. X      *resp = '\0';                  /* null terminate */
  832. X      dat = ++starend;                  /* Rescan after copied char */
  833. X    }
  834. X  }
  835. X}
  836. NO_NEWS_IS_GOOD_NEWS
  837. chmod 0644 unshar.c || echo "restore of unshar.c fails"
  838. set `wc -c unshar.c`;Sum=$1
  839. if test "$Sum" != "5388"
  840. then echo original size 5388, current size $Sum;fi
  841. echo "x - extracting update.c (Text)"
  842. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > update.c &&
  843. X#include "patchlevel.h"
  844. X#include "update.h"
  845. X
  846. Xint Update_Level = UPDATE;
  847. Xint Patch_Level = PATCHLEVEL;
  848. X
  849. X
  850. NO_NEWS_IS_GOOD_NEWS
  851. chmod 0644 update.c || echo "restore of update.c fails"
  852. set `wc -c update.c`;Sum=$1
  853. if test "$Sum" != "104"
  854. then echo original size 104, current size $Sum;fi
  855. echo "x - extracting update.h (Text)"
  856. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > update.h &&
  857. X#define UPDATE 0
  858. NO_NEWS_IS_GOOD_NEWS
  859. chmod 0644 update.h || echo "restore of update.h fails"
  860. set `wc -c update.h`;Sum=$1
  861. if test "$Sum" != "17"
  862. then echo original size 17, current size $Sum;fi
  863. echo "x - extracting vararg.h (Text)"
  864. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > vararg.h &&
  865. X
  866. X/*
  867. X * semi-faked varargs feature
  868. X */
  869. X
  870. X#ifdef NO_VARARGS
  871. X
  872. X#define va_alist    a, b, c, d, e, f, g, h
  873. X#define va_dcl        char *a, *b, *c, *d, *e, *f, *g, *h;
  874. X#define va_list        int
  875. X
  876. X#define va_arg1(type)    (type)a
  877. X#define va_arg2(type)    (type)b
  878. X#define va_args1toN    a, b, c, d, e, f, g, h
  879. X#define va_args2toN    b, c, d, e, f, g, h
  880. X#define va_args3toN    c, d, e, f, g, h
  881. X
  882. X#define vsprintf    sprintf
  883. X#define vprintf        printf
  884. X
  885. X#define va_start(ap)
  886. X#define va_end(ap)
  887. X
  888. X#define va_tail        va_alist
  889. X#define va_tdcl        va_dcl
  890. X
  891. X#else
  892. X
  893. X#include <varargs.h>
  894. X
  895. X#define va_tail        ap
  896. X#define    va_tdcl        va_list va_tail;
  897. X
  898. X#define va_arg1(type)    va_arg(ap, type)
  899. X#define va_arg2(type)    va_arg(ap, type)
  900. X#define va_args1toN    ap
  901. X#define va_args2toN    ap
  902. X#define va_args3toN    ap
  903. X
  904. X#endif
  905. X
  906. X
  907. NO_NEWS_IS_GOOD_NEWS
  908. chmod 0644 vararg.h || echo "restore of vararg.h fails"
  909. set `wc -c vararg.h`;Sum=$1
  910. if test "$Sum" != "737"
  911. then echo original size 737, current size $Sum;fi
  912. echo "x - extracting variable.c (Text)"
  913. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > variable.c &&
  914. X/*
  915. X *    Variabel setting and display
  916. X */
  917. X
  918. X#include "config.h"
  919. X
  920. Ximport in_init;
  921. X
  922. Ximport char            /* string variables */
  923. X    *default_save_file,
  924. X    *header_lines,
  925. X    *folder_directory,
  926. X    included_mark[],
  927. X    *mail_box,
  928. X    *mail_record,
  929. X    *news_record,
  930. X#ifdef NNTP
  931. X    nntp_server[],
  932. X#endif
  933. X    *pager,
  934. X    *patch_cmd,
  935. X    printer[],
  936. X    *save_counter_format;
  937. X
  938. Ximport int            /* boolean variables */
  939. X    conf_append,
  940. X    conf_dont_sleep,
  941. X    delay_redraw,
  942. X    do_kill_handling,
  943. X    dont_sort_articles,
  944. X    dont_sort_folders,
  945. X    dont_split_digests,
  946. X    fmt_rptsubj,
  947. X    keep_rc_backup,
  948. X    long_menu,
  949. X    macro_debug,
  950. X    mark_overlap,
  951. X    monitor_mode,
  952. X    novice,
  953. X    quick_save,
  954. X    save_report,
  955. X    show_article_date,
  956. X    show_current_time,
  957. X    silent,
  958. X    use_mail_folders,
  959. X    use_newsrc;
  960. X
  961. Ximport int            /* integer variables */
  962. X    also_read_articles,
  963. X    article_limit,
  964. X    Debug,
  965. X    first_page_lines,
  966. X    fmt_linenum,
  967. X    Lines,
  968. X    overlap,
  969. X    preview_window,
  970. X    retry_on_error;
  971. X
  972. Ximport char            /* key strokes */
  973. X    comp1_key,
  974. X    comp2_key,
  975. X    help_key,
  976. X    erase_key,
  977. X    delword_key,
  978. X    kill_key;
  979. X
  980. X#define    V_STRING    0
  981. X#define V_BOOLEAN    1
  982. X#define    V_INTEGER    2
  983. X#define V_KEY        3
  984. X#define    V_SPECIAL    4
  985. X
  986. Xstruct variable_defs {
  987. X    char *var_name;
  988. X    char var_type;
  989. X    char var_op;
  990. X    char **var_addr;
  991. X} variables[] = {
  992. X    "backup",        V_BOOLEAN,    3,    (char **)&keep_rc_backup,
  993. X    "comp1_key",    V_KEY,        0,    (char **)&comp1_key,
  994. X    "comp2_key",    V_KEY,        0,    (char **)&comp2_key,
  995. X    "confirm",        V_BOOLEAN,    0,    (char **)&conf_dont_sleep,
  996. X    "confirm-append",    V_BOOLEAN,    0,    (char **)&conf_append,
  997. X    "date",        V_BOOLEAN,    0,    (char **)&show_article_date,
  998. X    "debug",        V_INTEGER,    0,    (char **)&Debug,
  999. X    "default-save-file",V_STRING,    0,    (char **)&default_save_file,
  1000. X    "delay-redraw",    V_BOOLEAN,    0,    (char **)&delay_redraw,
  1001. X    "erase-key",    V_KEY,        0,    (char **)&erase_key,
  1002. X    "expert",        V_BOOLEAN,    4,    (char **)&novice,
  1003. X    "folder",        V_STRING,    2,    (char **)&folder_directory,
  1004. X    "fsort",        V_BOOLEAN,    2,    (char **)&dont_sort_folders,
  1005. X    "header-lines",    V_STRING,    0,    (char **)&header_lines,
  1006. X    "help-key",        V_KEY,        0,    (char **)&help_key,
  1007. X    "included-mark",    V_STRING,    1,    (char **)included_mark,
  1008. X    "kill",        V_BOOLEAN,    0,    (char **)&do_kill_handling,
  1009. X    "kill-key",        V_KEY,        0,    (char **)&kill_key,
  1010. X    "layout",        V_INTEGER,    1,    (char **)&fmt_linenum,
  1011. X    "limit",        V_INTEGER,    0,    (char **)&article_limit,
  1012. X    "lines",        V_INTEGER,    1,    (char **)&Lines,
  1013. X    "long-menu",    V_BOOLEAN,    1,    (char **)&long_menu,
  1014. X    "macro-debug",    V_BOOLEAN,    0,    (char **)¯o_debug,
  1015. X    "mail",        V_STRING,    0,    (char **)&mail_box,
  1016. X    "mail-format",    V_BOOLEAN,    0,    (char **)&use_mail_folders,
  1017. X    "mail-record",    V_STRING,    2,    (char **)&mail_record,
  1018. X    "mark-overlap",    V_BOOLEAN,    0,    (char **)&mark_overlap,
  1019. X    "monitor",        V_BOOLEAN,    0,    (char **)&monitor_mode,
  1020. X    "news-record",    V_STRING,    2,    (char **)&news_record,
  1021. X    "newsrc",        V_BOOLEAN,    0,    (char **)&use_newsrc,
  1022. X#ifdef NNTP
  1023. X    "nntp-server",    V_STRING,    1,    (char **)nntp_server,
  1024. X#endif
  1025. X    "old",        V_SPECIAL,    2,    (char **)NULL,
  1026. X    "overlap",        V_INTEGER,    0,    (char **)&overlap,
  1027. X    "pager",        V_STRING,    0,    (char **)&pager,
  1028. X    "patch-cmd",    V_STRING,    0,    (char **)&patch_cmd,
  1029. X    "printer",        V_STRING,    1,    (char **)printer,
  1030. X    "quick-save",    V_BOOLEAN,    0,    (char **)&quick_save,
  1031. X    "record",        V_SPECIAL,    1,    (char **)NULL,
  1032. X    "repeat",        V_BOOLEAN,    0,    (char **)&fmt_rptsubj,
  1033. X    "retry-on-error",    V_INTEGER,    0,    (char **)&retry_on_error,
  1034. X    "save-counter",    V_STRING,    0,    (char **)&save_counter_format,
  1035. X    "save-report",    V_BOOLEAN,    0,    (char **)&save_report,
  1036. X    "silent",        V_BOOLEAN,    0,    (char **)&silent,
  1037. X    "sort",        V_BOOLEAN,    2,    (char **)&dont_sort_articles,
  1038. X    "split",        V_BOOLEAN,    4,    (char **)&dont_split_digests,
  1039. X    "stop",        V_INTEGER,    0,    (char **)&first_page_lines,
  1040. X    "time",        V_BOOLEAN,    0,    (char **)&show_current_time,
  1041. X    "window",        V_INTEGER,    1,    (char **)&preview_window,
  1042. X    "word-key",        V_KEY,        0,    (char **)&delword_key
  1043. X};
  1044. X
  1045. X#define TABLE_SIZE    (sizeof(variables)/sizeof(struct variable_defs))
  1046. X
  1047. X#define INT_VAR        (*((int *)(var->var_addr)))
  1048. X#define BOOL_VAR    (*((int *)(var->var_addr)))
  1049. X#define STR_VAR        (*(var->var_addr))
  1050. X#define CBUF_VAR    ((char *)(var->var_addr))
  1051. X#define KEY_VAR        (*((char *)(var->var_addr)))
  1052. X
  1053. X
  1054. Xstatic struct variable_defs *lookup_variable(variable)
  1055. Xchar *variable;
  1056. X{
  1057. X    register struct variable_defs *var;
  1058. X    register i, j, k, t;
  1059. X    
  1060. X    i = 0; j = TABLE_SIZE - 1; 
  1061. X    
  1062. X    while (i <= j) {
  1063. X    k = (i + j) / 2;
  1064. X    var = &variables[k];
  1065. X    
  1066. X    if ( (t=strcmp(variable, var->var_name)) > 0) 
  1067. X        i = k+1;
  1068. X    else
  1069. X    if (t < 0)
  1070. X        j = k-1;
  1071. X    else
  1072. X        return var;
  1073. X    }
  1074. X
  1075. X    init_message("unknown variable: %s", variable);
  1076. X    return NULL;
  1077. X}    
  1078. X
  1079. X
  1080. Xset_variable(variable, on, val_string)
  1081. Xchar *variable;
  1082. Xint on;
  1083. Xchar *val_string;
  1084. X{
  1085. X    long value;
  1086. X    register struct variable_defs *var;
  1087. X
  1088. X    if (strncmp(variable, "no", 2) == 0) {
  1089. X    on = !on;
  1090. X    variable += 2;
  1091. X    }
  1092. X    
  1093. X    if ((var = lookup_variable(variable)) == NULL) 
  1094. X    return 0;
  1095. X    
  1096. X    if (!on || val_string == NULL)
  1097. X    value = 0;
  1098. X    else    
  1099. X    value = atol(val_string);
  1100. X
  1101. X    switch (var->var_type) {
  1102. X    
  1103. X     case V_STRING:
  1104. X
  1105. X    switch (var->var_op) {
  1106. X     case 0:
  1107. X        if (val_string) STR_VAR = copy_str(val_string);
  1108. X        break;
  1109. X
  1110. X     case 1:
  1111. X        if (val_string) strcpy(CBUF_VAR, val_string);
  1112. X        break;
  1113. X
  1114. X     case 2:
  1115. X        adjust(val_string);
  1116. X        if (val_string) STR_VAR = home_relative(val_string);
  1117. X        break;
  1118. X    }
  1119. X    break;
  1120. X    
  1121. X     case V_BOOLEAN:
  1122. X    
  1123. X    switch (var->var_op) {
  1124. X     case 0:
  1125. X        BOOL_VAR = on;
  1126. X        break;
  1127. X        
  1128. X     case 1:
  1129. X        BOOL_VAR = on;
  1130. X        return 1;
  1131. X        
  1132. X     case 2:
  1133. X        if (BOOL_VAR == on) {
  1134. X        BOOL_VAR = !on;
  1135. X        if (!in_init) {
  1136. X            if (BOOL_VAR)
  1137. X            unsort_articles(1);
  1138. X            else
  1139. X            sort_articles();
  1140. X            return 1;
  1141. X        }
  1142. X        }    
  1143. X        break;
  1144. X        
  1145. X     case 3:
  1146. X        if (!in_init) {
  1147. X        msg("'%s' can only be set in the init file", variable);
  1148. X        break;
  1149. X        }
  1150. X        BOOL_VAR = on;
  1151. X        break;        
  1152. X
  1153. X     case 4:
  1154. X        BOOL_VAR = !on;
  1155. X        break;
  1156. X    }
  1157. X    break;
  1158. X
  1159. X     case V_INTEGER:
  1160. X
  1161. X    switch (var->var_op) {
  1162. X     case 0:
  1163. X        INT_VAR = value;        
  1164. X        break;
  1165. X        
  1166. X     case 1:
  1167. X        INT_VAR = value; 
  1168. X        return 1;
  1169. X    }
  1170. X    break;
  1171. X    
  1172. X     case V_KEY:
  1173. X    switch (var->var_op) {
  1174. X     case 0:
  1175. X        if (val_string) {
  1176. X        if (*val_string) adjust(val_string + 1); /* #N is valid */
  1177. X        KEY_VAR = parse_key(val_string);
  1178. X        }
  1179. X        break;
  1180. X    }
  1181. X    break;
  1182. X    
  1183. X     case V_SPECIAL:
  1184. X    
  1185. X    switch (var->var_op) {
  1186. X     case 1:
  1187. X        if (val_string) {
  1188. X        adjust(val_string);
  1189. X        news_record = home_relative(val_string);
  1190. X        mail_record = news_record;
  1191. X        }
  1192. X        break;
  1193. X        
  1194. X     case 2:
  1195. X        also_read_articles = on;
  1196. X        article_limit = value;
  1197. X        break;
  1198. X    }        
  1199. X    break;
  1200. X    }
  1201. X    return 0;
  1202. X}
  1203. X    
  1204. Xstatic adjust(str)
  1205. Xregister char *str;
  1206. X{
  1207. X    if (str == NULL) return;
  1208. X    while (*str && !isspace(*str) && *str != '#') str++;
  1209. X    *str = NUL;
  1210. X}
  1211. X
  1212. X
  1213. Xdisp_variables()
  1214. X{
  1215. X    char *str, *key_name();
  1216. X    int i, b;
  1217. X    register struct variable_defs *var;
  1218. X    
  1219. X    if (in_init) return;
  1220. X
  1221. X    pg_init(0, 1);
  1222. X    
  1223. X    clrdisp();
  1224. X    pg_next();
  1225. X    so_printf("\1Variable settings:\1");
  1226. X
  1227. X    for (var = variables; var < &variables[TABLE_SIZE]; var++) {
  1228. X    switch (var->var_type) {
  1229. X     case V_STRING:
  1230. X        str = (var->var_op == 1) ? CBUF_VAR : STR_VAR;
  1231. X        if (str == NULL || *str == NUL) break;
  1232. X        
  1233. X        if (pg_next() < 0) goto out;
  1234. X        printf("%-20.20s = \"%s\"\n", var->var_name, str);
  1235. X        break;
  1236. X
  1237. X     case V_BOOLEAN:
  1238. X        if (pg_next() < 0) goto out;
  1239. X        b = BOOL_VAR;
  1240. X        if (var->var_op == 2 || var->var_op == 4) b = !b;
  1241. X        printf("%s%s\n", b ? "" : "no", var->var_name);
  1242. X        break;
  1243. X        
  1244. X     case V_INTEGER:
  1245. X        i = INT_VAR;
  1246. X        if (i == 0) break;
  1247. X        if (pg_next() < 0) goto out;
  1248. X        printf("%-20.20s = %d\n", var->var_name, i);
  1249. X        break;
  1250. X        
  1251. X     case V_KEY:
  1252. X        if (pg_next() < 0) goto out;
  1253. X        printf("%-20.20s = %s\n", var->var_name, key_name(KEY_VAR));
  1254. X        break;
  1255. X        
  1256. X     case V_SPECIAL:
  1257. X        switch (var->var_op) {
  1258. X         case 1:
  1259. X        break;
  1260. X         case 2:
  1261. X        if (also_read_articles) {
  1262. X            if (pg_next() < 0) goto out;
  1263. X            printf("%-20.20s = %d\n", var->var_name, article_limit);
  1264. X        }
  1265. X        break;
  1266. X        }
  1267. X        break;
  1268. X    }
  1269. X    }
  1270. X    
  1271. Xout:
  1272. X    pg_end();
  1273. X}
  1274. X
  1275. Xtoggle_variable(variable)
  1276. Xchar *variable;
  1277. X{
  1278. X    register struct variable_defs *var;
  1279. X    
  1280. X    if ((var = lookup_variable(variable)) == NULL) return;
  1281. X    if (var->var_type != V_BOOLEAN) {
  1282. X    init_message("variable %s is not boolean", variable);
  1283. X    return;
  1284. X    }
  1285. X    
  1286. X    BOOL_VAR = !BOOL_VAR;
  1287. X}
  1288. X
  1289. X
  1290. Xtest_variable(expr)
  1291. Xchar *expr;
  1292. X{
  1293. X    char *variable;
  1294. X    register struct variable_defs *var;
  1295. X    int res = -1;
  1296. X    
  1297. X    variable = expr;
  1298. X    if ((expr = strchr(variable, '=')) == NULL) 
  1299. X    goto err;
  1300. X    
  1301. X    *expr++ = NUL;
  1302. X    
  1303. X    if ((var = lookup_variable(variable)) == NULL) {
  1304. X    msg("testing unknown variable %s=%s", variable, expr);
  1305. X    goto out;
  1306. X    }    
  1307. X
  1308. X    switch (var->var_type) {
  1309. X    
  1310. X     case V_BOOLEAN:
  1311. X    res = BOOL_VAR;
  1312. X    
  1313. X    if (strcmp(expr, "on") == 0) break;
  1314. X    if (strcmp(expr, "off") == 0) {
  1315. X        res = !res;
  1316. X        break;
  1317. X    }
  1318. X    msg("boolean variables must be tested =on or =off");
  1319. X    break;
  1320. X    
  1321. X     case V_INTEGER:
  1322. X    res = (INT_VAR == atoi(expr)) ? 1 : 0;
  1323. X    break;
  1324. X    
  1325. X     default:
  1326. X    msg("%s: cannot only test boolean and integer variables", variable);
  1327. X    break;
  1328. X    }
  1329. X out:
  1330. X    *--expr = '=';
  1331. X err:
  1332. X    return res;
  1333. X}
  1334. X
  1335. X
  1336. Xvar_completion(path, index)
  1337. Xchar *path;
  1338. Xint index;
  1339. X{
  1340. X    static char *head, *tail = NULL;
  1341. X    static int len;
  1342. X    static struct variable_defs *var, *help_var;
  1343. X
  1344. X    if (index < 0) return 0;
  1345. X
  1346. X    if (path) {
  1347. X    head = path;
  1348. X    tail = path + index;
  1349. X    while (*head && isspace(*head)) head++;
  1350. X    help_var = var = variables;
  1351. X    len = tail - head;
  1352. X    
  1353. X    return 1;
  1354. X    }
  1355. X    
  1356. X    if (index) {
  1357. X    list_completion((char *)NULL);
  1358. X    
  1359. X    for (;; help_var++) {
  1360. X        if (help_var >= &variables[TABLE_SIZE]) {
  1361. X        help_var = variables;
  1362. X        break;
  1363. X        }
  1364. X        
  1365. X        index = strncmp(help_var->var_name, head, len);
  1366. X        if (index < 0) continue;
  1367. X        if (index > 0) {
  1368. X        help_var = variables;
  1369. X        break;
  1370. X        }
  1371. X        if (list_completion(help_var->var_name) == 0) break;
  1372. X    }
  1373. X    fl;
  1374. X    return 1;
  1375. X    }
  1376. X
  1377. X    for (; var < &variables[TABLE_SIZE]; var++) {
  1378. X    if (len == 0) 
  1379. X        index = 0;
  1380. X    else
  1381. X        index = strncmp(var->var_name, head, len);
  1382. X    if (index < 0) continue;
  1383. X    if (index > 0) break;
  1384. X    sprintf(tail, "%s ", var->var_name + len);
  1385. X    var++;
  1386. X    return 1;
  1387. X    }
  1388. X    return 0;
  1389. X}
  1390. X
  1391. NO_NEWS_IS_GOOD_NEWS
  1392. chmod 0644 variable.c || echo "restore of variable.c fails"
  1393. set `wc -c variable.c`;Sum=$1
  1394. if test "$Sum" != "10209"
  1395. then echo original size 10209, current size $Sum;fi
  1396. echo "x - extracting xmakefile (Text)"
  1397. sed 's/^X//' << 'NO_NEWS_IS_GOOD_NEWS' > xmakefile &&
  1398. X*
  1399. X* DO NOT CHANGE THIS MAKEFILE DIRECTLY
  1400. X*
  1401. X* THERE ARE NO CONFIGURATION PARAMETERS IN THIS FILE
  1402. X*
  1403. X
  1404. X#include "config.h"
  1405. X#undef global
  1406. X#undef SHELL
  1407. X
  1408. X#ifndef COMPILER_FLAGS
  1409. X#define COMPILER_FLAGS
  1410. X#endif
  1411. X
  1412. X#ifndef EXTRA_LIB
  1413. X#define EXTRA_LIB
  1414. X#endif
  1415. X
  1416. X#ifdef HAVE_ROUTING
  1417. X#define NNMAIL
  1418. X#else
  1419. X#define    NNMAIL nnmail
  1420. X#endif
  1421. X
  1422. X------------------ MAKE WILL CUT HERE -------------
  1423. X*
  1424. X* Notice:  ymakefile is made from xmakefile by the Makefile.
  1425. X*
  1426. X
  1427. XCC =     COMPILER
  1428. XCPP =     PREPROC
  1429. XCFLAGS = COMPILER_FLAGS CDEBUG
  1430. X
  1431. X*
  1432. X* Resulting programs
  1433. X*
  1434. X
  1435. XBIN_PROG =    nn NNMAIL nntidy nngrep nnquery nnusage nngoback
  1436. XBIN_LINK =    nncheck nnadmin
  1437. XLIB_PROG =    aux date_regexp log_entry back_act
  1438. XMASTER_PROG =    nnmaster
  1439. X
  1440. X*
  1441. X* Compilation
  1442. X*
  1443. X
  1444. XSHELL = /bin/sh
  1445. X
  1446. XMASTER = master.o collect.o expire.o update.o \
  1447. X    global.o options.o active.o db.o nntp.o \
  1448. X    pack_date.o pack_name.o pack_subject.o news.o digest.o match.o 
  1449. X
  1450. XNN =     nn.o admin.o update.o \
  1451. X    global.o options.o active.o db.o nntp.o \
  1452. X    init.o variable.o term.o keymap.o macro.o regexp.o \
  1453. X    menu.o more.o rc.o group.o folder.o \
  1454. X    articles.o sequence.o selection.o kill.o \
  1455. X    answer.o reroute.o save.o unshar.o execute.o \
  1456. X    pack_date.o pack_name.o pack_subject.o news.o digest.o match.o 
  1457. X
  1458. XMAIL = nnmail.o reroute.o global.o options.o update.o
  1459. X
  1460. X
  1461. Xall:    $(BIN_PROG) $(LIB_PROG) $(MASTER_PROG)
  1462. X
  1463. Xclient: update.o $(BIN_PROG) $(LIB_PROG)
  1464. X
  1465. X
  1466. Xnn:    $(NN) 
  1467. X    $(CC) $(CFLAGS) $(NN) TERMLIB EXTRA_LIB -o nn
  1468. X
  1469. Xnnmaster: $(MASTER)
  1470. X    $(CC) $(CFLAGS) $(MASTER) EXTRA_LIB -o nnmaster
  1471. X
  1472. Xnnmail:    $(MAIL)
  1473. X    $(CC) $(CFLAGS) $(MAIL) EXTRA_LIB -o nnmail
  1474. X
  1475. Xnntidy:    nntidy.sh prefix
  1476. X    cat prefix nntidy.sh > nntidy
  1477. X    chmod +x nntidy
  1478. X
  1479. Xnngrep:    nngrep.sh prefix
  1480. X    cat prefix nngrep.sh > nngrep
  1481. X    chmod +x nngrep
  1482. X
  1483. Xnngoback: nngoback.sh prefix
  1484. X    cat prefix nngoback.sh > nngoback
  1485. X    chmod +x nngoback
  1486. X
  1487. Xnnquery: nnquery.sh prefix
  1488. X    cat prefix nnquery.sh > nnquery
  1489. X    chmod +x nnquery
  1490. X
  1491. Xnnusage: nnusage.sh prefix
  1492. X    cat prefix nnusage.sh > nnusage
  1493. X    chmod +x nnusage
  1494. X
  1495. X* LIB PROGRAMS
  1496. X
  1497. Xdate_regexp: date_regexp.o
  1498. X    $(CC) $(CFLAGS) date_regexp.o EXTRA_LIB -o date_regexp
  1499. X
  1500. Xlog_entry: log_entry.o global.o update.o
  1501. X    $(CC) $(CFLAGS) log_entry.o global.o update.o EXTRA_LIB -o log_entry
  1502. X
  1503. Xaux:     aux.sh prefix
  1504. X    cat prefix aux.sh > aux
  1505. X    chmod +x aux
  1506. X
  1507. Xback_act: back_act.sh prefix
  1508. X    cat prefix back_act.sh > back_act
  1509. X    chmod +x back_act
  1510. X
  1511. X
  1512. X*
  1513. X* Clean -- remove compiled programs
  1514. X*
  1515. X
  1516. Xclean:
  1517. X    rm -f $(BIN_PROG) $(LIB_PROG) $(MASTER_PROG) cvt-help
  1518. X
  1519. X*
  1520. X* Compilation counter updating
  1521. X*
  1522. X
  1523. Xupdate.o:    update.h update.c
  1524. X    -$(CC) -c $(CFLAGS) update.c
  1525. X
  1526. X*
  1527. X* Installation
  1528. X*
  1529. X
  1530. Xinstall: prefix install.bin install.lib install.master install.man
  1531. X    @sh install_aux incr OWNER GROUP LIB_DIRECTORY "Log" 666 \
  1532. X        "Installation" DB_DIRECTORY
  1533. X
  1534. Xinstall.client: prefix install.bin install.lib install.man
  1535. X    @sh install_aux incr OWNER GROUP LIB_DIRECTORY "Log" 666 \
  1536. X        "Client Installation"
  1537. X
  1538. Xinstall.bin: $(BIN_PROG)
  1539. X    @sh install_aux bin OWNER GROUP BIN_DIRECTORY "$(BIN_PROG)" 755 \
  1540. X        "$(BIN_LINK)"
  1541. X
  1542. Xinstall.lib: $(LIB_PROG) cvt-help
  1543. X    @sh install_aux aux  OWNER GROUP LIB_DIRECTORY "$(LIB_PROG)" 755
  1544. X    @sh install_aux help OWNER GROUP LIB_DIRECTORY "help.*" 644
  1545. X
  1546. Xinstall.master: $(MASTER_PROG)
  1547. X    @sh install_aux master OWNER GROUP LIB_DIRECTORY "$(MASTER_PROG)" 6755
  1548. X
  1549. Xinstall.man: 
  1550. X    @sh install_aux 1  OWNER GROUP USER_MAN_DIR USER_MAN_SECTION 644
  1551. X    @sh install_aux 1m OWNER GROUP SYS_MAN_DIR  SYS_MAN_SECTION  644
  1552. X
  1553. Xonline.manual:
  1554. X    @sh install_aux online OWNER GROUP LIB_DIRECTORY "n*.1 n*.1m" 444
  1555. X
  1556. X*
  1557. X* initialize database
  1558. X*
  1559. X
  1560. Xinitdb:
  1561. X    @sh install_aux db OWNER GROUP DB_DIRECTORY ". DATA" 755
  1562. X    @sh install_aux init . . LIB_DIRECTORY "$(MASTER_PROG)" . "-I"
  1563. X
  1564. X
  1565. X*
  1566. X* dependencies
  1567. X*
  1568. X
  1569. Xprefix:    prefix.sh config.h update.h patchlevel.h ymakefile
  1570. X    cp prefix.sh prefix.c
  1571. X    $(CPP) prefix.c | \
  1572. X    sed -e '1,/CUT PREFIX HERE/d' \
  1573. X        -e '/prefix.c/d' \
  1574. X        -e '/^[     ]*$$/d' \
  1575. X        -e 's/^&/#/' \
  1576. X        -e 's/[     ]*=[     ]*/=/' > prefix
  1577. X    rm -f prefix.c
  1578. X
  1579. Xcvt-help:    cvt-help.c
  1580. X    cc -o cvt-help cvt-help.c
  1581. X
  1582. Xactive.o:    active.c config.h global.h data.h
  1583. X
  1584. Xadmin.o:    admin.c config.h global.h data.h term.h db.h
  1585. X
  1586. Xanswer.o:    answer.c config.h global.h data.h news.h term.h keymap.h
  1587. X
  1588. Xarticles.o:    articles.c config.h global.h data.h articles.h db.h match.h
  1589. X
  1590. Xcollect.o:    collect.c config.h global.h data.h db.h news.h
  1591. X
  1592. Xdate_regexp.o:    config.h global.h data.h
  1593. X
  1594. Xdb.o:        db.c config.h global.h data.h db.h
  1595. X
  1596. Xdigest.o:    digest.c config.h global.h data.h news.h match.h
  1597. X
  1598. Xexecute.o:    execute.c config.h global.h data.h term.h
  1599. X
  1600. Xexpire.o:    expire.c config.h global.h data.h
  1601. X
  1602. Xfolder.o:    folder.c config.h global.h data.h articles.h news.h term.h menu.h
  1603. X
  1604. Xglobal.o:    global.c config.h global.h data.h
  1605. X
  1606. Xgroup.o:    group.c config.h global.h data.h articles.h db.c term.h menu.h keymap.h
  1607. X
  1608. Xinit.o:        init.c config.h global.h data.h articles.h keymap.h term.h menu.h 
  1609. X
  1610. Xkeymap.o:    keymap.c config.h global.h data.h keymap.h term.h
  1611. X
  1612. Xkill.o:        kill.c config.h global.h data.h term.h
  1613. X
  1614. Xlog_entry.o:    log_entry.c
  1615. X
  1616. Xmaster.o:    master.c config.h global.h data.h
  1617. X
  1618. Xmenu.o:        menu.c config.h global.h data.h articles.h term.h menu.h keymap.h
  1619. X
  1620. Xmore.o:        more.c config.h global.h data.h news.h term.h menu.h keymap.h
  1621. X
  1622. Xnews.o:        news.c config.h global.h data.h news.h
  1623. X
  1624. Xnn.o:        nn.c config.h global.h data.h menu.h term.h keymap.h
  1625. X
  1626. Xnnmail.o:    nnmail.c config.h global.h data.h options.h
  1627. X
  1628. Xnntp.o:        nntp.c config.h global.h data.h nntp.h
  1629. X
  1630. Xoptions.o:    options.c config.h global.h data.h options.h
  1631. X
  1632. Xpack_date.o:    pack_date.c config.h global.h data.h
  1633. X
  1634. Xpack_name.o:    pack_name.c config.h global.h data.h
  1635. X
  1636. Xpack_subject.o:    pack_subject.c config.h global.h data.h 
  1637. X
  1638. Xrc.o:        rc.c config.h global.h data.h term.h
  1639. X
  1640. Xreroute.o:    reroute.c config.h global.h data.h
  1641. X
  1642. Xsave.o:        save.c config.h global.h data.h term.h news.h keymap.h
  1643. X
  1644. Xselection.o:    selection.c config.h global.h data.h articles.h
  1645. X
  1646. Xsequence.o:    sequence.c config.h global.h data.h
  1647. X
  1648. Xvariable.o:    variable.c config.h global.h data.h 
  1649. X
  1650. Xterm.o:        term.c config.h global.h data.h term.h keymap.h
  1651. X
  1652. X* link debugging version
  1653. X
  1654. Xnn1:    $(NN) 
  1655. X    $(CC) $(CFLAGS) $(NN) TERMLIB EXTRA_LIB -Mnn1 -o nn1
  1656. X
  1657. X* this is probably non-portable so it is ifdef'ed
  1658. X
  1659. X#ifdef WITH_LINT
  1660. Xlint:
  1661. X    echo LINTING NN
  1662. X    lint $(NN:.o=.c)
  1663. X    echo LINTING MASTER
  1664. X    lint $(MASTER:.o=.c)
  1665. X#endif
  1666. NO_NEWS_IS_GOOD_NEWS
  1667. chmod 0644 xmakefile || echo "restore of xmakefile fails"
  1668. set `wc -c xmakefile`;Sum=$1
  1669. if test "$Sum" != "6101"
  1670. then echo original size 6101, current size $Sum;fi
  1671. rm -f s2_seq_.tmp
  1672. echo "You have unpacked the last part"
  1673. exit 0
  1674. ---
  1675. Kim F. Storm        storm@texas.dk        Tel +45 429 174 00
  1676. Texas Instruments, Marielundvej 46E, DK-2730 Herlev, Denmark
  1677.       No news is good news, but nn is better!
  1678.  
  1679.