gnokii (0.6.30+dfsg-1) change_configfile_order.patch

Summary

 Docs/man/gnokii.1  |    5 ++---
 common/cfgreader.c |   14 +++++++-------
 2 files changed, 9 insertions(+), 10 deletions(-)

    
download this patch

Patch contents

From b2d201a6ae09cfb52b7a402a54856299548e69b9 Mon Sep 17 00:00:00 2001
From: Pawel Kot <gnokii@gmail.com>
Date: Fri, 22 Apr 2011 20:47:33 +0000
Subject: config: change the order of the config file lookup

If $XDG_CONFIG_DIRS/gnokii/config was found $HOME/.gnokiirc was ignored.
Even though this location is deprecated, it is very confusing to users.
Current lookup order will be:
 1. $XDG_CONFIG_HOME/gnokii/config
 2. $HOME/.gnokiirc
 3. $XDG_CONFIG_DIRS/gnokii/config
 4. /etc/gnokiirc

Related user report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=623694
---
Index: repo/Docs/man/gnokii.1
===================================================================
--- repo.orig/Docs/man/gnokii.1	2011-04-23 20:00:36.170887217 +0200
+++ repo/Docs/man/gnokii.1	2011-04-23 22:47:22.668506754 +0200
@@ -38,10 +38,9 @@
 reads configuration from \fIfilename\fR instead of trying default locations.
 Normally gnokii looks for config file in
 \fI$XDG_CONFIG_HOME/gnokii/config\fR (which is usually
-\fI$HOME/.config/gnokii/config\fR),
+\fI$HOME/.config/gnokii/config\fR), \fI$HOME/.gnokiirc\fR (legacy),
 \fI$XDG_CONFIG_DIRS/gnokii/config\fR (which is usually
-\fI/etc/xdg/gnokii/config\fR),
-\fI$HOME/.gnokiirc\fR (legacy) and \fI/etc/gnokiirc\fR (legacy).
+\fI/etc/xdg/gnokii/config\fR) and \fI/etc/gnokiirc\fR (legacy).
 .TP 
 .BR "\-\-phone \fIname\fP"
 usees parameters from the given phone section of your config file. A phone section named 'foo' starts with [phone_foo] and is used as \-\-phone foo
Index: repo/common/cfgreader.c
===================================================================
--- repo.orig/common/cfgreader.c	2011-04-23 20:00:36.150887113 +0200
+++ repo/common/cfgreader.c	2011-04-23 22:47:22.672506789 +0200
@@ -1090,7 +1090,13 @@
 	snprintf(path, MAX_PATH_LEN, "%s/gnokii/config", xdg_config_home);
 	config_file_locations[(*retval)++] = strdup(path);
 
-	/* 2. $XDG_CONFIG_DIRS/gnokii/config (/etc/xdg) */
+	/* old gnokii behaviour */
+	/* 2. $HOME/.gnokiirc */
+	snprintf(path, MAX_PATH_LEN, "%s/.gnokiirc", home);
+	config_file_locations[(*retval)++] = strdup(path);
+	CHECK_SIZE();
+
+	/* 3. $XDG_CONFIG_DIRS/gnokii/config (/etc/xdg) */
 	for (j = 0; j < i; j++) {
 		snprintf(path, MAX_PATH_LEN, "%s/gnokii/config", xdg_config_dir[j]);
 		config_file_locations[(*retval)++] = strdup(path);
@@ -1100,12 +1106,6 @@
 	free(xdg_config_dir);
 
 	/* old gnokii behaviour */
-
-	/* 3. $HOME/.gnokiirc */
-	snprintf(path, MAX_PATH_LEN, "%s/.gnokiirc", home);
-	config_file_locations[(*retval)++] = strdup(path);
-	CHECK_SIZE();
-
 	/* 4. /etc/gnokiirc */
 	snprintf(path, MAX_PATH_LEN, "/etc/gnokiirc");
 	config_file_locations[(*retval)++] = strdup(path);