kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=783e4ec79f0c75c07c21cbc557625d45efcd90e1
commit 783e4ec79f0c75c07c21cbc557625d45efcd90e1 Author: Kim Woelders <[email protected]> Date: Fri Dec 29 17:11:34 2017 +0100 Make Esystem() take argumments --- src/E.h | 4 ++-- src/actions.c | 13 ++++++++++--- src/config.c | 32 +++++++++++++++----------------- src/session.c | 18 +++--------------- 4 files changed, 30 insertions(+), 37 deletions(-) diff --git a/src/E.h b/src/E.h index 1d009f2e..b7543331 100644 --- a/src/E.h +++ b/src/E.h @@ -3,7 +3,7 @@ /*****************************************************************************/ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2016 Kim Woelders + * Copyright (C) 2004-2017 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -462,7 +462,7 @@ void About(void); void Eexec(const char *cmd); int EspawnApplication(const char *params, int flags); void Espawn(const char *cmd); -int Esystem(const char *cmd); +int __PRINTF__ Esystem(const char *fmt, ...); /* config.c */ #define FILE_TYPE_CONFIG 0 diff --git a/src/actions.c b/src/actions.c index 5642c525..8d5dd573 100644 --- a/src/actions.c +++ b/src/actions.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2014 Kim Woelders + * Copyright (C) 2004-2017 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -222,7 +222,14 @@ Espawn(const char *cmd) } int -Esystem(const char *cmd) +Esystem(const char *fmt, ...) { - return system(cmd); + va_list args; + char buf[FILEPATH_LEN_MAX]; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + return system(buf); } diff --git a/src/config.c b/src/config.c index 5c43052e..c14f9125 100644 --- a/src/config.c +++ b/src/config.c @@ -232,7 +232,6 @@ ConfigAlertLoad(const char *txt) static int ConfigFilePreparse(const char *src, const char *dst, const char *themepath) { - char execline[FILEPATH_LEN_MAX]; const char *variant; if (EDebug(EDBUG_TYPE_CONFIG)) @@ -244,22 +243,21 @@ ConfigFilePreparse(const char *src, const char *dst, const char *themepath) themepath = Mode.theme.path; variant = (Mode.theme.variant) ? Mode.theme.variant : ""; - Esnprintf(execline, sizeof(execline), "%s/epp " "-P " "-nostdinc " "-undef " - "-include %s/config/definitions " "-I%s " "-I%s/config " - "-D ENLIGHTENMENT_VERSION=%s " "-D ENLIGHTENMENT_ROOT=%s " - "-D ENLIGHTENMENT_BIN=%s " - "-D ENLIGHTENMENT_THEME=%s " "-D VARIANT=%s " - "-D ECONFDIR=%s " "-D ECACHEDIR=%s " - "-D SCREEN_RESOLUTION_%ix%i=1 " - "-D SCREEN_WIDTH_%i=1 " "-D SCREEN_HEIGHT_%i=1 " - "-D SCREEN_DEPTH_%i=1 " - "%s %s", - EDirBin(), EDirRoot(), themepath, EDirRoot(), - e_wm_version, EDirRoot(), EDirBin(), themepath, variant, - EDirUser(), EDirUserCache(), - WinGetW(VROOT), WinGetH(VROOT), WinGetW(VROOT), WinGetH(VROOT), - WinGetDepth(VROOT), src, dst); - Esystem(execline); + Esystem("%s/epp " "-P " "-nostdinc " "-undef " + "-include %s/config/definitions " "-I%s " "-I%s/config " + "-D ENLIGHTENMENT_VERSION=%s " "-D ENLIGHTENMENT_ROOT=%s " + "-D ENLIGHTENMENT_BIN=%s " + "-D ENLIGHTENMENT_THEME=%s " "-D VARIANT=%s " + "-D ECONFDIR=%s " "-D ECACHEDIR=%s " + "-D SCREEN_RESOLUTION_%ix%i=1 " + "-D SCREEN_WIDTH_%i=1 " "-D SCREEN_HEIGHT_%i=1 " + "-D SCREEN_DEPTH_%i=1 " + "%s %s", + EDirBin(), EDirRoot(), themepath, EDirRoot(), + e_wm_version, EDirRoot(), EDirBin(), themepath, variant, + EDirUser(), EDirUserCache(), + WinGetW(VROOT), WinGetH(VROOT), WinGetW(VROOT), WinGetH(VROOT), + WinGetDepth(VROOT), src, dst); return exists(dst) ? 0 : 1; } diff --git a/src/session.c b/src/session.c index 4c735022..be140b37 100644 --- a/src/session.c +++ b/src/session.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors - * Copyright (C) 2004-2014 Kim Woelders + * Copyright (C) 2004-2017 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -711,21 +711,9 @@ SessionExit(int mode, const char *param) static void SessionRunProg(const char *prog, const char *params) { - char buf[4096]; - const char *s; - - if (params) - { - Esnprintf(buf, sizeof(buf), "%s %s", prog, params); - s = buf; - } - else - { - s = prog; - } if (EDebug(EDBUG_TYPE_SESSION)) - Eprintf("%s: %s\n", __func__, s); - Esystem(s); + Eprintf("%s: %s %s\n", __func__, prog, params); + Esystem("%s %s", prog, params); } void --
