]> andersk Git - moira.git/blobdiff - clients/moira/namespace.c
Switch from Imake-based build system to autoconf-based.
[moira.git] / clients / moira / namespace.c
index 080bbc3a218fc34a3de98aa0df181b114fcc0996..5bb6039173da1d743ad241018fdfd37d5484971a 100644 (file)
 #include <signal.h>
 #include <stdio.h>
 #include <string.h>
-#if 0
-#include <pwd.h>
-#include <sys/types.h>
-#endif
 
 #include <krb.h>
 
@@ -164,7 +160,9 @@ Menu namespace_menu = {
   }
 };
 
+#ifdef HAVE_CURSES
 Bool use_menu = TRUE;          /* whether or not we are using a menu. */
+#endif
 
 /*     Function Name: main
  *     Description: The main driver for the Moira Client.
@@ -196,7 +194,22 @@ void main(int argc, char **argv)
       if (**arg == '-')
        {
          if (!strcmp(*arg, "-nomenu"))
-           use_menu = FALSE;
+           {
+#ifdef HAVE_CURSES
+             use_menu = FALSE;
+#else
+             ;
+#endif
+           }
+         else if (!strcmp(*arg, "-menu"))
+           {
+#ifdef HAVE_CURSES
+             use_menu = TRUE;
+#else
+             fprintf(stderr, "%s: No curses support. -menu option ignored\n",
+                     whoami);
+#endif
+           }
          else if (!strcmp(*arg, "-db"))
            if (arg - argv < argc - 1)
              {
@@ -257,9 +270,11 @@ void main(int argc, char **argv)
   act.sa_handler = Signal_Handler;
   sigaction(SIGHUP, &act, NULL);
   sigaction(SIGQUIT, &act, NULL);
+#ifdef HAVE_CURSES
   if (use_menu)
     sigaction(SIGINT, &act, NULL);
   else
+#endif
     {
       act.sa_handler = CatchInterrupt;
       sigaction(SIGINT, &act, NULL);
@@ -267,6 +282,7 @@ void main(int argc, char **argv)
 
   menu = &namespace_menu;
 
+#ifdef HAVE_CURSES
   if (use_menu)                /* Start menus that execute program */
     {
       Start_paging();
@@ -274,6 +290,7 @@ void main(int argc, char **argv)
       Stop_paging();
     }
   else                 /* Start program without menus. */
+#endif
     Start_no_menu(menu);
 
   mr_disconnect();
@@ -315,8 +332,10 @@ static void Usage(void)
 static void Signal_Handler(void)
 {
   Put_message("Signal caught - exiting");
+#ifdef HAVE_CURSES
   if (use_menu)
     Cleanup_menu();
+#endif
   mr_disconnect();
   exit(1);
 }
This page took 0.04242 seconds and 4 git commands to generate.