Xstatic void display_page(char far *title, char far *text, unsigned text_len, int page, int num_pages, int start_margin, int *num_link, LINK far *link)
X {
X char temp[9];
X
X helptitle();
X helpinstr();
X setattr(2, 0, C_HELP_BODY, 80*22);
X putstringcenter(1, 0, 80, C_HELP_HDG, title);
X sprintf(temp, "%2d of %d", page+1, num_pages);
X#ifndef XFRACT
X putstring(1, 79-(6 + ((num_pages>=10)?2:1)), C_HELP_INSTR, temp);
X#else
X /* Some systems (Ultrix) mess up if you write to column 80 */
X putstring(1, 78-(6 + ((num_pages>=10)?2:1)), C_HELP_INSTR, temp);
X#endif
X
X if (text != NULL)
X display_parse_text(text, text_len, start_margin, num_link, link);
X
X movecursor(25, 80); /* hide cursor */
X }
X
X
X
X/*
X * int overlap(int a, int a2, int b, int b2);
X *
X * If a, a2, b, and b2 are points on a line, this function returns the
X * distance of intersection between a-->a2 and b-->b2. If there is no
X * intersection between the lines this function will return a negative number
X * representing the distance between the two lines.
X *
X * There are six possible cases of intersection between the lines:
X *
X * a a2
X * | |
X * b b2 | | b b2
X * |---(1)---| | | |---(2)---|
X * | |
X * b | b2 b | b2
X * |------(3)----| |------(4)-----|
X * | |
X * b | | b2
X * |------+--------(5)----------+---|
X * | |
X * | b b2 |
X * | |--(6)--| |
X * | |
X * | |
X *
X */
X
X
Xstatic int overlap(int a, int a2, int b, int b2)
X {
X if ( b < a )
X {
X if ( b2 >= a2 )
X return ( a2 - a ); /* case (5) */
X
X return ( b2 - a ); /* case (1), case (3) */
X }
X
X if ( b2 <= a2 )
X return ( b2 - b ); /* case (6) */
X
X return ( a2 - b ); /* case (2), case (4) */
X }
X
X
Xstatic int dist(int a, int b)
X {
X int t = a - b;
X
X return (abs(t));
X }
X
X
X#ifdef __TURBOC__
X# pragma warn -def /* turn off "Possible use before definition" warning */
X#endif
X
X
X
X
Xstatic int find_link_updown(LINK far *link, int num_link, int curr_link, int up)
X {
X int ctr,
X curr_c2,
X best_overlap,
X temp_overlap;
X LINK far *curr,
X far *temp,
X far *best;
X int temp_dist;
X
X curr = &link[curr_link];
X best = NULL;
X curr_c2 = curr->c + curr->width - 1;
X
X for (ctr=0, temp=link; ctr<num_link; ctr++, temp++)