FVWM: FvwmSaveDesk Operation?

From: Andrew Veliath <veliaa_at_rpi.edu>
Date: Sat, 25 May 1996 04:13:52 -0400

I like the FvwmSaveDesk module, but I was a bit confused why in the
man page seems to be more "updated" or something than the program. It
states that it creates a function called StartupFunction, when it
seems to create InitFunction (this seems more limited ? than
StartupFunction).

Also it would be nice I think to be able to specify a different file
than ~/.fvwmdesk. Also a different function name. Then one could
implement multiple dynamic save/restore desktop menus or something.

Here is a small patch, or start at least which changes the default
behavior to work like the man page says, and also adds two command
line options,

-file <outfile>

and

-func <funcname>

which alter the corresponding outputs accordingly (some unused vars
also removed). Sorry if this is already being worked on...

--- ../../../../orig/fvwm-2.0.42/modules/FvwmSaveDesk/FvwmSaveDesk.c Tue Apr 25 08:27:09 1995
+++ FvwmSaveDesk.c Sat May 25 04:05:25 1996
_at_@ -45,6 +45,7 @@
 #include "../../version.h"
 
 char *MyName;
+char *out_file = NULL, *func_name = "StartupFunction";
 int fd[2];
 
 struct list *list_root = NULL;
_at_@ -79,7 +80,7 @@
   strcpy(MyName,"*");
   strcat(MyName, temp);
 
- if((argc != 6)&&(argc != 7))
+ if(argc < 6)
     {
       fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",MyName,
               VERSION);
_at_@ -103,6 +104,22 @@
   fd[0] = atoi(argv[1]);
   fd[1] = atoi(argv[2]);
 
+ { /* parse args */
+ int i = 6;
+ while (i < argc)
+ {
+ if (strcmp(argv[i], "-file")==0) {
+ out_file = safemalloc(strlen(argv[++i]) + 1);
+ strcpy(out_file, argv[i]);
+ }
+ else if (strcmp(argv[i], "-func")==0) {
+ func_name = safemalloc(strlen(argv[++i]) + 1);
+ strcpy(func_name, argv[i]);
+ }
+ ++i;
+ }
+ }
+
   /* Create a list of all windows */
   /* Request a list of all windows,
    * wait for ConfigureWindow packets */
_at_@ -121,13 +138,12 @@
 void Loop(int *fd)
 {
   unsigned long header[HEADER_SIZE], *body;
- char *cbody;
- int body_length,count,count2=0,total;
+ int count;
 
   while(1)
     {
       /* read a packet */
- if(count = ReadFvwmPacket(fd[1],header,&body) > 0)
+ if( (count = ReadFvwmPacket(fd[1],header,&body)) > 0)
         {
           /* dispense with the new packet */
           process_message(header[1],body);
_at_@ -408,7 +424,7 @@
 void do_save(void)
 {
   struct list *t;
- char fnbuf[200];
+ char fnbuf[256];
   FILE *out;
   int maxdesk = 0;
   int actdesk = -1;
_at_@ -417,11 +433,14 @@
   for (t = list_root; t != NULL; t = t->next)
      if (t->desk > maxdesk)
         maxdesk = t->desk;
-
- sprintf(fnbuf, "%s/.fvwmdesk", getenv( "HOME" ) );
+
+ if (out_file)
+ strncpy(fnbuf, out_file, 256);
+ else
+ sprintf(fnbuf, "%s/.fvwmdesk", getenv( "HOME" ) );
   out = fopen( fnbuf, "w" );
 
- fprintf( out, "AddToFunc InitFunction");
+ fprintf( out, "AddToFunc %-12s", func_name);
   fflush ( out );
 
   /*
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Sat May 25 1996 - 03:36:20 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:59 BST