From 8fad60a1c6beb6bd73d6ceecfbe42872b1cb43b4 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 22 Sep 2002 17:03:28 +0000 Subject: [PATCH] * man2hlp.c: Take text width from help.h, not from the command line. * help.h: Declare HELP_TEXT_WIDTH. * help.c: Use HELP_TEXT_WIDTH. --- src/ChangeLog | 5 +++++ src/help.c | 7 +++++-- src/help.h | 8 +++----- src/man2hlp.c | 13 ++++++------- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 0090ddb87..68dd2d07c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2002-09-22 Pavel Roskin + * man2hlp.c: Take text width from help.h, not from the command + line. + * help.h: Declare HELP_TEXT_WIDTH. + * help.c: Use HELP_TEXT_WIDTH. + * help.h: Replace CHAR_BOLD_ON, CHAR_BOLD_OFF and CHAR_ITALIC_ON with CHAR_FONT_BOLD, CHAR_FONT_NORMAL and CHAR_FONT_ITALIC respectively for better consistency. diff --git a/src/help.c b/src/help.c index e7e31950b..4c5b7a2eb 100644 --- a/src/help.c +++ b/src/help.c @@ -56,9 +56,12 @@ #define MAXLINKNAME 80 #define HISTORY_SIZE 20 -#define HELP_WINDOW_WIDTH 62 +#define HELP_WINDOW_WIDTH (HELP_TEXT_WIDTH + 4) -/* "$Id$" */ +#define STRING_LINK_START "\01" +#define STRING_LINK_POINTER "\02" +#define STRING_LINK_END "\03" +#define STRING_NODE_END "\04" static char *data; /* Pointer to the loaded data file */ static int help_lines; /* Lines in help viewer */ diff --git a/src/help.h b/src/help.h index 87486d5f1..d6d31a35a 100644 --- a/src/help.h +++ b/src/help.h @@ -3,7 +3,9 @@ /* This file is included by help.c and man2hlp.c */ -/* Some useful constants */ +#define HELP_TEXT_WIDTH 58 + +/* Markers used in the help files */ #define CHAR_NODE_END '\04' #define CHAR_LINK_START '\01' #define CHAR_LINK_POINTER '\02' @@ -22,10 +24,6 @@ #define CHAR_TITLE_OFF '\023' #define CHAR_FONT_ITALIC '\024' #define CHAR_RESERVED '\025' -#define STRING_LINK_START "\01" -#define STRING_LINK_POINTER "\02" -#define STRING_LINK_END "\03" -#define STRING_NODE_END "\04" void interactive_display (char *filename, char *node); #endif /* __HELP_H */ diff --git a/src/man2hlp.c b/src/man2hlp.c index 085820bbb..1400678cd 100644 --- a/src/man2hlp.c +++ b/src/man2hlp.c @@ -27,7 +27,6 @@ #define BUFFER_SIZE 256 -static int width; /* Output width in characters */ static int col = 0; /* Current output column */ static int out_row = 1; /* Current output row */ static int in_row = 0; /* Current input row */ @@ -235,7 +234,7 @@ print_string (char *buffer) if (*(buffer)) { len = string_len (buffer); /* Change the line if about to break the right margin */ - if (col + len >= width) + if (col + len >= HELP_TEXT_WIDTH) newline (); /* Words are separated by spaces */ if (col > 0) { @@ -519,15 +518,15 @@ main (int argc, char **argv) long file_end; /* Length of the output file */ /* Validity check for arguments */ - if ((argc != 5) || ((width = atoi (argv[1])) <= 10)) { + if (argc != 4) { fprintf (stderr, - "Usage: man2hlp width file.man template_file helpfile\n"); + "Usage: man2hlp file.man template_file helpfile\n"); return 3; } - c_man = argv[2]; - c_tmpl = argv[3]; - c_out = argv[4]; + c_man = argv[1]; + c_tmpl = argv[2]; + c_out = argv[3]; /* First stage - process the manual, write to the output file */ f_man = fopen_check (c_man, "r"); -- 2.11.4.GIT