diff options
author | Mathieu Lirzin <mthl@gnu.org> | 2015-09-05 13:14:03 +0200 |
---|---|---|
committer | Mathieu Lirzin <mthl@gnu.org> | 2016-05-07 11:42:11 +0200 |
commit | ba6613fe964b5949b3a58b3e2f65da0601f6b613 (patch) | |
tree | d4841b81dcb99ce8cfae017e65856d52350a29db /mcron.c | |
parent | b390063628269abc4f7bbc85cf59c8835d5285db (diff) | |
download | mcron-ba6613fe964b5949b3a58b3e2f65da0601f6b613.tar.gz mcron-ba6613fe964b5949b3a58b3e2f65da0601f6b613.tar.bz2 mcron-ba6613fe964b5949b3a58b3e2f65da0601f6b613.zip |
mcron: Add forward declarations.
* mcron.c: Reorder function definitions sequentially.
Diffstat (limited to 'mcron.c')
-rw-r--r-- | mcron.c | 53 |
1 files changed, 28 insertions, 25 deletions
@@ -48,16 +48,30 @@ #include <signal.h> #include <string.h> -/* This is a function designed to be installed as a signal handler, for - signals which are supposed to initiate shutdown of this program. It calls - the scheme procedure (see mcron.scm for details) to do all the work, and - then exits. */ +/* Forward declarations. */ +void inner_main (void *closure, int argc, char **argv); +void react_to_terminal_signal (int sig); +SCM set_cron_signals (void); + +int +main (int argc, char **argv) +{ + setenv ("GUILE_LOAD_PATH", GUILE_LOAD_PATH, 1); + scm_boot_guile (argc, argv, inner_main, 0); + + return 0; +} + +/* The effective main function (i.e. the one that actually does some work). + We register the function above with the guile system, and then execute the + mcron guile program. */ void -react_to_terminal_signal (int sig) +inner_main (void *closure, int argc, char **argv) { - scm_c_eval_string ("(delete-run-file)"); - exit (1); + scm_set_current_module (scm_c_resolve_module ("mcron main")); + scm_c_define_gsubr ("c-set-cron-signals", 0, 0, 0, set_cron_signals); + scm_c_eval_string ("(main)"); } /* This is a function designed to be callable from scheme, and sets up all the @@ -78,25 +92,14 @@ set_cron_signals () return SCM_BOOL_T; } -/* The effective main function (i.e. the one that actually does some work). - We register the function above with the guile system, and then execute the - mcron guile program. */ +/* This is a function designed to be installed as a signal handler, for + signals which are supposed to initiate shutdown of this program. It calls + the scheme procedure (see mcron.scm for details) to do all the work, and + then exits. */ void -inner_main (void *closure, int argc, char **argv) -{ - scm_set_current_module (scm_c_resolve_module ("mcron main")); - scm_c_define_gsubr ("c-set-cron-signals", 0, 0, 0, set_cron_signals); - scm_c_eval_string ("(main)"); -} - -/* The real main function. Does nothing but start up the guile subsystem. */ - -int -main (int argc, char **argv) +react_to_terminal_signal (int sig) { - setenv ("GUILE_LOAD_PATH", GUILE_LOAD_PATH, 1); - scm_boot_guile (argc, argv, inner_main, 0); - - return 0; + scm_c_eval_string ("(delete-run-file)"); + exit (1); } |