summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-01-15 10:57:01 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-01-15 10:57:01 +0100
commit9c1f7c9b7fc346c1b09338788e06ba70128820ca (patch)
treed576c864d115a947d41aade95761d66400a8de4a
parent2590264615cb501d53092537b791b62755ef2de5 (diff)
downloadfeh-9c1f7c9b7fc346c1b09338788e06ba70128820ca.zip
Screw --rcpath, check XDG_CONFIG_HOME instead
-rw-r--r--man/feh.pre7
-rw-r--r--src/help.raw1
-rw-r--r--src/options.c40
-rw-r--r--src/options.h1
4 files changed, 16 insertions, 33 deletions
diff --git a/man/feh.pre b/man/feh.pre
index e181af7..bf5cb04 100644
--- a/man/feh.pre
+++ b/man/feh.pre
@@ -313,13 +313,6 @@ only errors.
When viewing multiple files in a slideshow, randomize the file list before
displaying.
.
-.It Cm -_ , --rcfile Ar file
-Use
-.Ar file
-to parse themes and options from, instead of the default
-.Pa ~/.config/feh/themes , /etc/fehrc
-files.
-.
.It Cm -r , --recursive
Recursively expand any directories in the commandline arguments
to the content of those directories, all the way down to the bottom level.
diff --git a/src/help.raw b/src/help.raw
index e0ea432..7a412b2 100644
--- a/src/help.raw
+++ b/src/help.raw
@@ -10,7 +10,6 @@ OPTIONS
-V, --verbose Show progress bars and other extra information
-q, --quiet Hide non-fatal errors. May be used with --verbose
-T, --theme THEME Load options with name THEME
- -_, --rcfile FILE Use FILE to parse themes and options from
-r, --recursive Recursively expand any directories in FILE to
the content of those directories. (Take it easy)
-z, --randomize Randomize the filelist
diff --git a/src/options.c b/src/options.c
index 400b43e..f0e09b5 100644
--- a/src/options.c
+++ b/src/options.c
@@ -146,32 +146,27 @@ static void feh_check_theme_options(int arg, char **argv)
static void feh_load_options_for_theme(char *theme)
{
FILE *fp = NULL;
- char *home;
+ char *home = getenv("HOME");
char *rcpath = NULL;
+ char *confbase = getenv("XDG_CONFIG_HOME");
char s[1024], s1[1024], s2[1024];
int cont = 0;
int bspos;
- if (opt.rcfile) {
- if ((fp = fopen(opt.rcfile, "r")) == NULL) {
- weprintf("couldn't load the specified rcfile %s\n", opt.rcfile);
- return;
- }
- } else {
- home = getenv("HOME");
- if (!home)
- eprintf("D'oh! Please define HOME in your environment! "
- "It would really help me out...\n");
+ if (!home)
+ eprintf("You have no HOME, cannot read themes");
+
+ if (confbase)
+ rcpath = estrjoin("/", confbase, "feh/themes", NULL);
+ else
rcpath = estrjoin("/", home, ".config/feh/themes", NULL);
- D(("Trying %s for config\n", rcpath));
- fp = fopen(rcpath, "r");
- if (!fp && ((fp = fopen("/etc/fehrc", "r")) == NULL)) {
- return;
- }
+ fp = fopen(rcpath, "r");
- free(rcpath);
- }
+ free(rcpath);
+
+ if (!fp && ((fp = fopen("/etc/feh/themes", "r")) == NULL))
+ return;
/* Oooh. We have an options file :) */
for (; fgets(s, sizeof(s), fp);) {
@@ -226,7 +221,7 @@ static void feh_parse_environment_options(void)
weprintf
("The FEH_OPTIONS configuration method is depreciated and will soon die.\n"
- "Use the .fehrc configuration file instead.");
+ "Use the feh/themes configuration file instead.");
/* We definitely have some options to parse */
feh_parse_options_from_string(opts);
@@ -314,10 +309,11 @@ char *feh_string_normalize(char *str)
}
static void feh_parse_option_array(int argc, char **argv)
+
{
static char stropts[] =
"a:A:b:B:cC:dD:e:E:f:Fg:GhH:iIj:J:kK:lL:mM:nNo:O:pPqQrR:sS:tT:uUvVwW:xXy:YzZ"
- "0:1:2:4:5:8:9:.@:^:~:):|:_:+:";
+ "0:1:2:4:5:8:9:.@:^:~:):|:+:";
/* (*name, has_arg, *flag, val) See: struct option in getopts.h */
static struct option lopts[] = {
@@ -392,7 +388,6 @@ static void feh_parse_option_array(int argc, char **argv)
{"rotate-button" , 1, 0, '8'},
{"blur-button" , 1, 0, '9'},
{"start-at" , 1, 0, '|'},
- {"rcfile" , 1, 0, '_'},
{"debug" , 0, 0, '+'},
{"output-dir" , 1, 0, 'j'},
{"bg-tile" , 1, 0, 200},
@@ -587,9 +582,6 @@ static void feh_parse_option_array(int argc, char **argv)
opt.bg = 1;
opt.bg_file = estrdup(optarg);
break;
- case '_':
- opt.rcfile = estrdup(optarg);
- break;
case 'A':
opt.actions[0] = estrdup(optarg);
break;
diff --git a/src/options.h b/src/options.h
index fc8fa02..7b20dd5 100644
--- a/src/options.h
+++ b/src/options.h
@@ -84,7 +84,6 @@ struct __fehoptions {
char *customlist;
char *menu_bg;
char *image_bg;
- char *rcfile;
char *menu_style;
char *caption_path;
char *start_list_at;