mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-02 18:31:22 +02:00
Merge remote-tracking branch 'check/cst-next'
needs build- and functional fixes Conflicts: configure.ac data/icons/shutdown.jpg data/icons/start.jpg data/locale/deutsch.locale data/locale/english.locale lib/libmd5sum/md5.c src/driver/scanepg.cpp src/driver/streamts.cpp src/driver/vfd.cpp src/driver/vfd.h src/driver/volume.cpp src/eitd/dmx.cpp src/eitd/xmlutil.cpp src/gui/Makefile.am src/gui/audiomute.cpp src/gui/channellist.cpp src/gui/dboxinfo.cpp src/gui/epgview.cpp src/gui/eventlist.cpp src/gui/filebrowser.cpp src/gui/hdd_menu.cpp src/gui/infoviewer.cpp src/gui/infoviewer_bb.cpp src/gui/infoviewer_bb.h src/gui/keybind_setup.cpp src/gui/luainstance.cpp src/gui/luainstance.h src/gui/miscsettings_menu.cpp src/gui/moviebrowser.cpp src/gui/movieplayer.cpp src/gui/osd_progressbar_setup.cpp src/gui/osd_progressbar_setup.h src/gui/osd_setup.cpp src/gui/osdlang_setup.cpp src/gui/personalize.cpp src/gui/plugins.cpp src/gui/plugins.h src/gui/scan.cpp src/gui/scan_setup.cpp src/gui/update_settings.cpp src/gui/user_menue.cpp src/gui/user_menue_setup.cpp src/gui/videosettings.cpp src/gui/widget/buttons.cpp src/gui/widget/menue.cpp src/gui/widget/menue.h src/gui/widget/progresswindow.cpp src/neutrino.cpp src/neutrino_menue.cpp src/nhttpd/yhttpd.cpp src/system/helpers.cpp src/system/locals.h src/system/locals_intern.h src/system/setting_helpers.cpp src/zapit/lib/zapitclient.cpp src/zapit/src/fastscan.cpp src/zapit/src/frontend.cpp src/zapit/src/getservices.cpp src/zapit/src/scan.cpp src/zapit/src/scannit.cpp src/zapit/src/scanpmt.cpp src/zapit/src/transponder.cpp src/zapit/src/zapit.cpp
This commit is contained in:
@@ -215,6 +215,28 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type)
|
||||
return(fp);
|
||||
}
|
||||
|
||||
int mkdirhier(const char *pathname, mode_t mode)
|
||||
{
|
||||
int res = -1;
|
||||
if (!pathname || !*pathname)
|
||||
return res;
|
||||
char path[strlen(pathname) + 1];
|
||||
strcpy(path, pathname);
|
||||
char *p = path;
|
||||
while ((p = strchr(p + 1, '/'))) {
|
||||
*p = 0;
|
||||
res = mkdir(path, mode);
|
||||
if (res < 0 && errno != EEXIST)
|
||||
break;
|
||||
*p = '/';
|
||||
}
|
||||
res = mkdir(path, mode);
|
||||
if (errno == EEXIST)
|
||||
res = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int safe_mkdir(const char * path)
|
||||
{
|
||||
struct statfs s;
|
||||
@@ -392,6 +414,20 @@ std::string trim(std::string &str, const std::string &trimChars /*= " \n\r\t"*/)
|
||||
return result.erase(0, result.find_first_not_of(trimChars));
|
||||
}
|
||||
|
||||
std::string strftime(const char *format, const struct tm *tm)
|
||||
{
|
||||
char buf[4096];
|
||||
*buf = 0;
|
||||
strftime(buf, sizeof(buf), format, tm);
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
std::string strftime(const char *format, time_t when, bool gm)
|
||||
{
|
||||
struct tm *t = gm ? gmtime(&when) : localtime(&when);
|
||||
return strftime(format, t);
|
||||
}
|
||||
|
||||
time_t toEpoch(std::string &date)
|
||||
{
|
||||
struct tm t;
|
||||
@@ -473,7 +509,7 @@ bool CFileHelpers::copyFile(const char *Src, const char *Dst, mode_t mode)
|
||||
unlink(Dst);
|
||||
if ((fd1 = open(Src, O_RDONLY)) < 0)
|
||||
return false;
|
||||
if ((fd2 = open(Dst, O_WRONLY | O_CREAT, 0666)) < 0) {
|
||||
if ((fd2 = open(Dst, O_WRONLY | O_CREAT, mode)) < 0) {
|
||||
close(fd1);
|
||||
return false;
|
||||
}
|
||||
@@ -501,7 +537,6 @@ bool CFileHelpers::copyFile(const char *Src, const char *Dst, mode_t mode)
|
||||
close(fd1);
|
||||
close(fd2);
|
||||
|
||||
chmod(Dst, mode);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -723,3 +758,56 @@ bool split_config_string(const std::string &str, std::map<std::string,std::strin
|
||||
}
|
||||
return !smap.empty();
|
||||
}
|
||||
|
||||
std::vector<std::string> split(const std::string &s, char delim)
|
||||
{
|
||||
std::vector<std::string> vec;
|
||||
std::stringstream ss(s);
|
||||
std::string item;
|
||||
while (std::getline(ss, item, delim))
|
||||
vec.push_back(item);
|
||||
return vec;
|
||||
}
|
||||
|
||||
std::string to_string(int i)
|
||||
{
|
||||
std::stringstream s;
|
||||
s << i;
|
||||
return s.str();
|
||||
}
|
||||
|
||||
std::string to_string(unsigned int i)
|
||||
{
|
||||
std::stringstream s;
|
||||
s << i;
|
||||
return s.str();
|
||||
}
|
||||
|
||||
std::string to_string(long i)
|
||||
{
|
||||
std::stringstream s;
|
||||
s << i;
|
||||
return s.str();
|
||||
}
|
||||
|
||||
std::string to_string(unsigned long i)
|
||||
{
|
||||
std::stringstream s;
|
||||
s << i;
|
||||
return s.str();
|
||||
}
|
||||
|
||||
std::string to_string(long long i)
|
||||
{
|
||||
std::stringstream s;
|
||||
s << i;
|
||||
return s.str();
|
||||
}
|
||||
|
||||
std::string to_string(unsigned long long i)
|
||||
{
|
||||
std::stringstream s;
|
||||
s << i;
|
||||
return s.str();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user