same sanity fixes from the sipb-athena port.
several s/#endif lint/#endif/ to make irix cc happy
rename SignalHandler to Signal_Handler to avoid namespace collision in Linux
POSIX and other fixes in menu.c. Kludge for NetBSD since there's no
portable fix. Removed Password_input since it's not used and it was
hopelessly confused about POSIX vs SYSV
OBJS= ${MOBJS} ${NOBJS}
INCLUDE= -I$(BUILDTOP)/include -I$(BUILDTOP)/lib ${GDSSINC} -I/usr/athena/include -I.
-
-program(moira, ${MOBJS},${MR_LIBDEP} ${GDB_LIBDEP}, ${LIBGDSS} ${CLIBS} ${CURSES},${PROGDIR})
-program(namespace, ${NOBJS},${MR_LIBDEP} ${GDB_LIBDEP}, ${LIBGDSS} ${CLIBS} ${CURSES},${PROGDIR})
+program(moira, ${MOBJS},${MR_LIBDEP} ${GDB_LIBDEP}, ${LIBGDSS} ${CLIBS} ${CRYPT} ${CURSES},${PROGDIR})
+program(namespace, ${NOBJS},${MR_LIBDEP} ${GDB_LIBDEP}, ${LIBGDSS} ${CLIBS} ${CRYPT} ${CURSES},${PROGDIR})
install::
$(RM) $(DESTDIR)$(PROGDIR)/listmaint
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file cluster.c for the MOIRA Client, which allows a nieve
* user to quickly and easily maintain most parts of the MOIRA database.
static char *MacState(state)
int state;
{
- char buf[BUFSIZ];
+ static char buf[BUFSIZ];
if (state < 0 || state > 3) {
sprintf(buf, "Unknown (%d)", state);
name = strsave(""); /* want to put prefix here */
if (GetValueFromUser("Machine name", &name) == SUB_ERROR)
- return(NULL);
+ return(0);
name = canonicalize_hostname(strsave(name));
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file delete.c for the MOIRA Client, which allows a nieve
* user to quickly and easily maintain most parts of the MOIRA database.
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file globals.c for the Moira Client, which allows a nieve
* user to quickly and easily maintain most parts of the Moira database.
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file lists.c for the MOIRA Client, which allows a nieve
* user to quickly and easily maintain most parts of the MOIRA database.
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file main.c for the Moira Client, which allows a nieve
* user to quickly and easily maintain most parts of the Moira database.
extern Menu moira_top_menu, list_menu, user_menu, dcm_menu;
#ifndef DEBUG
-static void SignalHandler(), CatchInterrupt();
-#endif DEBUG
+static void Signal_Handler(), CatchInterrupt();
+#endif
static void ErrorExit(), Usage();
char *getlogin();
#ifdef POSIX
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
- act.sa_handler= (void (*)()) SignalHandler;
+ act.sa_handler= (void (*)()) Signal_Handler;
(void) sigaction(SIGHUP, &act, NULL);
(void) sigaction(SIGQUIT, &act, NULL);
if (use_menu)
(void) sigaction(SIGINT, &act, NULL);
}
#else
- (void) signal(SIGHUP, SignalHandler);
- (void) signal(SIGQUIT, SignalHandler);
+ (void) signal(SIGHUP, Signal_Handler);
+ (void) signal(SIGQUIT, Signal_Handler);
if (use_menu)
- (void) signal(SIGINT, SignalHandler);
+ (void) signal(SIGINT, Signal_Handler);
else
(void) signal(SIGINT, CatchInterrupt);
#endif /* POSIX */
}
#ifndef DEBUG
-/* Function Name: SignalHandler
+/* Function Name: Signal_Handler
* Description: This function cleans up from a signal interrupt.
* Arguments: none.
* Returns: doesn't
*/
static void
-SignalHandler()
+Signal_Handler()
{
Put_message("Signal caught - exiting");
if (use_menu)
Put_message("Interrupt! Press RETURN to continue");
interrupt = 1;
}
-#endif DEBUG
+#endif
#ifndef lint
static char rcsid_menu_c[] = "$Header$";
-
-#endif lint
+#endif
#include <mit-copyright.h>
#include <sys/types.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <curses.h>
#ifdef POSIX
#include <unistd.h>
#include <termios.h>
+#include <stdarg.h>
+#else
+#include <sgtty.h>
+#include <varargs.h>
#endif /* POSIX */
#include <ctype.h>
-#ifndef sun
-#include <varargs.h>
-#endif
#include <com_err.h>
#include <moira.h>
#include "menu.h"
#define MIN_INPUT 2 /* Minimum number of lines for input window */
extern int interrupt; /* will be set if ^C is received */
-extern FILE *fdopen();
-#ifndef sgi
-extern int getpid();
-#endif
-extern char *calloc();
extern char *whoami;
FILE *log_file = (FILE *) NULL; /* file stream of log file */
int more_flg = 1;
-#ifdef POSIX
-extern char *malloc();
-#endif
-
/* Structure for holding current displayed menu */
struct menu_screen {
WINDOW *ms_screen; /* Window for this menu */
{
struct menu_screen *make_ms();
#ifdef __STDC__
- register void (*old_hook)(const char *, long, const char *, va_list) = set_com_err_hook(menu_com_err_hook);
+ register void (*old_hook)(const char *, long, const char *, va_list) = set_com_err_hook((void (*) (const char *, long, const char *, va_list))menu_com_err_hook);
#else
register void (*old_hook)() = set_com_err_hook(menu_com_err_hook);
#endif
(void) wmove(cur_ms->ms_input, y, 0);
(void) wclrtoeol(cur_ms->ms_input);
y--;
- x = cur_ms->ms_input->_maxx-1;
+#ifdef __NetBSD__
+ x = cur_ms->ms_input->maxx - 1;
+#else
+ x = cur_ms->ms_input->_maxx - 1;
+#endif
}
}
break;
(void) waddch(cur_ms->ms_input, c);
*p++ = c;
x++;
+#ifdef __NetBSD__
+ if (x >= cur_ms->ms_input->maxx) {
+#else
if (x >= cur_ms->ms_input->_maxx) {
+#endif
x = 0;
y++;
}
return 1;
}
-/* Prompt the user for input in the input window of cur_ms, but don't echo
- and allow some control characters */
-int Password_input(prompt, buf, buflen)
- char *prompt;
- char *buf;
- int buflen;
-{
- int c;
- char *p;
- int y, x, oldx;
-
- if (cur_ms != NULLMS) {
- more_flg = 1;
- getyx(cur_ms->ms_input, y, x);
- (void) wmove(cur_ms->ms_input, y, 0);
-
- touchwin(cur_ms->ms_screen);
- refresh_ms(cur_ms);
- (void) waddstr(cur_ms->ms_input, prompt);
- getyx(cur_ms->ms_input, y, x);
-
- oldx = x;
- for (p = buf; p - buf < buflen;) {
- (void) wmove(cur_ms->ms_input, y, x);
- (void) wclrtoeol(cur_ms->ms_input);
- refresh_ms(cur_ms);
- c = getchar() & 0x7f;
- switch (c) {
- case CTL('C'):
- return 0;
- case CTL('Z'):
- (void) kill(getpid(), SIGTSTP);
- touchwin(curscr);
- break;
- case CTL('L'):
- (void) wclear(cur_ms->ms_input);
- (void) waddstr(cur_ms->ms_input, prompt);
- refresh_ms(cur_ms);
- (void) move(LINES - 1, 0);
- (void) wrefresh(curscr);
- getyx(cur_ms->ms_input, y, x);
- break;
- case '\n':
- case '\r':
- (void) waddch(cur_ms->ms_input, '\n');
-
- (void) wclrtoeol(cur_ms->ms_input);
- refresh_ms(cur_ms);
- *p = '\0';
- Start_paging();
- return 1;
- case '\b':
- case '\177':
- if (p > buf) {
- p--;
- x--;
- }
- break;
- case CTL('U'):
- x = oldx;
- p = buf;
- break;
- default:
- *p++ = c;
- break;
- }
- }
- }
- else {
-#ifdef POSIX
- struct termios ttybuf, nttybuf;
-#else
- struct sgttyb ttybuf, nttybuf;
-#endif /* POSIX */
- printf("%s", prompt);
- /* turn off echoing */
-#ifdef POSIX
- tcgetattr(0, &ttybuf);
- nttybuf = ttybuf;
- nttybuf.c_lflag &= ~ECHO;
- tcsetattr(0, TCSANOW, &nttybuf);
- if (gets(buf) == NULL) {
- tcsetattr(0, TCSANOW, &ttybuf);
- putchar('\n');
- return 0;
- }
- putchar('\n');
- (void) ioctl(0, TCSETA, (char *)&ttybuf);
-#else
- (void) ioctl(0, TIOCGETP, (char *)&ttybuf);
- nttybuf = ttybuf;
- nttybuf.sg_flags &= ~ECHO;
- (void)ioctl(0, TIOCSETP, (char *)&nttybuf);
- if (gets(buf) == NULL) {
- (void) ioctl(0, TIOCSETP, (char *)&ttybuf);
- putchar('\n');
- return 0;
- }
- putchar('\n');
- (void) ioctl(0, TIOCSETP, (char *)&ttybuf);
-#endif /* POSIX */
- Start_paging();
- return 1;
- }
- return 0;
-}
-
int lines_left;
/* Start paging */
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file menus.c for the MOIRA Client, which allows a nieve
* user to quickly and easily maintain most parts of the MOIRA database.
struct hostent *host_entry;
host_address = inet_addr(info[1]);
- if (host_address != NULL) {
+ if (host_address != 0) {
host_entry = gethostbyaddr((char *) &host_address, 4, AF_INET);
if (host_entry != NULL) {
free(info[1]);
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file main.c for the Moira Client, which allows a nieve
* user to quickly and easily maintain most parts of the Moira database.
#ifndef DEBUG
-static void SignalHandler(), CatchInterrupt();
-#endif DEBUG
+static void Signal_Handler(), CatchInterrupt();
+#endif
static void ErrorExit(), Usage();
char *getlogin();
#ifdef POSIX
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
- act.sa_handler= (void (*)()) SignalHandler;
+ act.sa_handler= (void (*)()) Signal_Handler;
(void) sigaction(SIGHUP, &act, NULL);
(void) sigaction(SIGQUIT, &act, NULL);
if (use_menu)
(void) sigaction(SIGINT, &act, NULL);
}
#else
- (void) signal(SIGHUP, SignalHandler);
- (void) signal(SIGQUIT, SignalHandler);
+ (void) signal(SIGHUP, Signal_Handler);
+ (void) signal(SIGQUIT, Signal_Handler);
if (use_menu)
- (void) signal(SIGINT, SignalHandler);
+ (void) signal(SIGINT, Signal_Handler);
else
(void) signal(SIGINT, CatchInterrupt);
#endif /* POSIX */
}
#ifndef DEBUG
-/* Function Name: SignalHandler
+/* Function Name: Signal_Handler
* Description: This function cleans up from a signal interrupt.
* Arguments: none.
* Returns: doesn't
*/
static void
-SignalHandler()
+Signal_Handler()
{
Put_message("Signal caught - exiting");
if (use_menu)
Put_message("Interrupt! Press RETURN to continue");
interrupt = 1;
}
-#endif DEBUG
+#endif
/* Dummy routine to be able to link against the rest of the moira client */
DeleteUser()
{
return(DM_QUIT);
-};
+}
int
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file nfs.c for the MOIRA Client, which allows a nieve
* user to quickly and easily maintain most parts of the MOIRA database.
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file pobox.c for the MOIRA Client, which allows a nieve
* user to quickly and easily maintain most parts of the MOIRA database.
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file printer.c for the MOIRA Client, which allows a nieve
* user to quickly and easily maintain most parts of the MOIRA database.
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file quota.c for the MOIRA Client, which allows a nieve
* user to quickly and easily maintain most parts of the MOIRA database.
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file user.c for the MOIRA Client, which allows a nieve
* user to quickly and easily maintain most parts of the MOIRA database.
static char *UserState(state)
int state;
{
- char buf[BUFSIZ];
+ static char buf[BUFSIZ];
if (state < 0 || state >= US_END) {
sprintf(buf, "Unknown (%d)", state);
* (wildcards okay).
* Returns: the first element of the queue containing the user info.
*
- * Note: if we are checking a login name, if the length is greater
- * than 8 characters, we immediately print a "no such user" error.
- * This gets around a bug in Ingres, where a non-existent 8 character
- * username returns a "no such user" error instantaneously, but a 9
- * character username takes 5-6 minutes. :-( We will need to change
- * this if we ever make a username longer than 8 characters.
- * Unlikely, but....
*/
struct qelem *
switch(type) {
case LOGIN:
- if (strlen(name1) > 8) {
- com_err(program_name, MR_USER,
- " when attempting to get_user_acount_by_login.");
- return (NULL);
- }
args[0] = name1;
if ( (status = do_mr_query("get_user_account_by_login", 1, args,
StoreInfo, (char *) &elem)) != 0) {
#if (!defined(lint) && !defined(SABER))
static char rcsid_module_c[] = "$Header$";
-#endif lint
+#endif
/* This is the file utils.c for the MOIRA Client, which allows a nieve
* user to quickly and easily maintain most parts of the MOIRA database.
#include <netdb.h> /* for gethostbyname. */
#include <sys/types.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
/* Function Name: AddQueue