wdvi

network DVI viewer
Log | Files | Refs

commit 94f3e71b9af968887b99c1a1ddf6a353f702c18d
parent 264bbe10425a8bbf42bbbbfa1b4a12b16ca84c20
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Mon, 16 Aug 2021 23:05:10 +0000

Unifdef OPEN_MODE "r"

There is no reason to have this indirection anymore.

Diffstat:
Mdvi-draw.c | 4++--
Mdvi-init.c | 2+-
Mfilefind.c | 4++--
Mfont-open.c | 10+++++-----
Mpopups.c | 2+-
Mspecial.c | 8++++----
Mxdvi.h | 8+-------
7 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/dvi-draw.c b/dvi-draw.c @@ -642,7 +642,7 @@ open_font_file(fontp) struct font *fontp; { if (fontp->file == NULL) { - fontp->file = xfopen(fontp->filename, OPEN_MODE); + fontp->file = xfopen(fontp->filename, "r"); if (fontp->file == NULL) oops("Font file disappeared: %s", fontp->filename); } @@ -2328,7 +2328,7 @@ src_spawn_editor(parsed) } if (debug & DBG_OPEN) Printf("Trying source special file %s\n", filename2); - f = xfopen(filename2, OPEN_MODE); + f = xfopen(filename2, "r"); } if (f == NULL) { diff --git a/dvi-init.c b/dvi-init.c @@ -821,7 +821,7 @@ open_dvi_file(path) struct stat buf; ino_t old_inode; - dvi_file = fopen(path, OPEN_MODE); + dvi_file = fopen(path, "r"); if (dvi_file == NULL) return False; diff --git a/filefind.c b/filefind.c @@ -1590,7 +1590,7 @@ TRY_TO_OPEN(pos, flags) if (FFDEBUG) printf("Trying %s file %s\n", lrec.type, ffline); - file_found = xfopen(ffline, OPEN_MODE); + file_found = xfopen(ffline, "r"); if (file_found != NULL) longjmp(got_it, 1); } @@ -1794,7 +1794,7 @@ init_quick_find(root, pos, atom, pos1) bcopy(ffline + pos, tmpsav, sizeof(tmpsav)); bcopy("ls-R", ffline + pos, sizeof(tmpsav)); if (FFDEBUG) printf("Opening ls-R file %s\n", ffline); - f = xfopen(ffline, OPEN_MODE); + f = xfopen(ffline, "r"); bcopy(tmpsav, ffline + pos, sizeof(tmpsav)); if (f == NULL) { if (FFDEBUG) printf("xfopen: %s\n", strerror(errno)); diff --git a/font-open.c b/font-open.c @@ -709,7 +709,7 @@ gs_try_fopen(str, len, name) ffline[len] = '/'; memcpy(ffline + len + 1, name, namelen); - f = xfopen(ffline, OPEN_MODE); + f = xfopen(ffline, "r"); if (debug & DBG_OPEN) Printf("gs_try_fopen: %s: %s\n", ffline, @@ -840,7 +840,7 @@ lookup_gs_font(font, path_ret) if (gl->value[0] == '/' || (gl->value[0] == '.' && (gl->value[1] == '/' || (gl->value[1] == '.' && gl->value[2] == '/')))) { - f = xfopen(gl->value, OPEN_MODE); + f = xfopen(gl->value, "r"); if (f != NULL) { *path_ret = xstrdup(gl->value); break; @@ -1130,7 +1130,7 @@ process_gs_fontmap P1C(FILE *, f) ffline[pos1] = '\0'; if (ffline[0] == '/' || (ffline[0] == '.' && (ffline[1] == '/' || (ffline[1] == '.' && ffline[2] == '/')))) - f1 = xfopen(ffline, OPEN_MODE); + f1 = xfopen(ffline, "r"); else { char *q; @@ -1719,7 +1719,7 @@ init_font_open() } } if (dvipsrc != NULL) { - f = xfopen(dvipsrc, OPEN_MODE); + f = xfopen(dvipsrc, "r"); if (f != NULL) getdefaults(f); } @@ -2260,7 +2260,7 @@ makefont(font, dpi, name, magstepval) Printf("%s ---> %s\n", actual_command + 2, ffline); free((void *) actual_command); - f = xfopen(ffline, OPEN_MODE); + f = xfopen(ffline, "r"); if (f == NULL) { perror(ffline); return NULL; diff --git a/popups.c b/popups.c @@ -1268,7 +1268,7 @@ cb_file_go(w, client_data, call_data) provided by xfopen(), since there is only one of them. However, in this case we're opening one before closing the old one, so we have to use xfopen() in this case. */ - f = xfopen(str, OPEN_MODE); + f = xfopen(str, "r"); if (f == NULL) warning_popup_long("Error opening file: %s\n%s.", "OK", NULL, str, strerror(errno)); diff --git a/special.c b/special.c @@ -894,7 +894,7 @@ cachetick(filename, pathinfo, fp, fdp) } if (strcmp(filename, tikp->command) == 0) { /* found it */ *linkp = tikp->next; /* unlink it */ - *fp = xfopen(tikp->tempname, OPEN_MODE); + *fp = xfopen(tikp->tempname, "r"); if (*fp == NULL) { perror(tikp->tempname); free(tikp->tempname); @@ -976,7 +976,7 @@ send_ps_file(filename, pathinfo) expandline(len); Sprintf(ffline, "%s > %s", filename + 1, tikp->tempname); (void) system(ffline); - f = xfopen(tikp->tempname, OPEN_MODE); + f = xfopen(tikp->tempname, "r"); if (f == NULL) { perror(tikp->tempname); return; @@ -1002,7 +1002,7 @@ send_ps_file(filename, pathinfo) bufp = ffline; } if (debug & DBG_OPEN) Printf("Trying PS file %s\n", bufp); - f = xfopen(bufp, OPEN_MODE); + f = xfopen(bufp, "r"); } if (f == NULL) { f = filefind(filename, pathinfo, (const char **) NULL); @@ -1074,7 +1074,7 @@ send_ps_file(filename, pathinfo) perror("[xdvi] waitpid"); return; } - f = xfopen(tikp->tempname, OPEN_MODE); + f = xfopen(tikp->tempname, "r"); if (f == NULL) { perror(tikp->tempname); return; diff --git a/xdvi.h b/xdvi.h @@ -113,12 +113,6 @@ typedef char Bool3; /* Yes/No/Maybe */ #define NORETURN __attribute__((__noreturn__)) #define UNUSED __attribute__((__unused__)) -#ifndef OPEN_MODE -#define OPEN_MODE "r" -#endif /* OPEN_MODE */ - -#define OPEN_MODE_ARGS const char * - #define Printf (void) printf #define Puts (void) puts #define Fprintf (void) fprintf @@ -1050,7 +1044,7 @@ extern void alloc_bitmap ARGS((struct bitmap *)); extern void xputenv ARGS((const char *, const char *)); #endif extern int memicmp ARGS((const char *, const char *, size_t)); -extern FILE *xfopen ARGS((const char *, OPEN_MODE_ARGS)); +extern FILE *xfopen ARGS((const char *, const char *)); extern int xopen ARGS((const char *, int)); extern int xpipe ARGS((int *)); extern DIR *xopendir ARGS((const char *));