diff options
author | Tilman Keskinoz <arved@FreeBSD.org> | 2007-08-03 09:02:43 +0000 |
---|---|---|
committer | Tilman Keskinoz <arved@FreeBSD.org> | 2007-08-03 09:02:43 +0000 |
commit | 7fff479127b56667ce91a24f551115307f598b88 (patch) | |
tree | fdfaa43c23fb16d28b07c329b2a763584d36f5e0 /www/newsbeuter | |
parent | 3ae5f333159aa13f7b0e826b1a57b9b059a3f6b7 (diff) | |
download | ports-7fff479127b56667ce91a24f551115307f598b88.tar.gz ports-7fff479127b56667ce91a24f551115307f598b88.zip |
Make podbeuter work with the default configuration.
Obtained from: newsbeuter SVN
Reported by: sat
Notes
Notes:
svn path=/head/; revision=197011
Diffstat (limited to 'www/newsbeuter')
-rw-r--r-- | www/newsbeuter/Makefile | 1 | ||||
-rw-r--r-- | www/newsbeuter/files/patch-configcontainer.cpp | 86 |
2 files changed, 87 insertions, 0 deletions
diff --git a/www/newsbeuter/Makefile b/www/newsbeuter/Makefile index 58851db658a0..6525c4bb606a 100644 --- a/www/newsbeuter/Makefile +++ b/www/newsbeuter/Makefile @@ -6,6 +6,7 @@ PORTNAME= newsbeuter PORTVERSION= 0.5 +PORTREVISION= 1 CATEGORIES= www MASTER_SITES= http://synflood.at/newsbeuter/ diff --git a/www/newsbeuter/files/patch-configcontainer.cpp b/www/newsbeuter/files/patch-configcontainer.cpp new file mode 100644 index 000000000000..bf2358fb0426 --- /dev/null +++ b/www/newsbeuter/files/patch-configcontainer.cpp @@ -0,0 +1,86 @@ +Index: src/configcontainer.cpp +=================================================================== +--- src/configcontainer.cpp (revision 935) ++++ src/configcontainer.cpp (revision 937) +@@ -85,43 +85,13 @@ + return AHS_OK; + + case configdata::STR: ++ case configdata::PATH: + if (params.size() < 1) { + return AHS_TOO_FEW_PARAMS; + } + cfgdata.value = params[0]; + return AHS_OK; + +- case configdata::PATH: { +- if (params.size() < 1) { +- return AHS_TOO_FEW_PARAMS; +- } +- +- // a path config option is a bit more difficult to handle, because we need to replace +- // a possible "~/" at the beginning of the string with the user's home directory. +- +- const char * homedir; +- std::string filepath; +- +- if (!(homedir = ::getenv("HOME"))) { +- struct passwd * spw = ::getpwuid(::getuid()); +- if (spw) { +- homedir = spw->pw_dir; +- } else { +- homedir = ""; +- } +- } +- +- if (strcmp(homedir,"")!=0 && params[0].substr(0,2) == "~/") { +- filepath.append(homedir); +- filepath.append(1,'/'); +- filepath.append(params[0].substr(2,params[0].length()-2)); +- } else { +- filepath.append(params[0]); +- } +- +- cfgdata.value = filepath; +- return AHS_OK; +- } + default: + // should not happen + return AHS_INVALID_COMMAND; +@@ -150,7 +120,35 @@ + } + + std::string configcontainer::get_configvalue(const std::string& key) { +- return config_data[key].value; ++ std::string retval = config_data[key].value; ++ if (config_data[key].type == configdata::PATH) { ++ const char * homedir; ++ std::string filepath; ++ ++ if (!(homedir = ::getenv("HOME"))) { ++ struct passwd * spw = ::getpwuid(::getuid()); ++ if (spw) { ++ homedir = spw->pw_dir; ++ } else { ++ homedir = ""; ++ } ++ } ++ ++ if (strcmp(homedir,"")!=0) { ++ if (retval == "~") { ++ filepath.append(homedir); ++ } else if (retval.substr(0,2) == "~/") { ++ filepath.append(homedir); ++ filepath.append(1,'/'); ++ filepath.append(retval.substr(2,retval.length()-2)); ++ } ++ } else { ++ filepath.append(retval); ++ } ++ retval = filepath; ++ } ++ ++ return retval; + } + + int configcontainer::get_configvalue_as_int(const std::string& key) { |