groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] checking if groff was called with -U


From: Larry Kollar
Subject: Re: [Groff] checking if groff was called with -U
Date: Mon, 26 Apr 2004 21:56:57 -0400

Dorai Sitaram wrote:

Is there a way to check from the input text if groff was called in
unsafe mode?

Do you mean like a read-only register? I don't see one documented.
I think there *should* be one, so here's a patch to src/roff/troff/input.cpp that creates a read-only register \n[.U]. It returns 1 in safe mode or 0 in
unsafe mode.

--- input.cpp.orig      Mon Apr 26 21:48:04 2004
+++ input.cpp   Mon Apr 26 21:50:37 2004
@@ -7336,6 +7336,7 @@
   number_reg_dictionary.define(".g", new constant_reg("1"));
number_reg_dictionary.define(".H", new constant_int_reg(&hresolution));
   number_reg_dictionary.define(".R", new constant_reg("10000"));
+ number_reg_dictionary.define(".U", new constant_int_reg(&safer_flag)); number_reg_dictionary.define(".V", new constant_int_reg(&vresolution)); number_reg_dictionary.define(".warn", new constant_int_reg(&warning_mask));
   extern const char *major_version;

Hope that helps!

--
Larry Kollar     k  o  l  l  a  r  @  a  l  l  t  e  l  .  n  e  t
Unix Text Processing: "UTP Revival"
http://home.alltel.net/kollar/utp/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]