Index: modules/ChangeLog
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/ChangeLog,v
retrieving revision 1.1179
diff -u -u -r1.1179 ChangeLog
--- modules/ChangeLog	9 Feb 2006 11:49:33 -0000	1.1179
+++ modules/ChangeLog	9 Feb 2006 15:18:49 -0000
@@ -1,3 +1,46 @@
+2006-02-10  Renato Caldas  <seventhguardian@gmail.com>
+
+	* FvwmTheme/FvwmTheme.c:
+	* FvwmScript/FvwmScript.c:
+	* FvwmScript/Instructions.c:
+	* FvwmSave/FvwmSave.c:
+	* FvwmSaveDesk/FvwmSaveDesk.c:
+	* FvwmRearrange/FvwmRearrange.c:
+	* FvwmScroll/FvwmScroll.c:
+	* FvwmScroll/FvwmScroll.h:
+	* FvwmScroll/GrabWindow.c:
+	* FvwmTaskBar/FvwmTaskBar.c:
+	* FvwmTaskBar/Goodies.c:
+	* FvwmTaskBar/List.c:
+	* FvwmTaskBar/Start.c:
+	Replaced global vars for name and name length for a ModuleArgs
+	struct pointed by "module".
+	main() changed to copy the global fd's for comunication with fvwm
+	from the struct.
+	main() changed to use ParseModuleArgs instead of the "manual"
+	parsing methods.
+	main() changed to use the struct's user_argc and user_argv for
+	parsing command line options.
+	Small misc changes to use module->name for error messages.
+
+	* FvwmTaskBar/FvwmTaskBar.c: (ParseConfig, ParseConfigLine)
+	* FvwmTaskBar/Goodies.c: (GoodiesParseConfig)
+	Changed functions to use CatString3 and module->name.
+
+	* FvwmTaskBar/Start.c:	(StartButtonParseConfig)
+	Changed function to use module->namelen.
+
+	* FvwmScroll/FvwmScroll.c:
+	Replaced global var win_app for module->window.
+
+	* FvwmRearrange/FvwmRearrange.c:
+	Removed unused variable "len".
+
+	* FvwmTaskBar/Start.c:
+	* FvwmScript/Instructions.c:
+	Added #include "libs/Module.h" in order to be able
+	to use the ModuleArgs struct
+
 2006-02-09  Renato Caldas  <seventhguardian@gmail.com>
 
 	* FvwmAuto/FvwmAuto.c:
Index: modules/FvwmRearrange/FvwmRearrange.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmRearrange/FvwmRearrange.c,v
retrieving revision 1.33
diff -u -u -r1.33 FvwmRearrange.c
--- modules/FvwmRearrange/FvwmRearrange.c	26 Nov 2005 21:55:12 -0000	1.33
+++ modules/FvwmRearrange/FvwmRearrange.c	9 Feb 2006 15:18:57 -0000
@@ -59,7 +59,7 @@
 Display *dpy;
 int dx, dy;
 int dwidth, dheight;
-char *argv0;
+static ModuleArgs *module;
 int fd[2];
 fd_set_size_t fd_width;
 window_list wins = NULL, wins_tail = NULL;
@@ -205,7 +205,7 @@
     default:
       fprintf(console,
 	"%s: internal inconsistency: unknown message 0x%08x\n",
-	argv0, (int)packet->type);
+	module->name, (int)packet->type);
       break;
     }
   }
@@ -483,7 +483,7 @@
       if (++nsargc > 4) {
 	fprintf(console,
 		"%s: %s: ignoring unknown arg %s\n",
-		argv0, s, argv[argi]);
+		module->name, s, argv[argi]);
 	continue;
       }
       if (nsargc == 1) {
@@ -512,31 +512,25 @@
 int main(int argc, char *argv[])
 {
   char match[128];
-  int len;
   char *config_line;
   int scr;
 
   console = fopen("/dev/console","w");
   if (!console) console = stderr;
 
-  if (!(argv0 = strrchr(argv[0],'/')))
-    argv0 = argv[0];
-  else
-    ++argv0;
-
-  if (argc < 6) {
-    fprintf(stderr,
-	    "%s: module should be executed by fvwm only\n",
-	    argv0);
+  module = ParseModuleArgs(argc,argv,0);
+  if (module == NULL)
+  {
+    fprintf(stderr,"FvwmRearrange: module should be executed by fvwm only\n");
     exit(-1);
   }
 
-  fd[0] = atoi(argv[1]);
-  fd[1] = atoi(argv[2]);
+  fd[0] = module->to_fvwm;
+  fd[1] = module->from_fvwm;
 
   if (!(dpy = XOpenDisplay(NULL))) {
     fprintf(console, "%s: couldn't open display %s\n",
-	    argv0,
+	    module->name,
 	    XDisplayName(NULL));
     exit(-1);
   }
@@ -547,8 +541,7 @@
   fd_width = GetFdWidth();
 
   strcpy(match, "*");
-  strcat(match, argv0);
-  len = strlen(match);
+  strcat(match, module->name);
   InitGetConfigLine(fd,match);
   GetConfigLine(fd, &config_line);
   while (config_line != NULL)
@@ -563,8 +556,8 @@
   }
   FScreenGetScrRect(NULL, FSCREEN_CURRENT, &dx, &dy, &dwidth, &dheight);
 
-  if (strcmp(argv0, "FvwmCascade") &&
-      (!strcmp(argv0, "FvwmTile") ||
+  if (strcmp(module->name, "FvwmCascade") &&
+      (!strcmp(module->name, "FvwmTile") ||
        (argc >= 7 && !strcmp(argv[6], "-tile")))) {
     FvwmTile = 1;
     FvwmCascade = 0;
@@ -574,7 +567,7 @@
     FvwmTile = 0;
     resize = 0;
   }
-  parse_args("module args", argc, argv, 6);
+  parse_args("module args", module->user_argc, module->user_argv, 0);
 
   SetMessageMask(fd,
 		 M_CONFIGURE_WINDOW |
Index: modules/FvwmSave/FvwmSave.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmSave/FvwmSave.c,v
retrieving revision 1.24
diff -u -u -r1.24 FvwmSave.c
--- modules/FvwmSave/FvwmSave.c	26 Nov 2005 21:55:12 -0000	1.24
+++ modules/FvwmSave/FvwmSave.c	9 Feb 2006 15:18:57 -0000
@@ -43,7 +43,7 @@
 
 #include "FvwmSave.h"
 
-char *MyName;
+static ModuleArgs *module;
 int fd[2];
 
 struct list *list_root = NULL;
@@ -62,31 +62,20 @@
  */
 int main(int argc, char **argv)
 {
-  char *temp, *s;
   char *display_name = NULL;
 
-  /* Record the program name for error messages */
-  temp = argv[0];
-
-  s=strrchr(argv[0], '/');
-  if (s != NULL)
-    temp = s + 1;
-
-  MyName = safemalloc(strlen(temp)+2);
-  strcpy(MyName,"*");
-  strcat(MyName, temp);
-
-  if((argc != 6)&&(argc != 7))
-    {
-      fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",MyName,
-	      VERSION);
-      exit(1);
-    }
+  module = ParseModuleArgs(argc,argv,0); /* don't accept an alias */
+  if (module == NULL)
+  {
+    fprintf(stderr,"FvwmSave Version %s should only be executed by fvwm!\n",
+            VERSION);
+    exit(1);
+  }
 
   /* Open the X display */
   if (!(dpy = XOpenDisplay(display_name)))
     {
-      fprintf(stderr,"%s: can't open display %s", MyName,
+      fprintf(stderr,"%s: can't open display %s", module->name,
 	      XDisplayName(display_name));
       exit (1);
     }
@@ -97,8 +86,8 @@
   /* We should exit if our fvwm pipes die */
   signal (SIGPIPE, DeadPipe);
 
-  fd[0] = atoi(argv[1]);
-  fd[1] = atoi(argv[2]);
+  fd[0] = module->to_fvwm;
+  fd[1] = module->from_fvwm;
 
   /* Create a list of all windows */
   /* Request a list of all windows,
Index: modules/FvwmSaveDesk/FvwmSaveDesk.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmSaveDesk/FvwmSaveDesk.c,v
retrieving revision 1.25
diff -u -u -r1.25 FvwmSaveDesk.c
--- modules/FvwmSaveDesk/FvwmSaveDesk.c	26 Nov 2005 21:55:12 -0000	1.25
+++ modules/FvwmSaveDesk/FvwmSaveDesk.c	9 Feb 2006 15:18:58 -0000
@@ -57,7 +57,7 @@
 
 #include "FvwmSaveDesk.h"
 
-char *MyName;
+static ModuleArgs *module;
 int fd[2];
 
 struct list *list_root = NULL;
@@ -78,31 +78,20 @@
  */
 int main(int argc, char **argv)
 {
-  char *temp, *s;
   char *display_name = NULL;
 
-  /* Record the program name for error messages */
-  temp = argv[0];
-
-  s=strrchr(argv[0], '/');
-  if (s != NULL)
-    temp = s + 1;
-
-  MyName = safemalloc(strlen(temp)+2);
-  strcpy(MyName,"*");
-  strcat(MyName, temp);
-
-  if((argc != 6)&&(argc != 7))
-    {
-      fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",MyName,
-	      VERSION);
-      exit(1);
-    }
+  module = ParseModuleArgs(argc,argv,0); /* no alias */
+  if (module == NULL)
+  {
+    fprintf(stderr,"FvwmSaveDesk Version %s should only be executed by fvwm!\n",
+            VERSION);
+    exit(1);
+  }
 
   /* Open the X display */
   if (!(dpy = XOpenDisplay(display_name)))
     {
-      fprintf(stderr,"%s: can't open display %s", MyName,
+      fprintf(stderr,"%s: can't open display %s", module->name,
 	      XDisplayName(display_name));
       exit (1);
     }
@@ -113,8 +102,8 @@
   /* We should exit if our fvwm pipes die */
   signal (SIGPIPE, DeadPipe);
 
-  fd[0] = atoi(argv[1]);
-  fd[1] = atoi(argv[2]);
+  fd[0] = module->to_fvwm;
+  fd[1] = module->from_fvwm;
 
   /* Create a list of all windows */
   /* Request a list of all windows,
Index: modules/FvwmScript/FvwmScript.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmScript/FvwmScript.c,v
retrieving revision 1.72
diff -u -u -r1.72 FvwmScript.c
--- modules/FvwmScript/FvwmScript.c	5 Feb 2005 16:37:45 -0000	1.72
+++ modules/FvwmScript/FvwmScript.c	9 Feb 2006 15:18:59 -0000
@@ -62,7 +62,7 @@
 char *ScriptName;       /* Nom du fichier contenat le script decrivant le GUI */
 char *ScriptBaseName;
 char *ScriptPath = "";
-char *ModuleName;
+ModuleArgs *module;
 int fd[2];                      /* pipe pair */
 int fd_err;
 int x_fd;                       /* fd for X */
@@ -188,7 +188,7 @@
   if (yyin == NULL)
   {
     fprintf(stderr,"[%s][ReadConfig]: <<ERROR>> Can't open the script %s\n",
-	    ModuleName,s);
+	    module->name,s);
     exit(1);
   }
   /* On ne redefini pas yyout qui est la sortie standard */
@@ -500,7 +500,7 @@
   IndicWM->flags = InputHint|StateHint;
 
   classHints.res_name = safestrdup(ScriptBaseName);
-  classHints.res_class = safestrdup(ModuleName);
+  classHints.res_class = safestrdup(module->name);
 
   XSetWMProperties(dpy, x11base->win, &Name,
 		   &Name, NULL, 0, IndicNorm, IndicWM, &classHints);
@@ -1314,41 +1314,40 @@
 
   FlocaleInit(LC_CTYPE, "", "", "FvwmScript");
 
-  ModuleName = GetFileNameFromPath(argv[0]);
-
-  if (argc < 6)
+  module = ParseModuleArgs(argc,argv,0); /* no alias */
+  if (module == NULL)
   {
-    fprintf(stderr,"%s must be started by Fvwm.\n", ModuleName);
+    fprintf(stderr,"FvwmScript must be started by Fvwm.\n");
     exit(1);
   }
 
-  if (argc == 6)
+  if (module->user_argc == 0)
   {
-    fprintf(stderr,"%s requires the script's name or path.\n", ModuleName);
+    fprintf(stderr,"FvwmScript requires the script's name or path.\n");
     exit(1);
   }
 
   /* On determine si le script a un pere */
-  if (argc >= 8)
-    IsFather = (argv[7][0] != (char)161);
+  if (module->user_argc >= 2)
+    IsFather = (module->user_argv[1][0] != (char)161);
   else
     IsFather = 1;
 
-  ScriptName = argv[6];
+  ScriptName = module->user_argv[0];
   ScriptBaseName = GetFileNameFromPath(ScriptName);
   ref = strtol(argv[4], NULL, 16);
   if (ref == 0) ref = None;
-  fd[0] = atoi(argv[1]);
-  fd[1] = atoi(argv[2]);
+  fd[0] = module->to_fvwm;
+  fd[1] = module->from_fvwm;
   SetMessageMask(fd, M_NEW_DESK | M_END_WINDOWLIST| M_STRING |
 		 M_MAP|  M_RES_NAME| M_RES_CLASS| M_CONFIG_INFO|
 		 M_END_CONFIG_INFO| M_WINDOW_NAME | M_SENDCONFIG);
   SetMessageMask(fd, MX_PROPERTY_CHANGE);
   /* Enregistrement des arguments du script */
   x11base = (X11base*) safecalloc(1,sizeof(X11base));
-  x11base->TabArg[0] = ModuleName;
-  for (i=8-IsFather; i<argc; i++)
-    x11base->TabArg[i-7+IsFather] = argv[i];
+  x11base->TabArg[0] = module->name;
+  for (i=2-IsFather; i< module->user_argc; i++)
+    x11base->TabArg[i-1+IsFather] = module->user_argv[i];
   /* Couleurs et fontes par defaut */
   x11base->font = NULL;
   x11base->forecolor = safestrdup("black");
Index: modules/FvwmScript/Instructions.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmScript/Instructions.c,v
retrieving revision 1.53
diff -u -u -r1.53 Instructions.c
--- modules/FvwmScript/Instructions.c	3 Oct 2004 23:41:18 -0000	1.53
+++ modules/FvwmScript/Instructions.c	9 Feb 2006 15:19:01 -0000
@@ -24,6 +24,7 @@
 #include "libs/charmap.h"
 #include "libs/wcontext.h"
 #include "libs/modifiers.h"
+#include "libs/Module.h"
 #ifdef HAVE_GETPWUID
 #  include <pwd.h>
 #endif
@@ -47,7 +48,7 @@
 extern char **TabVVar;
 extern int TabIdObj[1001];
 extern char *ScriptName;
-extern char *ModuleName;
+extern ModuleArgs *module;
 extern TypeBuffSend BuffSend;
 extern Atom propriete;
 extern char *LastString;
@@ -606,14 +607,14 @@
   }
 
   /* Construction de la commande */
-  execstr = (char*)safecalloc(strlen(ModuleName) + strlen(arg) +
+  execstr = (char*)safecalloc(strlen(module->name) + strlen(arg) +
     strlen(x11base->TabScriptId[x11base->NbChild + 2]) + 5,sizeof(char));
   scriptname = (char*)safecalloc(sizeof(char),100);
   sscanf(arg,"%s",scriptname);
   scriptarg = (char*)safecalloc(sizeof(char),strlen(arg));
   scriptarg = (char*)strncpy(scriptarg, &arg[strlen(scriptname)],
 			     strlen(arg) - strlen(scriptname));
-  sprintf(execstr,"%s %s %s %s",ModuleName,scriptname,
+  sprintf(execstr,"%s %s %s %s",module->name,scriptname,
 	  x11base->TabScriptId[x11base->NbChild + 2],scriptarg);
   free(scriptname);
   free(scriptarg);
Index: modules/FvwmScroll/FvwmScroll.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmScroll/FvwmScroll.c,v
retrieving revision 1.36
diff -u -u -r1.36 FvwmScroll.c
--- modules/FvwmScroll/FvwmScroll.c	6 Jul 2003 14:34:08 -0000	1.36
+++ modules/FvwmScroll/FvwmScroll.c	9 Feb 2006 15:19:01 -0000
@@ -40,7 +40,7 @@
 #include "libs/FRenderInit.h"
 #include "FvwmScroll.h"
 
-char *MyName;
+ModuleArgs *module;
 fd_set_size_t fd_width;
 int fd[2];
 
@@ -56,8 +56,6 @@
 
 char *BackColor = "black";
 
-Window app_win;
-
 static int ErrorHandler(Display*, XErrorEvent*);
 
 /*
@@ -68,75 +66,60 @@
  */
 int main(int argc, char **argv)
 {
-  char *temp, *s;
-  int Clength;
   char *tline;
 
-  /* Save the program name for error messages and config parsing */
-  temp = argv[0];
-  s=strrchr(argv[0], '/');
-  if (s != NULL)
-    temp = s + 1;
-
-  MyName = safemalloc(strlen(temp)+2);
-  strcpy(MyName,"*");
-  strcat(MyName, temp);
-  Clength = strlen(MyName);
-
-  if(argc < 6)
+  module = ParseModuleArgs(argc,argv,0); /* no alias allowed */
+  if (module==NULL)
   {
-    fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",MyName,
+    fprintf(stderr,"FvwmScroll Version %s should only be executed by fvwm!\n",
 	    VERSION);
     exit(1);
   }
 
-  if(argc >= 7)
+  if(module->user_argc >= 1)
   {
     extern int Reduction_H;
     extern int Percent_H;
     int len;
-    len = strlen(argv[6])-1;
-    if (len >= 0 && argv[6][len] == 'p')
+    len = strlen(module->user_argv[0])-1;
+    if (len >= 0 && module->user_argv[0][len] == 'p')
     {
-      argv[6][len] = '\0';
-      Percent_H = atoi(argv[6]);
+      module->user_argv[0][len] = '\0';
+      Percent_H = atoi(module->user_argv[0]);
     }
     else
     {
-      Reduction_H = atoi(argv[6]);
+      Reduction_H = atoi(module->user_argv[0]);
     }
   }
 
-  if(argc >= 8)
+  if(module->user_argc >= 2)
   {
     extern int Reduction_V;
     extern int Percent_V;
     int len;
-    len = strlen(argv[7])-1;
-    if (len >= 0 && argv[7][len] == 'p')
+    len = strlen(module->user_argv[1])-1;
+    if (len >= 0 && module->user_argv[1][len] == 'p')
     {
-      argv[7][len] = '\0';
-      Percent_V = atoi(argv[7]);
+      module->user_argv[1][len] = '\0';
+      Percent_V = atoi(module->user_argv[1]);
     }
     else
     {
-      Reduction_V = atoi(argv[7]);
+      Reduction_V = atoi(module->user_argv[1]);
     }
   }
 
   /* Dead pipe == dead fvwm */
   signal (SIGPIPE, DeadPipe);
 
-  fd[0] = atoi(argv[1]);
-  fd[1] = atoi(argv[2]);
-
-  /* An application window may have already been selected - look for it */
-  sscanf(argv[4],"%x",(unsigned int *)&app_win);
+  fd[0] = module->to_fvwm;
+  fd[1] = module->from_fvwm;
 
   /* Open the Display */
   if (!(dpy = XOpenDisplay(NULL)))
   {
-    fprintf(stderr,"%s: can't open display\n", MyName);
+    fprintf(stderr,"%s: can't open display\n", module->name);
     exit (1);
   }
   x_fd = XConnectionNumber(dpy);
@@ -156,22 +139,23 @@
 
   /* scan config file for set-up parameters */
   /* Colors and fonts */
-  InitGetConfigLine(fd,MyName);
+  InitGetConfigLine(fd,CatString3("*",module->name,0));
   GetConfigLine(fd,&tline);
 
   while(tline != (char *)0)
   {
     if(strlen(tline)>1)
     {
-      if(strncasecmp(tline,CatString3(MyName, "Back",""),
-		     Clength+4)==0)
+      if(strncasecmp(tline,CatString3("*",module->name, "Back"),
+		     module->namelen+4)==0)
       {
-	CopyString(&BackColor,&tline[Clength+4]);
+	CopyString(&BackColor,&tline[module->namelen+4]);
 	colorset = -1;
       }
-      else if(strncasecmp(tline,CatString3(MyName,"Colorset",""),Clength+8)==0)
+      else if(strncasecmp(tline,CatString3("*",module->name,"Colorset"),
+                          module->namelen+8)==0)
       {
-	sscanf(&tline[Clength+8], "%d", &colorset);
+	sscanf(&tline[module->namelen+8], "%d", &colorset);
 	AllocColorset(colorset);
       }
       else if(strncasecmp(tline, "Colorset", 8) == 0)
@@ -184,20 +168,20 @@
 
   XSetErrorHandler(ErrorHandler);
 
-  if(app_win == 0)
-    GetTargetWindow(&app_win);
+  if(module->window == 0)
+    GetTargetWindow(&module->window);
 
-  if(app_win == 0)
+  if(module->window == 0)
     return 0;
 
   fd_width = GetFdWidth();
 
-  GrabWindow(app_win);
+  GrabWindow(module->window);
 
   /* tell fvwm we're running */
   SendFinishedStartupNotification(fd);
 
-  Loop(app_win);
+  Loop(module->window);
   return 0;
 }
 
@@ -210,8 +194,8 @@
 {
   extern Atom wm_del_win;
 
-  XReparentWindow(dpy,app_win,Root,0,0);
-  send_clientmessage (dpy, app_win, wm_del_win, CurrentTime);
+  XReparentWindow(dpy,module->window,Root,0,0);
+  send_clientmessage (dpy, module->window, wm_del_win, CurrentTime);
   XSync(dpy,0);
   exit(0);
   SIGNAL_RETURN;
@@ -228,7 +212,7 @@
 {
   Window target_win;
 
-  fvwmlib_get_target_window(dpy, screen, MyName, app_win, True);
+  fvwmlib_get_target_window(dpy, screen, module->name, app_win, True);
   target_win = fvwmlib_client_window(dpy, *app_win);
   if(target_win != None)
     *app_win = target_win;
@@ -250,6 +234,6 @@
     return 0;
 #endif
 
-  PrintXErrorAndCoredump(dpy, event, MyName);
+  PrintXErrorAndCoredump(dpy, event, module->name);
   return 0;
 }
Index: modules/FvwmScroll/FvwmScroll.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmScroll/FvwmScroll.h,v
retrieving revision 1.18
diff -u -u -r1.18 FvwmScroll.h
--- modules/FvwmScroll/FvwmScroll.h	6 Jul 2003 14:34:08 -0000	1.18
+++ modules/FvwmScroll/FvwmScroll.h	9 Feb 2006 15:19:01 -0000
@@ -1,5 +1,5 @@
 /* -*-c-*- */
-extern char* MyName;
+extern ModuleArgs *module;
 extern Display* dpy;
 extern Window Root;
 extern int screen;
Index: modules/FvwmScroll/GrabWindow.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmScroll/GrabWindow.c,v
retrieving revision 1.37
diff -u -u -r1.37 GrabWindow.c
--- modules/FvwmScroll/GrabWindow.c	29 Jun 2003 19:53:25 -0000	1.37
+++ modules/FvwmScroll/GrabWindow.c	9 Feb 2006 15:19:02 -0000
@@ -159,7 +159,7 @@
   FScreenMangleScreenIntoUSPosHints(FSCREEN_XYPOS, &mysizehints);
   XSetWMNormalHints(dpy,main_win,&mysizehints);
   XSelectInput(dpy,main_win,MW_EVENTS);
-  change_window_name(MyName);
+  change_window_name(module->name);
 
   holder_win = XCreateWindow(dpy, main_win, PAD_WIDTH3, PAD_WIDTH3,
 			     mysizehints.width - BAR_WIDTH - PAD_WIDTH3,
@@ -842,7 +842,7 @@
 
   if (XStringListToTextProperty(&str,1,&name) == 0)
   {
-    fprintf(stderr,"%s: cannot allocate window name\n",MyName);
+    fprintf(stderr,"%s: cannot allocate window name\n",module->name);
     return;
   }
   XSetWMName(dpy,main_win,&name);
@@ -861,7 +861,7 @@
     return;
   if (XStringListToTextProperty(&str,1,&name) == 0)
   {
-    fprintf(stderr,"%s: cannot allocate window name\n",MyName);
+    fprintf(stderr,"%s: cannot allocate window name\n",module->name);
     return;
   }
   XSetWMIconName(dpy,main_win,&name);
@@ -887,7 +887,7 @@
 		    (unsigned int *)&border_width,
 		    (unsigned int *)&depth))
   {
-    fprintf(stderr,"%s: cannot get window geometry\n", MyName);
+    fprintf(stderr,"%s: cannot get window geometry\n", module->name);
     exit(0);
   }
   XSync(dpy,0);
Index: modules/FvwmTaskBar/FvwmTaskBar.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmTaskBar/FvwmTaskBar.c,v
retrieving revision 1.131
diff -u -u -r1.131 FvwmTaskBar.c
--- modules/FvwmTaskBar/FvwmTaskBar.c	26 Nov 2005 21:55:12 -0000	1.131
+++ modules/FvwmTaskBar/FvwmTaskBar.c	9 Feb 2006 15:19:04 -0000
@@ -141,7 +141,7 @@
 static Bool is_dead_pipe = False;
 
 /* Module related information */
-char *Module;
+ModuleArgs *module;
 int  win_width    = 5,
 	win_height   = 5,
 	win_grav,
@@ -153,7 +153,6 @@
 	win_title_height = 0,
 	win_is_shaded = 0,
 	button_width = DEFAULT_BTN_WIDTH,
-	Clength,
 	ButPressed   = -1,
 	ButReleased  = -1,
 	Checked      = 0,
@@ -260,8 +259,6 @@
 */
 int main(int argc, char **argv)
 {
-  const char *temp;
-  char *s;
   int i;
 
   FlocaleInit(LC_CTYPE, "", "", "FvwmTaskBar");
@@ -273,38 +270,18 @@
     ClickAction[i] = DEFAULT_CLICK_N;
   }
 
-  /* Save the program name for error messages and config parsing */
-  temp = argv[0];
-  s=strrchr(argv[0], '/');
-  if (s != NULL)
-    temp = s + 1;
-
-
-  if((argc != 6)&&(argc != 7)) {
-    fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",temp,
+  module = ParseModuleArgs(argc,argv,1); /* use alias if provided */
+  if (module==NULL)
+  {
+    fprintf(stderr,
+            "FvwmTaskBar Version %s should only be executed by fvwm!\n",
 	    VERSION);
     exit(1);
   }
 
-  /* alise support */
-  if (argc == 7 && argv[6] != NULL)
-  {
-    Module = safemalloc(strlen(argv[6])+2);
-    strcpy(Module,"*");
-    strcat(Module, argv[6]);
-    Clength = strlen(Module);
-  }
-  else
-  {
-    Module = safemalloc(strlen(temp)+2);
-    strcpy(Module,"*");
-    strcat(Module, temp);
-    Clength = strlen(Module);
-  }
-
   /* setup fvwm pipes */
-  Fvwm_fd[0] = atoi(argv[1]);
-  Fvwm_fd[1] = atoi(argv[2]);
+  Fvwm_fd[0] = module->to_fvwm;
+  Fvwm_fd[1] = module->from_fvwm;
 
 #ifdef HAVE_SIGACTION
   {
@@ -388,7 +365,7 @@
 #ifdef FVWM_DEBUG_MSGS
   if ( isTerminated )
   {
-    fprintf(stderr, "%s: Received signal: exiting...\n", Module);
+    fprintf(stderr, "%s: Received signal: exiting...\n", module->name);
   }
 #endif
   return 0;
@@ -1095,7 +1072,7 @@
 {
   char *buf;
 
-  InitGetConfigLine(Fvwm_fd,Module);
+  InitGetConfigLine(Fvwm_fd,CatString3("*",module->name,0));
   while (GetConfigLine(Fvwm_fd,&buf), buf != NULL)
   {
     ParseConfigLine(buf);
@@ -1110,7 +1087,7 @@
   while (isspace((unsigned char)*tline))
     tline++;
 
-  if (strncasecmp(tline, Module, Clength) != 0)
+  if (strncasecmp(tline, CatString3("*",module->name,0), module->namelen) != 0)
   {
     /* Non module spcific option */
     index = GetTokenIndex(tline, configopts, -1, &rest);
@@ -1143,7 +1120,7 @@
   else
   {
     /* option beginning with '*ModuleName' */
-    rest = tline + Clength;
+    rest = tline + module->namelen;
     index = GetTokenIndex(rest, moduleopts, -1, &rest);
     while (*rest && *rest != '\n' && isspace(*rest))
       rest++;
@@ -1290,7 +1267,8 @@
       if (!GoodiesParseConfig(tline) &&
 	  !StartButtonParseConfig(tline))
       {
-	fprintf(stderr,"%s: unknown configuration option %s", Module, tline);
+	fprintf(stderr,"%s: unknown configuration option %s",
+                module->name, tline);
       }
       break;
     } /* switch */
@@ -2127,7 +2105,7 @@
    int wy;
 
    if (!(dpy = XOpenDisplay(""))) {
-     fprintf(stderr,"%s: can't open display %s", Module,
+     fprintf(stderr,"%s: can't open display %s", module->name,
 	     XDisplayName(""));
      exit (1);
    }
@@ -2164,14 +2142,15 @@
    if (selfont_string == NULL)
      selfont_string = font_string;
 
-   if ((FButtonFont = FlocaleLoadFont(dpy, font_string, Module)) == NULL)
+   if ((FButtonFont = FlocaleLoadFont(dpy, font_string,module->name)) == NULL)
    {
-     fprintf(stderr, "%s: Couldn't load font. Exiting!\n",Module);
+     fprintf(stderr, "%s: Couldn't load font. Exiting!\n",module->name);
      exit(1);
    }
-   if ((FSelButtonFont = FlocaleLoadFont(dpy, selfont_string, Module)) == NULL)
+   if ((FSelButtonFont = FlocaleLoadFont(dpy, selfont_string,module->name))
+                                                                   == NULL)
    {
-     fprintf(stderr, "%s: Couldn't load font. Exiting!\n",Module);
+     fprintf(stderr, "%s: Couldn't load font. Exiting!\n",module->name);
      exit(1);
    }
    LoadGoodiesFont();
@@ -2281,14 +2260,14 @@
   {
     XTextProperty nametext;
     char *list[]={NULL,NULL};
-    list[0] = Module+1;
+    list[0] = module->name;
 
-    classhints.res_name= Module+1;
+    classhints.res_name= module->name;
     classhints.res_class= "FvwmTaskBar";
 
     if(!XStringListToTextProperty(list,1,&nametext))
     {
-      fprintf(stderr,"%s: Failed to convert name to XText\n",Module);
+      fprintf(stderr,"%s: Failed to convert name to XText\n",module->name);
       exit(1);
     }
     /* hack to prevent mapping on wrong screen with StartsOnScreen */
@@ -2353,7 +2332,7 @@
 {
   XTextProperty name;
   if (XStringListToTextProperty(&str,1,&name) == 0) {
-    fprintf(stderr,"%s: cannot allocate window name.\n",Module);
+    fprintf(stderr,"%s: cannot allocate window name.\n",module->name);
     return;
   }
   XSetWMName(dpy,win,&name);
@@ -2581,6 +2560,6 @@
   if (FRenderGetErrorCodeBase() + FRenderBadPicture == event->error_code)
     return 0;
 
-  PrintXErrorAndCoredump(d, event, Module);
+  PrintXErrorAndCoredump(d, event, module->name);
   return 0;
 }
Index: modules/FvwmTaskBar/Goodies.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmTaskBar/Goodies.c,v
retrieving revision 1.51
diff -u -u -r1.51 Goodies.c
--- modules/FvwmTaskBar/Goodies.c	26 Nov 2005 21:55:12 -0000	1.51
+++ modules/FvwmTaskBar/Goodies.c	9 Feb 2006 15:19:05 -0000
@@ -48,12 +48,11 @@
 extern Window Root, win;
 extern int Fvwm_fd[2];
 extern int screen;
-extern char *Module;
+extern ModuleArgs *module;
 extern int win_width, win_height, win_y, win_border, RowHeight, Midline;
 extern rectangle screen_g;
 extern Pixel back, fore;
 extern int colorset;
-extern int Clength;
 extern GC blackgc, hilite, shadow, checkered;
 extern FlocaleWinString *FwinString;
 
@@ -209,7 +208,7 @@
   char *option;
   int i;
 
-  option = tline + Clength;
+  option = tline + module->namelen;
   i = GetTokenIndex(option, goodyopts, -1, &rest);
   while (*rest && *rest != '\n' && isspace(*rest))
     rest++;
@@ -295,9 +294,10 @@
 void LoadGoodiesFont(void)
 {
 	if ((FStatusFont =
-	     FlocaleLoadFont(dpy, statusfont_string, Module)) == NULL)
+	     FlocaleLoadFont(dpy, statusfont_string, module->name)) == NULL)
 	{
-		fprintf(stderr, "%s: Couldn't load font. Exiting!\n",Module);
+		fprintf(stderr, "%s: Couldn't load font. Exiting!\n",
+                       module->name);
 		exit(1);
 	}
 	goodies_fontheight = FStatusFont->height;
Index: modules/FvwmTaskBar/List.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmTaskBar/List.c,v
retrieving revision 1.25
diff -u -u -r1.25 List.c
--- modules/FvwmTaskBar/List.c	26 Nov 2005 21:55:12 -0000	1.25
+++ modules/FvwmTaskBar/List.c	9 Feb 2006 15:19:05 -0000
@@ -37,7 +37,7 @@
 #include "List.h"
 #include "Mallocs.h"
 
-extern char *Module;
+extern ModuleArgs *module;
 
 /*
   InitList - Initialize the list
@@ -250,7 +250,7 @@
 void PrintList(List *list)
 {
   Item *temp;
-  fprintf(stderr,"%s List of Items:\n", Module);
+  fprintf(stderr,"%s List of Items:\n", module->name);
   fprintf(stderr,"   %10s %-15s %-15s %-15s %-15s Flgs\n","ID","Name","I-Name",
 		 "R-Name","R-Class");
   fprintf(stderr,"   ---------- --------------- --------------- --------------- --------------- ----\n");
Index: modules/FvwmTaskBar/Start.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmTaskBar/Start.c,v
retrieving revision 1.33
diff -u -u -r1.33 Start.c
--- modules/FvwmTaskBar/Start.c	1 Sep 2004 14:55:19 -0000	1.33
+++ modules/FvwmTaskBar/Start.c	9 Feb 2006 15:19:06 -0000
@@ -24,6 +24,7 @@
 #include "libs/fvwmlib.h"
 #include "libs/Flocale.h"
 #include "libs/Picture.h"
+#include "libs/Module.h"
 #include "ButtonArray.h"
 #include "Mallocs.h"
 #include "Start.h"
@@ -31,8 +32,7 @@
 extern Display *dpy;
 extern Window Root, win;
 extern FlocaleFont *FButtonFont, *FSelButtonFont;
-extern char *Module;
-extern int Clength;
+extern ModuleArgs *module;
 extern char *ImagePath;
 
 Button *StartButton;
@@ -79,7 +79,7 @@
 	int mouseButton;
 	char **tmpStrPtr;
 
-	option = tline + Clength;
+	option = tline + module->namelen;
 	i = GetTokenIndex(option, startopts, -1, &rest);
 	while (*rest && *rest != '\n' && isspace(*rest))
 	{
@@ -361,13 +361,15 @@
       pos = rest;
       if (*mouseButton < 1 || *mouseButton > NUMBER_OF_EXTENDED_MOUSE_BUTTONS)
       {
-        fprintf(stderr,"%s: Invalid mouse button %d", Module, *mouseButton);
+        fprintf(stderr,"%s: Invalid mouse button %d", module->name,
+                *mouseButton);
         *mouseButton = 0;
       }
       break;
 
     default:
-      fprintf(stderr,"%s: Invalid taskbar button option '%s'", Module, token);
+      fprintf(stderr,"%s: Invalid taskbar button option '%s'", module->name,
+              token);
     }
     while (*pos && *pos != ',' && *pos != ')')
       pos++;
Index: modules/FvwmTheme/FvwmTheme.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmTheme/FvwmTheme.c,v
retrieving revision 1.56
diff -u -u -r1.56 FvwmTheme.c
--- modules/FvwmTheme/FvwmTheme.c	6 Jul 2003 14:34:08 -0000	1.56
+++ modules/FvwmTheme/FvwmTheme.c	9 Feb 2006 15:19:06 -0000
@@ -32,8 +32,7 @@
 #include "libs/fvwmsignal.h"
 
 /* Globals */
-static char *name;
-static int namelen;
+static ModuleArgs* module;
 static int fd[2]; /* communication pipes */
 
 /* forward declarations */
@@ -47,28 +46,24 @@
 
 int main(int argc, char **argv)
 {
-	name = GetFileNameFromPath(argv[0]);
-	namelen = strlen(name);
+	module = ParseModuleArgs(argc,argv,0); /* no alias allowed */
+	if (module==NULL)
+	{
+		fprintf(stderr,
+			"FvwmTheme "VERSION" should only be executed by fvwm!\n"
+			);
+		exit(1);
+	}
 
 	fprintf(
 		stderr,
 		"%s is obsolete, see the Colorset section of the fvwm(1) man"
-		" page\n", name);
+		" page\n", module->name);
 	set_signals();
 
-	/* try to make sure it is fvwm that spawned this module */
-	if (argc != 6)
-	{
-		fprintf(
-			stderr,
-			"%s "VERSION" should only be executed by fvwm!\n",
-			name);
-		exit(1);
-	}
-
 	/* note the communication pipes */
-	fd[0] = atoi(argv[1]);
-	fd[1] = atoi(argv[2]);
+	fd[0] = module->to_fvwm;
+	fd[1] = module->from_fvwm;
 
 	/* get the initial configuration options */
 	parse_config();
@@ -98,7 +93,7 @@
 		/* wait for an instruction from fvwm or a timeout */
 		if (fvwmSelect(fd_width, &in_fdset, NULL, NULL, NULL) < 0)
 		{
-			fprintf(stderr, "%s: select error!\n", name);
+			fprintf(stderr, "%s: select error!\n", module->name);
 			exit(-1);
 		}
 
@@ -178,14 +173,14 @@
 	char *line;
 
 	/* prepare the tokenizer array, [0,1] are ImagePath and ColorLimit */
-	config_options[2] = safemalloc(namelen + 10);
-	sprintf(config_options[2], "*%sColorset", name);
-	config_options[3] = safemalloc(namelen + 17);
-	sprintf(config_options[3], "*%sReadWriteColors", name);
+	config_options[2] = safemalloc(module->namelen + 10);
+	sprintf(config_options[2], "*%sColorset", module->name);
+	config_options[3] = safemalloc(module->namelen + 17);
+	sprintf(config_options[3], "*%sReadWriteColors", module->name);
 
 	/* set a filter on the config lines sent */
-	line = safemalloc(namelen + 2);
-	sprintf(line, "*%s", name);
+	line = safemalloc(module->namelen + 2);
+	sprintf(line, "*%s", module->name);
 	InitGetConfigLine(fd, line);
 	free(line);
 
@@ -243,7 +238,7 @@
 
 static RETSIGTYPE signal_handler(int signal)
 {
-	fprintf(stderr, "%s quiting on signal %d\n", name, signal);
+	fprintf(stderr, "%s quiting on signal %d\n", module->name, signal);
 	exit(signal);
 	SIGNAL_RETURN;
 }
