Commit b9fd67bd authored by Dan Nicolaescu's avatar Dan Nicolaescu
Browse files

* hftctl.c:

* chpdef.h:
* acldef.h: Remove files used only for systems no longer supported.

* Makefile.in: Fix .o alphabetical ordering.
(hftctl.o): Remove dependency, file removed.
(keymap.o, print.o): Depend on charset.h.
parent 05342dca
......@@ -158,7 +158,6 @@ src/fontset.c
src/getloadavg.c
src/gmalloc.c
src/gtkutil.c
src/hftctl.c
src/indent.c
src/insdel.c
src/image.c
......
2008-11-12 Dan Nicolaescu <dann@ics.uci.edu>
* hftctl.c:
* chpdef.h:
* acldef.h: Remove files used only for systems no longer supported.
* Makefile.in: Fix .o alphabetical ordering.
(hftctl.o): Remove dependency, file removed.
(keymap.o, print.o): Depend on charset.h.
2008-11-10 Kenichi Handa <handa@m17n.org>
* character.c (Fget_byte): Fix and make it faster for unibyte
......
......@@ -1021,6 +1021,7 @@ stamp-oldxmenu:
it is so often changed in ways that do not require any recompilation
and so rarely changed in ways that do require any. */
atimer.o: atimer.c atimer.h syssignal.h systime.h $(config_h)
abbrev.o: abbrev.c buffer.h window.h dispextern.h commands.h character.h \
syntax.h $(config_h)
buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \
......@@ -1051,6 +1052,7 @@ cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h $(config_h) \
pre-crt0.o: pre-crt0.c
ecrt0.o: ecrt0.c $(config_h)
CRT0_COMPILE ${srcdir}/ecrt0.c
dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h $(config_h)
dired.o: dired.c commands.h buffer.h $(config_h) character.h charset.h \
coding.h regex.h systime.h blockinput.h atimer.h
dispnew.o: dispnew.c systime.h commands.h process.h frame.h \
......@@ -1085,6 +1087,9 @@ ftfont.o: dispextern.h frame.h character.h charset.h composite.h font.h \
fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h character.h \
charset.h frame.h keyboard.h termhooks.h font.h $(config_h)
getloadavg.o: getloadavg.c $(config_h)
gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h $(config_h) \
blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \
charset.h coding.h syssignal.h
image.o: image.c frame.h window.h dispextern.h blockinput.h atimer.h \
systime.h xterm.h w32term.h w32gui.h font.h \
nsterm.h nsgui.h $(config_h)
......@@ -1099,7 +1104,7 @@ keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h \
$(config_h)
keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
atimer.h systime.h puresize.h character.h intervals.h keymap.h window.h \
atimer.h systime.h puresize.h character.h charset.h intervals.h keymap.h window.h \
$(config_h)
lastfile.o: lastfile.c $(config_h)
macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \
......@@ -1143,6 +1148,7 @@ search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \
blockinput.h atimer.h systime.h category.h character.h charset.h \
composite.h $(INTERVAL_SRC) \
$(config_h)
sound.o: sound.c dispextern.h syssignal.h $(config_h)
strftime.o: strftime.c $(config_h)
syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \
composite.h keymap.h regex.h $(INTERVAL_SRC) $(config_h)
......@@ -1212,14 +1218,6 @@ xselect.o: xselect.c process.h dispextern.h frame.h xterm.h blockinput.h \
xrdb.o: xrdb.c $(config_h) epaths.h
xsmfns.o: xsmfns.c $(config_h) systime.h sysselect.h termhooks.h xterm.h \
lisp.h termopts.h
gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h $(config_h) \
blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \
charset.h coding.h syssignal.h
dbusbind.o: dbusbind.c termhooks.h $(config_h)
hftctl.o: hftctl.c $(config_h)
sound.o: sound.c dispextern.h syssignal.h $(config_h)
atimer.o: atimer.c atimer.h syssignal.h systime.h $(config_h)
/* The files of Lisp proper */
......@@ -1238,17 +1236,17 @@ fns.o: fns.c commands.h $(config_h) frame.h buffer.h character.h keyboard.h \
blockinput.h atimer.h systime.h xterm.h termhooks.h
print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \
$(config_h) dispextern.h termchar.h $(INTERVAL_SRC) msdos.h composite.h \
blockinput.h atimer.h systime.h font.h
blockinput.h atimer.h systime.h font.h charset.h
lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \
charset.h $(config_h) $(INTERVAL_SRC) termhooks.h coding.h msdos.h
/* Text properties support */
textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVAL_SRC) \
$(config_h)
intervals.o: intervals.c buffer.h $(INTERVAL_SRC) keyboard.h puresize.h \
keymap.h $(config_h)
composite.o: composite.c buffer.h character.h dispextern.h font.h frame.h \
$(INTERVAL_SRC) window.h $(config_h)
intervals.o: intervals.c buffer.h $(INTERVAL_SRC) keyboard.h puresize.h \
keymap.h $(config_h)
textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVAL_SRC) \
$(config_h)
/* System-specific programs to be made.
OTHER_FILES and OBJECTS_MACHINE
......
/*
* The code here is forced by the interface, and is not subject to
* copyright, constituting the only possible expression of the
* algorithm in this format.
*/
#define ACL$K_LENGTH 12
#define ACL$C_LENGTH 12
#define ACL$C_FILE 1
#define ACL$C_DEVICE 2
#define ACL$C_JOBCTL_QUEUE 3
#define ACL$C_COMMON_EF_CLUSTER 4
#define ACL$C_LOGICAL_NAME_TABLE 5
#define ACL$C_PROCESS 6
#define ACL$C_GROUP_GLOBAL_SECTION 7
#define ACL$C_SYSTEM_GLOBAL_SECTION 8
#define ACL$C_ADDACLENT 1
#define ACL$C_DELACLENT 2
#define ACL$C_MODACLENT 3
#define ACL$C_FNDACLENT 4
#define ACL$C_FNDACETYP 5
#define ACL$C_DELETEACL 6
#define ACL$C_READACL 7
#define ACL$C_ACLLENGTH 8
#define ACL$C_READACE 9
#define ACL$C_RLOCK_ACL 10
#define ACL$C_WLOCK_ACL 11
#define ACL$C_UNLOCK_ACL 12
#define ACL$S_ADDACLENT 255
#define ACL$S_DELACLENT 255
#define ACL$S_MODACLENT 255
#define ACL$S_FNDACLENT 255
#define ACL$S_FNDACETYP 255
#define ACL$S_DELETEACL 255
#define ACL$S_READACL 512
#define ACL$S_ACLLENGTH 4
#define ACL$S_READACE 255
#define ACL$S_RLOCK_ACL 4
#define ACL$S_WLOCK_ACL 4
#define ACL$S_UNLOCK_ACL 4
#define ACL$S_ACLDEF 16
#define ACL$L_FLINK 0
#define ACL$L_BLINK 4
#define ACL$W_SIZE 8
#define ACL$B_TYPE 10
#define ACL$L_LIST 12
/* arch-tag: 7c11e99d-34df-41e8-98e2-20f152c4ad73
(do not change this comment) */
/*
* The code here is forced by the interface, and is not subject to
* copyright, constituting the only possible expression of the
* algorithm in this format.
*/
#define CHP$_END 0
#define CHP$_ACCESS 1
#define CHP$_FLAGS 2
#define CHP$_PRIV 3
#define CHP$_ACMODE 4
#define CHP$_ACCLASS 5
#define CHP$_RIGHTS 6
#define CHP$_ADDRIGHTS 7
#define CHP$_MODE 8
#define CHP$_MODES 9
#define CHP$_MINCLASS 10
#define CHP$_MAXCLASS 11
#define CHP$_OWNER 12
#define CHP$_PROT 13
#define CHP$_ACL 14
#define CHP$_AUDITNAME 15
#define CHP$_ALARMNAME 16
#define CHP$_MATCHEDACE 17
#define CHP$_PRIVUSED 18
#define CHP$_MAX_CODE 19
#define CHP$M_SYSPRV 1
#define CHP$M_BYPASS 2
#define CHP$M_UPGRADE 4
#define CHP$M_DOWNGRADE 8
#define CHP$M_GRPPRV 16
#define CHP$M_READALL 32
#define CHP$V_SYSPRV 0
#define CHP$V_BYPASS 1
#define CHP$V_UPGRADE 2
#define CHP$V_DOWNGRADE 3
#define CHP$V_GRPPRV 4
#define CHP$V_READALL 5
#define CHP$M_READ 1
#define CHP$M_WRITE 2
#define CHP$M_USEREADALL 4
#define CHP$V_READ 0
#define CHP$V_WRITE 1
#define CHP$V_USEREADALL 2
/* arch-tag: a7117984-e927-4f8e-932e-35d5fd524f12
(do not change this comment) */
/* IBM has disclaimed copyright on this module. */
/***************************************************************/
/* */
/* Function: hftctl */
/* */
/* Syntax: */
/* #include <sys/ioctl.h> */
/* #include <sys/hft.h> */
/* */
/* int hftctl(fildes, request, arg ) */
/* int fildes, request; */
/* char *arg; */
/* */
/* Description: */
/* */
/* Does the following: */
/* 1. determines if fildes is pty */
/* does normal ioctl it is not */
/* 2. places fildes into raw mode */
/* 3. converts ioctl arguments to datastream */
/* 4. waits for 2 secs for acknowledgement before */
/* timing out. */
/* 5. places response in callers buffer ( just like */
/* ioctl. */
/* 6. returns fildes to its original mode */
/* */
/* User of this program should review steps 1,4, and 3. */
/* hftctl makes no check on the request type. It must be */
/* a HFT ioctl that is supported remotely. */
/* This program will use the SIGALRM and alarm(2). Any */
/* Previous alarms are lost. */
/* */
/* Users of this program are free to modify it any way */
/* they want. */
/* */
/* Return Value: */
/* */
/* If ioctl fails, a value of -1 is returned and errno */
/* is set to indicate the error. */
/* */
/***************************************************************/
#include <config.h>
#include <sys/signal.h>
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <setjmp.h>
#include <sys/ioctl.h>
#include <sys/devinfo.h>
#include <termios.h>
#include <termio.h>
#include <sys/hft.h>
#include <sys/uio.h>
#include <sys/tty.h>
/* #include <sys/pty.h> */
#define REMOTE 0x01
#undef ioctl
static char SCCSid[] = "com/gnuemacs/src,3.1,9021-90/05/03-5/3/90";
/*************** LOCAL DEFINES **********************************/
#define QDEV ((HFQPDEVCH<<8)|HFQPDEVCL)
#define QLOC ((HFQLOCCH<<8)|HFQLOCCL)
#define QPS ((HFQPRESCH<<8)|HFQPRESCL)
#ifndef TCGETS
#define TCGETS TCGETA
#endif
#ifndef TCSETS
#define TCSETS TCSETA
#endif
/*************** EXTERNAL / GLOBAL DATA AREA ********************/
static int hfqry();
static int hfskbd();
char *xmalloc();
extern int errno;
static jmp_buf hftenv;
static int is_ack_vtd;
static SIGTYPE (*sav_alrm) ();
static struct hfctlreq req =
{ 0x1b,'[','x',0,0,0,21,HFCTLREQCH,HFCTLREQCL};
static struct hfctlack ACK =
{ 0x1b,'[','x',0,0,0,21,HFCTLACKCH,HFCTLACKCL};
/* FUNC signal(); */
/*************** LOCAL MACROS ***********************************/
#define HFTYPE(p) ((p->hf_typehi<<8)|(p->hf_typelo))
#define BYTE4(p) ((p)[0]<<24 | (p)[1]<<16 | (p)[2]<<8 | (p)[3])
/* read a buffer */
#define RD_BUF(f,p,l) \
while ((l)) \
if ((j = emacs_read (f, p, l)) < 0) \
if (errno != EINTR) return (-1); \
else continue; \
else { (l) -= j; (p) += j; }
/*************** function prototypes ***************************/
#ifdef PROTOTYPES
static GT_ACK (int fd, int req, char *buf);
static WR_REQ (int fd, int request, int cmdlen, char *cmd, int resplen);
static void hft_alrm(int sig);
#else
static GT_ACK ();
static WR_REQ ();
static void hft_alrm ();
#endif
/*************** HFTCTL FUNCTION *******************************/
hftctl (fd, request, arg)
int fd;
int request;
union {
struct hfintro *intro;
struct hfquery *query;
char *c;
} arg;
{
int i;
int fd_flag; /* fcntl flags */
register union {
struct hfintro *cmd; /* p.cmd - intro des. */
struct hfqphdevc *ph; /* p.ph - physical dev.*/
char *c; /* p.c - char ptr */
} p; /* general pointer */
int pty_new; /* pty modes */
int pty_old;
int retcode;
struct termios term_new; /* terminal attributes */
struct termios term_old;
struct devinfo devInfo; /* defined in sys/devinfo.h */
if (ioctl (fd, IOCINFO, &devInfo) == -1) return(-1);
if (devInfo.devtype != DD_PSEU) /* is it a pty? */
return (ioctl(fd, request, arg)); /* no, do IOCTL */
/******* START PTY **************/
/** Pty found, possible HFT */
/** set new file des as raw */
/** as you can. */
/********************************/
/* Get current state of file */
/* descriptor & save */
if ((fd_flag = fcntl (fd, F_GETFL, 0)) == -1) return (-1);
if (ioctl (fd, TCGETS, &term_old) == -1) return (-1);
/* set terminal attr to raw */
/* and to delay on read */
pty_new = pty_old | REMOTE;
memcpy (&term_new, &term_old, sizeof (term_new));
term_new.c_iflag = 0;
term_new.c_oflag = 0;
term_new.c_lflag = 0;
/* term_new.c_line = 0; */
for (i = 1; i <= 5; i++)
term_new.c_cc[i] = 0;
term_new.c_cc[0] = -1;
ioctl (fd, TCSETS, &term_new);
if (fcntl (fd, F_SETFL, fd_flag & ~O_NDELAY) == -1)
return(-1);
/* call spacific function */
if (request == HFSKBD)
retcode = hfskbd (fd, request, arg.c);
else /* assume HFQUERY */
retcode = hfqry (fd, request, arg.c);
fcntl (fd, F_SETFL, fd_flag); /* reset terminal to original */
ioctl (fd, TCSETS, &term_old);
return (retcode); /* return error */
}
/*************** HFSKBD FUNCTION ******************************/
static int
hfskbd (fd, request, arg)
int fd;
int request;
struct hfbuf *arg;
{
WR_REQ(fd, request, arg->hf_buflen, arg->hf_bufp,0);
return (GT_ACK(fd, request, arg->hf_bufp));
}
/*************** HFQUERY FUNCTION ******************************/
static int
hfqry (fd, request, arg)
int fd;
int request;
struct hfquery *arg;
{
WR_REQ(fd, request, arg->hf_cmdlen, arg->hf_cmd, arg->hf_resplen);
return (GT_ACK(fd, request, arg->hf_resp));
}
/*************** GT_ACK FUNCTION ******************************/
static int
GT_ACK (fd, req, buf)
int fd;
int req;
char *buf;
{
struct hfctlack ack;
int i = sizeof (ack);
int j = 0;
union {
char *c;
struct hfctlack *ack;
} p;
is_ack_vtd = 0; /* flag no ACT VTD yet */
if (setjmp (hftenv)) /* set environment in case */
{ /* of time out */
errno = ENODEV; /* if time out, set errno */
return (-1); /* flag error */
}
alarm(3); /* time out in 3 secs */
sav_alrm = signal (SIGALRM, hft_alrm); /* prepare to catch time out */
p.ack = &ack;
while (! is_ack_vtd) /* do until valid ACK VTD */
{
RD_BUF(fd, p.c, i); /* read until a ACK VTD is fill*/
if (! memcmp (&ack, &ACK, sizeof (HFINTROSZ)) /* the ACK intro & */
&& (ack.hf_request == req)) /* is it the response we want ?*/
{ /* yes, ACK VTD found */
is_ack_vtd = 1; /* quickly, flag it */
break; /* get the %$%#@ out of here */
}
p.ack = &ack; /* no, then skip 1st */
++p.c; /* char and start over */
i = sizeof (ack) - 1; /* one less ESC to cry over */
while ((*p.c != 0x1b) && i) /* scan for next ESC */
{ ++p.c; --i; } /* if any */
(i ? memcpy (&ack, p.c, i) : 0); /* if any left over, then move */
p.ack = &ack; /* ESC to front of ack struct */
p.c += i; /* skip over whats been read */
i = sizeof (ack) - i; /* set whats left to be read */
} /***** TRY AGAIN */
alarm(0); /* ACK VTD received, reset alrm*/
signal (SIGALRM, sav_alrm); /* reset signal */
if (i = ack.hf_arg_len) /* any data following ? */
{ /* yes, */
RD_BUF(fd,buf,i); /* read until it is received */
}
if (errno = ack.hf_retcode) /* set errno based on returned */
return (-1); /* code, if 0, then no error */
else
return (0); /* if set, then error returned */
}
/*************** HFT_ALRM FUNCTION ******************************/
static void
hft_alrm (sig) /* Function hft_alrm - handle */
int sig; /* alarm signal */
{
signal (SIGALRM, sav_alrm); /* reset to previous */
if (is_ack_vtd) /* has ack vtd arrived ? */
return; /* yes, then continue */
else /* no, then return with error */
longjmp (hftenv, -1);
}
/*********************************************************************/
/*** ***/
/*** NOTE: Both the HFCTLREQ and the arg structure should be ***/
/*** sent in one io write operation. If terminal ***/
/*** emulators are in NODELAY mode then multiple writes ***/
/*** may cause bogus information to be read by the emulator ***/
/*** depending on the timing. ***/
/*** ***/
/*********************************************************************/
static int
WR_REQ (fd, request, cmdlen, cmd, resplen)
int fd;
int request;
int cmdlen;
char *cmd;
int resplen;
{
struct {
char *c;
struct hfctlreq *req;
} p;
int size;
req.hf_request = request;
req.hf_arg_len = cmdlen;
req.hf_rsp_len = resplen;
if (cmdlen) /* if arg structure to pass */
{
size = sizeof (struct hfctlreq) + cmdlen;
if ((p.c = xmalloc(size)) == NULL) /* malloc one area */
return (-1);
memcpy (p.c, &req, sizeof (req)); /* copy CTL REQ struct */
memcpy (p.c + sizeof (req), cmd, cmdlen); /* copy arg struct */
}
else
{
p.req = &req; /* otherwise use only CTL REQ */
size = sizeof (req);
}
/* write request to terminal */
if (emacs_write (fd, p.c, size) == -1) return (-1);
if (p.req != &req) /* free if allocated */
xfree (p.c);
return (0);
}
/* arch-tag: cfd4f3bd-fd49-44e6-9f69-c8abdf367650
(do not change this comment) */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment