added the $HOME variable in the AFMPATH - enscript - GNU Enscript
HTML git clone git://thinkerwim.org/enscript.git
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 8dd15a323fa471f3ec726fd9a274c37123cb90f5
DIR parent 4828bae2f661b7b29b6db6d53bb8ebe17c5c1b94
HTML Author: Wim Stockman <wim@yasendfile.org>
Date: Fri, 10 Mar 2023 14:39:18 +0100
added the $HOME variable in the AFMPATH
so now you can use the $HOME variable in the AFMPATH
if you want your user to use there own fonts
I advice the put the userfonts in $HOME/.config/enscript/afm
Diffstat:
A .gitignore | 1 +
M src/util.c | 14 ++++++++++++++
R convertfontto.sh -> tools/convertf… | 0
3 files changed, 15 insertions(+), 0 deletions(-)
---
DIR diff --git a/.gitignore b/.gitignore
@@ -0,0 +1 @@
+afmlib/.deps
DIR diff --git a/src/util.c b/src/util.c
@@ -93,6 +93,19 @@ static struct
if (token2 == NULL) \
CFG_FATAL ((stderr, _("missing argument: %s"), token));
+void search_and_replace(char *str, char *search, char *replace) {
+ char *pos;
+ int search_len = strlen(search);
+ int replace_len = strlen(replace);
+
+ while ((pos = strstr(str, search)) != NULL) {
+ char tmp[strlen(str) + 1];
+ strcpy(tmp, pos + search_len);
+ strcpy(pos, replace);
+ strcpy(pos + replace_len, tmp);
+ str = pos + replace_len;
+ }
+}
int
read_config (char *path, char *file)
{
@@ -139,6 +152,7 @@ read_config (char *path, char *file)
{
token2 = GET_TOKEN (NULL);
CHECK_TOKEN ();
+ search_and_replace(token2,"$HOME",getenv("HOME"));
xfree (afm_path);
afm_path = xstrdup (token2);
}
DIR diff --git a/convertfontto.sh b/tools/convertfontto.sh