1
1

(handle_command): Handle '.\"NODE' comment. Use it for

nodename in translated manual pages.
Этот коммит содержится в:
Andrew V. Samoilov 2002-02-28 14:38:38 +00:00
родитель ad0767356f
Коммит b5a0c42e21
2 изменённых файлов: 17 добавлений и 8 удалений

Просмотреть файл

@ -2,6 +2,8 @@
* man2hlp.c (main): Don't crash if called without argument(s). * man2hlp.c (main): Don't crash if called without argument(s).
Make buffer char pointer. Make buffer char pointer.
(handle_command): Handle '.\"NODE' comment. Use it for
nodename in translated manual pages.
* find.c (find_parameters): Compile content_pattern here. * find.c (find_parameters): Compile content_pattern here.
Inform user about malformed regular expression. Inform user about malformed regular expression.

Просмотреть файл

@ -36,6 +36,7 @@ static int skip_flag = 0; /* Flag: Skip this section.
2 = title skipped, skipping text */ 2 = title skipped, skipping text */
static int link_flag = 0; /* Flag: Next line is a link */ static int link_flag = 0; /* Flag: Next line is a link */
static int verbatim_flag = 0; /* Flag: Copy input to output verbatim */ static int verbatim_flag = 0; /* Flag: Copy input to output verbatim */
static int node = 0; /* Flag: This line is an original ".SH" */
/* Report error in input */ /* Report error in input */
static void print_error (char *message) static void print_error (char *message)
@ -134,7 +135,7 @@ static void print_string (char *buffer)
/* Attempt to handle backslash quoting */ /* Attempt to handle backslash quoting */
while (*(buffer)) while (*(buffer))
{ {
c = *buffer; c = *buffer++;
if (c == '\\' && !backslash_flag){ if (c == '\\' && !backslash_flag){
backslash_flag = 1; backslash_flag = 1;
continue; continue;
@ -170,7 +171,8 @@ static void handle_command (char *buffer)
/* Get the command name */ /* Get the command name */
strtok (buffer, " \t"); strtok (buffer, " \t");
if (strcmp (buffer, ".SH") == 0){ if ((strcmp (buffer, ".SH") == 0) || (strcmp (buffer, ".\\\"NODE") == 0)){
int SH = (strcmp (buffer, ".SH") == 0);
/* If we already skipped a section, don't skip another */ /* If we already skipped a section, don't skip another */
if (skip_flag == 2){ if (skip_flag == 2){
skip_flag = 0; skip_flag = 0;
@ -210,15 +212,20 @@ static void handle_command (char *buffer)
skip_flag = 2; skip_flag = 2;
} }
else { else {
if (!SH || !node){
/* Start a new section */ /* Start a new section */
printf ("%c[%s]", CHAR_NODE_END, buffer); printf ("%c[%s]", CHAR_NODE_END, buffer);
col ++; col ++;
newline (); newline ();
}
if (SH){
print_string (buffer + heading_level); print_string (buffer + heading_level);
newline (); newline ();
newline (); newline ();
}
} /* Start new section */ } /* Start new section */
} /* Has parameters */ } /* Has parameters */
node = !SH;
} /* Command .SH */ } /* Command .SH */
else if (strcmp (buffer, ".\\\"DONT_SPLIT\"") == 0){ else if (strcmp (buffer, ".\\\"DONT_SPLIT\"") == 0){
no_split_flag = 1; no_split_flag = 1;