[Pkg-wmaker-commits] [wmbutton] 04/25: wmbutton: Support for global conf file
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Sun Jul 16 23:38:09 UTC 2017
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch upstream
in repository wmbutton.
commit d1ddaf017c1c5ecc3ad76bdf7c8b394db09a2059
Author: Rodolfo García Peñas (kix) <kix at kix.es>
Date: Mon Aug 20 20:28:45 2012 +0200
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.
---
wmb_libs.c | 7 +++++--
wmbutton.h | 3 ++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/wmb_libs.c b/wmb_libs.c
index c9ea4c8..3661f03 100644
--- a/wmb_libs.c
+++ b/wmb_libs.c
@@ -151,7 +151,9 @@ void err_mess(int err, char *str) {
fprintf(stderr,"Fail: XCreateGC\n");
exit(err);
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);
case FAILTMPL:
fprintf(stderr, "Fail: Can't Create 'template' Pixmap\n");
@@ -200,7 +202,8 @@ char *Parse(int app) {
char *Ptr;
if ((fp = fopen(Config.configfile, "r")) == NULL)
- err_mess(FAILCONF,Config.configfile);
+ if ((fp = fopen(CONFIGGLOBAL, "r")) == NULL)
+ err_mess(FAILCONF,Config.configfile);
while ((Ptr = fgets(Buf, BUFFER_SIZE, fp))) {
if (atoi(Buf) == app)
diff --git a/wmbutton.h b/wmbutton.h
index 5c721af..1b99abf 100644
--- a/wmbutton.h
+++ b/wmbutton.h
@@ -16,9 +16,10 @@
/****** Define Config File Info ***************************************/
#define CONFFILENAME "/.wmbutton" /* Default conf filename $HOME/.wmbutton */
+#define CONFIGGLOBAL "/etc/wmbutton.conf" /* system configuration */
#define BUTTONFILENAME "/.wmbutton.xpm"
-/****** Version / Release Number ***************************************/
+/****** Version Number *************************************************/
#define VER 0 /* Version Number */
#define REL 6 /* Release Number */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmbutton.git
More information about the Pkg-wmaker-commits
mailing list