18 #include "ecore_private.h"
20 static int app_argc = 0;
21 static char **app_argv = NULL;
24 * @addtogroup Ecore_Application_Group
30 * Set up the programs command-line arguments.
31 * @param argc The same as passed as argc to the programs main() function
32 * @param argv The same as passed as argv to the programs main() function
34 * A call to this function will store the programs command-line arguments
35 * for later use by ecore_app_restart() or ecore_app_args_get().
38 ecore_app_args_set(int argc,
41 EINA_MAIN_LOOP_CHECK_RETURN;
46 app_argv = (char **)argv;
50 * Return the programs stored command-line arguments.
51 * @param argc A pointer to the return value to hold argc
52 * @param argv A pointer to the return value to hold argv
54 * When called, this funciton returns the arguments for the program stored by
55 * ecore_app_args_set(). The integer pointed to by @p argc will be filled, if
56 * the pointer is not NULL, and the string array pointer @p argv will be filled
57 * also if the pointer is not NULL. The values they are filled with will be the
58 * same set by ecore_app_args_set().
61 ecore_app_args_get(int *argc,
64 EINA_MAIN_LOOP_CHECK_RETURN;
66 if (argc) *argc = app_argc;
67 if (argv) *argv = app_argv;
71 * Restart the program executable with the command-line arguments stored.
73 * This function will restart & re-execute this program in place of itself
74 * using the command-line arguments stored by ecore_app_args_set(). This is
75 * an easy way for a program to restart itself for cleanup purposes,
76 * configuration reasons or in the event of a crash.
79 ecore_app_restart(void)
81 EINA_MAIN_LOOP_CHECK_RETURN;
86 if ((app_argc < 1) || (!app_argv)) return;
87 if (app_argc >= 4096) return;
88 for (i = 0; i < app_argc; i++) args[i] = app_argv[i];
90 execvp(app_argv[0], args);