+++ /dev/null
-22 Insensitive text fields don't gray out
-
-24 Have delete* track down references
-
-26 When adding quota, if you click on OK while locker field is
-active, get a quota in callback error
-
-28 If you invoke the DCM (setting "are you sure" to true), then try
-again, that boolean is initialized incorrectly.
-
-31. put an initial member on lists
-
-32. XFILESEARCHPATH problems
-
-33. Coredumps on modifications
-
-34. problems deleting machine
-
-35. Looking up Karen Schiller by name gets bad signature, by login
-gets good signature
-
-
+++ /dev/null
-# $Header$
-#
-# Copyright 1991 by the Massachusetts Institute of Technology.
-#
-# For copying and distribution information,
-# please see the file <mit-copyright.h>.
-#
-# Imakefile for moira client.
-#
-
-SRCS= main.c formup.c form_setup.c \
- queries.c help.c stubs.c display.c tty.c parser.c
-CODE=${SRCS} Imakefile mmoira.h data.h menus.txt menus.awk forms.txt \
- forms.awk parser.h
-SRCDIR=${SRCTOP}/clients/mmoira
-OBJS = form_data.o form_setup.o menu_data.o main.o formup.o \
- queries.o help.o stubs.o display.o tty.o parser.o
-INCLUDE= -I$(BUILDTOP)/include -I$(BUILDTOP)/lib -I$(XDIR)/include \
- -I$(MOTIFINC) -I/usr/athena/include ${GDSSINC} -I.
-DEFINES= -D_NO_PROTO
-
-program(mmoira, ${OBJS},${MR_LIBDEP} ${GDB_LIBDEP},${LIBGDSS} ${CLIBS} -L$(XDIR)/lib -L$(MOTIFLIB) -lXm -lXt -lX11,${PROGDIR})
-
-form_data.c: forms.txt forms.awk
- awk -f forms.awk forms.txt > form_data.c
-
-menu_data.c: menus.txt menus.awk
- awk -f menus.awk menus.txt > menu_data.c
-
-depend:: ${CODE} form_data.c form_setup.c
+++ /dev/null
-! $Header$
-
-*traversalOn: True
-*keyboardFocusPolicy: explicit
-*highlightThickness: 2
-*highlightOnEnter: True
-
-*textwidget.columns: 50
-
-*logwidget.editMode: XmMULTI_LINE_EDIT
-*logwidget.editable: False
-*logwidget.scrollHorizontal: False
-*logwidget.rows: 24
-*logwidgetSW.y: 40
-*logwidgetSW.width: 673
-
-! The are the additional translations added to every field in a form
-! so that keyboard accelerators and navigation do the right thing.
-*formTranslations: None<Key>Return: next-or-do-it()\n\
- Ctrl<Key>C: cancel-form()\n\
- Shift<Key>Return: execute-form()\n\
- Meta<Key>Return: execute-form()\n\
- Meta<Key>?: help()\n\
- Meta Shift<Key>?: help()
-! These are the additional translations added to the Motif text widget
-! for emacs style editing.
-*textTranslations: <FocusOut>: focusOut() MoiraFocusOut() \n\
- ~Shift ~Ctrl ~Meta ~Alt <Key>osfDelete: delete-previous-character() \n\
- ~Shift ~Ctrl Meta ~Alt <Key>osfDelete: kill-previous-word() \n\
- ~Shift ~Ctrl ~Meta Alt <Key>osfDelete: kill-previous-word() \n\
- Ctrl<Key>D: delete-next-character() \n\
- Meta<Key>D: kill-next-word() \n\
- Alt<Key>D: kill-next-word() \n\
- Ctrl<Key>K: kill-to-end-of-line() \n\
- Ctrl<Key>W: kill-selection() \n\
- Ctrl<Key>Y: unkill() \n\
- Ctrl<Key>F: forward-character() \n\
- Ctrl<Key>B: backward-character() \n\
- Ctrl<Key>A: beginning-of-line() \n\
- Ctrl<Key>E: end-of-line() \n\
- Meta<Key>F: forward-word() \n\
- Alt<Key>F: forward-word() \n\
- Meta<Key>B: backward-word() \n\
- Alt<Key>B: backward-word() \n\
- ~Shift Meta<Key><: beginning-of-line() \n\
- ~Shift Alt<Key><: beginning-of-line() \n\
- Shift Meta<Key><: end-of-line() \n\
- Shift Alt<Key><: end-of-line() \n\
- Meta<Key>>: end-of-line() \n\
- Alt<Key>>: end-of-line()
-
-! These are the additional translations added to the Motif text widget
-! for the log window. The two noop translations are here to avoid
-! nasty interactions with the selection mechanism. They match the
-! existing translations that involve shifted mouse buttons.
-*logTranslations: ~Ctrl Shift ~Meta ~Alt<Btn1Down>: moiraRetrieve()\n\
- ~Ctrl ~Meta ~Alt<Btn1Up>: noop()\n\
- ~Ctrl Shift ~Meta ~Alt<Btn1Motion>: noop()\n\
- ~Ctrl Shift ~Meta ~Alt<Btn2Down>: moiraModify()
-
-*helpFile: /afs/athena/system/moira/lib/mmoira.helpfile
+++ /dev/null
-/*
-** Buttons & Pulldown menus across the top of the application.
-** When selected, it will continue to the submenu if non-null,
-** otherwise call the general callback.
-*/
-
-typedef struct MenuItemS {
- char *label; /* the displayed label */
- struct MenuItemS **submenu; /* if non-null, a submenu to display */
- char *accel; /* accelerator */
- int operation; /* op identifer */
- char *form; /* name of form to popup */
- char *query;
- int argc;
-} MenuItem;
-
-
-typedef struct {
- char *prompt; /* text displayed to left of input */
- int type; /* what sort of input expected */
- Boolean choice; /* is this field the next choice */
- union { /* default value / return value */
- char *stringvalue;
- Boolean booleanvalue;
- int integervalue;
- } returnvalue;
- Boolean insensitive; /* grayed-out or not... */
- Boolean changed; /* true when prog changes config */
- int (*valuechanged)(); /* if non-NULL, call */
- char **keywords; /* list of possible values */
- char *keyword_name; /* name of keyword */
- Widget mywidget;
- caddr_t parent; /* parent form */
-} UserPrompt;
-
-/* field types */
-#define FT_STRING 1
-#define FT_BOOLEAN 2
-#define FT_KEYWORD 3
-#define FT_NUMBER 4
-
-/* max length of character fields */
-#define MAXFIELDSIZE 256
-
-#define stringval(f, n) ((f)->inputlines[n]->returnvalue.stringvalue)
-#define boolval(f, n) ((f)->inputlines[n]->returnvalue.booleanvalue)
-
-/*
-** All (foo **) entries are assumed to be null-terminated lists of foos.
-*/
-
-typedef struct {
- char *label; /* text displayed on button */
- int (*returnfunction) (); /* function called when button hit */
-} BottomButton;
-
-/*
-** Pass a pointer to the filled-in EntryForm structure back to the
-** returnfunction when the button is hit.
-*/
-
-typedef struct {
- char *formname; /* name of form (duh!) */
- char *instructions; /* text at top of form */
- UserPrompt **inputlines; /* list of input lines */
- BottomButton **buttons; /* list of buttons on the bottom */
- Widget formpointer; /* already exists? */
- MenuItem *menu;
- caddr_t extrastuff; /* for future expansion */
-} EntryForm;
-
-/*
-** When you're coming up, check to see if formpointer is initialized.
-** If so, map it. Otherwise, create the form and set formpointer to
-** the new toplevel widget id. Then map it.
-*/
-
+++ /dev/null
-/* $Header$
- */
-
-#include <stdio.h>
-#include <moira.h>
-#include <moira_site.h>
-#include <sys/types.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <Xm/Xm.h>
-#include "mmoira.h"
-#ifdef GDSS
-#include <des.h>
-#include <krb.h>
-#include <gdss.h>
-#endif /* GDSS */
-
-
-static char *MOD_FORMAT = "Modified by %s at %s with %s\n";
-
-
-/* atot: convert ASCII integer unix time into human readable date string */
-
-char *atot(itime)
-char *itime;
-{
- int time;
- char *ct, *ctime();
-
- time = atoi(itime);
- ct = ctime(&time);
- ct[24] = 0;
- return(&ct[4]);
-}
-
-
-/* Turn an integer number of minutes into a print string */
-
-char *unparse_interval(i)
-int i;
-{
- static char uibuf[32];
-
- sprintf(uibuf, "%d hrs %d mins", i / 60, i % 60);
- return(&uibuf[0]);
-}
-
-
-static save_info(argc, argv, sq)
-int argc;
-char **argv;
-struct save_queue *sq;
-{
- sq_save_args(argc, argv, sq);
- return(MR_CONT);
-}
-
-
-int DisplayCallback(argc, info, form)
-int argc;
-char **info;
-EntryForm *form;
-{
- char buf[1024], name[128];
-#ifdef GDSS
- SigInfo si;
-#endif
- int i, status;
-
- switch (form->menu->operation) {
- case MM_SHOW_USER:
- sprintf(name, "%s, %s %s", info[U_LAST], info[U_FIRST], info[U_MIDDLE]);
- sprintf(buf, "Login name: %-20s Full name: %s\n", info[U_NAME], name);
- AppendToLog(buf);
- sprintf(buf, "User id: %-23s Login shell %-10s Class: %s\n",
- info[U_UID], info[U_SHELL], info[U_CLASS]);
- AppendToLog(buf);
-
-#ifdef GDSS
- sprintf(buf, "%s:%s", info[U_NAME], info[U_MITID]);
- si.rawsig = NULL;
- status = GDSS_Verify(buf, strlen(buf), info[U_SIGNATURE], &si);
-#ifdef DEBUG
- hex_dump(info[U_SIGNATURE]);
- sprintf(buf, "GDSS_Verify => %d", status);
- AppendToLog(buf);
-#endif /* DEBUG */
-#else /* GDSS */
- status = 0;
-#endif /* GDSS */
-
- sprintf(buf, "Account is: %-20s ID number: %-11s Signed: %s\n",
- user_states[atoi(info[U_STATE])], info[U_MITID],
- *info[U_SIGNATURE] ? (status ? "Bad" : "Yes") : "No");
- AppendToLog(buf);
- if (atoi(info[U_SECURE]))
- sprintf(buf, "Secure password set on %s.\n", atot(info[U_SECURE]));
- else
- sprintf(buf, "No secure password set.\n");
- AppendToLog(buf);
- sprintf(buf, "Comments: %s\n", info[U_COMMENT]);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT,
- info[U_MODBY], info[U_MODTIME],info[U_MODWITH]);
- AppendToLog(buf);
- break;
- case MM_SHOW_FINGER:
- sprintf(buf, "Finger information for user: %s\n", info[F_NAME]);
- AppendToLog(buf);
- sprintf(buf, "Login name: %-27s In real life: %s\n", info[F_NAME],
- info[F_FULLNAME]);
- AppendToLog(buf);
- sprintf(buf, "Nickname: %-29s Department: %s\n", info[F_NICKNAME],
- info[F_MIT_DEPT]);
- AppendToLog(buf);
- sprintf(buf, "Home: %-33s Home phone: %s\n", info[F_HOME_ADDR],
- info[F_HOME_PHONE]);
- AppendToLog(buf);
- sprintf(buf, "Office: %-31s Office phone: %s\n", info[F_OFFICE_ADDR],
- info[F_OFFICE_PHONE]);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[F_MODBY], info[F_MODTIME],
- info[F_MODWITH]);
- AppendToLog(buf);
- break;
- case MM_SHOW_POBOX:
- sprintf(buf, "Post Office information for user: %s\n", info[PO_NAME]);
- AppendToLog(buf);
- sprintf(buf, "Type: %-8s Box: %s\n", info[PO_TYPE], info[PO_BOX]);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[4], info[3], info[5]);
- AppendToLog(buf);
- break;
- case MM_SHOW_KRBMAP:
- sprintf(buf, "Kerberos mapping: User %-9s Principal %s",
- info[KMAP_USER], info[KMAP_PRINCIPAL]);
- AppendToLog(buf);
- break;
- case MM_SHOW_FILSYS:
- case MM_SHOW_FSGROUP:
- sq_save_args(argc, info, form->extrastuff);
- return(MR_CONT);
- break;
- case MM_SHOW_NFS:
- sprintf(buf,"Machine: %-20s Directory: %-15s Device: %s\n",
- info[NFS_NAME], info[NFS_DIR], info[NFS_DEVICE]);
- AppendToLog(buf);
- sprintf(buf, "Status: %s\n", format_filesys_type(info[NFS_STATUS]));
- AppendToLog(buf);
- sprintf(buf, "Quota Allocated: %-17s Size: %s\n",
- info[NFS_ALLOC], info[NFS_SIZE]);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[NFS_MODBY], info[NFS_MODTIME],
- info[NFS_MODWITH]);
- AppendToLog(buf);
- break;
- case MM_SHOW_QUOTA:
- if (!strcmp(info[Q_TYPE], "ANY"))
- sprintf(buf, "Filesystem: %s\n", info[Q_FILESYS]);
- else
- sprintf(buf, "Filesystem: %-45s %s %s\n", info[Q_FILESYS],
- info[Q_TYPE], info[Q_NAME]);
- AppendToLog(buf);
- sprintf(buf, "Machine: %-20s Directory: %-15s\n",
- info[Q_MACHINE], info[Q_DIRECTORY]);
- AppendToLog(buf);
- sprintf(buf, "Quota: %s\n", info[Q_QUOTA]);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[Q_MODBY], info[Q_MODTIME], info[Q_MODWITH]);
- AppendToLog(buf);
- break;
- case MM_SHOW_LIST:
- (void) sprintf(buf, "List: %s\n", info[L_NAME]);
- AppendToLog(buf);
- (void) sprintf(buf, "Description: %s\n", info[L_DESC]);
- AppendToLog(buf);
- if ( atoi(info[L_MAILLIST]))
- AppendToLog("This list is a mailing list.\n");
- else
- AppendToLog("This list is NOT a mailing list.\n");
- if (atoi(info[L_GROUP])) {
- (void) sprintf(buf,"This list is a Group and its ID number is %s\n",
- info[L_GID]);
- AppendToLog(buf);
- } else
- AppendToLog("This list is NOT a Group.\n");
- if (strcmp(info[L_ACE_TYPE],"NONE") == 0)
- AppendToLog("This list has no Administrator, how strange?!\n");
- else {
- sprintf(buf, "The Administrator of this list is the %s: %s\n",
- info[L_ACE_TYPE], info[L_ACE_NAME]);
- AppendToLog(buf);
- }
- (void) sprintf(buf, "This list is: %s, %s, and %s\n",
- atoi(info[L_ACTIVE]) ? "active" : "inactive",
- atoi(info[L_PUBLIC]) ? "public" : "private",
- atoi(info[L_HIDDEN]) ? "hidden" : "visible");
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[L_MODBY], info[L_MODTIME], info[L_MODWITH]);
- AppendToLog(buf);
- break;
- case MM_SHOW_MACH:
- sprintf(buf, "Machine: %-30s Type: %s\n", info[M_NAME], info[M_TYPE]);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[M_MODBY], info[M_MODTIME], info[M_MODWITH]);
- AppendToLog(buf);
- break;
- case MM_SHOW_CLUSTER:
- sprintf(buf, "Cluster: %s\n", info[C_NAME]);
- AppendToLog(buf);
- sprintf(buf, "Description: %s\n", info[C_DESCRIPT]);
- AppendToLog(buf);
- sprintf(buf, "Location: %s\n", info[C_LOCATION]);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[C_MODBY], info[C_MODTIME], info[C_MODWITH]);
- AppendToLog(buf);
- break;
- case MM_SHOW_CLDATA:
- sprintf(buf, "Cluster: %-20s Label: %-15s Data: %s",
- info[CD_NAME], info[CD_LABEL], info[CD_DATA]);
- AppendToLog(buf);
- break;
- case MM_SHOW_MCMAP:
- sprintf(buf, "Machine: %-20s Cluster: %s", info[0], info[1]);
- AppendToLog(buf);
- break;
- case MM_SHOW_MEMBERS:
- if (argc == 2)
- sprintf(buf, "%-9s %s", info[0], info[1]);
- else
- sprintf(buf, "%s", info[0]);
- AppendToLog(buf);
- break;
- case MM_STATS:
- sprintf(buf, "Table: %-20s Modified: %s\n", info[0], info[argc-1]);
- AppendToLog(buf);
- sprintf(buf, " %-8D appends, %-8d updates, %-8d deletes",
- info[2], info[3], info[4]);
- AppendToLog(buf);
- break;
- case MM_CLIENTS:
- {
- unsigned long host_address;
- struct hostent *host_entry;
-
- host_address = inet_addr(info[1]);
- if (host_address != NULL) {
- host_entry = gethostbyaddr((char *)&host_address, 4, AF_INET);
- if (host_entry != NULL) {
- free(info[1]);
- info[1] = strsave(host_entry->h_name);
- }
- }
- }
- sprintf(buf, "Principal %s on %s (%s)\n", info[0], info[1], info[2]);
- AppendToLog(buf);
- sprintf(buf, " Connected at %s, client %s", info[3], info[4]);
- AppendToLog(buf);
- break;
- case MM_SHOW_VALUE:
- sprintf(buf, "Variable: %-20s Value: %s\n", stringval(form, 0),
- info[0]);
- AppendToLog(buf);
- break;
- case MM_SHOW_ALIAS:
- sprintf(buf, "Alias: %-20s Type: %-8s Value: %s\n",
- info[0], info[1], info[2]);
- AppendToLog(buf);
- break;
- case MM_SHOW_HOST:
- if (atoi(info[SH_HOSTERROR]))
- sprintf(name, "Error %d: %s", atoi(info[SH_HOSTERROR]),
- info[SH_ERRMSG]);
- else
- strcpy(name, "No error");
- sprintf(buf, "%s:%s %s/%s/%s/%s/%s\n",
- info[SH_MACHINE], info[SH_SERVICE],
- atoi(info[SH_ENABLE]) ? "Enabled" : "Disabled",
- atoi(info[SH_SUCCESS]) ? "Success" : "Failure",
- atoi(info[SH_INPROGRESS]) ? "InProgress" : "Idle",
- atoi(info[SH_OVERRIDE]) ? "Override" : "Normal", name);
- AppendToLog(buf);
- AppendToLog("Last Try Last Success Value1 Value2 Value3\n");
- strcpy(name, atot(info[SH_LASTTRY]));
- sprintf(buf, "%-20s %-20s %-9d %-9d %s\n", name,
- atot(info[SH_LASTSUCCESS]), atoi(info[SH_VALUE1]),
- atoi(info[SH_VALUE2]), info[SH_VALUE3]);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[SH_MODBY], info[SH_MODTIME],
- info[SH_MODWITH]);
- AppendToLog(buf);
- break;
- case MM_SHOW_DQUOTA:
- sprintf(buf, "The default quota is %s Kbytes.\n", info[0]);
- AppendToLog(buf);
- break;
- case MM_SHOW_DCM:
- if (argc == 2)
- sprintf(buf, "%s:%s\n", info[0], info[1]);
- else
- sprintf(buf, "%s\n", info[0]);
- AppendToLog(buf);
- break;
- case MM_SHOW_PCAP:
- sprintf(buf, "Printer: %-35s Spool host: %s\n", info[PCAP_NAME],
- info[PCAP_SPOOL_HOST]);
- AppendToLog(buf);
- sprintf(buf, "Spool directory: %-27s Remote Printer Name: %s\n",
- info[PCAP_SPOOL_DIR], info[PCAP_RPRINTER]);
- AppendToLog(buf);
- sprintf(buf, "Authentication: %-3s Price/page: %-3s Quota Server: %s\n",
- atoi(info[PCAP_AUTH]) ? "yes" : "no",
- info[PCAP_PRICE], info[PCAP_QSERVER]);
- AppendToLog(buf);
- sprintf(buf, "Comments: %s\n", info[PCAP_COMMENTS]);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[PCAP_MODBY], info[PCAP_MODTIME],
- info[PCAP_MODWITH]);
- AppendToLog(buf);
- break;
- case MM_SHOW_ZEPHYR:
- sprintf(buf, "Zephyr class: %s\n", info[ZA_CLASS]);
- AppendToLog(buf);
- if (!strcmp("NONE", info[ZA_XMT_TYPE]))
- name[0] = 0;
- else
- sprintf(name, "Name: %s", info[ZA_XMT_ID]);
- sprintf(buf, "XMT ACL Type %s %s\n", info[ZA_XMT_TYPE], name);
- AppendToLog(buf);
- if (!strcmp("NONE", info[ZA_SUB_TYPE]))
- name[0] = 0;
- else
- sprintf(name, "Name: %s", info[ZA_SUB_ID]);
- sprintf(buf, "SUB ACL Type %s %s\n", info[ZA_SUB_TYPE], name);
- AppendToLog(buf);
- if (!strcmp("NONE", info[ZA_IWS_TYPE]))
- name[0] = 0;
- else
- sprintf(name, "Name: %s", info[ZA_IWS_ID]);
- sprintf(buf, "IWS ACL Type %s %s\n", info[ZA_IWS_TYPE], name);
- AppendToLog(buf);
- if (!strcmp("NONE", info[ZA_IUI_TYPE]))
- name[0] = 0;
- else
- sprintf(name, "Name: %s", info[ZA_IUI_ID]);
- sprintf(buf, "IUI ACL Type %s %s\n", info[ZA_IUI_TYPE], name);
- AppendToLog(buf);
- break;
- case MM_SHOW_SERVICE:
- sprintf(name, "%s:%s", info[SVC_ACE_TYPE], info[SVC_ACE_NAME]);
- sprintf(buf, "Service: %-10s Type: %-8s Owner: %-11s\n",
- info[SVC_SERVICE], info[SVC_TYPE], name);
- AppendToLog(buf);
- sprintf(buf, "Interval %s, Target:%s, Script:%s\n",
- unparse_interval(atoi(info[SVC_INTERVAL])), info[SVC_TARGET],
- info[SVC_SCRIPT]);
- AppendToLog(buf);
- strcpy(name, atot(info[SVC_DFGEN]));
- sprintf(buf, "Generated %s; Last Checked %s\n", name,
- atot(info[SVC_DFCHECK]));
- AppendToLog(buf);
- if (atoi(info[SVC_HARDERROR]))
- sprintf(name, "Error %d: %s", atoi(info[SVC_HARDERROR]),
- info[SVC_ERRMSG]);
- else
- strcpy(name, "No error");
- sprintf(buf, "%s/%s/%s\n",
- atoi(info[SVC_ENABLE]) ? "Enabled" : "Disabled",
- atoi(info[SVC_INPROGRESS]) ? "InProgress" : "Idle", name);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[SVC_MODBY], info[SVC_MODTIME],
- info[SVC_MODWITH]);
- AppendToLog(buf);
- break;
- case MM_SHOW_ACE_USE:
- sprintf(buf, "%s: %s", info[0], info[1]);
- AppendToLog(buf);
- break;
- case MM_SHOW_FS_ALIAS:
- sprintf(buf, "Alias: %s; Real name %s\n", info[0], info[2]);
- AppendToLog(buf);
- break;
- default:
- for (i = 0; i < argc; i++) {
- if (i != 0) AppendToLog(", ");
- AppendToLog(info[i]);
- }
- }
- AppendToLog("\n");
- return(MR_CONT);
-}
-
-
-/* Display info about filesystem, doing FS groups & type MUL as well.
- * frees info before returning.
- */
-
-ShowFilsys(info)
-char **info;
-{
- int stat, i;
- char **argv, buf[256];
- struct save_queue *sq;
-
- if (!strcmp(info[FS_TYPE], "FSGROUP") ||
- !strcmp(info[FS_TYPE], "MUL")) {
- sprintf(buf,"%20s %s: %s\n", " ", strcmp(info[FS_TYPE], "MUL") ?
- "Filesystem Group" : "Multiple Filesystem",
- info[FS_NAME]);
- AppendToLog(buf);
-
- sprintf(buf,"Comments: %s\n",info[FS_COMMENTS]);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[FS_MODBY], info[FS_MODTIME],
- info[FS_MODWITH]);
- AppendToLog(buf);
- AppendToLog("Containing the filesystems (in order):\n");
-
- sq = sq_create();
- if ((stat = MoiraQuery("get_fsgroup_members", 1, &info[FS_NAME],
- save_info, (char *)sq)) != 0) {
- if (stat == MR_NO_MATCH)
- AppendToLog(" [no members]");
- else
- com_err(program_name, stat, "");
- } else {
- while (sq_get_data(sq, &argv)) {
- sprintf(buf, " Filesystem: %-32s (sort key: %s)\n",
- argv[0], argv[1]);
- AppendToLog(buf);
- free(argv[0]);
- free(argv[1]);
- free(argv);
- }
- sq_destroy(sq);
- }
- } else {
- sprintf(buf,"Filesystem: %s\n", info[FS_NAME]);
- AppendToLog(buf);
- sprintf(buf,"Type: %-40s Machine: %-15s\n",
- info[FS_TYPE], info[FS_MACHINE]);
- AppendToLog(buf);
- sprintf(buf, "Packname: %s\n", info[FS_PACK]);
- AppendToLog(buf);
- sprintf(buf,"Default Access: %-29s Mountpoint %s\n",
- info[FS_ACCESS], info[FS_M_POINT]);
- AppendToLog(buf);
- sprintf(buf,"Comments: %s\n",info[FS_COMMENTS]);
- AppendToLog(buf);
- sprintf(buf, "User Ownership: %-30s Group Ownership: %s\n",
- info[FS_OWNER], info[FS_OWNERS]);
- AppendToLog(buf);
- sprintf(buf, "Update fileserver: %-27s Locker Type: %s\n",
- atoi(info[FS_CREATE]) ? "On" : "Off",
- info[FS_L_TYPE]);
- AppendToLog(buf);
- sprintf(buf, MOD_FORMAT, info[FS_MODBY], info[FS_MODTIME],
- info[FS_MODWITH]);
- AppendToLog(buf);
- }
- for (i = 0; i < FS_MODWITH; i++)
- free(info[i]);
- free(info);
- AppendToLog("\n");
-}
+++ /dev/null
-/* $Header$
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <moira.h>
-#include <moira_site.h>
-#include <Xm/Xm.h>
-#include "mmoira.h"
-
-
-extern char *user, *program_name;
-extern EntryForm *MoiraForms[];
-EntryForm *GetAndClearForm();
-
-char *user_states[] = { "0 - Registerable",
- "1 - Active",
- "2 - Half Registered",
- "3 - Deleted",
- "4 - Not registerable",
- "5 - Enrolled/Registerable",
- "6 - Enrolled/Not Registerable",
- "7 - Half Enrolled",
- NULL};
-char *nfs_states[] = { "0 - Not Allocated",
- "1 - Student",
- "2 - Faculty",
- "4 - Staff",
- "8 - Miscellaneous",
- NULL};
-
-
-static FixNameCase(form, field)
-EntryForm *form;
-int field;
-{
- char fixname[128], buf[256];
-
- strcpy(fixname, stringval(form, field));
- FixCase(fixname);
- sprintf(buf, "You entered a name which does not follow the capitalization conventions.\nCorrect it to \"%s\"?", fixname);
- if (strcmp(fixname, stringval(form, field)) &&
- AskQuestion(buf, "fixcase"))
- StoreField(form, field, fixname);
-}
-
-
-get_members(argc, argv, sq)
-int argc;
-char **argv;
-struct save_queue *sq;
-{
- char buf[256];
-
- sprintf(buf, "%s (%s)", argv[0], argv[1]);
- sq_save_data(sq, strsave(buf));
- return(MR_CONT);
-}
-
-
-/* Deal with AFS cell names */
-
-char *canonicalize_cell(c)
-char *c;
-{
- struct stat stbuf;
- char path[512];
- int count;
-
- c = strtrim(c);
- sprintf(path, "/afs/%s", c);
- if (lstat(path, &stbuf) || !stbuf.st_mode&S_IFLNK)
- return(c);
- count = readlink(path, path, sizeof(path));
- if (count < 1) return(c);
- path[count] = 0;
- free(c);
- return(strsave(path));
-}
-
-
-int GetAliasValue(argc, argv, retval)
-int argc;
-char **argv;
-char **retval;
-{
- *retval = strsave(argv[2]);
- return(MR_CONT);
-}
-
-
-static int GetArgv(argc, argv, info)
-int argc;
-char **argv;
-char ***info;
-{
- int i;
-
- *info = (char **)malloc((argc + 1) * sizeof(char *));
- for (i = 0; i < argc; i++)
- (*info)[i] = strsave(argv[i]);
- (*info)[i] = NULL;
- return(MR_ABORT);
-}
-
-
-MoiraValueChanged(f, prompt)
-EntryForm *f;
-UserPrompt *prompt;
-{
- char buf[1024];
- char *argv[5], *p, **info;
- int i, size, field;
- struct save_queue *sq, *s;
-#define maybechange(f, n, v) {if (f->inputlines[n]->insensitive != v) { f->inputlines[n]->insensitive=v; f->inputlines[n]->changed = True; }}
-
- for (field = 0; f->inputlines[field]; field++)
- if (prompt == f->inputlines[field]) break;
-
- switch (f->menu->operation) {
- case MM_ADD_LIST:
- case MM_MOD_LIST:
- if (field == L_GROUP)
- maybechange(f, L_GID, !boolval(f, L_GROUP));
- if (field == L_ACE_TYPE) {
- if (!strcmp(stringval(f, L_ACE_TYPE), "NONE"))
- maybechange(f, L_ACE_NAME, True)
- else
- maybechange(f, L_ACE_NAME, False)
- }
- break;
- case MM_ADD_FILSYS:
- case MM_MOD_FILSYS:
- if (field == FS_TYPE &&
- (!strcmp(stringval(f, FS_TYPE), "FSGROUP") ||
- !strcmp(stringval(f, FS_TYPE), "MUL") ||
- !strcmp(stringval(f, FS_TYPE), "ERR"))) {
- maybechange(f, FS_MACHINE+1, True);
- maybechange(f, FS_PACK+1, True);
- maybechange(f, FS_M_POINT+1, True);
- maybechange(f, FS_ACCESS+1, True);
- maybechange(f, FS_CREATE+1, True);
- } else if (field == FS_TYPE &&
- (!strcmp(stringval(f, FS_TYPE), "NFS") ||
- !strcmp(stringval(f, FS_TYPE), "AFS") ||
- !strcmp(stringval(f, FS_TYPE), "RVD"))) {
- maybechange(f, FS_MACHINE+1, False);
- maybechange(f, FS_PACK+1, False);
- maybechange(f, FS_M_POINT+1, False);
- maybechange(f, FS_ACCESS+1, False);
- maybechange(f, FS_CREATE+1, False);
- }
- if (field == FS_NAME && !strcmp(stringval(f, FS_M_POINT+1), "/mit/")) {
- sprintf(buf, "/mit/%s", stringval(f, FS_NAME));
- StoreField(f, FS_M_POINT+1, buf);
- }
- if (field == FS_MACHINE+1 && !strcmp(stringval(f, FS_TYPE), "AFS")) {
- p = strsave(stringval(f, FS_MACHINE+1));
- p = canonicalize_cell(p);
- lowercase(p);
- StoreField(f, FS_MACHINE+1, p);
- free(p);
- }
- if (field == FS_MACHINE+1 && (!strcmp(stringval(f, FS_TYPE), "NFS") ||
- !strcmp(stringval(f, FS_TYPE), "RVD"))) {
- StoreHost(f, FS_MACHINE+1, &p);
- }
- if (!strcmp(stringval(f, FS_TYPE), "AFS") &&
- *stringval(f, FS_NAME) &&
- *stringval(f, FS_MACHINE+1) &&
- *stringval(f, /*FS_L_TYPE*/FS_TYPE+1)) {
- char *path;
- int depth;
-
- sprintf(buf, "%s:%s", stringval(f, FS_MACHINE+1),
- stringval(f, FS_TYPE+1));
- argv[0] = buf;
- argv[1] = "AFSPATH";
- argv[2] = "*";
- path = "???";
- i = MoiraQuery("get_alias", 3, argv, GetAliasValue, &path);
- if (i == MR_SUCCESS) {
- p = strchr(path, ':');
- if (p) {
- *p = 0;
- depth = atoi(++p);
- } else depth = 0;
- sprintf(buf, "/afs/%s/%s", stringval(f, FS_MACHINE+1), path);
- if (depth >= 0) {
- for (p=stringval(f, FS_NAME);
- *p && (p - stringval(f, FS_NAME)) < depth;
- p++) {
- if (islower(*p)) {
- strcat(buf, "/x");
- buf[strlen(buf)-1] = *p;
- } else {
- sprintf(buf, "/afs/%s/%s/other",
- stringval(f, FS_MACHINE+1), path);
- break;
- }
- }
- } else if (depth = -1) {
- if (isdigit(stringval(f, FS_NAME)[0])) {
- strcat(buf, "/");
- depth = strlen(buf);
- for (p = stringval(f, FS_NAME);
- *p && isdigit(*p);
- p++) {
- buf[depth++] = *p;
- buf[depth] = 0;
- }
- } else
- strcat(buf, "/other");
- } else {
- /* no default */
- }
- strcat(buf, "/");
- strcat(buf, stringval(f, FS_NAME));
- free(path);
- } else {
- p = strsave(stringval(f, FS_TYPE+1));
- sprintf(buf, "/afs/%s/%s/%s", stringval(f, FS_MACHINE+1),
- lowercase(p), stringval(f, FS_NAME));
- free(p);
- }
- StoreField(f, FS_PACK+1, buf);
- }
- break;
- case MM_SET_POBOX:
- if (!strcmp(stringval(f, PO_TYPE), "POP")) {
- maybechange(f, 2, True);
- maybechange(f, 3, False);
- } else if (!strcmp(stringval(f, PO_TYPE), "SMTP")) {
- maybechange(f, 2, False);
- maybechange(f, 3, True);
- } else if (!strcmp(stringval(f, PO_TYPE), "NONE")) {
- maybechange(f, 2, True);
- maybechange(f, 3, True);
- }
- break;
- case MM_ADD_QUOTA:
- case MM_MOD_QUOTA:
- if (field == Q_FILESYS) {
- argv[0] = stringval(f, 0);
- i = MoiraQuery("get_filesys_by_label", 1, argv, GetArgv, &info);
- if (i == MR_SUCCESS) {
- if (!strcmp(info[FS_TYPE], "AFS")) {
- StoreField(f, 1, "ANY");
- } else if (!strcmp(info[FS_TYPE], "NFS")) {
- argv[0] = strsave(info[FS_MACHINE]);
- argv[1] = strsave(info[FS_PACK]);
- p = strrchr(argv[1], '/');
- if (p) *p = 0;
- for (i = 0; info[i]; i++) free(info[i]);
- free(info);
- i = MoiraQuery("get_nfsphys", 2, argv, GetArgv, &info);
- if (i == MR_SUCCESS) {
- i = atoi(info[NFS_STATUS]);
- if (i & MR_FS_GROUPQUOTA)
- StoreField(f, 1, "GROUP");
- else
- StoreField(f, 1, "USER");
- for (i = 0; info[i]; i++) free(info[i]);
- free(info);
- }
- }
- }
- }
- if (!strcmp(stringval(f, Q_TYPE), "ANY"))
- maybechange(f, Q_NAME, True)
- else
- maybechange(f, Q_NAME, False)
- break;
- case MM_ADD_ZEPHYR:
- case MM_MOD_ZEPHYR:
- if (!strcmp(stringval(f, ZA_XMT_TYPE), "NONE"))
- maybechange(f, ZA_XMT_ID, True)
- else
- maybechange(f, ZA_XMT_ID, False)
- if (!strcmp(stringval(f, ZA_SUB_TYPE), "NONE"))
- maybechange(f, ZA_SUB_ID, True)
- else
- maybechange(f, ZA_SUB_ID, False)
- if (!strcmp(stringval(f, ZA_IWS_TYPE), "NONE"))
- maybechange(f, ZA_IWS_ID, True)
- else
- maybechange(f, ZA_IWS_ID, False)
- if (!strcmp(stringval(f, ZA_IUI_TYPE), "NONE"))
- maybechange(f, ZA_IUI_ID, True)
- else
- maybechange(f, ZA_IUI_ID, False)
- break;
- case MM_ADD_USER:
- FixNameCase(f, U_LAST);
- FixNameCase(f, U_FIRST);
- FixNameCase(f, U_MIDDLE);
- break;
- case MM_SHOW_USER:
- FixNameCase(f, 1);
- FixNameCase(f, 2);
- break;
- case MM_ADD_FSGROUP:
- argv[0] = stringval(f, 0);
- sq = sq_create();
- i = MoiraQuery("get_fsgroup_members", 1, argv, get_members, (char *)sq);
- if (i) {
- com_err(program_name, i, " retrieving filesystem group members");
- break;
- }
- size = 1;
- for (s = sq->q_next; s->q_next != sq; s = s->q_next)
- size++;
- if (f->inputlines[2]->keywords)
- free(f->inputlines[2]->keywords);
- f->inputlines[2]->keywords = (char **)malloc(sizeof(char *)*(size+2));
- if (f->inputlines[2]->keywords == NULL) {
- display_error("Out of memory while fetching members");
- return;
- }
- f->inputlines[2]->keywords[0] = "[First]";
- for (i = 0; i < size; i++)
- sq_get_data(sq, &f->inputlines[2]->keywords[i+1]);
- f->inputlines[2]->keywords[i+1] = NULL;
- f->inputlines[2]->changed = 1;
- sq_destroy(sq);
- RemakeRadioField(f, 2);
- break;
- case MM_DEL_FSGROUP:
- argv[0] = stringval(f, 0);
- sq = sq_create();
- i = MoiraQuery("get_fsgroup_members", 1, argv, get_members, (char *)sq);
- if (i) {
- com_err(program_name, i, " retrieving filesystem group members");
- break;
- }
- size = 1;
- for (s = sq->q_next; s->q_next != sq; s = s->q_next)
- size++;
- if (f->inputlines[1]->keywords)
- free(f->inputlines[1]->keywords);
- f->inputlines[1]->keywords = (char **)malloc(sizeof(char *)*(size+1));
- if (f->inputlines[1]->keywords == NULL) {
- display_error("Out of memory while fetching members");
- return;
- }
- for (i = 0; i < size; i++)
- sq_get_data(sq, &f->inputlines[1]->keywords[i]);
- f->inputlines[1]->keywords[i] = NULL;
- f->inputlines[1]->changed = 1;
- sq_destroy(sq);
- RemakeRadioField(f, 1);
- break;
- case MM_MOV_FSGROUP:
- argv[0] = stringval(f, 0);
- sq = sq_create();
- i = MoiraQuery("get_fsgroup_members", 1, argv, get_members, (char *)sq);
- if (i) {
- com_err(program_name, i, " retrieving filesystem group members");
- break;
- }
- size = 1;
- for (s = sq->q_next; s->q_next != sq; s = s->q_next)
- size++;
- if (f->inputlines[1]->keywords)
- free(f->inputlines[1]->keywords);
- f->inputlines[1]->keywords = (char **)malloc(sizeof(char *)*(size+1));
- if (f->inputlines[1]->keywords == NULL) {
- display_error("Out of memory while fetching members");
- return;
- }
- if (f->inputlines[2]->keywords)
- free(f->inputlines[2]->keywords);
- f->inputlines[2]->keywords = (char **)malloc(sizeof(char *)*(size+2));
- if (f->inputlines[2]->keywords == NULL) {
- display_error("Out of memory while fetching members");
- return;
- }
- f->inputlines[2]->keywords[0] = "[First]";
- for (i = 0; i < size; i++) {
- sq_get_data(sq, &f->inputlines[1]->keywords[i]);
- f->inputlines[2]->keywords[i+1] = f->inputlines[1]->keywords[i];
- }
- f->inputlines[1]->keywords[i] = NULL;
- f->inputlines[2]->keywords[i+1] = NULL;
- f->inputlines[1]->changed = 1;
- f->inputlines[2]->changed = 1;
- sq_destroy(sq);
- RemakeRadioField(f, 1);
- RemakeRadioField(f, 2);
- break;
- default:
- return;
- }
- UpdateForm(f);
-}
-
-
-/* Called when a menu item is selected. */
-
-MoiraMenuRequest(menu)
-MenuItem *menu;
-{
- EntryForm *f;
-
- f = GetAndClearForm(menu->form);
- if (f == NULL) {
- if (!strcmp(menu->form, "0"))
- MoiraMenuComplete(menu);
- else
- display_error("Sorry, unable to process that request (no form registered).");
- return;
- }
-
- switch (menu->operation) {
- case MM_SHOW_USER:
- GetKeywords(f, 4, "class");
- f->inputlines[1]->valuechanged = MoiraValueChanged;
- f->inputlines[2]->valuechanged = MoiraValueChanged;
- break;
- case MM_ADD_USER:
- StoreField(f, U_NAME, UNIQUE_LOGIN);
- StoreField(f, U_UID, UNIQUE_UID);
- StoreField(f, U_SHELL, "/bin/csh");
- StoreField(f, U_STATE, user_states[US_NO_LOGIN_YET]);
- f->inputlines[U_STATE]->keywords = user_states;
- f->inputlines[U_LAST]->valuechanged = MoiraValueChanged;
- f->inputlines[U_FIRST]->valuechanged = MoiraValueChanged;
- f->inputlines[U_MIDDLE]->valuechanged = MoiraValueChanged;
- GetKeywords(f, U_CLASS, "class");
- break;
- case MM_SET_POBOX:
- GetKeywords(f, 1, "pobox");
- GetKeywords(f, 3, "poserver");
- f->inputlines[PO_TYPE]->valuechanged = MoiraValueChanged;
- break;
- case MM_ADD_FILSYS:
- StoreField(f, FS_TYPE, "AFS");
- StoreField(f, FS_M_POINT+1, "/mit/");
- StoreField(f, FS_MACHINE+1, "athena.mit.edu");
- StoreField(f, FS_ACCESS+1, "w");
- StoreField(f, FS_OWNER+1, user);
- StoreField(f, FS_OWNERS+1, user);
- boolval(f, FS_CREATE+1) = TRUE;
- GetKeywords(f, FS_TYPE, "filesys");
- GetKeywords(f, FS_ACCESS+1, "fs_access_AFS");
- GetKeywords(f, FS_TYPE+1, "lockertype");
- f->inputlines[FS_TYPE]->valuechanged = MoiraValueChanged;
- f->inputlines[FS_TYPE+1]->valuechanged = MoiraValueChanged;
- f->inputlines[FS_NAME]->valuechanged = MoiraValueChanged;
- f->inputlines[FS_MACHINE+1]->valuechanged = MoiraValueChanged;
- break;
- case MM_ADD_FSGROUP:
- if (f->inputlines[2]->keywords)
- free(f->inputlines[2]->keywords);
- f->inputlines[2]->keywords = (char **)malloc(sizeof(char*)*2);
- f->inputlines[2]->keywords[0] = "[First]";
- f->inputlines[2]->keywords[1] = NULL;
- f->inputlines[0]->valuechanged = MoiraValueChanged;
- break;
- case MM_DEL_FSGROUP:
- if (f->inputlines[1]->keywords)
- free(f->inputlines[1]->keywords);
- f->inputlines[1]->keywords = (char **)malloc(sizeof(char*)*2);
- f->inputlines[1]->keywords[0] = "[Placeholder]";
- f->inputlines[1]->keywords[1] = NULL;
- f->inputlines[0]->valuechanged = MoiraValueChanged;
- break;
- case MM_MOV_FSGROUP:
- if (f->inputlines[1]->keywords)
- free(f->inputlines[1]->keywords);
- f->inputlines[1]->keywords = (char **)malloc(sizeof(char*)*2);
- f->inputlines[1]->keywords[0] = "[Placeholder]";
- f->inputlines[1]->keywords[1] = NULL;
- if (f->inputlines[2]->keywords)
- free(f->inputlines[2]->keywords);
- f->inputlines[2]->keywords = (char **)malloc(sizeof(char*)*2);
- f->inputlines[2]->keywords[0] = "[First]";
- f->inputlines[2]->keywords[1] = NULL;
- f->inputlines[0]->valuechanged = MoiraValueChanged;
- break;
- case MM_ADD_NFS:
- StoreField(f, 1, "/u1/lockers");
- StoreField(f, 2, "/dev/");
- StoreField(f, 5, "0");
- StoreField(f, 6, "0");
- StoreField(f, 3, nfs_states[1]);
- f->inputlines[3]->keywords = nfs_states;
- break;
- case MM_ADD_QUOTA:
- case MM_DEL_QUOTA:
- case MM_MOD_QUOTA:
- GetKeywords(f, 1, "quota_type");
- f->inputlines[Q_FILESYS]->valuechanged = MoiraValueChanged;
- f->inputlines[Q_TYPE]->valuechanged = MoiraValueChanged;
- break;
- case MM_SHOW_ACE_USE:
- StoreField(f, 0, "USER");
- GetKeywords(f, 0, "ace_type");
- break;
- case MM_ADD_LIST:
- boolval(f, L_ACTIVE) = TRUE;
- boolval(f, L_MAILLIST) = TRUE;
- StoreField(f, L_GID, UNIQUE_GID);
- StoreField(f, L_ACE_TYPE, "USER");
- GetKeywords(f, L_ACE_TYPE, "ace_type");
- f->inputlines[L_GID]->insensitive = True;
- f->inputlines[L_GROUP]->valuechanged = MoiraValueChanged;
- f->inputlines[L_ACE_TYPE]->valuechanged = MoiraValueChanged;
- break;
- case MM_SHOW_MEMBERS:
- GetKeywords(f, 1, "member");
- break;
- case MM_ADD_MEMBER:
- case MM_DEL_MEMBER:
- GetKeywords(f, 1, "member");
- break;
- case MM_DEL_ALL_MEMBER:
- boolval(f, 2) = TRUE;
- GetKeywords(f, 0, "member");
- break;
- case MM_ADD_MACH:
- GetKeywords(f, 1, "mac_type");
- break;
- case MM_ADD_PCAP:
- StoreField(f, PCAP_SPOOL_DIR, "/usr/spool/printer/");
- boolval(f, PCAP_AUTH) = TRUE;
- StoreField(f, PCAP_PRICE, "10");
- break;
- case MM_ADD_SERVICE:
- StoreField(f, SVC_INTERVAL, "1430");
- StoreField(f, SVC_TARGET, "/tmp/");
- StoreField(f, SVC_SCRIPT, "/moira/bin/");
- StoreField(f, 4, "UNIQUE");
- StoreField(f, 6, "NONE");
- GetKeywords(f, 4, "service");
- GetKeywords(f, 6, "ace_type");
- break;
- case MM_SHOW_ALIAS:
- StoreField(f, 2, "*");
- GetKeywords(f, 1, "alias");
- break;
- case MM_ADD_ZEPHYR:
- GetKeywords(f, 1, "ace_type");
- GetKeywords(f, 3, "ace_type");
- GetKeywords(f, 5, "ace_type");
- GetKeywords(f, 7, "ace_type");
- f->inputlines[ZA_XMT_TYPE]->valuechanged = MoiraValueChanged;
- f->inputlines[ZA_SUB_TYPE]->valuechanged = MoiraValueChanged;
- f->inputlines[ZA_IWS_TYPE]->valuechanged = MoiraValueChanged;
- f->inputlines[ZA_IUI_TYPE]->valuechanged = MoiraValueChanged;
- break;
- }
-
- f->menu = menu;
- if (tty)
- TtyForm(f);
- else
- DisplayForm(f);
-}
-
-
-/* Find a form by name. Returns a pointer to the form or NULL on error. */
-
-EntryForm *GetForm(name)
-char *name;
-{
- EntryForm **fp;
-
- for (fp = MoiraForms; *fp; fp++)
- if (!strcmp((*fp)->formname, name))
- break;
- return(*fp);
-}
-
-
-/* Find a form by name and clear all of its fields. Returns a pointer
- * to the form or NULL on error.
- */
-
-EntryForm *GetAndClearForm(name)
-char *name;
-{
- EntryForm **fp;
- UserPrompt *p, **pp;
- static BottomButton **buttons = NULL;
- int MoiraFormComplete(), MoiraFormApply();
- int button_callback(), help_form_callback();
-
- for (fp = MoiraForms; *fp; fp++)
- if (!strcmp((*fp)->formname, name))
- break;
- if (*fp == (EntryForm *)NULL)
- return(NULL);
-
- for (pp = (*fp)->inputlines; p = *pp; pp++) {
- switch (p->type) {
- case FT_STRING:
- case FT_KEYWORD:
- if (p->returnvalue.stringvalue)
- free(p->returnvalue.stringvalue);
- p->returnvalue.stringvalue = (char *)malloc(MAXFIELDSIZE);
- if (p->returnvalue.stringvalue == NULL) {
- fprintf(stderr, "Moira: out of memory\n");
- return(NULL);
- }
- *(p->returnvalue.stringvalue) = '\0';
- break;
- case FT_BOOLEAN:
- p->returnvalue.booleanvalue = False;
- break;
- case FT_NUMBER:
- p->returnvalue.integervalue = 0;
- break;
- }
- }
- if (!tty && buttons == NULL) {
- buttons = (BottomButton **)malloc(5 * sizeof(BottomButton *));
- buttons[0] = (BottomButton *)malloc(sizeof(BottomButton));
- buttons[0]->label = "OK";
- buttons[0]->returnfunction = MoiraFormComplete;
- buttons[1] = (BottomButton *)malloc(sizeof(BottomButton));
- buttons[1]->label = "Apply";
- buttons[1]->returnfunction = MoiraFormApply;
- buttons[2] = (BottomButton *)malloc(sizeof(BottomButton));
- buttons[2]->label = "Cancel";
- buttons[2]->returnfunction = button_callback;
- buttons[3] = (BottomButton *)malloc(sizeof(BottomButton));
- buttons[3]->label = "Help";
- buttons[3]->returnfunction = help_form_callback;
- buttons[4] = NULL;
- }
- (*fp)->buttons = buttons;
- (*fp)->extrastuff = NULL;
- return(*fp);
-}
-
-
-/* Store a string into a given field in a form. */
-
-StoreField(form, field, value)
-EntryForm *form;
-int field;
-char *value;
-{
- strncpy(form->inputlines[field]->returnvalue.stringvalue,
- value, MAXFIELDSIZE);
-}
-
-
-char *StringValue(form, field)
-EntryForm *form;
-int field;
-{
- switch (form->inputlines[field]->type) {
- case FT_STRING:
- case FT_KEYWORD:
- return(stringval(form, field));
- case FT_BOOLEAN:
- return(boolval(form, field) ? "1" : "0");
- }
-}
-
-
-StoreHost(form, field, dest)
-EntryForm *form;
-int field;
-char **dest;
-{
- char *s;
-
- s = strsave(stringval(form, field));
- s = canonicalize_hostname(s);
- StoreField(form, field, s);
- form->inputlines[field]->changed = True;
- UpdateForm(form);
- free(s);
- *dest = stringval(form, field);
-}
-
-
-/* Helper routine for GetKeywords() */
-
-static get_alias(argc, argv, sq)
-int argc;
-char **argv;
-struct save_queue *sq;
-{
- sq_save_data(sq, strsave(argv[2]));
-#ifdef DEBUG
- printf("found keyword %s\n", argv[2]);
-#endif
- return(MR_CONT);
-}
-
-static get_sloc(argc, argv, sq)
-int argc;
-char **argv;
-struct save_queue *sq;
-{
- sq_save_data(sq, strsave(argv[1]));
-#ifdef DEBUG
- printf("found sloc %s\n", argv[1]);
-#endif
- return(MR_CONT);
-}
-
-
-/* Retrieve possible keyword values from Moira and store them in the specified
- * field of the form. Returns 0 if successful, -1 if not.
- */
-
-static struct save_queue *cache = NULL;
-struct cache_elem { char *name; char **values; };
-
-int GetKeywords(form, field, name)
-EntryForm *form;
-int field;
-char *name;
-{
- struct save_queue *sq, *s;
- struct cache_elem *ce;
- int i, size, stat;
- char *argv[4];
-
- /* init cache */
- if (cache == NULL)
- cache = sq_create();
- cache->q_lastget = NULL;
-
- if (!strcmp(name, "fsgroup")) {
- form->inputlines[field]->keywords = NULL;
- }
-
- /* look through cache */
- while (sq_get_data(cache, &ce))
- if (!strcmp(ce->name, name)) {
- form->inputlines[field]->keywords = ce->values;
- return(0);
- }
-
- /* not in cache, do query */
- sq = sq_create();
- if (!strcmp(name, "poserver")) {
- argv[0] = "POP";
- stat = MoiraQuery("get_server_locations", 1, argv, get_sloc,
- (char *)sq);
- if (stat) {
- com_err(program_name, stat, "retrieving service locations");
- return(-1);
- }
- } else {
- argv[0] = name;
- argv[1] = "TYPE";
- argv[2] = "*";
- stat = MoiraQuery("get_alias", 3, argv, get_alias, (char *)sq);
- if (stat) {
- com_err(program_name, stat, "retrieving keyword values");
- return(-1);
- }
- }
-
- size = 1;
- for (s = sq->q_next; s->q_next != sq; s = s->q_next)
- size++;
-#ifdef DEBUG
- printf("Found %d keywords of type %s\n", size, name);
-#endif
-
- /* transform query data into proper malloc'ed structure */
- ce = (struct cache_elem *) malloc(sizeof(struct cache_elem));
- if (ce == NULL) {
- display_error("Out of memory while fetching keywords");
- return(-1);
- }
- ce->name = name;
- ce->values = (char **) malloc(sizeof(char *) * (size + 1));
- if (ce->values == NULL) {
- display_error("Out of memory while fetching keywords");
- return(-1);
- }
- for (i = 0; i < size; i++)
- sq_get_data(sq, &(ce->values[i]));
- ce->values[i] = NULL;
- sq_destroy(sq);
-
- /* put it in the cache */
- sq_save_data(cache, ce);
-
- /* and return answer */
- form->inputlines[field]->keywords = ce->values;
- return(0);
-}
-
-CacheNewValue(form, field, name, value)
-EntryForm *form;
-int field;
-char *name;
-char *value;
-{
- struct save_queue *sq;
- struct cache_elem *ce;
- int size;
-
- /* init cache */
- if (cache == NULL)
- cache = sq_create();
- cache->q_lastget = NULL;
-
- /* find entry in cache */
- while (sq_get_data(cache, &ce))
- if (!strcmp(ce->name, name))
- break;
-
- /* get its size */
- for (size = 0; ce->values[size]; size++);
-
- /* add new keyword */
- ce->values = (char **)realloc(ce->values, sizeof(char *) * (size + 2));
- ce->values[size] = strsave(value);
- ce->values[size + 1] = NULL;
-
-#ifdef DEBUG
- printf("CacheNewValue(%x, %d, %s, %s)\n", form, field, name, value);
- printf(" form is %x (%s)\n", form, form->formname);
- printf(" field is %d (%s)\n", field, form->inputlines[field]->prompt);
- printf(" keywords: ");
- for (size = 0; ce->values[size]; size++) printf("%s ", ce->values[size]);
- printf("\n");
-#endif /* DEBUG */
-
- /* new update form */
- form->inputlines[field]->keywords = ce->values;
- if (!tty) RemakeRadioField(form, field);
-}
+++ /dev/null
-# $Header$
-
-BEGIN { numfields = 0; numforms = 0; orfield = 0;
- printf("/* This file is machine generated, do not edit. */");
- printf("\n#include <Xm/Text.h>\n");
- printf("#include \"mmoira.h\"\n\n");
- }
-
-/^;/ { next; }
-NF == 0 { next; }
-NF == 1 && $1 == "or" { orfield = 1; next; }
-
-$1 == "{" { formname = sprintf("form%d", numforms);
- formrealname = $2;
- numforms++;
- instructions = $3;
- for (i = 4; i <= NF; i++)
- instructions = sprintf("%s %s", instructions, $i);
- next;
- }
-
-$1 == "}" { printf("static UserPrompt *%s_fields[] = {\n", formname);
- for (i = 0; i < numfields; i++)
- printf("\t&%s_fld%d,\n", formname, i);
- printf("\t(UserPrompt *)NULL\n};\n");
- printf("static EntryForm %s = {\n\t\"%s\",\n", \
- formname, formrealname);
- printf("\t\"%s\",\n\t%s_fields\n};\n", \
- instructions, formname);
- numfields = 0;
- next
- }
-
-$NF == "s" || $NF == "S" \
- { printf("static UserPrompt %s_fld%d = { \"", \
- formname, numfields);
- for (i = 1; i < NF; i++) printf("%s ", $i);
- if (orfield) {
- printf("\", FT_STRING, True };\n");
- orfield = 0;
- } else {
- printf("\", FT_STRING, False };\n");
- }
- numfields++;
- next
- }
-
-$NF == "b" || $NF == "B" \
- { printf("static UserPrompt %s_fld%d = { \"", \
- formname, numfields);
- for (i = 1; i < NF; i++) printf("%s ", $i);
- if (orfield) {
- printf("\", FT_BOOLEAN, True };\n");
- orfield = 0;
- } else {
- printf("\", FT_BOOLEAN, False };\n");
- }
- numfields++;
- next
- }
-
-$NF == "k" || $NF == "K" \
- { printf("static UserPrompt %s_fld%d = { \"", \
- formname, numfields);
- for (i = 1; i < NF; i++) printf("%s ", $i);
- if (orfield) {
- printf("\", FT_KEYWORD, True };\n");
- orfield = 0;
- } else {
- printf("\", FT_KEYWORD, False };\n");
- }
- numfields++;
- next
- }
-
- { printf("forms syntax error on line %d of file %s:\n%s\n", \
- NR, FILENAME, $0);
- exit 1
- }
-
-END {
- printf("EntryForm *MoiraForms[] = {\n");
- for (i = 0; i < numforms; i++)
- printf("\t&form%d,\n", i);
- printf("\t(EntryForm *)NULL,\n};\n");
- }
+++ /dev/null
-; $Header$
-;
-
-; { FORM_NAME INSTRUCTION FIELD
-; LABEL FIELD TYPE (S=string, K=keyword, B=TRUE/FALSE)
-; etc
-; }
-
-{ show_user Enter the login name, real name, uid or class to select one or more users.
- Login name s
- or
- First name s
- Last name s
- or
- Unix UID s
- or
- Class K
-}
-{ add_user Add a new user to the database.
- Login name S
- Unix UID s
- Shell s
- Last name s
- First name s
- Middle name s
- Account status K
- ID number s
- Class|class K
- Comments s
- Extra password b
-}
-{ mod_user Modify a user in the database.
- New login name S
- Unix UID s
- Shell s
- Last name s
- First name s
- Middle name s
- Account status K
- ID number s
- Class|class K
- Comments s
- Extra password b
-}
-{ register_user Register a user with an active account. Specify user by real name or uid.
- First name s
- Last name s
- or
- Unix UID s
- Desired login name s
-}
-; deactivate/expunge/show finger
-{ select_user Enter the login name to select a user to modify.
- Login s
-}
-{ deactivate_user Enter the login name to select a user to deactivate.
- Login s
-}
-{ expunge_user Enter the login name to select a user to expunge.
- Login s
-}
-{ show_finger Enter the login name to select which user's finger information to display.
- Login s
-}
-{ select_finger Enter the login name to select which user's finger information to modify.
- Login s
-}
-
-{ mod_finger Update the info for the user.
- Real Name s
- Nickname s
- Home Address S
- Home Phone S
- Office Address S
- Office Phone S
- Department S
- Affiliation S
-}
-
-{ select_pobox Enter the login name of the user whose P. O. Box you want to examine.
- Login s
-}
-{ set_pobox Enter the new P. O. Box information.
- Login s
- Type|pobox K
- SMTP Address s
- or
- POP server K
-}
-{ reset_pobox Enter the new user whose mailforwarding should be turned off.
- Login s
-}
-{ del_pobox Enter the login name of the user whose P. O. Box you want to delete.
- Login s
-}
-
-{ show_krbmap Enter the username or principal of the Kerberos mapping to examine.
- Login s
- or
- Principal s
-}
-{ add_krbmap Enter the new Kerberos mapping.
- Login s
- Principal s
-}
-{ del_krbmap Enter the Kerberos mapping to delete.
- Login s
- Principal s
-}
-
-{ show_filsys Enter the name, machine, owning group, or path to see one or more filesystems.
- Name s
- or
- Machine s
- Partition s
- or
- Group s
- or
- Path s
-}
-; add/modify
-{ add_filsys Enter the new filesystem information.
- Name s
- Type|filesys K
- Lockertype|lockertype K
- Machine/Cell s
- Remote name s
- Mountpoint s
- Access mode|fs_access_NFS K
- Comments s
- Owner s
- Owners s
- Propagate changes to fileserver? B
-}
-{ mod_filsys Update the filesystem information.
- Name s
- Type|filesys K
- Lockertype|lockertype K
- Machine/Cell s
- Remote name s
- Mountpoint s
- Access mode|fs_access_NFS K
- Comments s
- Owner s
- Owners s
- Automatically create on fileserver? B
-}
-{ select_filsys Enter the name of the filesystem to modify.
- Name s
-}
-{ del_filsys Enter the name of the filesystem to delete.
- Name s
-}
-{ show_fsgroup Enter the name of the filesystem group to show.
- Name s
-}
-{ add_fsgroup Specify the filesystem for the filesystem group and where it goes in sort order.
- Filesystem group name s
- Filesystem name s
- Select filesystem to insert after in sort order k
-}
-{ order_fsgroup Specify the filesystem in the filesystem group and where it should go in sort order.
- Filesystem group name s
- Filesystem to move k
- Select filesystem to insert after in sort order k
-}
-{ del_fsgroup Specify the filesystem to remove from the filesystem group.
- Filesystem group name s
- Filesystem to delete k
-}
-{ show_fs_alias Specify the alias or real name of the filesystem alias to show.
- Real filesystem name s
- or
- Aliased name s
-}
-{ add_fs_alias Specify the filesystem alias to be added.
- Real filesystem name s
- Aliased name s
-}
-{ del_fs_alias Specify the filesystem alias to be deleted.
- Real filesystem name s
- Aliased name s
-}
-
-
-{ show_nfs Specify the machine (and optionally the partition) to be examined.
- Machine s
- or
- Partition s
-}
-{ select_nfs Specify the machine (and optionally the partition) to be modified.
- Machine s
- or
- Partition s
-}
-{ add_nfs Enter the information for the new NFS partition.
- Machine s
- Partition s
- Device s
- Status K
- Group quota? B
- Allocation (Kbytes) s
- Size (Kbytes) s
-}
-{ mod_nfs Update the information for the NFS partition.
- Machine s
- Partition s
- Device s
- Status K
- Group quota? B
- Allocation (Kbytes) s
- Size (Kbytes) s
-}
-{ del_nfs Specify the NFS partition to delete.
- Machine s
- Partition s
-}
-
-
-{ show_quota Specify the filesystem and/or user/group of the desired quota.
- Filesystem s
- or
- User s
- or
- Group s
-}
-{ add_quota Enter the quota information.
- Filesystem s
- Quota type|quota_type K
- User/group s
- Quota (Kbytes) s
-}
-{ mod_quota Update the quota information.
- Filesystem s
- Quota type|quota_type K
- User/group s
- Quota (Kbytes) s
-}
-{ del_quota Specify the quota to delete.
- Filesystem s
- Quota type|quota_type K
- User/group s
-}
-;quota show default
-{ set_dquota Specify the default quota for new accounts.
- Value (Kbytes) s
-}
-
-
-{ show_list Specify the name of the list to examine.
- Name s
-}
-;list show all public
-{ show_ace_use Specify the user or list to see what they can administer.
- Access Control Type|ace_type K
- ACE name s
- Search recursively? B
-}
-{ add_list Enter the information for the new list.
- Name s
- Active B
- Public B
- Hidden B
- Maillist B
- Group B
- Unix GID s
- Owner type|ace_type K
- Owner name s
- Description s
-}
-{ mod_list Update the list information.
- Name s
- Active B
- Public B
- Hidden B
- Maillist B
- Group B
- Unix GID s
- Owner type|ace_type K
- Owner name s
- Description s
-}
-{ select_list Spelect a list to modify by entering its name.
- Name s
-}
-{ del_list Spelect a list to delete by entering its name.
- Name s
-}
-{ show_members Specify the list name or member type and name to see memberships.
- List name s
- or
- Member type K
- Member name s
- Recursive search? B
-}
-{ add_member Enter the information to add a member to a list.
- List name s
- Member type|member K
- Member name s
-}
-{ del_member Enter the information to delete a member from a list.
- List name s
- Member type K
- Member name s
-}
-{ del_all_member Enter a member to remove from all lists.
- Member type K
- Member name s
- Prompt for each deletion? B
-}
-
-
-; show
-{ show_machine Specify the machine to display.
- Name s
-}
-{ add_machine Enter the information about the machine.
- Name s
- Type|mac_type K
-}
-{ select_machine Specify the machine to update.
- Name s
-}
-{ mod_machine Update the information about the machine.
- Name s
- Type|mac_type K
-}
-{ del_machine Select a machine to delete.
- Name s
-}
-
-
-; show
-{ show_cluster Specify the cluster to display.
- Name s
-}
-{ add_cluster Enter the information about the new cluster.
- Name s
- Description s
- Location s
-}
-{ mod_cluster Update the information about the cluster.
- Name s
- Description s
- Location s
-}
-{ select_cluster Select a cluster to modify.
- Name s
-}
-{ del_cluster Select a cluster to delete.
- Name s
-}
-{ mcmap Enter a machine or cluster to see its mappings.
- Machine s
- Cluster s
-}
-{ add_mcmap Enter the machine and cluster to add it to.
- Machine s
- Cluster s
-}
-{ del_mcmap Enter the machine and cluster to remove it from.
- Machine s
- Cluster s
-}
-{ show_cldata Enter the cluster name or data label of the desired cluster data.
- Cluster s
- Label s
-}
-{ add_cldata Enter the cluster information.
- Cluster s
- Label s
- Value s
-}
-{ del_cldata Specify the cluster information to be deleted.
- Cluster s
- Label s
- Value s
-}
-
-
-{ show_printer Specify the desired printer to display.
- Name s
-}
-{ del_printer Specify the desired printer.
- Name s
-}
-{ add_printer Enter the new printer information.
- Name s
- Spooling host s
- Spool directory s
- Remote name s
- Quota server s
- Authenticate B
- Price s
- Comments s
-}
-{ mod_printer Update the printer information.
- Name s
- Spooling host s
- Spool directory s
- Remote name s
- Quota server s
- Authenticate B
- Price s
- Comments s
-}
-{ select_printer Specify the desired printer to modify.
- Name s
-}
-
-
-;server updates show
-{ dcm_enable Set Data Control Manager status.
- Enable updates? B
-}
-{ trigger_dcm Start a Data Control Manager batch update now.
- Are You Sure? B
-}
-
-;service show/delete/clear error/reset
-{ show_service Enter the service name to examine.
- Name s
-}
-{ add_service Enter the service information.
- Service name s
- Interval (minutes) s
- Destination file s
- Script s
- Type|service K
- Enable B
- Owner type|ace_type K
- Owner name s
-}
-{ mod_service Update the service information.
- Service name s
- Interval (minutes) s
- Destination file s
- Script s
- Type|service K
- Enable B
- Owner type|ace_type K
- Owner name s
-}
-{ select_service Enter the name of the service to change.
- Name s
-}
-; show/delete/clear error/reset state
-{ show_host Enter the host and or service name of the service/host tuple to examine.
- Service name s
- Host name s
-}
-{ add_host Enter the service/host tuple information.
- Service s
- Host name s
- Enable B
- Value1 s
- Value2 s
- Value3 s
-}
-{ mod_host Update the service/host tuple information.
- Service s
- Host name s
- Enable B
- Value1 s
- Value2 s
- Value3 s
-}
-{ select_host Enter the host and service name to select a service/host tuple.
- Service name s
- Host name s
-}
-
-
-;misc show stats
-;misc show clients
-{ show_value Enter the name of the variable to display.
- Variable name s
-}
-{ show_alias Enter the alias name, type, or value to display.
- Name s
- Type|alias K
- Value s
-}
-
-
-; show/delete
-{ show_zephyr Enter the name of the zephyr class to examine.
- Class s
-}
-; add/modify
-{ add_zephyr Enter the zephyr class access information.
- Class s
- XMT type|ace_type K
- XMT name s
- SUB type|ace_type K
- SUB name s
- IWS type|ace_type K
- IWS name s
- IUI type|ace_type K
- IUI name s
-}
-{ select_zephyr Select a zephyr class by name.
- Class s
-}
-
-
-{ save_log Save your log to a file.
- Filename s
-}
-; for adding new keyword values
-{ add_new_value Enter the new value for this keyword.
- Keyword s
-}
+++ /dev/null
-/* $Header$ */
-
-#include <stdio.h>
-#include <string.h>
-#include <X11/StringDefs.h>
-#include <X11/IntrinsicP.h>
-#include <X11/Shell.h>
-#include <X11/Core.h>
-#include <X11/CoreP.h>
-#include <X11/CompositeP.h>
-#include <Xm/Xm.h>
-#include <Xm/BulletinB.h>
-#include <Xm/Label.h>
-#include <Xm/Text.h>
-#include <Xm/TextP.h>
-#include <Xm/PushB.h>
-#include <Xm/PushBG.h>
-#include <Xm/CascadeB.h>
-#include <Xm/ToggleB.h>
-#include <Xm/ToggleBG.h>
-#include <Xm/RowColumn.h>
-#include <Xm/Separator.h>
-#include <Xm/Traversal.h>
-#include "mmoira.h"
-
-static char rcsid[] = "$Header$";
-
-#ifndef MAX
-#define MAX(a,b) ((a > b) ? a : b)
-#endif
-#ifndef MIN
-#define MIN(a,b) ((a < b) ? a : b)
-#endif
-
-int hpad = 10;
-int vpad = 5;
-
-void manage_widget();
-Widget CreateForm();
-Widget CreateMenu();
-Widget BuildMenuTree();
-Widget MakeRadioField();
-int button_callback();
-void radio_callback();
-void string_callback();
-void boolean_callback();
-void menu_callback();
-void newvalue();
-void MoiraFocusOut();
-EntryForm *WidgetToForm();
-
-extern void UpdateForm();
-extern int PopupErrorMessage();
-extern void PopupHelpWindow();
-extern int AppendToLog();
-extern void MakeWatchCursor();
-extern void MakeNormalCursor();
-extern Widget SetupLogWidget();
-
-static XtActionsRec myactions[] = {
- { "MoiraFocusOut", MoiraFocusOut },
-};
-
-
-void
-manage_widget(w, widget, call_data)
-Widget w, widget;
-XmAnyCallbackStruct *call_data;
-{
- XtManageChild(widget);
-}
-
-int
-button_callback(w, client_data, call_data)
-Widget w;
-EntryForm *client_data;
-XmAnyCallbackStruct *call_data;
-{
- XtUnmanageChild(client_data->formpointer);
-}
-
-
-Widget
-BuildMenuTree(topW, spec)
-Widget topW;
-MenuItem *spec;
-{
- return (CreateMenu(topW, spec->submenu, XmHORIZONTAL));
-}
-
-/*
-** Read the specification and put up a menu to match...
-*/
-
-Widget
-CreateMenu(parent, spec, orientation)
-Widget parent;
-MenuItem **spec;
-int orientation;
-{
- Widget menuparent;
- MenuItem *curmenuitem;
- Widget childbutton, childmenu;
- Arg wargs[10];
- int n;
- XmString label; /* !@#$%^ compound string required */
-
- label = XmStringCreate( "Complete junk", XmSTRING_DEFAULT_CHARSET);
-
- n = 0;
- XtSetArg(wargs[n], XmNlabelString, label); n++;
-
- if (orientation == XmHORIZONTAL) {
- XtSetArg(wargs[n], XmNspacing, 5); n++;
- menuparent = XmCreateMenuBar( parent, "randommenu",
- wargs, n);
- XtManageChild(menuparent);
- }
- else
- menuparent = XmCreatePulldownMenu(parent, "randommenu",
- wargs, n);
-
- for ( curmenuitem = (*spec);
- curmenuitem;
- spec++, curmenuitem = (*spec)) {
-
-#ifdef DEBUG
- printf ("Making entry: %s\n", curmenuitem->label);
-#endif
- label = XmStringCreate( curmenuitem->label,
- XmSTRING_DEFAULT_CHARSET);
- n = 0;
- XtSetArg(wargs[n], XmNlabelString, label); n++;
- if (curmenuitem->accel) {
- XtSetArg(wargs[n], XmNmnemonic, *(curmenuitem->accel)); n++;
- }
-
- if (curmenuitem->submenu) {
-#ifdef DEBUG
- printf ("It has a submenu, which I'm recursing on...\n");
-#endif
- childmenu = CreateMenu( menuparent,
- curmenuitem->submenu,
- XmVERTICAL);
- XtSetArg(wargs[n], XmNsubMenuId, childmenu); n++;
-
- childbutton = XtCreateManagedWidget( "child",
- xmCascadeButtonWidgetClass,
- menuparent, wargs, n);
-
- }
-
- else {
- childbutton = XtCreateManagedWidget( "child",
- xmPushButtonGadgetClass,
- menuparent, wargs, n);
-
- XtAddCallback( childbutton,
- XmNactivateCallback,
- menu_callback, curmenuitem);
- }
- }
-
- return (menuparent);
-}
-
-/*
-** Read the specification and put up a form to match...
-*/
-
-Widget
-CreateForm(parent, spec)
-Widget parent;
-EntryForm *spec;
-{
- Widget bb;
- Arg wargs[10];
- int n;
- XmString label; /* compound string required */
- Dimension height_so_far = 0, width_so_far = 0;
- Dimension height, width;
- Widget titleW, instructionW;
- Position x, y;
- Widget shellparent;
-
- if (spec->formpointer) {
- UpdateForm(spec);
- return(spec->formpointer);
- }
-
- height_so_far = vpad;
-
-#define GETSIZE(foo) n = 0; \
- XtSetArg(wargs[n], XtNwidth, &width); n++; \
- XtSetArg(wargs[n], XtNheight, &height); n++; \
- XtGetValues (foo, wargs, n); \
-
-#define STORESIZE if (width > width_so_far) width_so_far = width;\
- height_so_far += height + vpad;
-
-
- n = 0;
- XtSetArg(wargs[n], XmNautoUnmanage, False); n++;
- bb = XmCreateBulletinBoardDialog(parent, spec->formname, wargs, n);
- MapWidgetToForm(bb, spec);
-
- spec->formpointer = bb;
-
-#ifdef FORMTITLES
- label = XmStringCreate(spec->formname, XmSTRING_DEFAULT_CHARSET);
- n = 0;
- XtSetArg(wargs[n], XmNlabelString, label); n++;
- XtSetArg(wargs[n], XtNx, 0); n++;
- XtSetArg(wargs[n], XtNy, 0); n++;
- titleW = XtCreateManagedWidget( "title",
- xmLabelWidgetClass,
- bb, wargs, n);
- GETSIZE(titleW);
- STORESIZE;
-#endif
-
- label = XmStringCreate(spec->instructions, XmSTRING_DEFAULT_CHARSET);
- n = 0;
- XtSetArg(wargs[n], XmNlabelString, label); n++;
- XtSetArg(wargs[n], XtNx, 0); n++;
- XtSetArg(wargs[n], XtNy, height_so_far); n++;
- instructionW = XtCreateManagedWidget( "instructions",
- xmLabelWidgetClass,
- bb, wargs, n);
- GETSIZE(instructionW);
- STORESIZE;
-
- height = height_so_far;
- width = width_so_far;
- MakeInputLines(bb, &height, &width, spec);
- STORESIZE;
-
- height = height_so_far;
- width = width_so_far;
- MakeButtons(bb, &height, &width, spec);
- STORESIZE;
-
-/*
-** Center the title of the form
-*/
-#ifdef FORMTITLES
- n = 0;
- XtSetArg(wargs[n], XtNwidth, &width); n++;
- XtGetValues (titleW, wargs, n);
-
- x = (width_so_far - width) / 2;
-
- n = 0;
- XtSetArg(wargs[n], XtNx, x); n++;
- XtSetValues (titleW, wargs, n);
-#endif
- n = 0;
- XtSetArg(wargs[n], XtNwidth, &width); n++;
- XtGetValues (instructionW, wargs, n);
-
- x = (width_so_far - width) / 2;
-
- n = 0;
- XtSetArg(wargs[n], XtNx, x); n++;
- XtSetValues (instructionW, wargs, n);
-
- return((Widget) bb);
-}
-
-/*
-** Pheight and pwidth start with the values-to-date of the bboard so far.
-** Return your height and width in them when you're done.
-**
-** Positioning the widgets happens in two phases:
-** First, we set their y-positions as we create them.
-** After they're created, we go back and adjust the x-positions
-** according to the widest left side noted.
-*/
-
-MakeInputLines(parent, pheight, pwidth, spec)
-Widget parent;
-Dimension *pheight;
-Dimension *pwidth;
-EntryForm *spec;
-{
- UserPrompt *current;
- XmString label; /* compound string required */
- Arg wargs[10];
- int i, n;
- Widget child;
- Dimension width, height, maxleftwidth = 0, maxrightwidth = 0;
- Dimension localy, leftheight = 0, rightheight = 0;
- UserPrompt **myinputlines = spec->inputlines;
- int foo = 30;
- Widget children[20];
- static XtTranslations trans = NULL;
-
- for ( current = (*myinputlines), localy = 0, i = 0;
- current;
- myinputlines++, current = (*myinputlines), i++) {
-
-
-#ifdef DEBUG
- printf ("Making entry %d: %s of type %d\n",
- i, current->prompt, current->type);
-#endif
-/*
-** First, make the prompt
-*/
- if (current->type == FT_KEYWORD) {
- char *p;
-
- p = strchr(current->prompt, '|');
- if (p) {
- *p++ = 0;
- current->keyword_name = p;
- }
- }
-
- label = XmStringCreate( current->prompt,
- XmSTRING_DEFAULT_CHARSET);
- n = 0;
- XtSetArg(wargs[n], XmNlabelString, label); n++;
- XtSetArg(wargs[n], XtNy, localy + *pheight); n++;
- child = XtCreateManagedWidget( "prompt",
- xmLabelWidgetClass,
- parent, wargs, n);
-
- GETSIZE(child);
- leftheight = height;
- if (width > maxleftwidth)
- maxleftwidth = width;
-
- if (current->type == FT_KEYWORD && current->keyword_name) {
- label = XmStringCreate("add new value",
- XmSTRING_DEFAULT_CHARSET);
- n = 0;
- XtSetArg(wargs[n], XmNlabelString, label); n++;
- XtSetArg(wargs[n], XtNy, localy + *pheight + height); n++;
- XtSetArg(wargs[n], XtNx, height); n++;
- child = XtCreateManagedWidget("newvalue",
- xmPushButtonWidgetClass,
- parent, wargs, n);
- XtAddCallback(child, XmNactivateCallback,
- newvalue, current);
-
- GETSIZE(child);
- leftheight += height;
- if (width + height > maxleftwidth)
- maxleftwidth = width + height;
- }
-/*
-** Second, make the input widget
-*/
- n = 0;
- XtSetArg(wargs[n], XtNy, localy + *pheight); n++;
- XtSetArg(wargs[n], XmNtraversalOn, True); n++;
- XtSetArg(wargs[n], XtNsensitive,
- !(current->insensitive)); n++;
- switch (current->type) {
- case FT_STRING:
- children[i] = XtCreateManagedWidget( "textwidget",
- xmTextWidgetClass,
- parent, wargs, n);
- XtAddCallback( children[i], XmNvalueChangedCallback,
- string_callback, current);
- if (trans == NULL) {
- XtAppAddActions(XtWidgetToApplicationContext(children[i]),
- myactions, XtNumber(myactions));
-
- trans = XtParseTranslationTable(resources.text_trans);
- }
- XtOverrideTranslations(children[i], trans);
- if (current->returnvalue.stringvalue) {
- XmTextSetString (children[i], current->returnvalue.stringvalue);
- }
- GETSIZE (children[i]);
- rightheight = height;
- if (width > maxrightwidth)
- maxrightwidth = width;
- break;
-
- case FT_BOOLEAN:
- XtSetArg(wargs[n], XmNset,
- current->returnvalue.booleanvalue ? True : False); n++;
-
- if (current->returnvalue.booleanvalue)
- label = XmStringCreate( "(True)", XmSTRING_DEFAULT_CHARSET);
- else
- label = XmStringCreate( "(False)", XmSTRING_DEFAULT_CHARSET);
- XtSetArg(wargs[n], XmNlabelString, label); n++;
-
- children[i] = XtCreateManagedWidget( "ignore this",
- xmToggleButtonWidgetClass,
- parent, wargs, n);
-
- XtAddCallback( children[i], XmNvalueChangedCallback,
- boolean_callback, current);
-
- GETSIZE (children[i]);
- rightheight = height;
- if (width > maxrightwidth)
- maxrightwidth = width;
- break;
-
- case FT_KEYWORD:
- children[i] =
- MakeRadioField(parent, current,
- &rightheight, spec);
- XtManageChild(children[i]);
- XtSetValues(children[i], wargs, n);
- GETSIZE (children[i]);
- if (width > maxrightwidth)
- maxrightwidth = width;
- break;
-
- default:
- printf ("Sorry, don't recognize that type\n");
- break;
- }
- XmAddTabGroup(children[i]);
- MapWidgetToForm(children[i], spec);
- current->parent = (caddr_t) spec;
-
- current->mywidget = children[i];
-
- localy += MAX(rightheight, leftheight) + vpad;
- }
-
-/*
-** Now slide the input widgets right as far as the widest prompt.
-*/
- n = 0;
- XtSetArg(wargs[n], XtNx, maxleftwidth + hpad); n++;
- for (; i; i--)
- XtSetValues (children[i - 1], wargs, n);
-
- *pheight = localy - vpad;
- *pwidth = maxleftwidth + maxrightwidth + hpad;
-}
-
-/*
-** All the junk about keeping track of the sum of the children's heights
-** is because the !#$% RowColumn widget doesn't sum them for us, NOR
-** does it accept SetValues on its XtNHeight! Thanks, Motif!
-*/
-
-Widget
-MakeRadioField(parent, prompt, pheight, spec)
-Widget parent;
-UserPrompt *prompt;
-Dimension *pheight;
-EntryForm *spec;
-{
- Widget radioparent, child = NULL;
- char *current;
- Arg wargs[10];
- int count, n;
- XmString label; /* accursed compound string required */
- Dimension height, width;
- char **keywords, *null[2];
-
- if (!prompt->keywords) {
- fprintf (stderr, "Warning: No list of keywords for widget\n");
- prompt->keywords = null;
- null[0] = NULL;
- }
- for ( count = 0, keywords = prompt->keywords;
- *keywords;
- keywords++, count++);
-
-/*
-** Although the XmNnumColumns resource is documented as actually
-** representing the number of _rows_ when XmNorientation is set to XmVERTICAL,
-** it doesn't. So I need to count the items myself and manually set the
-** number of columns to get a maximum of five rows. There's no XmNnumRows
-** resource. Thanks, Motif!
-*/
-
- n = 0;
- XtSetArg(wargs[n], XmNspacing, 0); n++;
-
- if (count > 5) {
- XtSetArg(wargs[n], XmNnumColumns, 1 + (count-1) / 5); n++;
- XtSetArg(wargs[n], XmNorientation, XmVERTICAL); n++;
- XtSetArg(wargs[n], XmNpacking, XmPACK_COLUMN); n++;
- }
- radioparent = XmCreateRadioBox(parent, "radio", wargs, n);
-
- keywords = prompt->keywords;
- for (current=(*keywords); current; keywords++, current=(*keywords)) {
- n = 0;
- label = XmStringCreate(current, XmSTRING_DEFAULT_CHARSET);
- XtSetArg(wargs[n], XmNlabelString, label); n++;
- if ((prompt->returnvalue.stringvalue) &&
- (!strcmp (current, prompt->returnvalue.stringvalue))) {
- XtSetArg(wargs[n], XmNset, True); n++;
- }
- else {
- XtSetArg(wargs[n], XmNset, False); n++;
- }
- child = XtCreateManagedWidget( current,
- xmToggleButtonWidgetClass,
- radioparent, wargs, n);
- MapWidgetToForm(child, spec);
-
- XtAddCallback( child, XmNvalueChangedCallback,
- radio_callback, prompt);
-
- }
-/*
-** Assume all child widgets are the same height. Increase height by
-** five times this, or the actual number of children, whichever is lesser.
-*/
-
- if (child) {
- GETSIZE (child);
- } else
- height = 10;
- *pheight = (height * MIN(5, count)) + vpad;
-
- return(radioparent);
-}
-
-
-/* This is called when the list of keywords changes. The old radio box
- * will be destroyed and a new one created.
- */
-
-RemakeRadioField(form, field)
-EntryForm *form;
-int field;
-{
- Dimension x, y, parent_y, oldheight, newheight;
- Arg wargs[4];
- Widget w;
- static XtTranslations trans = NULL;
- extern char form_override_table[];
- int i;
-
- XtSetArg(wargs[0], XtNx, &x);
- XtSetArg(wargs[1], XtNy, &y);
- XtSetArg(wargs[2], XtNheight, &oldheight);
- XtGetValues(form->inputlines[field]->mywidget, wargs, 3);
- XtUnmanageChild(form->inputlines[field]->mywidget);
- form->inputlines[field]->mywidget = w =
- MakeRadioField(form->formpointer, form->inputlines[field],
- &newheight, form);
- XtSetArg(wargs[0], XtNx, x);
- XtSetArg(wargs[1], XtNy, y);
- XtSetValues(w, wargs, 2);
- MapWidgetToForm(w, form);
- XmAddTabGroup(w);
- if (newheight > oldheight) {
- parent_y = y;
- for (i = 0; i < NumChildren(form->formpointer); i++) {
- XtSetArg(wargs[0], XtNy, &y);
- XtGetValues(NthChild(form->formpointer, i), wargs, 1);
- if (y > parent_y) {
- y = (y + newheight) - oldheight;
- XtSetArg(wargs[0], XtNy, y);
- XtSetValues(NthChild(form->formpointer, i), wargs, 1);
- }
- }
- }
-
- if (trans == NULL)
- trans = XtParseTranslationTable(resources.form_trans);
- XtOverrideTranslations(w, trans);
- for (i = 0; i < NumChildren(w); i++)
- XtOverrideTranslations(NthChild(w, i), trans);
-
- XtManageChild(w);
-}
-
-
-MakeButtons(parent, pheight, pwidth, spec)
-Widget parent;
-Dimension *pheight;
-Dimension *pwidth;
-EntryForm *spec;
-{
- BottomButton *current;
- XmString label; /* compound string required */
- Arg wargs[10];
- int i, n;
- Dimension newwidth, width = 25;
- Widget newbutton;
- BottomButton **buttons = spec->buttons;
-
- *pheight += vpad;
-
- n = 0;
- XtSetArg(wargs[n], XtNy, *pheight); n++;
- XtSetArg(wargs[n], XtNx, 0); n++;
- XtSetArg(wargs[n], XtNwidth, *pwidth); n++;
- XtCreateManagedWidget( "separator",
- xmSeparatorWidgetClass,
- parent, wargs, n);
- *pheight += vpad;
-
- for ( current=(*buttons);
- current;
- buttons++, current=(*buttons)) {
-
-#ifdef DEBUG
- printf ("Making a button labeled %s\n", current->label);
-#endif
- label = XmStringCreate( current->label,
- XmSTRING_DEFAULT_CHARSET);
- n = 0;
- XtSetArg(wargs[n], XtNy, (*pheight)); n++;
- XtSetArg(wargs[n], XtNx, width); n++;
- XtSetArg(wargs[n], XmNlabelString, label); n++;
-
- newbutton = XtCreateManagedWidget( current->label,
- xmPushButtonWidgetClass,
- parent, wargs, n);
-
- XtAddCallback(newbutton, XmNactivateCallback,
- (XtCallbackProc) current->returnfunction,
- spec);
- n = 0;
- XtSetArg(wargs[n], XtNwidth, &newwidth); n++;
- XtGetValues (newbutton, wargs, n);
-
- width += (newwidth + hpad);
- }
-
- (*pheight) += 100;
-}
-
-void
-radio_callback(w, client_data, call_data)
-Widget w;
-XmAnyCallbackStruct *client_data;
-XmAnyCallbackStruct *call_data;
-{
- Arg wargs[10];
- int n;
- Boolean is_set;
-
- UserPrompt *prompt = (UserPrompt *) client_data;
-
- n = 0;
- XtSetArg(wargs[n], XmNset, &is_set); n++;
- XtGetValues (w, wargs, n);
-
- if (!is_set)
- return;
-
-/*
-** Since Motif insists on using !@#$% Compound Strings as the text for
-** its label widgets, but doesn't provide a way of getting a char* back
-** from a !@#$% Compound String, I can't retrieve the label of the button
-** that was hit.
-**
-** Fortunately, I was smart enough to use the button label as the name
-** of the widget, and I can extract it via XtName(). Thanks, Motif!
-*/
- if (prompt->returnvalue.stringvalue &&
- (strcmp(prompt->returnvalue.stringvalue, XtName(w)))) {
- strcpy(prompt->returnvalue.stringvalue, XtName(w));
- if (prompt->valuechanged)
- (*prompt->valuechanged)(WidgetToForm(w), prompt);
- }
-
-}
-
-void
-boolean_callback(w, client_data, call_data)
-Widget w;
-XmAnyCallbackStruct *client_data;
-XmAnyCallbackStruct *call_data;
-{
- Arg wargs[10];
- int n;
- Boolean is_set;
- UserPrompt *current = (UserPrompt *)client_data;
- XmString label;
-
- n = 0;
- XtSetArg(wargs[n], XmNset, &is_set); n++;
- XtGetValues (w, wargs, n);
-
- current->returnvalue.booleanvalue = is_set;
-
- if (is_set)
- label = XmStringCreate( "(True)", XmSTRING_DEFAULT_CHARSET);
- else
- label = XmStringCreate( "(False)", XmSTRING_DEFAULT_CHARSET);
- n = 0;
- XtSetArg(wargs[n], XmNlabelString, label); n++;
- XtSetValues (w, wargs, n);
-
- if (current->valuechanged)
- (*current->valuechanged)(WidgetToForm(w), current);
-
-#if DEBUG
- printf ("boolean_callback: button %x is %s\n",
- w, (is_set ? "True" : "False"));
-#endif
-}
-
-void
-menu_callback(w, client_data, call_data)
-Widget w;
-XmAnyCallbackStruct *client_data;
-XmAnyCallbackStruct *call_data;
-{
- MenuItem *itemhit = (MenuItem *) client_data;
-
-/* printf ("menu_callback: item '%s', op %d and string '%s'\n",
- itemhit->label,
- itemhit->operation,
- itemhit->form);
- XtManageChild(entryformwidget);
-*/
- MoiraMenuRequest(itemhit);
-}
-
-
-void
-string_callback(w, client_data, call_data)
-Widget w;
-XmAnyCallbackStruct *client_data;
-XmAnyCallbackStruct *call_data;
-{
- UserPrompt *current = (UserPrompt *)client_data;
- char *newvalue;
-
- newvalue = XmTextGetString(w);
-
- if (strcmp(current->returnvalue.stringvalue, newvalue)) {
-/* printf ("Replacing old value of selection, '%s', with '%s'\n",
- current->returnvalue.stringvalue,
- newvalue);
- strcpy(current->returnvalue.stringvalue, newvalue);
- if (current->valuechanged)
- (*current->valuechanged)(WidgetToForm(w), current);
-*/ }
- XtFree(newvalue);
-}
-
-
-void MoiraFocusOut(w, event, p, n)
-Widget w;
-XEvent *event;
-String *p;
-Cardinal *n;
-{
- char *newvalue;
- UserPrompt *current = NULL;
- EntryForm *f;
- XmTextRec *tr = (XmTextRec *)w;
- int i;
-
- if (!tr || tr->core.self != w || tr->core.widget_class != xmTextWidgetClass)
- return;
- newvalue = XmTextGetString(w);
- f = WidgetToForm(w);
- for (i = 0; f->inputlines[i]; i++)
- if (f->inputlines[i]->mywidget == w)
- current = f->inputlines[i];
- if (current == NULL) {
- fprintf(stderr, "Couldn't find prompt structure!\n");
- return;
- }
-
- if (strcmp(current->returnvalue.stringvalue, newvalue)) {
- strcpy(current->returnvalue.stringvalue, newvalue);
- if (current->valuechanged)
- (*current->valuechanged)(f, current);
- }
- XtFree(newvalue);
-}
-
-
-void
-newvalue(w, client_data, call_data)
-Widget w;
-XmAnyCallbackStruct *client_data;
-XmAnyCallbackStruct *call_data;
-{
- UserPrompt *current = (UserPrompt *)client_data;
- EntryForm *form, *f;
- int i;
- static MenuItem mi;
-
- if (current->keyword_name == NULL) {
- PopupErrorMessage("Sorry, that keyword cannot be changed.", NULL);
- return;
- }
- form = (EntryForm *)current->parent;
- for (i = 0; form->inputlines[i]; i++)
- if (form->inputlines[i] == current)
- break;
- f = GetAndClearForm("add_new_value");
- mi.operation = MM_NEW_VALUE;
- mi.query = "add_alias";
- mi.argc = 3;
- mi.form = form->formname;
- mi.accel = (char *) i;
- f->menu = &mi;
- f->extrastuff = current->keyword_name;
- DisplayForm(f);
-}
-
-
-/* WARNING: This routine uses Motif internal undocumented routines.
- * It was the only way to get carriage return to Do The Right Thing.
- * If you are in a single-item tab group, this routine will call
- * MoiraFormComplete() (same as pressing OK on the bottom of the form).
- * otherwise, it advances the focus the same as pressing TAB.
- */
-
-void EnterPressed(w, event, argv, count)
-Widget w;
-XEvent *event;
-char **argv;
-Cardinal *count;
-{
- Widget next;
- EntryForm *form;
-
- next = _XmFindNextTabGroup(w);
- if (next == w) {
- MoiraFocusOut(w, event, argv, count);
- form = WidgetToForm(w);
- MoiraFormComplete(NULL, form);
- } else {
- _XmMgrTraversal(w, XmTRAVERSE_NEXT_TAB_GROUP);
- }
-}
-
-
-void CancelForm(w, event, argv, count)
-Widget w;
-XEvent *event;
-char **argv;
-Cardinal *count;
-{
- EntryForm *form;
-
- form = WidgetToForm(w);
- if (form)
- XtUnmanageChild(form->formpointer);
-}
-
-
-void ExecuteForm(w, event, argv, count)
-Widget w;
-XEvent *event;
-char **argv;
-Cardinal *count;
-{
- EntryForm *form;
-
- form = WidgetToForm(w);
- if (form) {
- MoiraFocusOut(w, event, argv, count);
- MoiraFormComplete(NULL, form);
- }
-}
-
-
-void DoHelp(w, event, argv, count)
-Widget w;
-XEvent *event;
-char **argv;
-Cardinal *count;
-{
- EntryForm *form;
-
- form = WidgetToForm(w);
- if (form)
- help(form->formname);
-}
-
-
-extern struct hash *create_hash();
-static struct hash *WFmap = NULL;
-
-MapWidgetToForm(w, f)
-Widget *w;
-EntryForm *f;
-{
- if (WFmap == NULL) {
- WFmap = create_hash(101);
- }
- hash_store(WFmap, w, f);
-}
-
-EntryForm *WidgetToForm(w)
-Widget *w;
-{
- return((EntryForm *) hash_lookup(WFmap, w));
-}
-
-
-/* Routines to deal with children of composite widgets */
-
-Widget NthChild(w, n)
-CompositeRec *w;
-int n;
-{
- return(w->composite.children[n]);
-}
-
-int NumChildren(w)
-CompositeRec *w;
-{
- return(w->composite.num_children);
-}
+++ /dev/null
-/* $Header$
- *
- * Copyright 1991 by the Massachusetts Institute of Technology.
- *
- * For further information on copyright and distribution
- * see the file mit-copyright.h
- */
-
-#include <mit-copyright.h>
-#include <stdio.h>
-#include <Xm/Xm.h>
-#include <moira.h>
-#include "mmoira.h"
-
-
-help(node)
-char *node;
-{
- FILE *helpfile = NULL;
- char buf[1024], key[32], *msg, helpbuf[10240], *filename;
- char *realloc(), *getenv();
-
- sprintf(key, "*%s\n", node);
- filename = resources.help_file;
- if (filename == NULL)
- filename = HELPFILE;
- helpfile = fopen(filename, "r");
- if (helpfile == NULL) {
- display_error("Sorry, help is currently unavailable.\n");
- return;
- }
- while (fgets(buf, sizeof(buf), helpfile))
- if (!strcmp(buf, key))
- break;
- if (strcmp(buf, key)) {
- sprintf(buf, "Sorry, unable to find help on topic \"%s\".\n", node);
- display_error(buf);
- fclose(helpfile);
- return;
- }
- msg = NULL;
- while (fgets(buf, sizeof(buf), helpfile))
- if (buf[0] == '*')
- break;
- else {
- if (msg) {
- if (!strcmp(buf, "\n"))
- strcpy(buf, " \n");
- msg = realloc(msg, strlen(msg) + strlen(buf) + 2);
- strcat(msg, buf);
- } else
- msg = strsave(buf);
- }
- fclose(helpfile);
- if (msg) {
- if (tty)
- printf("%s\r\n", msg);
- else
- PopupHelpWindow(msg);
- free(msg);
- }
- return;
-}
-
-help_form_callback(dummy, form)
-int dummy;
-EntryForm *form;
-{
- UserPrompt **p;
- int count;
-
- /* undocumented Motif internal routine to advance in tab group.
- * In this case we're going backwards because for some reason
- * the form advances whenever this button is pressed.
- * However, it doesn't seem to go backwards even though source
- * implies that it should. So we go forward until we wrap.
- */
- count = 0;
- for (p = form->inputlines; *p; p++)
- if (!((*p)->insensitive))
- count++;
- while (count-- > 1)
- _XmMgrTraversal(form->formpointer, XmTRAVERSE_PREV_TAB_GROUP);
- help(form->formname);
-}
-
+++ /dev/null
-$Header$
-*no_more_help
-Sorry, no further help is available.
-*show_user
-This will display information about a user in the database. The user
-may or may not have an active account.
-
-Users may be retrieved in four ways:
-+ by login name (may use wildcards)
-+ by Unix UID (must match exactly)
-+ by first and/or last names (may use wildcards)
-+ by class (please do not specify a class with too many people in it)
-
-Fill in the desired field(s), click on "OK", and moira will retrieve
-any matching users. Moira will look to see which field(s) you
-filled in, and perform one of the four retrievals mentioned above.
-*add_user
-Specify all of the information to add a new user to the database. The
-user need not have an active user account.
-
-+ specify a login name of 3 to 8 characters, or the special value
- "create unique login" to have moira choose one for you
-+ specify a number for the UID, or the special value "create unique UID"
- to have moira choose one for you.
-+ Moira has a set of standard capitalization rules it uses on users'
- real names. If you attempt to enter names capitalized differently,
- Moira will complain. You may override this, but if you do so, the
- register program may not work for that user.
-+ the ID number will be one-way encrypted before being stored in the
- database. If you wish to enter the encrypted ID directly, enclose
- it in double-quotes.
-+ to create a fully active user account, enter a user here as status
- "Registerable", then use the "register" option on the "user" menu to
- complete the user account.
-*register_user
-This will turn an entry for a user in the database to a fully
-functioning account. The user may be selected in two ways:
-
-+ specify the real name of the user (with wildcards allowed) in the
- first name and last name fields. This must match only one user in
- the database.
-+ specify the unix UID of the desired user.
-
-Be sure to fill in a login name which is not in use. The suggested
-name is
- first initial, middle initial, first six characters of last name
-but must be eight or fewer characters long.
-*select_user
-Specify the login name of the user to be modified. Wildcards may
-be used, but your specification must match exactly one user.
-*mod_user
-Change any fields desired, then click on "OK" to modify the user
-entry. You may even change the login name.
-
-+ You may change the UID to the special value "create unique UID"
- to have moira choose another one for you.
-+ Moira has a set of standard capitalization rules it uses on users'
- real names. If you attempt to enter names capitalized differently,
- Moira will complain. You may override this, but if you do so, the
- register program may not work for that user.
-+ the ID number will be one-way encrypted before being stored in the
- database. To enter an already encrypted ID, type double-quotes (")
- around it.
-+ If you are just changing the account status, in the future remember
- that the "deactivate" choice of the "user" menu is a quick way to
- set the status to "3 - Deleted".
-*deactivate_user
-Specify the login name of the user to be deactivated.
-
-Deactivating a user makes their account no longer usable. They will
-show up with an account status of "3 - Marked for Deletion". However,
-all of their information will still be in the database so that the
-account can be turned back on if necessary. Since they are still in
-the database, their login name and UID may not be re-used. You may
-wish to make the user's group list no longer active and deny access to
-their locker at the same time.
-
-At some point in the future, deactivated accounts should be expunged,
-either in bulk or with the "expunge" option of the "user" menu.
-*expunge_user
-Specify the login name of the user to be expunged.
-
-This will remove the user's record from the Moira database (but not
-from Kerberos). Once this is done, the login name and UID may be
-reused. It is a good idea to leave users in the deactivated state for
-a while before expunging them so that the name and ID are not reused
-right away, and the account can be reactivated if necessary.
-
-At Project Athena, we have decided that expunging individual accounts
-is a bad idea, so any account which has ever been active may not be
-expunged this way. These accounts must be removed in bulk by the
-Moira administrator.
-*show_finger
-Specify a login name to select a user whose finger information will be
-displayed. This information will exist for users whose accounts are
-not yet active, as it is loaded at the same time as the users
-themselves.
-*select_finger
-Specify the login name of the user whose finger information is to be
-modified. Wildcards may be used, but your specification must match
-exactly one user.
-*mod_finger
-Enter the new information about the user. This information will
-appear where the finger program can see it.
-
-You may set your name as it appears to other users to anything you
-want. Please keep it something resembling your real name. Our
-operations staff can find out the real name of the owner of an
-account.
-
-The rest of the information is optional, and is initialized to
-information from the administration. If you do not want this
-information to appear for you, type spaces over it. Please do not
-enter incorrect information.
-
-Note that commas (,) and colons (:) are not allowed in these
-responses. This is due to how the information is manipulated later.
-We suggest that you use a semicolon (;) to separate parts of your
-address.
-*select_pobox
-Enter the login name of a user to see what that user's P. O. Box or
-mail forwarding is set to.
-*set_pobox
-This allows you to set where a user receives their mail. Specify the
-login name to select a user.
-
-+ If the type is POP, then the user will receive their mail on a post
- office (POP) server. Select one of the POP servers listed below.
-+ If the type is SMTP, then the user will have their mail forwarded
- somewhere else. Type the destination address in the "SMTP Address"
- field.
-+ If the type is NONE, the user will be unable to receive mail. This
- is the same as deleting the P. O. Box.
-
-Note that if the user has had their mail forwarded, and wants to
-receive it locally again, you should not use this form; select the
-"reset" option from the "pobox" menu to select the same POP server
-that they previously used.
-
-To add new POP servers to the list, add them as POP servers in the
-servers submenu of the updates menu.
-*reset_pobox
-This option will change a user's mail setting to receiving on a local
-POP server. The server chosen will be the same one that the user has
-used in the past. If the user is already receiving their mail
-locally, or has never had a POP box, then you will get an error. Use
-the "set" option of the "pobox" menu for more general mail
-manipulation.
-*del_pobox
-If you delete a user's P. O. Box, they will not be able to receive
-mail. This normally should not be done. To go ahead and delete a
-users mailbox, enter their login name.
-*show_krbmap
-This will display user to kerberos principal mappings. You may
-specify the mappings to be displayed by entering a login name, a
-principal name, or both. Either field may contain wildcards.
-*add_krbmap
-This will add a new user to kerberos mapping to the database. You
-must fill in both fields, entering a login name and a kerberos
-principal.
-
-Note that the principal is case sensitive, and should be entered with
-the realm in uppercase. If the principal name contains a periods or
-at-signs other than as separators between the name, instance and
-realm, be sure to escape them with backslashes (\).
-*del_krbmap
-This will remove a mapping from the database. You must fill in both
-fields, exactly matching an existing kerberos mapping.
-
-Note that the principal is case sensitive, and should be entered with
-the realm in uppercase. If the principal name contains a periods or
-at-signs other than as separators between the name, instance and
-realm, be sure to escape them with backslashes (\).
-*show_list
-This will show you the information about one or more lists in the
-database. Wildcards may be used in the name.
-*show_ace_use
-This will show you every object in the database that can be
-administered by a particular entity. This includes lists,
-filesystems, services, quotas, queries, and zephyr controls. The
-entity specified can be just a user, and kerberos principal, or a
-moira list. Note that the name of the entity cannot have wildcards.
-
-If you specify to search recursively, for every list of which the
-named entity is a member, items that list owns will also be displayed.
-Note that this can take a long time, so please only use it if
-necessary.
-*add_list
-This will add a new list to the database. The name can be any string
-up to 32 characters long, but cannot contain uppercase letters or
-punctuation characters other than hyphen, underscore, and period.
-
-The flags control attributes of the list: if the list is inactive
-(active flag is false), no services other than moira will know about
-the list; if the list is public (public flag is true), anyone may add
-or remove themselves from the list; if the list is hidden (hidden flag
-is true), no one other than the list owners may get information from
-moira about the list (but be aware that often list information is
-available from other sources, so this is not secure); if the maillist
-flag is true, you will be able to send email to the list (lists get
-automatically promoted to maillists if they are members of maillists);
-if the group flag is true, the list will be a unix file access group.
-Only if the list is a group is the Unix GID field valid. This field
-may contain an integer or the string "create unique GID", in which
-case Moira will assign a number.
-
-The owner can be a user, a kerberos principal, or any list. A list
-may own itself, in which case each member of the list is an
-administrator of that list. Finally, the description field can
-contain anything you like.
-*select_list
-Enter the name of a list to modify. Wildcards may be used
-in the name, but only the first matching name will be used.
-*del_list
-Enter the name of a list to delete. Wildcards may be used
-in the name, but only the first matching name will be used.
-*mod_list
-You may edit any of the information about the list. The name can be
-any string up to 32 characters long, but cannot contain uppercase
-letters or punctuation characters other than hyphen, underscore, and
-period.
-
-The flags control attributes of the list: if the list is inactive
-(active flag is false), no services other than moira will know about
-the list; if the list is public (public flag is true), anyone may add
-or remove themselves from the list; if the list is hidden (hidden flag
-is true), no one other than the list owners may get information from
-moira about the list (but be aware that often list information is
-available from other sources, so this is not secure); if the maillist
-flag is true, you will be able to send email to the list (lists get
-automatically promoted to maillists if they are members of maillists);
-if the group flag is true, the list will be a unix file access group.
-Only if the list is a group is the Unix GID field valid. This field
-may contain an integer or the string "create unique GID", in which
-case Moira will assign a number.
-
-The owner can be a user, a kerberos principal, or any list. A list
-may own itself, in which case each member of the list is an
-administrator of that list. Finally, the description field can
-contain anything you like.
-*show_members
-You may list the members of a list, or the lists to which a member
-belongs. Please fill out EITHER the list name OR the member type and
-name, but not both.
-
-If you tell it to search recursively, when retrieving the members of a
-list it will also find the members of any other lists which are
-members of the list in question.
-*add_member
-This will allow you to add a new member to a list. Enter the name of
-the list, and the type and name of the member. Do not use wildcards
-in either of the names.
-*del_member
-This will allow you to remove an existing member from a list. Enter
-the name of the list, and the type and name of the member. Do not use
-wildcards in either of the names.
-*del_all_member
-This will allow you to remove a particular member from all lists that
-member belongs to. You may specify any type of member, but must
-exactly match that member without wildcards.
-
-This program can prompt you for each deletion, or simply do them all.
-*del_mem_confirm
-If you answer yes, this member will be deleted from the named list.
-Answer no to avoid the deletion. In either case, you will continue to
-be prompted with the other lists the member belongs to.
-*authors
-This moira client was written by Mark Rosenstein and Andy Oakland of
-MIT Information Systems/Distributed Computing and Network Services
-(formerly Project Athena).
-
-The best way to reach someone with questions or comments about this
-program is to email to moira@mit.edu.
-*about_moira
-Moira is a system configuration manager for distributed systems. This
-program is the user interface part of the system, and allows you to
-manipulate everything moira knows about.
-
-The top menu bar lists the kinds of things moira knows about, and
-clicking the mouse on one of them will display a menu of operations
-supported for that kind of object. Some of these menus have submenus
-for related objects.
-
-When you select a menu item, a form will be displayed. Fill out any
-desired parts of the form:
- + put the correct value in any text fields
- + click on the appropriate choice in keyword fields
- + click on the value to toggle booleans between True and False
- + typing TAB will forward you to the next field
-When you are done, click the mouse on "OK". The form will disappear,
-and if you are retrieving information from the database, the results
-will be displayed in the window underneath the form. Clicking on
-"Apply" will perform the operation, but leave the form up on the
-screen. If you click on "Cancel", the form will disappear without
-doing anything. Each form has a help message specific to that form
-that you can see by clicking the mouse on "Help".
-*add_new_value
-This will allow you to add a new keyword which can be specified for
-the field in the previous form. Moira type fields are checked against
-a list of legal values, but this list itself can easily be changed.
-However, this should not be done lightly. Be sure you know what you
-are doing and really want this new value before adding it.
-
-To have a keyword value removed, ask the Moira system administrator.
-*wildcards
-Wildcards are allowed in most fields when looking things up in the
-database. Asterisk "*" will match zero or more characters, so that
-"Rose*" will match "Rose", "Rosen", "Rosenberg" or "Rosenstein".
-
-Be careful about using wildcards where your query will match too much
-data in the database. You probably do not want to retrieve 1000
-items, and doing so will cause the server to take a long time and
-possibly require more resources than are available.
-*mouse
-You may also retrieve or modify objects by using the mouse to click on
-them where they appear in the log window. Regular mouse clicks will
-do selections as they do in most X applications. But if you hold down
-SHIFT and click the first mouse button, it will retrieve the
-referenced object. And if you hold down SHIFT and click the second
-mouse button, it will pull up the window to modify the referenced
-object. If you click the mouse on something the program doesn't
-recognize as an object, it will beep at you.
-
-For example, when you show information about a filesystem, a paragraph
-is added to the log that starts with "Filesystem: foo". If you click
-on the name (foo in the example), it will reference that filesystem
-again. The paragraph about the filesystem also mentions a machine, a
-user (the owner), a group (the owners), and another user (who last
-modified the info). You can click on any of these names to select the
-object being referred to.
-*keyboard
-There are keyboard accelerators for many of the mouse actions.
-
-For choosing items from the menubar, if you hold down META and type the
-letter which is underlined in each word, you will select that menu.
-Then typing the letter underlined in any of the items in the menu will
-select that item.
-
-When you are filling out a form, ENTER will advance you to the next
-field if there is more than one field in the form. If there is only
-one field, ENTER is equivalent to clicking on OK. META-ENTER or
-SHIFT-ENTER is the same as clicking on OK. ^C in a form is the same
-as clicking on CANCEL. Meta-? is the same as clicking on HELP.
-*bugs
-Please report bugs in this program by sending email to:
- bug-moira@mit.edu
-Please be sure to mention what kind of computer you were running it
-on, and any other necessary information so that we can repeat the bug
-before we fix it.
-*save_log
-Enter a file name here, and the current contents of the log file will
-be written out to that file.
-*fixcase
-It is important that names in the Moira database all follow the same
-capitalization style so that the register program can find users. So
-even though for a few names it may not look right, we strongly suggest
-that you follow what this program suggests.
-*confirm_del_all
-If you answer yes, this member will be deleted from the named list.
-Answer no to avoid the deletion. In either case, you will continue to
-be prompted with the other lists the member belongs to.
-*show_filsys
-This will display information about a filesystem. The filesystem may
-be of any protocol type and may be a filesystem group or multiple
-filesystem entry as well.
-
-Filesystems may be retrieved in any of five ways:
-+ by the name of the filesystem (may use wildcards)
-+ by the name of the fileserver (machine) (must match exactly)
-+ by the actual partition of an NFS server (specify machine and
- partition, both must match exactly)
-+ by the owning group of the filesystem (must match exactly)
-+ by the pathname of the locker on the fileserver
-
-Fill in the desired field(s), click on "OK", and moira will retrieve
-any matching filesystems. Moira will look to see which field(s) you
-filled in, and perform one of the for retrievals mentioned above.
-*add_filsys
-Specify all of the information to add a new filesystem to the
-database. The name, type, owner, owners and lockertype are mandatory
-fields. The other fields may have to be filled in depending on what
-the type is.
-
-+ For type AFS filesystems, the machine/cell field contains the AFS
- cell name. The remote name is the path to the volume mountpoint in
- AFS.
-+ For type ERR filesystems, only the comment field is actually used.
- The contents of the comment field will be displayed as an error
- message when someone tries to attach this filesystem.
-+ No other fields are necessary for type FSGROUP or MUL filesystems.
- Use the operations on the filesystem group submenu to manipulate
- the membership of these types.
-+ For type NFS filesystems, the machine field names the fileserver,
- and the remote name is the path of the directory on the fileserver.
-*select_filsys
-Specify the name of a filesystem to be modified. Wildcards may be
-used, but your specification must match exactly one filesystem.
-*mod_filsys
-Change any fields desired, then click on "OK" to modify the filesystem
-entry. You may even change the name of the filesystem. The name,
-type, owner, owners and lockertype are mandatory fields. The other
-fields may have to be filled in depending on what the type is.
-
-+ For type AFS filesystems, the machine/cell field contains the AFS
- cell name. The remote name is the path to the volume mountpoint in
- AFS.
-+ For type ERR filesystems, only the comment field is actually used.
- The contents of the comment field will be displayed as an error
- message when someone tries to attach this filesystem. The other
- fields may be left so that when the filesystem is re-enabled, you
- only have to change the type and comment.
-+ No other fields are necessary for type FSGROUP or MUL filesystems.
- Use the operations on the filesystem group submenu to manipulate
- the membership of these types.
-+ For type NFS filesystems, the machine field names the fileserver,
- and the remote name is the path of the directory on the fileserver.
-*del_filsys
-Enter the name of a filesystem to delete. Wildcards may be used in
-the name, but only the first matching name will be used.
-*show_fsgroup
-This will display information about a filesystem group, multiple
-filesystem, or any other type of filesystem. You may use wildcards in
-the name you specify.
-*add_fsgroup
-This enables you to add additional filesystems to a filesystem group
-or multiple filesystem. Enter the name of the group, and the
-filesystem to be added. Since the order of membership in these groups
-is important, you must also indicate where to insert the filesystem by
-indicating whether the new one should be first or which one it should
-follow. This sorted list will be displayed only after you have indicated
-the name of the group to be modified.
-*order_fsgroup
-This enables you to change the order in which the members of a
-filesystem group or multiple filesystem are listed. First enter the
-name of the group. This must match the name of an existing filesystem
-group or type multiple filesystem. If it does, the next two fields
-will have the possible choices filled in for you.
-
-Now select which filesystem you want to reorder, then indicate which
-filesystem it should follow.
-*del_fsgroup
-First enter the name of the filesystem group or multiple filesystem to
-be modified. This must match the name of an existing filesystem group
-or type multiple filesystem. If it does, the next field will now show
-the current members of the group. Select which one you want to remove
-from the group.
-*show_fs_alias
-This will show you filesystem alias mappings. Enter either the real
-name of the filesystem or the alias name, and all matching pairs will
-be displayed.
-*add_fs_alias
-This will let you create a new filesystem alias. Enter the real name
-of the filesystem, and the alternate name (alias) you want to be able
-to use.
-*del_fs_alias
-This will let you delete an existing filesystem alias. Enter the real
-name of the filesystem, and the alternate name (alias) you want to
-remove.
-*show_nfs
-This will show you information about NFS server partitions. You must
-fill in the name of the server, and optionally the name of the
-partition (i.e. /u1/lockers), or leave the partition blank to see all
-partitions on a server.
-*add_nfs
-This will let you add information about a new NFS server partition to
-the database. The machine (server) name will be canonicalized; if
-you want to enter a string literally, enclose it in double-quotes.
-The group quota flag must be set correctly for Moira to correctly
-assign quotas to lockers on that partition. The size and allocation
-fields are used by Moira to automatically locate new lockers. The
-allocation field is updated whenever the quota on a locker on that
-partition is changed.
-*select_nfs
-Name a NFS server and partition (i.e. /u1/lockers) to modify. The
-machine (server) name will be canonicalized; if you want to enter a
-string literally, enclose it in double-quotes.
-*mod_nfs
-Change any fields desired, then click on "OK" to modify the NFS
-partition information. The machine (server) name will be
-canonicalized; if you want to enter a string literally, enclose it in
-double-quotes. The group quota flag must be set correctly for Moira
-to correctly assign quotas to lockers on that partition. The size and
-allocation fields are used by Moira to automatically locate new
-lockers. The allocation field is updated whenever the quota on a
-locker on that partition is changed.
-*del_nfs
-Name a NFS server and partition (i.e. /u1/lockers) to delete. The
-machine (server) name will be canonicalized; if you want to enter a
-string literally, enclose it in double-quotes.
-*show_quota
-This will show filesystem quotas. If you only fill in the name of the
-filesystem, then all quotas on that filesystem will be displayed. If
-you only fill in the user or group, then all quotas applying to that
-user or group will be displayed. If you fill on both, then only
-matching quotas will be displayed.
-
-Note that quotas on AFS filesystems are of type ANY and will not match
-User or Group quotas.
-*add_quota
-First enter the name of the filesystem. The program will then
-indicate whether this filesystem should have a type ANY quota (i.e. it
-is in AFS), a type GROUP quota (i.e. it is in NFS on a group quota
-partition), or type USER (anything else).
-
-If this is a user or group quota, you will have to fill in the name of
-the user or group. Finally, enter the actual quota value in Kilobytes.
-*mod_quota
-[First enter the name of the filesystem. The program will then
-indicate whether this filesystem should have a type ANY quota (i.e. it
-is in AFS), a type GROUP quota (i.e. it is in NFS on a group quota
-partition), or type USER (anything else).]
-
-THIS DOES NOT WORK. For now, you have to set the quota type by hand.
-
-If this is a user or group quota, you will have to fill in the name of
-the user or group. Finally, enter the new quota value in Kilobytes.
-*del_quota
-[First enter the name of the filesystem. The program will then
-indicate whether this filesystem should have a type ANY quota (i.e. it
-is in AFS), a type GROUP quota (i.e. it is in NFS on a group quota
-partition), or type USER (anything else).]
-
-THIS DOES NOT WORK. For now, you have to set the quota type by hand.
-
-If this is a user or group quota, you will have to fill in the name of
-the user or group.
-*set_dquota
-Use this to set the default quota. The default quota is the quota
-that is automatically assigned to new users' home directories when the
-register, and is the default value for other new locker creations as
-well. The value should be specified in Kilobytes.
-*show_machine
-This will show you the information about one or more machines (hosts)
-in the database. Wildcards may be used in the name. If no wildcards
-are used, the name you type will be canonicalized by the domain name
-system before being looked up in the database. To bypass this
-canonicalization, put the name inside a pair of double-quotes. All
-machine name comparisons are case-insensitive.
-*add_machine
-This will add a new machine (host) to the database. The name you type
-will be canonicalized by the domain name system. To bypass this
-canonicalization, put the name inside a pair of double-quotes. Each
-machine must be of one of the defined types.
-
-Note that type "AFS" is used with pseudo-machines that are used as AFS
-cell name indicators.
-*select_machine
-Enter the name of the machine (host) to modify. Wildcards may be used
-in the name. If no wildcards are used, the name you type will be
-canonicalized by the domain name system before being looked up in the
-database. To bypass this canonicalization, put the name inside a pair
-of double-quotes. All machine name comparisons are case-insensitive.
-*mod_machine
-You may change the name and/or type of the machine. The name you type
-will be canonicalized by the domain name system. To bypass this
-canonicalization, put the name inside a pair of double-quotes. Each
-machine must be of one of the defined types.
-
-Note that type "AFS" is used with pseudo-machines that are used as AFS
-cell name indicators.
-*del_machine
-Specify the hostname to delete a machine from the Moira database. The
-name you type will be canonicalized before it is used. To enter a
-literal string, enclose it in double-quotes.
-*show_cluster
-This will show you the information about one or more clusters in the
-database. Wildcards may be used in the name.
-*add_cluster
-This will add a new cluster to the database. Choose a name containing
-letters, numbers, and underscore. Current Athena convention is
-building number (preceded by "M" if it doesn't start with a letter),
-optional descriptor such as "staff" or "test", a hyphen, and then the
-platform designation such as "vs" or "dmu". The description and
-location fields are optional.
-*select_cluster
-Enter the name of a cluster to modify. Wildcards may be used in the
-name, although only the first match found will be modified.
-*mod_cluster
-You may change any information about the cluster, including its name.
-When you have the information they way you want it, click on "OK" to
-commit the changes.
-*del_cluster
-Specify the name of the cluster to delete.
-*mcmap
-This will show machine to cluster mappings. This mapping is not
-one-to-one, as a machine may be in multiple clusters and clusters
-generally contain more than one machine.
-
-Enter either a machine name or a cluster name to see the matching
-memberships. You may use wildcards with either.
-*add_mcmap
-This will add a machine to a cluster. Note that a machine may be in
-multiple clusters. The machine name you type will be canonicalized by
-the domain name system before being stored in the database. To bypass
-this canonicalization, put the name inside a pair of double-quotes.
-*del_mcmap
-This will remove a machine from a cluster. The machine name you type
-will be canonicalized by the domain name system before being stored in
-the database. To bypass this canonicalization, put the name inside a
-pair of double-quotes.
-*show_cldata
-This will show the data associated with a cluster. You must enter a
-clustername, which may include wildcards. The label is optional, and
-it too may contain wildcards. If no label is specified, all data
-associated with the cluster will be displayed.
-*add_cldata
-This will add additional data to a cluster. You must fill in all of
-the fields. Enter a valid cluster name. The label may be any string,
-but is generally one of "syslib", "lpr", or "zephyr". The data also
-may be anything, but is generally a filesystem name, printer name, or
-zephyr server name.
-*del_cldata
-This will remove data from a cluster. Enter a valid cluster name.
-You must fill in each of the fields, although if you use a wildcard
-for the value, it will remove all data with the specified label from
-that cluster.
-*show_printer
-This will show you information about one or more printers in the
-database. Wildcards may be used in the name.
-*add_printer
-This will add a new printer to the database. The printer must have a
-unique name up to 32 characters long. Enter the name of the print
-spooler as the spooling host. This hostname will be canonicalized
-before it is stored in the database. To enter a literal string,
-enclose it in double-quotes. The spool directory is the directory on
-the print spooler for that printer. The remote name is the name of
-the printer on the print spooler. The quota server is another
-canonicalized hostname, this time of the machine that handles
-accounting for this printer. To disable accounting, leave the quota
-server field blank. If authentication is true, all print requests for
-this printer must be kerberos authenticated. The price entered here
-(in cents) is for informational purposes only; the quota server gets
-the actual price from another source.
-*select_printer
-Enter the name of a printer to modify. While you may use wildcards
-here, you will only get a chance to modify the first printer matched.
-*mod_printer
-Change any desired fields, then click on "OK" to commit the changes.
-
-The printer must have a unique name up to 32 characters long. Enter
-the name of the print spooler as the spooling host. This hostname
-will be canonicalized before it is stored in the database. To enter a
-literal string, enclose it in double-quotes. The spool directory is
-the directory on the print spooler for that printer. The remote name
-is the name of the printer on the print spooler. The quota server is
-another canonicalized hostname, this time of the machine that handles
-accounting for this printer. To disable accounting, leave the quota
-server field blank. If authentication is true, all print requests for
-this printer must be kerberos authenticated. The price entered here
-(in cents) is for informational purposes only; the quota server gets
-the actual price from another source.
-*del_printer
-Specify the name of a printer to delete.
-*show_zephyr
-Enter the name of a zephyr class to see the restrictions in place on
-that class. You may use wildcards.
-*add_zephyr
-Enter the necessary information to set up access controls on a class
-of zephyr messages. For each privilege, you can set a user, a single
-kerberos principal, an access list, or nothing. The privileges are:
- + XMT: the ability to transmit a zephyr message of this class
- + SUB: the ability to subscribe to messages of this class
- + IWS: the ability to subscribe to the wildcard instance of this class
- + IUI: the ability to use only the instance UID identity???
-*select_zephyr
-Enter a zephyr class whose restrictions you wish to modify or delete.
-*mod_zephyr
-Update the restrictions for this zephyr class. When you are done,
-click on "OK" to commit the changes. For each privilege, you can set
-a user, a single kerberos principal, an access list, or nothing. The
-privileges are:
- + XMT: the ability to transmit a zephyr message of this class
- + SUB: the ability to subscribe to messages of this class
- + IWS: the ability to subscribe to the wildcard instance of this class
- + IUI: the ability to use only the instance UID identity???
-*dcm_enable
-Use this switch to enable or disable DCM updates. If this is not
-enabled, the DCM will quit shortly after it starts. When this is
-enabled, there are still many other reasons (such as the existence of
-the file /etc/nodcm) why it might not run.
-*trigger_dcm
-Use this to start a DCM pass now instead of waiting until the next
-scheduled run. Do not do this unless you understand all of the
-implications of an unscheduled DCM run.
-*show_service
-This will show you the configuration of a DCM service to be updated.
-The name may contain wildcards.
-*add_service
-Specify the information to add a new service to the Moira database.
-Note that these services are used for two purposes: those which the
-DCM updates, and those present just for a hesiod SLOC entry.
-
-The interval is the minimum time between attempted updates. The
-destination file is where the DCM will leave the datafile on hosts
-being updated. The script will be run on each host being updated
-after copying the datafile to its destination. The service must be
-enabled for the DCM to update it. Services existing just for the
-hesiod SLOC info should be left disabled. The owner fields are
-currently ignored.
-
-If the type is UNIQUE, each host to be updated with this service will
-be treated individually, and some of them may be updated
-simultaneously. If the type is REPLICAT(ED), only one instance of the
-service will be updated at a time, and if any of them fail no further
-updates for that service will occur until this is reset.
-*select_service
-Specify the name of the service to be affected (depending on the menu
-item you selected, this could mean modifying, deleting, reseting
-errors, or resetting the complete state).
-*mod_service
-Change any fields desired, then click on "OK" to commit the changes.
-Note that these services are used for two purposes: those which the
-DCM updates, and those present just for a hesiod SLOC entry.
-
-The interval is the minimum time between attempted updates. The
-destination file is where the DCM will leave the datafile on hosts
-being updated. The script will be run on each host being updated
-after copying the datafile to its destination. The service must be
-enabled for the DCM to update it. Services existing just for the
-hesiod SLOC info should be left disabled. The owner fields are
-currently ignored.
-
-If the type is UNIQUE, each host to be updated with this service will
-be treated individually, and some of them may be updated
-simultaneously. If the type is REPLICAT(ED), only one instance of the
-service will be updated at a time, and if any of them fail no further
-updates for that service will occur until this is reset.
-*show_host
-This will show the configuration of a DCM host/service tuple. Enter
-the service and/or host name. Either of both of them may contain
-wildcards.
-*add_host
-Specify the information to add a new host/service tuple to the Moira
-database. Note that these entries are actually used for two purposes:
-to indicate what the DCM should update, and to create a hesiod SLOC
-entry.
-
-The service name should be the name of an existing service. The host
-name must be the name of a known host. This host name will be
-canonicalized before it is stored in the database. To enter a literal
-string, enclose it in double-quotes. Enable the host if you actually
-want it to recieve DCM updates. The three values are used in a
-service-specific way. Values 1 and 2 are integers and value 3 is a
-string.
-*select_host
-Specify the host/service tuple to be affected (depending on the menu
-item you selected, this could mean modifying, deleting, reseting
-errors, or resetting the complete state).
-*mod_host
-Change any fields desired, then click on "OK" to commit the changes.
-Note that these entries are actually used for two purposes: to
-indicate what the DCM should update, and to create a hesiod SLOC
-entry.
-
-The service name should be the name of an existing service. The host
-name must be the name of a known host. This host name will be
-canonicalized before it is stored in the database. To enter a literal
-string, enclose it in double-quotes. Enable the host if you actually
-want it to recieve DCM updates. The three values are used in a
-service-specific way. Values 1 and 2 are integers and value 3 is a
-string.
-*show_value
-This will show the value of a Moira configuration variable. This is
-intended primarily for the moira system administrator and others
-familiar with moira's operation. Wildcards are not allowed in the
-variable name.
-
-Variables of possible interest are uid and gid, which are the next ID
-numbers to be assigned.
-*show_alias
-This will show a raw alias entry from the Moira database. Besides the
-obvious use for altername names for things, aliases are used to store
-valid keywords for various fields, variable typing information, and
-random string variables.
-
-To see keywords for a field, enter the name of the keyword, and use
-type TYPE. To see the type associated with a value, select TYPEDATA.
-To see a string variable, use type VALUE. Tye AFSPATH contains
-information for turning a lockername and locker type into the
-appropriate mountpoint for the locker. The remaining types are just
-for alias names.
-*quota_after_filsys
-Add a new quota now for the filesystem you just added to the database.
+++ /dev/null
-/* $Header$
- *
- * Copyright 1991 by the Massachusetts Institute of Technology.
- *
- * For further information on copyright and distribution
- * see the file mit-copyright.h
- */
-
-#include <mit-copyright.h>
-#include <stdio.h>
-#include <string.h>
-#include <pwd.h>
-#include <moira.h>
-#include <com_err.h>
-#include <X11/StringDefs.h>
-#include <Xm/PushB.h>
-#include <Xm/BulletinB.h>
-#include <Xm/RowColumn.h>
-#include "mmoira.h"
-
-extern MenuItem MenuRoot;
-
-Widget CreateMenu(), CreateForm();
-Widget BuildMenuTree();
-void popup_error_hook(), mr_x_input(), EnterPressed(), CancelForm();
-void ExecuteForm(), DoHelp();
-
-MoiraResources resources;
-
-static XrmOptionDescRec options[] = {
- {"-db", "*database", XrmoptionSepArg, NULL},
- {"-noauth", "*noAuth", XrmoptionNoArg, (caddr_t) "true"},
- {"-helpfile","*helpFile", XrmoptionSepArg, NULL},
- {"-logsize","*logSize", XrmoptionSepArg, NULL},
-};
-
-
-#define Offset(field) (XtOffset(MoiraResources *, field))
-
-static XtResource my_resources[] = {
- {"formTranslations", XtCString, XtRString, sizeof(String),
- Offset(form_trans), XtRImmediate, (caddr_t) NULL},
- {"textTranslations", XtCString, XtRString, sizeof(String),
- Offset(text_trans), XtRImmediate, (caddr_t) NULL},
- {"logTranslations", XtCString, XtRString, sizeof(String),
- Offset(log_trans), XtRImmediate, (caddr_t) NULL},
- {"helpFile", XtCFile, XtRString, sizeof(String),
- Offset(help_file), XtRImmediate, (caddr_t) "/afs/athena.mit.edu/system/moira/lib/mmoira.helpfile"},
- {"database", XtCString, XtRString, sizeof(String),
- Offset(db), XtRImmediate, (caddr_t) NULL},
- {"noAuth", XtCBoolean, XtRBoolean, sizeof(Boolean),
- Offset(noauth), XtRImmediate, (caddr_t) False},
- {"logSize", XtCValue, XtRInt, sizeof(int),
- Offset(maxlogsize), XtRImmediate, (caddr_t) MAXLOGSIZE},
-};
-
-#undef Offset
-
-XtActionsRec actions[] = {
- { "next-or-do-it", EnterPressed },
- { "cancel-form", CancelForm },
- { "execute-form", ExecuteForm },
- { "help", DoHelp }
-};
-
-
-Widget toplevel;
-char *user, *program_name, *moira_server;
-int tty;
-
-main(argc, argv)
-int argc;
-char *argv[];
-{
- Widget button, bboard, menuwidget;
- char *motd, *env, buf[256], host[64];
- int n, status;
- char *getlogin(), *getenv();
-
- /* I know, this is a crock, but it makes the program work... */
- env = getenv("XFILESEARCHPATH");
- if (env) {
- char buf[256];
- sprintf(buf, "%s:/afs/athena.mit.edu/system/moira/lib/%N", env);
- setenv("XFILESEARCHPATH", buf, 1);
- } else
- setenv("XFILESEARCHPATH", "/afs/athena.mit.edu/system/moira/lib/%N", 1);
-
- if (getenv("DISPLAY"))
- tty = 0;
- else
- tty = 1;
-
- if ((user = getlogin()) == NULL)
- user = getpwuid((int) getuid())->pw_name;
- user = (user && strlen(user)) ? strsave(user) : "";
-
- if ((program_name = strrchr(argv[0], '/')) == NULL)
- program_name = argv[0];
- else
- program_name++;
- program_name = strsave(program_name);
-
- resources.help_file = my_resources[3].default_addr;
- resources.maxlogsize = (int) my_resources[6].default_addr;
- resources.noauth = 0;
- resources.db = "";
- for (n = 1; n < argc; n++) {
- if (!strcmp(argv[n], "-db") && n+1 < argc) {
- resources.db = argv[n+1];
- n++;
- } else if (!strcmp(argv[n], "-helpfile") && n+1 < argc) {
- resources.help_file = argv[n+1];
- n++;
- } else if (!strcmp(argv[n], "-logsize") && n+1 < argc) {
- resources.maxlogsize = atoi(argv[n+1]);
- n++;
- } else if (!strcmp(argv[n], "-noauth")) {
- resources.noauth = 1;
- } else if (!strcmp(argv[n], "-tty")) {
- tty = 1;
- } else {
- printf("%s: unknown option: %s\n", argv[0], argv[n]);
- }
- }
-
- if (!tty) {
- toplevel = XtInitialize("toplevel", "Moira", options,
- XtNumber(options), &argc, argv);
-
- XtAppAddActions(XtWidgetToApplicationContext(toplevel),
- actions, XtNumber(actions));
-
- XtGetApplicationResources(toplevel, (caddr_t) &resources,
- my_resources, XtNumber(my_resources),
- NULL, (Cardinal) 0);
- }
-
- moira_server = "";
- if (resources.db)
- moira_server = resources.db;
-
-#ifdef GDSS
- initialize_gdss_error_table();
-#endif /* GDSS */
-
- status = mr_connect(moira_server);
- if (status) {
- com_err(program_name, status, " connecting to server");
- exit(1);
- }
- status = mr_motd(&motd);
- if (status) {
- com_err(program_name, status, " connecting to server");
- exit(1);
- }
- if (motd) {
- fprintf(stderr, "The Moira server is currently unavailable:\n%s\n",
- motd);
- mr_disconnect();
- exit(1);
- }
-
- if (!resources.noauth) {
- status = mr_auth("mmoira");
- if (status == MR_USER_AUTH) {
- char buf[BUFSIZ];
- com_err(program_name, status, "\nPress [RETURN] to continue");
- gets(buf);
- } else if (status) {
- com_err(program_name, status, "; authorization failed - may need to run kinit");
- exit(1);
- }
- }
-
- if (!tty) {
- bboard = XtCreateManagedWidget("bboard",
- xmBulletinBoardWidgetClass,
- toplevel, NULL, 0);
- menuwidget = BuildMenuTree(bboard, &MenuRoot);
- SetupLogWidget(bboard);
-
- XtRealizeWidget(toplevel);
-
- set_com_err_hook(popup_error_hook);
- mr_set_alternate_input(ConnectionNumber(XtDisplay(toplevel)),
- mr_x_input);
- }
-
- mr_host(host, sizeof(host));
- if (resources.noauth)
- sprintf(buf, "UNAUTHENTICATED connection to Moira server %s\n\n",
- host);
- else
- sprintf(buf, "Connected to Moira server %s\n\n", host);
- AppendToLog(buf);
-
- if (tty)
- TtyMainLoop();
- else
- XtMainLoop();
-}
-
-
-int MoiraQuery(query, argc, argv, callback, data)
-char *query;
-int argc;
-char **argv;
-int (*callback)();
-caddr_t data;
-{
- int status;
-
- if (!tty) {
- MakeWatchCursor(toplevel);
- XFlush(XtDisplay(toplevel));
- }
- status = mr_query(query, argc, argv, callback, data);
- if (status != MR_ABORTED && status != MR_NOT_CONNECTED) {
- if (!tty)
- MakeNormalCursor(toplevel);
- return(status);
- }
- status = mr_connect(moira_server);
- if (status) {
- com_err(program_name, status, " while re-connecting to server %s",
- moira_server);
- if (!tty)
- MakeNormalCursor(toplevel);
- return(MR_ABORTED);
- }
- status = mr_auth("mmoira");
- if (status) {
- com_err(program_name, status, " while re-authenticating to server %s",
- moira_server);
- mr_disconnect();
- if (!tty)
- MakeNormalCursor(toplevel);
- return(MR_ABORTED);
- }
- status = mr_query(query, argc, argv, callback, data);
- if (!tty)
- MakeNormalCursor(toplevel);
- return(status);
-
-}
-
-
-DisplayForm(spec)
-EntryForm *spec;
-{
- Widget w;
- int i, j;
- static XtTranslations trans = NULL;
-
- if (trans == NULL)
- trans = XtParseTranslationTable(resources.form_trans);
-
- w = CreateForm(toplevel, spec);
- XtManageChild(w);
- for (i = 0; spec->inputlines[i]; i++) {
- XtOverrideTranslations(spec->inputlines[i]->mywidget, trans);
- if (spec->inputlines[i]->type == FT_KEYWORD)
- for (j = 0; j < NumChildren(spec->inputlines[i]->mywidget); j++)
- XtOverrideTranslations(NthChild(spec->inputlines[i]->mywidget, j), trans);
- }
- /* set the focus to the first line of the form */
- _XmGrabTheFocus(spec->inputlines[0]->mywidget, NULL);
-}
-
-
-void popup_error_hook(who, code, fmt, arg1, arg2, arg3, arg4, arg5)
-char *who;
-long code;
-char *fmt;
-caddr_t arg1, arg2, arg3, arg4, arg5;
-{
- char buf[BUFSIZ], *cp;
-
- (void) strcpy(buf, who);
- for (cp = buf; *cp; cp++);
- *cp++ = ':';
- *cp++ = ' ';
- if (code) {
- (void) strcpy(cp, error_message(code));
- while (*cp)
- cp++;
- }
- sprintf(cp, fmt, arg1, arg2, arg3, arg4, arg5);
- display_error(buf);
-}
-
-
-void mr_x_input()
-{
- XEvent event;
- XtAppContext _XtDefaultAppContext();
-
- XtAppNextEvent(_XtDefaultAppContext(), &event);
- XtDispatchEvent(&event);
-}
+++ /dev/null
-# $Header$
-
-BEGIN { numfields = 0; nummenus = 0;
- printf("/* This file is machine generated, do not edit. */");
- printf("\n#include <Xm/Text.h>\n");
- printf("#include \"mmoira.h\"\n\n");
- }
-
-/^;/ { next }
-NF == 0 { next }
-
-$1 == "=" { if (menuname != "") {
- menuno = menumap[menuname] = nummenus++;
- printf("static MenuItem *menu%dsub[] = {\n", menuno);
- for (i = 0; i < count; i++)
- printf("\t&menu%d,\n", save[i]);
- printf("\t(MenuItem *) NULL\n};\n");
- printf("static MenuItem menu%d = { \"%s\", menu%dsub, %s };\n", \
- menuno, menuname, menuno, menuaccel);
- }
-
- menuname = $2;
- for (i = 3; (i <= NF) && (substr($i, 0, 1) != "\""); i++)
- menuname = sprintf("%s %s", menuname, $i);
- if (substr($i, 0, 1) == "\"")
- menuaccel = $i;
- else
- menuaccel = "NULL";
- count = 0;
- next
- }
-
-$NF == "}" { itemname = $1;
- for (i = 2; i <= NF && $i != "{"; i++)
- itemname = sprintf("%s %s", itemname, $i);
- menuno = nummenus++;
- if (i + 5 < NF)
- printf("static MenuItem menu%d = { \"%s\", NULL, %s, %s \"%s\", \"%s\", %d };\n", \
- menuno, itemname, $(i + 5), \
- $(i + 1), $(i + 2), $(i + 3), $(i + 4));
- else
- printf("static MenuItem menu%d = { \"%s\", NULL, NULL, %s \"%s\", \"%s\", %d };\n", \
- menuno, itemname, \
- $(i + 1), $(i + 2), $(i + 3), $(i + 4));
- save[count++] = menuno;
- next
- }
-
- { itemname = $1;
- for (i = 2; i <= NF && $i != "{"; i++)
- itemname = sprintf("%s %s", itemname, $i);
- save[count++] = menumap[itemname];
- next
- }
-
-END { menuno = menumap[menuname] = nummenus++;
- printf("static MenuItem *menu%dsub[] = {\n", menuno);
- for (i = 0; i < count; i++)
- printf("\t&menu%d,\n", save[i]);
- printf("\t(MenuItem *) NULL\n};\n");
- printf("MenuItem MenuRoot = { \"%s\", menu%dsub };\n", \
- menuname, menuno);
- printf("int NumMenus = %d;\n", nummenus);
- }
+++ /dev/null
-; $Header$
-;
-
-; = menu name "mnemonic"
-; label { operation, form_name query_name argc "mnemonic" }
-; or
-; submenu name
-
-
-= misc "s"
- show database statistics { MM_STATS, 0 get_all_table_stats 0 "s" }
- show active moira clients { MM_CLIENTS, 0 _list_users 0 "c" }
- show numeric value { MM_SHOW_VALUE, show_value get_value 1 "n" }
- show alias { MM_SHOW_ALIAS, show_alias get_alias 3 "a" }
-
-= server "r"
- show { MM_SHOW_HOST, show_host get_server_host_info 2 "s" }
- add { MM_ADD_HOST, add_host add_server_host_info 6 "a" }
- modify { MM_MOD_HOST, select_host get_server_host_info 2 "m" }
- delete { MM_DEL_HOST, select_host delete_server_host_info 2 "d" }
- reset server error { MM_CLEAR_HOST, select_host reset_server_host_error 2 "e" }
- reset server state { MM_RESET_HOST, select_host set_server_host_internal 9 "r" }
-
-= service "c"
- show { MM_SHOW_SERVICE, show_service get_server_info 1 "s" }
- add { MM_ADD_SERVICE, add_service add_server_info 8 "a" }
- modify { MM_MOD_SERVICE, select_service get_server_info 1 "m" }
- delete { MM_DEL_SERVICE, select_service delete_server_info 1 "d" }
- reset service error { MM_CLEAR_SERVICE, select_service reset_server_error 1 "e" }
- reset service state { MM_RESET_SERVICE, select_service set_server_internal_flags 6 "r" }
-
-= updates "d"
- show { MM_SHOW_DCM, 0 qualified_get_server 3 "s" }
- enable { MM_ENABLE_DCM, dcm_enable get_value 1 "e" }
- invoke { MM_TRIGGER_DCM, trigger_dcm trigger_dcm 0 "i" }
- service
- server
-
-= zephyr "z"
- show { MM_SHOW_ZEPHYR, show_zephyr get_zephyr_class 1 "s" }
- add { MM_ADD_ZEPHYR, add_zephyr add_zephyr_class 9 "a" }
- modify { MM_MOD_ZEPHYR, select_zephyr get_zephyr_class 1 "m" }
- delete { MM_DEL_ZEPHYR, select_zephyr delete_zephyr_class 1 "d" }
-
-= printer "r"
- show { MM_SHOW_PCAP, show_printer get_printcap_entry 1 "s" }
- add { MM_ADD_PCAP, add_printer add_printcap_entry 8 "a" }
- modify { MM_MOD_PCAP, select_printer get_printcap_entry 1 "m" }
- delete { MM_DEL_PCAP, del_printer delete_printcap_entry 1 "d" }
-
-= data "t"
- show { MM_SHOW_CLDATA, show_cldata get_cluster_data 2 "s" }
- add { MM_ADD_CLDATA, add_cldata add_cluster_data 3 "a" }
- delete { MM_DEL_CLDATA, del_cldata delete_cluster_data 3 "d" }
-
-= mappings "p"
- show { MM_SHOW_MCMAP, mcmap get_machine_to_cluster_map 2 "s" }
- add { MM_ADD_MCMAP, add_mcmap add_machine_to_cluster 2 "a" }
- delete { MM_DEL_MCMAP, del_mcmap delete_machine_from_cluster 2 "d" }
-
-= cluster "c"
- show { MM_SHOW_CLUSTER, show_cluster get_cluster 1 "s" }
- add { MM_ADD_CLUSTER, add_cluster add_cluster 3 "a" }
- modify { MM_MOD_CLUSTER, select_cluster get_cluster 1 "m" }
- delete { MM_DEL_CLUSTER, del_cluster delete_cluster 1 "d" }
- mappings
- data
-
-= machine "h"
- show { MM_SHOW_MACH, show_machine get_machine 1 "s" }
- add { MM_ADD_MACH, add_machine add_machine 2 "a" }
- modify { MM_MOD_MACH, select_machine get_machine 1 "m" }
- delete { MM_DEL_MACH, del_machine delete_machine 1 "d" }
-
-= member "m"
- show { MM_SHOW_MEMBERS, show_members get_members_of_list 1 "s" }
- add { MM_ADD_MEMBER, add_member add_member_to_list 3 "a" }
- delete { MM_DEL_MEMBER, del_member delete_member_from_list 3 "d" }
- delete member from all lists { MM_DEL_ALL_MEMBER, del_all_member get_lists_of_member 2 "l" }
-
-= list "l"
- show { MM_SHOW_LIST, show_list get_list_info 1 "s" }
- show all public mailing lists { MM_SHOW_MAILLIST, 0 qualified_get_lists 5 "p" }
- show all items a member can administer { MM_SHOW_ACE_USE, show_ace_use get_ace_use 2 "i" }
- add { MM_ADD_LIST, add_list add_list 10 "a" }
- modify { MM_MOD_LIST, select_list get_list_info 1 "m" }
- delete { MM_DEL_LIST, del_list delete_list 1 "d" }
-
-= quota "q"
- show { MM_SHOW_QUOTA, show_quota get_quota 3 "s" }
- add { MM_ADD_QUOTA, add_quota add_quota 4 "a" }
- modify { MM_MOD_QUOTA, mod_quota update_quota 4 "m" }
- delete { MM_DEL_QUOTA, del_quota delete_quota 3 "d" }
- show default { MM_SHOW_DQUOTA, 0 get_value 1 "w" }
- set default { MM_SET_DQUOTA, set_dquota set_value 2 "t" }
-
-= nfs partition "n"
- show { MM_SHOW_NFS, show_nfs get_nfsphys 2 "s" }
- add { MM_ADD_NFS, add_nfs add_nfsphys 6 "a" }
- modify { MM_MOD_NFS, select_nfs get_nfsphys 2 "m" }
- delete { MM_DEL_NFS, del_nfs delete_nfsphys 2 "d" }
-
-= alias "l"
- show { MM_SHOW_FS_ALIAS, show_fs_alias get_alias 3 "s" }
- add { MM_ADD_FS_ALIAS, add_fs_alias add_alias 3 "a" }
- delete { MM_DEL_FS_ALIAS, del_fs_alias delete_alias 3 "d" }
-
-= group "g"
- show { MM_SHOW_FSGROUP, show_fsgroup get_filesys_by_label 1 "s" }
- insert { MM_ADD_FSGROUP, add_fsgroup add_filesys_to_fsgroup 3 "i" }
- re-order { MM_MOV_FSGROUP, order_fsgroup add_filesys_to_fsgroup 3 "o" }
- remove { MM_DEL_FSGROUP, del_fsgroup remove_filesys_from_fsgroup 2 "r" }
-
-= filesystem "f"
- show { MM_SHOW_FILSYS, show_filsys get_filesys_by_label 1 "s" }
- add { MM_ADD_FILSYS, add_filsys add_filesys 11 "a" }
- modify { MM_MOD_FILSYS, select_filsys get_filesys_by_label 1 "m" }
- delete { MM_DEL_FILSYS, del_filsys delete_filesys 1 "d" }
- group
- alias
- nfs partition
-
-= kerberos mapping "k"
- show { MM_SHOW_KRBMAP, show_krbmap get_kerberos_user_map 2 "s" }
- add { MM_ADD_KRBMAP, add_krbmap add_kerberos_user_map 2 "a" }
- delete { MM_DEL_KRBMAP, del_krbmap delete_kerberos_user_map 2 "d" }
-
-= pobox "p"
- show { MM_SHOW_POBOX, select_pobox get_pobox 1 "s" }
- set { MM_SET_POBOX, set_pobox set_pobox 3 "t" }
- reset { MM_RESET_POBOX, reset_pobox set_pobox_pop 1 "r" }
- delete { MM_DEL_POBOX, del_pobox delete_pobox 1 "d" }
-
-= user "u"
- show { MM_SHOW_USER, show_user get_user_account_by_login 1 "s" }
- add { MM_ADD_USER, add_user add_user_account 9 "a" }
- register { MM_REGISTER, register_user register_user 3 "r" }
- modify { MM_MOD_USER, select_user get_user_account_by_login 1 "m" }
- deactivate { MM_DEACTIVATE, deactivate_user update_user_status 2 "d" }
- expunge { MM_EXPUNGE, expunge_user delete_user 1 "x" }
- show finger info { MM_SHOW_FINGER, show_finger get_finger_by_login 1 "f" }
- modify finger info { MM_MOD_FINGER, select_finger get_finger_by_login 1 }
- kerberos mapping
-
-= ?help "?"
- about moira { MM_HELP_MOIRA, 0 about_moira 0 "a" }
- wildcards { MM_HELP_WILDCARDS, 0 wildcards 0 "w" }
- using the mouse { MM_HELP_MOUSE, 0 mouse 0 "m" }
- using the keyboard { MM_HELP_KEYBOARD, 0 keyboard 0 "k" }
- reporting bugs { MM_HELP_BUGS, 0 bugs 0 "b" }
- authors { MM_HELP_AUTHORS, 0 authors 0 "u" }
-
-= file "i"
- save log buffer { MM_SAVE_LOG, save_log 0 0 "l" }
- quit { MM_QUIT, 0 0 0 "q" }
-
-= toplevel
- file
- user
- pobox
- list
- member
- filesystem
- quota
- machine
- cluster
- printer
- zephyr
- updates
- misc
- ?help
+++ /dev/null
-/* $Header$ */
-
-#include "data.h"
-
-extern EntryForm *GetAndClearForm(), *GetForm();
-extern char *user, *program_name;
-extern int tty;
-extern char *user_states[], *nfs_states[];
-extern char *StringValue();
-extern int DisplayCallback(), MoiraValueChanged();
-extern int NumChildren();
-extern Widget NthChild();
-
-typedef struct _MoiraResources {
- String form_trans;
- String text_trans;
- String log_trans;
- String help_file;
- String db;
- Boolean noauth;
- int maxlogsize;
-} MoiraResources;
-extern MoiraResources resources;
-
-#define HELPFILE "/usr/athena/lib/moira.help"
-#define MAXLOGSIZE 10000
-
-#define MM_STATS 1
-#define MM_CLIENTS 2
-#define MM_SHOW_VALUE 3
-#define MM_SHOW_ALIAS 4
-#define MM_SHOW_HOST 5
-#define MM_ADD_HOST 6
-#define MM_MOD_HOST 7
-#define MM_DEL_HOST 8
-#define MM_CLEAR_HOST 9
-#define MM_RESET_HOST 10
-#define MM_SHOW_SERVICE 11
-#define MM_ADD_SERVICE 12
-#define MM_MOD_SERVICE 13
-#define MM_DEL_SERVICE 14
-#define MM_CLEAR_SERVICE 15
-#define MM_RESET_SERVICE 16
-#define MM_SHOW_DCM 17
-#define MM_ENABLE_DCM 18
-#define MM_TRIGGER_DCM 19
-#define MM_SHOW_ZEPHYR 20
-#define MM_ADD_ZEPHYR 21
-#define MM_MOD_ZEPHYR 22
-#define MM_DEL_ZEPHYR 23
-#define MM_SHOW_PCAP 24
-#define MM_ADD_PCAP 25
-#define MM_MOD_PCAP 26
-#define MM_DEL_PCAP 27
-#define MM_SHOW_CLDATA 28
-#define MM_ADD_CLDATA 29
-#define MM_DEL_CLDATA 30
-#define MM_SHOW_MCMAP 31
-#define MM_ADD_MCMAP 32
-#define MM_DEL_MCMAP 33
-#define MM_SHOW_CLUSTER 34
-#define MM_ADD_CLUSTER 35
-#define MM_MOD_CLUSTER 36
-#define MM_DEL_CLUSTER 37
-#define MM_SHOW_MACH 38
-#define MM_ADD_MACH 39
-#define MM_MOD_MACH 40
-#define MM_DEL_MACH 41
-#define MM_SHOW_MEMBERS 42
-#define MM_ADD_MEMBER 43
-#define MM_DEL_MEMBER 44
-#define MM_DEL_ALL_MEMBER 45
-#define MM_SHOW_LIST 46
-#define MM_SHOW_MAILLIST 47
-#define MM_SHOW_ACE_USE 48
-#define MM_ADD_LIST 49
-#define MM_MOD_LIST 50
-#define MM_DEL_LIST 51
-#define MM_SHOW_QUOTA 52
-#define MM_ADD_QUOTA 53
-#define MM_MOD_QUOTA 54
-#define MM_DEL_QUOTA 55
-#define MM_SHOW_DQUOTA 56
-#define MM_SET_DQUOTA 57
-#define MM_SHOW_NFS 58
-#define MM_ADD_NFS 59
-#define MM_MOD_NFS 60
-#define MM_DEL_NFS 61
-#define MM_SHOW_FS_ALIAS 62
-#define MM_ADD_FS_ALIAS 63
-#define MM_DEL_FS_ALIAS 64
-#define MM_SHOW_FSGROUP 65
-#define MM_ADD_FSGROUP 66
-#define MM_MOV_FSGROUP 67
-#define MM_DEL_FSGROUP 68
-#define MM_SHOW_FILSYS 69
-#define MM_ADD_FILSYS 70
-#define MM_MOD_FILSYS 71
-#define MM_DEL_FILSYS 72
-#define MM_SHOW_KRBMAP 73
-#define MM_ADD_KRBMAP 74
-#define MM_DEL_KRBMAP 75
-#define MM_SHOW_POBOX 76
-#define MM_SET_POBOX 77
-#define MM_DEL_POBOX 78
-#define MM_SHOW_USER 79
-#define MM_ADD_USER 80
-#define MM_REGISTER 81
-#define MM_MOD_USER 82
-#define MM_DEACTIVATE 83
-#define MM_EXPUNGE 84
-#define MM_SHOW_FINGER 85
-#define MM_MOD_FINGER 86
-#define MM_RESET_POBOX 87
-#define MM_HELP_MOIRA 88
-#define MM_HELP_WILDCARDS 89
-#define MM_HELP_AUTHORS 90
-#define MM_HELP_BUGS 91
-#define MM_SAVE_LOG 92
-#define MM_NEW_VALUE 93
-#define MM_QUIT 94
-#define MM_HELP_KEYBOARD 95
-#define MM_HELP_MOUSE 96
+++ /dev/null
-/* $Header$
- *
- * TOPS-20 style command parser
- *
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/signal.h>
-#include <X11/Intrinsic.h>
-#include "mmoira.h"
-#include "parser.h"
-
-
-/* trivial absolute-value macro */
-#define abs(i) ((i) < 0 ? -(i) : (i))
-
-/* message used when end of parse tree is reached */
-char eolmsg[] = "return to execute command";
-
-
-/* main entry point. Takes the prompt and top node of the parse tree, and
- * will collect user's input, providing help and completion. When entry
- * is complete (<return> is pressed), the actions called for by each node
- * in the parse tree which is traversed will be executed.
- */
-
-int parser(prompt, nd)
-char *prompt;
-struct parse_node *nd;
-{
- char line[BUFLEN];
- char *p, c;
- int val;
-
- p = &line[0];
- *p = 0;
- write(1, prompt, strlen(prompt));
- for (c = (getchar() & 0x7F); 1; c = (getchar() & 0x7F)) {
- if (c == 0)
- continue;
- switch (c) {
- case 127:
- case '\b':
- if (p == &line[0]) {
- putchar(7);
- break;
- }
- if (*(--p) == 'I' - '@') {
- *p = 0;
- printf("\r%s%s", prompt, line);
- fflush(stdout);
- break;
- }
- *p = 0;
- write(1, "\b \b", 3);
- break;
- case 'C' - '@':
- case 'G' - '@':
- write(1, " \007ABORT\r\n", 9);
- return(ABORT);
- case 'Q' - '@':
- case 'V' - '@':
- putchar('\\');
- c = getchar();
- if (c < ' ')
- printf("\b^%c", c + '@');
- else
- printf("\b%c", c);
- fflush(stdout);
- *p++ = c;
- break;
- case 'W' - '@':
- if (p > &line[0])
- p--;
- while ((p >= &line[0]) && isspace(*p)) {
- write(1, "\b \b", 3);
- p--;
- }
- while ((p >= &line[0]) && !isspace(*p)) {
- write(1, "\b \b", 3);
- p--;
- }
- if (p > &line[0]) {
- p++;
- } else {
- p = &line[0];
- }
- *p = 0;
- break;
- case '?':
- write(1, "? ", 3);
- *p = 0;
- do_help(&line[0], nd, prompt);
- p = &line[strlen(line)];
- printf("\n\r%s%s", prompt, line);
- fflush(stdout);
- break;
- case '[' - '@':
- case '\t':
- *p = 0;
- do_complete(&line[0], nd, prompt);
- p = &line[strlen(line)];
- break;
- case 'Z' - '@':
- printf("\r\n");
- cooked_mode();
- kill(getpid(), SIGSTOP);
- raw_mode();
- /* when continued, fall through to */
- case 'R' - '@':
- *p = 0;
- printf("\r\n%s%s", prompt, line);
- fflush(stdout);
- break;
- case 'U' - '@':
- while (p-- > &line[0])
- write(1, "\b \b", 3);
- *(++p) = 0;
- printf("\r%s", prompt);
- fflush(stdout);
- break;
- case '\n':
- case '\r':
- if ((val = do_parse(line, nd, prompt)) != ERROR) {
- write(1, "\r\n", 2);
- return(val);
- }
- p = &line[strlen(line)];
- *p = 0;
- printf("\r\n%s%s", prompt, line);
- fflush(stdout);
- break;
- default:
- putchar(c);
- *p++ = c;
- *p = 0;
- }
- }
-}
-
-
-/* called when a ? is typed. This parses the line as far as possible, then
- * displays possible completions and help strings.
- */
-
-do_help(line, nod, prompt)
-char *line;
-struct parse_node *nod;
-char *prompt;
-{
- char *ln;
- struct parse_node *n, *nd, *last;
- int kw, state, nomatch;
- struct parse_node *best, *ambig;
-
- n = nod;
- state = MATCH;
- best = NULNODE;
- for (ln = line; n && state == MATCH; best && (n = best->p_next)) {
- last = best;
- state = single_parse(&ln, n, &best, &ambig, &nomatch);
- }
- if (*ln && ((best && best->p_menu) || n == NULNODE))
- state = NOMATCH;
- switch (state) {
- case NOMATCH:
- if (!*ln) {
- if (last && last->p_menu && *line)
- printf("Carriage return, or ");
- break;
- }
- ln += nomatch;
- *ln = 0;
- write(1, "\r\nNOT a valid command line", 26);
- return;
- case AMBIG:
- write(1, "one of the following:\r\n ", 26);
- for (; ambig; ambig = ambig->p_link)
- printf("%s ", ambig->p_word);
- fflush(stdout);
- return;
- case INCOMP:
- printf("one of the following:\r\n %s", best->p_word);
- fflush(stdout);
- return;
- default:
- write(1, eolmsg, strlen(eolmsg));
- return;
- }
- kw = 0;
- for (nd = n; nd; nd = nd->p_peer) {
- if (!kw) {
- write(1, "one of the following:\r\n ", 26);
- kw = 3;
- }
- if (kw + strlen(nd->p_word) > 72) {
- printf("\r\n %s ", nd->p_word);
- fflush(stdout);
- kw = 4 + strlen(nd->p_word);
- } else {
- printf("%s ", nd->p_word);
- fflush(stdout);
- kw += 1 + strlen(nd->p_word);
- }
- }
-}
-
-
-/* Do escape processing. If a unique completion exists, use it. Otherwise,
- * do the same as ?.
- */
-
-do_complete(line, nod, prompt)
-char *line;
-struct parse_node *nod;
-char *prompt;
-{
- struct parse_node *n, *nd;
- char *ln;
- char *tmp;
- int state, nomatch;
- struct parse_node *best, *ambig;
-
- ln = line;
- state = MATCH;
- nd = nod;
- while (state == MATCH) {
- tmp = ln;
- state = single_parse(&ln, nd, &best, &ambig, &nomatch);
- if (state == MATCH)
- nd = best->p_next;
- }
- switch (state) {
- case AMBIG:
-/* printf("ln %X, tmp %X, ln - tmp %d, nomatch %d\r\n", ln, tmp, ln-tmp, nomatch);
- if (ln - tmp < nomatch) {
- printf("attempting partial complete\r\n");
- fflush(stdout);
- sleep(1);
- while ((ln > line) && !isspace(*ln))
- ln--;
- tmp = ambig->p_word;
- while (nomatch--)
- *ln++ = *tmp++;
- *ln = 0;
- putchar(7);
- return;
- } */
- /* fall through to: */
- case NOMATCH:
- if (!(nd) || (nd->p_peer)) {
- write(1, " ", 2);
- do_help(line, nod, prompt);
- printf("\r\n%s%s", prompt, line);
- fflush(stdout);
- return;
- }
- best = nd;
- *ln++ = 'x';
- /* fall through to incomplete case */
- case INCOMP:
- ln = tmp;
- do {
- tmp = best->p_word;
- while (*tmp)
- *ln++ = *tmp++;
- *ln++ = ' ';
- *ln = 0;
- } while (best->p_next && !best->p_next->p_peer &&
- !best->p_menu && (best = best->p_next));
- printf("\r%s%s", prompt, line);
- fflush(stdout);
- break;
- default:
- write(1, "We shouldn't get here (parser error)\r\n", 38);
- }
-}
-
-
-/* Single parse parses through a single level of the parse tree.
- * There are 4 possible outcomes:
- * an exact match is made: the matching node is returned, ambig = 0
- * an incomplete match: the matching node is returned, ambig = node
- * ambiguous: nothing is returned, ambig = list of completions
- * no matches: nothing is returned, ambig = 0
- */
-
-int single_parse(line, nd, best, ambig, nomatch)
-char **line;
-struct parse_node *nd;
-struct parse_node **best;
-struct parse_node **ambig;
-int *nomatch;
-{
- char *p;
- char c; /* char we're working on (from line) */
- struct parse_node *n; /* node loop counter */
- struct parse_node *tail; /* tmp used to build chains */
- int i; /* loop counter */
- int match; /* how many chars have we matched? */
- int len; /* length of this keyword */
-
-#ifdef DEBUG
- printf("single_parse(\"%s\") -> ", *line);
-#endif /* DEBUG */
- *ambig = tail = *best = NULNODE;
- match = *nomatch = 0;
- /* skip leading whitespace */
- while (isspace(**line))
- (*line)++;
- /* step through each node */
- for (n = nd; n; n = n->p_peer) {
- len = strlen(n->p_word);
- /* step through each character in line */
- for (i = 0; 1; i++) {
- /* if at end of word on line */
- if (isspace((*line)[i]) || (*line)[i] == 0) {
- /* another ambiguous match */
- if (i == match && i) {
- tail->p_link = n;
- tail = n;
- n->p_link = NULNODE;
- }
- /* a better match */
- if (i > match) {
- match = i;
- *best = tail = *ambig = n;
- n->p_link = NULNODE;
- }
- break;
- }
- if (isupper(c = (*line)[i]))
- c = tolower(c);
- if (c != n->p_word[i]) {
- if (i > *nomatch)
- *nomatch = i;
- break;
- }
- }
- }
- if (match > 0) {
- (*line) += match;
- if (tail != *ambig) {
- *best = NULNODE;
- *nomatch = match;
- if (isspace(**line)) {
-#ifdef DEBUG
- printf("NOMATCH\n");
-#endif /* DEBUG */
- return(NOMATCH);
- } else {
-#ifdef DEBUG
- printf("AMBIG\n");
-#endif /* DEBUG */
- return(AMBIG);
- }
- }
- if (isspace(**line)) {
- *ambig = NULNODE;
- while (isspace(**line))
- (*line)++;
-#ifdef DEBUG
- printf("MATCH\n");
-#endif /* DEBUG */
- return(MATCH);
- }
-#ifdef DEBUG
- printf("INCOMP\n");
-#endif /* DEBUG */
- return(INCOMP);
- }
- *ambig = tail = *best = NULNODE;
-#ifdef DEBUG
- printf("NOMATCH\n");
-#endif /* DEBUG */
- return(NOMATCH);
-}
-
-
-/* execute the line. First check to see that the line is legal. If not,
- * do_help the line & return ERROR. If so, execute each node passed through,
- * and return OK (or EXIT if an EXIT node was encountered).
- */
-
-int do_parse(line, nod, prompt)
-char *line;
-struct parse_node *nod;
-char *prompt;
-{
- struct parse_node *n, *nd, *last;
- char *ln, *tmp;
- int state, i;
- struct parse_node *best, *ambig;
- int nomatch;
- EntryForm *f;
-
- ln = line;
- n = nod;
- state = MATCH;
- best = NULNODE;
- while (n && ((state == MATCH) || (state == INCOMP))) {
- last = best;
- state = single_parse(&ln, n, &best, &ambig, &nomatch);
-#ifdef DEBUG
- printf("best = %s, best->next = 0x%x\r\n", best ? best->p_word : "",
- best ? best->p_next : 0);
-#endif /* DEBUG */
- if ((state == NOMATCH) && (!*ln) && (n == nod))
- return(OK);
- if ((state == MATCH) || (state == INCOMP)) {
- n = best->p_next;
- }
- }
- if (((state == AMBIG) || (state == NOMATCH)) && !*ln)
- for (; n; n = n->p_peer)
- if (last && last->p_menu) {
- n = last;
- state = MATCH;
- break;
- }
- if (state == NOMATCH && !*ln) {
- while (last && last->p_next && !last->p_next->p_peer && !last->p_menu)
- last = last->p_next;
- if (last && last->p_menu) {
- state = MATCH;
- best = last;
- }
- }
-
- if ((state == NOMATCH) || (state == AMBIG)) {
- write(1, " BAD command, ", 16);
- do_help(line, nod, prompt);
- return(ERROR);
- }
- if (!best)
- best = n;
- write(1, "\r\n", 2);
- cooked_mode();
- for (i = 0; line[i] && !isspace(line[i]); i++);
- if (!strncmp("help", line, i))
- help(best->p_menu->form);
- else
- MoiraMenuRequest(best->p_menu);
- raw_mode();
- return(OK);
-}
+++ /dev/null
-/* $Header$
- * Constants and structures for TOPS-20 style parser
- *
- */
-
-/* type codes for nodes & return values in parse tree */
-#define NONE 0
-#define KEYWORD 1
-#define INTEGER 2
-#define STRING 3
-#define ADDRESS 4
-#define PROC 5
-#define ERROR 6
-#define EXIT 7
-#define ABORT 8
-
-
-/* return codes from single_parse */
-#define OK 0
-#define MATCH 1 /* exact match found */
-#define INCOMP 2 /* incomplete field */
-#define AMBIG 3 /* ambiguous response */
-#define NOMATCH 4 /* no match */
-
-
-/* maximum line length for parser */
-#define BUFLEN 128
-
-/* the nodes which make up the parse tree */
-
-struct parse_node {
- char *p_word; /* keyword, data description */
- MenuItem *p_menu; /* MMoira menu entry for this command */
- struct parse_node *p_peer; /* next node this level */
- struct parse_node *p_next; /* next level nodes */
- struct parse_node *p_link; /* for temporary chains */
-};
-
-
-#define NULNODE ((struct parse_node *) 0)
-
-
-/* this structure is used for collecting data to pass to parse functions */
-
-#define pval struct pvalst
-
-pval {
- char *p_dat; /* data value or pointer */
- int p_free; /* size of data to free */
-};
-
-/* how many return values are allowed in a single parse */
-#define PMAXDAT 8
+++ /dev/null
-/* $Header$
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <moira.h>
-#include <moira_site.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <netdb.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <Xm/Xm.h>
-#include "mmoira.h"
-#ifdef GDSS
-#include <des.h>
-#include <krb.h>
-#include <gdss.h>
-#endif /* GDSS */
-
-
-/* Called with moira data that is to be modified. */
-
-int ModifyCallback(argc, argv, form)
-int argc;
-char **argv;
-EntryForm *form;
-{
- EntryForm *f;
- char *fn;
- int count, i, offset;
-
- count = -1;
- offset = 0;
- switch (form->menu->operation) {
- case MM_MOD_USER:
- count = 0;
- f = GetAndClearForm("mod_user");
- if (f == NULL) {
- display_error("Unknown form in ModifyCallback!\n");
- return;
- }
- f->extrastuff = form->extrastuff;
- f->menu = form->menu;
- for (i = 0; i < U_SIGNATURE; i++)
- if (f->inputlines[i]->type == FT_BOOLEAN)
- f->inputlines[i]->returnvalue.booleanvalue =
- strcmp(argv[i + offset], "0") ? 1 : 0;
- else
- StoreField(f, i, argv[i + offset]);
- f->inputlines[U_SIGNATURE]->keyword_name = strsave(argv[U_SIGNATURE]);
- f->inputlines[U_SIGNATURE]->returnvalue.booleanvalue =
- strcmp(argv[U_SECURE], "0") ? 1 : 0;
- f->inputlines[U_COMMENT]->keyword_name = strsave(argv[U_SECURE]);
- return;
- case MM_MOD_FINGER:
- fn = "mod_finger";
- count = F_MODTIME - 1;
- offset = 1;
- break;
- case MM_REGISTER:
- if (form->extrastuff)
- form->extrastuff = NULL;
- else
- form->extrastuff = strsave(argv[U_UID]);
- return;
- break;
- case MM_MOD_LIST:
- fn = "mod_list";
- count = L_MODTIME;
- break;
- case MM_MOD_FILSYS:
- f = GetAndClearForm("mod_filsys");
- if (f == NULL) {
- display_error("Unknown form in ModifyCallback!\n");
- return;
- }
- f->extrastuff = form->extrastuff;
- f->menu = form->menu;
- StoreField(f, FS_NAME, argv[FS_NAME + offset]);
- StoreField(f, FS_TYPE, argv[FS_TYPE + offset]);
- for (i = FS_TYPE+1; i < FS_MODTIME-1; i++)
- if (f->inputlines[i+1]->type == FT_BOOLEAN)
- f->inputlines[i+1]->returnvalue.booleanvalue =
- strcmp(argv[i + offset], "0") ? 1 : 0;
- else
- StoreField(f, i+1, argv[i + offset]);
- StoreField(f, FS_TYPE+1, argv[FS_L_TYPE + offset]);
- return;
- break;
- case MM_MOD_NFS:
- f = GetAndClearForm("mod_nfs");
- if (f == NULL) {
- display_error("Unknown form in ModifyCallback of mod_nfs\n");
- return;
- }
- f->extrastuff = form->extrastuff;
- f->menu = form->menu;
- StoreField(f, 0, argv[0]);
- StoreField(f, 1, argv[1]);
- StoreField(f, 2, argv[2]);
- f->inputlines[3]->keywords = nfs_states;
- for (i = 0; nfs_states[i]; i++)
- if (atoi(nfs_states[i]) & atoi(argv[3]))
- StoreField(f, 3, nfs_states[i]);
- if (atoi(argv[3]) & MR_FS_GROUPQUOTA)
- f->inputlines[4]->returnvalue.booleanvalue = 1;
- else
- f->inputlines[4]->returnvalue.booleanvalue = 0;
- StoreField(f, 5, argv[4]);
- StoreField(f, 6, argv[5]);
- return;
- case MM_MOD_MACH:
- fn = "mod_machine";
- count = M_MODTIME;
- break;
- case MM_MOD_CLUSTER:
- fn = "mod_cluster";
- count = C_MODTIME;
- break;
- case MM_MOD_PCAP:
- fn = "mod_printer";
- count = PCAP_MODTIME;
- break;
- case MM_MOD_SERVICE:
- f = GetAndClearForm("mod_service");
- if (f == NULL) {
- display_error("Unknown form in ModifyCallback of mod_service\n");
- return;
- }
- f->extrastuff = form->extrastuff;
- f->menu = form->menu;
- for (i = 0; i < 4; i++) StoreField(f, i, argv[i]);
- StoreField(f, 4, argv[6]);
- f->inputlines[5]->returnvalue.booleanvalue = atoi(argv[7]);
- StoreField(f, 6, argv[11]);
- StoreField(f, 7, argv[12]);
- return;
- break;
- case MM_MOD_HOST:
- f = GetAndClearForm("mod_host");
- if (f == NULL) {
- display_error("Unknown form in ModifyCallback of mod_host\n");
- return;
- }
- f->extrastuff = form->extrastuff;
- f->menu = form->menu;
- StoreField(f, 0, argv[0]);
- StoreField(f, 1, argv[1]);
- f->inputlines[2]->returnvalue.booleanvalue = atoi(argv[2]);
- StoreField(f, 3, argv[10]);
- StoreField(f, 4, argv[11]);
- StoreField(f, 5, argv[12]);
- return;
- break;
- }
-
- if (count > 0) {
- f = GetAndClearForm(fn);
- if (f == NULL) {
- display_error("Unknown form in ModifyCallback!\n");
- return;
- }
- f->extrastuff = form->extrastuff;
- f->menu = form->menu;
- for (i = 0; i < count; i++)
- if (f->inputlines[i]->type == FT_BOOLEAN)
- f->inputlines[i]->returnvalue.booleanvalue =
- strcmp(argv[i + offset], "0") ? 1 : 0;
- else
- StoreField(f, i, argv[i + offset]);
- } else {
- display_error("Unknown function in ModifyCallback!\n");
- return;
- }
-}
-
-
-/* Generate a new cryptographic signature for the user record */
-SignUser(argv, offset)
-char **argv;
-int offset;
-{
-#ifdef GDSS
- char buf[256];
- SigInfo si;
- int i;
-
- if (strcmp(argv[U_NAME + offset], UNIQUE_LOGIN)) {
- sprintf(buf, "%s:%s", argv[U_NAME + offset], argv[U_MITID + offset]);
- si.rawsig = NULL;
- i = GDSS_Verify(buf, strlen(buf), argv[U_SIGNATURE + offset], &si);
- /* If it's already signed OK, don't resign it. */
- if (i != GDSS_SUCCESS) {
- free(argv[U_SIGNATURE + offset]);
- argv[U_SIGNATURE + offset] = (char *) malloc(GDSS_Sig_Size() * 2);
- sign_again:
- i = GDSS_Sign(buf, strlen(buf), argv[U_SIGNATURE + offset]);
- if (i != GDSS_SUCCESS)
- com_err(program_name, gdss2et(i),
- "Failed to create signature");
- else {
- unsigned char newbuf[256];
- si.rawsig = newbuf;
- i = GDSS_Verify(buf, strlen(buf),
- argv[U_SIGNATURE + offset], &si);
- if (strlen(newbuf) > 68) {
-#ifdef DEBUG
- AppendLog("Signature too long, trying again\n");
-#endif /* DEBUG */
- goto sign_again;
- }
- }
-#ifdef DEBUG
- AppendLog("Made signature:");hex_dump(argv[U_SIGNATURE + offset]);
- } else {
- AppendLog("Don't need to remake signature\n");
-#endif /* DEBUG */
- }
- }
-#else /* GDSS */
- argv[U_SIGNATURE + offset] = strsave("");
-#endif /* GDSS */
-}
-
-
-/* when OK pressed */
-
-MoiraFormComplete(dummy1, form)
-int dummy1;
-EntryForm *form;
-{
- process_form(form, TRUE);
-}
-
-
-/* when APPLY pressed */
-
-MoiraFormApply(dummy1, form)
-int dummy1;
-EntryForm *form;
-{
- UserPrompt **p;
- int count;
-
- /* undocumented Motif internal routine to advance in tab group.
- * In this case we're going backwards because for some reason
- * the form advances whenever this button is pressed.
- * However, it doesn't seem to go backwards even though source
- * implies that it should. So we go forward until we wrap.
- */
- count = 0;
- for (p = form->inputlines; *p; p++)
- if (!((*p)->insensitive))
- count++;
- while (count-- > 1)
- _XmMgrTraversal(form->formpointer, XmTRAVERSE_PREV_TAB_GROUP);
- MoiraFocusOut(form->inputlines[0]->mywidget,
- (XEvent *)NULL, (String *)NULL, 0);
- process_form(form, FALSE);
-}
-
-
-int CollectData(argc, argv, form)
-int argc;
-char **argv;
-EntryForm *form;
-{
- struct save_queue *sq;
-
- sq = (struct save_queue *) form->extrastuff;
- sq_save_data(sq, strsave(argv[0]));
- return(MR_CONT);
-}
-
-
-/* callback when form is complete to process the data */
-
-process_form(form, remove)
-EntryForm *form;
-int remove;
-{
- char *qy, *argv[32], buf[256], *s, **aargv;
- int (*retfunc)(), argc, i;
- EntryForm *f;
-
- retfunc = DisplayCallback;
- argc = -1;
-
- for (i = 0; form->inputlines[i]; i++)
- argv[i] = StringValue(form, i);
- qy = form->menu->query;
- argc = form->menu->argc;
-
- switch (form->menu->operation) {
- case MM_SHOW_USER:
- if (*stringval(form, 0)) {
- qy = "get_user_account_by_login";
- argv[0] = stringval(form, 0);
- argc = 1;
- } else if (*stringval(form, 3)) {
- qy = "get_user_account_by_uid";
- argv[0] = stringval(form, 3);
- argc = 1;
- } else if (*stringval(form, 4)) {
- qy = "get_user_account_by_class";
- argv[0] = stringval(form, 4);
- argc = 1;
- } else if (*stringval(form, 1) == 0 &&
- *stringval(form, 2) == 0) {
- display_error("Must fill in at least one blank.");
- return;
- } else {
- if (*stringval(form, 1) == 0)
- StoreField(form, 1, "*");
- if (*stringval(form, 2) == 0)
- StoreField(form, 2, "*");
- qy = "get_user_account_by_name";
- argv[0] = stringval(form, 1);
- argv[1] = stringval(form, 2);
- argc = 2;
- }
- break;
- case MM_ADD_USER:
- argv[U_STATE][1] = 0;
- argv[U_SECURE] = argv[U_SIGNATURE];
- SignUser(argv, 0);
- argc = U_MODTIME;
- break;
- case MM_MOD_USER:
- if (!strcmp(form->formname, "mod_user")) {
- qy = "update_user_account";
- for (i = 0; i < U_SIGNATURE; i++)
- argv[i + 1] = StringValue(form, i);
- argv[0] = form->extrastuff;
- argv[U_STATE + 1][1] = 0;
- argv[U_SIGNATURE + 1] = form->inputlines[U_SIGNATURE]->keyword_name;
- argv[U_SECURE + 1] = StringValue(form, U_SIGNATURE);
- if (*argv[U_SECURE + 1] == '1')
- if (atoi(form->inputlines[U_COMMENT]->keyword_name))
- argv[U_SECURE + 1] = form->inputlines[U_COMMENT]->keyword_name;
- else {
- struct timeval tv;
- char buf[32];
- gettimeofday(&tv, NULL);
- printf("Got %ld, %ld\n", tv.tv_sec, tv.tv_usec);
- sprintf(buf, "%ld", tv.tv_sec);
- argv[U_SECURE + 1] = strsave(buf);
- }
- SignUser(argv, 1);
- argc = U_MODTIME + 1;
- break;
- }
- form->extrastuff = (caddr_t) "mod_user";
- retfunc = ModifyCallback;
- break;
- case MM_REGISTER:
- if (*stringval(form, 2)) {
- argv[0] = stringval(form, 2);
- } else {
- argv[0] = stringval(form, 0);
- argv[1] = stringval(form, 1);
- form->extrastuff = NULL;
- i = MoiraQuery("get_user_account_by_name", 2, argv,
- ModifyCallback, (char *)form);
- if (i) {
- com_err(program_name, i, " looking up user by name");
- return;
- }
- if (form->extrastuff == NULL) {
- display_error("Ambiguous user specification");
- return;
- }
- argv[0] = (char *)form->extrastuff;
- }
- qy = "register_user";
- argv[1] = stringval(form, 3);
- argv[2] = "1";
- argc = 3;
- break;
- case MM_DEACTIVATE:
- argv[1] = "3";
- break;
- case MM_EXPUNGE:
- display_error("Expunge is not yet implemented");
- return;
- break;
- case MM_MOD_FINGER:
- if (!strcmp(form->formname, "mod_finger")) {
- qy = "update_finger_by_login";
- for (i = 0; i < F_MODTIME - 1; i++)
- argv[i + 1] = StringValue(form, i);
- argv[0] = form->extrastuff;
- argc = F_MODTIME;
- break;
- }
- form->extrastuff = (caddr_t) "mod_finger";
- retfunc = ModifyCallback;
- break;
- case MM_SHOW_KRBMAP:
- if (!*stringval(form, 0))
- argv[0] = "*";
- if (!*stringval(form, 1))
- argv[1] = "*";
- AppendToLog("Kerberos mappings:\n");
- break;
- case MM_SET_POBOX:
- if (!strcmp(argv[1], "POP"))
- argv[2] = stringval(form, 3);
- break;
- case MM_SHOW_ACE_USE:
- if (boolval(form, 2)) {
- sprintf(buf, "R%s", stringval(form, 0));
- argv[0] = strsave(buf);
- }
- sprintf(buf, "Objects %s %s can administer\n",
- stringval(form, 0), stringval(form, 1));
- AppendToLog(buf);
- break;
- case MM_MOD_LIST:
- if (!strcmp(form->formname, "mod_list")) {
- qy = "update_list";
- for (i = 0; i < L_MODTIME; i++)
- argv[i + 1] = StringValue(form, i);
- argv[0] = form->extrastuff;
- argc = L_MODTIME + 1;
- break;
- }
- form->extrastuff = (caddr_t) "mod_list";
- retfunc = ModifyCallback;
- break;
- case MM_SHOW_MEMBERS:
- if (!*stringval(form, 0)) {
- qy = "get_lists_of_member";
- argv[0] = stringval(form, 1);
- sprintf(buf, "Lists of %s %s:\n", stringval(form, 1), argv[2]);
- AppendToLog(buf);
- if (boolval(form, 3)) {
- sprintf(buf, "R%s", stringval(form, 1));
- argv[0] = buf;
- }
- argv[1] = stringval(form, 2);
- argc = 2;
- } else {
- if (boolval(form, 3)) {
- qy = "get_end_members_of_list";
- sprintf(buf, "Recursive members of list: %s\n", argv[0]);
- } else
- sprintf(buf, "Members of list: %s\n", argv[0]);
- AppendToLog(buf);
- }
- break;
- case MM_DEL_ALL_MEMBER:
- form->extrastuff = (caddr_t) sq_create();
- retfunc = CollectData;
- break;
- case MM_SHOW_FILSYS:
- if (*stringval(form, 0)) {
- qy = "get_filesys_by_label";
- argv[0] = stringval(form, 0);
- argc = 1;
- } else if (*stringval(form, 1)) {
- StoreHost(form, 1, &argv[0]);
- if (*stringval(form, 2)) {
- qy = "get_filesys_by_nfsphys";
- argv[1] = stringval(form, 2);
- argc = 2;
- } else {
- qy = "get_filesys_by_machine";
- argc = 1;
- }
- } else if (*stringval(form, 3)) {
- qy = "get_filesys_by_group";
- argv[0] = stringval(form, 3);
- argc = 1;
- } else if (*stringval(form, 4)) {
- qy = "get_filesys_by_path";
- argv[0] = stringval(form, 4);
- argc = 1;
- }
- /* fall through to */
- case MM_SHOW_FSGROUP:
- form->extrastuff = (caddr_t) sq_create();
- break;
- case MM_ADD_FILSYS:
- for (i = FS_TYPE+1; i < FS_MODTIME-1; i++)
- argv[i] = StringValue(form, i+1);
- argv[FS_L_TYPE] = StringValue(form, FS_TYPE+1);
- StoreHost(form, FS_MACHINE+1, &argv[FS_MACHINE]);
- if (!strcmp(stringval(form, FS_TYPE), "FSGROUP") ||
- !strcmp(stringval(form, FS_TYPE), "MUL"))
- argv[FS_MACHINE+1] = "\\[NONE\\]";
- break;
- case MM_MOD_FILSYS:
- if (!strcmp(form->formname, "mod_filsys")) {
- qy = "update_filesys";
- argv[0] = form->extrastuff;
- argv[1] = StringValue(form, 0);
- argv[2] = StringValue(form, 1);
- argv[FS_L_TYPE+1] = StringValue(form, 2);
- StoreHost(form, FS_MACHINE+1, &argv[FS_MACHINE + 1]);
- for (i = FS_MACHINE+1; i < FS_L_TYPE; i++)
- argv[i] = StringValue(form, i);
- argc = FS_MODTIME + 1;
- break;
- }
- form->extrastuff = (caddr_t) "mod_filsys";
- retfunc = ModifyCallback;
- break;
- case MM_MOV_FSGROUP:
- argv[1] = strsave(stringval(form, 1));
- s = strchr(argv[1], ' ');
- if (s) *s = 0;
- i = MoiraQuery("remove_filesys_from_fsgroup", 2, argv, ModifyCallback,
- (char *)form);
- if (i) {
- com_err(program_name, i, " removing filesystem from FS group");
- return;
- }
- argc = 3;
- /* fall through to: */
- case MM_ADD_FSGROUP:
- /* find the two keys to sort between */
- argv[2] = strsave(argv[2]);
- s = strchr(argv[2], ' ');
- if (s) {
- argv[2] = s+2;
- s = strchr(argv[2], ')');
- if (s) *s = 0;
- } else
- argv[2] = "";
- if (*argv[2] == 0) argv[2] = "A";
- /* Finding the after key is gross. We look through the widgets
- * in the radiobox to find the one selected and the one after
- * it. The name of the widget is also the member name.
- */
- if (!tty) {
- Widget w, kid;
-
- argv[3] = "";
- w = form->inputlines[2]->mywidget;
- for (i = 0; i < NumChildren(w); i++) {
- kid = NthChild(w, i);
- if (!strcmp(XtName(kid), stringval(form, 2))) {
- i++;
- if (i < NumChildren(w)) {
- argv[3] = strsave(XtName(NthChild(w, i)));
- s = strchr(argv[3], ' ');
- if (s) {
- argv[3] = s+2;
- s = strchr(argv[3], ')');
- if (s) *s = 0;
- } else
- argv[3] = "";
- }
- break;
- }
- }
- } else {
- printf("Don't know how to do this\007\007!\n");
- }
- if (*argv[3] == 0) argv[3] = "Z";
-#ifdef DEBUG
- printf("Got before key of \"%s\" and after key of \"%s\"\n",
- argv[2], argv[3]);
-#endif /* DEBUG */
- /* copy the matching chars */
- for (s = buf; *argv[2] && *argv[2] == *argv[3]; argv[3]++)
- *s++ = *argv[2]++;
- /* and set the last char */
- if (*argv[2] == 0)
- *argv[2] = i = 'A';
- else
- i = argv[2][1];
- if (i == 0) i = 'A';
- if (*argv[3] == 0) *argv[3] = 'Z';
- if (*argv[3] - *argv[2] > 1) {
- *s++ = (*argv[3] + *argv[2])/2;
- } else {
- *s++ = *argv[2];
- *s++ = (i + 'Z')/2;
- }
- *s = 0;
- argv[2] = strsave(buf);
- break;
- case MM_DEL_FSGROUP:
- argv[1] = strsave(stringval(form, 1));
- s = strchr(argv[1], ' ');
- if (s) *s = 0;
- break;
- case MM_SHOW_FS_ALIAS:
- if (!*stringval(form, 0))
- argv[2] = "*";
- else
- argv[2] = stringval(form, 0);
- if (!*stringval(form, 1))
- argv[0] = "*";
- else
- argv[0] = stringval(form, 1);
- argv[1] = "FILESYS";
- break;
- case MM_ADD_FS_ALIAS:
- case MM_DEL_FS_ALIAS:
- argv[0] = stringval(form, 1);
- argv[1] = "FILESYS";
- argv[2] = stringval(form, 0);
- break;
- case MM_SHOW_NFS:
- StoreHost(form, NFS_NAME, &argv[NFS_NAME]);
- if (!*stringval(form, 1))
- argv[1] = "*";
- break;
- case MM_ADD_NFS:
- StoreHost(form, NFS_NAME, &argv[NFS_NAME]);
- sprintf(buf, "%d", atoi(stringval(form, NFS_STATUS)) +
- (boolval(form, 4) ? MR_FS_GROUPQUOTA : 0));
- argv[NFS_STATUS] = buf;
- argv[NFS_ALLOC] = stringval(form, 5);
- argv[NFS_SIZE] = stringval(form, 6);
- break;
- case MM_MOD_NFS:
- StoreHost(form, NFS_NAME, &argv[NFS_NAME]);
- if (!strcmp(form->formname, "mod_nfs")) {
- qy = "update_nfsphys";
- argc = NFS_MODTIME;
- StoreHost(form, NFS_NAME, &argv[NFS_NAME]);
- sprintf(buf, "%d", atoi(stringval(form, NFS_STATUS)) +
- (boolval(form, 4) ? MR_FS_GROUPQUOTA : 0));
- argv[NFS_STATUS] = buf;
- argv[NFS_ALLOC] = stringval(form, 5);
- argv[NFS_SIZE] = stringval(form, 6);
- break;
- }
- form->extrastuff = (caddr_t) "mod_nfs";
- retfunc = ModifyCallback;
- break;
- case MM_DEL_NFS:
- StoreHost(form, NFS_NAME, &argv[NFS_NAME]);
- break;
- case MM_SHOW_QUOTA:
- if (!*stringval(form, 0))
- argv[0] = "*";
- if (*stringval(form, 1)) {
- argv[1] = "USER";
- argv[2] = stringval(form, 1);
- } else if (*stringval(form, 2)) {
- argv[1] = "GROUP";
- argv[2] = stringval(form, 2);
- } else if (!*stringval(form, 0)) {
- display_error("Must specify something.");
- return;
- } else {
- qy = "get_quota_by_filesys";
- argc = 1;
- }
- break;
- case MM_SHOW_MACH:
- case MM_ADD_MACH:
- case MM_DEL_MACH:
- StoreHost(form, 0, &argv[0]);
- break;
- case MM_MOD_MACH:
- if (!strcmp(form->formname, "mod_machine")) {
- qy = "update_machine";
- for (i = 0; i < M_MODTIME; i++)
- argv[i + 1] = StringValue(form, i);
- argv[0] = form->extrastuff;
- argc = M_MODTIME + 1;
- break;
- }
- StoreHost(form, 0, &argv[0]);
- form->extrastuff = (caddr_t) "mod_machine";
- retfunc = ModifyCallback;
- break;
- case MM_MOD_CLUSTER:
- if (!strcmp(form->formname, "mod_cluster")) {
- qy = "update_cluster";
- for (i = 0; i < C_MODTIME; i++)
- argv[i + 1] = StringValue(form, i);
- argv[0] = form->extrastuff;
- argc = C_MODTIME + 1;
- break;
- }
- form->extrastuff = (caddr_t) "mod_cluster";
- retfunc = ModifyCallback;
- break;
- case MM_SHOW_MCMAP:
- if (!*stringval(form, 0))
- argv[0] = "*";
- else
- StoreHost(form, 0, &argv[0]);
- if (!*stringval(form, 1))
- argv[1] = "*";
- AppendToLog("Cluster mappings:\n");
- break;
- case MM_ADD_MCMAP:
- case MM_DEL_MCMAP:
- StoreHost(form, 0, &argv[0]);
- break;
- case MM_SHOW_CLDATA:
- if (!*stringval(form, 1))
- argv[1] = "*";
- AppendToLog("Cluster data:\n");
- break;
- case MM_ADD_PCAP:
- StoreHost(form, PCAP_SPOOL_HOST, &argv[PCAP_SPOOL_HOST]);
- StoreHost(form, PCAP_QSERVER, &argv[PCAP_QSERVER]);
- break;
- case MM_MOD_PCAP:
- if (!strcmp(form->formname, "mod_printer")) {
- qy = "update_printcap_entry";
- argc = PCAP_MODTIME;
- break;
- }
- form->extrastuff = (caddr_t) "mod_printer";
- retfunc = ModifyCallback;
- break;
- case MM_MOD_SERVICE:
- if (!strcmp(form->formname, "mod_service")) {
- qy = "update_server_info";
- argc = SC_END;
- break;
- }
- form->extrastuff = (caddr_t) "mod_service";
- retfunc = ModifyCallback;
- break;
- case MM_RESET_SERVICE:
- argv[1] = argv[2] = argv[3] = argv[4] = "0";
- argv[5] = "";
- break;
- case MM_RESET_HOST:
- StoreHost(form, 1, &argv[1]);
- argv[2] = argv[3] = argv[4] = argv[5] = argv[7] = argv[8] = "0";
- argv[6] = "";
- break;
- case MM_CLEAR_HOST:
- StoreHost(form, 1, &argv[1]);
- break;
- case MM_SHOW_HOST:
- if (!*stringval(form, 0))
- argv[0] = "*";
- if (!*stringval(form, 1))
- argv[1] = "*";
- else
- StoreHost(form, 1, &argv[1]);
- break;
- case MM_MOD_HOST:
- if (!strcmp(form->formname, "mod_host")) {
- qy = "update_server_host_info";
- argc = SHI_END;
- break;
- }
- StoreHost(form, 1, &argv[1]);
- form->extrastuff = (caddr_t) "mod_host";
- retfunc = ModifyCallback;
- break;
- case MM_SAVE_LOG:
- if (!write_log_to_file(stringval(form, 0)) && !tty && remove)
- XtUnmanageChild(form->formpointer);
- return;
- case MM_NEW_VALUE:
- argv[0] = form->extrastuff;
- argv[1] = "TYPE";
- argv[2] = StringValue(form, 0);
- for (s = argv[2]; *s; s++)
- if (islower(*s)) *s = toupper(*s);
- break;
- case MM_TRIGGER_DCM:
- if (form->inputlines[0]->returnvalue.booleanvalue) {
- i = mr_do_update();
- if (i)
- com_err(program_name, i, " starting DCM");
- else
- AppendToLog("DCM started.\n");
- }
- if (!tty && remove)
- XtUnmanageChild(form->formpointer);
- return;
- }
-
- if (argc == -1) {
- display_error("Unknown function in form callback.\n");
- return;
- }
- i = MoiraQuery(qy, argc, argv, retfunc, (char *)form);
- if (i) {
- com_err(program_name, i, " executing database query");
- return;
- }
-
- f = NULL;
- if (form->extrastuff && (f = GetForm((char *)(form->extrastuff)))) {
- if (form->formpointer)
- XtUnmanageChild(form->formpointer);
- f->extrastuff = (caddr_t) strsave(stringval(form, 0));
- f->menu = form->menu;
- }
-
- switch (form->menu->operation) {
- case MM_MOD_USER:
- if (f) {
- f->inputlines[U_STATE]->keywords = user_states;
- StoreField(f, U_STATE, user_states[atoi(stringval(f, U_STATE))]);
- GetKeywords(f, U_CLASS, "class");
- } else
- AppendToLog("Done.\n");
- break;
- case MM_MOD_FINGER:
- case MM_MOD_CLUSTER:
- if (!f)
- AppendToLog("Done.\n");
- break;
- case MM_MOD_LIST:
- if (f) {
- GetKeywords(f, L_ACE_TYPE, "ace_type");
- f->inputlines[L_GROUP]->valuechanged = MoiraValueChanged;
- f->inputlines[L_ACE_TYPE]->valuechanged = MoiraValueChanged;
- } else
- AppendToLog("Done.\n");
- break;
- case MM_MOD_SERVICE:
- if (f) {
- GetKeywords(f, SC_TYPE, "service");
- GetKeywords(f, SC_ACE_TYPE, "ace_type");
- }
- break;
- case MM_MOD_FILSYS:
- if (f) {
- GetKeywords(f, FS_TYPE, "filesys");
- sprintf(buf, "fs_access_%s", stringval(f, FS_TYPE));
- GetKeywords(f, FS_ACCESS+1, buf);
- GetKeywords(f, FS_TYPE+1, "lockertype");
- if (!strcmp(stringval(f, FS_MACHINE+1), "[NONE]"))
- StoreField(f, FS_MACHINE+1, "\\[NONE\\]");
- f->inputlines[FS_TYPE]->valuechanged = MoiraValueChanged;
- } else
- AppendToLog("Done.\n");
- break;
- case MM_MOD_MACH:
- if (f)
- GetKeywords(f, 1, "mac_type");
- else
- AppendToLog("Done.\n");
- break;
- case MM_MOD_NFS:
- if (f)
- f->inputlines[3]->keywords = nfs_states;
- else
- AppendToLog("Done.\n");
- break;
- case MM_DEL_ALL_MEMBER:
- argv[1] = StringValue(form, 0);
- argv[2] = StringValue(form, 1);
- while (sq_get_data(form->extrastuff, &(argv[0]))) {
- sprintf(buf, "Delete %s %s from list %s?", StringValue(form, 0),
- StringValue(form, 1), argv[0]);
- if (!boolval(form, 2) ||
- AskQuestion(buf, "confirm_del_all")) {
- i = MoiraQuery("delete_member_from_list", 3, argv,
- DisplayCallback, NULL);
- if (i)
- com_err(program_name, i, " while removing member from list");
- else {
- sprintf(buf, "Member %s %s removed from list %s.\n",
- argv[1], argv[2], argv[0]);
- AppendToLog(buf);
- }
- }
- free(argv[0]);
- }
- AppendToLog("Done.\n");
- break;
- case MM_ADD_FILSYS:
- if (!f) {
- AppendToLog("Done.\n");
- if (AskQuestion("Add a quota for this filesystem?",
- "quota_after_filsys")) {
- f = GetAndClearForm("add_quota");
- GetKeywords(f, 1, "quota_type");
- f->inputlines[Q_FILESYS]->valuechanged = MoiraValueChanged;
- f->inputlines[Q_TYPE]->valuechanged = MoiraValueChanged;
- StoreField(f, 0, argv[0]);
- if (!strcmp(argv[1], "AFS"))
- StoreField(f, 1, "ANY");
- if (tty)
- TtyForm(f);
- else
- DisplayForm(f);
- }
- }
- break;
- case MM_SHOW_FILSYS:
- case MM_SHOW_FSGROUP:
- while (sq_get_data(form->extrastuff, &aargv)) {
- ShowFilsys(aargv);
- }
- sq_destroy(form->extrastuff);
- break;
- case MM_ADD_HOST:
- case MM_DEL_HOST:
- case MM_CLEAR_HOST:
- case MM_RESET_HOST:
- case MM_ADD_SERVICE:
- case MM_DEL_SERVICE:
- case MM_CLEAR_SERVICE:
- case MM_RESET_SERVICE:
- case MM_ENABLE_DCM:
- case MM_ADD_ZEPHYR:
- case MM_DEL_ZEPHYR:
- case MM_ADD_PCAP:
- case MM_DEL_PCAP:
- case MM_ADD_CLDATA:
- case MM_DEL_CLDATA:
- case MM_ADD_MCMAP:
- case MM_DEL_MCMAP:
- case MM_ADD_CLUSTER:
- case MM_DEL_CLUSTER:
- case MM_ADD_MACH:
- case MM_DEL_MACH:
- case MM_ADD_MEMBER:
- case MM_DEL_MEMBER:
- case MM_ADD_LIST:
- case MM_DEL_LIST:
- case MM_ADD_QUOTA:
- case MM_MOD_QUOTA:
- case MM_DEL_QUOTA:
- case MM_SET_DQUOTA:
- case MM_ADD_NFS:
- case MM_DEL_NFS:
- case MM_ADD_FS_ALIAS:
- case MM_DEL_FS_ALIAS:
- case MM_ADD_FSGROUP:
- case MM_MOV_FSGROUP:
- case MM_DEL_FSGROUP:
- case MM_DEL_FILSYS:
- case MM_ADD_KRBMAP:
- case MM_DEL_KRBMAP:
- case MM_SET_POBOX:
- case MM_DEL_POBOX:
- case MM_ADD_USER:
- case MM_REGISTER:
- case MM_DEACTIVATE:
- case MM_EXPUNGE:
- case MM_RESET_POBOX:
- AppendToLog("Done.\n");
- break;
- case MM_SHOW_KRBMAP:
- case MM_SHOW_CLDATA:
- case MM_SHOW_MCMAP:
- case MM_SHOW_MEMBERS:
- case MM_STATS:
- case MM_CLIENTS:
- case MM_SHOW_ACE_USE:
- AppendToLog("\n");
- break;
- case MM_NEW_VALUE:
- CacheNewValue(GetForm(form->menu->form), (int) form->menu->accel,
- form->extrastuff, StringValue(form, 0));
- }
-
- if (remove && form->formpointer)
- XtUnmanageChild(form->formpointer);
-
- if (f) {
- if (tty)
- TtyForm(f);
- else
- DisplayForm(f);
- }
-}
-
-
-MoiraMenuComplete(m)
-MenuItem *m;
-{
- char *qy, *argv[32];
- int (*retfunc)(), argc, i;
- EntryForm dummy;
-
- retfunc = DisplayCallback;
- argc = -1;
- dummy.menu = m;
- qy = m->query;
- argc = m->argc;
-
- switch (m->operation) {
- case MM_SHOW_MAILLIST:
- argv[0] = argv[1] = argv[3] = "TRUE";
- argv[2] = "FALSE";
- argv[4] = "DONTCARE";
- AppendToLog("Public Mailinglists:\n");
- break;
- case MM_SHOW_DQUOTA:
- argv[0] = "def_quota";
- break;
- case MM_SHOW_DCM:
- AppendToLog("Services and Hosts with failed updates:\n");
- argv[0] = argv[2] = "DONTCARE";
- argv[1] = "TRUE";
- i = MoiraQuery("qualified_get_server", 3, argv, retfunc,
- (char *)&dummy);
- if (i && i != MR_NO_MATCH)
- com_err(program_name, i, " executing database query");
- argv[0] = "*";
- argv[1] = argv[2] = argv[3] = argv[5] = "DONTCARE";
- argv[4] = "TRUE";
- i = MoiraQuery("qualified_get_server_host", 6, argv, retfunc,
- (char *)&dummy);
- if (i && i != MR_NO_MATCH)
- com_err(program_name, i, " executing database query");
- AppendToLog("\n");
- return;
- case MM_HELP_MOIRA:
- case MM_HELP_WILDCARDS:
- case MM_HELP_AUTHORS:
- case MM_HELP_BUGS:
- case MM_HELP_MOUSE:
- case MM_HELP_KEYBOARD:
- help(m->query);
- return;
- case MM_QUIT:
- mr_disconnect();
- exit(0);
- }
- if (argc == -1) {
- display_error("Unknown function in menu callback.\n");
- return;
- }
- i = MoiraQuery(qy, argc, argv, retfunc, (char *)&dummy);
- if (i)
- com_err(program_name, i, " executing database query");
- AppendToLog("\n");
-}
+++ /dev/null
-/*
-** Stub functions
-*/
-
-#ifdef POSIX
-#include <unistd.h>
-#endif
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <X11/StringDefs.h>
-#include <X11/Intrinsic.h>
-#include <X11/Core.h>
-#include <X11/cursorfont.h>
-#include <Xm/Text.h>
-#include <Xm/MessageB.h>
-#include "mmoira.h"
-#include <sys/types.h>
-#include <sys/file.h>
-#include <fcntl.h>
-
-static char rcsid[] = "$Header$";
-
-void extra_help_callback();
-extern EntryForm *MoiraForms[];
-static DoMoiraSelect(), DoReference();
-
-static Widget logwidget = NULL;
-
-
-/* No-op action to mask built-in actions */
-
-void noopACT(w, event, p, n)
-Widget w;
-XEvent *event;
-String *p;
-Cardinal *n;
-{
-}
-
-
-/* Action to do a moira retrieve on what was clicked at */
-
-void moiraRetrieveACT(w, event, p, n)
-Widget w;
-XEvent *event;
-String *p;
-Cardinal *n;
-{
- XmTextPosition pos;
- XButtonEvent *be;
-
- be = (XButtonEvent *)event;
-
- pos = XmTextXYToPos(w, be->x, be->y);
- DoMoiraSelect(pos, w, 0);
-}
-
-
-/* Action to modify the moira object that was clicked on */
-
-void moiraModifyACT(w, event, p, n)
-Widget w;
-XEvent *event;
-String *p;
-Cardinal *n;
-{
- XmTextPosition pos;
- XButtonEvent *be;
-
- be = (XButtonEvent *)event;
-
- pos = XmTextXYToPos(w, be->x, be->y);
- DoMoiraSelect(pos, w, 1);
-}
-
-
-static XtActionsRec myactions[] = {
- { "moiraRetrieve", moiraRetrieveACT },
- { "moiraModify", moiraModifyACT },
- { "noop", noopACT },
-};
-
-
-/* Create the log window, and setup the translation table to taking
- * mouse clicks in it.
- */
-
-Widget
-SetupLogWidget(parent)
-Widget parent;
-{
- Arg wargs[10];
- int n;
- XtTranslations trans;
-
- if (logwidget)
- return (logwidget);
-
- n = 0;
- XtSetArg(wargs[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
- XtSetArg(wargs[n], XmNeditable, False); n++;
-
- logwidget = XmCreateScrolledText( parent,
- "logwidget",
- wargs, n);
- XtManageChild(logwidget);
-
- XtAppAddActions(XtWidgetToApplicationContext(logwidget),
- myactions, XtNumber(myactions));
- trans = XtParseTranslationTable(resources.log_trans);
- XtOverrideTranslations(logwidget, trans);
- return (logwidget);
-}
-
-
-/* This actually does all of the work for handling mouse clicks. It
- * finds the surrounding text and decides what to do with the click,
- * the actually starts the moira query or pops up the form.
- */
-
-static DoMoiraSelect(pos, w, modify)
-XmTextPosition pos;
-Widget w;
-int modify;
-{
- char *log, *p, *p1, *p2;
- char name[256], type[256], type2[256];
-
- log = XmTextGetString(w);
- for (p = &log[pos]; p > log; p--)
- if (isspace(*p) || *p == ':') break;
-
- /* p now points to the beginning of the word on which the mouse was
- * clicked. Begin gross hacking to find the name and type of object.
- */
- /* get name */
- p1 = p + 1;
- p2 = name;
- while (*p1 && !isspace(*p1)) *p2++ = *p1++;
- *p2 = 0;
- /* backup two words before for type2 */
- while (p >= log && isspace(*p) || *p == ':') p--;
- while (p >= log && !isspace(*p)) p--;
- while (p >= log && isspace(*p)) p--;
- while (p >= log && !isspace(*p)) p--;
- p++;
- p2 = type2;
- /* new get type2 */
- if (p > log) {
- while (!isspace(*p)) *p2++ = *p++;
- *p2++ = *p++;
- /* skip additional whitespace */
- while (isspace(*p)) p++;
- }
- /* get type & rest of type2 */
- p1 = type;
- while (*p && *p != ':' && !isspace(*p)) *p2++ = *p1++ = *p++;
- *p2 = *p1 = 0;
- /* Done! */
-#ifdef DEBUG
- printf("name \"%s\", type \"%s\" type2 \"%s\"\n", name, type, type2);
-#endif /* DEBUG */
- if (!strcasecmp(type, "USER") ||
- !strcmp(type, "name") ||
- !strcmp(type2, "Modified by") ||
- !strcmp(type2, "User Ownership") ||
- !strcmp(type2, "Login name") ||
- !strcmp(type, "login")) {
- DoReference(name, "select_user", MM_MOD_USER, MM_SHOW_USER,
- "get_user_account_by_login", modify);
- } else if (!strcasecmp(type, "LIST") ||
- !strcmp(type2, "Group Ownership")) {
- DoReference(name, "select_list", MM_MOD_LIST, MM_SHOW_LIST,
- "get_list_info", modify);
- } else if (!strcasecmp(type, "MACHINE") ||
- !strcmp(type, "host") ||
- !strcasecmp(type, "Server") ||
- !strcmp(type, "on") ||
- !strcmp(type, "Box")) {
- DoReference(name, "select_machine", MM_MOD_MACH, MM_SHOW_MACH,
- "get_machine", modify);
- } else if (!strcasecmp(type, "CLUSTER")) {
- DoReference(name, "select_cluster", MM_MOD_CLUSTER, MM_SHOW_CLUSTER,
- "get_cluster", modify);
- } else if (!strcasecmp(type, "FILESYSTEM") ||
- !strcmp(type, "FILESYS") ||
- !strcmp(type2, "syslib Data")) {
- DoReference(name, "select_filsys", MM_MOD_FILSYS, MM_SHOW_FILSYS,
- "get_filesys_by_label", modify);
- } else if (!strcmp(type2, "Filesystem Group")) {
- DoReference(name, "order_fsgroup", MM_MOV_FSGROUP, MM_SHOW_FSGROUP,
- "get_filesys_by_label", modify);
- } else if (!strcmp(type, "Printer") ||
- !strcmp(type2, "lpr Data")) {
- DoReference(name, "select_printer", MM_MOD_PCAP, MM_SHOW_PCAP,
- "get_printcap_entry", modify);
- } else if (!strcmp(type, "Service")) {
- DoReference(name, "select_service", MM_MOD_SERVICE, MM_SHOW_SERVICE,
- "get_server_info", modify);
-/* This code isn't complete, and it's not clear that we really want it...
- } else if (!strcmp(type, "Packname")) {
- char name2[256];
- sprintf(name2, "%s:%s", type2, name);
- p = strrchr(name2, '/');
- if (p) *p = 0;
- DoReference(name, "select_nfs", MM_MOD_NFS, MM_SHOW_NFS,
- "get_nfsphys", modify);
-*/ } else {
- XBell(XtDisplay(w), 100);
- }
- XtFree(log);
-}
-
-
-/* This is the heart of handling the reference once we have found out
- * what type of reference it is.
- */
-
-static DoReference(name, formname, modop, showop, query, modify)
-char *name;
-char *formname;
-int modop;
-int showop;
-char *query;
-int modify;
-{
- EntryForm *form, f;
- MenuItem m;
- char *argv[2], **aargv;
- int status;
-
- if (modify) {
- form = GetAndClearForm(formname);
- StoreField(form, 0, name);
- form->menu = &m;
- m.operation = modop;
- m.query = query;
- m.argc = 1;
- if (showop == MM_SHOW_FSGROUP) {
- DisplayForm(form);
- MoiraValueChanged(form, form->inputlines[0]);
- } else
- MoiraFormApply(0, form);
- } else {
- f.menu = &m;
- if (showop == MM_SHOW_FILSYS ||
- showop == MM_SHOW_FSGROUP) f.extrastuff = (caddr_t) sq_create();
- argv[0] = name;
- m.operation = showop;
- status = MoiraQuery(query, 1, argv, DisplayCallback, &f);
- if (showop == MM_SHOW_FILSYS ||
- showop == MM_SHOW_FSGROUP) {
- while (sq_get_data(f.extrastuff, &aargv)) {
- ShowFilsys(aargv);
- }
- sq_destroy(f.extrastuff);
- }
- if (status)
- com_err(program_name, status, " while looking up data");
- else
- AppendToLog("\n");
- }
-}
-
-
-/*
-** PopupErrorMessage(text)
-**
-** Given a char* pointing to an error message, possibly with imbedded
-** newlines, display the text in a popup window and put two buttons
-** at the bottom of the window, labelled "OK" and "Cancel." Pop down
-** when one of the buttons is pressed.
-**
-** Return 0 if "OK" is pressed, 1 for "Cancel."
-*/
-
-Boolean
-PopupErrorMessage(text, extrahelp)
-char *text;
-char *extrahelp;
-{
- static Widget child;
- Arg wargs[10];
- int n;
- static XmString label;
-
- if (tty) {
- printf("%s\r\n", text);
- return;
- }
-
- if (label) {
- XtFree(label);
- XtDestroyWidget(child);
- }
-
-
- label = XmStringCreateLtoR( text, XmSTRING_DEFAULT_CHARSET);
-
- n = 0;
- XtSetArg(wargs[n], XmNmessageString, label); n++;
-
- child = (Widget) XmCreateErrorDialog(logwidget, "errormessage", wargs, n);
- if (extrahelp)
- XtAddCallback (child, XmNhelpCallback, extra_help_callback, extrahelp);
- else
- XtUnmanageChild(XmMessageBoxGetChild (child, XmDIALOG_HELP_BUTTON));
- XtUnmanageChild(XmMessageBoxGetChild (child, XmDIALOG_CANCEL_BUTTON));
- XtManageChild(child);
-}
-
-/*
-** PopupHelpWindow(text)
-**
-** Given a char* pointing to an help message, possibly with imbedded
-** newlines, display the text in a popup window and put a single button
-** at the bottom of the window, labelled "OK." Pop down when the
-** the buttons is pressed.
-*/
-
-void
-PopupHelpWindow(text)
-char *text;
-{
- static Widget child;
- Arg wargs[10];
- int n;
-
- static XmString label;
- if (label) {
- XtFree(label);
- XtDestroyWidget(child);
- }
-
- label = XmStringCreateLtoR( text, XmSTRING_DEFAULT_CHARSET);
-
- n = 0;
- XtSetArg(wargs[n], XmNmessageString, label); n++;
-
- child = (Widget) XmCreateMessageDialog(logwidget, "helpmessage", wargs, n);
- XtUnmanageChild(XmMessageBoxGetChild (child, XmDIALOG_CANCEL_BUTTON));
- XtUnmanageChild(XmMessageBoxGetChild (child, XmDIALOG_HELP_BUTTON));
-
- XtManageChild(child);
-}
-
-/*
-** Given a char* to a single line of text, append this line at the bottom
-** of the log window. Return 0 of the append was sucessful, non-zero
-** for an error condition.
-*/
-
-int
-AppendToLog(text)
-char *text;
-{
- XmTextPosition pos;
- char *string, *p;
-
- if (tty) {
- fputs(text, stdout);
- return;
- }
-
- string = XmTextGetString(logwidget);
- pos = strlen(string);
- XtFree(string);
-
- XmTextReplace(logwidget, pos, pos, text);
- XmTextSetCursorPosition(logwidget, pos + strlen(text));
- if (pos > resources.maxlogsize) {
- for (p = &string[pos-resources.maxlogsize]; *p && *p != '\n'; p++);
- if (*p)
- pos = p - string;
- XmTextReplace(logwidget, 0, pos, "");
- }
-}
-
-void
-MakeWatchCursor(topW)
-Widget topW;
-{
- static Cursor mycursor = NULL;
- EntryForm **fp;
-
- if (!topW)
- return;
-
- if (!mycursor)
- mycursor = XCreateFontCursor (XtDisplay(topW), XC_watch);
-
- XDefineCursor(XtDisplay(topW), XtWindow(topW), mycursor);
- for (fp = MoiraForms; *fp; fp++)
- if ((*fp)->formpointer && XtIsManaged((*fp)->formpointer))
- XDefineCursor(XtDisplay(topW), XtWindow((*fp)->formpointer), mycursor);
-}
-
-void
-MakeNormalCursor(topW)
-Widget topW;
-{
- EntryForm **fp;
-
- if (!topW)
- return;
-
- XUndefineCursor(XtDisplay(topW), XtWindow(topW));
- for (fp = MoiraForms; *fp; fp++)
- if ((*fp)->formpointer && XtIsManaged((*fp)->formpointer))
- XUndefineCursor(XtDisplay(topW), XtWindow((*fp)->formpointer));
-}
-
-/*
-** Move through the fields of the spec and make certain that the
-** form's widgets actually reflect the current values.
-*/
-
-void
-UpdateForm(spec)
-EntryForm *spec;
-{
- UserPrompt **myinputlines = spec->inputlines;
- UserPrompt *current;
- Arg wargs[10];
- int n, kidcount;
- Widget kid;
-
- if (tty || spec->formpointer == NULL) return;
-
- for ( current = (*myinputlines);
- current;
- myinputlines++, current = (*myinputlines)) {
-
- if (current->changed) {
- n = 0;
- XtSetArg(wargs[n], XmNsensitive,
- current->insensitive ? False : True); n++;
- XtSetValues(current->mywidget, wargs, n);
- current->changed = False;
- }
-
- switch (current->type) {
- case FT_STRING:
- if (current->returnvalue.stringvalue) {
- XmTextSetString (current->mywidget, current->returnvalue.stringvalue);
- }
- break;
-
- case FT_BOOLEAN:
- n = 0;
- XtSetArg(wargs[n], XmNset,
- current->returnvalue.booleanvalue ? True : False); n++;
- XtSetValues (current->mywidget, wargs, n);
- break;
-
- case FT_KEYWORD:
- kidcount = NumChildren(current->mywidget);
- while(kidcount--) {
- n = 0;
- kid = NthChild(current->mywidget, kidcount);
- if (current->returnvalue.stringvalue &&
- (!strcmp (XtName(kid), current->returnvalue.stringvalue))) {
- XtSetArg(wargs[n], XmNset, True);
- n++;
- }
- else {
- XtSetArg(wargs[n], XmNset, False);
- n++;
- }
- XtSetValues (kid, wargs, n);
- }
- break;
-
- case FT_NUMBER:
- break;
- }
- n = 0;
- XtSetArg(wargs[n], XtNsensitive, !(current->insensitive)); n++;
- XtSetValues (current->mywidget, wargs, n);
- }
-}
-
-void
-extra_help_callback(w, client_data, call_data)
-Widget w;
-char *client_data;
-XmAnyCallbackStruct *call_data;
-{
- help(client_data);
-}
-
-
-int write_log_to_file(fn)
-char *fn;
-{
- char *string, buf[256];
- int fd, i;
- extern int errno;
-
- string = XmTextGetString(logwidget);
- fd = open(fn, O_WRONLY|O_CREAT, 0666);
- if (fd < 0) {
- sprintf(buf, "opening output file \"%s\"", fn);
- com_err(program_name, errno, buf);
- return(1);
- }
- if ((i = write(fd, string, strlen(string))) < 0) {
- sprintf(buf, "writing output file \"%s\"", fn);
- com_err(program_name, errno, buf);
- return(1);
- }
- if ((i = close(fd)) < 0) {
- sprintf(buf, "closing output file \"%s\"", fn);
- com_err(program_name, errno, buf);
- return(1);
- }
- return(0);
-}
-
-
-void yesCallback(w, ret, dummy)
-Widget w;
-XtPointer ret;
-XtPointer dummy;
-{
- int *ip = (int *)ret;
- *ip = 1;
-}
-
-void noCallback(w, ret, dummy)
-Widget w;
-XtPointer ret;
-XtPointer dummy;
-{
- int *ip = (int *)ret;
- *ip = -1;
-}
-
-
-static int value;
-static XtCallbackRec yescb[] = { { yesCallback, (XtPointer) &value },
- { NULL, NULL} };
-static XtCallbackRec nocb[] = { { noCallback, (XtPointer) &value },
- {NULL, NULL} };
-
-Boolean AskQuestion(text, helpname)
-char *text, *helpname;
-{
- static Widget child;
- Arg wargs[10];
- int n;
- static XmString label, yes = NULL, no;
- XEvent event;
- XtAppContext _XtDefaultAppContext();
-
- if (tty) {
- char buf[256];
-
- while (1) {
- printf("%s (Y/N) ", text);
- fflush(stdout);
- if (mgets(buf, sizeof(buf)))
- return(False);
- if (buf[0] == 'T' || buf[0] == 't' ||
- buf[0] == 'Y' || buf[0] == 'y')
- return(True);
- else if (buf[0] == 'F' || buf[0] == 'f' ||
- buf[0] == 'N' || buf[0] == 'n')
- return(False);
- printf("Please answer Yes or No\r\n");
- }
- }
-
- if (!yes) {
- yes = XmStringCreate("Yes", XmSTRING_DEFAULT_CHARSET);
- no = XmStringCreate("No", XmSTRING_DEFAULT_CHARSET);
- }
- if (label) {
- XtFree(label);
- XtDestroyWidget(child);
- }
-
- label = XmStringCreateLtoR( text, XmSTRING_DEFAULT_CHARSET);
-
- n = 0;
- XtSetArg(wargs[n], XmNmessageString, label); n++;
- XtSetArg(wargs[n], XmNokLabelString, yes); n++;
- XtSetArg(wargs[n], XmNcancelLabelString, no); n++;
- XtSetArg(wargs[n], XmNokCallback, yescb); n++;
- XtSetArg(wargs[n], XmNcancelCallback, nocb); n++;
-
- child = (Widget) XmCreateQuestionDialog(logwidget, "question", wargs, n);
- if (helpname)
- XtAddCallback (child, XmNhelpCallback, extra_help_callback, helpname);
- else
- XtUnmanageChild(XmMessageBoxGetChild (child, XmDIALOG_HELP_BUTTON));
-
- XtManageChild(child);
- value = 0;
- while (value == 0) {
- XtAppNextEvent(_XtDefaultAppContext(), &event);
- XtDispatchEvent(&event);
- }
- if (value > 0)
- return(1);
- else
- return(0);
-}
-
-
-
-/******* temporary ********/
-display_error(msg)
-char *msg;
-{
- PopupErrorMessage(msg, "no_more_help");
-}
+++ /dev/null
-/* $Header$
- *
- * Copyright 1992 by the Massachusetts Institute of Technology.
- *
- * For further information on copyright and distribution
- * see the file mit-copyright.h
- */
-
-#include <mit-copyright.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/signal.h>
-#ifdef POSIX
-#include <termios.h>
-#else
-#include <sgtty.h>
-#endif
-#include <sys/ioctl.h>
-#include <ctype.h>
-#include <X11/Intrinsic.h>
-#include <moira.h>
-#include "mmoira.h"
-#include "parser.h"
-
-static char rcsid[] = "$Header$";
-
-
-struct parse_node *TtyCommands = NULL, *TtyRoot = NULL;
-
-extern int NumMenus;
-extern MenuItem MenuRoot;
-char prompt[] = "moira> ";
-
-#ifdef POSIX
-static struct termios otty, ntty;
-#else
-static struct sgttyb otty, ntty;
-#endif
-
-TtyMainLoop()
-{
- char buf[1024], cbuf[2], c, *p;
- int arg, i, done;
-
- if (TtyCommands == NULL)
- parse_menus();
-
-#ifdef DEBUG
- print_parse_tree(TtyRoot, 0);
- fflush(stdout);
- sleep(10);
-#endif /* DEBUG */
-
-#ifdef POSIX
- tcgetattr(0, &otty);
- ntty = otty;
- ntty.c_lflag &= ~(ICANON|ECHO);
- ntty.c_cc[VTIME] = 0;
- ntty.c_cc[VMIN] = 1;
-#else
- ioctl(0, TIOCFLUSH, &arg);
- ioctl(0, TIOCGETP, &otty);
- ntty = otty;
- ntty.sg_flags |= RAW;
- ntty.sg_flags &= ~ECHO;
-#endif
- raw_mode();
-
- while (1) {
- parser(prompt, TtyRoot);
- }
-}
-
-cooked_mode()
-{
-#ifdef POSIX
- tcsetattr (0, TCSANOW, &otty);
-#else
- ioctl(0, TIOCSETP, &otty);
-#endif
-}
-
-raw_mode()
-{
-#ifdef POSIX
- tcsetattr (0, TCSANOW, &ntty);
-#else
- ioctl(0, TIOCSETP, &ntty);
-#endif
-}
-
-static NumWords(s)
-char *s;
-{
- int ret;
-
- for (ret = 1; *s; s++)
- if (*s == ' ') ret++;
- return(ret);
-}
-
-
-parse_menus()
-{
- int arg;
- struct parse_node *p;
-
- TtyCommands = (struct parse_node *)malloc(sizeof(struct parse_node) *
- NumMenus * 3);
- memset(TtyCommands, 0, sizeof(struct parse_node) * NumMenus * 3);
- arg = 0;
- parse_menu_recursive(&MenuRoot, "", &arg);
- TtyCommands[arg].p_word = "help";
- TtyCommands[arg].p_next = TtyRoot;
- for (p = TtyRoot; p; p = p->p_peer)
- if (strcmp(p->p_peer->p_word, "help") > 0)
- break;
- TtyCommands[arg].p_peer = p->p_peer->p_peer;
- p->p_peer = &TtyCommands[arg];
- arg++;
-}
-
-
-parse_menu_recursive(m, parent, i)
-MenuItem *m;
-char *parent;
-int *i;
-{
- char buf[64], cmd[64], *word, *s;
- struct parse_node *p, **prev;
- int j, len;
-
- if (m->submenu == NULL) {
- if (!strcmp(parent, "file") ||
- !strcmp(parent, "misc"))
- parent = "";
- if (NumWords(m->label) > 2 || !*parent)
- strcpy(cmd, m->label);
- else
- sprintf(cmd, "%s %s", m->label, parent);
- /* insert command into parse tree */
- p = TtyRoot;
- prev = (struct parse_node **) &TtyRoot;
- for (word = cmd; word; word = strchr(word, ' ')) {
- if (*word == ' ')
- word++;
- s = strchr(word, ' ');
- if (s)
- len = s - word;
- else
- len = strlen(word);
- for (;;) {
- if (!p || !p->p_word ||
- (j = strncmp(p->p_word, word, len)) > 0) {
- strcpy(buf, word);
- buf[len] = 0;
-#ifdef DEBUG
- printf("word: %s\n", buf);
-#endif
- TtyCommands[*i].p_word = strsave(buf);
- if (len == strlen(word))
- TtyCommands[*i].p_menu = m;
- TtyCommands[*i].p_peer = p;
- if (prev)
- *prev = &TtyCommands[*i];
- TtyCommands[*i].p_next = (struct parse_node *) NULL;
- TtyCommands[*i].p_link = (struct parse_node *) NULL;
- prev = &(TtyCommands[*i].p_next);
- p = (struct parse_node *) NULL;
- *i = *i + 1;
- break;
- } else if (j == 0) {
- prev = &(p->p_next);
- if (p->p_next)
- p = p->p_next;
- else
- p = (struct parse_node *) NULL;
- break;
- } else {
- prev = &(p->p_peer);
- p = p->p_peer;
- }
- }
- }
- return;
- }
- if (!strcmp(m->label, "?help")) return;
- for (j = 0; m->submenu[j]; j++) {
- if (m == &MenuRoot)
- buf[0] = 0;
- else if (strlen(parent))
- sprintf(buf, "%s %s", parent, m->label);
- else
- strcpy(buf, m->label);
- parse_menu_recursive(m->submenu[j], buf, i);
- }
-}
-
-
-TtyForm(f)
-EntryForm *f;
-{
- int i, j, done, best, choice;
- char buf[512], *k;
- UserPrompt *p;
-
- printf("%s\r\n", f->instructions);
- choice = 0;
- for (i = 0, p = f->inputlines[i]; p = f->inputlines[i]; i++)
- if (p->choice) {
- choice = 1;
- break;
- }
- if (choice) {
- j = 0;
- *buf = 0;
- for (i = 0, p = f->inputlines[i]; p = f->inputlines[i]; i++) {
- if (p->choice) {
- printf(" %s\r\n", buf);
- sprintf(buf, "%d: %s", ++j, p->prompt);
- } else if (*buf == 0) {
- sprintf(buf, "%d: %s", ++j, p->prompt);
- } else {
- strcat(buf, "/");
- strcat(buf, p->prompt);
- }
- if (buf[strlen(buf)-1] == ' ') buf[strlen(buf)-1] = 0;
- }
- printf(" %s\r\nSelect by [1]: ", buf);
- if (mgets(buf, sizeof(buf)))
- return;
- if (buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = 0;
- if (strlen(buf) == 0)
- choice = 1;
- else
- choice = atoi(buf);
- } else choice = -1;
- for (i = 0, p = f->inputlines[i]; p = f->inputlines[i]; i++) {
- if (choice > 0 && p->choice) choice--;
- if (choice != -1 && choice != 1) continue;
- if (p->insensitive == True) continue;
- switch (p->type) {
- case FT_BOOLEAN:
- done = 0;
- while (!done) {
- done = 1;
- printf("%s(T/F) [%c]: ", p->prompt, boolval(f, i) ? 'T' : 'F');
- fflush(stdout);
- if (mgets(buf, sizeof(buf)))
- return;
- if (buf[0] == 'T' || buf[0] == 't' ||
- buf[0] == 'Y' || buf[0] == 'y')
- p->returnvalue.booleanvalue = True;
- else if (buf[0] == 'F' || buf[0] == 'f' ||
- buf[0] == 'N' || buf[0] == 'n')
- p->returnvalue.booleanvalue = False;
- else if (buf[0] != 0) {
- done = 0;
- printf("Please answer True or False\r\n");
- }
- }
- break;
- case FT_STRING:
- if (*StringValue(f, i))
- printf("%s[%s]: ", p->prompt, StringValue(f, i));
- else
- printf("%s: ", p->prompt);
- fflush(stdout);
- if (mgets(buf, sizeof(buf)))
- return;
- if (buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = 0;
- if (strlen(buf) != 0)
- StoreField(f, i, buf);
- if (!strcmp(buf, "\"\""))
- StoreField(f, i, "");
- break;
- case FT_KEYWORD:
- k = strchr(p->prompt, '|');
- if (k) *k = 0;
- done = 0;
- while (done != 1) {
- if (*StringValue(f, i))
- printf("%s[%s]: ", p->prompt, StringValue(f, i));
- else
- printf("%s: ", p->prompt);
- fflush(stdout);
- if (mgets(buf, sizeof(buf)))
- return;
- if (buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = 0;
- if (strlen(buf) == 0)
- strcpy(buf, StringValue(f, i));
- done = 0;
- for (j = 0; p->keywords[j]; j++)
- if (!strncasecmp(p->keywords[j], buf, strlen(buf)))
- done++, best = j;
- if (done != 1) {
- printf("You must enter one of these keywords:\r\n");
- for (j = 0; p->keywords[j]; j++) {
- printf(" %s\r\n", p->keywords[j]);
- }
- } else
- StoreField(f, i, p->keywords[best]);
- }
- break;
- }
- }
- process_form(f, TRUE);
-}
-
-
-int mgets(line, linelen)
-char *line;
-int linelen;
-{
- char c, *p;
-
- raw_mode();
- p = &line[0];
- *p = 0;
- for (c = (getchar() & 0x7f); 1; c = (getchar() & 0x7f)) {
- if (c == 0) continue;
- switch (c) {
- case 127:
- case '\b':
- if (p == &line[0]) {
- putchar(7);
- break;
- }
- *(--p) = 0;
- write(1, "\b \b", 3);
- break;
- case 'C' - '@':
- case 'G' - '@':
- cooked_mode();
- return(-1);
- case 'Q' - '@':
- case 'V' - '@':
- putchar('\\');
- c = getchar();
- if (c < ' ')
- printf("\b^%c", c + '@');
- else
- printf("\b%c", c);
- fflush(stdout);
- *p++ = c;
- break;
- case 'W' - '@':
- if (p > &line[0])
- p--;
- while ((p >= &line[0]) && isspace(*p)) {
- write(1, "\b \b", 3);
- p--;
- }
- while ((p >= &line[0]) && !isspace(*p)) {
- write(1, "\b \b", 3);
- p--;
- }
- if (p > &line[0]) {
- p++;
- } else {
- p = &line[0];
- }
- *p = 0;
- break;
- case 'Z' - '@':
- printf("\r\n");
- kill(getpid(), SIGSTOP);
- /* when continued, fall through to */
- case 'R' - '@':
- *p = 0;
- printf("\r\n%s", line);
- fflush(stdout);
- break;
- case 'U' - '@':
- while (p-- > &line[0])
- write(1, "\b \b", 3);
- *(++p) = 0;
- fflush(stdout);
- break;
- case '\n':
- case '\r':
- write(1, "\r\n", 2);
- cooked_mode();
- return(0);
- break;
- default:
- putchar(c);
- *p++ = c;
- *p = 0;
- }
- }
-}
-
-
-print_parse_tree(n, l)
-struct parse_node *n;
-int l;
-{
- int i;
-
- for (i = l; i > 0; i--) putchar(' ');
- printf("%s%c\n", n->p_word, n->p_menu ? '*' : ' ');
- if (n->p_next)
- print_parse_tree(n->p_next, l+1);
- if (n->p_peer)
- return(print_parse_tree(n->p_peer, l));
-}
+++ /dev/null
-/*
-** Copyright (c) 1990 David E. Smyth
-**
-** Redistribution and use in source and binary forms are permitted
-** provided that the above copyright notice and this paragraph are
-** duplicated in all such forms and that any documentation, advertising
-** materials, and other materials related to such distribution and use
-** acknowledge that the software was developed by David E. Smyth. The
-** name of David E. Smyth may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-** WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-*/
-
-/*
-* SCCS_data: @(#)AriRegAll.c 1.0 ( 19 June 1990 )
-*
-* Subsystem_group:
-*
-* Widget Creation Library - Athena Resource Interpreter
-*
-* Module_description:
-*
-* This module contains registration routine for all Athena
-* widget constructors and classes.
-*
-* Module_interface_summary:
-*
-* void AriRegisterAthena ( XtAppContext app )
-*
-* Module_history:
-*
-* mm/dd/yy initials function action
-* -------- -------- -------- ---------------------------------------------
-* 06/19/90 D.Smyth all create.
-*
-* Design_notes:
-*
-*******************************************************************************
-*/
-/*
-*******************************************************************************
-* Include_files.
-*******************************************************************************
-*/
-
-#include <X11/Xatom.h>
-#include <X11/Intrinsic.h>
-#include <X11/StringDefs.h>
-
-#include <X11/Xaw/AsciiText.h>
-#include <X11/Xaw/Clock.h>
-#include <X11/Xaw/Command.h>
-#include <X11/Xaw/Dialog.h>
-#include <X11/Xaw/Form.h>
-#include <X11/Xaw/Label.h>
-#include <X11/Xaw/MenuButton.h>
-#include <X11/Xaw/SimpleMenu.h>
-#include <X11/Xaw/SmeBSB.h>
-#include <X11/Xaw/SmeLine.h>
-
-#ifdef Use_AtLabel /* djf's formatted text stuff... */
-#include "Label.h"
-#endif
-
-
-#include <X11/Xaw/Cardinals.h>
-
-void AriRegisterAthena ( app )
- XtAppContext app;
-{
-
-#define RCN( name, class ) WcRegisterClassName ( app, name, class );
-
- /* -- register all Athena widget classes */
- /* Simple Widgets (Chapt 3) */
- RCN("Command", commandWidgetClass );
- RCN("Label", labelWidgetClass );
-
- /* Menus (Chapt 4) */
- RCN("SimpleMenu", simpleMenuWidgetClass );
- RCN("SmeBSB", smeBSBObjectClass );
- RCN("SmeLine", smeLineObjectClass );
- RCN("MenuButton", menuButtonWidgetClass );
-
- /* Text Widgets (Chapt 5) */
- RCN("AsciiText", asciiTextWidgetClass );
- RCN("Text", textWidgetClass );
-
- /* Composite and Constraint Widgets (Chapt 6) */
- RCN("Dialog", dialogWidgetClass );
- RCN("Form", formWidgetClass );
-
- /* Other Interestng Widgets (not in ref manual) */
- RCN("Clock", clockWidgetClass );
-
-#ifdef Use_AtLabel /* djf's formatted text stuff... */
- RCN("AtLabel", atLabelWidgetClass );
-#endif
-
-#undef RCN
-}
+++ /dev/null
-# $Header$
-
-CFLAGS = -I/mit/x11 -I/mit/motif/include
-XLIBS = -L/mit/x11/$${HOSTTYPE}lib /mit/motif/`machtype`lib/libWc.a -lXaw -lXmu -lXt -lX11 \
- -L/usr/athena/lib -lkrb -ldes -lhesiod -lm
-
-OBJS = register.o AriRegAll.o
-
-all: register
-
-register: $(OBJS)
- cc -o register $(OBJS) $(XLIBS)
-
+++ /dev/null
-! App resources for Register
-
-register.wcChildren: box
-Register*Geometry: 600x500+205+90
-*.Font: -*-new century schoolbook-bold-r-normal--*-140-*-*-*
-
-*box.wcClassName: form
-*box.wcChildren: title, logo, info, fnamel, mnamel, lnamel, \
- idl, loginl, fnameb, mnameb, lnameb, idb, \
- loginb, go, again, quit
-*title.wcClassName: label
-*title.label: Project Athena Registration
-*title.borderWidth: 0
-*title.font: -*-new century schoolbook-bold-r-normal--*-240-*-*-*
-*title.vertDistance: 55
-*title.horizDistance: 40
-*title.left: ChainLeft
-*title.right: ChainLeft
-*logo.wcClassName: label
-*logo.bitmap: /etc/athena/login/bitmaps/owl
-*logo.fromHoriz: *title
-*logo.horizDistance: 30
-*logo.vertDistance: 10
-*logo.left: ChainLeft
-*logo.right: ChainLeft
-*logo.borderWidth: 0
-
-*info.wcClassName: label
-*info.fromVert: *logo
-*info.vertDistance: 20
-*info.horizDistance: 40
-*info.width: 450
-*info.height: 200
-*info*type: file
-*info*string: /mit/moiradev/src/clients/xregister/welcome
-*info*font: -*-new century schoolbook-medium-r-normal--*-140-*-*-*
-*info*displayCaret: false
-
-*fnamel.wcClassName: label
-*fnamel.fromVert: *info
-*fnamel.vertDistance: 20
-*fnamel.horizDistance: 80
-*fnamel.borderWidth: 0
-*fnamel.justify: left
-*fnamel.label: First Name:
-*fnamel.width: 150
-*fnameb.wcClassName: asciiText
-*fnameb.fromVert: *info
-*fnameb.vertDistance: 20
-*fnameb.fromHoriz: *fnamel
-*fnameb*editType: edit
-*fnameb*type: string
-*fnameb.width: 200
-*fnameb.borderWidth: 2
-*fnameb*useStringInPlace: true
-*fnameb*length: 80
-*fnameb*translations: #override \
- Ctrl<Key>n: AdvanceFocus()\n\
- Ctrl<Key>p: RetreatFocus()\n
-
-*mnamel.wcClassName: label
-*mnamel.fromVert: *fnamel
-*mnamel.horizDistance: 80
-*mnamel.borderWidth: 0
-*mnamel.justify: left
-*mnamel.label: Middle Name:
-*mnamel.width: 150
-*mnameb.wcClassName: asciiText
-*mnameb.fromVert: *fnamel
-*mnameb.fromHoriz: *mnamel
-*mnameb*string:
-*mnameb*editType: edit
-*mnameb*type: string
-*mnameb.width: 200
-*mnameb.borderWidth: 0
-*mnameb.displayCaret: false
-*mnameb*useStringInPlace: true
-*mnameb*length: 80
-
-*lnamel.wcClassName: label
-*lnamel.fromVert: *mnamel
-*lnamel.horizDistance: 80
-*lnamel.borderWidth: 0
-*lnamel.justify: left
-*lnamel.label: Family Name:
-*lnamel.width: 150
-*lnameb.wcClassName: asciiText
-*lnameb.fromVert: *mnamel
-*lnameb.fromHoriz: *lnamel
-*lnameb*string:
-*lnameb*editType: edit
-*lnameb*type: string
-*lnameb.width: 200
-*lnameb.borderWidth: 0
-*lnameb.displayCaret: false
-*lnameb*useStringInPlace: true
-*lnameb*length: 80
-
-*idl.wcClassName: label
-*idl.fromVert: *lnamel
-*idl.horizDistance: 80
-*idl.borderWidth: 0
-*idl.justify: left
-*idl.label: MIT ID Number:
-*idl.width: 150
-*idb.wcClassName: asciiText
-*idb.fromVert: *lnamel
-*idb.fromHoriz: *idl
-*idb.editType: edit
-*idb.width: 200
-*idb.type: string
-*idb.borderWidth: 0
-*idb.displayCaret: false
-*idb*useStringInPlace: true
-*idb*length: 80
-
-*loginl.wcClassName: label
-*loginl.fromVert: *idl
-*loginl.horizDistance: 80
-*loginl.borderWidth: 0
-*loginl.justify: left
-*loginl.label: Login ID:
-*loginl.width: 150
-*loginl.foreground: white
-*loginb.wcClassName: asciiText
-*loginb.fromVert: *idl
-*loginb.fromHoriz: *loginl
-*loginb.editType: edit
-*loginb.width: 200
-*loginb.type: string
-*loginb.borderWidth: 0
-*loginb.displayCaret: false
-*loginb*useStringInPlace: true
-*loginb*length: 80
-
-*go.wcClassName: command
-*go.fromVert: *loginl
-*go.vertDistance: 20
-*go.horizDistance: 50
-*go.label: OK
-*go.left: ChainLeft
-*go.right: ChainLeft
-*again.wcClassName: command
-*again.fromVert: *loginl
-*again.vertDistance: 20
-*again.horizDistance: 160
-*again.fromHoriz: *go
-*again.label: Start Over
-*again.left: ChainLeft
-*again.right: ChainLeft
-*quit.wcClassName: command
-*quit.fromVert: *loginl
-*quit.vertDistance: 20
-*quit.horizDistance: 160
-*quit.fromHoriz: *again
-*quit.label: Quit
-*quit.left: ChainLeft
-*quit.right: ChainLeft
-*quit.callback: WcExitCB(0)
-
-
-! Help popup:
-*helpshell.allowShellResize: true
-*helpshell*font: -adobe-new century schoolbook-medium-r-normal--*-120-75-75-*
-*helptext*type: file
-*helptext*string: /mit/moiradev/src/clients/xregister/help
-*helptext.scrollVertical:always
-*helptext.width: 500
-*helptext.height: 250
-*helpcmd.label: Click here to remove
-*helpcmd.fromVert: *text
+++ /dev/null
-This is some context-sensitive help text.
+++ /dev/null
-/* $Header$
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <Wc/WcCreate.h>
-#include <X11/Intrinsic.h>
-#include <X11/Xaw/Box.h>
-#include <X11/Xaw/Command.h>
-#include <X11/Xaw/Form.h>
-#include <X11/Xaw/AsciiText.h>
-#include <X11/Shell.h>
-#include <X11/StringDefs.h>
-#include <X11/cursorfont.h>
-#include <X11/Xutil.h>
-#include <X11/Xlib.h>
-
-
-int help(), again(), go();
-void advance_focus(), retreat_focus();
-char fname[128], mname[128], lname[128], iname[128], uname[128], pname[128];
-Widget TopWidget;
-
-XtActionsRec field_actions[] = {
- {"AdvanceFocus", advance_focus},
- {"RetreatFocus", retreat_focus},
-};
-
-#define NFIELDS 5
-struct field {
- char *s;
- Widget w;
-} fields[NFIELDS] = {
- { fname }, { mname }, { lname }, { iname }, { uname }
-};
-int active_field = 0;
-
-
-main(argc, argv)
-int argc;
-char **argv;
-{
- Widget table, w, box;
- XtAppContext app;
- Arg args[10];
- Cardinal arg_cnt;
- Cursor cursor;
-
- setenv("XAPPLRESDIR", "/mit/moiradev/src/clients/xregister/");
- TopWidget = XtInitialize("Register", "Register", NULL, 0,
- (unsigned int *)&argc, argv);
-
- XtGetApplicationResources(TopWidget, NULL, NULL, 0, NULL);
- app = XtWidgetToApplicationContext(TopWidget);
- AriRegisterAthena(app);
- WcWidgetCreation(TopWidget);
-
- XtRealizeWidget(TopWidget);
- XtMainLoop();
-
- XtAddActions(field_actions, 2);
- fname[0] = 0;
- XtSetArg(args[0], XtNstring, fname);
- fields[0].w = XtCreateManagedWidget("fnameb", asciiTextWidgetClass,
- box, args, 1);
- mname[0] = 0;
- XtSetArg(args[0], XtNstring, mname);
- fields[1].w = XtCreateManagedWidget("mnameb", asciiTextWidgetClass,
- box, args, 1);
- lname[0] = 0;
- XtSetArg(args[0], XtNstring, lname);
- fields[2].w = XtCreateManagedWidget("lnameb", asciiTextWidgetClass,
- box, args, 1);
- iname[0] = 0;
- XtSetArg(args[0], XtNstring, iname);
- fields[3].w = XtCreateManagedWidget("idb", asciiTextWidgetClass,
- box, args, 1);
- uname[0] = 0;
- XtSetArg(args[0], XtNstring, uname);
- fields[4].w = XtCreateManagedWidget("loginb", asciiTextWidgetClass,
- box, args, 1);
-
- w = XtCreateManagedWidget("go", commandWidgetClass, box, args, 0);
- XtAddCallback(w, XtNcallback, go, NULL);
- w = XtCreateManagedWidget("again", commandWidgetClass, box, args, 0);
- XtAddCallback(w, XtNcallback, again, NULL);
-}
-
-
-remove_popup(ignored, w, ignored1)
-Widget ignored;
-caddr_t w;
-caddr_t ignored1;
-{
- XtPopdown((Widget) w);
-}
-
-help(button)
-Widget button;
-{
- static Widget top;
- Widget box, last;
- Cardinal num_args;
- Arg args[12];
- Position x, y;
- static int inited = 0;
-
- if (!inited++) {
- XtTranslateCoords(TopWidget, (Position) 0, (Position) 120, &x, &y);
- num_args = 0;
- XtSetArg(args[num_args], XtNx, x); num_args++;
- XtSetArg(args[num_args], XtNy, y); num_args++;
- top = XtCreatePopupShell("helpshell", transientShellWidgetClass,
- TopWidget, args, num_args);
-
- box = XtCreateManagedWidget("box", boxWidgetClass, top, NULL, 0);
- last = XtCreateManagedWidget("helptext", asciiTextWidgetClass,
- box, args, 0);
- last = XtCreateManagedWidget("helpcmd", commandWidgetClass,
- box, NULL, 0);
- XtAddCallback(last, XtNcallback, remove_popup, top);
- }
- XtPopup(top, XtGrabNone);
-}
-
-again()
-{
- fname[0] = mname[0] = lname[0] = iname[0] = uname[0] = pname[0] = 0;
- activate_field(0);
-}
-
-activate_field(f)
-int f;
-{
- Arg args[10];
- int i;
-
- XtSetArg(args[0], XtNborderWidth, 0);
- XtSetArg(args[1], XtNdisplayCaret, False);
- for (i = 0; i < NFIELDS; i++) {
- XtSetValues(fields[i].w, args, 2);
- }
- XtSetArg(args[0], XtNborderWidth, 2);
- XtSetArg(args[1], XtNdisplayCaret, True);
- XtSetValues(fields[f].w, args, 2);
-}
-
-void advance_focus()
-{
- if (active_field++ >= NFIELDS)
- active_field = 0;
- activate_field(active_field);
-
-}
-
-void retreat_focus()
-{
- if (active_field-- < 0)
- active_field = NFIELDS;
- activate_field(active_field);
-
-}
-
-go()
-{
-}
+++ /dev/null
-Welcome to Project Athena user registration. To begin registering for
-your account, please type your first name as it appears on your MIT ID
-card, then press the key marked ``Return''. If you make a mistake while
-typing, use the key above the Return key to erase what you just typed.
-
-** NOTE: You must respond to each question within 90 seconds, or you
- will have to start over. (This is to prevent accident
- and/or vandalism.)
-
-** If you have trouble, please call the account administrator at x3-1325.