diff options
author | wl <wl> | 2006-05-30 17:29:09 +0000 |
---|---|---|
committer | wl <wl> | 2006-05-30 17:29:09 +0000 |
commit | 50e9fc1df6513643d35c2d537352f6ec130f4d12 (patch) | |
tree | 84244004390c19144a6b6a97e800af64b8caacc4 /src | |
parent | f2c362acd0e6f51a9ddd53112b482f1777b6686e (diff) | |
download | groff-50e9fc1df6513643d35c2d537352f6ec130f4d12.tar.gz |
* src/libs/libgroff/font.cpp (font::load): Reject fonts called
`DESC'.
Reduce number of false positives for `.if F ...' conditionals.
Improve warning messages.
* tmac/Makefile.sub: Add copyright notice.
(NORMALFILES): Add man.tmac and ms.tmac.
(SPECIALFILES): Remove man.tmac and ms.tmac.
(CLEANADD): Remove man.tmac-sed and ms.tmac-sed.
(install_data, uninstall_sub): Don't handle man.tmac and ms.tmac
specially.
(stamp-sed): Don't handle man.tmac and ms.tmac.
Remove obsolete components in sed's regexp.
* doc/Makefile.sub (EXAMPLEFILES): Add gnu.eps.
* Makefile.in (OTHERDIRS, NOMAKEDIRS): Add hdtbl.
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/libgroff/font.cpp | 26 | ||||
-rw-r--r-- | src/roff/troff/env.h | 2 | ||||
-rw-r--r-- | src/roff/troff/input.cpp | 6 |
3 files changed, 21 insertions, 13 deletions
diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp index 67d4f154..e0b6de0a 100644 --- a/src/libs/libgroff/font.cpp +++ b/src/libs/libgroff/font.cpp @@ -746,6 +746,13 @@ again: int font::load(int *not_found, int head_only) { + if (strcmp(name, "DESC") == 0) { + if (not_found) + *not_found = 1; + else + error("`DESC' is not a valid font file name"); + return 0; + } char *path; FILE *fp; if ((fp = open_file(name, &path)) == NULL) { @@ -771,7 +778,7 @@ int font::load(int *not_found, int head_only) p = strtok(0, WS); int n; if (p == 0 || sscanf(p, "%d", &n) != 1 || n <= 0) { - t.error("bad argument for spacewidth command"); + t.error("bad argument for `spacewidth' command"); return 0; } space_width = n; @@ -780,7 +787,7 @@ int font::load(int *not_found, int head_only) p = strtok(0, WS); double n; if (p == 0 || sscanf(p, "%lf", &n) != 1 || n >= 90.0 || n <= -90.0) { - t.error("bad argument for slant command", p); + t.error("bad argument for `slant' command", p); return 0; } slant = n; @@ -809,7 +816,7 @@ int font::load(int *not_found, int head_only) else if (strcmp(p, "internalname") == 0) { p = strtok(0, WS); if (!p) { - t.error("`internalname command requires argument"); + t.error("`internalname' command requires argument"); return 0; } internalname = new char[strlen(p) + 1]; @@ -826,8 +833,6 @@ int font::load(int *not_found, int head_only) else break; } - if (head_only) - return 1; int had_charset = 0; if (p == 0) { if (!is_unicode) { @@ -839,6 +844,8 @@ int font::load(int *not_found, int head_only) t.skip_comments = 0; while (command) { if (strcmp(command, "kernpairs") == 0) { + if (head_only) + return 1; for (;;) { if (!t.next()) { command = 0; @@ -868,6 +875,8 @@ int font::load(int *not_found, int head_only) } } else if (strcmp(command, "charset") == 0) { + if (head_only) + return 1; had_charset = 1; glyph *last_glyph = NULL; for (;;) { @@ -963,15 +972,16 @@ int font::load(int *not_found, int head_only) } } else { - t.error("unrecognised command `%1' after `kernpairs' or `charset' command", - command); + t.error("unrecognised command `%1' " + "after `kernpairs' or `charset' command", + command); return 0; } } compact(); } if (!is_unicode && !had_charset) { - t.error("missing charset command"); + t.error("missing `charset' command"); return 0; } if (space_width == 0) diff --git a/src/roff/troff/env.h b/src/roff/troff/env.h index 2ee7bdcf..01b6866d 100644 --- a/src/roff/troff/env.h +++ b/src/roff/troff/env.h @@ -398,7 +398,7 @@ public: friend void do_divert(int append, int boxing); }; - + extern environment *curenv; extern void pop_env(); extern void push_env(int); diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index e3ecef47..053468e5 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -2023,13 +2023,11 @@ void token::next() case 'H': // don't take height increments relative to previous height if // in compatibility mode - if (!compatible_flag && curenv->get_char_height()) - { + if (!compatible_flag && curenv->get_char_height()) { if (get_delim_number(&x, 'z', curenv->get_char_height())) curenv->set_char_height(x); } - else - { + else { if (get_delim_number(&x, 'z', curenv->get_requested_point_size())) curenv->set_char_height(x); } |