[27575] in Source-Commits
xdsc commit: Remove C version
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Mon Feb 3 15:59:26 2014
Date: Mon, 3 Feb 2014 15:59:18 -0500
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201402032059.s13KxIxM010533@drugstore.mit.edu>
To: source-commits@MIT.EDU
https://github.com/mit-athena/xdsc/commit/76e795a4d891dbf3e56eb435e7434fa27ecc2d48
commit 76e795a4d891dbf3e56eb435e7434fa27ecc2d48
Author: Jonathan Reed <jdreed@mit.edu>
Date: Mon Dec 9 14:09:04 2013 -0500
Remove C version
Makefile.in | 58 --
Xdsc | 288 ----------
cache.c | 581 --------------------
configure.in | 10 -
headers.c | 341 ------------
reply.c | 1465 -------------------------------------------------
xdsc.c | 1721 ----------------------------------------------------------
xdsc.h | 56 --
8 files changed, 0 insertions(+), 4520 deletions(-)
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index 8ce2201..0000000
--- a/Makefile.in
+++ /dev/null
@@ -1,58 +0,0 @@
-# $Id: Makefile.in,v 1.3 2000-04-10 02:02:32 ghudson Exp $
-
-SHELL=/bin/sh
-VPATH=@srcdir@
-INSTALL=@INSTALL@
-INSTALL_PROGRAM=@INSTALL_PROGRAM@
-MKDIR_P=@MKDIR_P@
-srcdir=@srcdir@
-top_srcdir=@top_srcdir@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-bindir=@bindir@
-sbindir=@sbindir@
-libdir=@libdir@
-mandir=@mandir@
-datadir=@datadir@
-sysconfdir=@sysconfdir@
-appdefsdir=${sysconfdir}/X11/app-defaults
-
-CC=@CC@
-DEFS=@DEFS@ -DEDSC_PATH=\"${libdir}/debathena-discuss/edsc\"
-CPPFLAGS=@CPPFLAGS@
-CFLAGS=@CFLAGS@
-X_CFLAGS=@X_CFLAGS@
-LDFLAGS=@LDFLAGS@
-X_LIBS=@X_LIBS@
-X_PRE_LIBS=@X_PRE_LIBS@
-X_EXTRA_LIBS=@X_EXTRA_LIBS@
-LIBS=@LIBS@
-ALL_LDFLAGS=${LDFLAGS} ${X_LIBS}
-ALL_CFLAGS=${CPPFLAGS} ${CFLAGS} ${X_CFLAGS} ${DEFS}
-ALL_LIBS=-lXaw -lXt -lXmu -lXext ${X_PRE_LIBS} -lX11 ${X_EXTRA_LIBS} ${LIBS}
-
-OBJS=xdsc.o reply.o headers.o cache.o
-
-all: xdsc
-
-xdsc: ${OBJS}
- ${CC} ${ALL_LDFLAGS} -o $@ ${OBJS} ${ALL_LIBS}
-
-.c.o:
- ${CC} -c ${ALL_CFLAGS} $<
-
-check:
-
-install:
- ${MKDIR_P} ${DESTDIR}${bindir}
- ${MKDIR_P} ${DESTDIR}${mandir}/man1
- ${MKDIR_P} ${DESTDIR}${appdefsdir}
- ${INSTALL_PROGRAM} xdsc ${DESTDIR}${bindir}
- ${INSTALL} -m 444 ${srcdir}/Xdsc ${DESTDIR}${appdefsdir}
- ${INSTALL} -m 444 ${srcdir}/xdsc.1 ${DESTDIR}${mandir}/man1
-
-clean:
- rm -f ${OBJS} xdsc
-
-distclean: clean
- rm -f config.cache config.log config.status Makefile
diff --git a/Xdsc b/Xdsc
deleted file mode 100644
index cccd50a..0000000
--- a/Xdsc
+++ /dev/null
@@ -1,288 +0,0 @@
-*loggingOn: False
-*BitmapFilePath: /usr/athena/lib/X11/bitmaps:/usr/lib/X11/bitmaps:/usr/include/X11/bitmaps
-
-*font: fixed
-
-*pane.refigureMode True
-
-*pane.topbox.borderWidth: 0
-*pane.topbox.help.label: HELP
-*pane.topbox.quit.label: QUIT
-*pane.topbox.showGrip: False
-*pane.topbox.allowResize: False
-
-*pane.toptext.min: 30
-*pane.toptext.height: 150
-*pane.toptext.scrollVertical: whenNeeded
-*pane.toptext.cursor: left_ptr
-*pane.toptext.translations: #override \
-<Btn1Down>: TriggerFocusMove(Here) DispatchClick() \n\
-<Btn1Motion>: extend-adjust() \n\
-<Btn1Up>: extend-end(PRIMARY, CUT_BUFFER0) \n\
-<Btn2Down>: Stub() \n\
-<Btn3Down>: extend-start() \n\
-<Btn3Motion>: extend-adjust() \n\
-<Btn3Up>: extend-end(PRIMARY, CUT_BUFFER0) \n\
-<Key>Return: Update() \n\
-<Key>Right: forward-character() \n\
-<Key>Left: backward-character() \n\
-<Key>Down: next-line() \n\
-Shift<Key>Up: FetchIfNecessary(Up,5) previous-line() \n\
-<Key>Up: FetchIfNecessary(Up,1) previous-line() \n\
-Ctrl<Key>r: search(backward) \n\
-Ctrl<Key>s: search(forward) \n\
-<Key>: Stub()
-
-*pane.bottext.preferredPaneSize: 250
-*pane.bottext.scrollVertical: always
-*pane.bottext.allowResize: True
-*pane.bottext.scrollHorizontal: never
-*pane.bottext.wrap: line
-*enterpopup*bodytext.autoFill: on
-
-
-*pane.label.label: (no current meeting)
-*pane.label.showGrip: True
-*pane.label.allowResize: True
-
-*pane.botbox.showGrip: True
-*pane.botbox.allowResize: False
-
-
-*enterpopup.pane.desctext.showGrip: False
-*enterpopup.pane.topbox.label.label: Subject:
-*enterpopup.pane.topbox.label.borderWidth: 0
-*enterpopup.pane.bodytext.scrollHorizontal: whenNeeded
-*enterpopup.pane.bodytext.scrollVertical: always
-*enterpopup.pane.bodytext.height: 150
-*enterpopup*Text.displayCaret: off
-*enterpopup*subjecttext.translations: \
-#override \n\
-Ctrl<Key>Return: TriggerSend(Go) \n\
-<Key>Return: TriggerFocusMove(Next) \n\
-<Key>Escape: TriggerSend(Cancel) \n\
-<Btn1Down>: TriggerFocusMove(Here) \n\
-<MapNotify>: TriggerFocusMove(Here) \n\
-<FocusIn>: display-caret(on) \n\
-<FocusOut>: display-caret(off)
-
-*enterpopup*bodytext.translations: \
-#override \n\
-Shift<Key>Return: TriggerFocusMove(Prev) \n\
-Ctrl<Key>Return: TriggerSend(Go) \n\
-<Key>Escape: TriggerSend(Cancel) \n\
-<Btn1Down>: TriggerFocusMove(Here) \n\
-<FocusIn>: display-caret(on) \n\
-<FocusOut>: display-caret(off)
-
-*enterpopup.pane.botbox.send.label: Send
-*enterpopup.pane.botbox.abort.label: Abort
-*enterpopup.pane.botbox.skipAdjust: True
-*enterpopup.pane.botbox.showGrip: False
-
-*writepopup.pane.label.label: Write transaction to file:
-*writepopup.pane.label.showGrip: False
-*writepopup.pane.box1.write.label: Write
-*writepopup.pane.box1.abort.label: Abort
-*writepopup.pane.text.showGrip: False
-*writepopup*text.translations: \
-#override \n\
-<Key>Return: TriggerWrite(Go) \n\
-<Key>Escape: TriggerWrite(Cancel) \n\
-<MapNotify>: TriggerFocusMove(Here) \n\
-<Btn1Down>: TriggerFocusMove(Here)
-
-*numpopup.pane.label.label: Go to transaction number:
-*numpopup.pane.label.showGrip: False
-*numpopup.pane.box1.goto.label: Go To
-*numpopup.pane.box1.abort.label: Abort
-*numpopup.pane.text.showGrip: False
-*numpopup*text.translations: \
-#override \n\
-<Key>Escape: TriggerNum(Cancel) \n\
-<Key>Return: TriggerNum(Go) \n\
-<MapNotify>: TriggerFocusMove(Here) \n\
-<Btn1Down>: TriggerFocusMove(Here)
-
-*helppopup.pane.box.okay.label: dismiss
-*helppopup.pane.helptext.height: 500
-*helppopup.pane.helptext.allowResize: True
-*helppopup*string: \
-\n\
- What the buttons mean:\n\
----------------------------------------------------------------------\n\
- Down Enter the next meeting with unread transactions\n\
- Up Enter the previous meeting with unread transactions\n\
- update Check for new transactions\n\
- configure Change the list of meetings you attend\n\
- mode Choose between listing meetings or transactions\n\
- show Choose how many transactions should be listed\n\
- HELP Display this screen\n\
- QUIT Quit\n\
-\n\
- <downarrow> Move cursor to the next line\n\
- <uparrow> Move cursor to the previous line\n\
- <return> Read the meeting or transaction the cursor is on\n\
----------------------------------------------------------------------\n\
- next Read the next transaction in the current meeting\n\
- prev Read the previous transaction in the current meeting\n\
- Next in chain Read the next transaction in this chain\n\
- Prev in chain Read the previous transaction in this chain\n\
- goto Choose a specific transaction to read\n\
- enter Enter a new transaction or reply to the current one\n\
- write Save the current transaction to a file or mail it\n\
-\n\
- <spacebar> 'do the right thing'\n\
- <backspace> reverse what space did\n\
----------------------------------------------------------------------\n\
-You can also enter a meeting by doubleclicking on its title.\n\
-\n\
-The keyboard equivalent for clicking on a button is always the first\n\
-character on the button.\n\
-\n\
-If a button is grayed out, this action is not possible at this time.\n\
-For example, the 'enter' button will gray out when you do not have\n\
-permission to enter transactions in a meeting.
-
-
-*addpopup.pane.width: 600
-*addpopup.pane.label.label: Adding a meeting
-*addpopup.pane.label.showGrip: False
-*addpopup.pane.box1.label.label: Host:
-*addpopup.pane.box1.label.borderWidth: 0
-*addpopup.pane.box1.showGrip: False
-*addpopup.pane.box2.label.label: Pathname:
-*addpopup.pane.box2.label.borderWidth: 0
-*addpopup.pane.box2.showGrip: False
-*addpopup.pane.box3.add.label: Add
-*addpopup.pane.box3.abort.label: Abort
-*addpopup.pane.box3.allowResize: False
-*addpopup*Text.displayCaret: off
-*addpopup*hosttext.translations: \
-#override \n\
-<Key>Escape: TriggerAdd(Cancel) \n\
-Ctrl<Key>Return: TriggerAdd(Go) \n\
-<Key>Return: TriggerFocusMove(Next) \n\
-<FocusIn>: display-caret(on) \n\
-<FocusOut>: display-caret(off) \n\
-<Enter>: Stub() \n\
-<Leave>: Stub() \n\
-<MapNotify>: TriggerFocusMove(Here) \n\
-<Btn1Down>: TriggerFocusMove(Here)
-
-*addpopup*pathtext.translations: \
-#override \n\
-<Key>Escape: TriggerAdd(Cancel) \n\
-Ctrl<Key>Return: TriggerAdd(Go) \n\
-<Key>Return: TriggerFocusMove(Next) \n\
-<FocusIn>: display-caret(on) \n\
-<FocusOut>: display-caret(off) \n\
-<Enter>: Stub() \n\
-<Leave>: Stub() \n\
-<Btn1Down>: TriggerFocusMove(Here)
-
-*deletepopup.pane.width: 600
-*deletepopup.pane.label.label: Deleting a meeting
-*deletepopup.pane.label.showGrip: False
-*deletepopup.pane.box1.label.label: Meeting Name:
-*deletepopup.pane.box1.showGrip: False
-*deletepopup.pane.box1.label.borderWidth: 0
-*deletepopup.pane.box2.delete.label: Delete
-*deletepopup.pane.box2.abort.label: Abort
-*deletepopup.pane.box2.showGrip: False
-*deletepopup.pane.box2.width: 300
-*deletepopup*text.translations: \
-#override \n\
-<Key>Escape: TriggerDelete(Cancel) \n\
-<Key>Return: TriggerDelete(Go) \n\
-<MapNotify>: TriggerFocusMove(Here) \n\
-<Btn1Down>: TriggerFocusMove(Here)
-
-*configurebutton.leftBitmap: menu12
-*modebutton.leftBitmap: menu12
-*showbutton.leftBitmap: menu12
-*gotobutton.leftBitmap: menu12
-*enterbutton.leftBitmap: menu12
-*botbox.writebutton.leftBitmap: menu12
-
-*warningpopup.pane.box.acknowledge.label: dismiss
-*warningpopup.pane.label1.showGrip: False
-*warningpopup.pane.label2.showGrip: False
-*warningpopup.pane.box.showGrip: False
-
-*pane.accelerators: \
-#override \n\
-Shift<Key>N: KeyCallback(nchainbutton) \n\
-Shift<Key>P: KeyCallback(pchainbutton) \n\
-!<Key>n: KeyCallback(nextbutton) \n\
-!<Key>p: KeyCallback(prevbutton) \n\
-<Key>space: DoTheRightThing() \n\
-<Key>Delete: DoTheRightThingInReverse() \n\
-Shift<Key>D: KeyCallback(downbutton) \n\
-Shift<Key>U: KeyCallback(upbutton) \n\
-<Key>u: KeyCallback(updatebutton) \n\
-Shift<Key>H: KeyCallback(helpbutton) \n\
-Shift<Key>Q: KeyCallback(quitbutton) \n\
-<Key>c: KeyCallback(configurebutton) \n\
-<Key>m: KeyCallback(modebutton) \n\
-!<Key>s: KeyCallback(showbutton) \n\
-<Key>g: KeyCallback(gotobutton) \n\
-<Key>e: KeyCallback(enterbutton) \n\
-<Key>w: KeyCallback(writebutton) \n\
-<Key>d: PopdownCB() \n\
-~Ctrl<Key>h: HelpCB()
-
-*configure.translations: \
-#override \n\
-<Key>a: MenuCallback(configurebutton, addbutton) \n\
-<Key>d: MenuCallback(configurebutton, deletebutton) \n\
-<Key>: MenuCallback(abort) \n\
-
-*mode.translations: \
-#override \n\
-<Key>t: MenuCallback(modebutton, transbutton) \n\
-<Key>m: MenuCallback(modebutton, meetingbutton) \n\
-<Key>: MenuCallback(abort) \n\
-
-*show.translations: \
-#override \n\
-<Key>u: MenuCallback(showbutton, unreadbutton) \n\
-<Key>a: MenuCallback(showbutton, allbutton) \n\
-<Key>b: MenuCallback(showbutton, backbutton) \n\
-<Key>: MenuCallback(abort) \n\
-
-*goto.translations: \
-#override \n\
-<Key>n: MenuCallback(gotobutton, numberbutton) \n\
-:<Key>f: MenuCallback(gotobutton, firstbutton) \n\
-:<Key>l: MenuCallback(gotobutton, lastbutton) \n\
-:<Key>s: MenuCallback(gotobutton, frefbutton) \n\
-:<Key>e: MenuCallback(gotobutton, lrefbutton) \n\
-
-*enter.translations: \
-#override \n\
-<Key>r: MenuCallback(enterbutton, replybutton) \n\
-<Key>n: MenuCallback(enterbutton, newbutton) \n\
-<Key>: MenuCallback(abort) \n\
-
-*write.translations: \
-#override \n\
-<Key>w: MenuCallback(writebutton, writebutton) \n\
-<Key>m: MenuCallback(writebutton, mailbutton) \n\
-<Key>: MenuCallback(abort) \n\
-
-*warningpopup*translations: \
-#override \n\
-<MapNotify>: TriggerFocusMove(Here) \n\
-<Key>d: TriggerPopdown(Go) \n\
-<Key>Return: TriggerPopdown(Go) \n\
-<Key>space: TriggerPopdown(Go) \n\
-
-*helppopup*translations: \
-#override \n\
-<MapNotify>: TriggerFocusMove(Here) \n\
-<Key>d: TriggerPopdown(Go) \n\
-<Key>Return: TriggerPopdown(Go) \n\
-<Btn2Down>: Stub() \n\
-<Key>: Stub()
-
diff --git a/cache.c b/cache.c
deleted file mode 100644
index 06da95b..0000000
--- a/cache.c
+++ /dev/null
@@ -1,581 +0,0 @@
-/*
-Copyright 1991 by the Massachusetts Institute of Technology
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of M.I.T. not be used in
-advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-M.I.T. makes no representations about the suitability of
-this software for any purpose. It is provided "as is"
-without express or implied warranty.
-*/
-
-/*
-** cache.c: manage the files in /tmp
-**
-** Ensure we have the ones we need, and get rid of the ones no
-/*
-** cache.c: manage the files in /tmp
-**
-** Ensure we have the ones we need, and get rid of the ones no
-** longer in use.
-**
-*/
-
-#include <stdio.h>
-#include <X11/Intrinsic.h>
-#include <X11/StringDefs.h>
-#include <X11/IntrinsicP.h>
-#include <X11/CoreP.h>
-#include <X11/Xaw/Command.h>
-#include <X11/Xaw/AsciiText.h>
-#include <X11/Xaw/TextP.h>
-#include <fcntl.h>
-#include "xdsc.h"
-
-#define NUM_CACHED_FILES 5
-#define CACHE_DIR_NEXT 1
-#define CACHE_DIR_PREV 2
-#define CACHE_DIR_NREF 3
-#define CACHE_DIR_PREF 4
-
-
-static char rcsid[] = "$Id: cache.c,v 1.13 1999-12-16 01:58:23 danw Exp $";
-
-extern char *RunCommand();
-extern EntryRec toplevelbuttons[2][MAX_BUTTONS];
-extern TextWidget bottextW, toptextW;
-extern Boolean debug;
-extern char filebase[];
-extern int topscreen;
-extern int edscversion;
-extern Widget topW;
-extern void TopSelect();
-extern Boolean nocache;
-extern char axis[];
-
-int next=0, prev=0;
-static int nref = 0, pref=0, fref=0, lref=0;
-static int first=0, last=0;
-static int highestseen;
-static int current;
-
-static int cache[NUM_CACHED_FILES] = {-1,-1,-1,-1,-1};
-static char currentmtglong[LONGNAMELEN] = "";
-static char currentmtgshort[SHORTNAMELEN] = "";
-
-char *GetTransactionFile();
-
-char *
-CurrentMtg(which)
-int which;
-{
- if (which == 0)
- return (currentmtglong);
- else
- return (currentmtgshort);
-}
-
-int
-SaveMeetingNames(newlong, newshort)
-char *newlong;
-char *newshort;
-{
- char oldlong[LONGNAMELEN];
- char oldshort[SHORTNAMELEN];
- if (*currentmtglong) {
- MarkLastRead();
- DeleteOldTransactions();
- }
-
- if (*newlong) {
- strcpy (oldlong, currentmtglong);
- strcpy (currentmtglong, newlong);
- strcpy (oldshort, currentmtgshort);
- strcpy (currentmtgshort, newshort);
- if (SetUpTransactionNumbers() == -1) {
- strcpy (currentmtglong, oldlong);
- strcpy (currentmtgshort, oldshort);
- return (-1);
- }
- }
-
- else {
- *currentmtglong = '\0';
- *currentmtgshort = '\0';
- }
- return (0);
-}
-
-/*
-** GoToTransaction updates the data structures and cache so that
-** we are in a particular transaction.
-**
-** if 'update' is True (it usually is) we put the contents of the
-** transaction into the lower text widget.
-*/
-
-GoToTransaction (num, update)
-int num;
-Boolean update;
-{
- static char command[LONGNAMELEN + 25];
- char *filename;
- char *returndata;
- int transactionnum;
-
- if (!num) return;
-
- if (num < 0)
- transactionnum = TransactionNum(num);
- else
- transactionnum = num;
-
- if (update && topscreen == LISTTRNS);
- UpdateHighlightedTransaction(transactionnum);
-
- sprintf (command, "Reading %s [%d-%d], #%d...",
- currentmtglong, first, last, transactionnum);
- PutUpStatusMessage(command);
-
- if ((filename = GetTransactionFile(num)) == (char *) -1)
- return (-1);
-
- if (update)
- FileIntoWidget(filename, bottextW);
-
- sprintf (command, "(gti %d %s)\n", transactionnum, currentmtglong);
- returndata = RunCommand (command, NULL, NULL, True);
-
- if ((int) returndata <= 0) goto DONE;
-
- sscanf ( returndata,
- "%*c%d%d%d%d%d%d%d%*s",
- ¤t, &prev, &next, &pref,
- &nref, &fref, &lref);
-
- myfree(returndata);
- CheckButtonSensitivity(BUTTONS_UPDATE);
-
- if (!nocache)
- CacheSurroundingTransactions();
-
- if ( current > highestseen)
- highestseen = current;
-
- if ( next > last || current > last) {
- MarkLastRead();
- (void) SetUpTransactionNumbers();
- }
-
- if (highestseen == last && topscreen == MAIN)
- RemoveLetterC();
-DONE:
- sprintf (command, "Reading %s [%d-%d], #%d",
- currentmtglong, first, last, transactionnum);
- PutUpStatusMessage(command);
-}
-
-DeleteOldTransactions()
-{
- char filename[80];
- unsigned int fd;
-
- DeleteTransactionFile(current);
- DeleteTransactionFile(prev);
- DeleteTransactionFile(next);
- DeleteTransactionFile(pref);
- DeleteTransactionFile(nref);
-
- sprintf (filename, "%s-list", filebase);
- if ((fd = open(filename, O_RDONLY)) != -1) {
- close (fd);
- unlink (filename);
- }
-
- next=0, prev=0, nref=0;
- pref=0, fref=0, lref=0;
- first=0, last=0, current=0;
-}
-
-/*
-** Read in the transactions immedidately before and after the
-** current one.
-*/
-
-CacheSurroundingTransactions()
-{
-
- int i;
-
-/*
-** Remove unnecessary files
-*/
-
- for (i = 0; i < NUM_CACHED_FILES; i++) {
- if ( cache[i] != next && cache[i] != prev &&
- cache[i] != nref && cache[i] != pref &&
- cache[i] != current && cache[i] != -1) {
-
- DeleteTransactionFile(cache[i]);
- }
- }
-
-/*
-** Get the files we need
-*/
- (void) GetTransactionFile (next);
- (void) GetTransactionFile (prev);
- (void) GetTransactionFile (nref);
- (void) GetTransactionFile (pref);
- (void) GetTransactionFile (current);
-
-}
-
-/*
-** Remove the file from /tmp and the cache.
-*/
-
-DeleteTransactionFile(num)
-int num;
-{
- char filename[50];
- int i;
-
- sprintf (filename, "%s-%d", filebase, num);
- unlink (filename);
-
- for (i = 0; i < NUM_CACHED_FILES; i++)
- if (cache[i] == num)
- cache[i] = -1;
-}
-
-/*
-** This function behaves differently depending on the version of
-** edsc we're talking to.
-**
-** If edsc is doing the caching, just ask for the transaction and
-** return the filename.
-**
-** If we're doing the caching, ask if the file is already in the cache,
-** and return the filename if it is. Otherwise, run the
-** edsc command to fetch it, note it as cached, and return the filename.
-**
-*/
-
-char *
-GetTransactionFile(num)
-int num;
-{
- static char filename[50];
- char command[LONGNAMELEN + 25];
- int i;
- char *retval;
- int transactionnum;
- int direction;
-
- if (num == 0)
- return((char *)-1);
-
-/*
-** have we been passed a symbol instead of a number?
-*/
-
- if (num < 0)
- transactionnum = TransactionNum(num);
- else
- transactionnum = num;
-
- if (!nocache)
- sprintf (filename, "%s-%d", filebase, transactionnum);
-/*
-** See if the file is in our cache. If so, return its filename;.
-*/
- if (!nocache) {
- for (i = 0; i < NUM_CACHED_FILES; i++) {
- if (cache[i] == num) {
- return (filename);
- }
- }
- }
-
-/*
-** If file doesn't exist, go get it.
-*/
- if (nocache) {
- switch (num) {
- case NEXT:
- direction = CACHE_DIR_NEXT;
- break;
- case PREV:
- direction = CACHE_DIR_PREV;
- break;
- case NREF:
- direction = CACHE_DIR_NREF;
- break;
- case PREF:
- direction = CACHE_DIR_PREF;
- break;
- default:
- direction = 0;
- break;
- }
-
- sprintf ( command, "(gtfc %d %d %s)\n",
- direction, transactionnum, currentmtglong);
-
- retval = RunCommand (command, NULL, NULL, True);
- if ((int) retval <= 0)
- return((char *)-1);
- sscanf (retval, "(\"%[^\"]", filename);
- }
-
- else {
- sprintf ( command, "(gtf %s %d %s)\n",
- filename, transactionnum, currentmtglong);
- retval = RunCommand (command, NULL, NULL, True);
- if ((int) retval <= 0)
- return((char *)-1);
-
- for (i = 0; i < NUM_CACHED_FILES; i++) {
- if (cache[i] == -1) {
- cache[i] = num;
- break;
- }
- }
- }
-
- myfree (retval);
- return (filename);
-}
-
-/*
-** Return the highestseen from mtg. Also set first, last, and highestseen.
-** Set current to highestseen if it's not already set (ie, we've just
-** entered the meeting)
-**
-** Return -1 if something went wrong.
-*/
-
-int
-SetUpTransactionNumbers()
-{
-
- char command[LONGNAMELEN + 25];
- char *retval;
- static int oldhighestseen = 0;
-
- sprintf (command, "(gmi %s)\n", currentmtglong);
-
- retval = RunCommand (command, NULL, NULL, True);
- if ((int) retval <= 0) return (-1);
-
- sscanf (retval, "(\"%*[^\"]\" \"%*[^\"]\" \"%*[^\"]\" %d %d %*d %*d \"%*[^\"]\" \"%*[^\"]\" %*d \"%[^\"]\" %d",
- &first, &last, axis, &highestseen);
-
- oldhighestseen = highestseen;
-
- if (last == 0 && first == 0) {
- fprintf (stderr,"xdsc: Reply out of sync with request!\n");
- fprintf (stderr,"xdsc: requested '%s', got '%s'\n",command, retval);
- PutUpWarning( "INTERNAL ERROR DETECTED",
- "I suggest you quit immediately to avoid\npossible corruption of your .meetings file.", True);
- myfree(retval);
- return (-1);
- }
- myfree(retval);
-
- if (highestseen > last) {
- PutUpWarning( "WARNING",
- "The highest-read transaction in this\nmeeting no longer exists.\nGoing to end of the meeting.", True);
- highestseen = last;
- }
-
- if (debug) {
- fprintf (stderr, "highestseen message of %s is %d\n",
- currentmtglong, highestseen);
-
- fprintf (stderr, "first is %d, last is %d\n",first, last);
- }
-
- GoToTransaction (highestseen, False);
-
- return (highestseen);
-}
-
-MarkLastRead()
-{
- static char command[LONGNAMELEN + 25];
-
- if (*currentmtglong) {
- sprintf ( command,
- "(ss %d %s)\n",
- highestseen,
- currentmtglong);
- if (edscversion >= 24)
- (void) RunCommand (command, NULL, NULL, True);
- else
- (void) RunCommand (command, NULL, NULL, False);
- }
-
-}
-
-TransactionNum(arg)
-int arg;
-{
- switch (arg) {
- case NEXT:
- return(next);
- case PREV:
- return(prev);
- case NREF:
- return(nref);
- case PREF:
- return(pref);
- case LREF:
- return(lref);
- case FREF:
- return(fref);
- case FIRST:
- return(first);
- case LAST:
- return(last);
- case CURRENT:
- return(current);
- case HIGHESTSEEN:
- return(highestseen);
- default:
- fprintf (stderr, "Unknown arg to TransactionNum: %d\n", arg);
- return(0);
- }
-}
-
-MoveToMeeting(which)
-int which;
-{
- Arg args[2];
- Boolean transactionflag = False;
-/*
-** If we're currently showing transactions, we have to restore the top-level
-** list of meetings.
-*/
- if (topscreen == LISTTRNS) {
- XawTextDisableRedisplay(toptextW);
- TopSelect (NULL, 4 + (1 << 4));
- transactionflag = True;
- }
-
-/*
-** HighlightNewItem will eventually call SaveMeetingNames and
-** SetUpTransactionNumbers to get the next, prev, etc. vars set.
-*/
- if (HighlightNewItem(toptextW, which, True) == 0) {
-
-/*
-** Need to restore transaction list?
-*/
- if (transactionflag == True) {
- TopSelect (NULL, 4 + (0 << 4));
- XawTextEnableRedisplay(toptextW);
- }
-
-/*
-** Clear out bottom text window.
-*/
- XtSetArg (args[0], XtNstring, "");
- XtSetArg (args[1], XtNlength, 0);
- XtSetValues (bottextW, args, 1);
-
-/*
-** If we're at the end of the meeting, make it so the "next" button
-** will show us the last transaction.
-*/
- if (next == 0)
- next = last;
-
- CheckButtonSensitivity(BUTTONS_ON);
- return (0);
- }
-
- else {
- return (-1);
- }
-}
-
-/*
-** Make sure bottom buttons are set appropriately, according to context
-** and mode.
-**
-** Mode = BUTTONS_UPDATE: turn on appropriate buttons, if sensitive = True.
-** Mode = BUTTONS_OFF: Turn off all buttons. Set sensitive = False.
-** Mode = BUTTONS_ON: Turn on appropriate buttons. Set sensitive = True.
-**
-*/
-CheckButtonSensitivity(mode)
-int mode;
-{
- static Boolean sensitive = True;
- Arg args[2];
-
- if (mode == BUTTONS_ON) sensitive = True;
- if (mode == BUTTONS_OFF) sensitive = False;
-
- if (next && sensitive) {
- XtSetArg(args[0], XtNsensitive, True);
- XtSetArg(args[1], XtNborderWidth, 1);
- }
- else {
- XtSetArg(args[0], XtNsensitive, False);
- XtSetArg(args[1], XtNborderWidth, 4);
- }
- XtSetValues ((toplevelbuttons[1][0]).button, args, 2);
-
- if (prev && sensitive)
- XtSetArg(args[0], XtNsensitive, True);
- else
- XtSetArg(args[0], XtNsensitive, False);
- XtSetValues ((toplevelbuttons[1][1]).button, args, 1);
-
- if (nref && sensitive)
- XtSetArg(args[0], XtNsensitive, True);
- else
- XtSetArg(args[0], XtNsensitive, False);
- XtSetValues ((toplevelbuttons[1][2]).button, args, 1);
-
- if (pref && sensitive)
- XtSetArg(args[0], XtNsensitive, True);
- else
- XtSetArg(args[0], XtNsensitive, False);
- XtSetValues ((toplevelbuttons[1][3]).button, args, 1);
-
- if (topscreen == LISTTRNS && sensitive)
- XtSetArg(args[0], XtNsensitive, True);
- else
- XtSetArg(args[0], XtNsensitive, False);
- XtSetValues ((toplevelbuttons[0][5]).button, args, 1);
-
- if (axis[0] == ' ' && axis[6] == ' ')
- XtSetArg(args[0], XtNsensitive, False);
- else
- XtSetArg(args[0], XtNsensitive, True);
- XtSetValues ((toplevelbuttons[1][5]).button, args, 1);
-
- if (axis[0] == ' ')
- XtSetArg(args[0], XtNsensitive, False);
- else
- XtSetArg(args[0], XtNsensitive, True);
- XtSetValues ((toplevelbuttons[1][5]).nextrec->button, args, 1);
-
- if (axis[6] == ' ')
- XtSetArg(args[0], XtNsensitive, False);
- else
- XtSetArg(args[0], XtNsensitive, True);
- XtSetValues ((toplevelbuttons[1][5]).nextrec->nextrec->button, args, 1);
-
- XtSetArg(args[0], XtNsensitive, False);
- XtSetValues ((toplevelbuttons[1][6]).nextrec->nextrec->button, args, 1);
-}
diff --git a/configure.in b/configure.in
deleted file mode 100644
index fd06e09..0000000
--- a/configure.in
+++ /dev/null
@@ -1,10 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(xdsc.c)
-
-AC_PROG_CC
-AC_PROG_INSTALL
-AC_PROG_MKDIR_P
-
-AC_PATH_XTRA
-
-AC_OUTPUT(Makefile)
diff --git a/headers.c b/headers.c
deleted file mode 100644
index 78c01bd..0000000
--- a/headers.c
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
-Copyright 1991 by the Massachusetts Institute of Technology
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of M.I.T. not be used in
-advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-M.I.T. makes no representations about the suitability of
-this software for any purpose. It is provided "as is"
-without express or implied warranty.
-*/
-
-/*
-** headers.c: manage the list of transaction headers
-**
-*/
-
-#include <stdio.h>
-#include <X11/Intrinsic.h>
-#include <X11/StringDefs.h>
-#include <X11/IntrinsicP.h>
-#include <X11/CoreP.h>
-#include <X11/Xaw/AsciiText.h>
-#include <X11/Xaw/TextP.h>
-#include "xdsc.h"
-
-static char rcsid[] = "$Id: headers.c,v 1.5 1999-12-16 01:58:23 danw Exp $";
-
-extern char *RunCommand();
-extern EntryRec toplevelbuttons[2][MAX_BUTTONS];
-extern TextWidget bottextW, toptextW;
-extern Boolean debug;
-extern char filebase[];
-extern int topscreen;
-extern void TopSelect();
-extern char *CurrentMtg();
-
-static void FetchHeaders();
-static char oldmeeting[LONGNAMELEN];
-
-/*
-** Get the list of transaction headers from start to finish and
-** put them into the upper text widget.
-*/
-
-PutUpTransactionList(start, finish)
-int start;
-int finish;
-{
- char command[LONGNAMELEN + 25];
- char filename[70];
- static int oldstart=0, oldfinish=0;
- Arg args[1];
-
- XtSetArg(args[0], XtNsensitive, True);
- XtSetValues ((toplevelbuttons[0][5]).button, args, 1);
-
- if (start < TransactionNum(FIRST))
- start = TransactionNum(FIRST);
-
- if (finish > TransactionNum(LAST))
- finish = TransactionNum(LAST);
-
-/*
-** Can we optimize by keeping some of the old data?
-*/
- if ( *oldmeeting &&
- !strcmp (oldmeeting, CurrentMtg(0)) &&
- finish == oldfinish &&
- start <= oldstart) {
-
-/*
-** Just put up old list
-*/
- if (oldstart == start) {
- sprintf (filename, "%s-list", filebase);
- FileIntoWidget(filename, toptextW);
- return;
- }
-
-/*
-** Prepend to old list
-*/
- sprintf ( command, "mv %s-list %s-old",
- filebase, filebase);
-
- if (system (command) != 0) {
- sprintf ( command,
- "Cannot write to '%s-old'\n",
- filebase);
- PutUpWarning("WARNING", command, False);
- }
-
- FetchHeaders(start, oldstart-1);
-
- sprintf ( command,
- "cat %s-old >> %s-list",
- filebase, filebase);
- if (system (command) != 0) {
- sprintf ( command,
- "Cannot write to '%s-list'\n",
- filebase);
- PutUpWarning("WARNING", command, False);
- }
-
- sprintf (filename, "%s-old", filebase);
- unlink (filename);
- }
-/*
-** Get an entirely new list
-*/
- else {
- FetchHeaders(start, finish);
- }
-
- sprintf (filename, "%s-list", filebase);
- FileIntoWidget(filename, toptextW);
-
- strcpy (oldmeeting, CurrentMtg(0));
- oldstart = start;
- oldfinish = finish;
-
- sprintf (command, "Reading %s [%d-%d], #%d",
- CurrentMtg(0),
- TransactionNum(FIRST),
- TransactionNum(LAST),
- TransactionNum(CURRENT));
-
- PutUpStatusMessage(command);
-}
-
-/*
-** Get the headers for the specified range of transactions. Get them in
-** packets of CHUNKSIZE if necessary, and update status line as doing so.
-*/
-
-static void
-FetchHeaders(start, finish)
-int start;
-int finish;
-{
- int localstart, localfinish;
- char command[LONGNAMELEN + 25];
- char filename[70];
- char *returndata;
-
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#define CHUNKSIZE 25
-
- localstart = start;
- localfinish = finish;
-
- sprintf (filename, "%s-list", filebase);
- unlink (filename);
- sprintf (filename, "%s-temp", filebase);
- unlink (filename);
-
- while (localstart <= finish) {
- localfinish = MIN (localstart + CHUNKSIZE - 1, finish);
-
- if (localfinish != finish)
-
- sprintf ( command,
- "Reading headers for transactions %d to %d (%d remaining)...",
- start, finish, (finish - localstart));
- else
- sprintf ( command,
- "Reading headers for transactions %d to %d...",
- start, finish);
-
- if (start == finish)
- sprintf ( command,
- "Reading header for transaction %d...",
- start);
-
-
- PutUpTempMessage(command);
-
- sprintf (filename, "%s-temp", filebase);
- sprintf (command, "(ls %s %d %d 0 %s)\n", filename,
- localstart, localfinish, CurrentMtg(0));
- returndata = RunCommand (command, NULL, NULL, True);
- if ((int) returndata <= 0) {
- TakeDownTempMessage();
- sprintf (filename, "%s-temp", filebase);
- unlink (filename);
- return;
- }
- myfree (returndata);
-
- sprintf ( command,
- "cat %s-temp >> %s-list",
- filebase, filebase);
- if (system (command) != 0) {
- sprintf ( command,
- "Cannot write to '%s-list'\n",
- filebase);
- PutUpWarning("WARNING", command, False);
- }
-
- localstart += CHUNKSIZE;
- }
- TakeDownTempMessage();
- sprintf (filename, "%s-temp", filebase);
- unlink (filename);
-}
-
-/*
-** This should only be called if topscreen == LISTTRNS. It moves
-** the marker on the upper text widget to the line for the
-** specified transaction. If moveinsert is true, it tells PutUpArrow
-** to move the text insert carat there, too.
-*/
-
-UpdateHighlightedTransaction(num, moveinsert)
-int num;
-Boolean moveinsert;
-{
- static int lastend;
- Arg args[5];
- unsigned int n;
- char *tempstring, *foo = NULL, *bar = NULL;
- char buf[50];
-
- n = 0;
- XtSetArg(args[n], XtNstring, &tempstring); n++;
- XtGetValues (toptextW, args, n);
-
-/*
-** Okay, the following is REAL STUPID code. I'm looking for a specific
-** transaction number, so I sprintf the specified transaction number
-** into a string and search for it in each line of the text widget's string.
-**
-** Should really use a better way to find the line than sequential search!
-*/
-
- sprintf (buf, " [%04d]", num);
- foo = tempstring;
-
-/*
-** Specialization for common case of moving one forwards...
-*/
- if ( lastend &&
- lastend < strlen (tempstring) &&
- (!strncmp (tempstring + lastend + 1, buf, strlen(buf))))
- foo = tempstring + lastend + 1;
-
- else {
- while (*foo) {
- if (!strncmp (foo, buf, strlen(buf)))
- break;
- for ( ; *foo && *foo != '\n'; foo++)
- ;
- if (*foo) foo++;
- }
- }
-
- if (*foo) {
- for (bar = foo; *bar && *bar != '\n'; bar++)
- ;
- PutUpArrow(toptextW, foo - tempstring, moveinsert);
- }
- if (bar)
- lastend = bar - tempstring;
-}
-
-/*
-** An arrow key has been hit in the upper text window. If we're showing
-** transactions, see if we need to fetch another header.
-*/
-
-void
-FetchIfNecessary(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-int *num_params;
-{
- TextWidget ctx = toptextW;
- int num;
- int step;
- XawTextPosition inspoint = ctx->text.insertPos;
-
- if (*num_params < 2)
- return;
-
- if (topscreen != LISTTRNS)
- return;
-
- step = atoi (params[1]);
-
- if (!strcmp(params[0], "Up")) {
- num = HighlightedTransaction();
- if ( (ctx->text.insertPos<ctx->text.lt.info[1].position) &&
- ctx->text.lt.top == 0 &&
- num != TransactionNum(FIRST)) {
- XawTextDisableRedisplay(ctx);
- PutUpTransactionList(num - step, TransactionNum(LAST));
- UpdateHighlightedTransaction(TransactionNum(CURRENT),False);
- XawTextSetInsertionPoint(ctx, inspoint + ctx->text.lt.info[step].position);
- XawTextEnableRedisplay(ctx);
- }
- }
-}
-
-/*
-** Pull the transaction number out of the highlighted line and return it
-*/
-
-HighlightedTransaction()
-{
- Arg args[5];
- unsigned int n, num;
- XawTextPosition start, inspoint;
- char *tempstring;
-
- n = 0;
- XtSetArg(args[n], XtNstring, &tempstring); n++;
- XtGetValues (toptextW, args, n);
-
- inspoint = XawTextGetInsertionPoint(toptextW);
-
- if (tempstring[inspoint] == '\0')
- return;
-
- for (start = inspoint; start && tempstring[start-1] != '\n'; start--)
- ;
-
- num = atoi (strchr (tempstring + start, '[') + 1);
-
- return (num);
-}
-
-InvalidateHeaders()
-{
- strcpy (oldmeeting, "\0");
-}
diff --git a/reply.c b/reply.c
deleted file mode 100644
index e05fa73..0000000
--- a/reply.c
+++ /dev/null
@@ -1,1465 +0,0 @@
-/*
-Copyright 1991 by the Massachusetts Institute of Technology
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of M.I.T. not be used in
-advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-M.I.T. makes no representations about the suitability of
-this software for any purpose. It is provided "as is"
-without express or implied warranty.
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <X11/Intrinsic.h>
-#include <X11/StringDefs.h>
-#include <X11/Xaw/List.h>
-#include <X11/Xaw/Command.h>
-#include <X11/Xaw/Box.h>
-#include <X11/Xaw/Paned.h>
-#include <X11/Xaw/AsciiText.h>
-#include <X11/Xaw/Dialog.h>
-#include <X11/Shell.h>
-#include "xdsc.h"
-
-static char rcsid[] = "$Id: reply.c,v 1.17 1999-01-22 23:15:39 ghudson Exp $";
-
-extern char *getenv();
-extern char *RunCommand();
-extern char *CurrentMtg();
-extern char filebase[];
-extern int topscreen;
-extern Widget topW, paneW;
-extern TextWidget bottextW;
-extern int char_width;
-extern char *GetTransactionFile();
-extern Boolean nocache;
-
-static char sourcefile[80];
-
-static void SendCB();
-void TriggerSend();
-
-static Widget writePopupW = 0, writeTextW;
-static void WriteCB();
-void TriggerWrite();
-
-static Widget numPopupW = 0, numTextW;
-static void NumCB();
-void GetTransactionNum();
-void TriggerNum();
-
-static Widget addPopupW = 0, addHostTextW, addPathTextW;
-static void AddCB();
-void TriggerAdd();
-
-static Widget deletePopupW = 0, deleteMtgTextW;
-static void DeleteCB();
-void TriggerDelete();
-
-static Widget warningPopupW = 0;
-void DieCB();
-void TriggerPopdown();
-void TriggerFocusMove();
-int PopdownCB();
-
-static Widget helpPopupW = 0;
-
-static char *GetDefaultValue();
-
-static Boolean CompareWithoutWhitespace();
-
-typedef struct {
- Widget sendPopupW;
- Widget sendButtonW;
- Widget subjectTextW;
- Widget bodyTextW;
- char mtg[80];
- int replynum;
-} SendData, *SendDataPtr;
-
-typedef struct trnrec {
- SendDataPtr data;
- struct trnrec *nextrec;
-} TransactionRec, *TransactionRecPtr;
-
-static TransactionRecPtr listhead = 0;
-
-/*
-** The structures TransactionRec and SendData are to keep track of the
-** contexts for multiple enter-transaction windows. listhead is the
-** first of a chain of TransactionRec's, one per window. This is
-** so we can search through the list when a keyhit comes in trying to
-** trigger a button, and figure out which button matches a particular
-** text widget.
-*/
-
-void
-SubmitTransaction(myreplynum)
-int myreplynum;
-{
- Arg args[5];
- unsigned int n;
- char *subjectline;
- char buffer[80];
- char *ptr1, *ptr2;
- char *returndata;
- Widget localPaneW, box1W, box2W, buttonW;
- SendDataPtr data;
- TransactionRecPtr i;
-
- if (listhead == 0) {
- listhead = (TransactionRecPtr) malloc (sizeof (TransactionRec));
- listhead->data = 0;
- listhead->nextrec = 0;
- }
-
- for (i = listhead; i->data != 0 && i->nextrec != 0; i = i->nextrec)
- ;
-
- if (i->data != 0) {
- i->nextrec =
- (TransactionRecPtr) malloc (sizeof (TransactionRec));
- i = i->nextrec;
- i->data = 0;
- i->nextrec = 0;
- }
-
- data = (SendDataPtr) malloc (sizeof (SendData));
-
- i->data = data;
-
-/*
-** Save current meeting name and reply number
-*/
- strcpy (data->mtg, CurrentMtg(0));
- data->replynum = myreplynum;
-
-/*
-** Find and use the subject of the previous transaction if we are replying.
-*/
- if (myreplynum != 0) {
- sprintf (buffer, "(gti %d %s)\n", myreplynum, CurrentMtg(0));
- returndata = RunCommand (buffer, NULL, NULL, True);
-
- if ((int) returndata <= 0) {
- return;
- }
-
-/*
-** Find the third quote
-*/
- for (n = 0, ptr1 = returndata; n < 3; n++)
- while (*ptr1++ != '\"')
- ;
-/*
-** Copy from just after the third quote to the next non-escaped quote
-*/
- ptr2 = buffer;
- while (*ptr1 != '\"') {
- if (*ptr1 == '\\')
- ptr1++;
- *ptr2++ = *ptr1++;
- }
- *ptr2 = '\0';
-
- if (!strncmp (buffer, "Re: ", 4)) {
- subjectline = (char *) malloc (strlen(buffer) + 1);
- sprintf (subjectline, "%s", buffer);
- }
- else {
- subjectline = (char *) malloc (strlen(buffer) + 5);
- sprintf (subjectline, "Re: %s", buffer);
- }
- myfree(returndata);
- }
- else {
- subjectline = (char *) malloc (80);
- sprintf (subjectline, "");
- }
-
- n = 0;
- XtSetArg(args[n], XtNwidth, 80 * char_width); n++;
- data->sendPopupW = XtCreatePopupShell(
- "enterpopup",
- topLevelShellWidgetClass,
- topW,
- args,
- n);
-
- n = 0;
- localPaneW = XtCreateManagedWidget(
- "pane",
- panedWidgetClass,
- data->sendPopupW,
- args,
- n);
-
- if (myreplynum == 0) {
- sprintf ( buffer,
- " (Entering new transaction in %s)",
- CurrentMtg(0));
- }
-
- else {
- sprintf ( buffer,
- " (Replying to transaction %d in %s)",
- myreplynum, CurrentMtg(0));
- }
-
- n = 0;
- XtSetArg(args[n], XtNstring, buffer); n++;
- XtSetArg(args[n], XtNeditType, XawtextRead); n++;
- (void) XtCreateManagedWidget(
- "desctext",
- asciiTextWidgetClass,
- localPaneW,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- box1W = XtCreateManagedWidget(
- "topbox",
- boxWidgetClass,
- localPaneW,
- args,
- n);
-
- n = 0;
- (void) XtCreateManagedWidget(
- "label",
- labelWidgetClass,
- box1W,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNstring, subjectline); n++;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- XtSetArg(args[n], XtNeditType, XawtextEdit); n++;
- XtSetArg(args[n], XtNwidth, 60 * char_width); n++;
- data->subjectTextW = XtCreateManagedWidget(
- "subjecttext",
- asciiTextWidgetClass,
- box1W,
- args,
- n);
- myfree(subjectline);
-
- n = 0;
- XtSetArg(args[n], XtNeditType, XawtextEdit); n++;
- XtSetArg(args[n], XtNwidth, 80 * char_width); n++;
- data->bodyTextW = XtCreateManagedWidget(
- "bodytext",
- asciiTextWidgetClass,
- localPaneW,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- box2W = XtCreateManagedWidget(
- "botbox",
- boxWidgetClass,
- localPaneW,
- args,
- n);
-
- n = 0;
- data->sendButtonW = XtCreateManagedWidget(
- "send",
- commandWidgetClass,
- box2W,
- args,
- n);
-
- XtAddCallback (data->sendButtonW, XtNcallback, SendCB, data);
-
- n = 0;
- buttonW = XtCreateManagedWidget(
- "abort",
- commandWidgetClass,
- box2W,
- args,
- n);
- XtAddCallback (buttonW, XtNcallback, SendCB, data);
- XtPopup(data->sendPopupW, XtGrabNone);
-}
-
-static void
-SendCB(w, client_data, call_data)
-Widget w;
-XtPointer client_data;
-XtPointer call_data;
-{
- Arg args[5];
- unsigned int n;
- char *tempstring;
- char command [LONGNAMELEN + 25];
- char filename[50];
- FILE *fp;
- char *returndata;
- SendDataPtr data = (SendDataPtr) client_data;
- TransactionRecPtr i, parent;
-
- if (data->sendButtonW == w) {
- n = 0;
- XtSetArg(args[n], XtNstring, &tempstring); n++;
- XtGetValues (data->bodyTextW, args, n);
-
- sprintf ( filename, "%s-%dr",
- filebase, data->replynum);
- if ((fp = fopen(filename, "w")) == (FILE *) NULL) {
- sprintf (command, "could not open file'%s'\n", filename);
- PutUpWarning("WARNING", command, False);
- }
- else {
- fprintf (fp, "%s\n", tempstring);
- fclose (fp);
-/*
-** Breakdown in the edsc protocol: We have to first send it the (at...)
-** to enter the transaction, then the newline-terminated subject line
-** on the next line. (No parens around subject line)
-*/
- sprintf(command, "(at %d %s %s)\n",
- data->replynum, filename, data->mtg);
- (void) RunCommand (command, NULL, NULL, False);
-
- n = 0;
- XtSetArg(args[n], XtNstring, &tempstring); n++;
- XtGetValues (data->subjectTextW, args, n);
-
- for (n = 0; tempstring[n]; n++)
- if (tempstring[n] == '\n')
- tempstring[n] = ' ';
-
- sprintf(command, "%s\n",tempstring);
-
- returndata = RunCommand (command, NULL, NULL, True);
- if ((int) returndata > 0)
- myfree(returndata);
- unlink (filename);
- }
- }
-
- XtDestroyWidget(data->sendPopupW);
- myfree (data);
-
- for (i = listhead, parent = 0; i; parent = i, i = i->nextrec) {
- if (data->subjectTextW == i->data->subjectTextW) {
- if (parent)
- parent->nextrec = i->nextrec;
- else
- listhead = i->nextrec;
- myfree (i->data);
- myfree (i);
- break;
- }
- }
-
- GoToTransaction (TransactionNum(CURRENT), False);
-
- XFlush(XtDisplay(topW));
-}
-
-void
-WriteTransaction(current)
-int current;
-{
- Arg args[5];
- unsigned int n;
- char destfile[80];
- Widget button, writePaneW, writeBox1W;
- Position parentx, parenty;
- Dimension parentwidth, mywidth;
-
- if (writePopupW)
- return;
-
- n = 0;
- XtSetArg(args[n], XtNwidth, &parentwidth); n++;
- XtSetArg(args[n], XtNx, &parentx); n++;
- XtSetArg(args[n], XtNy, &parenty); n++;
- XtGetValues (topW, args, n);
-
- sprintf ( destfile,
- "%s/xdsc/%s-%d", getenv("HOME"),
- CurrentMtg(1), current);
-
- if (nocache)
- strcpy (sourcefile, GetTransactionFile(current));
- else
- sprintf ( sourcefile,
- "%s-%d", filebase, current);
-
- mywidth = 80 * char_width;
-
- n = 0;
- XtSetArg(args[n], XtNwidth, mywidth); n++;
- XtSetArg(args[n], XtNtransient, True); n++;
- XtSetArg(args[n], XtNtransientFor, topW); n++;
- XtSetArg(args[n], XtNx,
- parentx + ((parentwidth - mywidth) / 2)); n++;
- XtSetArg(args[n], XtNy, parenty + 100); n++;
- writePopupW = XtCreatePopupShell(
- "writepopup",
- transientShellWidgetClass,
- topW,
- args,
- n);
-
- writePaneW = XtCreateManagedWidget(
- "pane",
- panedWidgetClass,
- writePopupW,
- NULL,
- 0);
-
- n = 0;
- (void) XtCreateManagedWidget(
- "label",
- labelWidgetClass,
- writePaneW,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- XtSetArg(args[n], XtNeditType, XawtextEdit); n++;
- XtSetArg(args[n], XtNwidth, 15 * char_width); n++;
- XtSetArg(args[n], XtNstring, destfile); n++;
-
- writeTextW = XtCreateManagedWidget(
- "text",
- asciiTextWidgetClass,
- writePaneW,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- writeBox1W = XtCreateManagedWidget(
- "box1",
- boxWidgetClass,
- writePaneW,
- args,
- n);
-
- n = 0;
- button = XtCreateManagedWidget(
- "write",
- commandWidgetClass,
- writeBox1W,
- args,
- n);
-
- XtAddCallback (button, XtNcallback, WriteCB, (XtPointer) True);
-
- n = 0;
- button = XtCreateManagedWidget(
- "abort",
- commandWidgetClass,
- writeBox1W,
- args,
- n);
-
- XtAddCallback (button, XtNcallback, WriteCB, (XtPointer) False);
- XtPopup(writePopupW, XtGrabNone);
-}
-
-static void
-WriteCB(w, client_data, call_data)
-Widget w;
-XtPointer client_data;
-XtPointer call_data;
-{
- char command[165];
- char *tempptr1, *destfile;
- Arg args[5];
- unsigned int n;
-
- if (!writePopupW)
- return;
-
- if ((Boolean) client_data) {
- n = 0;
- XtSetArg(args[n], XtNstring, &destfile); n++;
- XtGetValues (writeTextW, args, n);
-
-/*
-** Make directory path. We ignore errors until we actually try to copy.
-*/
- tempptr1 = strchr(destfile + 1,'/');
-
- while (tempptr1) {
- *tempptr1 = '\0';
- sprintf (command, "test -d %s", destfile);
- if (system (command) != 0) {
- sprintf (command, "mkdir %s", destfile);
- system (command);
- }
- *tempptr1 = '/';
- tempptr1 = strchr(tempptr1+1,'/');
- }
-
- sprintf (command, "cp %s %s", sourcefile, destfile);
- if (system (command) != 0) {
- sprintf (command, "Cannot write to '%s'\n",destfile);
- PutUpWarning("WARNING", command, False);
- }
- }
-
- XtDestroyWidget(writePopupW);
- writePopupW = 0;
-}
-
-void
-AddMeeting()
-{
- Arg args[5];
- unsigned int n;
- char *defaultvalue1, *defaultvalue2;
- Position parentx, parenty;
- Dimension parentwidth, mywidth;
-
- Widget addPaneW, addBox1W, addLabel1W;
- Widget addBox2W, addLabel2W, addBox3W, addButton1W;
- Widget addButton2W;
-
- if (addPopupW)
- return;
-
- n = 0;
- XtSetArg(args[n], XtNwidth, &parentwidth); n++;
- XtSetArg(args[n], XtNx, &parentx); n++;
- XtSetArg(args[n], XtNy, &parenty); n++;
- XtGetValues (topW, args, n);
-
- mywidth = 80 * char_width;
-
- n = 0;
- XtSetArg(args[n], XtNwidth, mywidth); n++;
- XtSetArg(args[n], XtNtransient, True); n++;
- XtSetArg(args[n], XtNtransientFor, topW); n++;
- XtSetArg(args[n], XtNx,
- parentx + ((parentwidth - mywidth) / 2)); n++;
- XtSetArg(args[n], XtNy, parenty + 100); n++;
-
- addPopupW = XtCreatePopupShell(
- "addpopup",
- transientShellWidgetClass,
- topW,
- args,
- n);
-
- addPaneW = XtCreateManagedWidget(
- "pane",
- panedWidgetClass,
- addPopupW,
- NULL,
- 0);
-
- n = 0;
- (void) XtCreateManagedWidget(
- "label",
- labelWidgetClass,
- addPaneW,
- args,
- n);
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- addBox1W = XtCreateManagedWidget(
- "box1",
- boxWidgetClass,
- addPaneW,
- args,
- n);
-
- n = 0;
- addLabel1W = XtCreateManagedWidget(
- "label",
- labelWidgetClass,
- addBox1W,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- XtSetArg(args[n], XtNeditType, XawtextEdit); n++;
- XtSetArg(args[n], XtNwidth, 60 * char_width); n++;
-/*
-** Is there a default hostname we can use?
-*/
- if (defaultvalue1 = GetDefaultValue("Host:")) {
- XtSetArg(args[n], XtNstring, defaultvalue1); n++;
- }
-
- addHostTextW = XtCreateManagedWidget(
- "hosttext",
- asciiTextWidgetClass,
- addBox1W,
- args,
- n);
-
- if (defaultvalue1)
- myfree (defaultvalue1);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- addBox2W = XtCreateManagedWidget(
- "box2",
- boxWidgetClass,
- addPaneW,
- args,
- n);
-
- n = 0;
- addLabel2W = XtCreateManagedWidget(
- "label",
- labelWidgetClass,
- addBox2W,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- XtSetArg(args[n], XtNeditType, XawtextEdit); n++;
- XtSetArg(args[n], XtNwidth, 60 * char_width); n++;
-/*
-** Is there a default pathname we can use?
-*/
- if (defaultvalue2 = GetDefaultValue("Pathname:")) {
- XtSetArg(args[n], XtNstring, defaultvalue2); n++;
- }
-
- addPathTextW = XtCreateManagedWidget(
- "pathtext",
- asciiTextWidgetClass,
- addBox2W,
- args,
- n);
-
- if (defaultvalue2)
- myfree (defaultvalue2);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- addBox3W = XtCreateManagedWidget(
- "box3",
- boxWidgetClass,
- addPaneW,
- args,
- n);
-
- n = 0;
- addButton1W = XtCreateManagedWidget(
- "add",
- commandWidgetClass,
- addBox3W,
- args,
- n);
- XtAddCallback (addButton1W, XtNcallback, AddCB, (XtPointer) True);
-
- n = 0;
- addButton2W = XtCreateManagedWidget(
- "abort",
- commandWidgetClass,
- addBox3W,
- args,
- n);
-
- XtAddCallback (addButton2W, XtNcallback, AddCB, (XtPointer) False);
- XtPopup(addPopupW, XtGrabNone);
-
-}
-
-static void
-AddCB(w, client_data, call_data)
-Widget w;
-XtPointer client_data;
-XtPointer call_data;
-{
- char buffer[165];
- char *tempstring1, *tempstring2, *returndata;
- Arg args[5];
- unsigned int n;
-
- if ((Boolean) client_data && addPopupW) {
- n = 0;
- XtSetArg(args[n], XtNstring, &tempstring1); n++;
- XtGetValues (addHostTextW, args, n);
-
- n = 0;
- XtSetArg(args[n], XtNstring, &tempstring2); n++;
- XtGetValues (addPathTextW, args, n);
-
- sprintf (buffer, "(am %s %s)\n", tempstring1, tempstring2);
- returndata = RunCommand (buffer, NULL, NULL, True);
-
- if ( (int) returndata <= 0)
- return;
-
-/* This forced an automatic update. Unfortunately, it erased any list
- of transaction headers.
-
- TopSelect(NULL, 2, NULL);
-*/
- myfree (returndata);
- myfree (tempstring1);
- myfree (tempstring2);
- }
-
- if (addPopupW) {
- XtDestroyWidget(addPopupW);
- XtSetKeyboardFocus(topW, topW);
- }
-
- addPopupW = 0;
-}
-
-void
-DeleteMeeting()
-{
- Arg args[5];
- unsigned int n;
-
- Widget deletePaneW, deleteBox1W;
- Widget deleteBox2W, deleteButton1W, deleteButton2W;
- char *defaultvalue;
- Position parentx, parenty;
- Dimension parentwidth, mywidth;
-
- if (deletePopupW)
- return;
-
- n = 0;
- XtSetArg(args[n], XtNwidth, &parentwidth); n++;
- XtSetArg(args[n], XtNx, &parentx); n++;
- XtSetArg(args[n], XtNy, &parenty); n++;
- XtGetValues (topW, args, n);
-
- mywidth = 80 * char_width;
-
- n = 0;
- XtSetArg(args[n], XtNwidth, mywidth); n++;
- XtSetArg(args[n], XtNtransient, True); n++;
- XtSetArg(args[n], XtNtransientFor, topW); n++;
- XtSetArg(args[n], XtNx,
- parentx + ((parentwidth - mywidth) / 2)); n++;
- XtSetArg(args[n], XtNy, parenty + 100); n++;
-
- deletePopupW = XtCreatePopupShell(
- "deletepopup",
- transientShellWidgetClass,
- topW,
- args,
- n);
-
- deletePaneW = XtCreateManagedWidget(
- "pane",
- panedWidgetClass,
- deletePopupW,
- NULL,
- 0);
-
- n = 0;
- (void) XtCreateManagedWidget(
- "label",
- labelWidgetClass,
- deletePaneW,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- deleteBox1W = XtCreateManagedWidget(
- "box1",
- boxWidgetClass,
- deletePaneW,
- args,
- n);
-
- n = 0;
- (void) XtCreateManagedWidget(
- "label",
- labelWidgetClass,
- deleteBox1W,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- XtSetArg(args[n], XtNeditType, XawtextEdit); n++;
- XtSetArg(args[n], XtNwidth, 60 * char_width); n++;
- if (defaultvalue = GetDefaultValue("Name:")) {
- XtSetArg(args[n], XtNstring, defaultvalue); n++;
- }
- deleteMtgTextW = XtCreateManagedWidget(
- "text",
- asciiTextWidgetClass,
- deleteBox1W,
- args,
- n);
-
- if (defaultvalue)
- myfree (defaultvalue);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- deleteBox2W = XtCreateManagedWidget(
- "box2",
- boxWidgetClass,
- deletePaneW,
- args,
- n);
-
- n = 0;
- deleteButton1W = XtCreateManagedWidget(
- "delete",
- commandWidgetClass,
- deleteBox2W,
- args,
- n);
- XtAddCallback (deleteButton1W, XtNcallback, DeleteCB,
- (XtPointer) True);
-
- n = 0;
- deleteButton2W = XtCreateManagedWidget(
- "abort",
- commandWidgetClass,
- deleteBox2W,
- args,
- n);
- XtAddCallback (deleteButton2W, XtNcallback, DeleteCB,
- (XtPointer) False);
-
- XtPopup(deletePopupW, XtGrabNone);
-
-}
-
-static void
-DeleteCB(w, client_data, call_data)
-Widget w;
-XtPointer client_data;
-XtPointer call_data;
-{
- char buffer[165];
- char *tempstring1, *returndata;
- Arg args[5];
- unsigned int n;
-
- if (!deletePopupW)
- return;
-
- if ((Boolean) client_data) {
- n = 0;
- XtSetArg(args[n], XtNstring, &tempstring1); n++;
- XtGetValues (deleteMtgTextW, args, n);
-/*
-** Protect us when we remove the current meeting. Watch out for leading
-** and trailing spaces in the text widget's value.
-*/
- if ( CompareWithoutWhitespace(tempstring1, CurrentMtg(0)) ||
- CompareWithoutWhitespace(tempstring1, CurrentMtg(1)))
- SaveMeetingNames("", "");
-
- sprintf (buffer, "(dm %s)\n", tempstring1);
- returndata = RunCommand (buffer, NULL, NULL, True);
-
- if ( (int) returndata <= 0)
- return;
-
-/*
- TopSelect(NULL, 2, NULL);
-*/
- myfree (returndata);
- myfree (tempstring1);
- }
-
- XtDestroyWidget(deletePopupW);
- deletePopupW = 0;
-}
-
-static Boolean
-CompareWithoutWhitespace(s, t)
-char *s, *t;
-{
- while (isspace(*s))
- *s++;
-
- while (isspace(*t))
- *t++;
-
- while (*s && *t && (*s++ == *t++))
- ;
-
- if (!*t && !*s)
- return (True);
-
- if (!*t) {
- while (isspace(*s))
- s++;
- if (!*s)
- return (True);
- else
- return (False);
- }
-
- if (!*s) {
- while (isspace(*t))
- t++;
- if (!*t)
- return (True);
- else
- return (False);
- }
-
- return (False);
-}
-
-PutUpWarning(prefix, message, deathoption)
-char *prefix;
-char *message;
-Boolean deathoption;
-{
- Arg args[5];
- unsigned int n;
- Widget warningPaneW, warningButtonW, warningBoxW, deathButtonW;
- Position parentx, parenty;
- Dimension parentwidth, mywidth;
- int flag = 0;
-
- if (warningPopupW)
- return;
-
- n = 0;
- XtSetArg(args[n], XtNwidth, &parentwidth); n++;
- XtSetArg(args[n], XtNx, &parentx); n++;
- XtSetArg(args[n], XtNy, &parenty); n++;
- XtGetValues (topW, args, n);
-
- mywidth = (strlen(message)+2) * char_width;
-
- n = 0;
- XtSetArg(args[n], XtNwidth, mywidth); n++;
- XtSetArg(args[n], XtNtransient, True); n++;
- XtSetArg(args[n], XtNtransientFor, topW); n++;
- XtSetArg(args[n], XtNx,
- parentx + ((parentwidth - mywidth) / 2)); n++;
- XtSetArg(args[n], XtNy, parenty + 100); n++;
- warningPopupW = XtCreatePopupShell(
- "warningpopup",
- transientShellWidgetClass,
- topW,
- args,
- n);
-
- warningPaneW = XtCreateManagedWidget(
- "pane",
- panedWidgetClass,
- warningPopupW,
- NULL,
- 0);
- XtInstallAccelerators(warningPaneW, paneW);
-
- if (*prefix) {
- n = 0;
- XtSetArg(args[n], XtNlabel, prefix); n++;
- XtSetArg(args[n], XtNwidth, 300); n++;
- (void) XtCreateManagedWidget(
- "label1",
- labelWidgetClass,
- warningPaneW,
- args,
- n);
- }
-
- n = 0;
- XtSetArg(args[n], XtNlabel, message); n++;
- (void) XtCreateManagedWidget(
- "label2",
- labelWidgetClass,
- warningPaneW,
- args,
- n);
- n = 0;
- warningBoxW = XtCreateManagedWidget(
- "box",
- boxWidgetClass,
- warningPaneW,
- args,
- n);
-
- n = 0;
- warningButtonW = XtCreateManagedWidget(
- "acknowledge",
- commandWidgetClass,
- warningBoxW,
- args,
- n);
-
- XtAddCallback (warningButtonW, XtNcallback, PopdownCB,
- (XtPointer) False);
-
- if (deathoption) {
- deathButtonW = XtCreateManagedWidget(
- "quit immediately",
- commandWidgetClass,
- warningBoxW,
- NULL, 0);
-
- XtAddCallback (deathButtonW, XtNcallback, DieCB,
- (XtPointer) False);
- }
-
- XtInstallAllAccelerators(warningPopupW, paneW);
- XtSetKeyboardFocus(paneW, warningButtonW);
-
- XtPopup(warningPopupW, XtGrabNone);
-}
-
-void
-DieCB(w, client_data, call_data)
-Widget w;
-XtPointer client_data;
-XtPointer call_data;
-{
- exit (-1);
-}
-
-PopdownCB(w, client_data, call_data)
-Widget w;
-XtPointer client_data;
-XtPointer call_data;
-{
- int didsomething = 0;
-
- if (warningPopupW) {
- XtDestroyWidget(warningPopupW);
- warningPopupW = 0;
- didsomething = 1;
- }
-
- if (helpPopupW) {
- XtDestroyWidget(helpPopupW);
- helpPopupW = 0;
- didsomething = 1;
- }
- XtSetKeyboardFocus(topW, topW);
- return (didsomething);
-}
-
-
-void
-PutUpHelp()
-{
- Arg args[5];
- unsigned int n;
- Widget localPaneW, textW, boxW, buttonW;
-
- if (helpPopupW)
- return;
-
- n = 0;
- helpPopupW = XtCreatePopupShell(
- "helppopup",
- topLevelShellWidgetClass,
- topW,
- args,
- n);
-
- XtInstallAccelerators(helpPopupW, paneW);
- n = 0;
- localPaneW = XtCreateManagedWidget(
- "pane",
- panedWidgetClass,
- helpPopupW,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNeditType, XawtextEdit); n++;
- XtSetArg(args[n], XtNwidth, 80 * char_width); n++;
-
- textW = XtCreateManagedWidget(
- "helptext",
- asciiTextWidgetClass,
- localPaneW,
- args,
- n);
- XtInstallAccelerators(textW, paneW);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- boxW = XtCreateManagedWidget(
- "box",
- boxWidgetClass,
- localPaneW,
- args,
- n);
-
- n = 0;
- buttonW = XtCreateManagedWidget(
- "okay",
- commandWidgetClass,
- boxW,
- args,
- n);
-
- XtInstallAllAccelerators(helpPopupW, paneW);
- XtAddCallback (buttonW, XtNcallback, PopdownCB, (XtPointer) True);
- XtPopup(helpPopupW, XtGrabNone);
-}
-
-
-/*
-** Okay, here's some really crude stuff. We assume the text in bottextW
-** contains lines like " Host: YABBA.DABBA.DOO" where "Host:" is
-** the sort of thing that we call a "prompt." We find the line, if any,
-** including the string pointed to by prompt, and return a pointer to
-** the string from whitespace to \n following the prompt.
-*/
-
-static char *
-GetDefaultValue(prompt)
-char *prompt;
-{
- Arg args[5];
- unsigned int n;
- char *prompt1, *string, *string1, *string2;
- char *retval;
-
- n = 0;
- XtSetArg(args[n], XtNstring, &string); n++;
- XtGetValues (bottextW, args, n);
-
-/*
-** Now we look for the prompt.
-*/
-
- for (string1 = string; *string1; string1++) {
- for ( prompt1 = prompt, string2 = string1;
- *prompt1 == *string2;
- prompt1++, string2++)
- ;
-
- if (!*prompt1) break;
- }
-
- if (!*string1) {
- return (NULL);
- }
-
- for (string2 = string1; *string2 != ' '; string2++);
-
- for ( ; *string2 == ' '; string2++);
-
- *strchr (string2, '\n') = '\0';
-
- retval = (char *) malloc (strlen(string2) + 1);
- strcpy (retval, string2);
- *(strchr(string2, '\0')) = '\n';
- return (retval);
-}
-
-void
-GetTransactionNum()
-{
- Arg args[5];
- unsigned int n;
- Widget button, numPaneW, numBox1W;
- Position parentx, parenty;
- Dimension parentwidth, mywidth;
-
- if (numPopupW)
- return;
-
- n = 0;
- XtSetArg(args[n], XtNwidth, &parentwidth); n++;
- XtSetArg(args[n], XtNx, &parentx); n++;
- XtSetArg(args[n], XtNy, &parenty); n++;
- XtGetValues (topW, args, n);
-
- mywidth = 35 * char_width;
-
- n = 0;
- XtSetArg(args[n], XtNwidth, mywidth); n++;
- XtSetArg(args[n], XtNtransient, True); n++;
- XtSetArg(args[n], XtNtransientFor, topW); n++;
- XtSetArg(args[n], XtNx,
- parentx + ((parentwidth - mywidth) / 2)); n++;
- XtSetArg(args[n], XtNy, parenty + 100); n++;
-
- numPopupW = XtCreatePopupShell(
- "numpopup",
- transientShellWidgetClass,
- topW,
- args,
- n);
-
- numPaneW = XtCreateManagedWidget(
- "pane",
- panedWidgetClass,
- numPopupW,
- NULL,
- 0);
-
- n = 0;
-
- (void) XtCreateManagedWidget(
- "label",
- labelWidgetClass,
- numPaneW,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- XtSetArg(args[n], XtNeditType, XawtextEdit); n++;
- XtSetArg(args[n], XtNwidth, 15 * char_width); n++;
-
- numTextW = XtCreateManagedWidget(
- "text",
- asciiTextWidgetClass,
- numPaneW,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNborderWidth, 0); n++;
- numBox1W = XtCreateManagedWidget(
- "box1",
- boxWidgetClass,
- numPaneW,
- args,
- n);
-
- n = 0;
- button = XtCreateManagedWidget(
- "goto",
- commandWidgetClass,
- numBox1W,
- args,
- n);
-
- XtAddCallback (button, XtNcallback, NumCB, (XtPointer) True);
-
- n = 0;
- button = XtCreateManagedWidget(
- "abort",
- commandWidgetClass,
- numBox1W,
- args,
- n);
-
- XtAddCallback (button, XtNcallback, NumCB, (XtPointer) False);
- XtPopup(numPopupW, XtGrabNone);
-}
-
-static void
-NumCB(w, client_data, call_data)
-Widget w;
-XtPointer client_data;
-XtPointer call_data;
-{
- char *tempstring;
- Arg args[5];
- unsigned int n;
-
- if (!numPopupW)
- return;
-
- if ((Boolean) client_data) {
- n = 0;
- XtSetArg(args[n], XtNstring, &tempstring); n++;
- XtGetValues (numTextW, args, n);
- GoToTransaction(atoi(tempstring), True);
- myfree (tempstring);
- }
-
- XtDestroyWidget(numPopupW);
- XtSetKeyboardFocus(topW, topW);
- numPopupW = 0;
-}
-
-void
-TriggerAdd(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-int *num_params;
-{
- if (*num_params < 1)
- return;
-
- AddCB(w, (XtPointer) !strcmp(params[0], "Go"), NULL);
-}
-
-void
-TriggerNum(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-int *num_params;
-{
- if (*num_params < 1)
- return;
-
- NumCB(w, (XtPointer) !strcmp(params[0], "Go"), NULL);
-}
-
-void
-TriggerWrite(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-int *num_params;
-{
- if (*num_params < 1)
- return;
-
- WriteCB(w, (XtPointer) !strcmp(params[0], "Go"), NULL);
-}
-
-void
-TriggerDelete(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-int *num_params;
-{
- if (*num_params < 1)
- return;
-
- DeleteCB(w, (XtPointer) !strcmp(params[0], "Go"), NULL);
-}
-
-void
-TriggerPopdown(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-int *num_params;
-{
- if (*num_params < 1)
- return;
-
- PopdownCB(w, (XtPointer) !strcmp(params[0], "Go"), NULL);
-}
-
-void
-TriggerSend(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-int *num_params;
-{
- TransactionRecPtr i;
-
- if (*num_params < 1)
- return;
-
- if (listhead == 0) {
- return;
- }
-
- for (i = listhead; i; i = i->nextrec) {
- if (w == i->data->subjectTextW)
- break;
- if (w == i->data->bodyTextW)
- break;
- if (w == i->data->sendButtonW)
- break;
- if (w == i->data->sendPopupW)
- break;
- }
-
- if (i == 0)
- return;
-
-/*
-** Okay, here's a kludge. SendCB() checks the incoming widget ID,
-** and if it's equal to the sendButtonW stored in the data structure,
-** it actually does the send. So we fool it here.
-*/
- if (strcmp(params[0], "Go") == 0)
- SendCB(i->data->sendButtonW, i->data, NULL);
- else
- SendCB(NULL, i->data, NULL);
-}
-
-/*
-** Pass TriggerFocusMove "Prev" to move focus up, "Next" to move it down.
-** It figures out which widget got the event and moves focus to
-** the appropriate neighbor.
-*/
-
-void
-TriggerFocusMove(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-int *num_params;
-{
- TransactionRecPtr i;
- int direction = -1;
- Widget targetW = 0;
- Widget shellparent;
-
- if (*num_params < 1)
- return;
-
- for ( shellparent = XtParent(w);
- shellparent && !XtIsShell(shellparent);
- shellparent = XtParent(shellparent))
- ;
-
- if (!strcmp (params[0], "Next"))
- direction = 2;
- if (!strcmp (params[0], "Prev"))
- direction = 1;
- if (!strcmp (params[0], "Toggle"))
- direction = 0;
-
- if (!strcmp (params[0], "Here")) {
- XtSetKeyboardFocus(topW, shellparent);
- XtSetKeyboardFocus(shellparent, w);
- return;
- }
-
-/*
-** Was the hit widget in the add-mtg popup? All keys become toggle.
-*/
- if (addPopupW) {
- if (w == addHostTextW)
- targetW = addPathTextW;
- if (w == addPathTextW)
- targetW = addHostTextW;
- }
-
-/*
-** Check the subject and body widgets in the list of entryrecs.
-*/
- if (listhead != 0) {
- for (i = listhead; i; i = i->nextrec) {
- if (w == i->data->subjectTextW &&
- (direction == 2 || direction == 0))
- targetW = i->data->bodyTextW;
- if (w == i->data->bodyTextW &&
- (direction == 1 || direction == 0))
- targetW = i->data->subjectTextW;
- }
- }
-
- if (targetW) {
- XtSetKeyboardFocus(topW, shellparent);
- XtSetKeyboardFocus(shellparent, targetW);
- }
-}
diff --git a/xdsc.c b/xdsc.c
deleted file mode 100644
index da86f53..0000000
--- a/xdsc.c
+++ /dev/null
@@ -1,1721 +0,0 @@
-/*
-Copyright 1991 by the Massachusetts Institute of Technology
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of M.I.T. not be used in
-advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-M.I.T. makes no representations about the suitability of
-this software for any purpose. It is provided "as is"
-without express or implied warranty.
-*/
-
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/CoreP.h>
-
-#include <X11/Xaw/MenuButton.h>
-#include <X11/Xaw/SimpleMenu.h>
-#include <X11/Xaw/Sme.h>
-#include <X11/Xaw/SmeBSB.h>
-#include <X11/Xaw/Cardinals.h>
-
-#include <X11/Xaw/List.h>
-#include <X11/Xaw/SimpleMenP.h>
-#include <X11/Xaw/Paned.h>
-#include <X11/Xaw/Command.h>
-#include <X11/Xaw/Box.h>
-#include <X11/Xaw/AsciiText.h>
-#include <X11/Xaw/TextP.h>
-#include <X11/Xaw/TextSinkP.h>
-#include <X11/Xaw/Dialog.h>
-#include <X11/Xaw/Form.h>
-#include <X11/Xaw/Label.h>
-
-#include "xdsc.h"
-
-static char rcsid[] = "$Id: xdsc.c,v 1.35 1999-12-16 01:58:24 danw Exp $";
-
-/*
-** Globals
-*/
-
-char *RunCommand();
-TextWidget toptextW, bottextW;
-Boolean debug = False;
-char filebase[50];
-int topscreen = MAIN;
-Widget topW, paneW;
-void RemoveLetterC();
-int char_width;
-char axis[10];
-void TopSelect(), BotSelect();
-void Update(), Stub();
-void PrintEvent();
-int simplemode = 0;
-int edscversion;
-Boolean nocache;
-
-/*
-** External functions
-*/
-
-extern void PutUpHelp();
-extern void SubmitTransaction();
-extern void WriteTransaction();
-extern char *tempnam();
-extern int PopdownCB();
-extern char *getenv();
-extern void TriggerAdd(), TriggerNum(), TriggerDelete();
-extern void TriggerWrite(), TriggerPopdown(), TriggerSend();
-extern void TriggerFocusMove();
-extern void DispatchClick();
-extern void FetchIfNecessary();
-extern int HighlightedTransaction();
-
-/*
-** Private functions
-*/
-
-static void MenuCallback();
-static void KeyCallback();
-static void QuitCB(), HelpCB();
-static void BuildUserInterface();
-static void DoTheRightThing();
-static void DoTheRightThingInReverse();
-static void CheckEdscVersion();
-static void BuildSkeleton();
-static unsigned long GetFontWidth();
-
-/*
-** Private globals
-*/
-
-static int filedesparent[2], filedeschild[2];
-static FILE *inputfile, *outputfile;
-static char *meetinglist;
-
-static Widget topboxW, botboxW;
-static Widget label1W;
-static int prevfirst = 0;
-static XawTextPosition startOfCurrentMeeting = -1;
-Display *dpy;
-Window root_window;
-static XawTextPosition oldarrow = -1;
-
-/*
-** Data for top row of buttons
-*/
-
-static char * menu_labels0[MAX_BUTTONS] = {
- "Down", "Up", "update", "configure", "mode",
- "show", "HELP", "QUIT"};
-
-static char * menu_names0[MAX_BUTTONS] = {
- "downbutton", "upbutton", "updatebutton", "configurebutton",
- "modebutton", "showbutton", "helpbutton", "quitbutton"};
-
-static char * submenu_labels0[MAX_BUTTONS][MAX_MENU_LEN] = {
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL },
- { "add meeting", "delete meeting", NULL, NULL },
- { "transactions", "meetings", NULL, NULL },
- { "unread", "all", "back ten", NULL },
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL }};
-
-static char * submenu_names0[MAX_BUTTONS][MAX_MENU_LEN] = {
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL },
- { "addbutton", "deletebutton", NULL, NULL },
- { "transbutton", "meetingbutton", NULL, NULL },
- { "unreadbutton", "allbutton", "backbutton", NULL },
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL }};
-
-/*
-** Data for bottom row of buttons
-*/
-
-static char * menu_labels1[MAX_BUTTONS] = {
- "next", "prev", "Next in chain", "Prev in chain",
- "goto", "enter", "write", NULL };
-
-static char * menu_names1[MAX_BUTTONS] = {
- "nextbutton", "prevbutton", "nchainbutton", "pchainbutton",
- "gotobutton", "enterbutton", "writebutton", NULL };
-
-static char * submenu_labels1[MAX_BUTTONS][MAX_MENU_LEN] = {
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL },
- { "number", "first", "last", "start of chain", "end of chain", NULL },
- { "reply", "new transaction", NULL },
- { "write to file", "mail to someone", NULL }};
-
-static char * submenu_names1[MAX_BUTTONS][MAX_MENU_LEN] = {
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL },
- { NULL, NULL, NULL, NULL },
- { "numberbutton", "firstbutton", "lastbutton", "frefbutton", "lrefbutton",NULL },
- { "replybutton", "newbutton", NULL },
- { "writebutton", "mailbutton", NULL }};
-
-
-EntryRec toplevelbuttons[2][MAX_BUTTONS];
-
-void
-main(argc, argv)
-int argc;
-char *argv[];
-{
- int pid;
- char *oldpath, *newpath, *myname;
- Arg args[1];
- int width;
- char commandline[100];
-
- if (argc > 1 && !strcmp(argv[1], "-debug"))
- debug = True;
-
- myname = (myname = strrchr(argv[0], '/')) ? myname + 1 : argv[0];
-
- if (!strcmp (myname, "lucy"))
- simplemode = True;
- else
- simplemode = False;
-
- if (simplemode) {
- topW = XtInitialize("topwidget", "Lucy", NULL, 0, &argc, argv);
- }
- else
- topW = XtInitialize("topwidget", "Xdsc", NULL, 0, &argc, argv);
-
- BuildSkeleton();
-
-/*
-** Set our width to 80 chars wide in the current font. Min value of 500
-** means that all the lower buttons will fit.
-
-original code
- char_width = (((TextSinkObject) (toptextW->text.sink))->
- text_sink.font->max_bounds.width);
-
-removed because font parameter is either private or nonexistent (private in
-mit Xaw include files, nonexistent in others).
-
-borrowed code from Xaw/TextSink.c to write a generic GetFontWidth routine.
-rearranged some to use font resource, rather than accessing internals.
-
-mdb 7/26/96
-
-*/
-
- char_width = (int)GetFontWidth(toptextW);
- width = 80 * char_width;
- XtSetArg(args[0], XtNwidth, width < 500 ? 500 : width);
- XtSetValues(topW, args, 1);
-
-/*
- XtRealizeWidget(topW);
- XSync(XtDisplay(topW), False);
-*/
-
- if (debug)
- fprintf (stderr, "Debugging is on\n");
-
- sprintf (filebase,"/var/tmp/xdsc%d",getpid());
-
- if (debug)
- fprintf (stderr, "filebase is %s\n", filebase);
-
- pipe (filedesparent);
- pipe (filedeschild);
-
- pid = fork();
-
- if (pid == 0)
- SetUpEdsc();
-
- close (filedesparent[1]);
- close (filedeschild[0]);
-
- inputfile = fdopen (filedesparent[0], "r");
- outputfile = fdopen (filedeschild[1], "w");
-
- CheckEdscVersion();
- ParseMeetingsFile();
-
- oldpath = getenv("XFILESEARCHPATH");
-
- BuildUserInterface();
- XtRealizeWidget(topW);
-
- dpy = XtDisplay(topW);
- root_window = XtWindow(topW);
-
- (void) MoveToMeeting(INITIALIZE);
-/*
-** If running in simplemode, switch to reading transactions and put up
-** the list of unread ones.
-*/
- if (simplemode) {
- TopSelect (NULL, 4, NULL);
- BotSelect (NULL, 0, NULL);
- }
- CheckButtonSensitivity(BUTTONS_UPDATE);
- XtMainLoop();
-}
-
-SetUpEdsc()
-{
- int retval;
- char commandtorun[50];
- char machtype[20];
- char *envcommand;
-
- envcommand = getenv("EDSC");
- strcpy (commandtorun, envcommand ? envcommand : EDSC_PATH);
-
- close (filedesparent[0]);
- close (filedeschild[1]);
-
- dup2 (filedeschild[0], 0);
- dup2 (filedesparent[1], 1);
-
- if (debug)
- fprintf (stderr,"commandtorun = '%s'\n", commandtorun);
-
- retval = execlp (commandtorun, commandtorun, 0);
-
- fprintf (stderr, "Fatal error: Unable to exec '%s'\n",commandtorun);
- _exit (-1);
-}
-
-/*
-** Put up enough of the application that the user doesn't think it's hung...
-*/
-
-static void
-BuildSkeleton()
-{
- Arg args[5];
- unsigned int n;
- static XtActionsRec actions[] = {
- {"FetchIfNecessary", FetchIfNecessary},
- {"MenuCallback", MenuCallback},
- {"KeyCallback", KeyCallback},
- {"Update", Update},
- {"DispatchClick", DispatchClick},
- {"TriggerAdd", TriggerAdd},
- {"TriggerDelete", TriggerDelete},
- {"TriggerFocusMove", TriggerFocusMove},
- {"TriggerNum", TriggerNum},
- {"TriggerPopdown", TriggerPopdown},
- {"TriggerSend", TriggerSend},
- {"TriggerWrite", TriggerWrite},
- {"DoTheRightThing", DoTheRightThing},
- {"DoTheRightThingInReverse", DoTheRightThingInReverse},
- {"HelpCB", HelpCB},
- {"QuitCB", QuitCB},
- {"PopdownCB", (XtActionProc) PopdownCB},
- {"Stub", Stub},
- {"PrintEvent", PrintEvent}};
-
-
- n = 0;
- paneW = XtCreateManagedWidget(
- "pane",
- panedWidgetClass,
- topW,
- args,
- n);
-
- n = 0;
- topboxW = XtCreateManagedWidget(
- "topbox",
- boxWidgetClass,
- paneW,
- args,
- n);
-
- XtAppAddActions ( XtWidgetToApplicationContext(topboxW),
- actions, XtNumber(actions));
-
- XawSimpleMenuAddGlobalActions(XtWidgetToApplicationContext(topboxW));
-
- AddChildren (topboxW, 0);
-
- n = 0;
- XtSetArg(args[n], XtNstring, "Please wait..."); n++;
- XtSetArg(args[n], XtNeditType, XawtextEdit); n++;
- XtSetArg(args[n], XtNuseStringInPlace, False); n++;
-
- toptextW = (TextWidget) XtCreateManagedWidget(
- "toptext",
- asciiTextWidgetClass,
- paneW,
- args,
- n);
-
- n = 0;
- XtSetArg(args[n], XtNeditType, XawtextRead); n++;
- label1W = XtCreateManagedWidget(
- "label",
- asciiTextWidgetClass,
- paneW,
- args,
- n);
-
- n = 0;
- botboxW = XtCreateWidget(
- "botbox",
- boxWidgetClass,
- paneW,
- args,
- n);
-
- AddChildren (botboxW, 1);
-
- if (!simplemode)
- XtManageChild (botboxW);
-
- n = 0;
- XtSetArg(args[n], XtNeditType, XawtextRead); n++;
- bottextW = (TextWidget) XtCreateManagedWidget(
- "bottext",
- asciiTextWidgetClass,
- paneW,
- args,
- n);
-}
-
-static void
-BuildUserInterface()
-{
- Arg args[5];
- unsigned int n;
- Dimension foo;
-
- static XtActionsRec actions[] = {
- {"FetchIfNecessary", FetchIfNecessary},
- {"MenuCallback", MenuCallback},
- {"KeyCallback", KeyCallback},
- {"Update", Update},
- {"DispatchClick", DispatchClick},
- {"TriggerAdd", TriggerAdd},
- {"TriggerDelete", TriggerDelete},
- {"TriggerFocusMove", TriggerFocusMove},
- {"TriggerNum", TriggerNum},
- {"TriggerPopdown", TriggerPopdown},
- {"TriggerSend", TriggerSend},
- {"TriggerWrite", TriggerWrite},
- {"DoTheRightThing", DoTheRightThing},
- {"DoTheRightThingInReverse", DoTheRightThingInReverse},
- {"HelpCB", HelpCB},
- {"QuitCB", QuitCB},
- {"PopdownCB", (XtActionProc) PopdownCB},
- {"Stub", Stub},
- {"PrintEvent", PrintEvent}};
-
-/*
- n = 0;
- paneW = XtCreateManagedWidget(
- "pane",
- panedWidgetClass,
- topW,
- args,
- n);
-
-
- n = 0;
- topboxW = XtCreateManagedWidget(
- "topbox",
- boxWidgetClass,
- paneW,
- args,
- n);
-
- XtAppAddActions ( XtWidgetToApplicationContext(topboxW),
- actions, XtNumber(actions));
-
- XawSimpleMenuAddGlobalActions(XtWidgetToApplicationContext(topboxW));
-
- AddChildren (topboxW, 0);
-*/
-
- n = 0;
- XtSetArg(args[n], XtNstring, meetinglist); n++;
- XtSetValues(toptextW, args, n);
-
-/*
- n = 0;
- XtSetArg(args[n], XtNstring, meetinglist); n++;
- XtSetArg(args[n], XtNeditType, XawtextEdit); n++;
- XtSetArg(args[n], XtNuseStringInPlace, False); n++;
-
- toptextW = (TextWidget) XtCreateManagedWidget(
- "toptext",
- asciiTextWidgetClass,
- paneW,
- args,
- n);
-*/
-
-/*
- n = 0;
- XtSetArg(args[n], XtNeditType, XawtextRead); n++;
- label1W = XtCreateManagedWidget(
- "label",
- asciiTextWidgetClass,
- paneW,
- args,
- n);
-
- n = 0;
- botboxW = XtCreateWidget(
- "botbox",
- boxWidgetClass,
- paneW,
- args,
- n);
-
- AddChildren (botboxW, 1);
-
- if (!simplemode) {
- XtManageChild (botboxW);
- }
-
- n = 0;
- XtSetArg(args[n], XtNeditType, XawtextRead); n++;
- bottextW = (TextWidget) XtCreateManagedWidget(
- "bottext",
- asciiTextWidgetClass,
- paneW,
- args,
- n);
-*/
-
-/*
-** Add the pane's accelerators to the text widgets and the other kids.
-*/
- XtInstallAccelerators(toptextW, paneW);
- XtInstallAccelerators(bottextW, paneW);
- XtInstallAllAccelerators(paneW, paneW);
-
-}
-
-/*
-** MenuCallback is called for key hits on menu entries.
-** It gets two parameters: First, the number of the menubutton
-** secondly, the index of the entry in the menu. It
-** packs the two parameters into an int and manually calls TopSelect().
-*/
-
-static void
-MenuCallback(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-int *num_params;
-{
- int buttonnum, entrynum;
- int whichrow;
-
- if (*num_params != 2)
- goto ABORT;
-
- for (buttonnum = 0; buttonnum < MAX_BUTTONS; buttonnum++) {
- if ( menu_names0[buttonnum] &&
- !strcmp(menu_names0[buttonnum], params[0])) {
- whichrow = 0;
- break;
- }
- if ( menu_names1[buttonnum] &&
- !strcmp(menu_names1[buttonnum], params[0])) {
- whichrow = 1;
- break;
- }
- }
-
- if (buttonnum == MAX_BUTTONS)
- goto ABORT;
-
- for (entrynum = 0; entrynum < MAX_MENU_LEN; entrynum++) {
- if (whichrow == 0) {
- if ( submenu_names0[buttonnum][entrynum] &&
- !strcmp(submenu_names0[buttonnum][entrynum],
- params[1]))
- break;
- }
- else {
- if ( submenu_names1[buttonnum][entrynum] &&
- !strcmp(submenu_names1[buttonnum][entrynum],
- params[1]))
- break;
- }
- }
-
- if (entrynum == MAX_MENU_LEN)
- goto ABORT;
-
-/*
-** If a menu item was selected, popdown the menu and relinquish keyboard focus.
-*/
- if (whichrow == 0)
- TopSelect (NULL, buttonnum + (entrynum << 4));
- else
- BotSelect (NULL, buttonnum + (entrynum << 4));
-
- if (XtIsSubclass (w, simpleMenuWidgetClass))
- XtPopdown(w);
- XtSetKeyboardFocus(topW, paneW);
- return;
-
-ABORT:
-
- if (XtIsSubclass (w, simpleMenuWidgetClass))
- XtPopdown(w);
- XtSetKeyboardFocus(topW, paneW);
-}
-
-/*
-** TopSelect is called either automatically through the select callback
-** on a button, or manually through TopCallback when triggered by a
-** key hit.
-*/
-
-void
-TopSelect(w, client_data, call_data)
-Widget w; /*IGNORED*/
-XtPointer client_data;
-XtPointer call_data;
-{
- int buttonnum, entrynum;
- Arg args[5];
- unsigned int n;
-
- entrynum = ((int) client_data) >> 4;
- buttonnum = ((int) client_data) & 0x0F;
-
- switch (buttonnum) {
-/*
-** Move to next or previous meeting if topscreen is showing meetings,
-** to next or previous transaction otherwise
-*/
- case 0:
- if (topscreen == MAIN) {
- (void) MoveToMeeting(NEXTNEWS);
- }
- else {
- BotSelect (NULL, 0, NULL);
- }
- break;
-
- case 1:
- if (topscreen == MAIN) {
- (void) MoveToMeeting(PREVNEWS);
- }
- else {
- BotSelect (NULL, 1, NULL);
- }
- break;
-/*
-** Check for changed meetings
-*/
- case 2:
- MarkLastRead();
- PutUpTempMessage("Rereading meeting list...");
- ParseMeetingsFile();
- n = 0;
- XtSetArg(args[n], XtNstring, meetinglist); n++;
- XtSetValues(toptextW, args, n);
- TakeDownTempMessage();
- InvalidateHeaders();
- MoveToMeeting(INITIALIZE);
- break;
-
-/*
-** configure
-*/
- case 3:
- switch (entrynum) {
- case 0:
- AddMeeting();
- break;
- case 1:
- DeleteMeeting();
- break;
- }
- break;
-
-/*
-** mode
-*/
- case 4:
- switch (entrynum) {
- case 0:
-/*
-** Put up list of transactions within the current meeting
-*/
- prevfirst = TransactionNum(CURRENT);
- PutUpTransactionList( TransactionNum(CURRENT),
- TransactionNum(LAST));
- topscreen = LISTTRNS;
- UpdateHighlightedTransaction(TransactionNum(CURRENT),True);
- break;
- case 1:
-/*
-** Put up list of meetings
-*/
- topscreen = MAIN;
- RestoreTopTextWidget();
- if ( TransactionNum(HIGHESTSEEN) ==
- TransactionNum(LAST))
- RemoveLetterC();
- break;
- }
- break;
-
-/*
-** show
-*/
- case 5:
- if (topscreen != LISTTRNS)
- break;
- switch (entrynum) {
- case 0:
- PutUpTransactionList(
- TransactionNum(HIGHESTSEEN), TransactionNum(LAST));
- prevfirst = TransactionNum(HIGHESTSEEN);
- UpdateHighlightedTransaction(TransactionNum(CURRENT),True);
- break;
- case 1:
- PutUpTransactionList(
- TransactionNum(FIRST), TransactionNum(LAST));
- prevfirst = TransactionNum(FIRST);
- UpdateHighlightedTransaction(TransactionNum(CURRENT),True);
- break;
- case 2:
- PutUpTransactionList( prevfirst <= 10 ? 1 : prevfirst - 10,
- TransactionNum(LAST));
- UpdateHighlightedTransaction(prevfirst - 1,True);
-
- prevfirst -= 10;
- if (prevfirst <=0) prevfirst = 1;
- break;
- }
- break;
-
- case 6:
- PutUpHelp();
- break;
- case 7:
- QuitCB (NULL, NULL, NULL);
- break;
- }
-}
-
-void
-BotSelect(w, client_data, call_data)
-Widget w; /*IGNORED*/
-XtPointer client_data;
-XtPointer call_data;
-{
- int buttonnum, entrynum;
-
- entrynum = ((int) client_data) >> 4;
- buttonnum = ((int) client_data) & 0x0F;
-
- switch (buttonnum) {
-
- case 0:
- if (TransactionNum(CURRENT) < TransactionNum(LAST))
- GoToTransaction(NEXT, True);
- else
- GoToTransaction(CURRENT, True);
- break;
-
- case 1:
- GoToTransaction(PREV, True);
- break;
- case 2:
- GoToTransaction(NREF, True);
- break;
- case 3:
- GoToTransaction(PREF, True);
- break;
- case 4:
- switch (entrynum) {
- case 0:
- GetTransactionNum();
- break;
- case 1:
- GoToTransaction(FIRST, True);
- break;
- case 2:
- GoToTransaction(LAST, True);
- break;
- case 3:
- GoToTransaction(FREF, True);
- break;
- case 4:
- GoToTransaction(LREF, True);
- break;
- }
- break;
- case 5:
- switch (entrynum) {
- case 0:
- if (axis[0] != ' ')
- SubmitTransaction(TransactionNum(CURRENT));
- break;
- case 1:
- if (axis[6] != ' ')
- SubmitTransaction(0);
- break;
- }
-/*
-** This makes the buttons update to reflect the new transaction.
-*/
- GoToTransaction(CURRENT, False);
- break;
- case 6:
- switch (entrynum) {
- case 0:
- WriteTransaction(TransactionNum(CURRENT));
- break;
- case 1:
- break;
- }
- break;
- default:
- fprintf (stderr,"Stub function\n");
- }
-
-}
-
-RestoreTopTextWidget()
-{
- Arg args[1];
- unsigned int n;
-
- CheckButtonSensitivity(BUTTONS_ON);
-
- n = 0;
- XtSetArg(args[n], XtNstring, meetinglist); n++;
- XtSetValues (toptextW, args, n);
- PutUpArrow(toptextW, startOfCurrentMeeting, True);
-}
-
-
-
-static void
-QuitCB(w, client_data, call_data)
-Widget w;
-XtPointer client_data;
-XtPointer call_data;
-{
- (void) SaveMeetingNames("", "");
-
- fputs("(quit)\n", outputfile);
- fflush (outputfile);
- exit (0);
-}
-
-static void
-HelpCB(w, client_data, call_data)
-Widget w;
-XtPointer client_data;
-XtPointer call_data;
-{
- PutUpHelp();
-}
-
-/*
-** HighlightNewItem...Change the highlighted line in the passed textwidget
-** in the direction requested. Return 0 if successful, -1 if there was
-** no meeting in that direction.
-*/
-
-HighlightNewItem(textW, mode, flag)
-Widget textW; /* list of meetings */
-int mode; /* one of { NEXTNEWS, PREVNEWS, UPDATE, INITIALIZE} */
-Boolean flag; /* update current meeting? */
-{
- Arg args[5];
- unsigned int n;
- XawTextPosition start, end, inspoint;
- char *tempstring, *foo, *tempptr;
- int length;
- char statusline[LONGNAMELEN + 25];
- char longmtg[LONGNAMELEN];
- char shortmtg[SHORTNAMELEN];
-
- inspoint = XawTextGetInsertionPoint(textW);
-
- n = 0;
- XtSetArg(args[n], XtNstring, &tempstring); n++;
- XtGetValues (textW, args, n);
-
- if (tempstring[inspoint] == '\0')
- return (-1);
-
-/*
-** Find start and end of current line.
-*/
-
- for (start = inspoint; start && tempstring[start-1] != '\n'; start--)
- ;
- for ( end = inspoint;
- tempstring[end] != '\0' && tempstring[end] != '\n';
- end++)
- ;
-
-/*
-** Special case for initializing: change mode to NEXTNEWS unless we're
-** already on a line with unread transactions. Do nothing in simplemode,
-** because we always want to stay on the first line.
-*/
- if (mode == INITIALIZE && simplemode != True) {
- if ( tempstring[start + 2] != 'c')
- mode = NEXTNEWS;
- }
-
- if (mode == NEXTNEWS) {
-
- if (start == end || tempstring[end] == '\0') {
- PutUpWarning( "",
- "Nothing more to read", False);
- return(-1);
- }
-
- do {
- if (tempstring[end] == '\n') {
- start = end + 1;
- }
- end = start + strcspn (tempstring + start, "\n\0");
- } while ( tempstring[end] != '\0' &&
- tempstring[start + 2] != 'c');
-
-
- if ( tempstring[start] == '\0') {
- PutUpWarning( "",
- "Nothing more to read", False);
- return(-1);
- }
-
- }
-
- else if (mode == PREVNEWS) {
- if (start == 0) {
- PutUpWarning( "",
- "no previous meeting with unread news", False);
- return(-1);
- }
- do {
- end = start - 1;
- for ( start = end - 1;
- start > 0 && tempstring[start] != '\n';
- start--)
- ;
- if (start != 0) start++;
- } while ( start &&
- tempstring[start + 2] != 'c');
- if ( tempstring[start + 2] != 'c' ) {
- PutUpWarning( "",
- "no previous meeting with unread news", False);
- return(-1);
- }
- }
-
- else if (mode == UPDATE) {
-/*
-** Just need to update current meeting to match highlighted item.
-*/
- }
-
- PutUpArrow(textW, start, True);
-
- if (flag) {
- length = (end - start);
- foo = (char *) calloc (length + 1, sizeof(char));
- strncpy (foo, tempstring + start + 8, length - 8);
- tempptr = strchr (foo, ',');
- *tempptr = '\0';
- strcpy (longmtg, foo);
- strcpy (shortmtg, tempptr + 2);
-
- free (foo);
- }
-
- if (SaveMeetingNames(longmtg, shortmtg) == -1) {
- PutUpStatusMessage("No current meeting");
- CheckButtonSensitivity(BUTTONS_OFF);
- return (-1);
- }
- CheckButtonSensitivity(BUTTONS_ON);
-
- sprintf (statusline, "Reading %s [%d-%d]",
- longmtg,
- TransactionNum(FIRST),
- TransactionNum(LAST));
-
- PutUpStatusMessage(statusline);
-
- XFlush(XtDisplay(textW));
- return(0);
-}
-
-
-/*
-** Run the command. If textW and filename are passed,
-** read the contents of filename after running the command
-** and put them into textW.
-**
-** If returnvalue is NULL, don't wait for a response from the
-** command. Otherwise, return a pointer to the return value,
-** which must be freed by the calling routine.
-**
-** This version uses byte-by-byte i/o so it can recognize \n
-** as end-of-data. Can't use fgets because we don't know
-** how long the data stream is, and need to keep reallocing.
-**
-** Return -1 on error.
-*/
-
-char *
-RunCommand (command, textW, filename, returnvalue)
-char *command;
-Widget textW;
-char *filename;
-Boolean returnvalue;
-{
- char *message;
- int cursize = BUFSIZE;
- int curbyte = 0;
-
-/*
-** Send command to child's input stream
-*/
- if (fputs(command, outputfile) == EOF) {
- fprintf (stderr, "Error on fputs\n");
- return ((char *)-1);
- }
- fflush (outputfile);
-
- if (debug)
- fprintf (stderr, "appl: %s\n",command);
- fflush (stderr);
-
- if (!returnvalue)
- return (NULL);
-/*
-** Look for child's (one-line) response
-*/
-
-READLINE:
-
- message = (char *) malloc (BUFSIZE);
-
- while (( message [cursize - BUFSIZE + curbyte] =
- fgetc (inputfile)) != '\n') {
-
- curbyte++;
- if (curbyte == BUFSIZE) {
- cursize += BUFSIZE;
- curbyte = 0;
- message = (char *) realloc (message, cursize);
- }
- }
-
- message[cursize - BUFSIZE + curbyte] = '\0';
-
- if (debug)
- fprintf (stderr, "edsc: %s\n",message);
-
- if (message[0] == ';' ) {
- PutUpWarning("ERROR", message + 1, False);
- myfree (message);
- return ((char *)-1);
- }
-
- if (message[0] == '-') {
- PutUpWarning("WARNING", message + 1, False);
- myfree (message);
- curbyte = 0;
- cursize = BUFSIZE;
- goto READLINE;
- }
-/*
-** Read the verbose response and put it into the text widget
-*/
- if (filename && textW)
- FileIntoWidget(filename, textW);
-
- return (message);
-}
-
-
-FileIntoWidget(filename, textW)
-char *filename;
-TextWidget textW;
-{
- unsigned int fd;
- Arg args[5];
- char *message;
- int cursize = BUFSIZE;
- int numread = 1, n;
- char errormsg[80];
-
- fd = open(filename, O_RDONLY);
-
- if (fd == -1) {
- sprintf (errormsg,"Error opening file %s\n",filename);
- PutUpWarning("WARNING", errormsg, False);
- return (-1);
- }
-
-/*
-** Make certain we don't try to erase the (now nonexistant) plus sign.
-*/
- if (textW == toptextW)
- oldarrow = -1;
-
- message = (char*) malloc (cursize);
-
- while (!HELL_FROZEN_OVER) {
- numread = read (fd, message + cursize - BUFSIZE, BUFSIZE);
- if (numread == -1) {
- sprintf (errormsg,"Error reading from file %s\n",filename);
- PutUpWarning("WARNING", errormsg, False);
- close (fd);
- return(-1);
- }
- if (numread < BUFSIZE)
- break;
-
- cursize += BUFSIZE;
- message = (char*) realloc (message, cursize);
- }
-
- if (*message) {
- message[cursize - BUFSIZE + numread] = '\0';
- n = 0;
- XtSetArg (args[n], XtNstring, message); n++;
- XtSetValues (textW, args, n);
- }
- else {
- PutUpWarning( "",
- "No text in this transaction", False);
- XBell (XtDisplay(textW), 0);
-
- }
-
- XFlush(XtDisplay(textW));
-
- myfree (message);
- close (fd);
- return(0);
-}
-
-static void
-CheckEdscVersion()
-{
- char *version;
-
- version = RunCommand ("(gpv)\n", NULL, NULL, True);
-
- if ((int) version == -1) {
- fprintf (stderr, "Cannot communicate with edsc.\n");
- exit (-1);
- }
-
- edscversion = atoi(version + 1);
-
- if (edscversion < 24) {
- fprintf (stderr, "Caution...using edsc version %1.1f. ",(float) edscversion/10.0);
- fprintf (stderr, "Should be using at least 2.4.\n");
- }
-
- nocache = (edscversion >= 25) ? True : False;
-}
-
-ParseMeetingsFile()
-{
- char *fulllist;
- char *movingptr;
- char *firstquote, *secondquote;
- int status;
- char fullname[100], shortname[100];
- int i;
-
- fulllist = RunCommand ("(gml)\n", NULL, NULL, True);
- if ((int) fulllist <= 0) return;
-
- if (meetinglist)
- myfree (meetinglist);
-
- i = strlen(fulllist) * 2;
- meetinglist = (char *) calloc (i, sizeof(char));
- if (debug) fprintf (stderr, "Allocated %x, %d long\n", meetinglist, i);
-
- secondquote = fulllist;
-
- for (i = 0; ; i++) {
-
- movingptr = strchr (secondquote + 1, '(');
-
- if (!movingptr)
- break;
-
- movingptr++;
-
- status = atoi(movingptr);
-
- firstquote = strchr(movingptr, '"');
- secondquote = strchr(firstquote+1, '"');
- *secondquote = '\0';
- strcpy (fullname, firstquote + 1);
-
- if (*(secondquote + 1) == ')') {
- *shortname = '\0';
- }
-
- else {
- firstquote = strchr(secondquote+1, '"');
- secondquote = strchr(firstquote+1, '"');
- *secondquote = '\0';
- strcpy (shortname, firstquote + 1);
- }
-
- if (debug)
- fprintf (stderr, "Got %d, '%s', '%s'\n",
- status, fullname, shortname);
-
- sprintf (meetinglist, "%s %c %s, %s\n",
- meetinglist,
- status ? 'c' : ' ',
- fullname, shortname);
- }
-
- sprintf (meetinglist, "%s\0",meetinglist);
- myfree(fulllist);
- if (debug) fprintf (stderr, "Actually used %d\n", strlen(meetinglist));
-}
-
-myfree(ptr)
-char *ptr;
-{
- if ((int)ptr > 0) {
- if (debug) fprintf (stderr, "Freeing %x\n",ptr);
- free(ptr);
- }
- else if (debug) fprintf (stderr, "Not freeing %x\n",ptr);
-}
-
-/*
-** An item in the upper text window has been clicked on. If it is a
-** meeting, move there and put the first transaction on the screen.
-** If it's a transaction, we display it in the lower window.
-*/
-
-void
-Update()
-{
- if (topscreen == MAIN) {
- (void) MoveToMeeting(UPDATE);
- }
- else if (topscreen == LISTTRNS) {
- GoToTransaction(HighlightedTransaction(), True);
- }
-}
-
-
-void
-Stub()
-{
-}
-
-void
-PrintEvent(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-int *num_params;
-{
- fprintf(stderr, "event type %d for widget %s\n",
- event->type, XtName(w));
-}
-
-
-/*
-** If we're reading a transaction, scroll it one page down.
-** If we're at the end of a transaction, go to the next one.
-** If we're at the end of a meeting, find the next one with unread
-** transactions.
-*/
-
-static void
-DoTheRightThing()
-{
- if (PopdownCB(NULL, NULL, NULL))
- return;
-
- if (!TryToScrollAPage(bottextW,1)) {
- return;
- }
-
-/*
-** Are we at the end of a meeting?
-*/
- if (TransactionNum(NEXT) != 0) {
-/*
-** No, read the next transaction
-*/
- BotSelect(NULL, 0, NULL);
- }
- else {
-/*
-** Yes, go to the next meeting and read its next transaction.
-*/
- if ((simplemode != True) && (MoveToMeeting(NEXTNEWS) == 0)) {
- BotSelect(NULL, 0, NULL);
- }
- }
-}
-
-static void
-DoTheRightThingInReverse()
-{
- if (!TryToScrollAPage(bottextW,-1)) {
- return;
- }
-
-/*
-** Are we at the start of a meeting?
-*/
- if (TransactionNum(CURRENT) > TransactionNum(FIRST)) {
-/*
-** No, read the prev transaction
-*/
- BotSelect(NULL, (XtPointer)1, NULL);
- }
- else {
-/*
-** Yes, go to the prev meeting and read its next transaction.
-*/
- TopSelect(NULL, (XtPointer)1, NULL);
- }
-}
-
-/*
-** Code stolen from Text.c and TextAction.c to scroll the text widget.
-** Many text functions are static, so I had to take what I could get.
-*/
-
-TryToScrollAPage(ctx, direction)
-TextWidget ctx;
-int direction;
-{
- int scroll_val = (ctx->text.lt.lines - 1) * direction;
-
-/*
-** Don't scroll off the bottom
-*/
- if (ctx->text.lt.info[ctx->text.lt.lines].position >
- ctx->text.lastPos &&
- direction > 0) {
- return (-1);
- }
-/*
-** Don't scroll off the top
-*/
- if (ctx->text.lt.top == 0 &&
- direction < 0) {
- return (-1);
- }
-
- _XawTextPrepareToUpdate(ctx);
- _XawTextVScroll(ctx, scroll_val);
-
- ctx->text.insertPos = ctx->text.lt.top;
- _XawTextCheckResize(ctx);
- _XawTextExecuteUpdate(ctx);
- ctx->text.mult = 1;
- return (0);
-}
-
-
-static char oldline[80];
-
-PutUpTempMessage(string)
-char *string;
-{
- char *returndata;
- Arg args[1];
-
- XtSetArg(args[0], XtNstring, &returndata);
- XtGetValues (label1W, args, 1);
- strcpy (oldline, returndata);
-
- XtSetArg(args[0], XtNstring, string);
- XtSetValues (label1W, args, 1);
- XFlush(XtDisplay(label1W));
-}
-
-TakeDownTempMessage()
-{
- Arg args[1];
-
- XtSetArg(args[0], XtNstring, oldline);
- XtSetValues (label1W, args, 1);
-}
-
-PutUpStatusMessage(string)
-char *string;
-{
- Arg args[1];
-
- XtSetArg(args[0], XtNstring, string);
- XtSetValues (label1W, args, 1);
- XFlush(XtDisplay(label1W));
-}
-
-/*
-** PutUpArrow assumes that "start" is the first character position of a line
-** in a text widget. It puts a marker "+" on this line, and if moveinsert
-** is True, moves the insert point there.
-*/
-
-PutUpArrow(textW, start, moveinsert)
-TextWidget textW;
-XawTextPosition start;
-Boolean moveinsert;
-{
- XawTextBlock textblock;
- static int oldtopscreen = -1;
- int offset;
- XawTextPosition oldinspoint;
-
- offset = (topscreen == MAIN) ? 7 : 0;
-
- oldinspoint = XawTextGetInsertionPoint(textW);
-
-/*
-** Don't try to erase an arrow on another top screen
-*/
- if (topscreen != oldtopscreen)
- oldarrow = -1;
-
- oldtopscreen = topscreen;
-
- textblock.firstPos = 0;
- textblock.length = 1;
- textblock.format = FMT8BIT;
-
- if (oldarrow != -1) {
- textblock.ptr = " ";
- XawTextReplace ( textW, oldarrow + offset,
- oldarrow + offset + 1, &textblock);
- }
-
- textblock.ptr = "+";
-
- XawTextReplace ( textW, start + offset,
- start + offset + 1, &textblock);
-
- if (moveinsert)
- XawTextSetInsertionPoint (textW, start);
- else
- XawTextSetInsertionPoint (textW, oldinspoint);
-
- if (topscreen == MAIN)
- startOfCurrentMeeting = start;
-
- XFlush(XtDisplay(textW));
-
- oldarrow = start;
-}
-
-/*
-** This assumes the insert position is at the start of the line containing
-** the letter 'c'.
-*/
-
-/*
-** If UseStringInPlace were True for toptextW, we
-** wouldn't need both the XawTextReplace and the setting of
-** the char in meetinglist, but setting it to True causes weird
-** memory overlaps I haven't figured out yet.
-*/
-
-void
-RemoveLetterC()
-{
- XawTextBlock textblock;
- XawTextPosition inspoint;
-
- textblock.firstPos = 0;
- textblock.length = 1;
- textblock.format = FMT8BIT;
- textblock.ptr = " ";
-
- inspoint = startOfCurrentMeeting;
-
- if (inspoint > strlen (meetinglist))
- return;
-
- XawTextReplace (toptextW, inspoint + 2, inspoint + 3, &textblock);
-
- *(meetinglist + inspoint + 2) = ' ';
-
- XFlush(XtDisplay(toptextW));
-}
-
-AddChildren (parent, whichone)
-Widget parent;
-int whichone;
-{
- Widget command, menu, entry;
- int i, j, n;
- char *name, *label;
- Arg args[5];
- EntryRec *toprec, *newrec;
- void (*mycallback)();
-
- char **buttonlabels;
- char **buttonnames;
-
- if (whichone == 0) {
- buttonlabels = menu_labels0;
- buttonnames = menu_names0;
- mycallback = TopSelect;
- }
- else {
- buttonlabels = menu_labels1;
- buttonnames = menu_names1;
- mycallback = BotSelect;
- }
-
- for (i = 0; i < MAX_BUTTONS && buttonnames[i]; i++) {
- n = 0;
- XtSetArg(args[n], XtNmenuName, buttonlabels[i]); n++;
- XtSetArg(args[n], XtNlabel, buttonlabels[i]); n++;
-
- if (whichone == 0) {
- label = submenu_labels0[i][0];
- name = submenu_names0[i][0];
- }
- else {
- label = submenu_labels1[i][0];
- name = submenu_names1[i][0];
- }
- toprec = &(toplevelbuttons[whichone][i]);
-
- if (name) {
- command = XtCreateManagedWidget(
- buttonnames[i],
- menuButtonWidgetClass, parent,
- args, n);
- }
- else {
- command = XtCreateManagedWidget(
- buttonnames[i],
- commandWidgetClass, parent,
- args, n);
- XtAddCallback( command, XtNcallback,
- mycallback, (XtPointer) i);
- }
-
- toprec->button = command;
- toprec->nextrec = NULL;
-
- XtInstallAccelerators(topW, command);
-
- if (!name)
- continue;
-
-/*
-** Add menus to menu buttons.
-*/
-
- n = 0;
- menu = XtCreatePopupShell(
- buttonlabels[i],
- simpleMenuWidgetClass,
- parent,
- args, n);
-
- for (j = 0; j < MAX_MENU_LEN; j++) {
- if (whichone == 0) {
- label = submenu_labels0[i][j];
- name = submenu_names0[i][j];
- }
- else {
- label = submenu_labels1[i][j];
- name = submenu_names1[i][j];
- }
- if (!name)
- break;
-
- newrec = (EntryRec *) malloc (sizeof (EntryRec));
- toprec->nextrec = newrec;
- newrec->nextrec = NULL;
- n = 0;
- XtSetArg(args[n], XtNlabel, label); n++;
-
- entry = XtCreateManagedWidget(
- name, smeBSBObjectClass, menu,
- args, n);
- XtAddCallback( entry, XtNcallback,
- mycallback,
- (XtPointer) (i + (j << 4)));
- newrec->button = entry;
- toprec = newrec;
- }
- }
-}
-
-/*
-** A keyboard equivalent has been hit. For normal command widgets, send
-** them a button-one-down and button-one-up. For menu buttons, just send
-** them the button-down, and their child will send the button-up.
-*/
-
-static void
-KeyCallback(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params;
-int *num_params;
-{
- Widget button;
- XButtonEvent MyEvent;
- int i, whichrow;
-
- if (*num_params < 1)
- return;
-
- for (i = 0; i < MAX_BUTTONS; i++) {
-
- if (menu_names0[i] && !strcmp (params[0], menu_names0[i])) {
- whichrow = 0;
- break;
- }
-
- if (menu_names1[i] && !strcmp (params[0], menu_names1[i])) {
- whichrow = 1;
- break;
- }
- }
-
- if (i == MAX_BUTTONS) {
- fprintf (stderr, "Key not found. Aborting.\n");
- return;
- }
-
- button = (toplevelbuttons[whichrow][i]).button;
-
- MyEvent.type = ButtonPress;
- MyEvent.display = dpy;
- MyEvent.window = XtWindow(button);
- MyEvent.button = 1;
- MyEvent.x = 1;
- MyEvent.y = 1;
- MyEvent.state = ButtonPressMask;
- XSendEvent( dpy,
- XtWindow(button),
- False,
- ButtonPressMask,
- (XEvent *) &MyEvent);
-
- XSync(dpy, False);
- if (!(toplevelbuttons[whichrow][i]).nextrec) {
- MyEvent.type = ButtonRelease;
- MyEvent.state = ButtonReleaseMask;
- XSendEvent( dpy,
- XtWindow(button),
- False,
- ButtonReleaseMask,
- (XEvent *) &MyEvent);
- }
-
-}
-
-/*
-** Check time interval between mouse clicks. If it's less than the
-** intrinsics' multi-click timer, call my own "Update" procedure.
-** Otherwise, pass the click on to the text widget.
-*/
-
-void
-DispatchClick(w, event, params, num_params)
-Widget w;
-XEvent *event;
-String *params; /* unused */
-Cardinal *num_params; /* unused */
-{
- static Time lasttime = 0;
-
- if ( lasttime == 0 ||
- (XtLastTimestampProcessed(XtDisplay(w)) - lasttime) >
- (Time) XtGetMultiClickTime(XtDisplay(w))) {
- XtCallActionProc(w, "select-start", event,
- params, *num_params);
- }
- else {
- XtCallActionProc(w, "Update", event,
- params, *num_params);
- }
- lasttime = XtLastTimestampProcessed(XtDisplay(w));
-}
-
-/*
- * Function: GetFontWidth(widget)
- * based on code from Xaw/TextSink.c
- * mdb 7/26/96
- */
-
-static unsigned long
-GetFontWidth(w)
-Widget w;
-{
- TextSinkObject sink = (TextSinkObject) w;
- Atom XA_FIGURE_WIDTH;
- unsigned long figure_width = 0;
- XFontStruct *font;
- Arg args[1];
-
- XtSetArg(args[0], XtNfont, &font);
- XtGetValues (w, args, 1);
-
-/*
- * Find the figure width of the current font.
- */
-
- XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", FALSE);
- if ( XA_FIGURE_WIDTH != None &&
- ( (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)) ||
- (figure_width == 0)) )
- if (font->per_char && font->min_char_or_byte2 <= '$' &&
- font->max_char_or_byte2 >= '$')
- figure_width = font->per_char['$' - font->min_char_or_byte2].width;
- else
- figure_width = font->max_bounds.width;
-
- return(figure_width);
-}
diff --git a/xdsc.h b/xdsc.h
deleted file mode 100644
index 1e6f600..0000000
--- a/xdsc.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright 1991 by the Massachusetts Institute of Technology
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright
-notice and this permission notice appear in supporting
-documentation, and that the name of M.I.T. not be used in
-advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-M.I.T. makes no representations about the suitability of
-this software for any purpose. It is provided "as is"
-without express or implied warranty.
-*/
-
-#define MAX_BUTTONS 8
-#define MAX_MENU_LEN 6
-#define BUFSIZE 512
-#define HELL_FROZEN_OVER 0
-#define LONGNAMELEN 100
-#define SHORTNAMELEN 50
-
-#define NEXT -1
-#define PREV -2
-#define NEXTNEWS -3
-#define PREVNEWS -4
-#define UPDATE -5
-#define NREF -6
-#define PREF -7
-#define FIRST -8
-#define LAST -9
-#define CURRENT -10
-#define HIGHESTSEEN -11
-#define INITIALIZE -12
-#define LREF -13
-#define FREF -14
-
-#define BUTTONS_UPDATE 1
-#define BUTTONS_OFF 2
-#define BUTTONS_ON 3
-
-#define MAIN 1
-#define EDITMTGS 2
-#define LISTTRNS 3
-
-/*
-** In a chain of entryrecs, the head will be either a command widget or
-** a menubutton, and any following entries will be command children
-** of the menubutton.
-*/
-
-typedef struct entryrec {
- Widget button;
- struct entryrec *nextrec;
-} EntryRec;