File: change_configfile_order.patch

package info (click to toggle)
gnokii 0.6.30%2Bdfsg-1.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 10,052 kB
  • sloc: ansic: 66,256; sh: 11,369; makefile: 646; sql: 61
file content (65 lines) | stat: -rw-r--r-- 2,681 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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);