* $Author$
* $Locker$
* $Header$
+ *
+ * (c) Copyright 1988 by the Massachusetts Institute of Technology.
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
*/
#ifndef lint
static char *rcsid_display_c = "$Header$";
#endif lint
+#include <mit-copyright.h>
#include <stdio.h>
#include <curses.h>
#include <sys/time.h>
#include "userreg.h"
#define DESC_WIDTH 18
-#define HEADER "*** Project Athena User Registration ***"
-#ifdef ibm032
-#define HELP " Press backspace to delete a character. Press Ctrl-C to start over."
-#else
-#ifdef vax
-#define HELP " Press the key marked <X| to delete a character. Press Ctrl-C to start over."
+#define HEADER "*** Athena User Account Registration ***"
+#if defined(vax) || defined(mips)
+#define HELP " Press the key above RETURN to delete a character. Press Ctrl-C to start over."
#endif
+#ifndef HELP
+#define HELP " Press backspace to delete a character. Press Ctrl-C to start over."
#endif
#define BORDER_CHAR '-'
#define MIN_COLS 80
/* This replaces several "useful" display functions in the old userreg */
redisp () {
mvwprintw (fnamew, 0, 0, "%-24s", user.u_first);
+ wrefresh(fnamew);
mvwprintw (midw, 0, 0, "%-24s", user.u_mid_init);
+ wrefresh(midw);
mvwprintw (lnamew, 0, 0, "%-24s", user.u_last);
+ wrefresh(lnamew);
mvwprintw (idw, 0, 0, "%-24s", typed_mit_id);
+ wrefresh(idw);
mvwprintw (loginw, 0, 0, "%-24s", user.u_login);
-
- wrefresh (dataw);
+ wrefresh(loginw);
}
char *prompt;
char *buf;
int maxsize, timeout;
-bool echop, emptyok, valuep;
+int echop, emptyok, valuep;
{
- char c;
+ int c;
int i;
struct itimerval it;
wrefresh (queryw);
i = 0;
- while ((c = getchar ()) != '\r') {
+ while ((c = getchar ()) != '\r' && c != '\n') {
switch (c) {
case '\025': /* Ctl-U */
goto retry;
- break;
case EOF:
/* We're in raw mode, so EOF means disaster */
exit(1);
break;
+ delchar:
case '\177': /* Delete */
case '\010': /* Backspace */
if (i) {
}
break;
case '\003': /* Ctrl-C */
- if (getuid() != 0)
- { clear(); /* Exit if not root. */
- restore_display();
- exit(0);
- }
- else
- restart();
+ clear();
+ restore_display();
+ exit(0);
break;
default:
if (c >= ' ') { /* Ignore all other control chars */
break;
}
if (valuep && i >= maxsize) {
+ wfeep();
wprintw (displayw,
"You are not allowed to type more than %d characters for this answer.\n",
- maxsize);
+ maxsize-1);
wrefresh (displayw);
- goto retry;
+ goto delchar;
}
}
int ypos, xpos;
int answer;
struct itimerval it;
- char c;
+ int c;
start:
werase (queryw);
it.it_value.tv_usec = 0;
setitimer (ITIMER_REAL, &it, (struct itimerval *) 0);
- while ((c = getchar ()) != '\r') { /* Wait for CR. */
+ while ((c = getchar ()) != '\r' && c != '\n') { /* Wait for CR. */
switch (c) {
case 'n': /* No. */
case 'N':
exit(1);
break;
case '\003': /* Ctrl-C */
-/* if (getuid() != 0) */
- { clear(); /* Exit if not root. */
- restore_display();
- exit(0);
- }
+ clear();
+ restore_display();
+ exit(0);
break;
default: /* Ignore everything else. */
break;
char *line;
{
if (line) {
- waddstr (displayw, line);
- waddch (displayw, '\n');
- wrefresh (displayw);
- }
- else {
- werase (displayw);
+ waddstr (displayw, line);
+ waddch (displayw, '\n');
+ } else {
+ werase (displayw);
}
wrefresh (displayw);
}
-/* Display_text displays a canned message from a file */
-display_text (filename)
+/* Display_text displays a canned message from a file. The string
+ * will get imbedded in any %s's in the text.
+ */
+display_text(filename, string)
char *filename;
+char *string;
{
FILE * fp;
- char buf[100];
+ char buf[100], buf1[110];
werase (displayw);
if ((fp = fopen (filename, "r")) == NULL) {
}
while (fgets (buf, 100, fp)) {
- /* get rid of the newline */
- buf[strlen (buf) - 1] = 0;
- display_text_line (buf);
+ /* get rid of the newline */
+ buf[strlen (buf) - 1] = 0;
+ sprintf(buf1, buf, string);
+ waddstr(displayw, buf1);
+ waddch(displayw, '\n');
}
+ wrefresh(displayw);
fclose (fp);
}