diff options
| author | Dan Nicolaescu | 2008-11-12 07:17:21 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2008-11-12 07:17:21 +0000 |
| commit | b9fd67bd5c2e024a3532d7d03f0fb21910b2500e (patch) | |
| tree | 042f82ee9b02012d755ab03f452af226fe8fd601 | |
| parent | 05342dca46131c1726f503def80e45012e5cbc0f (diff) | |
| download | emacs-b9fd67bd5c2e024a3532d7d03f0fb21910b2500e.tar.gz emacs-b9fd67bd5c2e024a3532d7d03f0fb21910b2500e.zip | |
* 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.
| -rw-r--r-- | admin/MAINTAINERS | 1 | ||||
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/Makefile.in | 26 | ||||
| -rw-r--r-- | src/acldef.h | 48 | ||||
| -rw-r--r-- | src/chpdef.h | 46 | ||||
| -rw-r--r-- | src/hftctl.c | 342 |
6 files changed, 22 insertions, 451 deletions
diff --git a/admin/MAINTAINERS b/admin/MAINTAINERS index 17a0877b855..d892e9726d0 100644 --- a/admin/MAINTAINERS +++ b/admin/MAINTAINERS | |||
| @@ -158,7 +158,6 @@ src/fontset.c | |||
| 158 | src/getloadavg.c | 158 | src/getloadavg.c |
| 159 | src/gmalloc.c | 159 | src/gmalloc.c |
| 160 | src/gtkutil.c | 160 | src/gtkutil.c |
| 161 | src/hftctl.c | ||
| 162 | src/indent.c | 161 | src/indent.c |
| 163 | src/insdel.c | 162 | src/insdel.c |
| 164 | src/image.c | 163 | src/image.c |
diff --git a/src/ChangeLog b/src/ChangeLog index 0bbebd5f3bb..bafede72321 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2008-11-12 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | * hftctl.c: | ||
| 4 | * chpdef.h: | ||
| 5 | * acldef.h: Remove files used only for systems no longer supported. | ||
| 6 | |||
| 7 | * Makefile.in: Fix .o alphabetical ordering. | ||
| 8 | (hftctl.o): Remove dependency, file removed. | ||
| 9 | (keymap.o, print.o): Depend on charset.h. | ||
| 10 | |||
| 1 | 2008-11-10 Kenichi Handa <handa@m17n.org> | 11 | 2008-11-10 Kenichi Handa <handa@m17n.org> |
| 2 | 12 | ||
| 3 | * character.c (Fget_byte): Fix and make it faster for unibyte | 13 | * character.c (Fget_byte): Fix and make it faster for unibyte |
diff --git a/src/Makefile.in b/src/Makefile.in index 64d992f41c0..e3af6e5feef 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -1021,6 +1021,7 @@ stamp-oldxmenu: | |||
| 1021 | it is so often changed in ways that do not require any recompilation | 1021 | it is so often changed in ways that do not require any recompilation |
| 1022 | and so rarely changed in ways that do require any. */ | 1022 | and so rarely changed in ways that do require any. */ |
| 1023 | 1023 | ||
| 1024 | atimer.o: atimer.c atimer.h syssignal.h systime.h $(config_h) | ||
| 1024 | abbrev.o: abbrev.c buffer.h window.h dispextern.h commands.h character.h \ | 1025 | abbrev.o: abbrev.c buffer.h window.h dispextern.h commands.h character.h \ |
| 1025 | syntax.h $(config_h) | 1026 | syntax.h $(config_h) |
| 1026 | buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \ | 1027 | 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) \ | |||
| 1051 | pre-crt0.o: pre-crt0.c | 1052 | pre-crt0.o: pre-crt0.c |
| 1052 | ecrt0.o: ecrt0.c $(config_h) | 1053 | ecrt0.o: ecrt0.c $(config_h) |
| 1053 | CRT0_COMPILE ${srcdir}/ecrt0.c | 1054 | CRT0_COMPILE ${srcdir}/ecrt0.c |
| 1055 | dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h $(config_h) | ||
| 1054 | dired.o: dired.c commands.h buffer.h $(config_h) character.h charset.h \ | 1056 | dired.o: dired.c commands.h buffer.h $(config_h) character.h charset.h \ |
| 1055 | coding.h regex.h systime.h blockinput.h atimer.h | 1057 | coding.h regex.h systime.h blockinput.h atimer.h |
| 1056 | dispnew.o: dispnew.c systime.h commands.h process.h frame.h \ | 1058 | 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 \ | |||
| 1085 | fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h character.h \ | 1087 | fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h character.h \ |
| 1086 | charset.h frame.h keyboard.h termhooks.h font.h $(config_h) | 1088 | charset.h frame.h keyboard.h termhooks.h font.h $(config_h) |
| 1087 | getloadavg.o: getloadavg.c $(config_h) | 1089 | getloadavg.o: getloadavg.c $(config_h) |
| 1090 | gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h $(config_h) \ | ||
| 1091 | blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \ | ||
| 1092 | charset.h coding.h syssignal.h | ||
| 1088 | image.o: image.c frame.h window.h dispextern.h blockinput.h atimer.h \ | 1093 | image.o: image.c frame.h window.h dispextern.h blockinput.h atimer.h \ |
| 1089 | systime.h xterm.h w32term.h w32gui.h font.h \ | 1094 | systime.h xterm.h w32term.h w32gui.h font.h \ |
| 1090 | nsterm.h nsgui.h $(config_h) | 1095 | nsterm.h nsgui.h $(config_h) |
| @@ -1099,7 +1104,7 @@ keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \ | |||
| 1099 | xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h \ | 1104 | xterm.h puresize.h msdos.h keymap.h w32term.h nsterm.h \ |
| 1100 | $(config_h) | 1105 | $(config_h) |
| 1101 | keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \ | 1106 | keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \ |
| 1102 | atimer.h systime.h puresize.h character.h intervals.h keymap.h window.h \ | 1107 | atimer.h systime.h puresize.h character.h charset.h intervals.h keymap.h window.h \ |
| 1103 | $(config_h) | 1108 | $(config_h) |
| 1104 | lastfile.o: lastfile.c $(config_h) | 1109 | lastfile.o: lastfile.c $(config_h) |
| 1105 | macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \ | 1110 | 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 \ | |||
| 1143 | blockinput.h atimer.h systime.h category.h character.h charset.h \ | 1148 | blockinput.h atimer.h systime.h category.h character.h charset.h \ |
| 1144 | composite.h $(INTERVAL_SRC) \ | 1149 | composite.h $(INTERVAL_SRC) \ |
| 1145 | $(config_h) | 1150 | $(config_h) |
| 1151 | sound.o: sound.c dispextern.h syssignal.h $(config_h) | ||
| 1146 | strftime.o: strftime.c $(config_h) | 1152 | strftime.o: strftime.c $(config_h) |
| 1147 | syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \ | 1153 | syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \ |
| 1148 | composite.h keymap.h regex.h $(INTERVAL_SRC) $(config_h) | 1154 | 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 \ | |||
| 1212 | xrdb.o: xrdb.c $(config_h) epaths.h | 1218 | xrdb.o: xrdb.c $(config_h) epaths.h |
| 1213 | xsmfns.o: xsmfns.c $(config_h) systime.h sysselect.h termhooks.h xterm.h \ | 1219 | xsmfns.o: xsmfns.c $(config_h) systime.h sysselect.h termhooks.h xterm.h \ |
| 1214 | lisp.h termopts.h | 1220 | lisp.h termopts.h |
| 1215 | gtkutil.o: gtkutil.c gtkutil.h xterm.h lisp.h frame.h $(config_h) \ | ||
| 1216 | blockinput.h window.h atimer.h systime.h termhooks.h keyboard.h \ | ||
| 1217 | charset.h coding.h syssignal.h | ||
| 1218 | dbusbind.o: dbusbind.c termhooks.h $(config_h) | ||
| 1219 | |||
| 1220 | hftctl.o: hftctl.c $(config_h) | ||
| 1221 | sound.o: sound.c dispextern.h syssignal.h $(config_h) | ||
| 1222 | atimer.o: atimer.c atimer.h syssignal.h systime.h $(config_h) | ||
| 1223 | 1221 | ||
| 1224 | /* The files of Lisp proper */ | 1222 | /* The files of Lisp proper */ |
| 1225 | 1223 | ||
| @@ -1238,17 +1236,17 @@ fns.o: fns.c commands.h $(config_h) frame.h buffer.h character.h keyboard.h \ | |||
| 1238 | blockinput.h atimer.h systime.h xterm.h termhooks.h | 1236 | blockinput.h atimer.h systime.h xterm.h termhooks.h |
| 1239 | print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \ | 1237 | print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \ |
| 1240 | $(config_h) dispextern.h termchar.h $(INTERVAL_SRC) msdos.h composite.h \ | 1238 | $(config_h) dispextern.h termchar.h $(INTERVAL_SRC) msdos.h composite.h \ |
| 1241 | blockinput.h atimer.h systime.h font.h | 1239 | blockinput.h atimer.h systime.h font.h charset.h |
| 1242 | lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \ | 1240 | lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \ |
| 1243 | charset.h $(config_h) $(INTERVAL_SRC) termhooks.h coding.h msdos.h | 1241 | charset.h $(config_h) $(INTERVAL_SRC) termhooks.h coding.h msdos.h |
| 1244 | 1242 | ||
| 1245 | /* Text properties support */ | 1243 | /* Text properties support */ |
| 1246 | textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVAL_SRC) \ | ||
| 1247 | $(config_h) | ||
| 1248 | intervals.o: intervals.c buffer.h $(INTERVAL_SRC) keyboard.h puresize.h \ | ||
| 1249 | keymap.h $(config_h) | ||
| 1250 | composite.o: composite.c buffer.h character.h dispextern.h font.h frame.h \ | 1244 | composite.o: composite.c buffer.h character.h dispextern.h font.h frame.h \ |
| 1251 | $(INTERVAL_SRC) window.h $(config_h) | 1245 | $(INTERVAL_SRC) window.h $(config_h) |
| 1246 | intervals.o: intervals.c buffer.h $(INTERVAL_SRC) keyboard.h puresize.h \ | ||
| 1247 | keymap.h $(config_h) | ||
| 1248 | textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVAL_SRC) \ | ||
| 1249 | $(config_h) | ||
| 1252 | 1250 | ||
| 1253 | /* System-specific programs to be made. | 1251 | /* System-specific programs to be made. |
| 1254 | OTHER_FILES and OBJECTS_MACHINE | 1252 | OTHER_FILES and OBJECTS_MACHINE |
diff --git a/src/acldef.h b/src/acldef.h deleted file mode 100644 index 640ee22cd13..00000000000 --- a/src/acldef.h +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * The code here is forced by the interface, and is not subject to | ||
| 3 | * copyright, constituting the only possible expression of the | ||
| 4 | * algorithm in this format. | ||
| 5 | */ | ||
| 6 | #define ACL$K_LENGTH 12 | ||
| 7 | #define ACL$C_LENGTH 12 | ||
| 8 | #define ACL$C_FILE 1 | ||
| 9 | #define ACL$C_DEVICE 2 | ||
| 10 | #define ACL$C_JOBCTL_QUEUE 3 | ||
| 11 | #define ACL$C_COMMON_EF_CLUSTER 4 | ||
| 12 | #define ACL$C_LOGICAL_NAME_TABLE 5 | ||
| 13 | #define ACL$C_PROCESS 6 | ||
| 14 | #define ACL$C_GROUP_GLOBAL_SECTION 7 | ||
| 15 | #define ACL$C_SYSTEM_GLOBAL_SECTION 8 | ||
| 16 | #define ACL$C_ADDACLENT 1 | ||
| 17 | #define ACL$C_DELACLENT 2 | ||
| 18 | #define ACL$C_MODACLENT 3 | ||
| 19 | #define ACL$C_FNDACLENT 4 | ||
| 20 | #define ACL$C_FNDACETYP 5 | ||
| 21 | #define ACL$C_DELETEACL 6 | ||
| 22 | #define ACL$C_READACL 7 | ||
| 23 | #define ACL$C_ACLLENGTH 8 | ||
| 24 | #define ACL$C_READACE 9 | ||
| 25 | #define ACL$C_RLOCK_ACL 10 | ||
| 26 | #define ACL$C_WLOCK_ACL 11 | ||
| 27 | #define ACL$C_UNLOCK_ACL 12 | ||
| 28 | #define ACL$S_ADDACLENT 255 | ||
| 29 | #define ACL$S_DELACLENT 255 | ||
| 30 | #define ACL$S_MODACLENT 255 | ||
| 31 | #define ACL$S_FNDACLENT 255 | ||
| 32 | #define ACL$S_FNDACETYP 255 | ||
| 33 | #define ACL$S_DELETEACL 255 | ||
| 34 | #define ACL$S_READACL 512 | ||
| 35 | #define ACL$S_ACLLENGTH 4 | ||
| 36 | #define ACL$S_READACE 255 | ||
| 37 | #define ACL$S_RLOCK_ACL 4 | ||
| 38 | #define ACL$S_WLOCK_ACL 4 | ||
| 39 | #define ACL$S_UNLOCK_ACL 4 | ||
| 40 | #define ACL$S_ACLDEF 16 | ||
| 41 | #define ACL$L_FLINK 0 | ||
| 42 | #define ACL$L_BLINK 4 | ||
| 43 | #define ACL$W_SIZE 8 | ||
| 44 | #define ACL$B_TYPE 10 | ||
| 45 | #define ACL$L_LIST 12 | ||
| 46 | |||
| 47 | /* arch-tag: 7c11e99d-34df-41e8-98e2-20f152c4ad73 | ||
| 48 | (do not change this comment) */ | ||
diff --git a/src/chpdef.h b/src/chpdef.h deleted file mode 100644 index 3696cbc4878..00000000000 --- a/src/chpdef.h +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * The code here is forced by the interface, and is not subject to | ||
| 3 | * copyright, constituting the only possible expression of the | ||
| 4 | * algorithm in this format. | ||
| 5 | */ | ||
| 6 | #define CHP$_END 0 | ||
| 7 | #define CHP$_ACCESS 1 | ||
| 8 | #define CHP$_FLAGS 2 | ||
| 9 | #define CHP$_PRIV 3 | ||
| 10 | #define CHP$_ACMODE 4 | ||
| 11 | #define CHP$_ACCLASS 5 | ||
| 12 | #define CHP$_RIGHTS 6 | ||
| 13 | #define CHP$_ADDRIGHTS 7 | ||
| 14 | #define CHP$_MODE 8 | ||
| 15 | #define CHP$_MODES 9 | ||
| 16 | #define CHP$_MINCLASS 10 | ||
| 17 | #define CHP$_MAXCLASS 11 | ||
| 18 | #define CHP$_OWNER 12 | ||
| 19 | #define CHP$_PROT 13 | ||
| 20 | #define CHP$_ACL 14 | ||
| 21 | #define CHP$_AUDITNAME 15 | ||
| 22 | #define CHP$_ALARMNAME 16 | ||
| 23 | #define CHP$_MATCHEDACE 17 | ||
| 24 | #define CHP$_PRIVUSED 18 | ||
| 25 | #define CHP$_MAX_CODE 19 | ||
| 26 | #define CHP$M_SYSPRV 1 | ||
| 27 | #define CHP$M_BYPASS 2 | ||
| 28 | #define CHP$M_UPGRADE 4 | ||
| 29 | #define CHP$M_DOWNGRADE 8 | ||
| 30 | #define CHP$M_GRPPRV 16 | ||
| 31 | #define CHP$M_READALL 32 | ||
| 32 | #define CHP$V_SYSPRV 0 | ||
| 33 | #define CHP$V_BYPASS 1 | ||
| 34 | #define CHP$V_UPGRADE 2 | ||
| 35 | #define CHP$V_DOWNGRADE 3 | ||
| 36 | #define CHP$V_GRPPRV 4 | ||
| 37 | #define CHP$V_READALL 5 | ||
| 38 | #define CHP$M_READ 1 | ||
| 39 | #define CHP$M_WRITE 2 | ||
| 40 | #define CHP$M_USEREADALL 4 | ||
| 41 | #define CHP$V_READ 0 | ||
| 42 | #define CHP$V_WRITE 1 | ||
| 43 | #define CHP$V_USEREADALL 2 | ||
| 44 | |||
| 45 | /* arch-tag: a7117984-e927-4f8e-932e-35d5fd524f12 | ||
| 46 | (do not change this comment) */ | ||
diff --git a/src/hftctl.c b/src/hftctl.c deleted file mode 100644 index 0609f840e20..00000000000 --- a/src/hftctl.c +++ /dev/null | |||
| @@ -1,342 +0,0 @@ | |||
| 1 | /* IBM has disclaimed copyright on this module. */ | ||
| 2 | |||
| 3 | /***************************************************************/ | ||
| 4 | /* */ | ||
| 5 | /* Function: hftctl */ | ||
| 6 | /* */ | ||
| 7 | /* Syntax: */ | ||
| 8 | /* #include <sys/ioctl.h> */ | ||
| 9 | /* #include <sys/hft.h> */ | ||
| 10 | /* */ | ||
| 11 | /* int hftctl(fildes, request, arg ) */ | ||
| 12 | /* int fildes, request; */ | ||
| 13 | /* char *arg; */ | ||
| 14 | /* */ | ||
| 15 | /* Description: */ | ||
| 16 | /* */ | ||
| 17 | /* Does the following: */ | ||
| 18 | /* 1. determines if fildes is pty */ | ||
| 19 | /* does normal ioctl it is not */ | ||
| 20 | /* 2. places fildes into raw mode */ | ||
| 21 | /* 3. converts ioctl arguments to datastream */ | ||
| 22 | /* 4. waits for 2 secs for acknowledgement before */ | ||
| 23 | /* timing out. */ | ||
| 24 | /* 5. places response in callers buffer ( just like */ | ||
| 25 | /* ioctl. */ | ||
| 26 | /* 6. returns fildes to its original mode */ | ||
| 27 | /* */ | ||
| 28 | /* User of this program should review steps 1,4, and 3. */ | ||
| 29 | /* hftctl makes no check on the request type. It must be */ | ||
| 30 | /* a HFT ioctl that is supported remotely. */ | ||
| 31 | /* This program will use the SIGALRM and alarm(2). Any */ | ||
| 32 | /* Previous alarms are lost. */ | ||
| 33 | /* */ | ||
| 34 | /* Users of this program are free to modify it any way */ | ||
| 35 | /* they want. */ | ||
| 36 | /* */ | ||
| 37 | /* Return Value: */ | ||
| 38 | /* */ | ||
| 39 | /* If ioctl fails, a value of -1 is returned and errno */ | ||
| 40 | /* is set to indicate the error. */ | ||
| 41 | /* */ | ||
| 42 | /***************************************************************/ | ||
| 43 | |||
| 44 | #include <config.h> | ||
| 45 | #include <sys/signal.h> | ||
| 46 | #include <errno.h> | ||
| 47 | #include <stdio.h> | ||
| 48 | #include <fcntl.h> | ||
| 49 | #include <setjmp.h> | ||
| 50 | #include <sys/ioctl.h> | ||
| 51 | #include <sys/devinfo.h> | ||
| 52 | #include <termios.h> | ||
| 53 | #include <termio.h> | ||
| 54 | #include <sys/hft.h> | ||
| 55 | #include <sys/uio.h> | ||
| 56 | #include <sys/tty.h> | ||
| 57 | /* #include <sys/pty.h> */ | ||
| 58 | |||
| 59 | #define REMOTE 0x01 | ||
| 60 | |||
| 61 | #undef ioctl | ||
| 62 | static char SCCSid[] = "com/gnuemacs/src,3.1,9021-90/05/03-5/3/90"; | ||
| 63 | |||
| 64 | /*************** LOCAL DEFINES **********************************/ | ||
| 65 | |||
| 66 | #define QDEV ((HFQPDEVCH<<8)|HFQPDEVCL) | ||
| 67 | #define QLOC ((HFQLOCCH<<8)|HFQLOCCL) | ||
| 68 | #define QPS ((HFQPRESCH<<8)|HFQPRESCL) | ||
| 69 | |||
| 70 | #ifndef TCGETS | ||
| 71 | #define TCGETS TCGETA | ||
| 72 | #endif | ||
| 73 | #ifndef TCSETS | ||
| 74 | #define TCSETS TCSETA | ||
| 75 | #endif | ||
| 76 | |||
| 77 | /*************** EXTERNAL / GLOBAL DATA AREA ********************/ | ||
| 78 | |||
| 79 | static int hfqry(); | ||
| 80 | static int hfskbd(); | ||
| 81 | char *xmalloc(); | ||
| 82 | |||
| 83 | extern int errno; | ||
| 84 | static jmp_buf hftenv; | ||
| 85 | static int is_ack_vtd; | ||
| 86 | static SIGTYPE (*sav_alrm) (); | ||
| 87 | static struct hfctlreq req = | ||
| 88 | { 0x1b,'[','x',0,0,0,21,HFCTLREQCH,HFCTLREQCL}; | ||
| 89 | static struct hfctlack ACK = | ||
| 90 | { 0x1b,'[','x',0,0,0,21,HFCTLACKCH,HFCTLACKCL}; | ||
| 91 | |||
| 92 | /* FUNC signal(); */ | ||
| 93 | |||
| 94 | /*************** LOCAL MACROS ***********************************/ | ||
| 95 | |||
| 96 | #define HFTYPE(p) ((p->hf_typehi<<8)|(p->hf_typelo)) | ||
| 97 | |||
| 98 | #define BYTE4(p) ((p)[0]<<24 | (p)[1]<<16 | (p)[2]<<8 | (p)[3]) | ||
| 99 | |||
| 100 | /* read a buffer */ | ||
| 101 | #define RD_BUF(f,p,l) \ | ||
| 102 | while ((l)) \ | ||
| 103 | if ((j = emacs_read (f, p, l)) < 0) \ | ||
| 104 | if (errno != EINTR) return (-1); \ | ||
| 105 | else continue; \ | ||
| 106 | else { (l) -= j; (p) += j; } | ||
| 107 | |||
| 108 | /*************** function prototypes ***************************/ | ||
| 109 | #ifdef PROTOTYPES | ||
| 110 | static GT_ACK (int fd, int req, char *buf); | ||
| 111 | static WR_REQ (int fd, int request, int cmdlen, char *cmd, int resplen); | ||
| 112 | static void hft_alrm(int sig); | ||
| 113 | #else | ||
| 114 | static GT_ACK (); | ||
| 115 | static WR_REQ (); | ||
| 116 | static void hft_alrm (); | ||
| 117 | #endif | ||
| 118 | |||
| 119 | /*************** HFTCTL FUNCTION *******************************/ | ||
| 120 | |||
| 121 | hftctl (fd, request, arg) | ||
| 122 | int fd; | ||
| 123 | int request; | ||
| 124 | union { | ||
| 125 | struct hfintro *intro; | ||
| 126 | struct hfquery *query; | ||
| 127 | char *c; | ||
| 128 | } arg; | ||
| 129 | { | ||
| 130 | |||
| 131 | int i; | ||
| 132 | int fd_flag; /* fcntl flags */ | ||
| 133 | register union { | ||
| 134 | struct hfintro *cmd; /* p.cmd - intro des. */ | ||
| 135 | struct hfqphdevc *ph; /* p.ph - physical dev.*/ | ||
| 136 | char *c; /* p.c - char ptr */ | ||
| 137 | } p; /* general pointer */ | ||
| 138 | int pty_new; /* pty modes */ | ||
| 139 | int pty_old; | ||
| 140 | int retcode; | ||
| 141 | struct termios term_new; /* terminal attributes */ | ||
| 142 | struct termios term_old; | ||
| 143 | struct devinfo devInfo; /* defined in sys/devinfo.h */ | ||
| 144 | |||
| 145 | |||
| 146 | if (ioctl (fd, IOCINFO, &devInfo) == -1) return(-1); | ||
| 147 | |||
| 148 | if (devInfo.devtype != DD_PSEU) /* is it a pty? */ | ||
| 149 | return (ioctl(fd, request, arg)); /* no, do IOCTL */ | ||
| 150 | |||
| 151 | /******* START PTY **************/ | ||
| 152 | /** Pty found, possible HFT */ | ||
| 153 | /** set new file des as raw */ | ||
| 154 | /** as you can. */ | ||
| 155 | /********************************/ | ||
| 156 | |||
| 157 | /* Get current state of file */ | ||
| 158 | /* descriptor & save */ | ||
| 159 | if ((fd_flag = fcntl (fd, F_GETFL, 0)) == -1) return (-1); | ||
| 160 | if (ioctl (fd, TCGETS, &term_old) == -1) return (-1); | ||
| 161 | /* set terminal attr to raw */ | ||
| 162 | /* and to delay on read */ | ||
| 163 | pty_new = pty_old | REMOTE; | ||
| 164 | memcpy (&term_new, &term_old, sizeof (term_new)); | ||
| 165 | term_new.c_iflag = 0; | ||
| 166 | term_new.c_oflag = 0; | ||
| 167 | term_new.c_lflag = 0; | ||
| 168 | /* term_new.c_line = 0; */ | ||
| 169 | for (i = 1; i <= 5; i++) | ||
| 170 | term_new.c_cc[i] = 0; | ||
| 171 | term_new.c_cc[0] = -1; | ||
| 172 | ioctl (fd, TCSETS, &term_new); | ||
| 173 | if (fcntl (fd, F_SETFL, fd_flag & ~O_NDELAY) == -1) | ||
| 174 | return(-1); | ||
| 175 | /* call spacific function */ | ||
| 176 | if (request == HFSKBD) | ||
| 177 | retcode = hfskbd (fd, request, arg.c); | ||
| 178 | else /* assume HFQUERY */ | ||
| 179 | retcode = hfqry (fd, request, arg.c); | ||
| 180 | |||
| 181 | fcntl (fd, F_SETFL, fd_flag); /* reset terminal to original */ | ||
| 182 | ioctl (fd, TCSETS, &term_old); | ||
| 183 | |||
| 184 | |||
| 185 | return (retcode); /* return error */ | ||
| 186 | } | ||
| 187 | |||
| 188 | /*************** HFSKBD FUNCTION ******************************/ | ||
| 189 | static int | ||
| 190 | hfskbd (fd, request, arg) | ||
| 191 | int fd; | ||
| 192 | int request; | ||
| 193 | struct hfbuf *arg; | ||
| 194 | { | ||
| 195 | WR_REQ(fd, request, arg->hf_buflen, arg->hf_bufp,0); | ||
| 196 | return (GT_ACK(fd, request, arg->hf_bufp)); | ||
| 197 | } | ||
| 198 | |||
| 199 | /*************** HFQUERY FUNCTION ******************************/ | ||
| 200 | static int | ||
| 201 | hfqry (fd, request, arg) | ||
| 202 | int fd; | ||
| 203 | int request; | ||
| 204 | struct hfquery *arg; | ||
| 205 | { | ||
| 206 | WR_REQ(fd, request, arg->hf_cmdlen, arg->hf_cmd, arg->hf_resplen); | ||
| 207 | return (GT_ACK(fd, request, arg->hf_resp)); | ||
| 208 | } | ||
| 209 | |||
| 210 | |||
| 211 | /*************** GT_ACK FUNCTION ******************************/ | ||
| 212 | static int | ||
| 213 | GT_ACK (fd, req, buf) | ||
| 214 | int fd; | ||
| 215 | int req; | ||
| 216 | char *buf; | ||
| 217 | { | ||
| 218 | struct hfctlack ack; | ||
| 219 | int i = sizeof (ack); | ||
| 220 | int j = 0; | ||
| 221 | union { | ||
| 222 | char *c; | ||
| 223 | struct hfctlack *ack; | ||
| 224 | } p; | ||
| 225 | |||
| 226 | is_ack_vtd = 0; /* flag no ACT VTD yet */ | ||
| 227 | |||
| 228 | if (setjmp (hftenv)) /* set environment in case */ | ||
| 229 | { /* of time out */ | ||
| 230 | errno = ENODEV; /* if time out, set errno */ | ||
| 231 | return (-1); /* flag error */ | ||
| 232 | } | ||
| 233 | |||
| 234 | alarm(3); /* time out in 3 secs */ | ||
| 235 | sav_alrm = signal (SIGALRM, hft_alrm); /* prepare to catch time out */ | ||
| 236 | |||
| 237 | p.ack = &ack; | ||
| 238 | while (! is_ack_vtd) /* do until valid ACK VTD */ | ||
| 239 | { | ||
| 240 | RD_BUF(fd, p.c, i); /* read until a ACK VTD is fill*/ | ||
| 241 | |||
| 242 | if (! memcmp (&ack, &ACK, sizeof (HFINTROSZ)) /* the ACK intro & */ | ||
| 243 | && (ack.hf_request == req)) /* is it the response we want ?*/ | ||
| 244 | { /* yes, ACK VTD found */ | ||
| 245 | is_ack_vtd = 1; /* quickly, flag it */ | ||
| 246 | break; /* get the %$%#@ out of here */ | ||
| 247 | } | ||
| 248 | |||
| 249 | p.ack = &ack; /* no, then skip 1st */ | ||
| 250 | ++p.c; /* char and start over */ | ||
| 251 | i = sizeof (ack) - 1; /* one less ESC to cry over */ | ||
| 252 | |||
| 253 | while ((*p.c != 0x1b) && i) /* scan for next ESC */ | ||
| 254 | { ++p.c; --i; } /* if any */ | ||
| 255 | |||
| 256 | (i ? memcpy (&ack, p.c, i) : 0); /* if any left over, then move */ | ||
| 257 | p.ack = &ack; /* ESC to front of ack struct */ | ||
| 258 | p.c += i; /* skip over whats been read */ | ||
| 259 | i = sizeof (ack) - i; /* set whats left to be read */ | ||
| 260 | } /***** TRY AGAIN */ | ||
| 261 | |||
| 262 | alarm(0); /* ACK VTD received, reset alrm*/ | ||
| 263 | signal (SIGALRM, sav_alrm); /* reset signal */ | ||
| 264 | |||
| 265 | if (i = ack.hf_arg_len) /* any data following ? */ | ||
| 266 | { /* yes, */ | ||
| 267 | RD_BUF(fd,buf,i); /* read until it is received */ | ||
| 268 | } | ||
| 269 | |||
| 270 | if (errno = ack.hf_retcode) /* set errno based on returned */ | ||
| 271 | return (-1); /* code, if 0, then no error */ | ||
| 272 | else | ||
| 273 | return (0); /* if set, then error returned */ | ||
| 274 | } | ||
| 275 | |||
| 276 | /*************** HFT_ALRM FUNCTION ******************************/ | ||
| 277 | static void | ||
| 278 | hft_alrm (sig) /* Function hft_alrm - handle */ | ||
| 279 | int sig; /* alarm signal */ | ||
| 280 | { | ||
| 281 | signal (SIGALRM, sav_alrm); /* reset to previous */ | ||
| 282 | |||
| 283 | if (is_ack_vtd) /* has ack vtd arrived ? */ | ||
| 284 | return; /* yes, then continue */ | ||
| 285 | else /* no, then return with error */ | ||
| 286 | longjmp (hftenv, -1); | ||
| 287 | |||
| 288 | } | ||
| 289 | |||
| 290 | /*********************************************************************/ | ||
| 291 | /*** ***/ | ||
| 292 | /*** NOTE: Both the HFCTLREQ and the arg structure should be ***/ | ||
| 293 | /*** sent in one io write operation. If terminal ***/ | ||
| 294 | /*** emulators are in NODELAY mode then multiple writes ***/ | ||
| 295 | /*** may cause bogus information to be read by the emulator ***/ | ||
| 296 | /*** depending on the timing. ***/ | ||
| 297 | /*** ***/ | ||
| 298 | /*********************************************************************/ | ||
| 299 | |||
| 300 | static int | ||
| 301 | WR_REQ (fd, request, cmdlen, cmd, resplen) | ||
| 302 | int fd; | ||
| 303 | int request; | ||
| 304 | int cmdlen; | ||
| 305 | char *cmd; | ||
| 306 | int resplen; | ||
| 307 | { | ||
| 308 | struct { | ||
| 309 | char *c; | ||
| 310 | struct hfctlreq *req; | ||
| 311 | } p; | ||
| 312 | int size; | ||
| 313 | |||
| 314 | req.hf_request = request; | ||
| 315 | req.hf_arg_len = cmdlen; | ||
| 316 | req.hf_rsp_len = resplen; | ||
| 317 | |||
| 318 | if (cmdlen) /* if arg structure to pass */ | ||
| 319 | { | ||
| 320 | size = sizeof (struct hfctlreq) + cmdlen; | ||
| 321 | if ((p.c = xmalloc(size)) == NULL) /* malloc one area */ | ||
| 322 | return (-1); | ||
| 323 | |||
| 324 | memcpy (p.c, &req, sizeof (req)); /* copy CTL REQ struct */ | ||
| 325 | memcpy (p.c + sizeof (req), cmd, cmdlen); /* copy arg struct */ | ||
| 326 | } | ||
| 327 | else | ||
| 328 | { | ||
| 329 | p.req = &req; /* otherwise use only CTL REQ */ | ||
| 330 | size = sizeof (req); | ||
| 331 | } | ||
| 332 | |||
| 333 | /* write request to terminal */ | ||
| 334 | if (emacs_write (fd, p.c, size) == -1) return (-1); | ||
| 335 | if (p.req != &req) /* free if allocated */ | ||
| 336 | xfree (p.c); | ||
| 337 | return (0); | ||
| 338 | |||
| 339 | } | ||
| 340 | |||
| 341 | /* arch-tag: cfd4f3bd-fd49-44e6-9f69-c8abdf367650 | ||
| 342 | (do not change this comment) */ | ||