Subject: FvwmM4 -m4-prefix-defines

From: Sidik Isani <[email-masked]>
Date: Fri, 7 Sep 2001 09:56:26 -1000 (HST)

Hello -

  We need this at our site:  If you run FvwmM4 on unsuspecting
  users, "FvwmM4 -m4-prefix" prevents problems with "include", but
  there are still problems with $HOME in an exec becoming $/home/user.

  With the following patch, no default behavior is changed, but
  if FvwmM4 is also started with "-m4-prefix-defines", all of the
  built-in defines that *it* provides will start with "m4_".
  (So both $HOME and m4_HOME can be used.)

  This makes FvwmM4 completely transparent to the non-m4 user,
  as long as they don't have any strings starting with "m4_" in
  their fvwm2rc.

Be seeing you,

- Sidik

P.S.: Thanks for adding the new XineramaSls syntax.  I'll test it on
  a real SLS display next week.  (It needs the fix posted by Giuseppe
  with screens_xi.)

diff -ru fvwm/modules/FvwmM4/FvwmM4.1 fvwm-patched/modules/FvwmM4/FvwmM4.1
--- fvwm/modules/FvwmM4/FvwmM4.1	Mon Jul  2 21:23:07 2001
+++ fvwm-patched/modules/FvwmM4/FvwmM4.1	Thu Sep  6 22:38:57 2001
@@ -46,6 +46,10 @@
 .IP -m4-prefix
 I think this makes all the m4 directives require the prefix "m4_".
 
+.IP -m4-prefix-defines
+Causes built-in defines to be prefixed with "m4_" (i.e., m4_HOME
+is defined instead of HOME, etc.)
+
 .TP
 -m4opt \fIoption\fP
 Lets you pass an option to the m4 program.  Not really needed as any
diff -ru fvwm/modules/FvwmM4/FvwmM4.c fvwm-patched/modules/FvwmM4/FvwmM4.c
--- fvwm/modules/FvwmM4/FvwmM4.c	Sat Feb 10 06:56:33 2001
+++ fvwm-patched/modules/FvwmM4/FvwmM4.c	Thu Sep  6 22:43:26 2001
@@ -63,10 +63,11 @@
 static char *MkNum(char *name,int def);
 static char *m4_defs(Display *display, const char *host, char *m4_options, char *config_file);
 #define MAXHOSTNAME 255
-#define EXTRA 50
+#define EXTRA 56
 
 int  m4_enable;                 /* use m4? */
 int  m4_prefix;                 /* Do GNU m4 prefixing (-P) */
+int  m4_prefix_defines;		/* Add "m4_" to the names of the defines */
 char m4_options[BUFSIZ];        /* Command line options to m4 */
 char m4_outfile[BUFSIZ] = "";   /* The output filename for m4 */
 char *m4_prog = "m4";           /* Name of the m4 program */
@@ -105,6 +106,7 @@
 
   m4_enable = True;
   m4_prefix = False;
+  m4_prefix_defines = False;
   sprintf(m4_options, "-I '%s' ", FVWM_DATADIR);
   m4_default_quotes = 1;
 
@@ -138,6 +140,10 @@
 	{
 	  m4_prefix = TRUE;
 	}
+      else if(strcasecmp(argv[i],"-m4-prefix-defines") == 0)
+	{
+	  m4_prefix_defines = TRUE;
+	}
       else if(strcasecmp(argv[i],"-m4opt") == 0)
 	{
 	  /* leaving this in just in case-- any option starting with '-'
@@ -505,6 +511,8 @@
   else
     strcpy(cp, "define(");
 
+  if (m4_prefix_defines)
+    strcat(cp, "m4_");
   strcat(cp, name);
 
   /* Tack on "," and 2 sets of starting quotes */
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]