Allow specification of alternate samrcs via SAMRC. - sam - An updated version o… | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 3f2c8e96b3233b85916aaca81d4f414a8e90887f | |
parent 94871df993984b49dcb7037968bbd5277a7268f9 | |
Author: Rob King <[email protected]> | |
Date: Fri, 23 Sep 2016 21:29:23 -0500 | |
Allow specification of alternate samrcs via SAMRC. | |
Diffstat: | |
doc/sam.1 | 8 ++++++++ | |
samterm/main.c | 6 +++++- | |
2 files changed, 13 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/doc/sam.1 b/doc/sam.1 | |
@@ -1052,6 +1052,14 @@ e.g. | |
Any additional arguments should be passed to the command on the remote machine. | |
By default, this is the string | |
.Dq "ssh" "." | |
+.It Ev SAMRC | |
+If set, | |
+provides the name of the | |
+.Xr samrc 5 | |
+file to read at startup. | |
+By default, | |
+this is | |
+.Pa ${HOME}/.samrc "." | |
.It Ev TABS | |
A number between 1 and 12, indicating the width of a tab character. | |
This number is treated as a multiplier of the width of the '0' character. | |
diff --git a/samterm/main.c b/samterm/main.c | |
@@ -51,7 +51,11 @@ main(int argc, char *argv[]) | |
installdefaultbindings(); | |
installdefaultchords(); | |
- snprintf(rcpath, PATH_MAX, "%s/.samrc", getenv("HOME") ? getenv("HOME") : … | |
+ if (getenv("SAMRC")) | |
+ strncpy(rcpath, getenv("SAMRC"), PATH_MAX); | |
+ else | |
+ snprintf(rcpath, PATH_MAX, "%s/.samrc", getenv("HOME") ? getenv("HOME"… | |
+ | |
rc = fopen(rcpath, "r"); | |
if (rc){ | |
loadrcfile(rc); |