summaryrefslogtreecommitdiff
path: root/src/roff/troff/input.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/roff/troff/input.cc')
-rw-r--r--src/roff/troff/input.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc
index 0a18b0d7..9a10d7db 100644
--- a/src/roff/troff/input.cc
+++ b/src/roff/troff/input.cc
@@ -29,6 +29,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "token.h"
#include "div.h"
#include "charinfo.h"
+#include "stringclass.h"
#include "font.h"
#include "searchpath.h"
#include "macropath.h"
@@ -39,6 +40,12 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "nonposix.h"
+#ifdef NEED_DECLARATION_PUTENV
+extern "C" {
+ int putenv(const char *);
+}
+#endif /* NEED_DECLARATION_PUTENV */
+
#ifdef ISATTY_MISSING
#undef isatty
#define isatty(n) (1)
@@ -5830,6 +5837,17 @@ int main(int argc, char **argv)
int next_page_number;
opterr = 0;
hresolution = vresolution = 1;
+ // restore $PATH if called from groff
+ char* groff_path = getenv("GROFF_PATH__");
+ if (groff_path) {
+ string e = "PATH";
+ e += '=';
+ if (*groff_path)
+ e += groff_path;
+ e += '\0';
+ if (putenv(strsave(e.contents())))
+ fatal("putenv failed");
+ }
while ((c = getopt(argc, argv, "abivw:W:zCEf:m:n:o:r:d:F:M:T:tqs:RU"))
!= EOF)
switch(c) {