wdvi

network DVI viewer
Log | Files | Refs

commit 56acd0fc2cc3cc01dd125cff237d2db0abd90827
parent bee1c5d81bb6ae58bf540db8f1ad6017a4e296fd
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Sat, 11 Sep 2021 19:48:33 +0000

convert more fprintf(stderr, ...) to warnx()

Diffstat:
Mdvi-draw.c | 10+++++-----
Mfont-open.c | 2+-
Mft.c | 23+++++++++++++----------
Mpk.c | 3+--
Mpopups.c | 2+-
Mspecial.c | 2+-
Mutil.c | 2+-
Mvf.c | 6++----
Mxdvi.h | 3---
9 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/dvi-draw.c b/dvi-draw.c @@ -252,9 +252,9 @@ tell_oops(const char *message, ...) va_end(args); if (currinf.virtual) - Fprintf(stderr, " in virtual font %s\n", currinf.virtual->fontname); + warnx("in virtual font '%s'", currinf.virtual->fontname); else - Fprintf(stderr, ", offset %ld\n", xtell(currinf.pos - 1)); + warnx("offset %ld", xtell(currinf.pos - 1)); exit(1); } @@ -334,7 +334,7 @@ print_dvi(ch) return; } else s = dvi_table2[ch - (FNTNUM0 + 64)]; - if (s) Puts(s); + if (s) puts(s); else tell_oops("unknown op-code %d", ch); } @@ -725,7 +725,7 @@ set_char(wide_ubyte cmd, wide_ubyte ch) if ((g = &currinf.fontp->glyph[ch])->bitmap.bits == NULL) { if (g->addr == 0) { if (!hush_chars) - Fprintf(stderr, "Character %d not defined in font %s\n", ch, + warnx("Character %d not defined in font '%s'", ch, currinf.fontp->fontname); g->addr = -1; return ERRVAL; @@ -834,7 +834,7 @@ set_vf_char(wide_ubyte cmd, wide_ubyte ch) if (ch > maxchar) realloc_virtual_font(currinf.fontp, ch); if ((m = &currinf.fontp->macro[ch])->pos == NULL) { if (!hush_chars) - Fprintf(stderr, "Character %d not defined in font %s\n", ch, + warnx("Character %d not defined in font '%s'", ch, currinf.fontp->fontname); m->pos = m->end = &c; return ERRVAL; diff --git a/font-open.c b/font-open.c @@ -1553,7 +1553,7 @@ init_font_open() printf("Map file: %s\n", p_head->value); break; } - Fprintf(stderr, "Cannot open map file %s\n", p_head->value); + warnx("Cannot open map file '%s'", p_head->value); p_head = p_head->next; } } diff --git a/ft.c b/ft.c @@ -34,10 +34,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <err.h> #include <math.h> -#include <ft2build.h> -#include FT_FREETYPE_H -#include FT_SIZES_H - static FT_Library library = NULL; static struct avl_enc *enc_head = NULL; @@ -303,8 +299,11 @@ load_ft_font(fontp) if (face != NULL) { /* if this face is already in use */ err = FT_New_Size(face, &size); if (err != 0) { - Fprintf(stderr, "Could not load FreeType font %s at %d: FreeType FT_New_Size error = %d.\nWill try pixel version instead.\nPlease see the FreeType documentation for details about this.\n", - fontp->fontname, (int) (fontp->fsize + 0.5), err); + warnx("Could not load FreeType font '%s' at %d", + fontp->fontname, (int) (fontp->fsize + 0.5)); + warnx("FreeType FT_New_Size error = %d.", err); + warnx("Will try pixel version instead."); + warnx("Please see the FreeType documentation for details about this."); return False; } } @@ -318,8 +317,10 @@ load_ft_font(fontp) if (library == NULL) { err = FT_Init_FreeType(&library); if (err != 0) { - Fprintf(stderr, "Could not initialize FreeType library: FreeType FT_Init_FreeType error = %d.\nTurning off use of FreeType.\nPlease see the FreeType documentation for details about this.\n", - err); + warnx("Could not initialize FreeType library"); + warnx("FreeType FT_Init_FreeType error = %d.", err); + warnx("Turning off use of FreeType."); + warnx("Please see the FreeType documentation for details about this."); free((char *) path); Fclose(f); ++n_files_left; @@ -342,8 +343,10 @@ load_ft_font(fontp) args.stream = &ftp->stream; err = FT_Open_Face(library, &args, 0, &face); if (err != 0) { - Fprintf(stderr, "Could not load FreeType font %s: FreeType FT_Open_Face error = %d.\nWill try pixel version instead.\nPlease see the FreeType documentation for details about this.\n", - fontp->fontname, err); + warnx("Could not load FreeType font '%s'", fontp->fontname); + warnx("FreeType FT_Open_Face error = %d.", err); + warnx("Will try pixel version instead."); + warnx("Please see the FreeType documentation for details about this."); free((char *) path); Fclose(f); ++n_files_left; diff --git a/pk.c b/pk.c @@ -317,8 +317,7 @@ read_PK_index(struct font *fontp, Boolean hushcs) checksum = four(fontp->file); if (checksum != fontp->checksum && checksum != 0 && fontp->checksum != 0 && !hushcs) - Fprintf(stderr, - "Checksum mismatch (dvi = %lu, pk = %lu) in font file %s\n", + warnx("Checksum mismatch (dvi = %lu, pk = %lu) in font file '%s'", fontp->checksum, checksum, fontp->filename); hppp = sfour(fontp->file); vppp = sfour(fontp->file); diff --git a/popups.c b/popups.c @@ -1377,7 +1377,7 @@ print_do_it() _exit(1); } (void) execvp(*argv, argv); - Fprintf(stderr, "Execvp of %s failed.\n", *argv); + warn("Execvp of '%s' failed.", *argv); Fflush(stderr); _exit(1); } diff --git a/special.c b/special.c @@ -916,7 +916,7 @@ parse_color(cp0, cp, rgbp) } if (cp0 != NULL) - Fprintf(stderr, "Invalid color name in special `%s'\n", cp0); + warnx("Invalid color name in special `%s'", cp0); return False; } diff --git a/util.c b/util.c @@ -192,7 +192,7 @@ close_a_file() struct font *f = NULL; if (debug & DBG_OPEN) - Puts("Calling close_a_file()"); + puts("Calling close_a_file()"); for (fontp = font_head; fontp != NULL; fontp = fontp->next) if (fontp->file != NULL && fontp->timestamp <= oldest) { diff --git a/vf.c b/vf.c @@ -74,8 +74,7 @@ read_VF_index(struct font *fontp, Boolean hushcs) checksum = four(VF_file); if (checksum != fontp->checksum && checksum != 0 && fontp->checksum != 0 && !hushcs) - Fprintf(stderr, - "Checksum mismatch (dvi = %lu, vf = %lu) in font file %s\n", + warnx("Checksum mismatch (dvi = %lu, vf = %lu) in font file '%s'", fontp->checksum, checksum, fontp->filename); (void) four(VF_file); /* skip design size */ /* @@ -110,8 +109,7 @@ read_VF_index(struct font *fontp, Boolean hushcs) cc = four(VF_file); width = four(VF_file); if (cc >= 256) { - Fprintf(stderr, - "Virtual character %lu in font %s ignored.\n", + warnx("Virtual character %lu in font '%s' ignored.", cc, fontp->fontname); Fseek(VF_file, (long) len, 1); continue; diff --git a/xdvi.h b/xdvi.h @@ -52,8 +52,6 @@ NOTE: #define NORETURN __attribute__((__noreturn__)) #define Printf (void) printf -#define Puts (void) puts -#define Fprintf (void) fprintf #define Sprintf (void) sprintf #define Fseek (void) fseek #define Fread (void) fread @@ -62,7 +60,6 @@ NOTE: #define Putchar (void) putchar #define Fclose (void) fclose #define Fflush (void) fflush -#define Strcat (void) strcat #define Strcpy (void) strcpy /********************************