wmbutton: Support for global conf file
This patch is based in the code wrote by Christian Aichinger for the Debian distribution. The patch includes the /etc/wmbutton.conf as global configuration file. This file is readed if $home/.wmbutton don't exists.
This commit is contained in:
		
							parent
							
								
									83e2e0f2f9
								
							
						
					
					
						commit
						de5602b957
					
				
					 2 changed files with 7 additions and 3 deletions
				
			
		| 
						 | 
					@ -151,7 +151,9 @@ void err_mess(int err, char *str) {
 | 
				
			||||||
    fprintf(stderr,"Fail: XCreateGC\n");	
 | 
					    fprintf(stderr,"Fail: XCreateGC\n");	
 | 
				
			||||||
    exit(err);
 | 
					    exit(err);
 | 
				
			||||||
  case FAILCONF:
 | 
					  case FAILCONF:
 | 
				
			||||||
    fprintf(stderr, "Fail: Can't Find configuration file %s\n",str);
 | 
					    fprintf(stderr, "Fail: Can't Find user or system configuration file.\n");
 | 
				
			||||||
 | 
					    fprintf(stderr, "Fail: User Config: '%s'\n", str);
 | 
				
			||||||
 | 
					    fprintf(stderr, "Fail: System Config: '%s'\n", CONFIGGLOBAL);
 | 
				
			||||||
    exit(err);
 | 
					    exit(err);
 | 
				
			||||||
  case FAILTMPL:
 | 
					  case FAILTMPL:
 | 
				
			||||||
    fprintf(stderr, "Fail: Can't Create 'template' Pixmap\n");
 | 
					    fprintf(stderr, "Fail: Can't Create 'template' Pixmap\n");
 | 
				
			||||||
| 
						 | 
					@ -200,6 +202,7 @@ char *Parse(int app) {
 | 
				
			||||||
  char *Ptr;
 | 
					  char *Ptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ((fp = fopen(Config.configfile, "r")) == NULL)
 | 
					  if ((fp = fopen(Config.configfile, "r")) == NULL)
 | 
				
			||||||
 | 
					    if ((fp = fopen(CONFIGGLOBAL, "r")) == NULL)
 | 
				
			||||||
      err_mess(FAILCONF,Config.configfile);
 | 
					      err_mess(FAILCONF,Config.configfile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  while ((Ptr = fgets(Buf, BUFFER_SIZE, fp))) {
 | 
					  while ((Ptr = fgets(Buf, BUFFER_SIZE, fp))) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,9 +16,10 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/******  Define Config File Info  ***************************************/
 | 
					/******  Define Config File Info  ***************************************/
 | 
				
			||||||
#define CONFFILENAME  "/.wmbutton"   /* Default conf filename $HOME/.wmbutton */
 | 
					#define CONFFILENAME  "/.wmbutton"   /* Default conf filename $HOME/.wmbutton */
 | 
				
			||||||
 | 
					#define CONFIGGLOBAL "/etc/wmbutton.conf" /* system configuration */
 | 
				
			||||||
#define BUTTONFILENAME "/.wmbutton.xpm"
 | 
					#define BUTTONFILENAME "/.wmbutton.xpm"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/******  Version / Release Number ***************************************/
 | 
					/******  Version Number *************************************************/
 | 
				
			||||||
#define VER           0     /* Version Number */     
 | 
					#define VER           0     /* Version Number */     
 | 
				
			||||||
#define REL           6     /* Release Number */
 | 
					#define REL           6     /* Release Number */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue