Notes about the code - acli/trn GitHub Wiki

Basic screen I/O

  • uses bare termcap/terminfo, not curses
  • output goes to stdout with FLUSH macro: printf("foo\n") FLUSH;
  • reposition cursor: s_goxy(x, y);

Subject lines

  • orig_line still has newlines when tree_puts() (in rt-wumpus.c) is called
  • after orig_line is transformed into line newlines are already lost
    • decode_header() in cache.c

Article selector

  • article_selector() in rt-select.c
  • display_page() in rt-page.c
  • print_lines() is used for the help screen but not on the actual selection page
  • display_subject()? ← yes, this is it, grep for "%s%3d (it’s the else statement) → compress_from() in rt-util.c

Article display

  • do_article() in art.c – grep “normal line”
  • it seems to output characters one byte at a time :-/
  • to investigate: putsubstchar() in charsubst.c
  • finish_tree()
  • art.c:233, p bufptr gives 0x0 so investigate readartbuf

HTML decoding

Random notes

  • artsize = article size

  • check whether we’re using an NNTP server: if (datasrc->flags & DF_REMOTE)

  • DF_REMOTE = 0x80

  • artsize < 0 can only happen when using NNTP server so the code often doesn’t do the bitmask check when artsize < 0 is checked

  • artio.c:349 not reached (o, o) through either local or nntp

  • break artio.c:457 ← first line inside if (read_something) in readartbuf()

    • local: artbuf_seek=2709, artbuf_pos=0, extra_chars=0, artsize=77292, raw_artsize=77292, artbuf_seek (← tellart()) = 77292
      • artsize becomes 2709
    • nntp: artbuf_seek=2657, artbuf_pos=13, extra_chars=0, artsize=-1
      • after a few c’s content started being displayed even though artsize continues to be -1

.

(gdb) n 1000
Input caption text here. Use the block's Settings tab to change the caption position and set other styles.

Breakpoint 1, qp_decodestring (t=0x6e4f0f "=\n", f=0x6e4f0f "=\n", in_header=0) at mime.c:845
845                     f += 2;
(gdb)
420                                 outpos += i;
(gdb) c
Continuing.
Input caption text hmmmmmmmere. Use the block's Settings tab to change the caption position and set other styles.


** Title of Conservation eNews
------------------------------------------------------------

Breakpoint 1, qp_decodestring (t=0x6e4fdf "=\n", f=0x6e4fdf "=\n", in_header=0) at mime.c:845
845                     f += 2;
(gdb)
  • note the “hmmmmmmmere”. i might have stopped it from segfaulting but this is probably the reason it was trying to do a bcopy() with a negative size.