kwo pushed a commit to branch master. http://git.enlightenment.org/e16/e16.git/commit/?id=2a3f91471615611b423b6834b2b5bb1f1737fc00
commit 2a3f91471615611b423b6834b2b5bb1f1737fc00 Author: Kim Woelders <k...@woelders.dk> Date: Mon Feb 14 15:56:00 2022 +0100 actions.c: Let Eexec() use ExecSetupEnv() too And rename a couple of functions marking them local. --- src/actions.c | 46 ++++++++++++++++++++++------------------------ src/util.h | 1 + 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/actions.c b/src/actions.c index d18b044a..4901ed42 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-2021 Kim Woelders + * Copyright (C) 2004-2022 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 @@ -26,25 +26,8 @@ #include "file.h" #include "user.h" -void -Eexec(const char *cmd) -{ - char **lst; - int fd, num; - - /* Close all file descriptors except the std 3 */ - for (fd = 3; fd < 1024; fd++) - close(fd); - - lst = StrlistFromString(cmd, ' ', &num); - - execvp(lst[0], lst); - - StrlistFree(lst, num); -} - static void -StartupIdExport(void) +_ExecSetStartupId(void) { char buf[128]; Desk *dsk; @@ -59,7 +42,7 @@ StartupIdExport(void) } static void -ExecSetupEnv(int flags) +_ExecSetupEnv(int flags) { int fd; @@ -73,10 +56,10 @@ ExecSetupEnv(int flags) if (flags & EXEC_SET_LANG) LangExport(); if (flags & EXEC_SET_STARTUP_ID) - StartupIdExport(); + _ExecSetStartupId(); #if USE_LIBHACK - if (Mode.wm.window) + if (Mode.wm.window && !(flags & EXEC_NO_LIBHACK)) { char buf[1024]; @@ -86,6 +69,21 @@ ExecSetupEnv(int flags) #endif } +void +Eexec(const char *cmd) +{ + char **lst; + int num; + + _ExecSetupEnv(EXEC_NO_LIBHACK); + + lst = StrlistFromString(cmd, ' ', &num); + + execvp(lst[0], lst); + + StrlistFree(lst, num); +} + int EspawnApplication(const char *params, int flags) { @@ -105,7 +103,7 @@ EspawnApplication(const char *params, int flags) if (fork()) return 0; - ExecSetupEnv(flags); + _ExecSetupEnv(flags); sh = usershell(); @@ -204,7 +202,7 @@ _Espawn(int argc __UNUSED__, char **argv) if (fork()) return; - ExecSetupEnv(EXEC_SET_LANG | EXEC_SET_STARTUP_ID); + _ExecSetupEnv(EXEC_SET_LANG | EXEC_SET_STARTUP_ID); execvp(argv[0], argv); diff --git a/src/util.h b/src/util.h index ebde3382..e4dd73c3 100644 --- a/src/util.h +++ b/src/util.h @@ -123,6 +123,7 @@ void __PRINTF__ Eprintf(const char *fmt, ...); #define EXEC_SET_LANG 0x01 #define EXEC_SET_STARTUP_ID 0x02 +#define EXEC_NO_LIBHACK 0x04 void Eexec(const char *cmd); int EspawnApplication(const char *params, int flags); --