[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-mcron] [PATCH 23/33] mcron: Add forward declarations.
From: |
Mathieu Lirzin |
Subject: |
[Bug-mcron] [PATCH 23/33] mcron: Add forward declarations. |
Date: |
Sun, 27 Sep 2015 23:00:34 +0200 |
* mcron.c: Reorder function definitions sequentially.
---
mcron.c | 53 ++++++++++++++++++++++++++++-------------------------
1 file changed, 28 insertions(+), 25 deletions(-)
diff --git a/mcron.c b/mcron.c
index 472f096..015d9c9 100644
--- a/mcron.c
+++ b/mcron.c
@@ -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);
}
- [Bug-mcron] [PATCH 12/33] main: Use 'when' and 'unless' special forms., (continued)
- [Bug-mcron] [PATCH 12/33] main: Use 'when' and 'unless' special forms., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 14/33] main: Make 'catch-mcron-error' macro hygienic., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 16/33] main: Add cron-file-descriptors., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 27/33] main: Improve 'process-user-file' definition., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 15/33] main: Add docstrings., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 26/33] mcron: Make functions 'static'., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 29/33] environment: Redefine 'modify-environment'., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 17/33] main: Add main., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 21/33] main: Remove obsolete debug option., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 22/33] redirect: Use module (ice-9 regex)., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 23/33] mcron: Add forward declarations.,
Mathieu Lirzin <=
- [Bug-mcron] [PATCH 28/33] main: Remove unused 'regular-file?' procedure., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 24/33] mcron: Use symbolic constants., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 25/33] mcron: Rework comments., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 20/33] build: Enable silent rules by default., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 13/33] main: Turn 'command-name' into a thunk., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 19/33] build: Compile and install '.go' files., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 18/33] main: Add (mcron main) module., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 30/33] Define directory-local variables for Emacs., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 31/33] main: Add 'proc-in-directory'., Mathieu Lirzin, 2015/09/27
- [Bug-mcron] [PATCH 32/33] main: Remove 'valid-user'., Mathieu Lirzin, 2015/09/27