home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume29 / tin / part11 < prev    next >
Encoding:
Text File  |  1992-03-27  |  50.4 KB  |  2,061 lines

  1. Newsgroups: comp.sources.misc
  2. From: iain%anl433.uucp@germany.eu.net (Iain J. Lea)
  3. Subject:  v29i029:  tin - threaded full screen newsreader v1.1P1, Part11/12
  4. Message-ID: <1992Mar27.033945.3696@sparky.imd.sterling.com>
  5. X-Md4-Signature: abeabf93559a7d39e1d5cb0b999eba2f
  6. Date: Fri, 27 Mar 1992 03:39:45 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: iain%anl433.uucp@germany.eu.net (Iain J. Lea)
  10. Posting-number: Volume 29, Issue 29
  11. Archive-name: tin/part11
  12. Environment: BSD, SCO, ISC, SUNOS, SYSVR3, SYSVR4, ULTRIX, XENIX
  13. Supersedes: tin: Volume 28, Issue 45-55
  14.  
  15. #!/bin/sh
  16. # this is tin.shar.11 (part 11 of tin1.1)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file thread.c continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 11; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test ! -f _shar_wnt_.tmp; then
  33.     echo 'x - still skipping thread.c'
  34. else
  35. echo 'x - continuing file thread.c'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'thread.c' &&
  37. static int thread_respnum = 0;
  38. static int first_thread_on_screen = 0;
  39. static int last_thread_on_screen = 0;
  40. X
  41. X
  42. /*
  43. X * show current thread. If threaded on Subject: show
  44. X *   <respnum> <name>    <respnum> <name>
  45. X * If threaded on Archive-name: show
  46. X *   <respnum> <subject> <name>
  47. X */
  48. int show_thread (respnum, group, group_path)
  49. X    int respnum;
  50. X    char *group;
  51. X    char *group_path;
  52. {
  53. #ifndef INDEX_DAEMON
  54. X
  55. X    int ch;
  56. X    int i, index, n;
  57. X    int scroll_lines;
  58. X
  59. X    thread_respnum = respnum;
  60. X    thread_basenote = which_thread (thread_respnum);
  61. X    top_thread = num_of_responses (thread_basenote) + 1;
  62. X
  63. X    if (debug == 2) {
  64. X        sprintf (msg, "THREAD respnum=[%d]  basenote=[%d]  num=[%d]",
  65. X            thread_respnum, thread_basenote, top_thread);
  66. X        info_message (msg);
  67. X        sleep (2);
  68. X    }
  69. X
  70. X    if (top_thread <= 0) {
  71. X        info_message (txt_no_resps_in_thread);
  72. X        return FALSE;
  73. X    }
  74. X
  75. X    if (arts[thread_respnum].archive != (char *) 0) {
  76. X        threaded_on_subject = FALSE;
  77. X    } else {
  78. X        threaded_on_subject = TRUE;
  79. X    }
  80. X
  81. X    thread_index_point = top_thread;
  82. X    if (space_mode) {
  83. X        if (i = new_responses (thread_basenote)) {
  84. X            for (n=0, i = base[thread_basenote]; i >= 0 ;
  85. X                 i = arts[i].thread, n++) {
  86. X                if (arts[i].unread == ART_UNREAD) {
  87. X                    thread_index_point = n;
  88. X                    break;
  89. X                }
  90. X            }
  91. X        }
  92. X    }
  93. X
  94. X    if (thread_index_point < 0) {
  95. X        thread_index_point = 0;
  96. X    }
  97. X
  98. X    show_thread_page ();
  99. X
  100. X    while (TRUE) {
  101. X        ch = (char) ReadCh();
  102. X
  103. X        if (ch >= '0' && ch <= '9') {    /* 0 goes to basenote */
  104. X            prompt_thread_num (ch);
  105. X        } else switch (ch) {
  106. X            case ESC:    /* common arrow keys */
  107. X                switch (get_arrow_key ()) {
  108. X                    case KEYMAP_UP:
  109. X                        goto thread_up;
  110. X
  111. X                    case KEYMAP_DOWN:
  112. X                        goto thread_down;
  113. X
  114. X                    case KEYMAP_PAGE_UP:
  115. X                        goto thread_page_up;
  116. X
  117. X                    case KEYMAP_PAGE_DOWN:
  118. X                        goto thread_page_down;
  119. X
  120. X                    case KEYMAP_HOME:
  121. X                        if (thread_index_point != 0) {
  122. X                            thread_index_point = 0;
  123. X                            show_thread_page ();
  124. X                        }
  125. X                        break;
  126. X                    
  127. X                    case KEYMAP_END:
  128. X                        goto end_of_thread;
  129. X                }
  130. X                break;
  131. X
  132. X            case '$':    /* show last page of threads */
  133. end_of_thread:            
  134. X                if (thread_index_point != top_thread) {
  135. X                    thread_index_point = top_thread;
  136. X                    show_thread_page ();
  137. X                }
  138. X                break;
  139. X                
  140. X            case '\r':
  141. X            case '\n':    /* read current article within thread */
  142. X                n = choose_response (thread_basenote, thread_index_point);
  143. X                n = show_page (n, group, group_path);
  144. X                if (n == thread_basenote) {
  145. X                    show_thread_page ();
  146. X                } else {
  147. X                    index_point = n;    
  148. X                    goto thread_done;
  149. X                }
  150. X                break;
  151. X
  152. X            case '\t':
  153. X                 space_mode = TRUE;
  154. X                if (thread_index_point == 0) {
  155. X                    n = thread_respnum;
  156. X                } else {
  157. X                    n = choose_response (thread_basenote, thread_index_point);
  158. X                }
  159. X                index = thread_index_point;
  160. X                for (i = n ; i != -1 ; i = arts[i].thread) {
  161. X                    if (arts[i].unread == ART_UNREAD) {
  162. X                        n = show_page (i, group, group_path);
  163. X                        break;
  164. X                    }
  165. X                    index++;
  166. X                }
  167. X                if (n == thread_basenote) {
  168. X                    thread_index_point = index;
  169. X                    show_thread_page ();
  170. X                } else {
  171. X                    index_point = which_thread (n);    
  172. X                    goto thread_done;
  173. X                }
  174. X                break;
  175. X    
  176. X            case ' ':            /* page down */
  177. X            case ctrl('D'):        /* vi style */
  178. X            case ctrl('V'):        /* emacs style */
  179. thread_page_down:
  180. X                if (thread_index_point + 1 == top_thread)
  181. X                    break;
  182. X
  183. X                erase_thread_arrow ();
  184. X                scroll_lines = (full_page_scroll ? NOTESLINES : NOTESLINES / 2);
  185. X                thread_index_point = ((thread_index_point + scroll_lines) /
  186. X                            scroll_lines) * scroll_lines;
  187. X                if (thread_index_point >= top_thread) {
  188. X                    thread_index_point = (top_thread / scroll_lines) * scroll_lines;
  189. X                    if (thread_index_point < top_thread - 1) {
  190. X                        thread_index_point = top_thread - 1;
  191. X                    }
  192. X                }
  193. X                if (thread_index_point < first_thread_on_screen ||
  194. X                    thread_index_point >= last_thread_on_screen) {
  195. X                    show_thread_page ();
  196. X                } else {
  197. X                    draw_thread_arrow ();
  198. X                }
  199. X                break;
  200. X
  201. X            case ctrl('L'):        /* redraw screen */
  202. X            case ctrl('R'):
  203. X            case ctrl('W'):
  204. #ifndef USE_CLEARSCREEN
  205. X                ClearScreen ();
  206. #endif
  207. X                show_thread_page ();
  208. X                break;
  209. X
  210. X            case ctrl('N'):
  211. X            case 'j':        /* line down */
  212. thread_down:
  213. X                if (thread_index_point + 1 >= top_thread)
  214. X                    break;
  215. X
  216. X                if (thread_index_point + 1 >= last_thread_on_screen) {
  217. #ifndef USE_CLEARSCREEN
  218. X                    erase_thread_arrow ();
  219. #endif                    
  220. X                    thread_index_point++;
  221. X                    show_thread_page ();
  222. X                } else {
  223. X                    erase_thread_arrow ();
  224. X                    thread_index_point++;
  225. X                    draw_thread_arrow ();
  226. X                }
  227. X                break;
  228. X
  229. X            case ctrl('P'):
  230. X            case 'k':        /* line up */
  231. thread_up:
  232. X                if (! thread_index_point)
  233. X                    break;
  234. X
  235. X                if (thread_index_point <= first_thread_on_screen) {
  236. X                    thread_index_point--;
  237. X                    show_thread_page ();
  238. X                } else {
  239. X                    erase_thread_arrow ();
  240. X                    thread_index_point--;
  241. X                    draw_thread_arrow ();
  242. X                }
  243. X                break;
  244. X
  245. X            case ctrl('U'):        /* page up */
  246. X            case 'b':
  247. thread_page_up:
  248. #ifndef USE_CLEARSCREEN
  249. X                clear_message ();
  250. #endif
  251. X                erase_thread_arrow ();
  252. X                scroll_lines = (full_page_scroll ? NOTESLINES : NOTESLINES / 2);
  253. X                if ((n = thread_index_point % scroll_lines) > 0) {
  254. X                    thread_index_point = thread_index_point - n;
  255. X                } else {
  256. X                    thread_index_point = ((thread_index_point - scroll_lines) / scroll_lines) * scroll_lines;
  257. X                }
  258. X                if (thread_index_point < 0) {
  259. X                    thread_index_point = 0;
  260. X                }
  261. X                if (thread_index_point < first_thread_on_screen
  262. X                || thread_index_point >= last_thread_on_screen)
  263. X                    show_thread_page ();
  264. X                else
  265. X                    draw_thread_arrow ();
  266. X                break;
  267. X
  268. X            case 'h':    /* help */
  269. X                show_info_page (HELP_INFO, help_thread, txt_thread_com);
  270. X                show_thread_page ();
  271. X                break;
  272. X
  273. X            case 'I':    /* toggle inverse video */
  274. X                toggle_inverse_video ();
  275. X                show_thread_page ();
  276. X                break;
  277. X
  278. X            case 'i':    /* return */
  279. X            case 'q':
  280. X            case 't':
  281. X                goto thread_done;
  282. X
  283. X            case 'K':    /* mark thread as read */
  284. X                for (i = (int) base[thread_basenote] ; i != -1 ; i = arts[i].thread) {
  285. X                    arts[i].unread = ART_READ;
  286. X                }
  287. X                goto thread_done;
  288. X                break;
  289. X
  290. X             case 'T':    /* tag/untag art for mailing/piping/printing/saving */
  291. X                 if (thread_index_point == 0) {
  292. X                     n = thread_respnum;
  293. X                 } else {
  294. X                     n = choose_response (thread_basenote, thread_index_point);
  295. X                 }
  296. X                 if (n < 0)
  297. X                     break;
  298. X                 if (arts[n].tagged) {
  299. X                     arts[n].tagged = 0;
  300. X                     info_message (txt_untagged_art);
  301. X                 } else {
  302. X                     arts[n].tagged = ++num_of_tagged_files;
  303. X                    info_message (txt_tagged_art);
  304. X                 }
  305. X                 show_thread_page ();
  306. X                 break;
  307. X
  308. X            case 'v':    /* version */
  309. X                info_message (cvers);
  310. X                break;
  311. X
  312. X            case 'z':    /* mark article as unread */
  313. X                if (thread_index_point == 0) {
  314. X                    n = thread_respnum;
  315. X                } else {
  316. X                    n = choose_response (thread_basenote, thread_index_point);
  317. X                }
  318. X                if (n >= 0) {
  319. X                    arts[n].unread = ART_UNREAD;
  320. X                    show_thread_page ();
  321. X                    info_message (txt_art_marked_as_unread);
  322. X                }
  323. X                break;
  324. X
  325. X            case 'Z':    /* mark thread as unread */
  326. X                for (i = (int) base[thread_basenote] ; i != -1 ; i = arts[i].thread) {
  327. X                    arts[i].unread = ART_UNREAD;
  328. X                }
  329. X                show_thread_page ();
  330. X                info_message (txt_thread_marked_as_unread);
  331. X                break;
  332. X                
  333. X            default:
  334. X                info_message (txt_bad_command);
  335. X        }
  336. X    }
  337. X
  338. thread_done:
  339. X    clear_note_area ();
  340. X
  341. #endif /* INDEX_DAEMON */
  342. X
  343. X    return TRUE;
  344. }
  345. X
  346. X
  347. void show_thread_page ()
  348. {
  349. #ifndef INDEX_DAEMON
  350. X
  351. X    extern int index_point;
  352. X    char new_resps[8];
  353. X    char from[LEN];
  354. X    char subject[LEN];
  355. X    int i, j;
  356. X    static int index = 0;
  357. X
  358. X    set_signals_thread ();
  359. X    
  360. X    ClearScreen ();
  361. X
  362. X    if (threaded_on_subject) {
  363. X        sprintf (msg, "Thread (%s)", arts[thread_respnum].subject);
  364. X    } else {
  365. X        sprintf (msg, "List Thread (%d of %d)", index_point+1, top_base);
  366. X    }
  367. X    show_title (msg);
  368. X
  369. X    MoveCursor (INDEX_TOP, 0);
  370. X    if (thread_index_point > top_thread - 1) {
  371. X        thread_index_point = top_thread - 1;
  372. X    }
  373. X
  374. X    if (NOTESLINES <= 0) {
  375. X        first_thread_on_screen = 0;
  376. X    } else {
  377. X        first_thread_on_screen = (thread_index_point / NOTESLINES) * NOTESLINES;
  378. X        if (first_thread_on_screen < 0) {
  379. X            first_thread_on_screen = 0;
  380. X        }
  381. X    }
  382. X
  383. X    last_thread_on_screen = first_thread_on_screen + NOTESLINES;
  384. X
  385. X    if (last_thread_on_screen >= top_thread) {
  386. X        last_thread_on_screen = top_thread;
  387. X        first_thread_on_screen = (top_thread / NOTESLINES) * NOTESLINES;
  388. X
  389. X        if (first_thread_on_screen == last_thread_on_screen ||
  390. X            first_thread_on_screen < 0) {
  391. X            if (first_thread_on_screen < 0) {
  392. X                first_thread_on_screen = 0;
  393. X            } else {
  394. X                first_thread_on_screen = last_thread_on_screen - NOTESLINES;
  395. X            }
  396. X        }
  397. X    }
  398. X
  399. X    if (top_thread == 0) {
  400. X        first_thread_on_screen = 0;
  401. X        last_thread_on_screen = 0;
  402. X    }
  403. X
  404. X    index = choose_response (thread_basenote, first_thread_on_screen);
  405. X    assert(first_thread_on_screen != 0 || index == thread_respnum);
  406. X
  407. X    for (j=0, i = first_thread_on_screen; j < NOTESLINES && i < last_thread_on_screen; i++, j++) {
  408. X        if (arts[index].tagged) {
  409. X            sprintf (new_resps, "%3d", arts[index].tagged);
  410. X        } else if (arts[index].unread == ART_UNREAD) {
  411. X            sprintf (new_resps, "  %c", UNREAD_ART_MARK);
  412. X        } else if (arts[index].unread == ART_WILL_RETURN) {
  413. X            sprintf (new_resps, "  %c", RETURN_ART_MARK);
  414. X        } else {
  415. X            strcpy (new_resps, "   ");
  416. X        }
  417. X
  418. X        get_author (TRUE, index, from);
  419. X
  420. X        if (draw_arrow_mark) {
  421. X            if (threaded_on_subject) {
  422. X                printf ("  %4d%3s  %s\r\n", i, new_resps, from);
  423. X            } else {
  424. X                my_strncpy (subject, arts[index].subject, max_subj);
  425. X                printf ("  %4d%3s  %-*s   %-*s\r\n",
  426. X                    i, new_resps, max_subj, subject, max_from, from);
  427. X            }
  428. X        } else {
  429. X            if (threaded_on_subject) {
  430. X                sprintf (screen[j].col, "  %4d%3s  %-*s\r\n", i, new_resps, max_subj+max_from+5, from);
  431. X            } else {
  432. X                my_strncpy (subject, arts[index].subject, max_subj+2);
  433. X                sprintf (screen[j].col, "  %4d%3s  %-*s   %-*s\r\n",
  434. X                    i, new_resps, max_subj+2, subject, max_from, from);
  435. X            }
  436. X            printf ("%s", screen[j].col);
  437. X        }
  438. X        
  439. X        if ((index = next_response (index)) == -1) {
  440. X            break;
  441. X        }    
  442. X    }
  443. X
  444. #ifndef USE_CLEARSCREEN
  445. X    CleartoEOS ();
  446. #endif
  447. X
  448. X    if (last_thread_on_screen == top_thread) {
  449. X        info_message (txt_end_of_thread);
  450. X    }
  451. X
  452. X    draw_thread_arrow ();
  453. X
  454. #endif /* INDEX_DAEMON */
  455. }
  456. X
  457. X
  458. void draw_thread_arrow ()
  459. {
  460. X    draw_arrow (INDEX_TOP + (thread_index_point-first_thread_on_screen));
  461. }
  462. X
  463. X
  464. void erase_thread_arrow ()
  465. {
  466. X    erase_arrow (INDEX_TOP + (thread_index_point-first_thread_on_screen));
  467. }
  468. X
  469. X
  470. int prompt_thread_num (ch)
  471. X    char ch;
  472. {
  473. X    int num;
  474. X
  475. X    clear_message ();
  476. X
  477. X    if ((num = prompt_num (ch, txt_read_art)) == -1) {
  478. X        clear_message ();
  479. X        return FALSE;
  480. X    }
  481. X
  482. X    if (num >= top_thread)
  483. X        num = top_thread - 1;
  484. X
  485. X    if (num >= first_thread_on_screen
  486. X    &&  num < last_thread_on_screen) {
  487. X        erase_thread_arrow ();
  488. X        thread_index_point = num;
  489. X        draw_thread_arrow ();
  490. X    } else {
  491. #ifndef USE_CLEARSCREEN
  492. X        erase_thread_arrow ();
  493. #endif        
  494. X        thread_index_point = num;
  495. X        show_thread_page ();
  496. X    }
  497. X    return TRUE;
  498. }
  499. X
  500. /*
  501. X *  Return the number of unread articles there are within a thread
  502. X */
  503. X
  504. int new_responses (thread)
  505. X    int thread;
  506. {
  507. X    int i;
  508. X    int sum = 0;
  509. X
  510. X    for (i = (int) base[thread]; i >= 0; i = arts[i].thread) {
  511. X        if (arts[i].unread) {
  512. X            sum++;
  513. X        }
  514. X    }
  515. X    
  516. X    return sum;
  517. }
  518. X
  519. /*
  520. X *  Which base note (an index into base[]) does a respnum
  521. X *  (an index into arts[]) corresponsd to?
  522. X *
  523. X *  In other words, base[] points to an entry in arts[] which is
  524. X *  the head of a thread, linked with arts[].thread.  For any q: arts[q],
  525. X *  find i such that base[i]->arts[n]->arts[o]->...->arts[q]
  526. X *
  527. X *  Note that which_thread() can return -1 if in show_read_only mode and
  528. X *  the article of interest has been read as well as all other articles in
  529. X *  the thread,  thus resulting in no base[] entry for it.
  530. X */
  531. X
  532. int which_thread (n)
  533. X    int n;
  534. {
  535. X    register int i, j;
  536. X
  537. X    for (i = 0; i < top_base; i++) {
  538. X        for (j = (int) base[i] ; j >= 0 ; j = arts[j].thread) {
  539. X            if (j == n) {
  540. X                return i;
  541. X            }
  542. X        }
  543. X    }
  544. X
  545. X    sprintf (msg, "%d", n);
  546. X    error_message (txt_cannot_find_base_art, msg);
  547. X    return -1;
  548. }
  549. X
  550. /*
  551. X *  Find how deep in a thread a response is.  Start counting at zero
  552. X */
  553. X
  554. int which_response (n)
  555. X    int n;
  556. {
  557. X    int i, j;
  558. X    int num = 0;
  559. X
  560. X    i = which_thread (n);
  561. X    assert(i >= 0);
  562. X
  563. X    for (j = (int) base[i]; j != -1; j = arts[j].thread)
  564. X        if (j == n)
  565. X            break;
  566. X        else
  567. X            num++;
  568. X
  569. X    return num;
  570. }
  571. X
  572. /*
  573. X *  Given an index into base[], find the number of responses for
  574. X *  that basenote
  575. X */
  576. X
  577. int num_of_responses (n)
  578. X    int n;
  579. {
  580. X    int i;
  581. X    int oldi = -3;
  582. X    int sum = 0;
  583. X
  584. X    assert (n < top_base);
  585. X
  586. X    for (i = (int) base[n]; i != -1; i = arts[i].thread) {
  587. X        assert (i != -2);
  588. X        assert (i != oldi);
  589. X        oldi = i;
  590. X        sum++;
  591. X    }
  592. X
  593. X    return sum - 1;
  594. }
  595. X
  596. /*
  597. X *  Find the next response.  Go to the next basenote if there
  598. X *  are no more responses in this thread
  599. X */
  600. X
  601. int next_response (n)
  602. X    int n;
  603. {
  604. X    int i;
  605. X
  606. X    if (arts[n].thread >= 0)
  607. X        return arts[n].thread;
  608. X
  609. X    i = which_thread (n) + 1;
  610. X
  611. X    if (i >= top_base)
  612. X        return -1;
  613. X
  614. X    return (int) base[i];
  615. }
  616. X
  617. /*
  618. X *  Given a respnum (index into arts[]), find the respnum of the
  619. X *  next basenote
  620. X */
  621. X
  622. int next_thread (n)
  623. X    int n;
  624. {
  625. X    int i;
  626. X
  627. X    i = which_thread (n) + 1;
  628. X    if (i >= top_base)
  629. X        return -1;
  630. X
  631. X    return (int) base[i];
  632. }
  633. X
  634. /*
  635. X *  Find the previous response.  Go to the last response in the previous
  636. X *  thread if we go past the beginning of this thread.
  637. X */
  638. X
  639. int prev_response (n)
  640. X    int n;
  641. {
  642. X    int resp;
  643. X    int i;
  644. X
  645. X    resp = which_response (n);
  646. X
  647. X    if (resp > 0)
  648. X        return choose_response (which_thread (n), resp-1);
  649. X
  650. X    i = which_thread (n) - 1;
  651. X
  652. X    if (i < 0)
  653. X        return -1;
  654. X
  655. X    return choose_response (i, num_of_responses (i));
  656. }
  657. X
  658. /*
  659. X *  return response number n from thread i
  660. X */
  661. X
  662. int choose_response (i, n)
  663. X    int i;
  664. X    int n;
  665. {
  666. X    int j;
  667. X
  668. X    j = (int) base[i];
  669. X
  670. X    while (n-- && arts[j].thread >= 0) {
  671. X        j = arts[j].thread;
  672. X    }
  673. X
  674. X    return j;
  675. }
  676. X
  677. /*
  678. X *  Find the next unread response in this group 
  679. X */
  680. X
  681. int next_unread (n)
  682. X    int n;
  683. {
  684. X    while (n >= 0) {
  685. X        if (arts[n].unread == ART_UNREAD) {
  686. X            return n;
  687. X        }
  688. X        n = next_response (n);
  689. X    }
  690. X
  691. X    return -1;
  692. }
  693. X
  694. X
  695. /*
  696. X *  Find the previous unread response in this thread
  697. X */
  698. X
  699. int prev_unread (n)
  700. X    int n;
  701. {
  702. X    while (n >= 0) {
  703. X        if (arts[n].unread == ART_UNREAD) {
  704. X            return n;
  705. X        }
  706. X        n = prev_response (n);
  707. X    }
  708. X
  709. X    return -1;
  710. }
  711. SHAR_EOF
  712. echo 'File thread.c is complete' &&
  713. chmod 0600 thread.c ||
  714. echo 'restore of thread.c failed'
  715. Wc_c="`wc -c < 'thread.c'`"
  716. test 14471 -eq "$Wc_c" ||
  717.     echo 'thread.c: original size 14471, current size' "$Wc_c"
  718. rm -f _shar_wnt_.tmp
  719. fi
  720. # ============= wildmat.c ==============
  721. if test -f 'wildmat.c' -a X"$1" != X"-c"; then
  722.     echo 'x - skipping wildmat.c (File already exists)'
  723.     rm -f _shar_wnt_.tmp
  724. else
  725. > _shar_wnt_.tmp
  726. echo 'x - extracting wildmat.c (Text)'
  727. sed 's/^X//' << 'SHAR_EOF' > 'wildmat.c' &&
  728. /*  $Revision: 1.5 $
  729. **
  730. **  Do shell-style pattern matching for ?, \, [], and * characters.
  731. **  Might not be robust in face of malformed patterns; e.g., "foo[a-"
  732. **  could cause a segmentation violation.  It is 8bit clean.
  733. **
  734. **  Written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
  735. **  Rich $alz is now <rsalz@bbn.com>.
  736. **  April, 1991:  Replaced mutually-recursive calls with in-line code
  737. **  for the star character.
  738. **
  739. **  Special thanks to Lars Mathiesen <thorinn@diku.dk> for the ABORT code.
  740. **  This can greatly speed up failing wildcard patterns.  For example:
  741. **    pattern: -*-*-*-*-*-*-12-*-*-*-m-*-*-*
  742. **    text 1:     -adobe-courier-bold-o-normal--12-120-75-75-m-70-iso8859-1
  743. **    text 2:     -adobe-courier-bold-o-normal--12-120-75-75-X-70-iso8859-1
  744. **  Text 1 matches with 51 calls, while text 2 fails with 54 calls.  Without
  745. **  the ABORT, then it takes 22310 calls to fail.  Ugh.  The following
  746. **  explanation is from Lars:
  747. **  The precondition that must be fulfilled is that DoMatch will consume
  748. **  at least one character in text.  This is true if *p is neither '*' nor
  749. **  '\0'.)  The last return has ABORT instead of FALSE to avoid quadratic
  750. **  behaviour in cases like pattern "*a*b*c*d" with text "abcxxxxx".  With
  751. **  FALSE, each star-loop has to run to the end of the text; with ABORT
  752. **  only the last one does.
  753. **
  754. **  Once the control of one instance of DoMatch enters the star-loop, that
  755. **  instance will return either TRUE or ABORT, and any calling instance
  756. **  will therefore return immediately after (without calling recursively
  757. **  again).  In effect, only one star-loop is ever active.  It would be
  758. **  possible to modify the code to maintain this context explicitly,
  759. **  eliminating all recursive calls at the cost of some complication and
  760. **  loss of clarity (and the ABORT stuff seems to be unclear enough by
  761. **  itself).  I think it would be unwise to try to get this into a
  762. **  released version unless you have a good test data base to try it out
  763. **  on.
  764. */
  765. X
  766. #define TRUE            1
  767. #define FALSE            0
  768. #define ABORT            -1
  769. X
  770. X
  771. X    /* What character marks an inverted character class? */
  772. #define NEGATE_CLASS        '^'
  773. X    /* Is "*" a common pattern? */
  774. #define OPTIMIZE_JUST_STAR
  775. X    /* Do tar(1) matching rules, which ignore a trailing slash? */
  776. #undef MATCH_TAR_PATTERN
  777. X
  778. X
  779. /*
  780. **  Match text and p, return TRUE, FALSE, or ABORT.
  781. */
  782. static int
  783. DoMatch(text, p)
  784. X    register char    *text;
  785. X    register char    *p;
  786. {
  787. X    register int    last;
  788. X    register int    matched;
  789. X    register int    reverse;
  790. X
  791. X    for ( ; *p; text++, p++) {
  792. X    if (*text == '\0' && *p != '*')
  793. X        return ABORT;
  794. X    switch (*p) {
  795. X    case '\\':
  796. X        /* Literal match with following character. */
  797. X        p++;
  798. X        /* FALLTHROUGH */
  799. X    default:
  800. X        if (*text != *p)
  801. X        return FALSE;
  802. X        continue;
  803. X    case '?':
  804. X        /* Match anything. */
  805. X        continue;
  806. X    case '*':
  807. X        while (*++p == '*')
  808. X        /* Consecutive stars act just like one. */
  809. X        continue;
  810. X        if (*p == '\0')
  811. X        /* Trailing star matches everything. */
  812. X        return TRUE;
  813. X        while (*text)
  814. X        if ((matched = DoMatch(text++, p)) != FALSE)
  815. X            return matched;
  816. X        return ABORT;
  817. X    case '[':
  818. X        reverse = p[1] == NEGATE_CLASS ? TRUE : FALSE;
  819. X        if (reverse)
  820. X        /* Inverted character class. */
  821. X        p++;
  822. X        matched = FALSE;
  823. X        if (p[1] == ']' || p[1] == '-')
  824. X        if (*++p == *text)
  825. X            matched = TRUE;
  826. X        for (last = *p; *++p && *p != ']'; last = *p)
  827. X        /* This next line requires a good C compiler. */
  828. X        if (*p == '-' && p[1] != ']'
  829. X            ? *text <= *++p && *text >= last : *text == *p)
  830. X            matched = TRUE;
  831. X        if (matched == reverse)
  832. X        return FALSE;
  833. X        continue;
  834. X    }
  835. X    }
  836. X
  837. #ifdef    MATCH_TAR_PATTERN
  838. X    if (*text == '/')
  839. X    return TRUE;
  840. #endif    /* MATCH_TAR_ATTERN */
  841. X    return *text == '\0';
  842. }
  843. X
  844. X
  845. /*
  846. **  User-level routine.  Returns TRUE or FALSE.
  847. */
  848. int
  849. wildmat(text, p)
  850. X    char    *text;
  851. X    char    *p;
  852. {
  853. #ifdef    OPTIMIZE_JUST_STAR
  854. X    if (p[0] == '*' && p[1] == '\0')
  855. X    return TRUE;
  856. #endif    /* OPTIMIZE_JUST_STAR */
  857. X    return DoMatch(text, p) == TRUE;
  858. }
  859. X
  860. X
  861. X
  862. #ifdef    TEST
  863. #include <stdio.h>
  864. X
  865. /* Yes, we use gets not fgets.  Sue me. */
  866. extern char    *gets();
  867. X
  868. X
  869. main()
  870. {
  871. X    char     p[80];
  872. X    char     text[80];
  873. X
  874. X    printf("Wildmat tester.  Enter pattern, then strings to test.\n");
  875. X    printf("A blank line gets prompts for a new pattern; a blank pattern\n");
  876. X    printf("exits the program.\n");
  877. X
  878. X    for ( ; ; ) {
  879. X    printf("\nEnter pattern:  ");
  880. X    (void)fflush(stdout);
  881. X    if (gets(p) == NULL || p[0] == '\0')
  882. X        break;
  883. X    for ( ; ; ) {
  884. X        printf("Enter text:  ");
  885. X        (void)fflush(stdout);
  886. X        if (gets(text) == NULL)
  887. X        exit(0);
  888. X        if (text[0] == '\0')
  889. X        /* Blank line; go back and get a new pattern. */
  890. X        break;
  891. X        printf("      %s\n", wildmat(text, p) ? "YES" : "NO");
  892. X    }
  893. X    }
  894. X
  895. X    exit(0);
  896. X    /* NOTREACHED */
  897. }
  898. #endif    /* TEST */
  899. SHAR_EOF
  900. chmod 0600 wildmat.c ||
  901. echo 'restore of wildmat.c failed'
  902. Wc_c="`wc -c < 'wildmat.c'`"
  903. test 4749 -eq "$Wc_c" ||
  904.     echo 'wildmat.c: original size 4749, current size' "$Wc_c"
  905. rm -f _shar_wnt_.tmp
  906. fi
  907. # ============= tin.h ==============
  908. if test -f 'tin.h' -a X"$1" != X"-c"; then
  909.     echo 'x - skipping tin.h (File already exists)'
  910.     rm -f _shar_wnt_.tmp
  911. else
  912. > _shar_wnt_.tmp
  913. echo 'x - extracting tin.h (Text)'
  914. sed 's/^X//' << 'SHAR_EOF' > 'tin.h' &&
  915. /*
  916. X *  Project   : tin - a threaded Netnews reader
  917. X *  Module    : tin.h
  918. X *  Author    : I.Lea & R.Skrenta
  919. X *  Created   : 01-04-91
  920. X *  Updated   : 21-03-92
  921. X *  Notes     : #include files, #defines & struct's
  922. X *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  923. X *              You may  freely  copy or  redistribute  this software,
  924. X *              so  long as there is no profit made from its use, sale
  925. X *              trade or  reproduction.  You may not change this copy-
  926. X *              right notice, and it must be included in any copy made
  927. X */
  928. X
  929. #include    <stdio.h>
  930. #include    <signal.h>
  931. #include    <sys/types.h>
  932. #include    <pwd.h>
  933. #if !defined(MINIX) && !defined(__convexc__)
  934. #    include    <memory.h>
  935. #endif
  936. #include    <ctype.h>
  937. #include    <time.h>
  938. #include    <sys/stat.h>
  939. X
  940. #ifdef BSD
  941. #    include    <strings.h>
  942. #    include    <fcntl.h>
  943. #else
  944. #    include    <string.h>
  945. #    ifndef MINIX
  946. #        include    <malloc.h>
  947. #    else
  948. #        include    <stdlib.h>
  949. #    endif
  950. #endif
  951. X
  952. #ifdef M_XENIX
  953. #    include    <prototypes.h>
  954. #endif
  955. X
  956. /*
  957. X * Needed for resizing under an xterm
  958. X */
  959. X
  960. #if defined(SIGWINCH)
  961. #    include    <sys/ioctl.h>
  962. #    ifndef TIOCGWINSZ
  963. #        if !defined(sinix) && !defined(nsc)
  964. #            ifdef SCO_UNIX
  965. #                include    <sys/streams.h>
  966. #            else
  967. #                include <sys/stream.h>
  968. #            endif
  969. #            include <sys/ptem.h>
  970. #            include <sys/tty.h>
  971. #            ifndef SVR4
  972. #                include <sys/pty.h>
  973. #            endif
  974. #        endif
  975. #    endif
  976. #endif
  977. X
  978. #if defined(NNTP_ABLE) || defined(NNTP_ONLY)
  979. #    ifndef NNTP_ABLE
  980. #        define    NNTP_ABLE
  981. #    endif
  982. #    ifdef NNTP_EXTS
  983. #        ifndef NNTP_XUSER
  984. #            define    NNTP_XUSER
  985. #        endif
  986. #        ifndef NNTP_XINDEX
  987. #            define    NNTP_XINDEX
  988. #        endif
  989. #    endif
  990. #    ifdef NNTP_XUSER
  991. #        ifndef LOG_USER
  992. #            define    LOG_USER
  993. #        endif
  994. #    endif
  995. #endif
  996. X
  997. /*
  998. X * Index file daemon version of tin. Will create/update index files from cron
  999. X * on NNTP server machine so clients can retreive index file with NNTP XINDEX
  1000. X * command from server. Also can be used on machines that just want one copy
  1001. X * of all the index files in one place. In this case the normal tin must have
  1002. X * access to the index directory or be setuid news.
  1003. X */
  1004. #ifdef INDEX_DAEMON
  1005. #    undef NNTP_ABLE
  1006. #    undef NNTP_ONLY
  1007. #    undef NNTP_XUSER
  1008. #    undef NNTP_XINDEX
  1009. #endif
  1010. X
  1011. #ifndef SIGTYPE
  1012. #    if defined(sony)
  1013. #        define    SIGTYPE    int
  1014. #    else
  1015. #        if defined(__STDC__) || defined(__GNUC__) || \
  1016. X           defined(sinix)    || defined(sun) || defined(ultrix)
  1017. #            define    SIGTYPE    void
  1018. #        else
  1019. #            define    SIGTYPE    int
  1020. #        endif
  1021. #    endif
  1022. #endif
  1023. X
  1024. #ifndef SPOOLDIR
  1025. #    define        SPOOLDIR    "/usr/spool/news"
  1026. #endif
  1027. #ifndef LIBDIR
  1028. #    define        LIBDIR        "/usr/lib/news"
  1029. #endif
  1030. #ifndef INEWSDIR
  1031. #    define        INEWSDIR    LIBDIR
  1032. #endif
  1033. X
  1034. #define        DEFAULT_SHELL    "/bin/sh"
  1035. X
  1036. #ifdef BSD
  1037. #    define        strchr(str, ch)    index(str, ch)
  1038. #    define        DEFAULT_MAILER    "/bin/mail"
  1039. #    define        DEFAULT_EDITOR    "/usr/ucb/vi"
  1040. #    define        DEFAULT_MAILBOX    "/usr/spool/mail"
  1041. #    define        DEFAULT_PRINTER    "/usr/ucb/lpr"
  1042. #    define        DEFAULT_SUM        "sum"
  1043. #    ifndef USE_LONG_FILENAMES
  1044. #        define USE_LONG_FILENAMES
  1045. #    endif
  1046. #else
  1047. #    ifdef SVR4
  1048. #        define        USE_LONG_FILENAMES
  1049. #    endif
  1050. #    ifdef M_XENIX
  1051. #        define        DEFAULT_EDITOR    "/bin/vi"
  1052. #        define        DEFAULT_MAILBOX    "/usr/spool/mail"
  1053. #    else
  1054. #        define        DEFAULT_EDITOR    "/usr/bin/vi"
  1055. #        define        DEFAULT_MAILBOX    "/usr/mail"
  1056. #    endif
  1057. #    ifdef NCR
  1058. #        define        DEFAULT_MAILER    "/usr/bin/mailx"
  1059. #    endif
  1060. #    ifdef RS6000
  1061. #        define        DEFAULT_PRINTER    "/bin/lp"
  1062. #    endif
  1063. #    ifdef UNIXPC
  1064. #        define        DEFAULT_MAILER    "/bin/rmail"
  1065. #    endif
  1066. #    ifdef sinix
  1067. #        define        DEFAULT_MAILER    "/bin/rmail"
  1068. #        define        DEFAULT_PRINTER    "/bin/lpr"
  1069. #        ifndef USE_LONG_FILENAMES
  1070. #            define USE_LONG_FILENAMES
  1071. #        endif
  1072. #    endif
  1073. #    ifndef DEFAULT_MAILER
  1074. #        define        DEFAULT_MAILER    "/bin/mail"
  1075. #    endif
  1076. #    ifndef DEFAULT_PRINTER
  1077. #        define        DEFAULT_PRINTER    "/usr/bin/lp"
  1078. #    endif
  1079. #    define        DEFAULT_SUM        "sum -r"
  1080. #endif
  1081. X
  1082. #ifdef USE_LONG_FILENAMES
  1083. #    define        LONG_PATH_PART    "part"
  1084. #    define        LONG_PATH_PATCH    "patch"
  1085. #else
  1086. #    define        LONG_PATH_PART    ""
  1087. #    define        LONG_PATH_PATCH    "p"
  1088. #endif
  1089. X
  1090. #ifdef LOG_USER
  1091. #    define        LOG_USER_FILE    "/tmp/.tin_log" 
  1092. #endif
  1093. X
  1094. #ifndef NO_RESYNC_ACTIVE_FILE
  1095. #    ifndef RESYNC_ACTIVE_SECS
  1096. #        define    RESYNC_ACTIVE_SECS    300    /* reread active every n secs */
  1097. #    endif
  1098. #endif
  1099. X
  1100. #define        DEFAULT_ACTIVE_NUM    1800    /* initial size of active array */
  1101. #define        DEFAULT_ARTICLE_NUM    400        /* initial size of art array */ 
  1102. #define        DEFAULT_KILL_NUM    10        /* initial size of kill array */ 
  1103. #define        DEFAULT_SAVE_NUM    10        /* initial size of save array */ 
  1104. X
  1105. #define        RCDIR            ".tin"
  1106. #define        RCFILE            "tinrc"
  1107. #define        INDEXDIR        ".index"
  1108. #define        KILLFILE        "kill"
  1109. #define        POSTFILE        "posted"
  1110. #define        UNTHREADFILE    "unthread"
  1111. #define        DEFAULT_MAILDIR    "Mail"
  1112. X
  1113. #define BUG_REPORT_ADDRESS    "iain%anl433.uucp@germany.eu.net"
  1114. X
  1115. #ifdef TRUE
  1116. #    undef TRUE
  1117. #endif
  1118. #define        TRUE        1
  1119. X
  1120. #ifdef FALSE
  1121. #    undef FALSE
  1122. #endif
  1123. #define        FALSE        0
  1124. X
  1125. #define        LEN                    1024
  1126. #define        MODULO_COUNT_NUM    5
  1127. #define        HEADER_LEN            1024
  1128. #define        TABLE_SIZE            1409
  1129. #define        MAX_PAGES            1000
  1130. #define        ctrl(c)                ((c) & 0x1F)
  1131. X
  1132. X
  1133. #ifndef DEFAULT_COMMENT
  1134. #    define        DEFAULT_COMMENT    ": "    /* used when by follow-ups & replys */
  1135. #endif
  1136. #ifndef UNREAD_ART_MARK
  1137. #    define        UNREAD_ART_MARK    '+'    /* used to show that an art is unread */
  1138. #endif
  1139. #ifndef RETURN_ART_MARK
  1140. #    define        RETURN_ART_MARK    '-'    /* used to show that an art will return */
  1141. #endif
  1142. X
  1143. #ifdef USE_INVERSE_HACK
  1144. #    define        BLANK_SELECT_COLS    30
  1145. #    define        BLANK_GROUP_COLS    2
  1146. #    define        BLANK_PAGE_COLS        2
  1147. #else
  1148. #    define        BLANK_SELECT_COLS    58
  1149. #    define        BLANK_GROUP_COLS    0
  1150. #    define        BLANK_PAGE_COLS        0
  1151. #endif
  1152. X
  1153. #define        SCREEN_READ_UNREAD        6        /* position for "  +" / "   " */
  1154. #define        DEFAULT_COLS            132        /* used when updating indexes */
  1155. #define        INDEX_TOP                2
  1156. X
  1157. /*
  1158. X *  used by get_arrow_key()
  1159. X */
  1160. X
  1161. #define        KEYMAP_UNKNOWN            0
  1162. #define        KEYMAP_UP                1
  1163. #define        KEYMAP_DOWN                2
  1164. #define        KEYMAP_PAGE_UP            3
  1165. #define        KEYMAP_PAGE_DOWN        4
  1166. #define        KEYMAP_HOME                5
  1167. #define        KEYMAP_END                6
  1168. X
  1169. /*
  1170. X *  used by feed.c - feed_articles()
  1171. X */
  1172. #define        SELECT_LEVEL            1
  1173. #define        GROUP_LEVEL                2
  1174. #define        PAGE_LEVEL                3
  1175. X
  1176. #define        FEED_MAIL                1
  1177. #define        FEED_PIPE                2
  1178. #define        FEED_PRINT                3
  1179. #define        FEED_SAVE                4
  1180. X
  1181. /*
  1182. X *  used in art.c & rcfile.c
  1183. X */
  1184. #define        SORT_BY_NOTHING            0        /* sort types on arts[] array */
  1185. #define        SORT_BY_SUBJ_DESCEND    1
  1186. #define        SORT_BY_SUBJ_ASCEND        2
  1187. #define        SORT_BY_FROM_DESCEND    3
  1188. #define        SORT_BY_FROM_ASCEND        4
  1189. #define        SORT_BY_DATE_DESCEND    5
  1190. #define        SORT_BY_DATE_ASCEND        6
  1191. X
  1192. #define        SHOW_FROM_NONE            0
  1193. #define        SHOW_FROM_ADDR            1
  1194. #define        SHOW_FROM_NAME            2
  1195. #define        SHOW_FROM_BOTH            3
  1196. X
  1197. /*
  1198. X *  used in help.c
  1199. X */
  1200. X
  1201. #define        HELP_INFO                0
  1202. #define        POST_INFO                1
  1203. X
  1204. /*
  1205. X *  used in save.c
  1206. X */
  1207. X
  1208. #define        CHECK_ANY_NEWS            0
  1209. #define        START_ANY_NEWS            1
  1210. #define        MAIL_ANY_NEWS            2
  1211. #define        SAVE_ANY_NEWS            3
  1212. X
  1213. /*
  1214. X *  used in help.c
  1215. X */
  1216. X
  1217. #define        HEADER_TO                0
  1218. #define        HEADER_SUBJECT            1
  1219. X
  1220. /*
  1221. X *  used in page.c & post.c
  1222. X */
  1223. X
  1224. #define        POSTED_NONE                0
  1225. #define        POSTED_REDRAW            1
  1226. #define        POSTED_OK                2
  1227. X
  1228. /*
  1229. X *  Assertion verifier
  1230. X */
  1231. X
  1232. #if __STDC__
  1233. #    define    assert(p)    if(! (p)) asfail(__FILE__, __LINE__, #p); else
  1234. #else
  1235. #    define    assert(p)    if(! (p)) asfail(__FILE__, __LINE__, "p"); else
  1236. #endif
  1237. X
  1238. #define        ESC        27
  1239. #if defined(BSD) || defined(MINIX)
  1240. #    define        CR        '\r'
  1241. #else
  1242. #    define        CR        10
  1243. #endif
  1244. X
  1245. /*
  1246. X * return codes for change_rcfile ()
  1247. X */
  1248. X
  1249. #define        NO_KILLING        0
  1250. #define        KILLING            1
  1251. X
  1252. /*
  1253. X *  art.thread
  1254. X */
  1255. X
  1256. #define        ART_NORMAL        -1
  1257. #define        ART_EXPIRED        -2
  1258. X
  1259. /*
  1260. X *  art.unread
  1261. X */
  1262. X
  1263. #define        ART_READ        0
  1264. #define        ART_UNREAD        1
  1265. #define        ART_WILL_RETURN    2
  1266. X
  1267. /*
  1268. X * used by group_t & my_group[]
  1269. X */
  1270. #define        UNSUBSCRIBED    0x01    /* haven't put in my_group[] yet */
  1271. #define        SUBSCRIBED        0x02    /* subscribed to */
  1272. X
  1273. /*
  1274. X * kill_type used in struct kill_t
  1275. X */
  1276. #define KILL_SUBJ    1
  1277. #define KILL_FROM    2
  1278. #define KILL_BOTH    3
  1279. X
  1280. /*
  1281. X * used in feed.c & save.c
  1282. X */
  1283. #define POST_PROC_NONE            0
  1284. #define POST_PROC_SHAR            1
  1285. #define POST_PROC_UUDECODE        2
  1286. #define POST_PROC_UUD_LST_ZOO    3
  1287. #define POST_PROC_UUD_EXT_ZOO    4
  1288. X
  1289. /*
  1290. X *  struct article_t - article header
  1291. X *
  1292. X *  article.artnum:
  1293. X *    article number in spool directory for group
  1294. X *
  1295. X *  article.thread:
  1296. X *    initially -1
  1297. X *    points to another arts[] (struct article_t): zero and up
  1298. X *    -2 means article has expired (wasn't found in file search
  1299. X *    of spool directory for the group)
  1300. X *
  1301. X *  article.inthread:
  1302. X *    FALSE for the first article in a thread, TRUE for all
  1303. X *    following articles in thread
  1304. X *
  1305. X *  article.unread:
  1306. X *    boolean, has this article been read or not
  1307. X *
  1308. X *  article.date
  1309. X *  date: line used for sorting articles by date order
  1310. X *
  1311. X *  article.archive:
  1312. X *    archive name used in *source* groups
  1313. X *
  1314. X *  article.part:
  1315. X *    part no. of archive
  1316. X *
  1317. X *  article.patch:
  1318. X *    patch no. of archive
  1319. X *
  1320. X *  article.killed:
  1321. X *    boolean, has this article been killed
  1322. X *
  1323. X *  article.tagged:
  1324. X *    boolean, has this article been tagged for saving or not
  1325. X */
  1326. X
  1327. struct article_t {
  1328. X    long artnum;
  1329. X    char *subject;    /* Subject: line from mail header */
  1330. X    char *from;        /* From: line from mail header (address) */
  1331. X    char *name;        /* From: line from mail header (full name) */
  1332. X    int thread;
  1333. X    int inthread;
  1334. X    int unread;        /* 0 = read, 1 = unread, 2 = will return */
  1335. X    char date[16];    /* Date: line from mail header */
  1336. X    char *archive;    /* Archive-name: line from mail header */
  1337. X    char *part;        /* part no. of archive */
  1338. X    char *patch;    /* patch no. of archive */
  1339. X    int killed;        /* 0 = not killed, 1 = killed */
  1340. X    int tagged;        /* 0 = not tagged, 1 = tagged */
  1341. };
  1342. X
  1343. /*
  1344. X *  struct group_t - newsgroup info from active file
  1345. X */
  1346. X
  1347. struct group_t {
  1348. X    char *name;
  1349. X    long max;
  1350. X    long min;
  1351. X    char moderated;
  1352. X    int next;        /* next active entry in hash chain */
  1353. X    int flag;
  1354. X    int read;        /* marked TRUE if group was entered during session */
  1355. X    int thread;        /* marked FALSE if group is not to be threaded */
  1356. };
  1357. X
  1358. /*
  1359. X *  used in hashstr.c
  1360. X */
  1361. struct hashnode {
  1362. X    char *s;                        /* the string we're saving */
  1363. X    struct hashnode *next;            /* chain for spillover */
  1364. };
  1365. X
  1366. /*
  1367. X *  used in kill.c
  1368. X */
  1369. struct kill_t {
  1370. X    int kill_type;
  1371. X    long kill_group;
  1372. X    char *kill_subj;
  1373. X    char *kill_from;
  1374. };
  1375. X
  1376. struct save_t {
  1377. X    char *subject;
  1378. X    char *dir;
  1379. X    char *file;
  1380. X    char *archive;
  1381. X    char *part;
  1382. X    char *patch;
  1383. X    int index;    
  1384. X    int saved;    
  1385. X    int is_mailbox;    
  1386. };
  1387. X
  1388. struct screen_t {
  1389. X    char *col;
  1390. };
  1391. X
  1392. struct posted_t {
  1393. X    char date[10];
  1394. X    char group[80];
  1395. X    char subj[120];
  1396. };
  1397. X
  1398. /*
  1399. X *  function prototypes    & extern definitions    
  1400. X */ 
  1401. X
  1402. #include    "patchlev.h"
  1403. #include    "extern.h"
  1404. #include    "proto.h"
  1405. SHAR_EOF
  1406. chmod 0600 tin.h ||
  1407. echo 'restore of tin.h failed'
  1408. Wc_c="`wc -c < 'tin.h'`"
  1409. test 10183 -eq "$Wc_c" ||
  1410.     echo 'tin.h: original size 10183, current size' "$Wc_c"
  1411. rm -f _shar_wnt_.tmp
  1412. fi
  1413. # ============= extern.h ==============
  1414. if test -f 'extern.h' -a X"$1" != X"-c"; then
  1415.     echo 'x - skipping extern.h (File already exists)'
  1416.     rm -f _shar_wnt_.tmp
  1417. else
  1418. > _shar_wnt_.tmp
  1419. echo 'x - extracting extern.h (Text)'
  1420. sed 's/^X//' << 'SHAR_EOF' > 'extern.h' &&
  1421. /*
  1422. X *  Project   : tin - a threaded Netnews reader
  1423. X *  Module    : lang.h
  1424. X *  Author    : I.Lea
  1425. X *  Created   : 01-04-91
  1426. X *  Updated   : 21-03-92
  1427. X *  Notes     :
  1428. X *  Copyright : (c) Copyright 1991-92 by Iain Lea
  1429. X *              You may  freely  copy or  redistribute  this software,
  1430. X *              so  long as there is no profit made from its use, sale
  1431. X *              trade or  reproduction.  You may not change this copy-
  1432. X *              right notice, and it must be included in any copy made
  1433. X */
  1434. X
  1435. /*
  1436. X * Library functions
  1437. X */
  1438. X
  1439. #if !defined(__STDC__)
  1440. extern char *getenv();
  1441. #endif
  1442. X
  1443. extern int optind;
  1444. extern char *optarg;
  1445. X
  1446. /*
  1447. X * Local variables
  1448. X */
  1449. extern char *help_group[];
  1450. extern char *help_page[];
  1451. extern char *help_select[];
  1452. extern char *help_thread[];
  1453. extern char active_file[LEN];
  1454. extern char add_addr[LEN];
  1455. extern char art_search_string[LEN];
  1456. extern char article[LEN];
  1457. extern char author_search_string[LEN];
  1458. extern char bug_addr[LEN];
  1459. extern char cvers[LEN];
  1460. extern char dead_article[LEN];
  1461. extern char default_mail_address[LEN];
  1462. extern char default_pipe_command[LEN];
  1463. extern char default_post_subject[LEN];
  1464. extern char default_regex_pattern[LEN];
  1465. extern char default_save_file[LEN];
  1466. extern char default_shell_command[LEN];
  1467. extern char delgroups[LEN];
  1468. extern char group_search_string[LEN];
  1469. extern char homedir[LEN];
  1470. extern char indexdir[LEN];
  1471. extern char killfile[LEN];
  1472. extern char killfrom[LEN];
  1473. extern char killsubj[LEN];
  1474. extern char mail_news_user[LEN];
  1475. extern char mailbox[LEN];
  1476. extern char maildir[LEN];
  1477. extern char mailer[LEN];
  1478. extern char msg[LEN];
  1479. extern char my_org[LEN];
  1480. extern char newnewsrc[LEN];
  1481. extern char newsrc[LEN];
  1482. extern char nntp_server[LEN];
  1483. extern char page_header[LEN];
  1484. extern char postfile[LEN];
  1485. extern char printer[LEN];
  1486. extern char cmd_line_printer[LEN];
  1487. extern char proc_ch_default;                /* set in change_rcfile () */
  1488. extern char progname[LEN];
  1489. extern char rcdir[LEN];
  1490. extern char rcfile[LEN];
  1491. extern char redirect_output[LEN];
  1492. extern char reply_to[LEN];
  1493. extern char savedir[LEN];
  1494. extern char sig[LEN];
  1495. extern char signature[LEN];
  1496. extern char spooldir[LEN];
  1497. extern char subject_search_string[LEN];
  1498. extern char subscriptions_file[LEN];
  1499. extern char txt_help_bug_report[LEN];
  1500. extern char unthreadfile[LEN];
  1501. extern char userid[LEN];
  1502. X
  1503. extern char txt_group[];
  1504. extern char txt_cannot_open_art[];
  1505. extern char txt_indexing[];
  1506. extern char txt_indexing_num[];
  1507. extern char txt_corrupt_index[];
  1508. extern char txt_checking_for_news[];
  1509. extern char txt_there_is_no_news[];
  1510. extern char txt_killing_arts[];
  1511. extern char txt_unkilling_arts[];
  1512. extern char txt_art_thread_regex_tag[];
  1513. extern char txt_post_process_type[];
  1514. extern char txt_feed_pattern[];
  1515. extern char txt_no_command[];
  1516. extern char txt_piping[];
  1517. extern char txt_cannot_post[];
  1518. extern char txt_tagged_art[];
  1519. extern char txt_untagged_art[];
  1520. extern char txt_inverse_on[];
  1521. extern char txt_inverse_off[];
  1522. extern char txt_subscribed_to[];
  1523. extern char txt_unsubscribed_to[];
  1524. extern char txt_mark_all_read[];
  1525. extern char txt_no_more_groups[];
  1526. extern char txt_no_prev_group[];
  1527. extern char txt_no_arts[];
  1528. extern char txt_no_groups[];
  1529. extern char txt_end_of_thread[];
  1530. extern char txt_end_of_arts[];
  1531. extern char txt_end_of_groups[];
  1532. extern char txt_no_next_unread_art[];
  1533. extern char txt_no_prev_unread_art[];
  1534. extern char txt_no_last_message[];
  1535. extern char txt_bad_command[];
  1536. extern char txt_you_have_mail[];
  1537. extern char txt_type_h_for_help[];
  1538. extern char txt_read_art[];
  1539. extern char txt_author_search_forwards[];
  1540. extern char txt_author_search_backwards[];
  1541. extern char txt_search_forwards[];
  1542. extern char txt_search_backwards[];
  1543. extern char txt_no_search_string[];
  1544. extern char txt_no_match[];
  1545. extern char txt_post_subject[];
  1546. extern char txt_no_subject[];
  1547. extern char txt_cannot_open[];
  1548. extern char txt_posting[];
  1549. extern char txt_art_posted[];
  1550. extern char txt_art_rejected[];
  1551. extern char txt_abort_edit_post[];
  1552. extern char txt_index_page_com[];
  1553. extern char txt_thread_com[];
  1554. extern char txt_help_i_4[];
  1555. extern char txt_help_ctrl_k[];
  1556. extern char txt_help_ctrl_l[];
  1557. extern char txt_help_ctrl_d[];
  1558. extern char txt_help_i_cr[];
  1559. extern char txt_help_i_tab[];
  1560. extern char txt_help_d[];
  1561. extern char txt_help_l[];
  1562. extern char txt_help_m[];
  1563. extern char txt_help_M[];
  1564. extern char txt_help_a[];
  1565. extern char txt_help_sel_c[];
  1566. extern char txt_help_c[];
  1567. extern char txt_help_g[];
  1568. extern char txt_help_I[];
  1569. extern char txt_help_K[];
  1570. extern char txt_help_t_K[];
  1571. extern char txt_help_j[];
  1572. extern char txt_help_i_n[];
  1573. extern char txt_help_i_p[];
  1574. extern char txt_help_q[];
  1575. extern char txt_help_r[];
  1576. extern char txt_help_s[];
  1577. extern char txt_help_S[];
  1578. extern char txt_help_t[];
  1579. extern char txt_help_T[];
  1580. extern char txt_help_u[];
  1581. extern char txt_help_U[];
  1582. extern char txt_help_v[];
  1583. extern char txt_help_w[];
  1584. extern char txt_help_i_search[];
  1585. extern char txt_help_thread[];
  1586. #ifndef NO_SHELL_ESCAPE
  1587. extern char txt_help_shell[];
  1588. #endif
  1589. extern char txt_help_dash[];
  1590. extern char txt_save_pattern[];
  1591. extern char txt_saved_pattern_to[];
  1592. extern char txt_saved_to_mailbox[];
  1593. extern char txt_switch_on_kill_art_menu[];
  1594. extern char txt_post_history_menu[];
  1595. extern char txt_hit_space_for_more[];
  1596. extern char txt_kill_menu[];
  1597. extern char txt_kill_subject[];
  1598. extern char txt_kill_from[];
  1599. extern char txt_kill_text[];
  1600. extern char txt_kill_text_type[];
  1601. extern char txt_kill_group[];
  1602. extern char txt_help_kill_subject[];
  1603. extern char txt_help_kill_from[];
  1604. extern char txt_help_kill_text[];
  1605. extern char txt_help_kill_text_type[];
  1606. extern char txt_help_kill_group[];
  1607. extern char txt_abort_edit_save_killfile[];
  1608. extern char txt_quit[];
  1609. extern char txt_art_unavailable[];
  1610. extern char txt_art_marked_as_unread[];
  1611. extern char txt_thread_marked_as_unread[];
  1612. extern char txt_begin_of_art[];
  1613. extern char txt_next_resp[];
  1614. extern char txt_last_resp[];
  1615. extern char txt_more_percent[];
  1616. extern char txt_more[];
  1617. extern char txt_thread_x_of_n[];
  1618. extern char txt_art[];
  1619. extern char txt_resp_x_of_n[];
  1620. extern char txt_no_resp[];
  1621. extern char txt_1_resp[];
  1622. extern char txt_x_resp[];
  1623. extern char txt_s_at_s[];
  1624. extern char txt_thread_resp_page[];
  1625. extern char txt_thread_page[];
  1626. extern char txt_read_resp[];
  1627. extern char txt_art_pager_com[];
  1628. extern char txt_help_p_0[];
  1629. extern char txt_help_p_4[];
  1630. extern char txt_help_p_cr[];
  1631. extern char txt_help_p_tab[];
  1632. extern char txt_help_b[];
  1633. extern char txt_help_C[];
  1634. extern char txt_help_bug[];
  1635. extern char txt_help_p_f[];
  1636. extern char txt_help_ctrl_h[];
  1637. extern char txt_help_h[];
  1638. extern char txt_help_p_i[];
  1639. extern char txt_help_p_k[];
  1640. extern char txt_help_p_m[];
  1641. extern char txt_help_p_n[];
  1642. extern char txt_help_o[];
  1643. extern char txt_help_p_p[];
  1644. extern char txt_help_p_r[];
  1645. extern char txt_help_p_s[];
  1646. extern char txt_help_p_z[];
  1647. extern char txt_help_p_ctrl_r[];
  1648. extern char txt_help_p_g[];
  1649. extern char txt_help_p_d[];
  1650. extern char txt_help_pipe[];
  1651. extern char txt_help_p_search[];
  1652. extern char txt_mail_art_to[];
  1653. extern char txt_no_mail_address[];
  1654. extern char txt_abort_edit_send[];
  1655. extern char txt_abort_edit_cancel[];
  1656. extern char txt_cancelling[];
  1657. extern char txt_art_cancelled[];
  1658. extern char txt_mailing_to[];
  1659. extern char txt_message_sent[];
  1660. extern char txt_command_failed_s[];
  1661. extern char txt_in_art_you_write[];
  1662. extern char txt_resp_to_poster[];
  1663. extern char txt_resp_redirect[];
  1664. extern char txt_continue[];
  1665. extern char txt_writes[];
  1666. extern char txt_writes_name[];
  1667. extern char txt_save_filename[];
  1668. extern char txt_art_not_saved[];
  1669. extern char txt_no_filename[];
  1670. extern char txt_saving[];
  1671. extern char txt_art_saved_to[];
  1672. extern char txt_thread_not_saved[];
  1673. extern char txt_thread_saved_to_many[];
  1674. extern char txt_thread_saved_to[];
  1675. extern char txt_pipe_to_command[];
  1676. extern char txt_command_failed[];
  1677. extern char txt_printing[];
  1678. extern char txt_printed[];
  1679. extern char txt_append_to_file[];
  1680. extern char txt_hit_any_key[];
  1681. extern char txt_option_not_enabled[];
  1682. extern char txt_not_in_active_file[];
  1683. extern char txt_screen_init_failed[];
  1684. extern char txt_bad_active_file[];
  1685. extern char txt_creating_newsrc[];
  1686. extern char txt_deleting_from_newsrc[];
  1687. extern char txt_cannot_open_active_file[];
  1688. extern char txt_reading_active_file[];
  1689. extern char txt_active_file_is_empty[];
  1690. extern char txt_subscribe_to_new_group[];
  1691. extern char txt_checking_active_file[];
  1692. extern char txt_checking[];
  1693. extern char txt_cannot_find_base_art[];
  1694. extern char txt_out_of_memory[];
  1695. extern char txt_rename_error[];
  1696. extern char txt_shell_escape[];
  1697. extern char txt_connecting[];
  1698. extern char txt_cannot_get_nntp_server_name[];
  1699. extern char txt_server_name_in_file_env_var[];
  1700. extern char txt_failed_to_connect_to_server[];
  1701. extern char txt_rejected_by_nntpserver[];
  1702. extern char txt_connection_to_server_broken[];
  1703. extern char txt_stuff_nntp_cannot_open[];
  1704. extern char txt_nntp_to_fp_cannot_reopen[];
  1705. extern char txt_nntp_to_fd_cannot_reopen[];
  1706. extern char txt_toggled_rot13[];
  1707. extern char txt_no_arts_posted[];
  1708. extern char txt_post_an_article[];
  1709. extern char txt_post_a_followup[];
  1710. extern char txt_mail_bug_report[];
  1711. extern char txt_mail_bug_report_confirm[];
  1712. extern char txt_reply_to_author[];
  1713. extern char txt_opt_autosave[];
  1714. extern char txt_opt_save_separate[];
  1715. extern char txt_opt_mark_saved_read[];
  1716. extern char txt_opt_kill_articles[];
  1717. extern char txt_opt_show_author[];
  1718. extern char txt_opt_draw_arrow[];
  1719. extern char txt_opt_post_process[];
  1720. extern char txt_opt_print_header[];
  1721. extern char txt_opt_pos_first_unread[];
  1722. extern char txt_opt_page_scroll[];
  1723. extern char txt_opt_catchup_groups[];
  1724. extern char txt_opt_thread_arts[];
  1725. extern char txt_opt_show_only_unread[];
  1726. extern char txt_opt_process_type[];
  1727. extern char txt_opt_sort_type[];
  1728. extern char txt_show_from_none[];
  1729. extern char txt_show_from_addr[];
  1730. extern char txt_show_from_name[];
  1731. extern char txt_show_from_both[];
  1732. extern char txt_post_process_none[];
  1733. extern char txt_post_process_sh[];
  1734. extern char txt_post_process_uudecode[];
  1735. extern char txt_post_process_uud_lst_zoo[];
  1736. extern char txt_post_process_uud_ext_zoo[];
  1737. extern char txt_sort_by_nothing[];
  1738. extern char txt_sort_by_subj_descend[];
  1739. extern char txt_sort_by_subj_ascend[];
  1740. extern char txt_sort_by_from_descend[];
  1741. extern char txt_sort_by_from_ascend[];
  1742. extern char txt_sort_by_date_descend[];
  1743. extern char txt_sort_by_date_ascend[];
  1744. extern char txt_opt_savedir[];
  1745. extern char txt_opt_maildir[];
  1746. extern char txt_opt_printer[];
  1747. extern char txt_options_menu[];
  1748. extern char txt_help_autosave[];
  1749. extern char txt_help_save_separate[];
  1750. extern char txt_help_print_header[];
  1751. extern char txt_help_pos_first_unread[];
  1752. extern char txt_help_show_author[];
  1753. extern char txt_help_draw_arrow[];
  1754. extern char txt_help_kill_articles[];
  1755. extern char txt_help_mark_saved_read[];
  1756. extern char txt_help_page_scroll[];
  1757. extern char txt_help_catchup_groups[];
  1758. extern char txt_help_thread_arts[];
  1759. extern char txt_help_show_only_unread[];
  1760. extern char txt_help_post_proc_type[];
  1761. extern char txt_help_sort_type[];
  1762. extern char txt_help_savedir[];
  1763. extern char txt_help_maildir[];
  1764. extern char txt_help_printer[];
  1765. extern char txt_select_rcfile_option[];
  1766. extern char txt_post_processing[];
  1767. extern char txt_post_processing_finished[];
  1768. extern char txt_deleting[];
  1769. extern char txt_uudecoding[];
  1770. extern char txt_searching[];
  1771. extern char txt_moving[];
  1772. extern char txt_subscribe_pattern[];
  1773. extern char txt_unsubscribe_pattern[];
  1774. extern char txt_subscribing[];
  1775. extern char txt_subscribing_to[];
  1776. extern char txt_unsubscribing[];
  1777. extern char txt_unsubscribing_from[];
  1778. extern char txt_subscribed_num_groups[];
  1779. extern char txt_unsubscribed_num_groups[];
  1780. extern char txt_del_group_in_newsrc[];
  1781. extern char txt_group_deleted[];
  1782. extern char txt_group_undeleted[];
  1783. extern char txt_mark_group_read[];
  1784. extern char txt_no_groups_to_delete[];
  1785. extern char txt_reset_newsrc[];
  1786. extern char txt_post_newsgroup[];
  1787. extern char txt_yanking_all_groups[];
  1788. extern char txt_yanking_sub_groups[];
  1789. extern char txt_no_groups_to_read[];
  1790. extern char txt_added_groups[];
  1791. extern char txt_plural[];
  1792. extern char txt_no_groups_to_yank_in[];
  1793. extern char txt_group_selection[];
  1794. extern char txt_select_group[];
  1795. extern char txt_group_select_com[];
  1796. extern char txt_help_g_4[];
  1797. extern char txt_help_g_ctrl_r[];
  1798. extern char txt_help_g_ctrl_k[];
  1799. extern char txt_help_g_cr[];
  1800. extern char txt_help_g_tab[];
  1801. extern char txt_help_g_c[];
  1802. extern char txt_help_n[];
  1803. extern char txt_help_W[];
  1804. extern char txt_help_g_y[];
  1805. extern char txt_help_g_z[];
  1806. extern char txt_help_g_dollar[];
  1807. extern char txt_help_g_search[];
  1808. extern char txt_newsgroup[];
  1809. extern char txt_newsgroup_position[];
  1810. extern char txt_resizing_window[];
  1811. extern char txt_no_resps_in_thread[];
  1812. extern char txt_help_t_0[];
  1813. extern char txt_help_t_4[];
  1814. extern char txt_help_t_cr[];
  1815. extern char txt_help_t_tab[];
  1816. X
  1817. extern int LINES, COLS;
  1818. extern int MORE_POS;
  1819. extern int NOTESLINES;
  1820. extern int RIGHT_POS;
  1821. extern int *my_group;
  1822. extern int *unread;
  1823. extern int can_post;
  1824. extern int catchup;
  1825. extern int catchup_read_groups;
  1826. extern int cmd_line;
  1827. extern int compiled_with_nntp;
  1828. extern int created_rcdir;
  1829. extern int debug;
  1830. extern int default_printer;
  1831. extern int default_show_author;
  1832. #ifdef SIGTSTP
  1833. extern int do_sigtstp;
  1834. #endif
  1835. extern int draw_arrow_mark;
  1836. extern int full_page_scroll;
  1837. extern int group_hash[TABLE_SIZE];
  1838. extern int group_top;
  1839. extern int index_file_killed;
  1840. extern int inverse_okay;
  1841. extern int kill_articles;
  1842. extern int kill_num;
  1843. extern int local_index;
  1844. extern int mail_news;
  1845. extern int mark_saved_read;
  1846. extern int max_active;
  1847. extern int max_art;
  1848. extern int max_from;
  1849. extern int max_subj;
  1850. extern int max_kill;
  1851. extern int max_save;
  1852. extern int nntp_codeno;
  1853. extern int num_active;
  1854. extern int num_of_killed_files;
  1855. extern int num_of_tagged_files;
  1856. extern int pos_first_unread;
  1857. extern int post_proc_type;
  1858. extern int print_header;
  1859. extern int process_id;
  1860. extern int read_news_via_nntp;
  1861. extern int real_gid;
  1862. extern int real_uid;
  1863. extern int save_archive_name;
  1864. extern int save_news;
  1865. extern int save_num;
  1866. extern int save_separate;
  1867. extern int show_author;
  1868. extern int show_only_unread;
  1869. extern int sort_art_type;
  1870. extern int space_mode;
  1871. extern int start_line_offset;
  1872. extern int thread_arts;
  1873. extern int tin_gid;
  1874. extern int tin_uid;
  1875. extern int top;
  1876. extern int top_base;
  1877. extern int unlink_article;
  1878. extern int update;
  1879. extern int verbose;
  1880. extern int update_fork;
  1881. extern int check_any_unread;
  1882. extern int start_any_unread;
  1883. extern int notify_new_groups;
  1884. X
  1885. extern long *base;
  1886. X
  1887. extern struct passwd *myentry;
  1888. extern struct article_t *arts;
  1889. extern struct group_t *active;
  1890. extern struct kill_t *killf;
  1891. extern struct posted_t *posted;
  1892. extern struct save_t *save;
  1893. extern struct screen_t *screen;
  1894. X
  1895. #ifdef POSIX_JOB_CONTROL
  1896. extern struct sigaction art_act;
  1897. extern struct sigaction group_act;
  1898. extern struct sigaction kill_act;
  1899. extern struct sigaction main_act;
  1900. extern struct sigaction old_act;
  1901. extern struct sigaction page_act;
  1902. extern struct sigaction rcfile_act;
  1903. extern struct sigaction select_act;
  1904. extern struct sigaction thread_act;
  1905. #endif
  1906. SHAR_EOF
  1907. chmod 0600 extern.h ||
  1908. echo 'restore of extern.h failed'
  1909. Wc_c="`wc -c < 'extern.h'`"
  1910. test 14795 -eq "$Wc_c" ||
  1911.     echo 'extern.h: original size 14795, current size' "$Wc_c"
  1912. rm -f _shar_wnt_.tmp
  1913. fi
  1914. # ============= nntp.h ==============
  1915. if test -f 'nntp.h' -a X"$1" != X"-c"; then
  1916.     echo 'x - skipping nntp.h (File already exists)'
  1917.     rm -f _shar_wnt_.tmp
  1918. else
  1919. > _shar_wnt_.tmp
  1920. echo 'x - extracting nntp.h (Text)'
  1921. sed 's/^X//' << 'SHAR_EOF' > 'nntp.h' &&
  1922. /*
  1923. X *  Project   : tin - a threaded Netnews reader
  1924. X *  Module    : nntp.h
  1925. X *  Author    : I.Lea & R.Skrenta
  1926. X *  Created   : 01-04-91
  1927. X *  Updated   : 10-03-92
  1928. X *  Notes     : Changed a bit so nntp knows about Tin
  1929. X *              This file is originally from the nntp 1.5 source.
  1930. X *  Copyright : (c) Copyright 1991-92 by Iain Lea & Rich Skrenta
  1931. X *              You may  freely  copy or  redistribute  this software,
  1932. X *              so  long as there is no profit made from its use, sale
  1933. X *              trade or  reproduction.  You may not change this copy-
  1934. X *              right notice, and it must be included in any copy made
  1935. X */
  1936. X
  1937. #ifndef    NNTP_SERVER_FILE
  1938. #    define    NNTP_SERVER_FILE    "/etc/nntpserver"
  1939. #endif
  1940. X
  1941. /*
  1942. X *  External routine declarations
  1943. X */
  1944. X
  1945. extern char *getserverbyfile();
  1946. extern int server_init();
  1947. extern int get_tcp_socket();
  1948. extern int handle_server_response();
  1949. extern void put_server();
  1950. extern int get_server();
  1951. extern void close_server();
  1952. X
  1953. /*
  1954. X *  External file descriptors for the server connection
  1955. X */
  1956. X
  1957. extern FILE *ser_wr_fp;
  1958. X
  1959. /*
  1960. X * Response codes for NNTP server
  1961. X *
  1962. X * @(#)nntp.h    1.7    (Berkeley) 1/11/88
  1963. X *
  1964. X * First digit:
  1965. X *
  1966. X *    1xx    Informative message
  1967. X *    2xx    Command ok
  1968. X *    3xx    Command ok so far, continue
  1969. X *    4xx    Command was correct, but couldn't be performed
  1970. X *        for some specified reason.
  1971. X *    5xx    Command unimplemented, incorrect, or a
  1972. X *        program error has occured.
  1973. X *
  1974. X * Second digit:
  1975. X *
  1976. X *    x0x    Connection, setup, miscellaneous
  1977. X *    x1x    Newsgroup selection
  1978. X *    x2x    Article selection
  1979. X *    x3x    Distribution
  1980. X *    x4x    Posting
  1981. X */
  1982. X
  1983. #define    CHAR_INF    '1'
  1984. #define    CHAR_OK        '2'
  1985. #define    CHAR_CONT    '3'
  1986. #define    CHAR_ERR    '4'
  1987. #define    CHAR_FATAL    '5'
  1988. X
  1989. #define    INF_HELP        100    /* Help text on way */
  1990. #define    INF_DEBUG        199    /* Debug output */
  1991. X
  1992. #define    OK_CANPOST        200    /* Hello; you can post */
  1993. #define    OK_NOPOST        201    /* Hello; you can't post */
  1994. #define    OK_SLAVE        202    /* Slave status noted */
  1995. #define    OK_GOODBYE        205    /* Closing connection */
  1996. #define    OK_GROUP        211    /* Group selected */
  1997. #define    OK_GROUPS        215    /* Newsgroups follow */
  1998. X
  1999. #define OK_XINDEX        218    /* Tin index follows */
  2000. X
  2001. #define    OK_ARTICLE        220    /* Article (head & body) follows */
  2002. #define    OK_HEAD            221    /* Head follows */
  2003. #define    OK_BODY            222    /* Body follows */
  2004. #define    OK_NOTEXT        223    /* No text sent -- stat, next, last */
  2005. #define    OK_NEWNEWS        230    /* New articles by message-id follow */
  2006. #define    OK_NEWGROUPS        231    /* New newsgroups follow */
  2007. #define    OK_XFERED        235    /* Article transferred successfully */
  2008. #define    OK_POSTED        240    /* Article posted successfully */
  2009. X
  2010. #define CONT_XFER        335    /* Continue to send article */
  2011. #define    CONT_POST        340    /* Continue to post article */
  2012. X
  2013. #define    ERR_GOODBYE        400    /* Have to hang up for some reason */
  2014. #define    ERR_NOGROUP        411    /* No such newsgroup */
  2015. #define    ERR_NCING        412    /* Not currently in newsgroup */
  2016. X
  2017. #define ERR_XINDEX        418    /* No tin index for this group */
  2018. X
  2019. #define    ERR_NOCRNT        420    /* No current article selected */
  2020. #define    ERR_NONEXT        421    /* No next article in this group */
  2021. #define    ERR_NOPREV        422    /* No previous article in this group */
  2022. #define    ERR_NOARTIG        423    /* No such article in this group */
  2023. #define ERR_NOART        430    /* No such article at all */
  2024. #define ERR_GOTIT        435    /* Already got that article, don't send */
  2025. #define ERR_XFERFAIL        436    /* Transfer failed */
  2026. #define    ERR_XFERRJCT        437    /* Article rejected, don't resend */
  2027. #define    ERR_NOPOST        440    /* Posting not allowed */
  2028. #define    ERR_POSTFAIL        441    /* Posting failed */
  2029. X
  2030. #define    ERR_COMMAND        500    /* Command not recognized */
  2031. SHAR_EOF
  2032. true || echo 'restore of nntp.h failed'
  2033. fi
  2034. echo 'End of tin1.1 part 11'
  2035. echo 'File nntp.h is continued in part 12'
  2036. echo 12 > _shar_seq_.tmp
  2037. exit 0
  2038.  
  2039. --
  2040. NAME   Iain Lea 
  2041. EMAIL  iain%anl433.uucp@germany.eu.net
  2042. SNAIL  Siemens AG, ANL A433SZ, Gruendlacher Str. 248, 8510 Fuerth, Germany.
  2043. PHONE  +49-911-3089-407 (work) +49-911-331963 (home) +49-911-3089-290 (FAX)  
  2044. -- 
  2045.  Dr. med. dipl.-math Dieter Becker           Tel.: (0 / +49) 6841 - 16 3046
  2046.  Medizinische Universitaets- und Poliklinik  Fax.: (0 / +49) 6841 - 16 3369
  2047.  Innere Medizin III                         
  2048.  D - 6650 Homburg / Saar                     Email: becker@med-in.uni-sb.de
  2049. exit 0 # Just in case...
  2050.