home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
old
/
ckermit5a190
/
ckmrem.c
< prev
next >
Wrap
C/C++ Source or Header
|
2020-01-01
|
5KB
|
151 lines
/* $Id: ckmrem.c,v 1.5 91/12/15 23:17:48 rick Exp $
* $Source: /uw/mackermit/RCS/ckmrem.c,v $
*------------------------------------------------------------------
* $Log: ckmrem.c,v $
* Revision 1.5 91/12/15 23:17:48 rick
* ut9
*
* Revision 1.4 91/10/13 13:44:24 rick
* UT(7)
*
* Revision 1.3 91/10/03 12:42:59 rick
* UT(5)
*
* Revision 1.2 91/09/25 12:17:25 rick
* Command window in TE. Multiple vt100 windows for command window.
*
* Revision 1.3 1991/09/25 14:45:26 rick
* Multiple vt100 window support for command window.
*
* Revision 1.2 1991/09/16 17:03:14 rick
* Command window in TE
*
*------------------------------------------------------------------
* $Endlog$
*/
/* Version 0.8(35) - Jim Noble at Planning Research Corporation, June 1987. */
/* Ported to Megamax native Macintosh C compiler. */
/*
* file ckmrem.c
*
* Module of MacKermit containing code for remote commands and the display
* of remote commands.
*
*/
/*
Copyright (C) 1985, 1992, Trustees of Columbia University in the City of New
York. Permission is granted to any individual or institution to use this
software as long as it is not sold for profit. This copyright notice must be
retained. This software may not be included in commercial products without
written permission of Columbia University.
*/
#include "ckcdeb.h"
#include "ckcasc.h"
#include "ckcker.h"
#include "ckmdef.h" /* General Mac defs */
#include "ckmres.h" /* Resource file defs */
#include "ckmwin.h" /* common window defs */
#include "ckmptp.h" /* ckm* Prototypes */
typedef struct {
int resid;
char scode;
StringPtr name;
StringPtr hlp1;
StringPtr hlp2;
} RCMDTBL;
RCMDTBL remotecmds[] = {
{CWD_REMO, 'C', "\pCWD", "\pDirectory", "\pPassword"},
{DEL_REMO, 'E', "\pDelete", "\pFilespec", "\p"},
{DIR_REMO, 'D', "\pDirectory", "\pFilespec", "\p"},
{HELP_REMO, 'H', "\pHelp", "\pTopic", "\p"},
{HOST_REMO, ' ', "\pHost", "\pCommand", "\p"},
{SPAC_REMO, 'U', "\pSpace", "\pArea", "\p"},
{TYPE_REMO, 'T', "\pType", "\pFilespec", "\p"},
{WHO_REMO, 'W', "\pWho", "\pUser ID", "\pOptions"},
{0, 0, NULL, NULL, NULL}
};
/****************************************************************************/
/* Remote command dialog */
/* remotedialog - returns FALSE if cancel hit, TRUE otherwise with */
/* generic command setup in gstr. */
/****************************************************************************/
int
remotedialog (rid, gstr)
int rid;
char *gstr;
{
short itemhit;
short itemtype;
int i;
DialogPtr remoteDialog;
Handle itemhdl;
Rect itemrect;
RCMDTBL *rcmdh = (RCMDTBL *) NULL;
char arg1[256], arg2[256];
for (i = 0; remotecmds[i].resid != 0; i++) /* locate remote command */
if (remotecmds[i].resid == rid) /* record for this command */
rcmdh = &remotecmds[i]; /* set our handle */
if (rcmdh == (RCMDTBL *) NULL) { /* find anything? */
printerr ("Can't find remote command info for ", rid); /* ugh... */
return (FALSE);
}
remoteDialog = GetNewDialog (REMOTEBOXID, NILPTR, (WindowPtr) - 1);
circleOK(remoteDialog);
/* setup variables */
ParamText (rcmdh->name, rcmdh->hlp1, rcmdh->hlp2, "");
/* second argument? no, remove from screen */
if (Length (rcmdh->hlp2) == 0) {
GetDItem (remoteDialog, RRES_ARG2, &itemtype, &itemhdl, &itemrect);
if (itemtype != editText)
printerr ("RRES_ARG2 is not editText!", 0); /* ugh now we die! */
itemtype |= itemDisable;/* disable it */
SetRect (&itemrect, 1044, 20, 1145, 116); /* off the end of our
* world */
SetDItem (remoteDialog, RRES_ARG2, itemtype, itemhdl, &itemrect);
}
for (;;) {
ModalDialog ((ModalFilterProcPtr) NILPROC, &itemhit);
switch (itemhit) {
case OKBtn:
GetDItem (remoteDialog, RRES_ARG1, &itemtype, &itemhdl, &itemrect);
GetIText (itemhdl, arg1);
p2cstr(arg1);
GetDItem (remoteDialog, RRES_ARG2, &itemtype, &itemhdl, &itemrect);
GetIText (itemhdl, arg2);
p2cstr(arg2);
if (rid == HOST_REMO)
strcpy (gstr, arg1);
else
/* setup the command */
ssetgen (gstr, rcmdh->scode, arg1, arg2, "");
case QuitBtn: /* fall through */
DisposDialog (remoteDialog); /* all done, answer on cterm
* screen */
if (itemhit == OKBtn) { /* want to do the command?/ */
conoc (CR); /* output CR to delimit */
conoll ("-----"); /* and dashes followed by CR */
rcmdwshow (rcmdw); /* show Response window */
}
return (itemhit == OKBtn); /* and return ok or bad... */
}
}
} /* remotedialog */