ref: e67818ce2e673f3a7f7765666219324640311586
parent: 272cc55e2f6be4ae04e0f06f4dafa6cb9e132727
author: Ali Gholami Rudi <ali@rudi.ir>
date: Fri Aug 1 20:11:26 EDT 2014
dev: mount fonts from given paths If the second argument of the "x f" command contains a slash, neatroff assumes that it is the path of the font description file. Otherwise, as before, the font is looked up in the output device directory.
--- a/dev.c
+++ b/dev.c
@@ -30,7 +30,10 @@
struct font *fn;
if (pos >= NFONTS)
return -1;
- sprintf(path, "%s/dev%s/%s", dev_dir, dev_dev, name);
+ if (strchr(name, '/'))
+ strcpy(path, name);
+ else
+ sprintf(path, "%s/dev%s/%s", dev_dir, dev_dev, name);
fn = font_open(path);
if (!fn)
return -1;
@@ -37,7 +40,7 @@
if (fn_font[pos])
font_close(fn_font[pos]);
if (fn_name[pos] != name) /* ignore if fn_name[pos] is passed */
- strcpy(fn_name[pos], id);
+ snprintf(fn_name[pos], sizeof(fn_name[pos]), "%s", id);
fn_font[pos] = fn;
return pos;
}