#include <pwd.h>
#include <signal.h>
#include <stdio.h>
-#include <strings.h>
+#include <string.h>
#include <sys/types.h>
#include <moira.h>
#include <menu.h>
char * whoami; /* used by menu.c ugh!!! */
char * moira_server;
+int interrupt = 0;
int NewListHelp();
/*
NULLFUNC,
NULLFUNC,
"List Information Menu",
- 4,
+ 3,
{
SIMPLEFUNC("member", "Show all lists to which a given member belongs",
ListByMember),
ListByAdministrator),
SIMPLEFUNC("public", "Show all public mailing lists",
ListAllPublicMailLists),
- SIMPLEFUNC("maillists", "Show all mailing lists",
- ListAllMailLists)
}
};
#ifndef DEBUG
-static void SignalHandler();
+static void SignalHandler(), CatchInterrupt();
#endif DEBUG
static void ErrorExit(), Usage();
Menu *menu;
char *motd, **arg;
char pname[ANAME_SZ];
+#ifdef POSIX
+ struct sigaction act;
+#endif
- if ((program_name = rindex(argv[0], '/')) == NULL)
+ if ((program_name = strrchr(argv[0], '/')) == NULL)
program_name = argv[0];
else
program_name++;
*/
#ifndef DEBUG
+#ifdef POSIX
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler= (void (*)()) SignalHandler;
+ (void) sigaction(SIGHUP, &act, NULL);
+ (void) sigaction(SIGQUIT, &act, NULL);
+ if (use_menu)
+ (void) sigaction(SIGINT, &act, NULL);
+ else {
+ act.sa_handler= (void (*)()) CatchInterrupt;
+ (void) sigaction(SIGINT, &act, NULL);
+ }
+#else
(void) signal(SIGHUP, SignalHandler);
- (void) signal(SIGINT, SignalHandler);
(void) signal(SIGQUIT, SignalHandler);
-#endif DEBUG
+ if (use_menu)
+ (void) signal(SIGINT, SignalHandler);
+ else
+ (void) signal(SIGINT, CatchInterrupt);
+#endif /* POSIX */
+#endif /* DEBUG */
menu = &namespace_menu;
mr_disconnect();
exit(1);
}
+
+
+static void
+CatchInterrupt()
+{
+ Put_message("Interrupt! Press RETURN to continue");
+ interrupt = 1;
+}
#endif DEBUG