-/* $Id $
+/* $Id$
*
* Simple add-me-to/remove-me-from list client
*
#include <moira_site.h>
#include <ctype.h>
+#ifdef HAVE_CURSES
#include <curses.h>
+#endif
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <krb.h>
+
RCSID("$Header$");
#define STARTCOL 0
int main(int argc, char *argv[])
{
void (*old_hook)(const char *, long, const char *, va_list);
- int use_menu = 1;
- char buf[BUFSIZ], *motd;
+ int use_menu = 1, k_errno;
+ char buf[BUFSIZ], pname[ANAME_SZ], *motd;
if ((whoami = strrchr(argv[0], '/')) == NULL)
whoami = argv[0];
current_li->modby = NULL;
current_li->modwith = NULL;
}
- if (!(username = getlogin()))
- username = getpwuid(getuid())->pw_name;
- username = username ? strdup(username) : "";
+
+ if ((k_errno = tf_init(TKT_FILE, R_TKT_FIL)) ||
+ (k_errno = tf_get_pname(pname)))
+ {
+ com_err(whoami, k_errno, "reading Kerberos ticket file");
+ exit(1);
+ }
+ tf_close();
+ username = pname;
printf("Connecting to database for %s...please hold on.\n", username);
goto punt;
}
- if (use_menu)
+ initscr();
+ if ((LINES < 24) || (COLS < 60))
{
- initscr();
- if ((LINES < 24) || (COLS < 60))
- {
- display_buff("Display window too small.\n\n");
- sprintf(buf,
- "Current window parameters are (%d lines, %d columns)\n",
- LINES, COLS);
- display_buff(buf);
- display_buff("Please resize your window\n");
- display_buff("to at least 24 lines and 60 columns.\n");
- exit(0);
- }
- raw();
- noecho();
- old_hook = set_com_err_hook(menu_err_hook);
- position[0] = oldpos[0] = 1;
- level = 0;
- pack_main_menu();
- pack_help_menu();
- display_menu(main_menu);
- get_main_input();
- cls();
- endwin();
- set_com_err_hook(old_hook);
+ display_buff("Display window too small.\n\n");
+ sprintf(buf, "Current window parameters are (%d lines, %d columns)\n",
+ LINES, COLS);
+ display_buff(buf);
+ display_buff("Please resize your window\n");
+ display_buff("to at least 24 lines and 60 columns.\n");
+ exit(0);
}
+ raw();
+ noecho();
+ old_hook = set_com_err_hook(menu_err_hook);
+ position[0] = oldpos[0] = 1;
+ level = 0;
+ pack_main_menu();
+ pack_help_menu();
+ display_menu(main_menu);
+ get_main_input();
+ cls();
+ endwin();
+ set_com_err_hook(old_hook);
exit(0);
punt: