home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3900 < prev    next >
Encoding:
Internet Message Format  |  1991-08-24  |  49.7 KB

  1. Path: wupost!uunet!mcsun!unido!estevax!norisc!iain
  2. From: iain@norisc.UUCP (Iain Lea)
  3. Newsgroups: alt.sources
  4. Subject: tin v1.00 - YAN (Yet Another Newsreader) Part 05/08
  5. Message-ID: <586@norisc.UUCP>
  6. Date: 23 Aug 91 13:54:45 GMT
  7. Sender: iain@norisc.UUCP (Iain Lea)
  8. Organization: What organization?
  9. Lines: 2054
  10.  
  11. Submitted-by: iain@estevax.uucp
  12. Archive-name: tin/part05
  13.  
  14. #!/bin/sh
  15. # this is tin.shar.05 (part 5 of tin)
  16. # do not concatenate these parts, unpack them in order with /bin/sh
  17. # file page.c continued
  18. #
  19. if touch 2>&1 | fgrep '[-amc]' > /dev/null
  20.  then TOUCH=touch
  21.  else TOUCH=true
  22. fi
  23. if test ! -r shar3_seq_.tmp; then
  24.     echo "Please unpack part 1 first!"
  25.     exit 1
  26. fi
  27. (read Scheck
  28.  if test "$Scheck" != 5; then
  29.     echo "Please unpack part $Scheck next!"
  30.     exit 1
  31.  else
  32.     exit 0
  33.  fi
  34. ) < shar3_seq_.tmp || exit 1
  35. echo "x - Continuing file page.c"
  36. sed 's/^X//' << 'SHAR_EOF' >> page.c &&
  37. X                arts[respnum].unread = ART_WILL_RETURN;
  38. X                info_message(txt_art_marked_as_unread);
  39. X                break;
  40. X
  41. X            default:
  42. X                info_message(txt_bad_command);
  43. X        }
  44. X    }
  45. X}
  46. X
  47. X
  48. Xvoid redraw_page(respnum, group)
  49. X    int respnum;
  50. X    char *group;
  51. X{
  52. X
  53. X    if (note_page == NOTE_UNAVAIL) {
  54. X        ClearScreen();
  55. X        printf(txt_art_unavailable, arts[respnum].artnum);
  56. X        fflush(stdout);
  57. X    } else if (note_page > 0) {
  58. X        note_page--;
  59. X        fseek(note_fp, note_mark[note_page], 0);
  60. X        show_note_page(respnum, group);
  61. X    }
  62. X}
  63. X
  64. X
  65. Xvoid show_note_page (respnum, group)
  66. X    int respnum;
  67. X    char *group;
  68. X{
  69. X    char buf[LEN+1];
  70. X    char buf2[LEN+50];
  71. X    int percent;
  72. X    char *p, *q;
  73. X    int i, j;
  74. X    int ctrl_L;        /* form feed character detected */
  75. X
  76. X    ClearScreen();
  77. X
  78. X    note_line = 1;
  79. X
  80. X    if (note_page == 0)
  81. X        show_first_header (respnum, group);
  82. X    else
  83. X        show_cont_header (respnum);
  84. X
  85. X    ctrl_L = FALSE;
  86. X    while (note_line < LINES) {
  87. X        if (fgets(buf, LEN, note_fp) == NULL) {
  88. X            note_end = TRUE;
  89. X            break;
  90. X        }
  91. X
  92. X        buf[LEN-1] = '\0';
  93. X        if (rotate)
  94. X            for (p = buf, q = buf2;
  95. X                    *p && *p != '\n' && q<&buf2[LEN]; p++) {
  96. X                if (*p == '\b' && q > buf2) {
  97. X                    q--;
  98. X                } else if (*p == 12) {        /* ^L */
  99. X                    *q++ = '^';
  100. X                    *q++ = 'L';
  101. X                    ctrl_L = TRUE;
  102. X                } else if (*p == '\t') {
  103. X                    i = q - buf2;
  104. X                    j = (i|7) + 1;
  105. X
  106. X                    while (i++ < j)
  107. X                        *q++ = ' ';
  108. X                } else if (((*p) & 0x7F) < 32) {
  109. X                    *q++ = '^';
  110. X                    *q++ = ((*p) & 0x7F) + '@';
  111. X                } else if (*p >= 'A' && *p <= 'Z')
  112. X                    *q++ = 'A' + (*p - 'A' + rotate) % 26;
  113. X                else if (*p >= 'a' && *p <= 'z')
  114. X                    *q++ = 'a' + (*p - 'a' + rotate) % 26;
  115. X                else
  116. X                    *q++ = *p;
  117. X            }
  118. X        else
  119. X            for (p = buf, q = buf2;
  120. X                    *p && *p != '\n' && q<&buf2[LEN]; p++) {
  121. X                if (*p == '\b' && q > buf2) {
  122. X                    q--;
  123. X                } else if (*p == 12) {        /* ^L */
  124. X                    *q++ = '^';
  125. X                    *q++ = 'L';
  126. X                    ctrl_L = TRUE;
  127. X                } else if (*p == '\t') {
  128. X                    i = q - buf2;
  129. X                    j = (i|7) + 1;
  130. X
  131. X                    while (i++ < j)
  132. X                        *q++ = ' ';
  133. X                } else if (((*p) & 0x7F) < 32) {
  134. X                    *q++ = '^';
  135. X                    *q++ = ((*p) & 0x7F) + '@';
  136. X                } else
  137. X                    *q++ = *p;
  138. X            }
  139. X
  140. X        *q = '\0';
  141. X
  142. X        printf("%s\r\n", buf2);
  143. X
  144. X        note_line += ((int) strlen (buf2) / COLS) + 1;
  145. X
  146. X        if (ctrl_L) {
  147. X            break;
  148. X        }
  149. X    }
  150. X
  151. X    note_mark[++note_page] = ftell(note_fp);
  152. X
  153. X    StartInverse();    
  154. X
  155. X    if (note_end) {
  156. X        MoveCursor(LINES, MORE_POS-5);
  157. X        if (arts[respnum].thread != -1)
  158. X            printf(txt_next_resp);
  159. X        else
  160. X            printf(txt_last_resp);
  161. X    } else {
  162. X        if (note_size > 0) {
  163. X            percent = note_mark[note_page] * 100 / note_size;
  164. X            sprintf (buf, "%s(%d%%) [%ld/%ld]", txt_more, percent, note_mark[note_page], note_size);
  165. X            MoveCursor (LINES, (COLS - (int) strlen (buf))-1);
  166. X            CleartoEOLN ();
  167. X            printf ("%s", buf);
  168. X        } else {
  169. X            MoveCursor(LINES, MORE_POS);
  170. X            printf(txt_more);
  171. X        }
  172. X    }
  173. X
  174. X    EndInverse();
  175. X
  176. X    fflush(stdout);
  177. X}
  178. X
  179. X
  180. Xvoid show_first_header (respnum, group)
  181. X    int respnum;
  182. X    char *group;
  183. X{
  184. X    int whichresp;
  185. X    int x_resp;
  186. X    char buf[LEN+1];
  187. X    char tmp[LEN+1];
  188. X    int pos, i;
  189. X    int n;
  190. X
  191. X    whichresp = which_resp (respnum);
  192. X    x_resp = nresp (which_base (respnum));
  193. X
  194. X    ClearScreen ();
  195. X
  196. X    strcpy (buf, note_h_date);
  197. X    pos = (COLS - (int) strlen (group)) / 2;
  198. X    for (i = strlen(buf); i < pos; i++)
  199. X        buf[i] = ' ';
  200. X    buf[i] = '\0';
  201. X
  202. X    strcat (buf, group);
  203. X
  204. X    for (i = strlen(buf); i < RIGHT_POS; i++)
  205. X        buf[i] = ' ';
  206. X    buf[i] = '\0';
  207. X
  208. X    printf (txt_note_x_of_n, buf, which_base (respnum) + 1, top_base);
  209. X
  210. X    sprintf (buf, txt_art, arts[respnum].artnum);
  211. X    n = strlen (buf);
  212. X    fputs (buf, stdout);
  213. X
  214. X    strcpy (buf, note_h_subj);
  215. X    buf[RIGHT_POS - 2 - n] = '\0';
  216. X
  217. X    pos = ((COLS - (int) strlen (buf)) / 2) - 2;
  218. X
  219. X    if (pos > n) {
  220. X        MoveCursor (1, pos);
  221. X    } else {
  222. X        MoveCursor (1, n);
  223. X    }
  224. X
  225. X    StartInverse ();
  226. X    fputs (buf, stdout);
  227. X    EndInverse ();
  228. X
  229. X    MoveCursor (1, RIGHT_POS);
  230. X    if (whichresp)
  231. X        printf (txt_resp_x_of_n, whichresp, x_resp);
  232. X    else {
  233. X        if (x_resp == 0)
  234. X            printf (txt_no_resp);
  235. X        else if (x_resp == 1)
  236. X            printf (txt_1_resp);
  237. X        else
  238. X            printf (txt_x_resp, x_resp);
  239. X    }
  240. X
  241. X    if (*note_h_org)
  242. X        sprintf (tmp, txt_s_at_s, note_full_name, note_h_org);
  243. X    else
  244. X        strcpy (tmp, note_full_name);
  245. X
  246. X    tmp[LEN] = '\0';
  247. X
  248. X    sprintf (buf, "%s  ", note_from_addr);
  249. X
  250. X    pos = COLS - 1 - (int) strlen(tmp);
  251. X    if ((int) strlen (buf) + (int) strlen (tmp) >= COLS - 1) {
  252. X        strncat (buf, tmp, COLS - 1 - (int) strlen(buf));
  253. X        buf[COLS - 1] = '\0';
  254. X    } else {
  255. X        for (i = strlen(buf); i < pos; i++)
  256. X            buf[i] = ' ';
  257. X        buf[i] = '\0';
  258. X        strcat (buf, tmp);
  259. X    }
  260. X    printf ("%s\r\n\r\n", buf);
  261. X
  262. X    note_line += 4;
  263. X}
  264. X
  265. X
  266. Xvoid show_cont_header (respnum)
  267. X    int respnum;
  268. X{
  269. X    int whichresp;
  270. X    int whichbase;
  271. X    char buf[LEN+1];
  272. X
  273. X    whichresp = which_resp (respnum);
  274. X    whichbase = which_base (respnum);
  275. X
  276. X    assert (whichbase < top_base);
  277. X
  278. X    if (whichresp)
  279. X        sprintf(buf, txt_note_resp_page,
  280. X            whichbase + 1,
  281. X            top_base,
  282. X            whichresp,
  283. X            note_page + 1,
  284. X            note_h_subj);
  285. X    else
  286. X        sprintf(buf, txt_note_page,
  287. X            whichbase + 1,
  288. X            top_base,
  289. X            note_page + 1,
  290. X            note_h_subj);
  291. X
  292. X    buf[COLS] = '\0';
  293. X    printf("%s\r\n\r\n", buf);
  294. X
  295. X    note_line += 2;
  296. X}
  297. X
  298. X
  299. Xvoid open_note (art, group_path)
  300. X    long art;
  301. X    char *group_path;
  302. X{
  303. X    char buf[1025];
  304. X    char *p;
  305. X
  306. X    note_page = 0;
  307. X
  308. X    if ((note_fp = open_art_fp (group_path, art)) == NULL) {
  309. X        note_page = NOTE_UNAVAIL;
  310. X        return;
  311. X    }
  312. X
  313. X    note_h_from[0] = '\0';
  314. X    note_h_path[0] = '\0';
  315. X    note_h_subj[0] = '\0';
  316. X    note_h_org[0] = '\0';
  317. X    note_h_date[0] = '\0';
  318. X    note_h_newsgroups[0] = '\0';
  319. X    note_h_messageid[0] = '\0';
  320. X    note_h_distrib[0] = '\0';
  321. X    note_h_followup[0] = '\0';
  322. X
  323. X    while (fgets(buf, 1024, note_fp) != NULL) {
  324. X        buf[1024] = '\0';
  325. X
  326. X        for (p=buf ; *p && *p != '\n' ; p++) {
  327. X            if (((*p) & 0x7F) < 32)
  328. X                *p = ' ';
  329. X        }
  330. X        *p = '\0';
  331. X        
  332. X        if (*buf == '\0')
  333. X            break;
  334. X
  335. X        if (strncmp(buf, "From: ", 6) == 0) {
  336. X            strcpy(note_h_from, &buf[6]);
  337. X            note_h_from[LEN-1] = '\0';
  338. X        } else if (strncmp(buf, "Path: ", 6) == 0) {
  339. X            strcpy(note_h_path, &buf[6]);
  340. X            note_h_path[LEN-1] = '\0';
  341. X        } else if (strncmp(buf, "Subject: ", 9) == 0) {
  342. X            strcpy(note_h_subj, &buf[9]);
  343. X            note_h_subj[LEN-1] = '\0';
  344. X        } else if (strncmp(buf, "Organization: ", 14) == 0) {
  345. X            strcpy(note_h_org, &buf[14]);
  346. X            note_h_org[LEN-1] = '\0';
  347. X        } else if (strncmp(buf, "Date: ", 6) == 0) {
  348. X            strcpy(note_h_date, &buf[6]);
  349. X            note_h_date[LEN-1] = '\0';
  350. X        } else if (strncmp(buf, "Newsgroups: ", 12) == 0) {
  351. X            strcpy(note_h_newsgroups, &buf[12]);
  352. X            note_h_newsgroups[LEN-1] = '\0';
  353. X        } else if (strncmp(buf, "Message-ID: ", 12) == 0) {
  354. X            strcpy(note_h_messageid, &buf[12]);
  355. X            note_h_messageid[LEN-1] = '\0';
  356. X        } else if (strncmp(buf, "Distribution: ", 14) == 0) {
  357. X            strcpy(note_h_distrib, &buf[14]);
  358. X            note_h_distrib[LEN-1] = '\0';
  359. X        } else if (strncmp(buf, "Followup-To: ", 13) == 0) {
  360. X            strcpy(note_h_followup, &buf[13]);
  361. X            note_h_followup[LEN-1] = '\0';
  362. X        }
  363. X    }
  364. X
  365. X    note_page = 0;
  366. X    note_mark[0] = ftell (note_fp);
  367. X
  368. X    parse_from (note_h_from, note_from_addr, note_full_name);
  369. X    note_end = FALSE;
  370. X
  371. X    return;
  372. X}
  373. X
  374. X
  375. Xvoid note_cleanup()
  376. X{
  377. X    if (note_page != NOTE_UNAVAIL)
  378. X        fclose(note_fp);
  379. X}
  380. X
  381. X
  382. Xint prompt_response(ch, respnum)
  383. X    int respnum;
  384. X{
  385. X    int num;
  386. X
  387. X    clear_message ();
  388. X
  389. X    if ((num = parse_num (ch, txt_read_resp)) == -1) {
  390. X        clear_message ();
  391. X        return -1;
  392. X    }
  393. X
  394. X    return choose_resp (which_base (respnum), num);
  395. X}
  396. X
  397. X/*
  398. X *  return response number n from thread i
  399. X */
  400. X
  401. Xint choose_resp (i, n)
  402. X    int i;
  403. X    int n;
  404. X{
  405. X    int j;
  406. X
  407. X    j = base[i];
  408. X
  409. X    while (n-- && arts[j].thread >= 0) {
  410. X        j = arts[j].thread;
  411. X    }
  412. X
  413. X    return j;
  414. X}
  415. X
  416. X
  417. X/*
  418. X *  Parse various From: lines into the component mail addresses and
  419. X *  real names
  420. X */
  421. X
  422. Xvoid parse_from (str, addr, name)
  423. X    char *str;
  424. X    char *addr;
  425. X    char *name;
  426. X{
  427. X    char *p;
  428. X    
  429. X    for (p=str ; *p ; p++) {
  430. X        if (((*p) & 0x7F) < 32)
  431. X            *p = ' ';
  432. X    }
  433. X
  434. X    while (*str && *str != ' ')
  435. X        *addr++ = *str++;
  436. X    *addr = '\0';
  437. X    if (*str++ == ' ') {
  438. X        if (*str++ == '(') {
  439. X            if (*str == '"')
  440. X                str++;  /* Kill "quotes around names"         */
  441. X                    /* But don't touch quotes inside the  */
  442. X                    /* Name (that's what that nonsense    */
  443. X                    /* below is for                  */
  444. X            while (*str && *str != ')' && !(*str=='"'&&str[1]==')'))
  445. X                *name++ = *str++;
  446. X        }
  447. X    }
  448. X    *name = '\0';
  449. X}
  450. X
  451. X
  452. X/*
  453. X *  Find the previous response.  Go to the last response in the previous
  454. X *  thread if we go past the beginning of this thread.
  455. X */
  456. X
  457. Xint prev_response (n)
  458. X    int n;
  459. X{
  460. X    int resp;
  461. X    int i;
  462. X
  463. X    resp = which_resp (n);
  464. X
  465. X    if (resp > 0)
  466. X        return choose_resp (which_base (n), resp-1);
  467. X
  468. X    i = which_base (n) - 1;
  469. X
  470. X    if (i < 0)
  471. X        return -1;
  472. X
  473. X    return choose_resp (i, nresp (i));
  474. X}
  475. X
  476. X
  477. X/*
  478. X *  Find the next response.  Go to the next basenote if there
  479. X *  are no more responses in this thread
  480. X */
  481. X
  482. Xint next_response (n)
  483. X    int n;
  484. X{
  485. X    int i;
  486. X
  487. X    if (arts[n].thread >= 0)
  488. X        return arts[n].thread;
  489. X
  490. X    i = which_base (n) + 1;
  491. X
  492. X    if (i >= top_base)
  493. X        return -1;
  494. X
  495. X    return base[i];
  496. X}
  497. X
  498. X
  499. X/*
  500. X *  Given a respnum (index into arts[]), find the respnum of the
  501. X *  next basenote
  502. X */
  503. X
  504. Xint next_basenote (n)
  505. X    int n;
  506. X{
  507. X    int i;
  508. X
  509. X    i = which_base (n) + 1;
  510. X    if (i >= top_base)
  511. X        return -1;
  512. X
  513. X    return base[i];
  514. X}
  515. X
  516. X
  517. Xvoid yank_to_addr (orig, addr)
  518. X    char *orig;
  519. X    char *addr;
  520. X{
  521. X    char *p;
  522. X
  523. X    for (p = orig; *p; p++)
  524. X        if (((*p) & 0x7F) < 32)
  525. X            *p = ' ';
  526. X
  527. X    while (*addr)
  528. X        addr++;
  529. X
  530. X    while (*orig) {
  531. X        while (*orig && (*orig == ' ' || *orig == '"' || *orig == ','))
  532. X            orig++;
  533. X        *addr++ = ' ';
  534. X        while (*orig && (*orig != ' ' && *orig != ',' && *orig != '"'))
  535. X            *addr++ = *orig++;
  536. X        while (*orig && (*orig == ' ' || *orig == '"' || *orig == ','))
  537. X            orig++;
  538. X        if (*orig == '(') {
  539. X            while (*orig && *orig != ')')
  540. X                orig++;
  541. X            if (*orig == ')')
  542. X                orig++;
  543. X        }
  544. X    }
  545. X    *addr = '\0';
  546. X}
  547. X
  548. X/*
  549. X *  Read a file grabbing the address given for To: and
  550. X *  sticking it in mail_to
  551. X */
  552. X
  553. Xvoid find_new_to (nam, mail_to)
  554. X    char *nam;
  555. X    char *mail_to;
  556. X{
  557. X    FILE *fp;
  558. X    char buf[LEN+1];
  559. X    char buf2[LEN+1];
  560. X    char new_mail_to[LEN+1];
  561. X    char *p;
  562. X
  563. X    *new_mail_to = '\0';
  564. X
  565. X    if ((fp = fopen(nam, "r")) == NULL) {
  566. X        fprintf(stderr, txt_cannot_open, nam);
  567. X        return;
  568. X    }
  569. X
  570. X    while (fgets(buf, 1024, fp) != NULL) {
  571. X        for (p = buf; *p && *p != '\n'; p++) ;
  572. X        *p = '\0';
  573. X
  574. X        if (*buf == '\0')
  575. X            break;
  576. X
  577. X        if (strncmp(buf, "To: ", 4) == 0) {
  578. X            strncpy(buf2, &buf[4], LEN);
  579. X            buf2[LEN-1] = '\0';
  580. X            yank_to_addr(buf2, new_mail_to);
  581. X        } else if (strncmp(buf, "Cc: ", 4) == 0) {
  582. X            strncpy(buf2, &buf[4], LEN);
  583. X            buf2[LEN-1] = '\0';
  584. X            yank_to_addr(buf2, new_mail_to);
  585. X        }
  586. X    }
  587. X
  588. X    fclose(fp);
  589. X    if (new_mail_to[0] == ' ')
  590. X        my_strncpy(mail_to, &new_mail_to[1], LEN);
  591. X    else
  592. X        my_strncpy(mail_to, new_mail_to, LEN);
  593. X}
  594. X
  595. X
  596. Xint mail_to_someone ()
  597. X{
  598. X    char nam[100];
  599. X    FILE *fp;
  600. X    char ch;
  601. X    char ch_default = 's';
  602. X    char buf[LEN+1];
  603. X    char mail_to[LEN+1];
  604. X
  605. X    if (! parse_string (txt_mail_art_to, mail_to))
  606. X        return FALSE;
  607. X    if (mail_to[0] == '\0')
  608. X        return FALSE;
  609. X
  610. X    setuid (real_uid);
  611. X    setgid (real_gid);
  612. X
  613. X    sprintf(nam, "%s/.letter", homedir);
  614. X    if ((fp = fopen(nam, "w")) == NULL) {
  615. X        error_message (txt_cannot_open, nam);
  616. X        setuid(tin_uid);
  617. X        setgid(tin_gid);
  618. X        return FALSE;
  619. X    }
  620. X    chmod(nam, 0600);
  621. X
  622. X    fprintf(fp, "To: %s\n", mail_to);
  623. X    fprintf(fp, "Subject: %s\n", note_h_subj);
  624. X    if (*note_h_followup)
  625. X        fprintf(fp, "Newsgroups: %s\n\n", note_h_followup);
  626. X    else
  627. X        fprintf(fp, "Newsgroups: %s\n", note_h_newsgroups);
  628. X    if (*my_org)
  629. X        fprintf(fp, "Organization: %s\n", my_org);
  630. X    if (*reply_to)
  631. X        fprintf(fp, "Reply-To: %s\n", reply_to);
  632. X    fputs("\n", fp);
  633. X    
  634. X    fseek(note_fp, 0L, 0);
  635. X    copy_fp(note_fp, fp, "");
  636. X
  637. X    add_signature (fp, TRUE);
  638. X    fclose(fp);
  639. X    
  640. X    while (1) {
  641. X        do {
  642. X            sprintf (msg, "%s%c", txt_abort_edit_send, ch_default);
  643. X            wait_message (msg);
  644. X            MoveCursor(LINES, strlen (txt_abort_edit_send));
  645. X            if ((ch = ReadCh()) == CR)
  646. X                ch = ch_default;
  647. X        } while (ch != 'a' && ch != 'e' && ch != 's');
  648. X
  649. X        switch (ch) {
  650. X        case 'e':
  651. X            start_line_offset = 5;
  652. X            invoke_editor(nam);
  653. X            break;
  654. X
  655. X        case 'a':
  656. X            clear_message();
  657. X            setuid(tin_uid);
  658. X            setgid(tin_gid);
  659. X            return FALSE;
  660. X
  661. X        case 's':
  662. X/*
  663. X *  Open letter and get the To: line in case they changed it with
  664. X *  the editor
  665. X */
  666. X            find_new_to(nam, mail_to);
  667. X            sprintf (msg, txt_mailing_to, mail_to);
  668. X            wait_message (msg);
  669. X            sprintf(buf, "%s \"%s\" < %s", mailer, mail_to, nam);
  670. X            if (invoke_cmd(buf)) {
  671. X                info_message(txt_message_sent);
  672. X                goto mail_to_someone_done;
  673. X            } else {
  674. X                error_message (txt_command_failed_s, buf);
  675. X                break;
  676. X            }
  677. X        }
  678. X    }
  679. X
  680. Xmail_to_someone_done:
  681. X    setuid(tin_uid);
  682. X    setgid(tin_gid);
  683. X
  684. X    return TRUE;
  685. X}
  686. X
  687. X
  688. Xint mail_bug_report ()
  689. X{
  690. X    char nam[100];
  691. X    FILE *fp;
  692. X    char ch;
  693. X    char ch_default = 's';
  694. X    char buf[LEN+1];
  695. X    char mail_to[LEN+1];
  696. X    int start_line = 4;
  697. X    
  698. X    setuid (real_uid);
  699. X    setgid (real_gid);
  700. X
  701. X    sprintf (nam, "%s/.bugreport", homedir);
  702. X    if ((fp = fopen (nam, "w")) == NULL) {
  703. X        error_message (txt_cannot_open, nam);
  704. X        setuid (tin_uid);
  705. X        setgid (tin_gid);
  706. X        return FALSE;
  707. X    }
  708. X    chmod(nam, 0600);
  709. X
  710. X    fprintf (fp, "To: %s\n", BUG_REPORT_ADDRESS);
  711. X    fprintf (fp, "Subject: BUG REPORT %s %s\n", progname, version);
  712. X    if (*my_org) {
  713. X        fprintf (fp, "Organization: %s\n", my_org);
  714. X        start_line++;
  715. X    }
  716. X    if (*reply_to) {
  717. X        fprintf (fp, "Reply-To: %s\n", reply_to);
  718. X        start_line++;
  719. X    }
  720. X    fputs ("\n", fp);
  721. X
  722. X    add_signature (fp, TRUE);
  723. X    fclose (fp);
  724. X    
  725. X    ch = 'e';
  726. X    while (1) {
  727. X        switch (ch) {
  728. X        case 'e':
  729. X            start_line_offset = start_line;
  730. X            invoke_editor (nam);
  731. X            break;
  732. X
  733. X        case 'a':
  734. X            clear_message ();
  735. X            unlink (nam);
  736. X            setuid (tin_uid);
  737. X            setgid (tin_gid);
  738. X            return FALSE;
  739. X
  740. X        case 's':
  741. X            strcpy (mail_to, BUG_REPORT_ADDRESS);
  742. X            find_new_to (nam, mail_to);
  743. X            sprintf (msg, txt_mailing_to, mail_to);
  744. X            wait_message (msg);
  745. X            sprintf (buf, "%s \"%s\" < %s", mailer, mail_to, nam);
  746. X            if (invoke_cmd (buf)) {
  747. X                info_message (txt_message_sent);
  748. X                goto mail_bug_report_done;
  749. X            } else {
  750. X                error_message (txt_command_failed_s, buf);
  751. X                break;
  752. X            }
  753. X        }
  754. X
  755. X        do {
  756. X            sprintf (msg, "%s%c", txt_abort_edit_send, ch_default);
  757. X            wait_message (msg);
  758. X            MoveCursor (LINES, strlen (txt_abort_edit_send));
  759. X            if ((ch = ReadCh ()) == CR)
  760. X                ch = ch_default;
  761. X        } while (ch != 'a' && ch != 'e' && ch != 's');
  762. X    }
  763. X
  764. Xmail_bug_report_done:
  765. X    unlink (nam);
  766. X    
  767. X    setuid (tin_uid);
  768. X    setgid (tin_gid);
  769. X
  770. X    return TRUE;
  771. X}
  772. X
  773. X
  774. Xint mail_to_author (copy_text)
  775. X    int copy_text;
  776. X{
  777. X    char nam[100];
  778. X    FILE *fp;
  779. X    char ch;
  780. X    char ch_default = 's';
  781. X    char buf[LEN+1];
  782. X    char mail_to[LEN+1];
  783. X
  784. X    setuid(real_uid);
  785. X    setgid(real_gid);
  786. X
  787. X    sprintf(nam, "%s/.letter", homedir);
  788. X    if ((fp = fopen(nam, "w")) == NULL) {
  789. X        error_message (txt_cannot_open, nam);
  790. X        setuid(tin_uid);
  791. X        setgid(tin_gid);
  792. X        return(FALSE);
  793. X    }
  794. X    chmod(nam, 0600);
  795. X
  796. X    fprintf(fp, "To: %s%s (%s)\n", note_from_addr, add_addr, note_full_name);
  797. X    fprintf(fp, "Subject: Re: %s\n", eat_re(note_h_subj) );
  798. X    fprintf(fp, "Newsgroups: %s\n", note_h_newsgroups);
  799. X    if (*my_org)
  800. X        fprintf(fp, "Organization: %s\n", my_org);
  801. X    if (*reply_to)
  802. X        fprintf(fp, "Reply-To: %s\n", reply_to);
  803. X    fputs("\n", fp);
  804. X
  805. X    if (copy_text) {        /* if "copy_text" */
  806. X        fprintf(fp, txt_in_art_you_write, note_h_messageid);
  807. X
  808. X        fseek(note_fp, note_mark[0], 0);
  809. X        copy_fp(note_fp, fp, "> ");
  810. X    }
  811. X
  812. X    add_signature (fp, TRUE);
  813. X    fclose(fp);
  814. X
  815. X    ch = 'e';
  816. X    while (1) {
  817. X        switch (ch) {
  818. X        case 'e':
  819. X            start_line_offset = 5;
  820. X            invoke_editor(nam);
  821. X            break;
  822. X
  823. X        case 'a':
  824. X            clear_message();
  825. X            setuid(tin_uid);
  826. X            setgid(tin_gid);
  827. X            return FALSE;
  828. X
  829. X        case 's':
  830. X            strcpy(mail_to, note_from_addr);
  831. X            find_new_to(nam, mail_to);
  832. X            sprintf(msg, txt_mailing_to, mail_to);
  833. X            wait_message (msg);
  834. X            sprintf (buf, "%s \"%s\" < %s", mailer, mail_to, nam);
  835. X            if (invoke_cmd (buf)) {
  836. X                info_message (txt_message_sent);
  837. X                goto mail_to_author_done;
  838. X            } else {
  839. X                error_message (txt_command_failed_s, buf);
  840. X                break;
  841. X            }
  842. X        }
  843. X
  844. X        do {
  845. X            sprintf (msg, "%s%c", txt_abort_edit_send, ch_default);
  846. X            wait_message (msg);
  847. X            MoveCursor(LINES, strlen (txt_abort_edit_send));
  848. X            if ((ch = ReadCh()) == CR)
  849. X                ch = ch_default;
  850. X        } while (ch != 'a' && ch != 'e' && ch != 's');
  851. X    }
  852. X
  853. Xmail_to_author_done:
  854. X    setuid(tin_uid);
  855. X    setgid(tin_gid);
  856. X
  857. X    return TRUE;
  858. X}
  859. X
  860. X
  861. Xint post_response (group, respnum)
  862. X    char *group;
  863. X    int respnum;
  864. X{
  865. X    FILE *fp;
  866. X    char nam[LEN+1];
  867. X    char ch, *ptr;
  868. X    char ch_default = 'p';
  869. X    char buf[LEN+1];
  870. X
  871. X    start_line_offset = 6;
  872. X
  873. X    if (*note_h_followup && strcmp (note_h_followup, "poster") == 0) {
  874. X        clear_message ();
  875. X        if (! prompt_yn (LINES, txt_resp_to_poster, 'y')) {
  876. X            return FALSE;
  877. X        }
  878. X        *note_h_followup = '\0';
  879. X    } else if (*note_h_followup && strcmp(note_h_followup, group) != 0) {
  880. X        MoveCursor (LINES/2, 0);
  881. X        CleartoEOS ();
  882. X        StartInverse ();
  883. X        center_line ((LINES/2)+2, txt_resp_redirect);
  884. X        EndInverse ();
  885. X        MoveCursor ((LINES/2)+4, 0);
  886. X
  887. X        printf ("    ");
  888. X        ptr = note_h_followup;
  889. X        while (*ptr) {
  890. X            if (*ptr != ',') {
  891. X                putc (*ptr, stdout);
  892. X            } else {
  893. X                printf ("\r\n    ");
  894. X            }
  895. X            fflush (stdout);
  896. X            ptr++;
  897. X        }
  898. X
  899. X        if (! prompt_yn (LINES, txt_continue, 'y')) {
  900. X            return FALSE;
  901. X        }
  902. X    }
  903. X
  904. X    setuid(real_uid);
  905. X    setgid(real_gid);
  906. X
  907. X    sprintf(nam, "%s/.article", homedir);
  908. X    if ((fp = fopen(nam, "w")) == NULL) {
  909. X        error_message (txt_cannot_open, nam);
  910. X        setuid(tin_uid);
  911. X        setgid(tin_gid);
  912. X        return FALSE;
  913. X    }
  914. X    chmod(nam, 0600);
  915. X
  916. X    fprintf(fp, "Subject: Re: %s\n", eat_re(note_h_subj));
  917. X
  918. X    if (*note_h_followup && strcmp(note_h_followup, "poster") != 0)
  919. X        fprintf(fp, "Newsgroups: %s\n", note_h_followup);
  920. X    else
  921. X        fprintf(fp, "Newsgroups: %s\n", note_h_newsgroups);
  922. X
  923. X    if (*my_org) {
  924. X        fprintf(fp, "Organization: %s\n", my_org);
  925. X    }
  926. X
  927. X    if (*reply_to) {
  928. X        fprintf(fp, "Reply-To: %s\n", reply_to);
  929. X        start_line_offset++;
  930. X    }
  931. X
  932. X    if (note_h_distrib != '\0') {
  933. X        fprintf(fp, "Distribution: %s\n", note_h_distrib);
  934. X        start_line_offset++;
  935. X    }
  936. X
  937. X    fprintf(fp, "References: %s\n", note_h_messageid);
  938. X    fprintf(fp, "\n");
  939. X
  940. X    if (respnum) {        /* if "copy_text" */
  941. X        if (note_h_from[0]) {     
  942. X            fprintf(fp, txt_writes, note_h_from);
  943. X        }
  944. X
  945. X        fseek(note_fp, note_mark[0], 0);
  946. X        copy_fp(note_fp, fp, "> ");
  947. X    }
  948. X
  949. X    add_signature (fp, FALSE);
  950. X    fclose(fp);
  951. X
  952. X    ch = 'e';
  953. X    while (1) {
  954. X        switch (ch) {
  955. X        case 'e':
  956. X            invoke_editor (nam);
  957. X            break;
  958. X
  959. X        case 'a':
  960. X            clear_message ();
  961. X            setuid (tin_uid);
  962. X            setgid (tin_gid);
  963. X            return FALSE;
  964. X
  965. X        case 'p':
  966. X            wait_message (txt_posting);
  967. X            sprintf (buf, "%s/inews -h < %s", LIBDIR, nam);
  968. X            if (invoke_cmd (buf)) {
  969. X                info_message (txt_art_posted);
  970. X                goto post_response_done;
  971. X            } else {
  972. X                error_message (txt_art_rejected, NULL);
  973. X                break;
  974. X            }
  975. X        }
  976. X
  977. X        do {
  978. X            sprintf (msg, "%s%c", txt_abort_edit_post, ch_default);
  979. X            wait_message (msg);
  980. X            MoveCursor(LINES, strlen (txt_abort_edit_post));
  981. X            if ((ch = ReadCh()) == CR)
  982. X                ch = ch_default;
  983. X        } while (ch != 'a' && ch != 'e' && ch != 'p');
  984. X    }
  985. X
  986. Xpost_response_done:
  987. X    setuid(tin_uid);
  988. X    setgid(tin_gid);
  989. X
  990. X    if (*note_h_followup && strcmp(note_h_followup, "poster") != 0)
  991. X        update_art_posted_file (note_h_followup, note_h_subj);
  992. X    else
  993. X        update_art_posted_file (note_h_newsgroups, note_h_subj);
  994. X
  995. X    return TRUE;
  996. X}
  997. X
  998. X
  999. Xvoid pipe_article()
  1000. X{
  1001. X    char command[LEN+1];
  1002. X    FILE *fp;
  1003. X
  1004. X    if (!parse_string(txt_pipe_to_command, command))
  1005. X        return;
  1006. X    if (command[0] == '\0')
  1007. X        return;
  1008. X
  1009. X    Raw(FALSE);
  1010. X
  1011. X    if ((fp = popen(command, "w")) == NULL) {
  1012. X        error_message (txt_command_failed_s, command);
  1013. X        goto pipe_article_done;
  1014. X    }
  1015. X
  1016. X    fseek(note_fp, 0L, 0);
  1017. X    copy_fp(note_fp, fp, "");
  1018. X    pclose(fp);
  1019. X
  1020. Xpipe_article_done:
  1021. X
  1022. X    Raw(TRUE);
  1023. X    continue_prompt();
  1024. X}
  1025. X
  1026. X
  1027. Xvoid print_article ()
  1028. X{
  1029. X    char command[LEN+1];
  1030. X    FILE *fp;
  1031. X    
  1032. X    if (default_printer) {
  1033. X        sprintf (command, "%s -P%s > /dev/null 2>&1",
  1034. X            printer, get_val ("PRINTER","ps0"));
  1035. X    } else {
  1036. X        sprintf (command, "%s > /dev/null 2>&1", printer);
  1037. X    }
  1038. X    
  1039. X    if ((fp = popen(command, "w")) == NULL) {
  1040. X        info_message (txt_error_printing_art);
  1041. X    } else {
  1042. X        wait_message (txt_printing);
  1043. X        if (print_header) {
  1044. X            fseek(note_fp, 0L, 0);
  1045. X        } else {
  1046. X            fprintf (fp, "From: %s\n", note_h_from);
  1047. X            fprintf (fp, "Subject: %s\n\n", note_h_subj);
  1048. X            fseek (note_fp, note_mark[0], 0);
  1049. X        }
  1050. X        copy_fp(note_fp, fp, "");
  1051. X        pclose(fp);
  1052. X        fseek(note_fp, note_mark[note_page], 0);
  1053. X        info_message (txt_art_printed);
  1054. X    }
  1055. X}
  1056. X
  1057. X
  1058. Xvoid print_thread (respnum, group_path)
  1059. X    int respnum;
  1060. X    char *group_path;
  1061. X{
  1062. X    char command[LEN+1];
  1063. X    FILE *fp;
  1064. X    int b;
  1065. X    int i;
  1066. X    
  1067. X    b = which_base (respnum);
  1068. X
  1069. X    if (default_printer) {
  1070. X        sprintf (command, "%s -P%s > /dev/null 2>&1",
  1071. X            printer, get_val ("PRINTER","ps0"));
  1072. X    } else {
  1073. X        sprintf (command, "%s > /dev/null 2>&1", printer);
  1074. X    }
  1075. X    
  1076. X    for (i = base[b]; i >= 0; i = arts[i].thread) {
  1077. X        if ((fp = popen(command, "w")) == NULL) {
  1078. X            info_message (txt_error_printing_thread);
  1079. X            break;
  1080. X        } else {
  1081. X            note_cleanup();
  1082. X            wait_message (txt_printing);
  1083. X            open_note(arts[i].artnum, group_path);    
  1084. X
  1085. X            if (print_header) {
  1086. X                fseek(note_fp, 0L, 0);
  1087. X            } else {
  1088. X                fprintf (fp, "From: %s\n", note_h_from);
  1089. X                fprintf (fp, "Subject: %s\n\n", note_h_subj);
  1090. X                fseek (note_fp, note_mark[0], 0);
  1091. X            }
  1092. X            copy_fp(note_fp, fp, "");
  1093. X
  1094. X            pclose(fp);
  1095. X        }
  1096. X        info_message (txt_thread_printed);
  1097. X    }
  1098. X
  1099. X    open_note(arts[respnum].artnum, group_path);    
  1100. X    fseek(note_fp, note_mark[note_page], 0);
  1101. X}
  1102. X
  1103. X
  1104. Xint show_last_page ()
  1105. X{
  1106. X    char buf[LEN+1];
  1107. X    char buf2[LEN+50];
  1108. X    char *p, *q;
  1109. X    int ctrl_L;        /* form feed character detected */
  1110. X    int i, j;
  1111. X    
  1112. X    if (note_end) {
  1113. X        return FALSE;
  1114. X    }
  1115. X
  1116. X    while (! note_end) {
  1117. X        note_line = 1;
  1118. X        ctrl_L = FALSE;
  1119. X
  1120. X        if (note_page == 0) {
  1121. X            note_line += 4;
  1122. X        } else {
  1123. X            note_line += 2;
  1124. X        }
  1125. X        while (note_line < LINES) {
  1126. X            if (fgets(buf, LEN, note_fp) == NULL) {
  1127. X                note_end = TRUE;
  1128. X                break;
  1129. X            }
  1130. X            buf[LEN-1] = '\0';
  1131. X            for (p = buf, q = buf2;    *p && *p != '\n' && q<&buf2[LEN]; p++) {
  1132. X                if (*p == '\b' && q > buf2) {
  1133. X                    q--;
  1134. X                } else if (*p == 12) {        /* ^L */
  1135. X                    *q++ = '^';
  1136. X                    *q++ = 'L';
  1137. X                    ctrl_L = TRUE;
  1138. X                } else if (*p == '\t') {
  1139. X                    i = q - buf2;
  1140. X                    j = (i|7) + 1;
  1141. X
  1142. X                    while (i++ < j) {
  1143. X                        *q++ = ' ';
  1144. X                    }
  1145. X                } else if (((*p) & 0x7F) < 32) {
  1146. X                    *q++ = '^';
  1147. X                    *q++ = ((*p) & 0x7F) + '@';
  1148. X                } else {
  1149. X                    *q++ = *p;
  1150. X                }
  1151. X            }
  1152. X            *q = '\0';
  1153. X            note_line += ((int) strlen (buf2) / COLS) + 1;
  1154. X
  1155. X            if (ctrl_L) {
  1156. X                break;
  1157. X            }
  1158. X        }
  1159. X        if (! note_end) {
  1160. X            note_mark[++note_page] = ftell(note_fp);
  1161. X        }
  1162. X    }
  1163. X    fseek (note_fp, note_mark[note_page], 0);
  1164. X    return TRUE;
  1165. X}
  1166. SHAR_EOF
  1167. echo "File page.c is complete" &&
  1168. $TOUCH -am 0822180591 page.c &&
  1169. chmod 0600 page.c ||
  1170. echo "restore of page.c failed"
  1171. set `wc -c page.c`;Wc_c=$1
  1172. if test "$Wc_c" != "34638"; then
  1173.     echo original size 34638, current size $Wc_c
  1174. fi
  1175. # ============= posted.c ==============
  1176. echo "x - extracting posted.c (Text)"
  1177. sed 's/^X//' << 'SHAR_EOF' > posted.c &&
  1178. X/*
  1179. X *  Project   : tin - a visual threaded usenet newsreader
  1180. X *  Module    : posted.c
  1181. X *  Author    : I.Lea
  1182. X *  Created   : 01-04-91
  1183. X *  Updated   : 19-08-91
  1184. X *  Release   : 1.0
  1185. X *  Notes     :
  1186. X *  Copyright : (c) Copyright 1991 by Iain Lea
  1187. X *                You may  freely  copy or  redistribute  this software,
  1188. X *              so  long as there is no profit made from its use, sale
  1189. X *              trade or  reproduction.  You may not change this copy-
  1190. X *              right notice, and it must be included in any copy made
  1191. X */
  1192. X
  1193. X#include    "tin.h"
  1194. X
  1195. X
  1196. Xint user_posted_messages ()
  1197. X{
  1198. X    char buf[LEN+1];
  1199. X    FILE *fp;
  1200. X    int ch;
  1201. X    int i;
  1202. X
  1203. X    if ((fp = fopen (postfile, "r")) != NULL) {
  1204. X        ClearScreen ();
  1205. X        printf("%s\r\n", nice_time());    /* time in upper left */
  1206. X
  1207. X        StartInverse ();
  1208. X        center_line (1, txt_post_history_menu);
  1209. X        EndInverse ();
  1210. X    
  1211. X        MoveCursor(INDEX_TOP, 0);
  1212. X        for (i=1 ; fgets (buf, LEN, fp) != NULL ; ) {
  1213. X            if (buf[0] != '#') {
  1214. X                buf[strlen (buf)-1] = ' ';
  1215. X                buf[COLS-2] = '\0';
  1216. X                printf ("%s% *s\r\n", buf, (COLS - (int) strlen (buf))-2, " ");
  1217. X                i++;
  1218. X            }
  1219. X            if (i > NOTESLINES) {
  1220. X                center_line(LINES, txt_hit_any_key);
  1221. X                if ((ch = ReadCh()) != ' ') {
  1222. X                    break;
  1223. X                }
  1224. X                clear_message ();
  1225. X                MoveCursor(INDEX_TOP, 0);
  1226. X                i=1;
  1227. X            }
  1228. X        }
  1229. X        fclose (fp);
  1230. X
  1231. X        if (i != 1 && i < NOTESLINES) {
  1232. X            while (i <= NOTESLINES) {
  1233. X                MoveCursor((INDEX_TOP+i)-1, 0);
  1234. X                CleartoEOLN ();
  1235. X                i++;
  1236. X            }
  1237. X            center_line(LINES, txt_hit_any_key);
  1238. X            ch = ReadCh();
  1239. X        }
  1240. X        clear_note_area ();
  1241. X        return TRUE;
  1242. X    }
  1243. X    info_message (txt_no_arts_posted);
  1244. X    return FALSE;
  1245. X}
  1246. X
  1247. X
  1248. Xvoid update_art_posted_file (group, subj)
  1249. X    char *group;
  1250. X    char *subj;
  1251. X{
  1252. X    char buf[LEN+1];
  1253. X    char tmp_post[LEN+1];
  1254. X    FILE *fp, *tmp_fp;
  1255. X    long epoch;
  1256. X    struct tm *tm;
  1257. X
  1258. X    sprintf (tmp_post, "%s.%d", postfile, getpid ());
  1259. X
  1260. X    setuid(real_uid);
  1261. X    setgid(real_gid);
  1262. X
  1263. X    if ((tmp_fp = fopen (tmp_post, "w")) != NULL) {
  1264. X        time(&epoch);
  1265. X        tm = localtime (&epoch);
  1266. X        fprintf (tmp_fp, "%02d-%02d-%02d  %-32s %-s\n",
  1267. X            tm->tm_mday, tm->tm_mon+1, tm->tm_year, group, subj);
  1268. X        fclose (tmp_fp);
  1269. X    }
  1270. X
  1271. X    if ((tmp_fp = fopen (tmp_post, "a+")) != NULL) {
  1272. X        if ((fp = fopen (postfile, "r")) != NULL) {
  1273. X            while (fgets (buf, LEN, fp) != NULL) {
  1274. X                fprintf (tmp_fp, "%s", buf);
  1275. X            }    
  1276. X            fclose (fp);
  1277. X            rename_file (tmp_post, postfile);
  1278. X        }
  1279. X        fclose (tmp_fp);
  1280. X    }
  1281. X
  1282. X    setuid(tin_uid);
  1283. X    setgid(tin_gid);
  1284. X}
  1285. SHAR_EOF
  1286. $TOUCH -am 0819114691 posted.c &&
  1287. chmod 0600 posted.c ||
  1288. echo "restore of posted.c failed"
  1289. set `wc -c posted.c`;Wc_c=$1
  1290. if test "$Wc_c" != "2328"; then
  1291.     echo original size 2328, current size $Wc_c
  1292. fi
  1293. # ============= prompt.c ==============
  1294. echo "x - extracting prompt.c (Text)"
  1295. sed 's/^X//' << 'SHAR_EOF' > prompt.c &&
  1296. X/*
  1297. X *  Project   : tin - a visual threaded usenet newsreader
  1298. X *  Module    : prompt.c
  1299. X *  Author    : R.Skrenta / I.Lea
  1300. X *  Created   : 01-04-91
  1301. X *  Updated   : 10-08-91
  1302. X *  Release   : 1.0
  1303. X *  Notes     :
  1304. X *  Copyright : (c) Copyright 1991 by Rich Skrenta & Iain Lea
  1305. X *                You may  freely  copy or  redistribute  this software,
  1306. X *              so  long as there is no profit made from its use, sale
  1307. X *              trade or  reproduction.  You may not change this copy-
  1308. X *              right notice, and it must be included in any copy made
  1309. X */
  1310. X
  1311. X#include    "tin.h"
  1312. X
  1313. X/*
  1314. X *  parse_num
  1315. X *  get a number from the user
  1316. X *  Return -1 if missing or bad number typed
  1317. X */
  1318. X
  1319. Xint parse_num (ch, prompt)
  1320. X    char ch;
  1321. X    char *prompt;
  1322. X{
  1323. X    char buf[40];
  1324. X    int len;
  1325. X    int i;
  1326. X    int num;
  1327. X
  1328. X    MoveCursor(LINES,0);
  1329. X    printf("%s %c",prompt,ch);
  1330. X    fflush(stdout);
  1331. X    buf[0] = ch;
  1332. X    buf[1] = '\0';
  1333. X    len = 1;
  1334. X    ch = ReadCh();
  1335. X    while (ch != '\n' && ch != '\r') {
  1336. X        if (ch == 8 || ch == 127) {
  1337. X            if (len) {
  1338. X                len--;
  1339. X                buf[len] = '\0';
  1340. X                putchar('\b');
  1341. X                putchar(' ');
  1342. X                putchar('\b');
  1343. X            } else {
  1344. X                MoveCursor(LINES, 0);
  1345. X                CleartoEOLN();
  1346. X                return(-1);
  1347. X            }
  1348. X        } else if (ch == 21) {    /* control-U    */
  1349. X            for (i = len;i>0;i--) {
  1350. X                putchar('\b');
  1351. X                putchar(' ');
  1352. X                putchar('\b');
  1353. X            }
  1354. X            buf[0] = '\0';
  1355. X            len = 0;
  1356. X        } else if (ch >= '0' && ch <= '9' && len < 4) {
  1357. X            buf[len++] = ch;
  1358. X            buf[len] = '\0';
  1359. X            putchar (ch);
  1360. X        } else
  1361. X            putchar(7);
  1362. X        fflush(stdout);
  1363. X        ch = ReadCh();
  1364. X    }
  1365. X
  1366. X    MoveCursor(LINES, 0);
  1367. X    CleartoEOLN();
  1368. X
  1369. X    if (len) {
  1370. X        num = atoi(buf);
  1371. X        return(num);
  1372. X    } else
  1373. X        return(-1);
  1374. X}
  1375. X
  1376. X
  1377. X/*
  1378. X *  parse_string
  1379. X *  get a string from the user
  1380. X *  Return TRUE if a valid string was typed, FALSE otherwise
  1381. X */
  1382. X
  1383. Xint parse_string (prompt, buf)
  1384. X    char *prompt;
  1385. X    char *buf;
  1386. X{
  1387. X    int len;
  1388. X    int i;
  1389. X    char ch;
  1390. X
  1391. X    clear_message();
  1392. X    MoveCursor(LINES,0);
  1393. X    printf("%s", prompt);
  1394. X    fflush(stdout);
  1395. X    buf[0] = '\0';
  1396. X    len = 0;
  1397. X    ch = ReadCh();
  1398. X    while (ch != '\n' && ch != '\r') {
  1399. X        if (ch == 8 || ch == 127) {
  1400. X            if (len) {
  1401. X                len--;
  1402. X                buf[len] = '\0';
  1403. X                putchar('\b');
  1404. X                putchar(' ');
  1405. X                putchar('\b');
  1406. X            } else {
  1407. X                MoveCursor(LINES, 0);
  1408. X                CleartoEOLN();
  1409. X                return(FALSE);
  1410. X            }
  1411. X        } else if (ch == 21) {    /* control-U    */
  1412. X            for (i = len;i>0;i--) {
  1413. X                putchar('\b');
  1414. X                putchar(' ');
  1415. X                putchar('\b');
  1416. X            }
  1417. X            buf[0] = '\0';
  1418. X            len = 0;
  1419. X        } else if (ch >= ' ' && len < 60) {
  1420. X            buf[len++] = ch;
  1421. X            buf[len] = '\0';
  1422. X            putchar (ch);
  1423. X        } else
  1424. X            putchar(7);
  1425. X        fflush(stdout);
  1426. X        ch = ReadCh();
  1427. X    }
  1428. X    MoveCursor(LINES,0);
  1429. X    CleartoEOLN();
  1430. X
  1431. X    return TRUE;
  1432. X}
  1433. X
  1434. X
  1435. Xint prompt_yn (line, prompt, default_ch)
  1436. X    int line;
  1437. X    char *prompt;
  1438. X    char default_ch;
  1439. X{
  1440. X    char ch;
  1441. X
  1442. X    MoveCursor (line, 0);
  1443. X    CleartoEOLN ();
  1444. X    printf ("%s%c", prompt, default_ch);
  1445. X    fflush (stdout);
  1446. X    MoveCursor (line, strlen (prompt));
  1447. X
  1448. X    if ((ch = ReadCh()) == CR) {
  1449. X        ch = default_ch;
  1450. X    }    
  1451. X
  1452. X    if (line == LINES) {
  1453. X        clear_message();
  1454. X    } else {
  1455. X        MoveCursor (line, strlen (prompt));
  1456. X        printf ("%c", ch);
  1457. X        fflush (stdout);
  1458. X    }
  1459. X
  1460. X    return (ch == 'y' ? TRUE : FALSE);
  1461. X}
  1462. X
  1463. X
  1464. Xvoid continue_prompt()
  1465. X{
  1466. X    info_message(txt_hit_any_key);
  1467. X    ReadCh();
  1468. X}
  1469. X
  1470. X
  1471. SHAR_EOF
  1472. $TOUCH -am 0819090891 prompt.c &&
  1473. chmod 0600 prompt.c ||
  1474. echo "restore of prompt.c failed"
  1475. set `wc -c prompt.c`;Wc_c=$1
  1476. if test "$Wc_c" != "3061"; then
  1477.     echo original size 3061, current size $Wc_c
  1478. fi
  1479. # ============= proto.h ==============
  1480. echo "x - extracting proto.h (Text)"
  1481. sed 's/^X//' << 'SHAR_EOF' > proto.h &&
  1482. X#ifdef __STDC__
  1483. X/* art.c */
  1484. Xvoid art_susp(int sig);
  1485. Xlong my_atol(char *s, int n);
  1486. Xvoid find_base(void);
  1487. Xint num_of_arts(void);
  1488. Xint valid_artnum(long art);
  1489. Xint purge_needed(void);
  1490. Xvoid index_group(char *group, char *group_path);
  1491. Xint read_group(char *group, char *group_path);
  1492. Xvoid make_threads(int rethread);
  1493. Xchar *eat_re(char *s);
  1494. Xlong hash_s(char *s);
  1495. Xint parse_headers(int fd, struct header *h);
  1496. Xvoid dump_index(char *group, int killed);
  1497. Xvoid my_strncpy(char *p, char *q, int n);
  1498. Xint load_index(void);
  1499. Xvoid find_local_index(char *group);
  1500. Xvoid do_update(void);
  1501. Xvoid reload_index_file(char *group, int killed);
  1502. Xchar *parse_date(char *date, char *str);
  1503. Xint artnum_comp(struct header *s1, struct header *s2);
  1504. Xint subj_comp(struct header *s1, struct header *s2);
  1505. Xint from_comp(struct header *s1, struct header *s2);
  1506. Xint date_comp(struct header *s1, struct header *s2);
  1507. Xint set_article(struct header *art);
  1508. X/* curses.c */
  1509. Xint InitScreen(void);
  1510. Xvoid ScreenSize(int *num_lines, int *num_columns);
  1511. Xvoid ClearScreen(void);
  1512. Xvoid MoveCursor(int row, int col);
  1513. Xvoid CleartoEOLN(void);
  1514. Xvoid CleartoEOS(void);
  1515. Xvoid StartInverse(void);
  1516. Xvoid EndInverse(void);
  1517. Xint RawState(void);
  1518. Xvoid Raw(int state);
  1519. Xint ReadCh(void);
  1520. Xint outchar(int c);
  1521. X/* debug.c */
  1522. Xint debug_print_arts(void);
  1523. Xvoid debug_print_header(struct header *s);
  1524. Xint debug_print_comment(char *comment);
  1525. Xvoid debug_print_base(void);
  1526. Xvoid debug_print_active(void);
  1527. X/* group.c */
  1528. Xvoid group_susp(int sig);
  1529. Xvoid group_page(char *group);
  1530. Xvoid fix_new_highest(int groupnum);
  1531. Xvoid show_group_page(char *group);
  1532. Xvoid draw_subject_arrow(void);
  1533. Xvoid erase_subject_arrow(void);
  1534. Xint prompt_subject_num(int ch, char *group);
  1535. Xint new_responses(int thread);
  1536. Xvoid clear_note_area(void);
  1537. Xint post_base(char *group);
  1538. Xint find_new_pos(int old_top, long old_artnum, int cur_pos);
  1539. X/* hashstr.c */
  1540. Xchar *hash_str(char *s);
  1541. Xstruct hashnode *add_string(char *s);
  1542. Xvoid hash_init(void);
  1543. Xvoid hash_reclaim(void);
  1544. X/* help.c */
  1545. Xvoid help_select_commands(void);
  1546. Xvoid help_select_info(void);
  1547. Xvoid help_group_commands(void);
  1548. Xvoid help_group_info(void);
  1549. Xvoid help_page_commands(void);
  1550. Xvoid help_page_info(void);
  1551. X/* kill.c */
  1552. Xint read_kill_file(void);
  1553. Xvoid write_kill_file(void);
  1554. Xint kill_art_menu(char *group_name, int index);
  1555. Xint untag_all_articles(void);
  1556. Xint kill_any_articles(char *group);
  1557. X/* lang.c */
  1558. X/* mail.c */
  1559. Xvoid mail_setup(void);
  1560. Xint mail_check(void);
  1561. X/* main.c */
  1562. Xvoid main_susp(int sig);
  1563. Xvoid signal_handler(int sig);
  1564. Xvoid main(int argc, char *argv[]);
  1565. Xvoid usage(char *progname);
  1566. X/* memory.c */
  1567. Xvoid init_alloc(void);
  1568. Xvoid expand_art(void);
  1569. Xvoid free_art_array(void);
  1570. Xvoid expand_active(void);
  1571. Xvoid expand_kill(void);
  1572. Xvoid expand_save(void);
  1573. Xvoid init_screen_array(int allocate);
  1574. Xvoid free_all_arrays(void);
  1575. Xvoid free_kill_array(void);
  1576. Xvoid free_save_array(void);
  1577. Xchar *my_malloc(unsigned size);
  1578. Xchar *my_realloc(char *p, unsigned size);
  1579. X/* misc.c */
  1580. Xvoid init_selfinfo(void);
  1581. Xint which_base(int n);
  1582. Xint which_resp(int n);
  1583. Xint nresp(int n);
  1584. Xvoid asfail(char *file, int line, char *cond);
  1585. Xvoid copy_fp(FILE *a, FILE *b, char *prefix);
  1586. Xchar *get_val(char *env, char *def);
  1587. Xint invoke_editor(char *nam);
  1588. Xvoid shell_escape(void);
  1589. Xvoid tin_done(int ret);
  1590. Xvoid read_active(void);
  1591. Xint active_comp(struct group_ent *s1, struct group_ent *s2);
  1592. Xvoid add_signature(FILE *fp, int flag);
  1593. Xlong hash_groupname(char *buf);
  1594. Xvoid rename_file(char *old_filename, char *new_filename);
  1595. Xchar *str_dup(char *str);
  1596. Xint invoke_cmd(char *nam);
  1597. X/* newsrc.c */
  1598. Xvoid read_newsrc(int sub_only);
  1599. Xvoid write_newsrc(void);
  1600. Xvoid read_newsrc_line(char *group);
  1601. Xvoid update_newsrc(char *group, int groupnum);
  1602. Xvoid subscribe(char *group, int ch, int num, int out_seq);
  1603. Xvoid reset_newsrc(void);
  1604. Xvoid delete_group(char *group);
  1605. Xint undel_group(void);
  1606. Xvoid mark_group_read(char *group, int groupnum);
  1607. Xvoid parse_seq(char *s);
  1608. Xint parse_unread(char *s, int groupnum);
  1609. Xint get_line_unread(char *group, int groupnum);
  1610. Xvoid print_seq(FILE *fp, int groupnum);
  1611. Xint pos_group_in_newsrc(char *group, int pos);
  1612. X/* open.c */
  1613. Xchar *is_remote(void);
  1614. Xvoid nntp_startup(void);
  1615. Xvoid nntp_finish(void);
  1616. XFILE *open_active_fp(void);
  1617. XFILE *open_art_fp(char *group_path, long art);
  1618. Xint open_header_fd(char *group_path, long art);
  1619. Xint base_comp(long *a, long *b);
  1620. Xvoid setup_base(char *group, char *group_path);
  1621. Xint get_respcode(void);
  1622. Xint stuff_nntp(char *fnam);
  1623. XFILE *nntp_to_fp(void);
  1624. Xint nntp_to_fd(void);
  1625. X/* page.c */
  1626. Xvoid page_susp(int sig);
  1627. Xint show_page(int respnum, char *group, char *group_path);
  1628. Xvoid redraw_page(int respnum, char *group);
  1629. Xvoid show_note_page(int respnum, char *group);
  1630. Xvoid show_first_header(int respnum, char *group);
  1631. Xvoid show_cont_header(int respnum);
  1632. Xvoid open_note(long art, char *group_path);
  1633. Xvoid note_cleanup(void);
  1634. Xint prompt_response(int ch, int respnum);
  1635. Xint choose_resp(int i, int n);
  1636. Xvoid parse_from(char *str, char *addr, char *name);
  1637. Xint prev_response(int n);
  1638. Xint next_response(int n);
  1639. Xint next_basenote(int n);
  1640. Xvoid yank_to_addr(char *orig, char *addr);
  1641. Xvoid find_new_to(char *nam, char *mail_to);
  1642. Xint mail_to_someone(void);
  1643. Xint mail_bug_report(void);
  1644. Xint mail_to_author(int copy_text);
  1645. Xint post_response(char *group, int respnum);
  1646. Xvoid pipe_article(void);
  1647. Xvoid print_article(void);
  1648. Xvoid print_thread(int respnum, char *group_path);
  1649. Xint show_last_page(void);
  1650. X/* posted.c */
  1651. Xint user_posted_messages(void);
  1652. Xvoid update_art_posted_file(char *group, char *subj);
  1653. X/* prompt.c */
  1654. Xint parse_num(int ch, char *prompt);
  1655. Xint parse_string(char *prompt, char *buf);
  1656. Xint prompt_yn(int line, char *prompt, int default_ch);
  1657. Xvoid continue_prompt(void);
  1658. X/* rcfile.c */
  1659. Xint read_rcfile(void);
  1660. Xvoid write_rcfile(void);
  1661. Xint change_rcfile(char *group, int kill_at_once);
  1662. Xvoid parse_menu_string(int line, int col, char *var);
  1663. Xvoid expand_rel_abs_pathname(int line, int col, char *str);
  1664. Xvoid show_menu_help(char *help_message);
  1665. X/* save.c */
  1666. Xvoid save_art_to_file(int respnum, int index, int mailbox, char *filename);
  1667. Xvoid save_thread_to_file(int respnum, char *group_path);
  1668. Xint save_regex_arts(char *group_path, char *group);
  1669. Xint append_to_existing_file(int i);
  1670. Xint create_path(char *path);
  1671. Xint create_sub_dir(int i);
  1672. Xvoid add_to_save_list(int index, struct header *article, int is_mailbox, char *path);
  1673. Xvoid sort_save_list(void);
  1674. Xint save_comp(struct save_t *s1, struct save_t *s2);
  1675. Xchar *save_filename(int i);
  1676. Xchar *get_first_savefile(void);
  1677. Xchar *get_last_savefile(void);
  1678. Xint post_process_files(void);
  1679. Xvoid post_process_sh(void);
  1680. Xvoid post_process_uud(int pp);
  1681. Xvoid uudecode(FILE *fp_in, char *dst_file);
  1682. Xvoid doaline (char *s, FILE *fp_out);
  1683. Xvoid outdec (char *p, int n, FILE *fp_out);
  1684. Xchar *get_archive_file(char *dir, char *ext);
  1685. Xvoid delete_processed_files(void);
  1686. Xvoid post_process_patch(void);
  1687. X/* screen.c */
  1688. Xvoid info_message(char *msg);
  1689. Xvoid wait_message(char *msg);
  1690. Xvoid error_message(char *template, char *msg);
  1691. Xvoid clear_message(void);
  1692. Xvoid center_line(int line, char *str);
  1693. Xvoid draw_arrow(int line);
  1694. Xvoid erase_arrow(int line);
  1695. X/* search.c */
  1696. Xint search_author(int current_art, int forward);
  1697. Xvoid search_group(int forward);
  1698. Xvoid search_subject(int forward, char *group);
  1699. Xint search_article(int forward);
  1700. Xchar *str_str(char *text, char *pattern);
  1701. Xvoid make_lower(char *s, char *t);
  1702. X/* select.c */
  1703. Xvoid select_susp(int sig);
  1704. Xvoid selection_index(void);
  1705. Xvoid group_selection_page(void);
  1706. Xint prompt_group_num(int ch);
  1707. Xvoid erase_group_arrow(void);
  1708. Xvoid draw_group_arrow(void);
  1709. Xint choose_new_group(void);
  1710. Xint add_group(char *s, int get_unread);
  1711. Xint next_unread(int n);
  1712. Xint prev_unread(int n);
  1713. Xint reposition_group(char *group, int default_num);
  1714. X/* time.c */
  1715. Xvoid nicedate(char *timestr, char *newstr);
  1716. Xvoid nicetime(char *timestr, char *newstr);
  1717. Xchar *nice_time(void);
  1718. X/* wildmat.c */
  1719. Xint wildmat(char *text, char *p);
  1720. X#else
  1721. X/* art.c */
  1722. Xvoid art_susp(/*int sig*/);
  1723. Xlong my_atol(/*char *s, int n*/);
  1724. Xvoid find_base(/*void*/);
  1725. Xint num_of_arts(/*void*/);
  1726. Xint valid_artnum(/*long art*/);
  1727. Xint purge_needed(/*void*/);
  1728. Xvoid index_group(/*char *group, char *group_path*/);
  1729. Xint read_group(/*char *group, char *group_path*/);
  1730. Xvoid make_threads(/*int rethread*/);
  1731. Xchar *eat_re(/*char *s*/);
  1732. Xlong hash_s(/*char *s*/);
  1733. Xint parse_headers(/*int fd, struct header *h*/);
  1734. Xvoid dump_index(/*char *group, int killed*/);
  1735. Xvoid my_strncpy(/*char *p, char *q, int n*/);
  1736. Xint load_index(/*void*/);
  1737. Xvoid find_local_index(/*char *group*/);
  1738. Xvoid do_update(/*void*/);
  1739. Xvoid reload_index_file(/*char *group, int killed*/);
  1740. Xchar *parse_date(/*char *date, char *str*/);
  1741. Xint artnum_comp(/*struct header *s1, struct header *s2*/);
  1742. Xint subj_comp(/*struct header *s1, struct header *s2*/);
  1743. Xint from_comp(/*struct header *s1, struct header *s2*/);
  1744. Xint date_comp(/*struct header *s1, struct header *s2*/);
  1745. Xint set_article(/*struct header *art*/);
  1746. X/* curses.c */
  1747. Xint InitScreen(/*void*/);
  1748. Xvoid ScreenSize(/*int *lines, int *columns*/);
  1749. Xvoid ClearScreen(/*void*/);
  1750. Xvoid MoveCursor(/*int row, int col*/);
  1751. Xvoid CleartoEOLN(/*void*/);
  1752. Xvoid CleartoEOS(/*void*/);
  1753. Xvoid StartInverse(/*void*/);
  1754. Xvoid EndInverse(/*void*/);
  1755. Xint RawState(/*void*/);
  1756. Xvoid Raw(/*int state*/);
  1757. Xint ReadCh(/*void*/);
  1758. Xint outchar(/*int c*/);
  1759. X/* debug.c */
  1760. Xint debug_print_arts(/*void*/);
  1761. Xvoid debug_print_header(/*struct header *s*/);
  1762. Xint debug_print_comment(/*char *comment*/);
  1763. Xvoid debug_print_base(/*void*/);
  1764. Xvoid debug_print_active(/*void*/);
  1765. X/* group.c */
  1766. Xvoid group_susp(/*int sig*/);
  1767. Xvoid group_page(/*char *group*/);
  1768. Xvoid fix_new_highest(/*int groupnum*/);
  1769. Xvoid show_group_page(/*char *group*/);
  1770. Xvoid draw_subject_arrow(/*void*/);
  1771. Xvoid erase_subject_arrow(/*void*/);
  1772. Xint prompt_subject_num(/*int ch, char *group*/);
  1773. Xint new_responses(/*int thread*/);
  1774. Xvoid clear_note_area(/*void*/);
  1775. Xint post_base(/*char *group*/);
  1776. Xint find_new_pos(/*int old_top, long old_artnum, int cur_pos*/);
  1777. X/* hashstr.c */
  1778. Xchar *hash_str(/*char *s*/);
  1779. Xstruct hashnode *add_string(/*char *s*/);
  1780. Xvoid hash_init(/*void*/);
  1781. Xvoid hash_reclaim(/*void*/);
  1782. X/* help.c */
  1783. Xvoid help_select_commands(/*void*/);
  1784. Xvoid help_select_info(/*void*/);
  1785. Xvoid help_group_commands(/*void*/);
  1786. Xvoid help_group_info(/*void*/);
  1787. Xvoid help_page_commands(/*void*/);
  1788. Xvoid help_page_info(/*void*/);
  1789. X/* kill.c */
  1790. Xint read_kill_file(/*void*/);
  1791. Xvoid write_kill_file(/*void*/);
  1792. Xint kill_art_menu(/*char *group_name, int index*/);
  1793. Xint untag_all_articles(/*void*/);
  1794. Xint kill_any_articles(/*char *group*/);
  1795. X/* lang.c */
  1796. X/* mail.c */
  1797. Xvoid mail_setup(/*void*/);
  1798. Xint mail_check(/*void*/);
  1799. X/* main.c */
  1800. Xvoid main_susp(/*int sig*/);
  1801. Xvoid signal_handler(/*int sig*/);
  1802. Xvoid main(/*int argc, char *argv[]*/);
  1803. Xvoid usage(/*char *progname*/);
  1804. X/* memory.c */
  1805. Xvoid init_alloc(/*void*/);
  1806. Xvoid expand_art(/*void*/);
  1807. Xvoid free_art_array(/*void*/);
  1808. Xvoid expand_active(/*void*/);
  1809. Xvoid expand_kill(/*void*/);
  1810. Xvoid expand_save(/*void*/);
  1811. Xvoid init_screen_array(/*int allocate*/);
  1812. Xvoid free_all_arrays(/*void*/);
  1813. Xvoid free_kill_array(/*void*/);
  1814. Xvoid free_save_array(/*void*/);
  1815. Xchar *my_malloc(/*unsigned size*/);
  1816. Xchar *my_realloc(/*char *p, unsigned size*/);
  1817. X/* misc.c */
  1818. Xvoid init_selfinfo(/*void*/);
  1819. Xint which_base(/*int n*/);
  1820. Xint which_resp(/*int n*/);
  1821. Xint nresp(/*int n*/);
  1822. Xvoid asfail(/*char *file, int line, char *cond*/);
  1823. Xvoid copy_fp(/*FILE *a, FILE *b, char *prefix*/);
  1824. Xchar *get_val(/*char *env, char *def*/);
  1825. Xint invoke_editor(/*char *nam*/);
  1826. Xvoid shell_escape(/*void*/);
  1827. Xvoid tin_done(/*int ret*/);
  1828. Xvoid read_active(/*void*/);
  1829. Xint active_comp(/*struct group_ent *s1, struct group_ent *s2*/);
  1830. Xvoid add_signature(/*FILE *fp, int flag*/);
  1831. Xlong hash_groupname(/*char *buf*/);
  1832. Xvoid rename_file(/*char *old_filename, char *new_filename*/);
  1833. Xchar *str_dup(/*char *str*/);
  1834. Xint invoke_cmd(/*char *nam*/);
  1835. X/* newsrc.c */
  1836. Xvoid read_newsrc(/*int sub_only*/);
  1837. Xvoid write_newsrc(/*void*/);
  1838. Xvoid read_newsrc_line(/*char *group*/);
  1839. Xvoid update_newsrc(/*char *group, int groupnum*/);
  1840. Xvoid subscribe(/*char *group, int ch, int num, int out_seq*/);
  1841. Xvoid reset_newsrc(/*void*/);
  1842. Xvoid delete_group(/*char *group*/);
  1843. Xint undel_group(/*void*/);
  1844. Xvoid mark_group_read(/*char *group, int groupnum*/);
  1845. Xvoid parse_seq(/*char *s*/);
  1846. Xint parse_unread(/*char *s, int groupnum*/);
  1847. Xint get_line_unread(/*char *group, int groupnum*/);
  1848. Xvoid print_seq(/*FILE *fp, int groupnum*/);
  1849. Xint pos_group_in_newsrc(/*char *group, int pos*/);
  1850. X/* open.c */
  1851. Xchar *is_remote(/*void*/);
  1852. Xvoid nntp_startup(/*void*/);
  1853. Xvoid nntp_finish(/*void*/);
  1854. XFILE *open_active_fp(/*void*/);
  1855. XFILE *open_art_fp(/*char *group_path, long art*/);
  1856. Xint open_header_fd(/*char *group_path, long art*/);
  1857. Xint base_comp(/*long *a, long *b*/);
  1858. Xvoid setup_base(/*char *group, char *group_path*/);
  1859. Xint get_respcode(/*void*/);
  1860. Xint stuff_nntp(/*char *fnam*/);
  1861. XFILE *nntp_to_fp(/*void*/);
  1862. Xint nntp_to_fd(/*void*/);
  1863. X/* page.c */
  1864. Xvoid page_susp(/*int sig*/);
  1865. Xint show_page(/*int respnum, char *group, char *group_path*/);
  1866. Xvoid redraw_page(/*int respnum, char *group*/);
  1867. Xvoid show_note_page(/*int respnum, char *group*/);
  1868. Xvoid show_first_header(/*int respnum, char *group*/);
  1869. Xvoid show_cont_header(/*int respnum*/);
  1870. Xvoid open_note(/*long art, char *group_path*/);
  1871. Xvoid note_cleanup(/*void*/);
  1872. Xint prompt_response(/*int ch, int respnum*/);
  1873. Xint choose_resp(/*int i, int n*/);
  1874. Xvoid parse_from(/*char *str, char *addr, char *name*/);
  1875. Xint prev_response(/*int n*/);
  1876. Xint next_response(/*int n*/);
  1877. Xint next_basenote(/*int n*/);
  1878. Xvoid yank_to_addr(/*char *orig, char *addr*/);
  1879. Xvoid find_new_to(/*char *nam, char *mail_to*/);
  1880. Xint mail_to_someone(/*void*/);
  1881. Xint mail_bug_report(/*void*/);
  1882. Xint mail_to_author(/*int copy_text*/);
  1883. Xint post_response(/*char *group, int respnum*/);
  1884. Xvoid pipe_article(/*void*/);
  1885. Xvoid print_article(/*void*/);
  1886. Xvoid print_thread(/*int respnum, char *group_path*/);
  1887. Xint show_last_page(/*void*/);
  1888. X/* posted.c */
  1889. Xint user_posted_messages(/*void*/);
  1890. Xvoid update_art_posted_file(/*char *group, char *subj*/);
  1891. X/* prompt.c */
  1892. Xint parse_num(/*int ch, char *prompt*/);
  1893. Xint parse_string(/*char *prompt, char *buf*/);
  1894. Xint prompt_yn(/*int line, char *prompt, int default_ch*/);
  1895. Xvoid continue_prompt(/*void*/);
  1896. X/* rcfile.c */
  1897. Xint read_rcfile(/*void*/);
  1898. Xvoid write_rcfile(/*void*/);
  1899. Xint change_rcfile(/*char *group, int kill_at_once*/);
  1900. Xvoid parse_menu_string(/*int line, int col, char *var*/);
  1901. Xvoid expand_rel_abs_pathname(/*int line, int col, char *str*/);
  1902. Xvoid show_menu_help(/*char *help_message*/);
  1903. X/* save.c */
  1904. Xvoid save_art_to_file(/*int respnum, int index, int mailbox, char *filename*/);
  1905. Xvoid save_thread_to_file(/*int respnum, char *group_path*/);
  1906. Xint save_regex_arts(/*char *group_path, char *group*/);
  1907. Xint append_to_existing_file(/*int i*/);
  1908. Xint create_path(/*char *path*/);
  1909. Xint create_sub_dir(/*int i*/);
  1910. Xvoid add_to_save_list(/*int index, struct header *article, int is_mailbox, char *path*/);
  1911. Xvoid sort_save_list(/*void*/);
  1912. Xint save_comp(/*struct save_t *s1, struct save_t *s2*/);
  1913. Xchar *save_filename(/*int i*/);
  1914. Xchar *get_first_savefile(/*void*/);
  1915. Xchar *get_last_savefile(/*void*/);
  1916. Xint post_process_files(/*void*/);
  1917. Xvoid post_process_sh(/*void*/);
  1918. Xvoid post_process_uud(/*int pp*/);
  1919. Xvoid uudecode(/*FILE *fp_in, char *dst_file*/);
  1920. Xvoid doaline (/*char *s, FILE *fp_out*/);
  1921. Xvoid outdec (/*char *p, int n, FILE *fp_out*/);
  1922. Xchar *get_archive_file(/*char *dir, char *ext*/);
  1923. Xvoid delete_processed_files(/*void*/);
  1924. Xvoid post_process_patch(/*void*/);
  1925. X/* screen.c */
  1926. Xvoid info_message(/*char *msg*/);
  1927. Xvoid wait_message(/*char *msg*/);
  1928. Xvoid error_message(/*char *template, char *msg*/);
  1929. Xvoid clear_message(/*void*/);
  1930. Xvoid center_line(/*int line, char *str*/);
  1931. Xvoid draw_arrow(/*int line*/);
  1932. Xvoid erase_arrow(/*int line*/);
  1933. X/* search.c */
  1934. Xint search_author(/*int current_art, int forward*/);
  1935. Xvoid search_group(/*int forward*/);
  1936. Xvoid search_subject(/*int forward, char *group*/);
  1937. Xint search_article(/*int forward*/);
  1938. Xchar *str_str(/*char *text, char *pattern*/);
  1939. Xvoid make_lower(/*char *s, char *t*/);
  1940. X/* select.c */
  1941. Xvoid select_susp(/*int sig*/);
  1942. Xvoid selection_index(/*void*/);
  1943. Xvoid group_selection_page(/*void*/);
  1944. Xint prompt_group_num(/*int ch*/);
  1945. Xvoid erase_group_arrow(/*void*/);
  1946. Xvoid draw_group_arrow(/*void*/);
  1947. Xint choose_new_group(/*void*/);
  1948. Xint add_group(/*char *s, int get_unread*/);
  1949. Xint next_unread(/*int n*/);
  1950. Xint prev_unread(/*int n*/);
  1951. Xint reposition_group(/*char *group, int default_num*/);
  1952. X/* time.c */
  1953. Xvoid nicedate(/*char *timestr, char *newstr*/);
  1954. Xvoid nicetime(/*char *timestr, char *newstr*/);
  1955. Xchar *nice_time(/*void*/);
  1956. X/* wildmat.c */
  1957. Xint wildmat(/*char *text, char *p*/);
  1958. X#endif
  1959. SHAR_EOF
  1960. $TOUCH -am 0823134291 proto.h &&
  1961. chmod 0600 proto.h ||
  1962. echo "restore of proto.h failed"
  1963. set `wc -c proto.h`;Wc_c=$1
  1964. if test "$Wc_c" != "16291"; then
  1965.     echo original size 16291, current size $Wc_c
  1966. fi
  1967. # ============= rcfile.c ==============
  1968. echo "x - extracting rcfile.c (Text)"
  1969. sed 's/^X//' << 'SHAR_EOF' > rcfile.c &&
  1970. X/*
  1971. X *  Project   : tin - a visual threaded usenet newsreader
  1972. X *  Module    : rcfile.c
  1973. X *  Author    : I.Lea
  1974. X *  Created   : 01-04-91
  1975. X *  Updated   : 18-08-91
  1976. X *  Release   : 1.0
  1977. X *  Notes     :
  1978. X *  Copyright : (c) Copyright 1991 by Iain Lea
  1979. X *                You may  freely  copy or  redistribute  this software,
  1980. X *              so  long as there is no profit made from its use, sale
  1981. X *              trade or  reproduction.  You may not change this copy-
  1982. X *              right notice, and it must be included in any copy made
  1983. X */
  1984. X
  1985. X#include    "tin.h"
  1986. X
  1987. X#define COL2    COLS/2
  1988. X
  1989. Xextern char index_file[LEN+1];
  1990. X
  1991. X/*
  1992. X *  read_rcfile - read defaults from ~/.tin/tinrc
  1993. X */
  1994. X
  1995. Xint read_rcfile ()
  1996. X{
  1997. X    char buf[LEN+1];
  1998. X    FILE *fp;
  1999. X
  2000. X    if ((fp = fopen (rcfile, "r")) != NULL) {
  2001. X        while (fgets (buf, LEN, fp) != NULL) {
  2002. X            if (buf[0] != '#') { 
  2003. X                if (strncmp (buf, "save_archive=", 13) == 0) {
  2004. X                    save_archive_name = (strncmp (&buf[13], "ON", 2) == 0 ? TRUE : FALSE);
  2005. X                } else if (strncmp (buf, "save_separate=", 14) == 0) {
  2006. X                    save_separate = (strncmp (&buf[14], "ON", 2) == 0 ? TRUE : FALSE);
  2007. X                } else if (strncmp (buf, "mark_saved_read=", 16) == 0) {
  2008. X                    mark_saved_read = (strncmp (&buf[16], "ON", 2) == 0 ? TRUE : FALSE);
  2009. X                } else if (strncmp (buf, "kill_articles=", 14) == 0) {
  2010. X                    kill_articles = (strncmp (&buf[14], "ON", 2) == 0 ? TRUE : FALSE);
  2011. X                } else if (strncmp (buf, "show_author=", 12) == 0) {
  2012. X                    show_author = (strncmp (&buf[12], "ON", 2) == 0 ? TRUE : FALSE);
  2013. X                } else if (strncmp (buf, "draw_arrow=", 11) == 0) {
  2014. X                    draw_arrow_mark = (strncmp (&buf[11], "ON", 2) == 0 ? TRUE : FALSE);
  2015. X                } else if (strncmp (buf, "post_process=", 13) == 0) {
  2016. X                    post_process = (strncmp (&buf[13], "ON", 2) == 0 ? TRUE : FALSE);
  2017. X                } else if (strncmp (buf, "print_header=", 13) == 0) {
  2018. X                    print_header = (strncmp (&buf[14], "ON", 2) == 0 ? TRUE : FALSE);
  2019. X                } else if (strncmp (buf, "post_process_type=", 18) == 0) {
  2020. X                    post_proc_type = atoi (&buf[18]);
  2021. X                } else if (strncmp (buf, "sort_article_type=", 18) == 0) {
  2022. X                    sort_art_type = atoi (&buf[18]);
  2023. X                } else if (strncmp (buf, "savedir=", 8) == 0) {
  2024. X                    strncpy (savedir, &buf[8], LEN);
  2025. X                    savedir[strlen (savedir) - 1] = '\0';
  2026. X                    if (savedir[0] == '.' && strlen (savedir) == 1) {
  2027. X#ifdef BSD
  2028. X                        getwd (buf);    
  2029. X#else
  2030. X                        getcwd (buf, LEN);
  2031. X#endif
  2032. X                        my_strncpy (savedir, buf, LEN);
  2033. X                    } /*  else if (savedir[0] == '.' && savedir[1] == '.' && strlen (savedir) == 2) {
  2034. X                    } */
  2035. X                } else if (strncmp (buf, "maildir=", 8) == 0) {
  2036. X                    strncpy (maildir, &buf[8], LEN);
  2037. X                    maildir[strlen (maildir) - 1] = '\0';
  2038. X                } else if (strncmp (buf, "printer=", 8) == 0) {
  2039. X                    strncpy (printer, &buf[8], LEN);
  2040. X                    printer[strlen (printer) - 1] = '\0';
  2041. X                } else if (strncmp (buf, "spooldir=", 9) == 0) {
  2042. X                    strncpy (spooldir, &buf[9], LEN);
  2043. X                    spooldir[strlen (spooldir) - 1] = '\0';
  2044. X                } else if (strncmp (buf, "signature=", 10) == 0) {
  2045. X                    strncpy (signature, &buf[10], LEN);
  2046. X                    signature[strlen (signature) - 1] = '\0';
  2047. X                } else if (strncmp (buf, "sig=", 4) == 0) {
  2048. X                    strncpy (sig, &buf[4], LEN);
  2049. X                    sig[strlen (sig) - 1] = '\0';
  2050. SHAR_EOF
  2051. echo "End of tin part 5"
  2052. echo "File rcfile.c is continued in part 6"
  2053. echo "6" > shar3_seq_.tmp
  2054. exit 0
  2055.  
  2056. --
  2057. NAME   Iain Lea
  2058. EMAIL  norisc!iain@estevax.UUCP  ...!unido!estevax!norisc!iain
  2059. SNAIL  Siemens AG, AUT 922C, Postfach 4848, Nuernberg, Germany
  2060. PHONE  +49-911-895-3853, +49-911-895-3877, +49-911-331963
  2061.