mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 19:34:43 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe49c12662 |
No files matched your search
-34
@@ -1,34 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1995
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
char *getpwd __P((void));
|
||||
@@ -1,113 +0,0 @@
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char rcsid[] = "$Id: ns_udp.c,v 8.3 1996/08/27 08:33:23 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/nameser.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <netdb.h>
|
||||
#include <nlist.h>
|
||||
#include <resolv.h>
|
||||
|
||||
#include "named.h"
|
||||
|
||||
void
|
||||
ns_udp() {
|
||||
#if defined(CHECK_UDP_SUM) || defined(FIX_UDP_SUM)
|
||||
struct nlist nl[2];
|
||||
int fd;
|
||||
int sum;
|
||||
u_long res, offset;
|
||||
|
||||
nl[0].n_name = UDPSUM;
|
||||
nl[1].n_name = 0;
|
||||
|
||||
if (nlist(KSYMS, nl)) {
|
||||
dprintf(1, (ddt, "ns_udp: nlist (%s,%s) failed\n",
|
||||
KSYMS, UDPSUM));
|
||||
return;
|
||||
}
|
||||
|
||||
dprintf(1, (ddt, "ns_udp: %s %d %lu (%ld)\n",
|
||||
nl[0].n_name, nl[0].n_type, nl[0].n_value,
|
||||
nl[0].n_value));
|
||||
|
||||
if (!nl[0].n_type)
|
||||
return;
|
||||
|
||||
if ((fd = open(KMEM, O_RDWR, 0)) < 0) {
|
||||
dprintf(1, (ddt, "ns_udp: open %s failed\n", KMEM));
|
||||
return;
|
||||
}
|
||||
|
||||
offset = nl[0].n_value;
|
||||
#ifdef KMAP
|
||||
offset &= ((~0UL)>>1);
|
||||
#endif
|
||||
|
||||
res = lseek(fd, offset, SEEK_SET);
|
||||
if (res != offset) {
|
||||
dprintf(1, (ddt, "ns_udp: lseek %ul failed %lu %d\n",
|
||||
offset, res, errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (read(fd, &sum, sizeof(sum)) != sizeof(sum)) {
|
||||
dprintf(1, (ddt, "ns_udp: read failed\n"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
dprintf(1, (ddt, "ns_udp: %d\n", sum));
|
||||
if (sum == 0) {
|
||||
#ifdef FIX_UDP_SUM
|
||||
sum = 1;
|
||||
lseek(fd, offset, SEEK_SET);
|
||||
if (res != offset) {
|
||||
dprintf(1, (ddt, "ns_udp: lseek %ul failed %lu %d\n",
|
||||
offset, res, errno));
|
||||
goto cleanup;
|
||||
}
|
||||
if (write(fd, &sum, sizeof(sum)) != sizeof(sum)) {
|
||||
dprintf(1, (ddt, "ns_udp: write failed\n"));
|
||||
goto cleanup;
|
||||
}
|
||||
dprintf(1, (ddt, "ns_udp: set to 1\n"));
|
||||
syslog(LOG_WARNING, "ns_udp: check sums turned on");
|
||||
#else
|
||||
dprintf(1, (ddt, "ns_udp: Exiting\n"));
|
||||
syslog(LOG_WARNING, "ns_udp: checksums NOT turned on: Exiting");
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
cleanup:
|
||||
close(fd);
|
||||
#endif
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Portions Copyright (c) 1995 by International Business Machines, Inc.
|
||||
*
|
||||
* International Business Machines, Inc. (hereinafter called IBM) grants
|
||||
* permission under its copyrights to use, copy, modify, and distribute this
|
||||
* Software with or without fee, provided that the above copyright notice and
|
||||
* all paragraphs of this notice appear in all copies, and that the name of IBM
|
||||
* not be used in connection with the marketing of any product incorporating
|
||||
* the Software or modifications thereof, without specific, written prior
|
||||
* permission.
|
||||
*
|
||||
* To the extent it has a right to do so, IBM grants an immunity from suit
|
||||
* under its patents, if any, for the use, sale or manufacture of products to
|
||||
* the extent that such products are used for performing Domain Name System
|
||||
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
|
||||
* granted for any product per se or for any other function of any product.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
|
||||
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
|
||||
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <arpa/nameser.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <resolv.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(BSD) && (BSD >= 199103) && defined(AF_INET6)
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
#else
|
||||
# include "../conf/portability.h"
|
||||
#endif
|
||||
|
||||
#define Assert(Cond) if (!(Cond)) abort()
|
||||
|
||||
static const char Base64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
static const char Pad64 = '=';
|
||||
|
||||
/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
|
||||
The following encoding technique is taken from RFC 1521 by Borenstein
|
||||
and Freed. It is reproduced here in a slightly edited form for
|
||||
convenience.
|
||||
|
||||
A 65-character subset of US-ASCII is used, enabling 6 bits to be
|
||||
represented per printable character. (The extra 65th character, "=",
|
||||
is used to signify a special processing function.)
|
||||
|
||||
The encoding process represents 24-bit groups of input bits as output
|
||||
strings of 4 encoded characters. Proceeding from left to right, a
|
||||
24-bit input group is formed by concatenating 3 8-bit input groups.
|
||||
These 24 bits are then treated as 4 concatenated 6-bit groups, each
|
||||
of which is translated into a single digit in the base64 alphabet.
|
||||
|
||||
Each 6-bit group is used as an index into an array of 64 printable
|
||||
characters. The character referenced by the index is placed in the
|
||||
output string.
|
||||
|
||||
Table 1: The Base64 Alphabet
|
||||
|
||||
Value Encoding Value Encoding Value Encoding Value Encoding
|
||||
0 A 17 R 34 i 51 z
|
||||
1 B 18 S 35 j 52 0
|
||||
2 C 19 T 36 k 53 1
|
||||
3 D 20 U 37 l 54 2
|
||||
4 E 21 V 38 m 55 3
|
||||
5 F 22 W 39 n 56 4
|
||||
6 G 23 X 40 o 57 5
|
||||
7 H 24 Y 41 p 58 6
|
||||
8 I 25 Z 42 q 59 7
|
||||
9 J 26 a 43 r 60 8
|
||||
10 K 27 b 44 s 61 9
|
||||
11 L 28 c 45 t 62 +
|
||||
12 M 29 d 46 u 63 /
|
||||
13 N 30 e 47 v
|
||||
14 O 31 f 48 w (pad) =
|
||||
15 P 32 g 49 x
|
||||
16 Q 33 h 50 y
|
||||
|
||||
Special processing is performed if fewer than 24 bits are available
|
||||
at the end of the data being encoded. A full encoding quantum is
|
||||
always completed at the end of a quantity. When fewer than 24 input
|
||||
bits are available in an input group, zero bits are added (on the
|
||||
right) to form an integral number of 6-bit groups. Padding at the
|
||||
end of the data is performed using the '=' character.
|
||||
|
||||
Since all base64 input is an integral number of octets, only the
|
||||
-------------------------------------------------
|
||||
following cases can arise:
|
||||
|
||||
(1) the final quantum of encoding input is an integral
|
||||
multiple of 24 bits; here, the final unit of encoded
|
||||
output will be an integral multiple of 4 characters
|
||||
with no "=" padding,
|
||||
(2) the final quantum of encoding input is exactly 8 bits;
|
||||
here, the final unit of encoded output will be two
|
||||
characters followed by two "=" padding characters, or
|
||||
(3) the final quantum of encoding input is exactly 16 bits;
|
||||
here, the final unit of encoded output will be three
|
||||
characters followed by one "=" padding character.
|
||||
*/
|
||||
|
||||
int
|
||||
b64_ntop(src, srclength, target, targsize)
|
||||
u_char const *src;
|
||||
size_t srclength;
|
||||
char *target;
|
||||
size_t targsize;
|
||||
{
|
||||
size_t datalength = 0;
|
||||
u_char input[3];
|
||||
u_char output[4];
|
||||
int i;
|
||||
|
||||
while (2 < srclength) {
|
||||
input[0] = *src++;
|
||||
input[1] = *src++;
|
||||
input[2] = *src++;
|
||||
srclength -= 3;
|
||||
|
||||
output[0] = input[0] >> 2;
|
||||
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||
output[3] = input[2] & 0x3f;
|
||||
Assert(output[0] < 64);
|
||||
Assert(output[1] < 64);
|
||||
Assert(output[2] < 64);
|
||||
Assert(output[3] < 64);
|
||||
|
||||
if (datalength + 4 > targsize)
|
||||
return (-1);
|
||||
target[datalength++] = Base64[output[0]];
|
||||
target[datalength++] = Base64[output[1]];
|
||||
target[datalength++] = Base64[output[2]];
|
||||
target[datalength++] = Base64[output[3]];
|
||||
}
|
||||
|
||||
/* Now we worry about padding. */
|
||||
if (0 != srclength) {
|
||||
/* Get what's left. */
|
||||
input[0] = input[1] = input[2] = '\0';
|
||||
for (i = 0; i < srclength; i++)
|
||||
input[i] = *src++;
|
||||
|
||||
output[0] = input[0] >> 2;
|
||||
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
|
||||
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
|
||||
Assert(output[0] < 64);
|
||||
Assert(output[1] < 64);
|
||||
Assert(output[2] < 64);
|
||||
|
||||
if (datalength + 4 > targsize)
|
||||
return (-1);
|
||||
target[datalength++] = Base64[output[0]];
|
||||
target[datalength++] = Base64[output[1]];
|
||||
if (srclength == 1)
|
||||
target[datalength++] = Pad64;
|
||||
else
|
||||
target[datalength++] = Base64[output[2]];
|
||||
target[datalength++] = Pad64;
|
||||
}
|
||||
if (datalength >= targsize)
|
||||
return (-1);
|
||||
target[datalength] = '\0'; /* Returned value doesn't count \0. */
|
||||
return (datalength);
|
||||
}
|
||||
|
||||
/* skips all whitespace anywhere.
|
||||
converts characters, four at a time, starting at (or after)
|
||||
src from base - 64 numbers into three 8 bit bytes in the target area.
|
||||
it returns the number of data bytes stored at the target, or -1 on error.
|
||||
*/
|
||||
|
||||
int
|
||||
b64_pton(src, target, targsize)
|
||||
char const *src;
|
||||
u_char *target;
|
||||
size_t targsize;
|
||||
{
|
||||
int tarindex, state, ch;
|
||||
char *pos;
|
||||
|
||||
state = 0;
|
||||
tarindex = 0;
|
||||
|
||||
while ((ch = *src++) != '\0') {
|
||||
if (isspace(ch)) /* Skip whitespace anywhere. */
|
||||
continue;
|
||||
|
||||
if (ch == Pad64)
|
||||
break;
|
||||
|
||||
pos = strchr(Base64, ch);
|
||||
if (pos == 0) /* A non-base64 character. */
|
||||
return (-1);
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
if (target) {
|
||||
if (tarindex >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] = (pos - Base64) << 2;
|
||||
}
|
||||
state = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (target) {
|
||||
if (tarindex + 1 >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64) >> 4;
|
||||
target[tarindex+1] = ((pos - Base64) & 0x0f)
|
||||
<< 4 ;
|
||||
}
|
||||
tarindex++;
|
||||
state = 2;
|
||||
break;
|
||||
case 2:
|
||||
if (target) {
|
||||
if (tarindex + 1 >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64) >> 2;
|
||||
target[tarindex+1] = ((pos - Base64) & 0x03)
|
||||
<< 6;
|
||||
}
|
||||
tarindex++;
|
||||
state = 3;
|
||||
break;
|
||||
case 3:
|
||||
if (target) {
|
||||
if (tarindex >= targsize)
|
||||
return (-1);
|
||||
target[tarindex] |= (pos - Base64);
|
||||
}
|
||||
tarindex++;
|
||||
state = 0;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We are done decoding Base-64 chars. Let's see if we ended
|
||||
* on a byte boundary, and/or with erroneous trailing characters.
|
||||
*/
|
||||
|
||||
if (ch == Pad64) { /* We got a pad char. */
|
||||
ch = *src++; /* Skip it, get next. */
|
||||
switch (state) {
|
||||
case 0: /* Invalid = in first position */
|
||||
case 1: /* Invalid = in second position */
|
||||
return (-1);
|
||||
|
||||
case 2: /* Valid, means one byte of info */
|
||||
/* Skip any number of spaces. */
|
||||
for (NULL; ch != '\0'; ch = *src++)
|
||||
if (!isspace(ch))
|
||||
break;
|
||||
/* Make sure there is another trailing = sign. */
|
||||
if (ch != Pad64)
|
||||
return (-1);
|
||||
ch = *src++; /* Skip the = */
|
||||
/* Fall through to "single trailing =" case. */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 3: /* Valid, means two bytes of info */
|
||||
/*
|
||||
* We know this char is an =. Is there anything but
|
||||
* whitespace after it?
|
||||
*/
|
||||
for (NULL; ch != '\0'; ch = *src++)
|
||||
if (!isspace(ch))
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Now make sure for cases 2 and 3 that the "extra"
|
||||
* bits that slopped past the last full byte were
|
||||
* zeros. If we don't check them, they become a
|
||||
* subliminal channel.
|
||||
*/
|
||||
if (target && target[tarindex] != 0)
|
||||
return (-1);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* We ended by seeing the end of the string. Make sure we
|
||||
* have no partial bytes lying around.
|
||||
*/
|
||||
if (state != 0)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return (tarindex);
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: inet_net_ntop.c,v 8.2 1996/08/08 06:54:44 vixie Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef SPRINTF_CHAR
|
||||
# define SPRINTF(x) strlen(sprintf/**/x)
|
||||
#else
|
||||
# define SPRINTF(x) ((size_t)sprintf x)
|
||||
#endif
|
||||
|
||||
static char * inet_net_ntop_ipv4 __P((const u_char *src, int bits,
|
||||
char *dst, size_t size));
|
||||
|
||||
/*
|
||||
* char *
|
||||
* inet_net_ntop(af, src, bits, dst, size)
|
||||
* convert network number from network to presentation format.
|
||||
* generates CIDR style result always.
|
||||
* return:
|
||||
* pointer to dst, or NULL if an error occurred (check errno).
|
||||
* author:
|
||||
* Paul Vixie (ISC), July 1996
|
||||
*/
|
||||
char *
|
||||
inet_net_ntop(af, src, bits, dst, size)
|
||||
int af;
|
||||
const void *src;
|
||||
int bits;
|
||||
char *dst;
|
||||
size_t size;
|
||||
{
|
||||
switch (af) {
|
||||
case AF_INET:
|
||||
return (inet_net_ntop_ipv4(src, bits, dst, size));
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* static char *
|
||||
* inet_net_ntop_ipv4(src, bits, dst, size)
|
||||
* convert IPv4 network number from network to presentation format.
|
||||
* generates CIDR style result always.
|
||||
* return:
|
||||
* pointer to dst, or NULL if an error occurred (check errno).
|
||||
* note:
|
||||
* network byte order assumed. this means 192.5.5.240/28 has
|
||||
* 0x11110000 in its fourth octet.
|
||||
* author:
|
||||
* Paul Vixie (ISC), July 1996
|
||||
*/
|
||||
static char *
|
||||
inet_net_ntop_ipv4(src, bits, dst, size)
|
||||
const u_char *src;
|
||||
int bits;
|
||||
char *dst;
|
||||
size_t size;
|
||||
{
|
||||
char *odst = dst;
|
||||
char *t;
|
||||
u_int m;
|
||||
int b;
|
||||
|
||||
if (bits < 0 || bits > 32) {
|
||||
errno = EINVAL;
|
||||
return (NULL);
|
||||
}
|
||||
if (bits == 0) {
|
||||
if (size < sizeof "0")
|
||||
goto emsgsize;
|
||||
*dst++ = '0';
|
||||
*dst = '\0';
|
||||
}
|
||||
|
||||
/* Format whole octets. */
|
||||
for (b = bits / 8; b > 0; b--) {
|
||||
if (size < sizeof "255.")
|
||||
goto emsgsize;
|
||||
t = dst;
|
||||
dst += SPRINTF((dst, "%u", *src++));
|
||||
if (b > 1) {
|
||||
*dst++ = '.';
|
||||
*dst = '\0';
|
||||
}
|
||||
size -= (size_t)(dst - t);
|
||||
}
|
||||
|
||||
/* Format partial octet. */
|
||||
b = bits % 8;
|
||||
if (b > 0) {
|
||||
if (size < sizeof ".255")
|
||||
goto emsgsize;
|
||||
t = dst;
|
||||
if (dst != odst)
|
||||
*dst++ = '.';
|
||||
m = ((1 << b) - 1) << (8 - b);
|
||||
dst += SPRINTF((dst, "%u", *src & m));
|
||||
size -= (size_t)(dst - t);
|
||||
}
|
||||
|
||||
/* Format CIDR /width. */
|
||||
if (size < sizeof "/32")
|
||||
goto emsgsize;
|
||||
dst += SPRINTF((dst, "/%u", bits));
|
||||
return (odst);
|
||||
|
||||
emsgsize:
|
||||
errno = EMSGSIZE;
|
||||
return (NULL);
|
||||
}
|
||||
@@ -1,207 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: inet_net_pton.c,v 8.3 1996/11/11 06:36:52 vixie Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef SPRINTF_CHAR
|
||||
# define SPRINTF(x) strlen(sprintf/**/x)
|
||||
#else
|
||||
# define SPRINTF(x) ((size_t)sprintf x)
|
||||
#endif
|
||||
|
||||
static int inet_net_pton_ipv4 __P((const char *src, u_char *dst,
|
||||
size_t size));
|
||||
|
||||
/*
|
||||
* static int
|
||||
* inet_net_pton(af, src, dst, size)
|
||||
* convert network number from presentation to network format.
|
||||
* accepts hex octets, hex strings, decimal octets, and /CIDR.
|
||||
* "size" is in bytes and describes "dst".
|
||||
* return:
|
||||
* number of bits, either imputed classfully or specified with /CIDR,
|
||||
* or -1 if some failure occurred (check errno). ENOENT means it was
|
||||
* not a valid network specification.
|
||||
* author:
|
||||
* Paul Vixie (ISC), June 1996
|
||||
*/
|
||||
int
|
||||
inet_net_pton(af, src, dst, size)
|
||||
int af;
|
||||
const char *src;
|
||||
void *dst;
|
||||
size_t size;
|
||||
{
|
||||
switch (af) {
|
||||
case AF_INET:
|
||||
return (inet_net_pton_ipv4(src, dst, size));
|
||||
default:
|
||||
errno = EAFNOSUPPORT;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* static int
|
||||
* inet_net_pton_ipv4(src, dst, size)
|
||||
* convert IPv4 network number from presentation to network format.
|
||||
* accepts hex octets, hex strings, decimal octets, and /CIDR.
|
||||
* "size" is in bytes and describes "dst".
|
||||
* return:
|
||||
* number of bits, either imputed classfully or specified with /CIDR,
|
||||
* or -1 if some failure occurred (check errno). ENOENT means it was
|
||||
* not an IPv4 network specification.
|
||||
* note:
|
||||
* network byte order assumed. this means 192.5.5.240/28 has
|
||||
* 0x11110000 in its fourth octet.
|
||||
* author:
|
||||
* Paul Vixie (ISC), June 1996
|
||||
*/
|
||||
static int
|
||||
inet_net_pton_ipv4(src, dst, size)
|
||||
const char *src;
|
||||
u_char *dst;
|
||||
size_t size;
|
||||
{
|
||||
static const char
|
||||
xdigits[] = "0123456789abcdef",
|
||||
digits[] = "0123456789";
|
||||
int n, ch, tmp, dirty, bits;
|
||||
const u_char *odst = dst;
|
||||
|
||||
ch = *src++;
|
||||
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
|
||||
&& isascii(src[1]) && isxdigit(src[1])) {
|
||||
/* Hexadecimal: Eat nybble string. */
|
||||
if (size <= 0)
|
||||
goto emsgsize;
|
||||
*dst = 0, dirty = 0;
|
||||
src++; /* skip x or X. */
|
||||
while ((ch = *src++) != '\0' &&
|
||||
isascii(ch) && isxdigit(ch)) {
|
||||
if (isupper(ch))
|
||||
ch = tolower(ch);
|
||||
n = strchr(xdigits, ch) - xdigits;
|
||||
assert(n >= 0 && n <= 15);
|
||||
*dst |= n;
|
||||
if (!dirty++)
|
||||
*dst <<= 4;
|
||||
else if (size-- > 0)
|
||||
*++dst = 0, dirty = 0;
|
||||
else
|
||||
goto emsgsize;
|
||||
}
|
||||
if (dirty)
|
||||
size--;
|
||||
} else if (isascii(ch) && isdigit(ch)) {
|
||||
/* Decimal: eat dotted digit string. */
|
||||
for (;;) {
|
||||
tmp = 0;
|
||||
do {
|
||||
n = strchr(digits, ch) - digits;
|
||||
assert(n >= 0 && n <= 9);
|
||||
tmp *= 10;
|
||||
tmp += n;
|
||||
if (tmp > 255)
|
||||
goto enoent;
|
||||
} while ((ch = *src++) != '\0' &&
|
||||
isascii(ch) && isdigit(ch));
|
||||
if (size-- <= 0)
|
||||
goto emsgsize;
|
||||
*dst++ = (u_char) tmp;
|
||||
if (ch == '\0' || ch == '/')
|
||||
break;
|
||||
if (ch != '.')
|
||||
goto enoent;
|
||||
ch = *src++;
|
||||
if (!isascii(ch) || !isdigit(ch))
|
||||
goto enoent;
|
||||
}
|
||||
} else
|
||||
goto enoent;
|
||||
|
||||
bits = -1;
|
||||
if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) {
|
||||
/* CIDR width specifier. Nothing can follow it. */
|
||||
ch = *src++; /* Skip over the /. */
|
||||
bits = 0;
|
||||
do {
|
||||
n = strchr(digits, ch) - digits;
|
||||
assert(n >= 0 && n <= 9);
|
||||
bits *= 10;
|
||||
bits += n;
|
||||
} while ((ch = *src++) != '\0' &&
|
||||
isascii(ch) && isdigit(ch));
|
||||
if (ch != '\0')
|
||||
goto enoent;
|
||||
if (bits > 32)
|
||||
goto emsgsize;
|
||||
}
|
||||
|
||||
/* Firey death and destruction unless we prefetched EOS. */
|
||||
if (ch != '\0')
|
||||
goto enoent;
|
||||
|
||||
/* If nothing was written to the destination, we found no address. */
|
||||
if (dst == odst)
|
||||
goto enoent;
|
||||
/* If no CIDR spec was given, infer width from net class. */
|
||||
if (bits == -1) {
|
||||
if (*odst >= 240) /* Class E */
|
||||
bits = 32;
|
||||
else if (*odst >= 224) /* Class D */
|
||||
bits = 4;
|
||||
else if (*odst >= 192) /* Class C */
|
||||
bits = 24;
|
||||
else if (*odst >= 128) /* Class B */
|
||||
bits = 16;
|
||||
else /* Class A */
|
||||
bits = 8;
|
||||
/* If imputed mask is narrower than specified octets, widen. */
|
||||
if (bits >= 8 && bits < ((dst - odst) * 8))
|
||||
bits = (dst - odst) * 8;
|
||||
}
|
||||
/* Extend network to cover the actual mask. */
|
||||
while (bits > ((dst - odst) * 8)) {
|
||||
if (size-- <= 0)
|
||||
goto emsgsize;
|
||||
*dst++ = '\0';
|
||||
}
|
||||
return (bits);
|
||||
|
||||
enoent:
|
||||
errno = ENOENT;
|
||||
return (-1);
|
||||
|
||||
emsgsize:
|
||||
errno = EMSGSIZE;
|
||||
return (-1);
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static const char rcsid[] = "$Id: inet_neta.c,v 8.2 1996/08/08 06:54:44 vixie Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef SPRINTF_CHAR
|
||||
# define SPRINTF(x) strlen(sprintf/**/x)
|
||||
#else
|
||||
# define SPRINTF(x) ((size_t)sprintf x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* char *
|
||||
* inet_neta(src, dst, size)
|
||||
* format a u_long network number into presentation format.
|
||||
* return:
|
||||
* pointer to dst, or NULL if an error occurred (check errno).
|
||||
* note:
|
||||
* format of ``src'' is as for inet_network().
|
||||
* author:
|
||||
* Paul Vixie (ISC), July 1996
|
||||
*/
|
||||
char *
|
||||
inet_neta(src, dst, size)
|
||||
u_long src;
|
||||
char *dst;
|
||||
size_t size;
|
||||
{
|
||||
char *odst = dst;
|
||||
char *tp;
|
||||
|
||||
while (src & 0xffffffff) {
|
||||
u_char b = (src & 0xff000000) >> 24;
|
||||
|
||||
src <<= 8;
|
||||
if (b) {
|
||||
if (size < sizeof "255.")
|
||||
goto emsgsize;
|
||||
tp = dst;
|
||||
dst += SPRINTF((dst, "%u", b));
|
||||
if (src != 0L) {
|
||||
*dst++ = '.';
|
||||
*dst = '\0';
|
||||
}
|
||||
size -= (size_t)(dst - tp);
|
||||
}
|
||||
}
|
||||
if (dst == odst) {
|
||||
if (size < sizeof "0.0.0.0")
|
||||
goto emsgsize;
|
||||
strcpy(dst, "0.0.0.0");
|
||||
}
|
||||
return (odst);
|
||||
|
||||
emsgsize:
|
||||
errno = EMSGSIZE;
|
||||
return (NULL);
|
||||
}
|
||||
@@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
@@ -1,403 +0,0 @@
|
||||
Tue Mar 23 14:36:51 1993 Brian Fox ([email protected])
|
||||
|
||||
* readline.c (rl_copy): Changed name to rl_copy_text.
|
||||
|
||||
Mon Mar 22 19:16:05 1993 Brian Fox ([email protected])
|
||||
|
||||
* dispose_cmd.c, several other files. Declare dispose_xxx () as
|
||||
"void".
|
||||
|
||||
* builtins/hashcom.h: Make declarations of hashed_filenames be
|
||||
"extern" to keep the SGI compiler happy.
|
||||
|
||||
* readline.c (rl_initialize_everything): Assign values to
|
||||
out_stream and in_stream immediately, since
|
||||
output_character_function () can be called before
|
||||
readline_internal () is called.
|
||||
|
||||
Tue Dec 8 09:30:56 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (rl_init_terminal) Set PC from BC, not from *buffer.
|
||||
|
||||
Mon Nov 30 09:35:47 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (invoking_keyseqs_in_map, rl_parse_and_bind) Allow
|
||||
backslash to quote characters, such as backslash, double quote,
|
||||
and space. Backslash quotes all character indiscriminately.
|
||||
|
||||
* funmap.c (vi_keymap) Fix type in "vi-replace" declaration.
|
||||
|
||||
Fri Nov 20 10:55:05 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (init_terminal_io, rl_prep_terminal): FINALLY!
|
||||
Declare and use termcap variable `ospeed' when setting up terminal
|
||||
parameters.
|
||||
|
||||
Thu Oct 8 08:53:07 1992 Brian J. Fox (bfox@helios)
|
||||
|
||||
* Makefile, this directory: Include (as links to the canonical
|
||||
sources), tilde.c, tilde.h, posixstat.h and xmalloc.c.
|
||||
|
||||
Tue Sep 29 13:07:21 1992 Brian J. Fox (bfox@helios)
|
||||
|
||||
* readline.c (init_terminal_io) Don't set arrow keys if the key
|
||||
sequences that represent them are already set.
|
||||
|
||||
* readline.c (rl_function_of_keyseq) New function returns the first
|
||||
function (or macro) found while searching a key sequence.
|
||||
|
||||
Mon Sep 28 00:34:04 1992 Brian J. Fox (bfox@helios)
|
||||
|
||||
* readline.c (LibraryVersion) New static char * contains current
|
||||
version number. Version is at 2.0.
|
||||
|
||||
* readline.c (rl_complete_internal): Incorporated clean changes
|
||||
from gilmore ([email protected]) to support quoted substrings within
|
||||
completion functions.
|
||||
|
||||
* readline.c (many locations) Added support for the _GO32_,
|
||||
whatever that is. Patches supplied by Cygnus, typed in by hand,
|
||||
with cleanups.
|
||||
|
||||
Sun Aug 16 12:46:24 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (init_terminal_io): Find out the values of the keypad
|
||||
arrows and bind them to appropriate RL functions if present.
|
||||
|
||||
Mon Aug 10 18:13:24 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* history.c (stifle_history): A negative argument to stifle
|
||||
becomes zero.
|
||||
|
||||
Tue Jul 28 09:28:41 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (rl_variable_bind): New local structure describes
|
||||
booleans by name and address; code in rl_variable_bind () looks at
|
||||
structure to set simple variables.
|
||||
|
||||
* parens.c (rl_insert_close): New variable rl_blink_matching_paren
|
||||
is non-zero if we want to blink the matching open when a close is
|
||||
inserted. If FD_SET is defined, rl_blink_matching_paren defaults
|
||||
to 1, else 0. If FD_SET is not defined, and
|
||||
rl_blink_matching_paren is non-zero, the close character(s) are/is
|
||||
simply inserted.
|
||||
|
||||
Wed Jul 22 20:03:59 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* history.c, readline.c, vi_mode.c: Cause the functions strchr ()
|
||||
and strrchr () to be used instead of index () and rindex ()
|
||||
throughout the source.
|
||||
|
||||
Mon Jul 13 11:34:07 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c: (rl_variable_bind) New variable "meta-flag" if "on"
|
||||
means force the use of the 8th bit as Meta bit. Internal variable
|
||||
is called meta_flag.
|
||||
|
||||
Thu Jul 9 10:37:56 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* history.c (get_history_event) Change INDEX to LOCAL_INDEX. If
|
||||
compiling for the shell, allow shell metacharacters to separate
|
||||
history tokens as they would for shell tokens.
|
||||
|
||||
Sat Jul 4 19:29:12 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* vi_keymap.c: According to Posix, TAB self-inserts instead of
|
||||
doing completion.
|
||||
|
||||
* vi_mode.c: (rl_vi_yank_arg) Enter VI insert mode after yanking
|
||||
an arg from the previous line.
|
||||
|
||||
* search.c: New file takes over vi style searching and implements
|
||||
non-incremental searching the history.
|
||||
|
||||
Makefile: Add search.c and search.o.
|
||||
|
||||
funmap.c: Add names for non-incremental-forward-search-history and
|
||||
non-incremental-reverse-search-history.
|
||||
|
||||
readline.h: Add extern definitions for non-incremental searching.
|
||||
|
||||
vi_mode.c: Remove old search code; add calls to code in search.c.
|
||||
|
||||
Fri Jul 3 10:36:33 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c (rl_delete_horizontal_space); New function deletes
|
||||
all whitespace surrounding point.
|
||||
|
||||
funmap.c: Add "delete-horizontal-space".
|
||||
emacs_keymap.c: Put rl_delete_horizontal_space () on M-\.
|
||||
|
||||
* readline.c (rl_set_signals, rl_clear_signals); New function
|
||||
rl_set_sighandler () is either defined in a Posix way (if
|
||||
HAVE_POSIX_SIGNALS is defined) or in a BSD way. Function is
|
||||
called from rl_set_signals () and rl_clear_signals ().
|
||||
|
||||
Fri May 8 12:50:15 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c: (readline_default_bindings) Do comparisons with
|
||||
_POSIX_VDISABLE casted to `unsigned char'. Change tty characters
|
||||
to be unsigned char.
|
||||
|
||||
Thu Apr 30 12:36:35 1992 Brian Fox (bfox@cubit)
|
||||
|
||||
* readline.c: (rl_getc) Handle "read would block" error on
|
||||
non-blocking IO streams.
|
||||
|
||||
* readline.c: (rl_signal_handler): Unblock only the signal that we
|
||||
have caught, not all signals.
|
||||
|
||||
Sun Feb 23 03:33:09 1992 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: Many functions. Use only the macros META_CHAR and
|
||||
UNMETA to deal with meta characters. Prior to this, we used
|
||||
numeric values and tests.
|
||||
|
||||
* readline.c (rl_complete_internal) Report exactly the number of
|
||||
possible completions, not the number + 1.
|
||||
|
||||
* vi_mode.c (rl_do_move) Do not change the cursor position when
|
||||
using `cw' or `cW'.
|
||||
|
||||
* vi_mode.c (rl_vi_complete) Enter insert mode after completing
|
||||
with `*' or `\'.
|
||||
|
||||
Fri Feb 21 05:58:18 1992 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (rl_dispatch) Increment rl_key_sequence_length for
|
||||
meta characters that map onto ESC map.
|
||||
|
||||
Mon Feb 10 01:41:35 1992 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* history.c (history_do_write) Build a buffer of all of the lines
|
||||
to write and write them in one fell swoop (lower overhead than
|
||||
calling write () for each line). Suggested by Peter Ho.
|
||||
|
||||
* readline.c: Include hbullx20 as well as hpux for determining
|
||||
USGr3ness.
|
||||
|
||||
* readline.c (rl_unix_word_rubout) As per the "Now REMEMBER"
|
||||
comment, pass arguments to rl_kill_text () in the correct order to
|
||||
preserve prepending and appending of killed text.
|
||||
|
||||
* readline.c (rl_search_history) malloc (), realloc (), and free
|
||||
() SEARCH_STRING so that there are no static limits on searching.
|
||||
|
||||
* vi_mode.c (rl_vi_subst) Don't forget to end the undo group.
|
||||
|
||||
Fri Jan 31 14:51:02 1992 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (rl_signal_handler): Zero the current history entry's
|
||||
pointer after freeing the undo_list when SIGINT received.
|
||||
Reformat a couple of functions.
|
||||
|
||||
Sat Jan 25 13:47:35 1992 Brian Fox (bfox at bears)
|
||||
|
||||
* readline.c (parser_if): free () TNAME after use.
|
||||
|
||||
Tue Jan 21 01:01:35 1992 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (rl_redisplay) and (rl_character_len): Display
|
||||
Control characters as "^c" and Meta characters as "\234", instead
|
||||
of "C-C" and "M-C".
|
||||
|
||||
Sun Dec 29 10:59:00 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (init_terminal_io) Default to environment variables
|
||||
LINES and COLUMNS before termcap entry values. If all else fails,
|
||||
then assume 80x24 terminal.
|
||||
|
||||
Sat Dec 28 16:33:11 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: If this machine is USG and it is hpux, then define
|
||||
USGr3.
|
||||
|
||||
* history.c: Cosmetic fixes.
|
||||
|
||||
Thu Nov 21 00:10:12 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* vi_mode.c: (rl_do_move) Place cursor at end of line, never at
|
||||
next to last character.
|
||||
|
||||
Thu Nov 14 05:08:01 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* history.c (get_history_event) Non-anchored searches can have a
|
||||
return index of greater than zero from get_history_event ().
|
||||
|
||||
Fri Nov 1 07:02:13 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (rl_translate_keyseq) Make C-? translate to RUBOUT
|
||||
unconditionally.
|
||||
|
||||
Mon Oct 28 11:34:52 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c; Use Posix directory routines and macros.
|
||||
|
||||
* funmap.c; Add entry for call-last-kbd-macro.
|
||||
|
||||
* readline.c (rl_prep_term); Use system EOF character on POSIX
|
||||
systems also.
|
||||
|
||||
Thu Oct 3 16:19:53 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c; Make a distinction between having a TERMIOS tty
|
||||
driver, and having POSIX signal handling. You might one without
|
||||
the other. New defines used HAVE_POSIX_SIGNALS, and
|
||||
TERMIOS_TTY_DRIVER.
|
||||
|
||||
Tue Jul 30 22:37:26 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: rl_getc () If a call to read () returns without an
|
||||
error, but with zero characters, the file is empty, so return EOF.
|
||||
|
||||
Thu Jul 11 20:58:38 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: (rl_get_next_history, rl_get_previous_history)
|
||||
Reallocate the buffer space if the line being moved to is longer
|
||||
the the current space allocated. Amazing that no one has found
|
||||
this bug until now.
|
||||
|
||||
Sun Jul 7 02:37:05 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c:(rl_parse_and_bind) Allow leading whitespace.
|
||||
Make sure TERMIO and TERMIOS systems treat CR and NL
|
||||
disctinctly.
|
||||
|
||||
Tue Jun 25 04:09:27 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: Rework parsing conditionals to pay attention to the
|
||||
prior states of the conditional stack. This makes $if statements
|
||||
work correctly.
|
||||
|
||||
Mon Jun 24 20:45:59 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: support for displaying key binding information
|
||||
includes the functions rl_list_funmap_names (),
|
||||
invoking_keyseqs_in_map (), rl_invoking_keyseqs (),
|
||||
rl_dump_functions (), and rl_function_dumper ().
|
||||
|
||||
funmap.c: support for same includes rl_funmap_names ().
|
||||
|
||||
readline.c, funmap.c: no longer define STATIC_MALLOC. However,
|
||||
update both version of xrealloc () to handle a null pointer.
|
||||
|
||||
Thu Apr 25 12:03:49 1991 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* vi_mode.c (rl_vi_fword, fWord, etc. All functions use
|
||||
the macro `isident()'. Fixed movement bug which prevents
|
||||
continious movement through the text.
|
||||
|
||||
Fri Jul 27 16:47:01 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (parser_if) Allow "$if term=foo" construct.
|
||||
|
||||
Wed May 23 16:10:33 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c (rl_dispatch) Correctly remember the last command
|
||||
executed. Fixed typo in username_completion_function ().
|
||||
|
||||
Mon Apr 9 19:55:48 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: username_completion_function (); For text passed in
|
||||
with a leading `~', remember that this could be a filename (after
|
||||
it is completed).
|
||||
|
||||
Thu Apr 5 13:44:24 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: rl_search_history (): Correctly handle case of an
|
||||
unfound search string, but a graceful exit (as with ESC).
|
||||
|
||||
* readline.c: rl_restart_output (); The Apollo passes the address
|
||||
of the file descriptor to TIOCSTART, not the descriptor itself.
|
||||
|
||||
Tue Mar 20 05:38:55 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* readline.c: rl_complete (); second call in a row causes possible
|
||||
completions to be listed.
|
||||
|
||||
* readline.c: rl_redisplay (), added prompt_this_line variable
|
||||
which is the first character character following \n in prompt.
|
||||
|
||||
Sun Mar 11 04:32:03 1990 Brian Fox (bfox at gnuwest.fsf.org)
|
||||
|
||||
* Signals are now supposedly handled inside of SYSV compilation.
|
||||
|
||||
Wed Jan 17 19:24:09 1990 Brian Fox (bfox at sbphy.ucsb.edu)
|
||||
|
||||
* history.c: history_expand (); fixed overwriting memory error,
|
||||
added needed argument to call to get_history_event ().
|
||||
|
||||
Thu Jan 11 10:54:04 1990 Brian Fox (bfox at sbphy.ucsb.edu)
|
||||
|
||||
* readline.c: added mark_modified_lines to control the
|
||||
display of an asterisk on modified history lines. Also
|
||||
added a user variable called mark-modified-lines to the
|
||||
`set' command.
|
||||
|
||||
Thu Jan 4 10:38:05 1990 Brian Fox (bfox at sbphy.ucsb.edu)
|
||||
|
||||
* readline.c: start_insert (). Only use IC if we don't have an im
|
||||
capability.
|
||||
|
||||
Fri Sep 8 09:00:45 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* readline.c: rl_prep_terminal (). Only turn on 8th bit
|
||||
as meta-bit iff the terminal is not using parity.
|
||||
|
||||
Sun Sep 3 08:57:40 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* readline.c: start_insert (). Uses multiple
|
||||
insertion call in cases where that makes sense.
|
||||
|
||||
rl_insert (). Read type-ahead buffer for additional
|
||||
keys that are bound to rl_insert, and insert them
|
||||
all at once. Make insertion of single keys given
|
||||
with an argument much more efficient.
|
||||
|
||||
Tue Aug 8 18:13:57 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* readline.c: Changed handling of EOF. readline () returns
|
||||
(char *)EOF or consed string. The EOF character is read from the
|
||||
tty, or if the tty doesn't have one, defaults to C-d.
|
||||
|
||||
* readline.c: Added support for event driven programs.
|
||||
rl_event_hook is the address of a function you want called
|
||||
while Readline is waiting for input.
|
||||
|
||||
* readline.c: Cleanup time. Functions without type declarations
|
||||
do not use return with a value.
|
||||
|
||||
* history.c: history_expand () has new variable which is the
|
||||
characters to ignore immediately following history_expansion_char.
|
||||
|
||||
Sun Jul 16 08:14:00 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* rl_prep_terminal ()
|
||||
BSD version turns off C-s, C-q, C-y, C-v.
|
||||
|
||||
* readline.c -- rl_prep_terminal ()
|
||||
SYSV version hacks readline_echoing_p.
|
||||
BSD version turns on passing of the 8th bit for the duration
|
||||
of reading the line.
|
||||
|
||||
Tue Jul 11 06:25:01 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* readline.c: new variable rl_tilde_expander.
|
||||
If non-null, this contains the address of a function to call if
|
||||
the standard meaning for expanding a tilde fails. The function is
|
||||
called with the text sans tilde (as in "foo"), and returns a
|
||||
malloc()'ed string which is the expansion, or a NULL pointer if
|
||||
there is no expansion.
|
||||
|
||||
* readline.h - new file chardefs.h
|
||||
Separates things that only readline.c needs from the standard
|
||||
header file publishing interesting things about readline.
|
||||
|
||||
* readline.c:
|
||||
readline_default_bindings () now looks at terminal chararacters
|
||||
and binds those as well.
|
||||
|
||||
Wed Jun 28 20:20:51 1989 Brian Fox (bfox at aurel)
|
||||
|
||||
* Made readline and history into independent libraries.
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
## -*- text -*- ####################################################
|
||||
# #
|
||||
# Makefile for the GNU Readline and History Libraries. #
|
||||
# #
|
||||
####################################################################
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = .:@srcdir@
|
||||
topdir = @top_srcdir@
|
||||
BUILD_DIR = @BUILD_DIR@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
CC = @CC@
|
||||
RANLIB = @RANLIB@
|
||||
AR = @AR@
|
||||
RM = rm -f
|
||||
CP = cp
|
||||
MV = mv
|
||||
|
||||
# See the file STANDALONE for the -D defines that readline understands
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LOCAL_CFLAGS = @LOCAL_CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
DEFS = @DEFS@
|
||||
|
||||
INCLUDES = -I. -I$(BUILD_DIR) -I$(topdir) -I$(topdir)/lib
|
||||
|
||||
CCFLAGS = $(DEFS) $(APP_CFLAGS) $(CPPFLAGS) ${INCLUDES} $(LOCAL_CFLAGS) $(CFLAGS)
|
||||
|
||||
# Here is a rule for making .o files from .c files that doesn't force
|
||||
# the type of the machine (like -sun3) into the flags.
|
||||
.c.o:
|
||||
$(CC) -c $(CCFLAGS) $<
|
||||
|
||||
# The name of the main library target.
|
||||
LIBRARY_NAME = libreadline.a
|
||||
|
||||
# The C code source files for this library.
|
||||
CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
|
||||
$(srcdir)/vi_mode.c $(srcdir)/parens.c $(srcdir)/rltty.c \
|
||||
$(srcdir)/complete.c $(srcdir)/bind.c $(srcdir)/isearch.c \
|
||||
$(srcdir)/display.c $(srcdir)/signals.c $(srcdir)/emacs_keymap.c \
|
||||
$(srcdir)/vi_keymap.c $(srcdir)/util.c $(srcdir)/kill.c \
|
||||
$(srcdir)/undo.c $(srcdir)/macro.c $(srcdir)/input.c \
|
||||
$(srcdir)/callback.c $(srcdir)/terminal.c $(srcdir)/xmalloc.c \
|
||||
$(srcdir)/history.c $(srcdir)/histsearch.c $(srcdir)/histexpand.c \
|
||||
$(srcdir)/histfile.c $(srcdir)/nls.c \
|
||||
$(srcdir)/tilde.c \
|
||||
|
||||
# The header files for this library.
|
||||
HSOURCES = readline.h rldefs.h chardefs.h keymaps.h history.h histlib.h \
|
||||
posixstat.h tilde.h rlconf.h tcap.h
|
||||
|
||||
HISTOBJ = history.o histexpand.o histfile.o histsearch.o
|
||||
TILDEOBJ= tilde.o
|
||||
OBJECTS = readline.o vi_mode.o funmap.o keymaps.o parens.o search.o \
|
||||
rltty.o complete.o bind.o isearch.o display.o signals.o \
|
||||
util.o kill.o undo.o macro.o input.o callback.o terminal.o \
|
||||
nls.o xmalloc.o \
|
||||
$(HISTOBJ) $(TILDEOBJ)
|
||||
|
||||
# The texinfo files which document this library.
|
||||
DOCSOURCE = doc/rlman.texinfo doc/rltech.texinfo doc/rluser.texinfo
|
||||
DOCOBJECT = doc/readline.dvi
|
||||
DOCSUPPORT = doc/Makefile
|
||||
DOCUMENTATION = $(DOCSOURCE) $(DOCOBJECT) $(DOCSUPPORT)
|
||||
|
||||
SUPPORT = Makefile ChangeLog $(DOCSUPPORT) examples/[-a-z.]*
|
||||
|
||||
SOURCES = $(CSOURCES) $(HSOURCES) $(DOCSOURCE)
|
||||
|
||||
THINGS_TO_TAR = $(SOURCES) $(SUPPORT)
|
||||
|
||||
INSTALLED_HEADERS = readline.h chardefs.h keymaps.h history.h tilde.h
|
||||
|
||||
##########################################################################
|
||||
|
||||
all: libreadline.a libhistory.a
|
||||
|
||||
libreadline.a: $(OBJECTS)
|
||||
$(RM) -f $@
|
||||
$(AR) cr $@ $(OBJECTS)
|
||||
-test -n "$(RANLIB)" && $(RANLIB) $@
|
||||
|
||||
libhistory.a: $(HISTOBJ) xmalloc.o
|
||||
$(RM) -f $@
|
||||
$(AR) cr $@ $(HISTOBJ) xmalloc.o
|
||||
-test -n "$(RANLIB)" && $(RANLIB) $@
|
||||
|
||||
documentation: force
|
||||
test -d doc || mkdir doc
|
||||
-( cd doc && $(MAKE) $(MFLAGS) )
|
||||
|
||||
force:
|
||||
|
||||
# The rule for 'includes' is written funny so that the if statement
|
||||
# always returns TRUE unless there really was an error installing the
|
||||
# include files.
|
||||
install: installdirs libreadline.a
|
||||
for file in $(INSTALLED_HEADERS) ; do \
|
||||
$(INSTALL_DATA) $(srcdir)/$$file $(includedir)/readline ; \
|
||||
done
|
||||
-${MV} $(libdir)/libreadline.a $(libdir)/libreadline.old
|
||||
${INSTALL_DATA} libreadline.a $(libdir)/libreadline.a
|
||||
-test -n "$(RANLIB)" && $(RANLIB) -t $(bindir)/libreadline.a
|
||||
|
||||
installdirs: $(topdir)/support/mkdirs
|
||||
$(SHELL) $(topdir)/support/mkdirs $(includedir) \
|
||||
$(includedir)/readline $(libdir) $(infodir) $(man3dir)
|
||||
|
||||
uninstall:
|
||||
cd $(includedir)/readline && ${RM} -f ${INSTALLED_HEADERS}
|
||||
cd $(libdir) && ${RM} -f libreadline.a libreadline.old
|
||||
|
||||
tags: force
|
||||
etags $(CSOURCES) $(HSOURCES)
|
||||
|
||||
TAGS: force
|
||||
ctags -x $(CSOURCES) $(HSOURCES) > $@
|
||||
|
||||
readline: readline.h rldefs.h chardefs.h
|
||||
readline: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) $(CPPFLAGS) $(READLINE_DEFINES) \
|
||||
$(LOCAL_INCLUDES) -DTEST -o readline readline.c vi_mode.o funmap.o \
|
||||
keymaps.o -ltermcap
|
||||
|
||||
clean: force
|
||||
$(RM) $(OBJECTS) *.a
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
|
||||
distclean realclean maintainer-clean: clean
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
$(RM) Makefile
|
||||
|
||||
mostlyclean: clean
|
||||
-( cd doc && $(MAKE) $(MFLAGS) $@ )
|
||||
|
||||
# Dependencies
|
||||
readline.o: readline.c readline.h rldefs.h rlconf.h chardefs.h tcap.h
|
||||
readline.o: keymaps.h history.h
|
||||
vi_mode.o: rldefs.h rlconf.h readline.h history.h
|
||||
funmap.o: funmap.c readline.h rlconf.h
|
||||
keymaps.o: keymaps.c emacs_keymap.c vi_keymap.c keymaps.h chardefs.h rlconf.h
|
||||
history.o: history.h histlib.h
|
||||
histexpand.o: history.h histlib.h
|
||||
histsearch.o: history.h histlib.h
|
||||
histfile.o: history.h histlib.h
|
||||
isearch.o: readline.h history.h
|
||||
search.o: readline.h history.h
|
||||
display.o: readline.h history.h rldefs.h rlconf.h tcap.h
|
||||
complete.o: readline.h rldefs.h rlconf.h posixdir.h posixstat.h
|
||||
rltty.o: rldefs.h rlconf.h readline.h rltty.h
|
||||
bind.o: rldefs.h rlconf.h readline.h history.h
|
||||
signals.o: rldefs.h rlconf.h readline.h history.h
|
||||
parens.o: readline.h
|
||||
kill.o: rldefs.h rlconf.h readline.h history.h
|
||||
macro.o: rldefs.h rlconf.h readline.h history.h
|
||||
undo.o: rldefs.h rlconf.h readline.h history.h
|
||||
input.o: rldefs.h rlconf.h readline.h history.h
|
||||
callback.o: rlconf.h rldefs.h readline.h
|
||||
terminal.o: rlconf.h rldefs.h readline.h tcap.h history.h
|
||||
|
||||
bind.o: $(BUILD_DIR)/config.h
|
||||
callback.o: $(BUILD_DIR)/config.h
|
||||
complete.o: $(BUILD_DIR)/config.h
|
||||
display.o: $(BUILD_DIR)/config.h
|
||||
funmap.o: $(BUILD_DIR)/config.h
|
||||
histexpand.o: $(BUILD_DIR)/config.h
|
||||
histfile.o: $(BUILD_DIR)/config.h
|
||||
history.o: $(BUILD_DIR)/config.h
|
||||
histsearch.o: $(BUILD_DIR)/config.h
|
||||
input.o: $(BUILD_DIR)/config.h
|
||||
isearch.o: $(BUILD_DIR)/config.h
|
||||
keymaps.o: $(BUILD_DIR)/config.h
|
||||
kill.o: $(BUILD_DIR)/config.h
|
||||
macro.o: $(BUILD_DIR)/config.h
|
||||
parens.o: $(BUILD_DIR)/config.h
|
||||
readline.o: $(BUILD_DIR)/config.h
|
||||
rltty.o: $(BUILD_DIR)/config.h
|
||||
search.o: $(BUILD_DIR)/config.h
|
||||
signals.o: $(BUILD_DIR)/config.h
|
||||
tilde.o: $(BUILD_DIR)/config.h
|
||||
undo.o: $(BUILD_DIR)/config.h
|
||||
util.o: $(BUILD_DIR)/config.h
|
||||
vi_mode.o: $(BUILD_DIR)/config.h
|
||||
xmalloc.o: $(BUILD_DIR)/config.h
|
||||
@@ -1,6 +0,0 @@
|
||||
This is the distribution of the Gnu Readline library. See the file
|
||||
STANDALONE for a description of the #defines that can be passed via
|
||||
the makefile to build readline on different systems.
|
||||
|
||||
The file rlconf.h contains defines that enable and disable certain
|
||||
readline features.
|
||||
@@ -1,32 +0,0 @@
|
||||
This is a description of C preprocessor defines that readline accepts.
|
||||
Most are passed in from the parent `make'; e.g. from the bash source
|
||||
directory.
|
||||
|
||||
NO_SYS_FILE <sys/file.h> is not present
|
||||
HAVE_UNISTD_H <unistd.h> exists
|
||||
HAVE_STDLIB_H <stdlib.h> exists
|
||||
HAVE_VARARGS_H <varargs.h> exists and is usable
|
||||
HAVE_STRING_H <string.h> exists
|
||||
HAVE_ALLOCA_H <alloca.h> exists and is needed for alloca()
|
||||
HAVE_ALLOCA alloca(3) or a define for it exists
|
||||
PRAGMA_ALLOCA use of alloca() requires a #pragma, as in AIX 3.x
|
||||
VOID_SIGHANDLER signal handlers are void functions
|
||||
HAVE_DIRENT_H <dirent.h> exists and is usable
|
||||
HAVE_SYS_PTEM_H <sys/ptem.h> exists
|
||||
HAVE_SYS_PTE_H <sys/pte.h> exists
|
||||
HAVE_SYS_STREAM_H <sys/stream.h> exists
|
||||
HAVE_SYS_SELECT_H <sys/select.h> exists
|
||||
|
||||
System-specific options:
|
||||
|
||||
GWINSZ_IN_SYS_IOCTL need to include <sys/ioctl.h> for TIOCGWINSZ
|
||||
HAVE_GETPW_DECLS the getpw* functions are declared in <pwd.h> and cannot
|
||||
be redeclared without compiler errors
|
||||
HAVE_STRCASECMP the strcasecmp and strncasecmp functions are available
|
||||
|
||||
USG Running a variant of System V
|
||||
USGr3 Running System V.3
|
||||
XENIX_22 Xenix 2.2
|
||||
Linux Linux
|
||||
CRAY running a recent version of Cray UNICOS
|
||||
SunOS4 Running SunOS 4.x
|
||||
@@ -1,41 +0,0 @@
|
||||
/* ansi_stdlib.h -- An ANSI Standard stdlib.h. */
|
||||
/* A minimal stdlib.h containing extern declarations for those functions
|
||||
that bash uses. */
|
||||
|
||||
/* Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with Bash; see the file COPYING. If not, write to the Free Software
|
||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (_STDLIB_H_)
|
||||
#define _STDLIB_H_ 1
|
||||
|
||||
/* String conversion functions. */
|
||||
extern int atoi ();
|
||||
extern long int atol ();
|
||||
|
||||
/* Memory allocation functions. */
|
||||
extern char *malloc ();
|
||||
extern char *realloc ();
|
||||
extern void free ();
|
||||
|
||||
/* Other miscellaneous functions. */
|
||||
extern void abort ();
|
||||
extern void exit ();
|
||||
extern char *getenv ();
|
||||
extern void qsort ();
|
||||
|
||||
#endif /* _STDLIB_H */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,144 +0,0 @@
|
||||
/* callback.c -- functions to use readline as an X `callback' mechanism. */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "rlconf.h"
|
||||
|
||||
#if defined (READLINE_CALLBACKS)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
#include "readline.h"
|
||||
|
||||
extern void readline_internal_startup ();
|
||||
extern char *readline_internal_teardown ();
|
||||
extern int readline_internal_char ();
|
||||
|
||||
extern int _rl_meta_flag;
|
||||
extern char *rl_prompt;
|
||||
extern int rl_visible_prompt_length;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Callback Readline Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Allow using readline in situations where a program may have multiple
|
||||
things to handle at once, and dispatches them via select(). Call
|
||||
rl_callback_handler_install() with the prompt and a function to call
|
||||
whenever a complete line of input is ready. The user must then
|
||||
call readline_char() every time some input is available, and
|
||||
readline_char() will call the user's function with the complete text
|
||||
read in at each end of line. The terminal is kept prepped and signals
|
||||
handled all the time, except during calls to the user's function. */
|
||||
|
||||
VFunction *rl_linefunc; /* user callback function */
|
||||
static int in_handler; /* terminal_prepped and signals set? */
|
||||
|
||||
/* Make sure the terminal is set up, initialize readline, and prompt. */
|
||||
static void
|
||||
_rl_callback_newline ()
|
||||
{
|
||||
rl_initialize ();
|
||||
|
||||
if (in_handler == 0)
|
||||
{
|
||||
in_handler = 1;
|
||||
|
||||
(*rl_prep_term_function) (_rl_meta_flag);
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_set_signals ();
|
||||
#endif
|
||||
}
|
||||
|
||||
readline_internal_setup ();
|
||||
}
|
||||
|
||||
/* Install a readline handler, set up the terminal, and issue the prompt. */
|
||||
void
|
||||
rl_callback_handler_install (prompt, linefunc)
|
||||
char *prompt;
|
||||
VFunction *linefunc;
|
||||
{
|
||||
rl_prompt = prompt;
|
||||
rl_visible_prompt_length = rl_prompt ? rl_expand_prompt (rl_prompt) : 0;
|
||||
rl_linefunc = linefunc;
|
||||
_rl_callback_newline ();
|
||||
}
|
||||
|
||||
/* Read one character, and dispatch to the handler if it ends the line. */
|
||||
void
|
||||
rl_callback_read_char ()
|
||||
{
|
||||
char *line;
|
||||
int eof;
|
||||
|
||||
if (rl_linefunc == NULL)
|
||||
{
|
||||
fprintf (stderr, "readline: readline_callback_read_char() called with no handler!\r\n");
|
||||
abort ();
|
||||
}
|
||||
|
||||
eof = readline_internal_char ();
|
||||
|
||||
if (rl_done)
|
||||
{
|
||||
line = readline_internal_teardown (eof);
|
||||
|
||||
(*rl_deprep_term_function) ();
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_clear_signals ();
|
||||
#endif
|
||||
in_handler = 0;
|
||||
(*rl_linefunc) (line);
|
||||
|
||||
/* Redisplay the prompt if readline_handler_{install,remove} not called. */
|
||||
if (in_handler == 0 && rl_linefunc)
|
||||
_rl_callback_newline ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove the handler, and make sure the terminal is in its normal state. */
|
||||
void
|
||||
rl_callback_handler_remove ()
|
||||
{
|
||||
rl_linefunc = NULL;
|
||||
if (in_handler)
|
||||
{
|
||||
in_handler = 0;
|
||||
(*rl_deprep_term_function) ();
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
rl_clear_signals ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,127 +0,0 @@
|
||||
/* chardefs.h -- Character definitions for readline. */
|
||||
|
||||
/* Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef _CHARDEFS_H_
|
||||
#define _CHARDEFS_H_
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
# else
|
||||
# include <strings.h>
|
||||
# endif /* HAVE_STRING_H */
|
||||
#else
|
||||
# include <string.h>
|
||||
#endif /* !HAVE_CONFIG_H */
|
||||
|
||||
#ifndef whitespace
|
||||
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
|
||||
#endif
|
||||
|
||||
#ifdef CTRL
|
||||
#undef CTRL
|
||||
#endif
|
||||
|
||||
/* Some character stuff. */
|
||||
#define control_character_threshold 0x020 /* Smaller than this is control. */
|
||||
#define control_character_mask 0x1f /* 0x20 - 1 */
|
||||
#define meta_character_threshold 0x07f /* Larger than this is Meta. */
|
||||
#define control_character_bit 0x40 /* 0x000000, must be off. */
|
||||
#define meta_character_bit 0x080 /* x0000000, must be on. */
|
||||
#define largest_char 255 /* Largest character value. */
|
||||
|
||||
#define CTRL_CHAR(c) ((c) < control_character_threshold && (c) >= 0)
|
||||
#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char)
|
||||
|
||||
#define CTRL(c) ((c) & control_character_mask)
|
||||
#define META(c) ((c) | meta_character_bit)
|
||||
|
||||
#define UNMETA(c) ((c) & (~meta_character_bit))
|
||||
#define UNCTRL(c) _rl_to_upper(((c)|control_character_bit))
|
||||
|
||||
/* Old versions
|
||||
#define _rl_lowercase_p(c) (((c) > ('a' - 1) && (c) < ('z' + 1)))
|
||||
#define _rl_uppercase_p(c) (((c) > ('A' - 1) && (c) < ('Z' + 1)))
|
||||
#define _rl_digit_p(c) ((c) >= '0' && (c) <= '9')
|
||||
*/
|
||||
|
||||
#define _rl_lowercase_p(c) (islower(c))
|
||||
#define _rl_uppercase_p(c) (isupper(c))
|
||||
#define _rl_digit_p(x) (isdigit (x))
|
||||
|
||||
#define _rl_pure_alphabetic(c) (_rl_lowercase_p(c) || _rl_uppercase_p(c))
|
||||
#define ALPHABETIC(c) (_rl_lowercase_p(c) || _rl_uppercase_p(c) || _rl_digit_p(c))
|
||||
|
||||
/* Old versions
|
||||
# define _rl_to_upper(c) (_rl_lowercase_p(c) ? ((c) - 32) : (c))
|
||||
# define _rl_to_lower(c) (_rl_uppercase_p(c) ? ((c) + 32) : (c))
|
||||
*/
|
||||
|
||||
#ifndef _rl_to_upper
|
||||
# define _rl_to_upper(c) (islower(c) ? toupper(c) : (c))
|
||||
# define _rl_to_lower(c) (isupper(c) ? tolower(c) : (c))
|
||||
#endif
|
||||
|
||||
#ifndef _rl_digit_value
|
||||
#define _rl_digit_value(x) ((x) - '0')
|
||||
#endif
|
||||
|
||||
#ifndef NEWLINE
|
||||
#define NEWLINE '\n'
|
||||
#endif
|
||||
|
||||
#ifndef RETURN
|
||||
#define RETURN CTRL('M')
|
||||
#endif
|
||||
|
||||
#ifndef RUBOUT
|
||||
#define RUBOUT 0x7f
|
||||
#endif
|
||||
|
||||
#ifndef TAB
|
||||
#define TAB '\t'
|
||||
#endif
|
||||
|
||||
#ifdef ABORT_CHAR
|
||||
#undef ABORT_CHAR
|
||||
#endif
|
||||
#define ABORT_CHAR CTRL('G')
|
||||
|
||||
#ifdef PAGE
|
||||
#undef PAGE
|
||||
#endif
|
||||
#define PAGE CTRL('L')
|
||||
|
||||
#ifdef SPACE
|
||||
#undef SPACE
|
||||
#endif
|
||||
#define SPACE ' ' /* XXX - was 0x20 */
|
||||
|
||||
#ifdef ESC
|
||||
#undef ESC
|
||||
#endif
|
||||
|
||||
#define ESC CTRL('[')
|
||||
|
||||
#endif /* _CHARDEFS_H_ */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,69 +0,0 @@
|
||||
# This makefile for Readline library documentation is in -*- text -*- mode.
|
||||
# Emacs likes it that way.
|
||||
TEXI2DVI = texi2dvi
|
||||
|
||||
RM = rm -f
|
||||
|
||||
INSTALL_DATA = cp
|
||||
infodir = /usr/local/info
|
||||
|
||||
RLSRC = rlman.texinfo rluser.texinfo rltech.texinfo
|
||||
HISTSRC = hist.texinfo hsuser.texinfo hstech.texinfo
|
||||
|
||||
DVIOBJ = readline.dvi history.dvi
|
||||
INFOOBJ = readline.info history.info
|
||||
PSOBJ = readline.ps history.ps
|
||||
HTMLOBJ = readline.html history.html
|
||||
|
||||
all: info dvi html
|
||||
|
||||
readline.dvi: $(RLSRC)
|
||||
$(TEXI2DVI) rlman.texinfo
|
||||
mv rlman.dvi readline.dvi
|
||||
|
||||
readline.info: $(RLSRC)
|
||||
makeinfo --no-split -o $@ rlman.texinfo
|
||||
|
||||
history.dvi: ${HISTSRC}
|
||||
$(TEXI2DVI) hist.texinfo
|
||||
mv hist.dvi history.dvi
|
||||
|
||||
history.info: ${HISTSRC}
|
||||
makeinfo --no-split -o $@ hist.texinfo
|
||||
|
||||
readline.ps: readline.dvi
|
||||
dvips -D 300 -o $@ readline.dvi
|
||||
|
||||
history.ps: history.dvi
|
||||
dvips -D 300 -o $@ history.dvi
|
||||
|
||||
readline.html: ${RLSRC}
|
||||
texi2html rlman.texinfo
|
||||
sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman.html > readline.html
|
||||
sed -e 's:rlman.html:readline.html:' -e 's:rlman_toc.html:readline_toc.html:' rlman_toc.html > readline_toc.html
|
||||
rm -f rlman.html rlman_toc.html
|
||||
|
||||
history.html: ${HISTSRC}
|
||||
texi2html hist.texinfo
|
||||
sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist.html > history.html
|
||||
sed -e 's:hist.html:history.html:' -e 's:hist_toc.html:history_toc.html:' hist_toc.html > history_toc.html
|
||||
rm -f hist.html hist_toc.html
|
||||
|
||||
info: $(INFOOBJ)
|
||||
dvi: $(DVIOBJ)
|
||||
ps: $(PSOBJ)
|
||||
html: $(HTMLOBJ)
|
||||
|
||||
clean:
|
||||
$(RM) *.aux *.cp *.fn *.ky *.log *.pg *.toc *.tp *.vr *.cps *.pgs \
|
||||
*.fns *.kys *.tps *.vrs *.o core
|
||||
|
||||
distclean: clean
|
||||
mostlyclean: clean
|
||||
|
||||
maintainer-clean: clean
|
||||
$(RM) *.dvi *.info *.info-* *.ps *.html
|
||||
|
||||
install: info
|
||||
${INSTALL_DATA} readline.info $(infodir)/readline.info
|
||||
${INSTALL_DATA} history.info $(infodir)/history.info
|
||||
@@ -1,112 +0,0 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header (This is for running Texinfo on a region.)
|
||||
@setfilename history.info
|
||||
@settitle GNU History Library
|
||||
@c %**end of header (This is for running Texinfo on a region.)
|
||||
|
||||
@setchapternewpage odd
|
||||
|
||||
@ignore
|
||||
last change: Thu Mar 21 16:07:29 EST 1996
|
||||
@end ignore
|
||||
|
||||
@set EDITION 2.1
|
||||
@set VERSION 2.1
|
||||
@set UPDATED 21 March 1996
|
||||
@set UPDATE-MONTH March 1996
|
||||
|
||||
@ifinfo
|
||||
This document describes the GNU History library, a programming tool that
|
||||
provides a consistent user interface for recalling lines of previously
|
||||
typed input.
|
||||
|
||||
Copyright (C) 1988, 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
pare preserved on all copies.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through TeX and print the
|
||||
results, provided the printed document carries copying permission
|
||||
notice identical to this one except for the removal of this paragraph
|
||||
(this paragraph not being relevant to the printed manual).
|
||||
@end ignore
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the entire
|
||||
resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation approved
|
||||
by the Foundation.
|
||||
@end ifinfo
|
||||
|
||||
@titlepage
|
||||
@title GNU History Library
|
||||
@subtitle Edition @value{EDITION}, for @code{History Library} Version @value{VERSION}.
|
||||
@subtitle @value{UPDATE-MONTH}
|
||||
@author Brian Fox, Free Software Foundation
|
||||
@author Chet Ramey, Case Western Reserve University
|
||||
|
||||
@page
|
||||
This document describes the GNU History library, a programming tool that
|
||||
provides a consistent user interface for recalling lines of previously
|
||||
typed input.
|
||||
|
||||
Published by the Free Software Foundation @*
|
||||
675 Massachusetts Avenue, @*
|
||||
Cambridge, MA 02139 USA
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the entire
|
||||
resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation approved
|
||||
by the Foundation.
|
||||
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
|
||||
@end titlepage
|
||||
|
||||
@ifinfo
|
||||
@node Top
|
||||
@top GNU History Library
|
||||
|
||||
This document describes the GNU History library, a programming tool that
|
||||
provides a consistent user interface for recalling lines of previously
|
||||
typed input.
|
||||
|
||||
@menu
|
||||
* Using History Interactively:: GNU History User's Manual.
|
||||
* Programming with GNU History:: GNU History Programmer's Manual.
|
||||
* Concept Index:: Index of concepts described in this manual.
|
||||
* Function and Variable Index:: Index of externally visible functions
|
||||
and variables.
|
||||
@end menu
|
||||
@end ifinfo
|
||||
|
||||
@syncodeindex fn vr
|
||||
|
||||
@include hsuser.texinfo
|
||||
@include hstech.texinfo
|
||||
|
||||
@node Concept Index
|
||||
@appendix Concept Index
|
||||
@printindex cp
|
||||
|
||||
@node Function and Variable Index
|
||||
@appendix Function and Variable Index
|
||||
@printindex vr
|
||||
|
||||
@contents
|
||||
@bye
|
||||
@@ -1,504 +0,0 @@
|
||||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988, 1991, 1994, 1996 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
provided the copyright notice and this permission notice are preserved on
|
||||
all copies.
|
||||
|
||||
Permission is granted to process this file through Tex and print the
|
||||
results, provided the printed document carries copying permission notice
|
||||
identical to this one except for the removal of this paragraph (this
|
||||
paragraph not being relevant to the printed manual).
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided also that the
|
||||
GNU Copyright statement is available to the distributee, and provided that
|
||||
the entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions.
|
||||
@end ignore
|
||||
|
||||
@node Programming with GNU History
|
||||
@chapter Programming with GNU History
|
||||
|
||||
This chapter describes how to interface programs that you write
|
||||
with the GNU History Library.
|
||||
It should be considered a technical guide.
|
||||
For information on the interactive use of GNU History, @pxref{Using
|
||||
History Interactively}.
|
||||
|
||||
@menu
|
||||
* Introduction to History:: What is the GNU History library for?
|
||||
* History Storage:: How information is stored.
|
||||
* History Functions:: Functions that you can use.
|
||||
* History Variables:: Variables that control behaviour.
|
||||
* History Programming Example:: Example of using the GNU History Library.
|
||||
@end menu
|
||||
|
||||
@node Introduction to History
|
||||
@section Introduction to History
|
||||
|
||||
Many programs read input from the user a line at a time. The GNU History
|
||||
library is able to keep track of those lines, associate arbitrary data with
|
||||
each line, and utilize information from previous lines in composing new
|
||||
ones.
|
||||
|
||||
The programmer using the History library has available functions
|
||||
for remembering lines on a history list, associating arbitrary data
|
||||
with a line, removing lines from the list, searching through the list
|
||||
for a line containing an arbitrary text string, and referencing any line
|
||||
in the list directly. In addition, a history @dfn{expansion} function
|
||||
is available which provides for a consistent user interface across
|
||||
different programs.
|
||||
|
||||
The user using programs written with the History library has the
|
||||
benefit of a consistent user interface with a set of well-known
|
||||
commands for manipulating the text of previous lines and using that text
|
||||
in new commands. The basic history manipulation commands are similar to
|
||||
the history substitution provided by @code{csh}.
|
||||
|
||||
If the programmer desires, he can use the Readline library, which
|
||||
includes some history manipulation by default, and has the added
|
||||
advantage of command line editing.
|
||||
|
||||
@node History Storage
|
||||
@section History Storage
|
||||
|
||||
The history list is an array of history entries. A history entry is
|
||||
declared as follows:
|
||||
|
||||
@example
|
||||
typedef struct _hist_entry @{
|
||||
char *line;
|
||||
char *data;
|
||||
@} HIST_ENTRY;
|
||||
@end example
|
||||
|
||||
The history list itself might therefore be declared as
|
||||
|
||||
@example
|
||||
HIST_ENTRY **the_history_list;
|
||||
@end example
|
||||
|
||||
The state of the History library is encapsulated into a single structure:
|
||||
|
||||
@example
|
||||
/* A structure used to pass the current state of the history stuff around. */
|
||||
typedef struct _hist_state @{
|
||||
HIST_ENTRY **entries; /* Pointer to the entries themselves. */
|
||||
int offset; /* The location pointer within this array. */
|
||||
int length; /* Number of elements within this array. */
|
||||
int size; /* Number of slots allocated to this array. */
|
||||
int flags;
|
||||
@} HISTORY_STATE;
|
||||
@end example
|
||||
|
||||
If the flags member includes @code{HS_STIFLED}, the history has been
|
||||
stifled.
|
||||
|
||||
@node History Functions
|
||||
@section History Functions
|
||||
|
||||
This section describes the calling sequence for the various functions
|
||||
present in GNU History.
|
||||
|
||||
@menu
|
||||
* Initializing History and State Management:: Functions to call when you
|
||||
want to use history in a
|
||||
program.
|
||||
* History List Management:: Functions used to manage the list
|
||||
of history entries.
|
||||
* Information About the History List:: Functions returning information about
|
||||
the history list.
|
||||
* Moving Around the History List:: Functions used to change the position
|
||||
in the history list.
|
||||
* Searching the History List:: Functions to search the history list
|
||||
for entries containing a string.
|
||||
* Managing the History File:: Functions that read and write a file
|
||||
containing the history list.
|
||||
* History Expansion:: Functions to perform csh-like history
|
||||
expansion.
|
||||
@end menu
|
||||
|
||||
@node Initializing History and State Management
|
||||
@subsection Initializing History and State Management
|
||||
|
||||
This section describes functions used to initialize and manage
|
||||
the state of the History library when you want to use the history
|
||||
functions in your program.
|
||||
|
||||
@deftypefun void using_history ()
|
||||
Begin a session in which the history functions might be used. This
|
||||
initializes the interactive variables.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HISTORY_STATE *} history_get_history_state ()
|
||||
Return a structure describing the current state of the input history.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void history_set_history_state (HISTORY_STATE *state)
|
||||
Set the state of the history list according to @var{state}.
|
||||
@end deftypefun
|
||||
|
||||
@node History List Management
|
||||
@subsection History List Management
|
||||
|
||||
These functions manage individual entries on the history list, or set
|
||||
parameters managing the list itself.
|
||||
|
||||
@deftypefun void add_history (char *string)
|
||||
Place @var{string} at the end of the history list. The associated data
|
||||
field (if any) is set to @code{NULL}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} remove_history (int which)
|
||||
Remove history entry at offset @var{which} from the history. The
|
||||
removed element is returned so you can free the line, data,
|
||||
and containing structure.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} replace_history_entry (int which, char *line, char *data)
|
||||
Make the history entry at offset @var{which} have @var{line} and @var{data}.
|
||||
This returns the old entry so you can dispose of the data. In the case
|
||||
of an invalid @var{which}, a @code{NULL} pointer is returned.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void clear_history ()
|
||||
Clear the history list by deleting all the entries.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void stifle_history (int max)
|
||||
Stifle the history list, remembering only the last @var{max} entries.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int unstifle_history ()
|
||||
Stop stifling the history. This returns the previous amount the
|
||||
history was stifled. The value is positive if the history was
|
||||
stifled, negative if it wasn't.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int history_is_stifled ()
|
||||
Returns non-zero if the history is stifled, zero if it is not.
|
||||
@end deftypefun
|
||||
|
||||
@node Information About the History List
|
||||
@subsection Information About the History List
|
||||
|
||||
These functions return information about the entire history list or
|
||||
individual list entries.
|
||||
|
||||
@deftypefun {HIST_ENTRY **} history_list ()
|
||||
Return a @code{NULL} terminated array of @code{HIST_ENTRY} which is the
|
||||
current input history. Element 0 of this list is the beginning of time.
|
||||
If there is no history, return @code{NULL}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int where_history ()
|
||||
Returns the offset of the current history element.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} current_history ()
|
||||
Return the history entry at the current position, as determined by
|
||||
@code{where_history ()}. If there is no entry there, return a @code{NULL}
|
||||
pointer.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} history_get (int offset)
|
||||
Return the history entry at position @var{offset}, starting from
|
||||
@code{history_base}. If there is no entry there, or if @var{offset}
|
||||
is greater than the history length, return a @code{NULL} pointer.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int history_total_bytes ()
|
||||
Return the number of bytes that the primary history entries are using.
|
||||
This function returns the sum of the lengths of all the lines in the
|
||||
history.
|
||||
@end deftypefun
|
||||
|
||||
@node Moving Around the History List
|
||||
@subsection Moving Around the History List
|
||||
|
||||
These functions allow the current index into the history list to be
|
||||
set or changed.
|
||||
|
||||
@deftypefun int history_set_pos (int pos)
|
||||
Set the position in the history list to @var{pos}, an absolute index
|
||||
into the list.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} previous_history ()
|
||||
Back up the current history offset to the previous history entry, and
|
||||
return a pointer to that entry. If there is no previous entry, return
|
||||
a @code{NULL} pointer.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {HIST_ENTRY *} next_history ()
|
||||
Move the current history offset forward to the next history entry, and
|
||||
return the a pointer to that entry. If there is no next entry, return
|
||||
a @code{NULL} pointer.
|
||||
@end deftypefun
|
||||
|
||||
@node Searching the History List
|
||||
@subsection Searching the History List
|
||||
@cindex History Searching
|
||||
|
||||
These functions allow searching of the history list for entries containing
|
||||
a specific string. Searching may be performed both forward and backward
|
||||
from the current history position. The search may be @dfn{anchored},
|
||||
meaning that the string must match at the beginning of the history entry.
|
||||
@cindex anchored search
|
||||
|
||||
@deftypefun int history_search (char *string, int direction)
|
||||
Search the history for @var{string}, starting at the current history
|
||||
offset. If @var{direction} < 0, then the search is through previous entries,
|
||||
else through subsequent. If @var{string} is found, then
|
||||
the current history index is set to that history entry, and the value
|
||||
returned is the offset in the line of the entry where
|
||||
@var{string} was found. Otherwise, nothing is changed, and a -1 is
|
||||
returned.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int history_search_prefix (char *string, int direction)
|
||||
Search the history for @var{string}, starting at the current history
|
||||
offset. The search is anchored: matching lines must begin with
|
||||
@var{string}. If @var{direction} < 0, then the search is through previous
|
||||
entries, else through subsequent. If @var{string} is found, then the
|
||||
current history index is set to that entry, and the return value is 0.
|
||||
Otherwise, nothing is changed, and a -1 is returned.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int history_search_pos (char *string, int direction, int pos)
|
||||
Search for @var{string} in the history list, starting at @var{pos}, an
|
||||
absolute index into the list. If @var{direction} is negative, the search
|
||||
proceeds backward from @var{pos}, otherwise forward. Returns the absolute
|
||||
index of the history element where @var{string} was found, or -1 otherwise.
|
||||
@end deftypefun
|
||||
|
||||
@node Managing the History File
|
||||
@subsection Managing the History File
|
||||
|
||||
The History library can read the history from and write it to a file.
|
||||
This section documents the functions for managing a history file.
|
||||
|
||||
@deftypefun int read_history (char *filename)
|
||||
Add the contents of @var{filename} to the history list, a line at a
|
||||
time. If @var{filename} is @code{NULL}, then read from
|
||||
@file{~/.history}. Returns 0 if successful, or errno if not.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int read_history_range (char *filename, int from, int to)
|
||||
Read a range of lines from @var{filename}, adding them to the history list.
|
||||
Start reading at line @var{from} and end at @var{to}. If
|
||||
@var{from} is zero, start at the beginning. If @var{to} is less than
|
||||
@var{from}, then read until the end of the file. If @var{filename} is
|
||||
@code{NULL}, then read from @file{~/.history}. Returns 0 if successful,
|
||||
or @code{errno} if not.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int write_history (char *filename)
|
||||
Write the current history to @var{filename}, overwriting @var{filename}
|
||||
if necessary. If @var{filename} is
|
||||
@code{NULL}, then write the history list to @file{~/.history}. Values
|
||||
returned are as in @code{read_history ()}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int append_history (int nelements, char *filename)
|
||||
Append the last @var{nelements} of the history list to @var{filename}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int history_truncate_file (char *filename, int nlines)
|
||||
Truncate the history file @var{filename}, leaving only the last
|
||||
@var{nlines} lines.
|
||||
@end deftypefun
|
||||
|
||||
@node History Expansion
|
||||
@subsection History Expansion
|
||||
|
||||
These functions implement @code{csh}-like history expansion.
|
||||
|
||||
@deftypefun int history_expand (char *string, char **output)
|
||||
Expand @var{string}, placing the result into @var{output}, a pointer
|
||||
to a string (@pxref{History Interaction}). Returns:
|
||||
@table @code
|
||||
@item 0
|
||||
If no expansions took place (or, if the only change in
|
||||
the text was the de-slashifying of the history expansion
|
||||
character);
|
||||
@item 1
|
||||
if expansions did take place;
|
||||
@item -1
|
||||
if there was an error in expansion;
|
||||
@item 2
|
||||
if the returned line should only be displayed, but not executed,
|
||||
as with the @code{:p} modifier (@pxref{Modifiers}).
|
||||
@end table
|
||||
|
||||
If an error ocurred in expansion, then @var{output} contains a descriptive
|
||||
error message.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {char *} history_arg_extract (int first, int last, char *string)
|
||||
Extract a string segment consisting of the @var{first} through @var{last}
|
||||
arguments present in @var{string}. Arguments are broken up as in Bash.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {char *} get_history_event (char *string, int *cindex, int qchar)
|
||||
Returns the text of the history event beginning at @var{string} +
|
||||
@var{*cindex}. @var{*cindex} is modified to point to after the event
|
||||
specifier. At function entry, @var{cindex} points to the index into
|
||||
@var{string} where the history event specification begins. @var{qchar}
|
||||
is a character that is allowed to end the event specification in addition
|
||||
to the ``normal'' terminating characters.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun {char **} history_tokenize (char *string)
|
||||
Return an array of tokens parsed out of @var{string}, much as the
|
||||
shell might. The tokens are split on white space and on the
|
||||
characters @code{()<>;&|$}, and shell quoting conventions are
|
||||
obeyed.
|
||||
@end deftypefun
|
||||
|
||||
@node History Variables
|
||||
@section History Variables
|
||||
|
||||
This section describes the externally visible variables exported by
|
||||
the GNU History Library.
|
||||
|
||||
@deftypevar int history_base
|
||||
The logical offset of the first entry in the history list.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int history_length
|
||||
The number of entries currently stored in the history list.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int max_input_history
|
||||
The maximum number of history entries. This must be changed using
|
||||
@code{stifle_history ()}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar char history_expansion_char
|
||||
The character that starts a history event. The default is @samp{!}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar char history_subst_char
|
||||
The character that invokes word substitution if found at the start of
|
||||
a line. The default is @samp{^}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar char history_comment_char
|
||||
During tokenization, if this character is seen as the first character
|
||||
of a word, then it and all subsequent characters up to a newline are
|
||||
ignored, suppressing history expansion for the remainder of the line.
|
||||
This is disabled by default.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {char *} history_no_expand_chars
|
||||
The list of characters which inhibit history expansion if found immediately
|
||||
following @var{history_expansion_char}. The default is whitespace and
|
||||
@samp{=}.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {char *} history_search_delimiter_chars
|
||||
The list of additional characters which can delimit a history search
|
||||
string, in addition to whitespace, @samp{:} and @samp{?} in the case of
|
||||
a substring search. The default is empty.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar int history_quotes_inhibit_expansion
|
||||
If non-zero, single-quoted words are not scanned for the history expansion
|
||||
character. The default value is 0.
|
||||
@end deftypevar
|
||||
|
||||
@node History Programming Example
|
||||
@section History Programming Example
|
||||
|
||||
The following program demonstrates simple use of the GNU History Library.
|
||||
|
||||
@smallexample
|
||||
main ()
|
||||
@{
|
||||
char line[1024], *t;
|
||||
int len, done = 0;
|
||||
|
||||
line[0] = 0;
|
||||
|
||||
using_history ();
|
||||
while (!done)
|
||||
@{
|
||||
printf ("history$ ");
|
||||
fflush (stdout);
|
||||
t = fgets (line, sizeof (line) - 1, stdin);
|
||||
if (t && *t)
|
||||
@{
|
||||
len = strlen (t);
|
||||
if (t[len - 1] == '\n')
|
||||
t[len - 1] = '\0';
|
||||
@}
|
||||
|
||||
if (!t)
|
||||
strcpy (line, "quit");
|
||||
|
||||
if (line[0])
|
||||
@{
|
||||
char *expansion;
|
||||
int result;
|
||||
|
||||
result = history_expand (line, &expansion);
|
||||
if (result)
|
||||
fprintf (stderr, "%s\n", expansion);
|
||||
|
||||
if (result < 0 || result == 2)
|
||||
@{
|
||||
free (expansion);
|
||||
continue;
|
||||
@}
|
||||
|
||||
add_history (expansion);
|
||||
strncpy (line, expansion, sizeof (line) - 1);
|
||||
free (expansion);
|
||||
@}
|
||||
|
||||
if (strcmp (line, "quit") == 0)
|
||||
done = 1;
|
||||
else if (strcmp (line, "save") == 0)
|
||||
write_history ("history_file");
|
||||
else if (strcmp (line, "read") == 0)
|
||||
read_history ("history_file");
|
||||
else if (strcmp (line, "list") == 0)
|
||||
@{
|
||||
register HIST_ENTRY **the_list;
|
||||
register int i;
|
||||
|
||||
the_list = history_list ();
|
||||
if (the_list)
|
||||
for (i = 0; the_list[i]; i++)
|
||||
printf ("%d: %s\n", i + history_base, the_list[i]->line);
|
||||
@}
|
||||
else if (strncmp (line, "delete", 6) == 0)
|
||||
@{
|
||||
int which;
|
||||
if ((sscanf (line + 6, "%d", &which)) == 1)
|
||||
@{
|
||||
HIST_ENTRY *entry = remove_history (which);
|
||||
if (!entry)
|
||||
fprintf (stderr, "No such entry %d\n", which);
|
||||
else
|
||||
@{
|
||||
free (entry->line);
|
||||
free (entry);
|
||||
@}
|
||||
@}
|
||||
else
|
||||
@{
|
||||
fprintf (stderr, "non-numeric arg given to `delete'\n");
|
||||
@}
|
||||
@}
|
||||
@}
|
||||
@}
|
||||
@end smallexample
|
||||
@@ -1,304 +0,0 @@
|
||||
@ignore
|
||||
This file documents the user interface to the GNU History library.
|
||||
|
||||
Copyright (C) 1988, 1991, 1996 Free Software Foundation, Inc.
|
||||
Authored by Brian Fox and Chet Ramey.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this manual
|
||||
provided the copyright notice and this permission notice are preserved on
|
||||
all copies.
|
||||
|
||||
Permission is granted to process this file through Tex and print the
|
||||
results, provided the printed document carries copying permission notice
|
||||
identical to this one except for the removal of this paragraph (this
|
||||
paragraph not being relevant to the printed manual).
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided also that the
|
||||
GNU Copyright statement is available to the distributee, and provided that
|
||||
the entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions.
|
||||
@end ignore
|
||||
|
||||
@node Using History Interactively
|
||||
@chapter Using History Interactively
|
||||
|
||||
@ifset BashFeatures
|
||||
This chapter describes how to use the GNU History Library interactively,
|
||||
from a user's standpoint. It should be considered a user's guide. For
|
||||
information on using the GNU History Library in your own programs,
|
||||
see the GNU Readline Library Manual.
|
||||
@end ifset
|
||||
@ifclear BashFeatures
|
||||
This chapter describes how to use the GNU History Library interactively,
|
||||
from a user's standpoint. It should be considered a user's guide. For
|
||||
information on using the GNU History Library in your own programs,
|
||||
@pxref{Programming with GNU History}.
|
||||
@end ifclear
|
||||
|
||||
@ifset BashFeatures
|
||||
@menu
|
||||
* Bash History Facilities:: How Bash lets you manipulate your command
|
||||
history.
|
||||
* History Interaction:: What it feels like using History as a user.
|
||||
@end menu
|
||||
@end ifset
|
||||
@ifclear BashFeatures
|
||||
@menu
|
||||
* History Interaction:: What it feels like using History as a user.
|
||||
@end menu
|
||||
@end ifclear
|
||||
|
||||
@ifset BashFeatures
|
||||
@node Bash History Facilities
|
||||
@section Bash History Facilities
|
||||
@cindex command history
|
||||
@cindex history list
|
||||
|
||||
When the @samp{-o history} option to the @code{set} builtin
|
||||
is enabled (@pxref{The Set Builtin}),
|
||||
the shell provides access to the @var{command history},
|
||||
the list of commands previously typed. The text of the last
|
||||
@code{HISTSIZE}
|
||||
commands (default 500) is saved in a history list. The shell
|
||||
stores each command in the history list prior to parameter and
|
||||
variable expansion
|
||||
but after history expansion is performed, subject to the
|
||||
values of the shell variables
|
||||
@code{HISTIGNORE} and @code{HISTCONTROL}.
|
||||
When the shell starts up, the history is initialized from the
|
||||
file named by the @code{HISTFILE} variable (default @file{~/.bash_history}).
|
||||
@code{HISTFILE} is truncated, if necessary, to contain no more than
|
||||
the number of lines specified by the value of the @code{HISTFILESIZE}
|
||||
variable. When an interactive shell exits, the last
|
||||
@code{HISTSIZE} lines are copied from the history list to @code{HISTFILE}.
|
||||
If the @code{histappend} shell option is set (@pxref{Bash Builtins}),
|
||||
the lines are appended to the history file,
|
||||
otherwise the history file is overwritten.
|
||||
If @code{HISTFILE}
|
||||
is unset, or if the history file is unwritable, the history is
|
||||
not saved. After saving the history, the history file is truncated
|
||||
to contain no more than @code{$HISTFILESIZE}
|
||||
lines. If @code{HISTFILESIZE} is not set, no truncation is performed.
|
||||
|
||||
The builtin command @code{fc} (@pxref{Korn Shell Builtins})
|
||||
may be used to list or edit and re-execute a portion of
|
||||
the history list. The @code{history} builtin (@pxref{C Shell Builtins})
|
||||
can be used to display or modify the history list and
|
||||
manipulate the history file.
|
||||
When using the command-line editing, search commands
|
||||
are available in each editing mode that provide access to the
|
||||
history list.
|
||||
|
||||
The shell allows control over which commands are saved on the history
|
||||
list. The @code{HISTCONTROL} and @code{HISTIGNORE}
|
||||
variables may be set to cause the shell to save only a subset of the
|
||||
commands entered.
|
||||
The @code{cmdhist}
|
||||
shell option, if enabled, causes the shell to attempt to save each
|
||||
line of a multi-line command in the same history entry, adding
|
||||
semicolons where necessary to preserve syntactic correctness.
|
||||
The @code{lithist}
|
||||
shell option causes the shell to save the command with embedded newlines
|
||||
instead of semicolons.
|
||||
@xref{Bash Builtins} for a description of @code{shopt}.
|
||||
@end ifset
|
||||
|
||||
@node History Interaction
|
||||
@section Interactive History Expansion
|
||||
@cindex history expansion
|
||||
|
||||
The History library provides a history expansion feature that is similar
|
||||
to the history expansion provided by @code{csh}. This section
|
||||
describes the syntax used to manipulate the history information.
|
||||
|
||||
History expansions introduce words from the history list into
|
||||
the input stream, making it easy to repeat commands, insert the
|
||||
arguments to a previous command into the current input line, or
|
||||
fix errors in previous commands quickly.
|
||||
|
||||
History expansion takes place in two parts. The first is to determine
|
||||
which line from the previous history should be used during substitution.
|
||||
The second is to select portions of that line for inclusion into the
|
||||
current one. The line selected from the previous history is called the
|
||||
@dfn{event}, and the portions of that line that are acted upon are
|
||||
called @dfn{words}. Various @dfn{modifiers} are available to manipulate
|
||||
the selected words. The line is broken into words in the same fashion
|
||||
that Bash does, so that several English (or Unix) words
|
||||
surrounded by quotes are considered as one word.
|
||||
History expansions are introduced by the appearance of the
|
||||
history expansion character, which is @samp{!} by default.
|
||||
@ifset BashFeatures
|
||||
Only @samp{\} and @samp{'} may be used to escape the history expansion
|
||||
character.
|
||||
@end ifset
|
||||
|
||||
@ifset BashFeatures
|
||||
Several shell options settable with the @code{shopt}
|
||||
builtin (@pxref{Bash Builtins}) may be used to tailor
|
||||
the behavior of history expansion. If the
|
||||
@code{histverify} shell option is enabled, and Readline
|
||||
is being used, history substitutions are not immediately passed to
|
||||
the shell parser.
|
||||
Instead, the expanded line is reloaded into the Readline
|
||||
editing buffer for further modification.
|
||||
If Readline is being used, and the @code{histreedit}
|
||||
shell option is enabled, a failed history expansion will be
|
||||
reloaded into the Readline editing buffer for correction.
|
||||
The @samp{-p} option to the @code{history} builtin command
|
||||
may be used to see what a history expansion will do before using it.
|
||||
The @samp{-s} option to the @code{history} builtin may be used to
|
||||
add commands to the end of the history list without actually executing
|
||||
them, so that they are available for subsequent recall.
|
||||
|
||||
The shell allows control of the various characters used by the
|
||||
history expansion mechanism with the @code{histchars} variable.
|
||||
@end ifset
|
||||
|
||||
@menu
|
||||
* Event Designators:: How to specify which history line to use.
|
||||
* Word Designators:: Specifying which words are of interest.
|
||||
* Modifiers:: Modifying the results of substitution.
|
||||
@end menu
|
||||
|
||||
@node Event Designators
|
||||
@subsection Event Designators
|
||||
@cindex event designators
|
||||
|
||||
An event designator is a reference to a command line entry in the
|
||||
history list.
|
||||
@cindex history events
|
||||
|
||||
@table @asis
|
||||
|
||||
@item @code{!}
|
||||
Start a history substitution, except when followed by a space, tab,
|
||||
the end of the line, @key{=} or @key{(}.
|
||||
|
||||
@item @code{!@var{n}}
|
||||
Refer to command line @var{n}.
|
||||
|
||||
@item @code{!-@var{n}}
|
||||
Refer to the command @var{n} lines back.
|
||||
|
||||
@item @code{!!}
|
||||
Refer to the previous command. This is a synonym for @samp{!-1}.
|
||||
|
||||
@item @code{!@var{string}}
|
||||
Refer to the most recent command starting with @var{string}.
|
||||
|
||||
@item @code{!?@var{string}[?]}
|
||||
Refer to the most recent command containing @var{string}. The trailing
|
||||
@samp{?} may be omitted if the @var{string} is followed immediately by
|
||||
a newline.
|
||||
|
||||
@item @code{^@var{string1}^@var{string2}^}
|
||||
Quick Substitution. Repeat the last command, replacing @var{string1}
|
||||
with @var{string2}. Equivalent to
|
||||
@code{!!:s/@var{string1}/@var{string2}/}.
|
||||
|
||||
@item @code{!#}
|
||||
The entire command line typed so far.
|
||||
|
||||
@end table
|
||||
|
||||
@node Word Designators
|
||||
@subsection Word Designators
|
||||
|
||||
Word designators are used to select desired words from the event.
|
||||
A @samp{:} separates the event specification from the word designator. It
|
||||
can be omitted if the word designator begins with a @samp{^}, @samp{$},
|
||||
@samp{*}, @samp{-}, or @samp{%}. Words are numbered from the beginning
|
||||
of the line, with the first word being denoted by 0 (zero). Words are
|
||||
inserted into the current line separated by single spaces.
|
||||
|
||||
@table @code
|
||||
|
||||
@item 0 (zero)
|
||||
The @code{0}th word. For many applications, this is the command word.
|
||||
|
||||
@item @var{n}
|
||||
The @var{n}th word.
|
||||
|
||||
@item ^
|
||||
The first argument; that is, word 1.
|
||||
|
||||
@item $
|
||||
The last argument.
|
||||
|
||||
@item %
|
||||
The word matched by the most recent @samp{?@var{string}?} search.
|
||||
|
||||
@item @var{x}-@var{y}
|
||||
A range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}.
|
||||
|
||||
@item *
|
||||
All of the words, except the @code{0}th. This is a synonym for @samp{1-$}.
|
||||
It is not an error to use @samp{*} if there is just one word in the event;
|
||||
the empty string is returned in that case.
|
||||
|
||||
@item @var{x}*
|
||||
Abbreviates @samp{@var{x}-$}
|
||||
|
||||
@item @var{x}-
|
||||
Abbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word.
|
||||
|
||||
@end table
|
||||
|
||||
If a word designator is supplied without an event specification, the
|
||||
previous command is used as the event.
|
||||
|
||||
@node Modifiers
|
||||
@subsection Modifiers
|
||||
|
||||
After the optional word designator, you can add a sequence of one or more
|
||||
of the following modifiers, each preceded by a @samp{:}.
|
||||
|
||||
@table @code
|
||||
|
||||
@item h
|
||||
Remove a trailing pathname component, leaving only the head.
|
||||
|
||||
@item t
|
||||
Remove all leading pathname components, leaving the tail.
|
||||
|
||||
@item r
|
||||
Remove a trailing suffix of the form @samp{.@var{suffix}}, leaving
|
||||
the basename.
|
||||
|
||||
@item e
|
||||
Remove all but the trailing suffix.
|
||||
|
||||
@item p
|
||||
Print the new command but do not execute it.
|
||||
|
||||
@ifset BashFeatures
|
||||
@item q
|
||||
Quote the substituted words, escaping further substitutions.
|
||||
|
||||
@item x
|
||||
Quote the substituted words as with @samp{q},
|
||||
but break into words at spaces, tabs, and newlines.
|
||||
@end ifset
|
||||
|
||||
@item s/@var{old}/@var{new}/
|
||||
Substitute @var{new} for the first occurrence of @var{old} in the
|
||||
event line. Any delimiter may be used in place of @samp{/}.
|
||||
The delimiter may be quoted in @var{old} and @var{new}
|
||||
with a single backslash. If @samp{&} appears in @var{new},
|
||||
it is replaced by @var{old}. A single backslash will quote
|
||||
the @samp{&}. The final delimiter is optional if it is the last
|
||||
character on the input line.
|
||||
|
||||
@item &
|
||||
Repeat the previous substitution.
|
||||
|
||||
@item g
|
||||
Cause changes to be applied over the entire event line. Used in
|
||||
conjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/},
|
||||
or with @samp{&}.
|
||||
|
||||
@end table
|
||||
@@ -1,110 +0,0 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@comment %**start of header (This is for running Texinfo on a region.)
|
||||
@setfilename readline.info
|
||||
@settitle GNU Readline Library
|
||||
@comment %**end of header (This is for running Texinfo on a region.)
|
||||
@synindex vr fn
|
||||
@setchapternewpage odd
|
||||
|
||||
@ignore
|
||||
last change: Thu Mar 21 16:06:39 EST 1996
|
||||
@end ignore
|
||||
|
||||
@set EDITION 2.1
|
||||
@set VERSION 2.1
|
||||
@set UPDATED 21 March 1996
|
||||
@set UPDATE-MONTH March 1996
|
||||
|
||||
@ifinfo
|
||||
This document describes the GNU Readline Library, a utility which aids
|
||||
in the consistency of user interface across discrete programs that need
|
||||
to provide a command line interface.
|
||||
|
||||
Copyright (C) 1988, 1991 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
pare preserved on all copies.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through TeX and print the
|
||||
results, provided the printed document carries copying permission
|
||||
notice identical to this one except for the removal of this paragraph
|
||||
(this paragraph not being relevant to the printed manual).
|
||||
@end ignore
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the entire
|
||||
resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation approved
|
||||
by the Foundation.
|
||||
@end ifinfo
|
||||
|
||||
@titlepage
|
||||
@title GNU Readline Library
|
||||
@subtitle Edition @value{EDITION}, for @code{Readline Library} Version @value{VERSION}.
|
||||
@subtitle @value{UPDATE-MONTH}
|
||||
@author Brian Fox, Free Software Foundation
|
||||
@author Chet Ramey, Case Western Reserve University
|
||||
|
||||
@page
|
||||
This document describes the GNU Readline Library, a utility which aids
|
||||
in the consistency of user interface across discrete programs that need
|
||||
to provide a command line interface.
|
||||
|
||||
Published by the Free Software Foundation @*
|
||||
675 Massachusetts Avenue, @*
|
||||
Cambridge, MA 02139 USA
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of
|
||||
this manual provided the copyright notice and this permission notice
|
||||
are preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the entire
|
||||
resulting derived work is distributed under the terms of a permission
|
||||
notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation approved
|
||||
by the Foundation.
|
||||
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
|
||||
@end titlepage
|
||||
|
||||
@ifinfo
|
||||
@node Top
|
||||
@top GNU Readline Library
|
||||
|
||||
This document describes the GNU Readline Library, a utility which aids
|
||||
in the consistency of user interface across discrete programs that need
|
||||
to provide a command line interface.
|
||||
|
||||
@menu
|
||||
* Command Line Editing:: GNU Readline User's Manual.
|
||||
* Programming with GNU Readline:: GNU Readline Programmer's Manual.
|
||||
* Concept Index:: Index of concepts described in this manual.
|
||||
* Function and Variable Index:: Index of externally visible functions
|
||||
and variables.
|
||||
@end menu
|
||||
@end ifinfo
|
||||
|
||||
@include rluser.texinfo
|
||||
@include rltech.texinfo
|
||||
|
||||
@node Concept Index
|
||||
@unnumbered Concept Index
|
||||
@printindex cp
|
||||
|
||||
@node Function and Variable Index
|
||||
@unnumbered Function and Variable Index
|
||||
@printindex fn
|
||||
|
||||
@contents
|
||||
@bye
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,885 +0,0 @@
|
||||
/* emacs_keymap.c -- the keymap for emacs_mode in readline (). */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (BUFSIZ)
|
||||
#include <stdio.h>
|
||||
#endif /* !BUFSIZ */
|
||||
|
||||
#include "readline.h"
|
||||
|
||||
/* An array of function pointers, one for each possible key.
|
||||
If the type byte is ISKMAP, then the pointer is the address of
|
||||
a keymap. */
|
||||
|
||||
KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
|
||||
|
||||
/* Control keys. */
|
||||
{ ISFUNC, rl_set_mark }, /* Control-@ */
|
||||
{ ISFUNC, rl_beg_of_line }, /* Control-a */
|
||||
{ ISFUNC, rl_backward }, /* Control-b */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-c */
|
||||
{ ISFUNC, rl_delete }, /* Control-d */
|
||||
{ ISFUNC, rl_end_of_line }, /* Control-e */
|
||||
{ ISFUNC, rl_forward }, /* Control-f */
|
||||
{ ISFUNC, rl_abort }, /* Control-g */
|
||||
{ ISFUNC, rl_rubout }, /* Control-h */
|
||||
{ ISFUNC, rl_complete }, /* Control-i */
|
||||
{ ISFUNC, rl_newline }, /* Control-j */
|
||||
{ ISFUNC, rl_kill_line }, /* Control-k */
|
||||
{ ISFUNC, rl_clear_screen }, /* Control-l */
|
||||
{ ISFUNC, rl_newline }, /* Control-m */
|
||||
{ ISFUNC, rl_get_next_history }, /* Control-n */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-o */
|
||||
{ ISFUNC, rl_get_previous_history }, /* Control-p */
|
||||
{ ISFUNC, rl_quoted_insert }, /* Control-q */
|
||||
{ ISFUNC, rl_reverse_search_history }, /* Control-r */
|
||||
{ ISFUNC, rl_forward_search_history }, /* Control-s */
|
||||
{ ISFUNC, rl_transpose_chars }, /* Control-t */
|
||||
{ ISFUNC, rl_unix_line_discard }, /* Control-u */
|
||||
{ ISFUNC, rl_quoted_insert }, /* Control-v */
|
||||
{ ISFUNC, rl_unix_word_rubout }, /* Control-w */
|
||||
{ ISKMAP, (Function *)emacs_ctlx_keymap }, /* Control-x */
|
||||
{ ISFUNC, rl_yank }, /* Control-y */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-z */
|
||||
{ ISKMAP, (Function *)emacs_meta_keymap }, /* Control-[ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-\ */
|
||||
{ ISFUNC, rl_char_search }, /* Control-] */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-^ */
|
||||
{ ISFUNC, rl_undo_command }, /* Control-_ */
|
||||
|
||||
/* The start of printing characters. */
|
||||
{ ISFUNC, rl_insert }, /* SPACE */
|
||||
{ ISFUNC, rl_insert }, /* ! */
|
||||
{ ISFUNC, rl_insert }, /* " */
|
||||
{ ISFUNC, rl_insert }, /* # */
|
||||
{ ISFUNC, rl_insert }, /* $ */
|
||||
{ ISFUNC, rl_insert }, /* % */
|
||||
{ ISFUNC, rl_insert }, /* & */
|
||||
{ ISFUNC, rl_insert }, /* ' */
|
||||
{ ISFUNC, rl_insert }, /* ( */
|
||||
#if defined (PAREN_MATCHING)
|
||||
{ ISFUNC, rl_insert_close }, /* ) */
|
||||
#else
|
||||
{ ISFUNC, rl_insert }, /* ) */
|
||||
#endif /* !PAREN_MATCHING */
|
||||
{ ISFUNC, rl_insert }, /* * */
|
||||
{ ISFUNC, rl_insert }, /* + */
|
||||
{ ISFUNC, rl_insert }, /* , */
|
||||
{ ISFUNC, rl_insert }, /* - */
|
||||
{ ISFUNC, rl_insert }, /* . */
|
||||
{ ISFUNC, rl_insert }, /* / */
|
||||
|
||||
/* Regular digits. */
|
||||
{ ISFUNC, rl_insert }, /* 0 */
|
||||
{ ISFUNC, rl_insert }, /* 1 */
|
||||
{ ISFUNC, rl_insert }, /* 2 */
|
||||
{ ISFUNC, rl_insert }, /* 3 */
|
||||
{ ISFUNC, rl_insert }, /* 4 */
|
||||
{ ISFUNC, rl_insert }, /* 5 */
|
||||
{ ISFUNC, rl_insert }, /* 6 */
|
||||
{ ISFUNC, rl_insert }, /* 7 */
|
||||
{ ISFUNC, rl_insert }, /* 8 */
|
||||
{ ISFUNC, rl_insert }, /* 9 */
|
||||
|
||||
/* A little more punctuation. */
|
||||
{ ISFUNC, rl_insert }, /* : */
|
||||
{ ISFUNC, rl_insert }, /* ; */
|
||||
{ ISFUNC, rl_insert }, /* < */
|
||||
{ ISFUNC, rl_insert }, /* = */
|
||||
{ ISFUNC, rl_insert }, /* > */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* @ */
|
||||
|
||||
/* Uppercase alphabet. */
|
||||
{ ISFUNC, rl_insert }, /* A */
|
||||
{ ISFUNC, rl_insert }, /* B */
|
||||
{ ISFUNC, rl_insert }, /* C */
|
||||
{ ISFUNC, rl_insert }, /* D */
|
||||
{ ISFUNC, rl_insert }, /* E */
|
||||
{ ISFUNC, rl_insert }, /* F */
|
||||
{ ISFUNC, rl_insert }, /* G */
|
||||
{ ISFUNC, rl_insert }, /* H */
|
||||
{ ISFUNC, rl_insert }, /* I */
|
||||
{ ISFUNC, rl_insert }, /* J */
|
||||
{ ISFUNC, rl_insert }, /* K */
|
||||
{ ISFUNC, rl_insert }, /* L */
|
||||
{ ISFUNC, rl_insert }, /* M */
|
||||
{ ISFUNC, rl_insert }, /* N */
|
||||
{ ISFUNC, rl_insert }, /* O */
|
||||
{ ISFUNC, rl_insert }, /* P */
|
||||
{ ISFUNC, rl_insert }, /* Q */
|
||||
{ ISFUNC, rl_insert }, /* R */
|
||||
{ ISFUNC, rl_insert }, /* S */
|
||||
{ ISFUNC, rl_insert }, /* T */
|
||||
{ ISFUNC, rl_insert }, /* U */
|
||||
{ ISFUNC, rl_insert }, /* V */
|
||||
{ ISFUNC, rl_insert }, /* W */
|
||||
{ ISFUNC, rl_insert }, /* X */
|
||||
{ ISFUNC, rl_insert }, /* Y */
|
||||
{ ISFUNC, rl_insert }, /* Z */
|
||||
|
||||
/* Some more punctuation. */
|
||||
{ ISFUNC, rl_insert }, /* [ */
|
||||
{ ISFUNC, rl_insert }, /* \ */
|
||||
#if defined (PAREN_MATCHING)
|
||||
{ ISFUNC, rl_insert_close }, /* ] */
|
||||
#else
|
||||
{ ISFUNC, rl_insert }, /* ] */
|
||||
#endif /* !PAREN_MATCHING */
|
||||
{ ISFUNC, rl_insert }, /* ^ */
|
||||
{ ISFUNC, rl_insert }, /* _ */
|
||||
{ ISFUNC, rl_insert }, /* ` */
|
||||
|
||||
/* Lowercase alphabet. */
|
||||
{ ISFUNC, rl_insert }, /* a */
|
||||
{ ISFUNC, rl_insert }, /* b */
|
||||
{ ISFUNC, rl_insert }, /* c */
|
||||
{ ISFUNC, rl_insert }, /* d */
|
||||
{ ISFUNC, rl_insert }, /* e */
|
||||
{ ISFUNC, rl_insert }, /* f */
|
||||
{ ISFUNC, rl_insert }, /* g */
|
||||
{ ISFUNC, rl_insert }, /* h */
|
||||
{ ISFUNC, rl_insert }, /* i */
|
||||
{ ISFUNC, rl_insert }, /* j */
|
||||
{ ISFUNC, rl_insert }, /* k */
|
||||
{ ISFUNC, rl_insert }, /* l */
|
||||
{ ISFUNC, rl_insert }, /* m */
|
||||
{ ISFUNC, rl_insert }, /* n */
|
||||
{ ISFUNC, rl_insert }, /* o */
|
||||
{ ISFUNC, rl_insert }, /* p */
|
||||
{ ISFUNC, rl_insert }, /* q */
|
||||
{ ISFUNC, rl_insert }, /* r */
|
||||
{ ISFUNC, rl_insert }, /* s */
|
||||
{ ISFUNC, rl_insert }, /* t */
|
||||
{ ISFUNC, rl_insert }, /* u */
|
||||
{ ISFUNC, rl_insert }, /* v */
|
||||
{ ISFUNC, rl_insert }, /* w */
|
||||
{ ISFUNC, rl_insert }, /* x */
|
||||
{ ISFUNC, rl_insert }, /* y */
|
||||
{ ISFUNC, rl_insert }, /* z */
|
||||
|
||||
/* Final punctuation. */
|
||||
{ ISFUNC, rl_insert }, /* { */
|
||||
{ ISFUNC, rl_insert }, /* | */
|
||||
#if defined (PAREN_MATCHING)
|
||||
{ ISFUNC, rl_insert_close }, /* } */
|
||||
#else
|
||||
{ ISFUNC, rl_insert }, /* } */
|
||||
#endif /* !PAREN_MATCHING */
|
||||
{ ISFUNC, rl_insert }, /* ~ */
|
||||
{ ISFUNC, rl_rubout }, /* RUBOUT */
|
||||
|
||||
#if KEYMAP_SIZE > 128
|
||||
/* Pure 8-bit characters (128 - 159).
|
||||
These might be used in some
|
||||
character sets. */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
|
||||
/* ISO Latin-1 characters (160 - 255) */
|
||||
{ ISFUNC, rl_insert }, /* No-break space */
|
||||
{ ISFUNC, rl_insert }, /* Inverted exclamation mark */
|
||||
{ ISFUNC, rl_insert }, /* Cent sign */
|
||||
{ ISFUNC, rl_insert }, /* Pound sign */
|
||||
{ ISFUNC, rl_insert }, /* Currency sign */
|
||||
{ ISFUNC, rl_insert }, /* Yen sign */
|
||||
{ ISFUNC, rl_insert }, /* Broken bar */
|
||||
{ ISFUNC, rl_insert }, /* Section sign */
|
||||
{ ISFUNC, rl_insert }, /* Diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Copyright sign */
|
||||
{ ISFUNC, rl_insert }, /* Feminine ordinal indicator */
|
||||
{ ISFUNC, rl_insert }, /* Left pointing double angle quotation mark */
|
||||
{ ISFUNC, rl_insert }, /* Not sign */
|
||||
{ ISFUNC, rl_insert }, /* Soft hyphen */
|
||||
{ ISFUNC, rl_insert }, /* Registered sign */
|
||||
{ ISFUNC, rl_insert }, /* Macron */
|
||||
{ ISFUNC, rl_insert }, /* Degree sign */
|
||||
{ ISFUNC, rl_insert }, /* Plus-minus sign */
|
||||
{ ISFUNC, rl_insert }, /* Superscript two */
|
||||
{ ISFUNC, rl_insert }, /* Superscript three */
|
||||
{ ISFUNC, rl_insert }, /* Acute accent */
|
||||
{ ISFUNC, rl_insert }, /* Micro sign */
|
||||
{ ISFUNC, rl_insert }, /* Pilcrow sign */
|
||||
{ ISFUNC, rl_insert }, /* Middle dot */
|
||||
{ ISFUNC, rl_insert }, /* Cedilla */
|
||||
{ ISFUNC, rl_insert }, /* Superscript one */
|
||||
{ ISFUNC, rl_insert }, /* Masculine ordinal indicator */
|
||||
{ ISFUNC, rl_insert }, /* Right pointing double angle quotation mark */
|
||||
{ ISFUNC, rl_insert }, /* Vulgar fraction one quarter */
|
||||
{ ISFUNC, rl_insert }, /* Vulgar fraction one half */
|
||||
{ ISFUNC, rl_insert }, /* Vulgar fraction three quarters */
|
||||
{ ISFUNC, rl_insert }, /* Inverted questionk mark */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with ring above */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter ae */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter c with cedilla */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter e with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter e with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter e with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter e with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter i with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter i with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter i with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter i with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter eth (Icelandic) */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter n with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Multiplication sign */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with stroke */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter u with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter u with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter u with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter u with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter Y with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter thorn (Icelandic) */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter sharp s (German) */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with ring above */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter ae */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter c with cedilla */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter e with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter e with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter e with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter e with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter i with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter i with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter i with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter i with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter eth (Icelandic) */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter n with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Division sign */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with stroke */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter u with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter u with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter u with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter u with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter y with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter thorn (Icelandic) */
|
||||
{ ISFUNC, rl_insert } /* Latin small letter y with diaeresis */
|
||||
#endif /* KEYMAP_SIZE > 128 */
|
||||
};
|
||||
|
||||
KEYMAP_ENTRY_ARRAY emacs_meta_keymap = {
|
||||
|
||||
/* Meta keys. Just like above, but the high bit is set. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-@ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-a */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-b */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-c */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-d */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-e */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-f */
|
||||
{ ISFUNC, rl_abort }, /* Meta-Control-g */
|
||||
{ ISFUNC, rl_backward_kill_word }, /* Meta-Control-h */
|
||||
{ ISFUNC, rl_tab_insert }, /* Meta-Control-i */
|
||||
{ ISFUNC, rl_vi_editing_mode }, /* Meta-Control-j */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-k */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-l */
|
||||
{ ISFUNC, rl_vi_editing_mode }, /* Meta-Control-m */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-n */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-o */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-p */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-q */
|
||||
{ ISFUNC, rl_revert_line }, /* Meta-Control-r */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-s */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-t */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-u */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-v */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-w */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-x */
|
||||
{ ISFUNC, rl_yank_nth_arg }, /* Meta-Control-y */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-z */
|
||||
|
||||
{ ISFUNC, rl_complete }, /* Meta-Control-[ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-\ */
|
||||
{ ISFUNC, rl_backward_char_search }, /* Meta-Control-] */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-^ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-Control-_ */
|
||||
|
||||
/* The start of printing characters. */
|
||||
{ ISFUNC, rl_set_mark }, /* Meta-SPACE */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-! */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-" */
|
||||
{ ISFUNC, rl_insert_comment },/* Meta-# */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-$ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-% */
|
||||
{ ISFUNC, rl_tilde_expand }, /* Meta-& */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-' */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-( */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-) */
|
||||
{ ISFUNC, rl_insert_completions }, /* Meta-* */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-+ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-, */
|
||||
{ ISFUNC, rl_digit_argument }, /* Meta-- */
|
||||
{ ISFUNC, rl_yank_last_arg}, /* Meta-. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-/ */
|
||||
|
||||
/* Regular digits. */
|
||||
{ ISFUNC, rl_digit_argument }, /* Meta-0 */
|
||||
{ ISFUNC, rl_digit_argument }, /* Meta-1 */
|
||||
{ ISFUNC, rl_digit_argument }, /* Meta-2 */
|
||||
{ ISFUNC, rl_digit_argument }, /* Meta-3 */
|
||||
{ ISFUNC, rl_digit_argument }, /* Meta-4 */
|
||||
{ ISFUNC, rl_digit_argument }, /* Meta-5 */
|
||||
{ ISFUNC, rl_digit_argument }, /* Meta-6 */
|
||||
{ ISFUNC, rl_digit_argument }, /* Meta-7 */
|
||||
{ ISFUNC, rl_digit_argument }, /* Meta-8 */
|
||||
{ ISFUNC, rl_digit_argument }, /* Meta-9 */
|
||||
|
||||
/* A little more punctuation. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-: */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-; */
|
||||
{ ISFUNC, rl_beginning_of_history }, /* Meta-< */
|
||||
{ ISFUNC, rl_possible_completions }, /* Meta-= */
|
||||
{ ISFUNC, rl_end_of_history }, /* Meta-> */
|
||||
{ ISFUNC, rl_possible_completions }, /* Meta-? */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-@ */
|
||||
|
||||
/* Uppercase alphabet. */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-A */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-B */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-C */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-D */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-E */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-F */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-G */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-H */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-I */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-J */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-K */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-L */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-M */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-N */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-O */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-P */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-Q */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-R */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-S */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-T */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-U */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-V */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-W */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-X */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-Y */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Meta-Z */
|
||||
|
||||
/* Some more punctuation. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-[ */ /* was rl_arrow_keys */
|
||||
{ ISFUNC, rl_delete_horizontal_space }, /* Meta-\ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-] */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-^ */
|
||||
{ ISFUNC, rl_yank_last_arg }, /* Meta-_ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-` */
|
||||
|
||||
/* Lowercase alphabet. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-a */
|
||||
{ ISFUNC, rl_backward_word }, /* Meta-b */
|
||||
{ ISFUNC, rl_capitalize_word }, /* Meta-c */
|
||||
{ ISFUNC, rl_kill_word }, /* Meta-d */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-e */
|
||||
{ ISFUNC, rl_forward_word }, /* Meta-f */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-g */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-h */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-i */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-j */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-k */
|
||||
{ ISFUNC, rl_downcase_word }, /* Meta-l */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-m */
|
||||
{ ISFUNC, rl_noninc_forward_search }, /* Meta-n */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-o */ /* was rl_arrow_keys */
|
||||
{ ISFUNC, rl_noninc_reverse_search }, /* Meta-p */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-q */
|
||||
{ ISFUNC, rl_revert_line }, /* Meta-r */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-s */
|
||||
{ ISFUNC, rl_transpose_words }, /* Meta-t */
|
||||
{ ISFUNC, rl_upcase_word }, /* Meta-u */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-v */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-w */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-x */
|
||||
{ ISFUNC, rl_yank_pop }, /* Meta-y */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-z */
|
||||
|
||||
/* Final punctuation. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-{ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-| */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Meta-} */
|
||||
{ ISFUNC, rl_tilde_expand }, /* Meta-~ */
|
||||
{ ISFUNC, rl_backward_kill_word }, /* Meta-rubout */
|
||||
|
||||
#if KEYMAP_SIZE > 128
|
||||
/* Undefined keys. */
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 }
|
||||
#endif /* KEYMAP_SIZE > 128 */
|
||||
};
|
||||
|
||||
KEYMAP_ENTRY_ARRAY emacs_ctlx_keymap = {
|
||||
|
||||
/* Control keys. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-@ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-a */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-b */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-c */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-d */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-e */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-f */
|
||||
{ ISFUNC, rl_abort }, /* Control-g */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-h */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-i */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-j */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-k */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-l */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-m */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-n */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-o */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-p */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-q */
|
||||
{ ISFUNC, rl_re_read_init_file }, /* Control-r */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-s */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-t */
|
||||
{ ISFUNC, rl_undo_command }, /* Control-u */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-v */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-w */
|
||||
{ ISFUNC, rl_exchange_point_and_mark },/* Control-x */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-y */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-z */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-[ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-\ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-] */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-^ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-_ */
|
||||
|
||||
/* The start of printing characters. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* SPACE */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ! */
|
||||
{ ISFUNC, (Function *)0x0 }, /* " */
|
||||
{ ISFUNC, (Function *)0x0 }, /* # */
|
||||
{ ISFUNC, (Function *)0x0 }, /* $ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* % */
|
||||
{ ISFUNC, (Function *)0x0 }, /* & */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ' */
|
||||
{ ISFUNC, rl_start_kbd_macro }, /* ( */
|
||||
{ ISFUNC, rl_end_kbd_macro }, /* ) */
|
||||
{ ISFUNC, (Function *)0x0 }, /* * */
|
||||
{ ISFUNC, (Function *)0x0 }, /* + */
|
||||
{ ISFUNC, (Function *)0x0 }, /* , */
|
||||
{ ISFUNC, (Function *)0x0 }, /* - */
|
||||
{ ISFUNC, (Function *)0x0 }, /* . */
|
||||
{ ISFUNC, (Function *)0x0 }, /* / */
|
||||
|
||||
/* Regular digits. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* 0 */
|
||||
{ ISFUNC, (Function *)0x0 }, /* 1 */
|
||||
{ ISFUNC, (Function *)0x0 }, /* 2 */
|
||||
{ ISFUNC, (Function *)0x0 }, /* 3 */
|
||||
{ ISFUNC, (Function *)0x0 }, /* 4 */
|
||||
{ ISFUNC, (Function *)0x0 }, /* 5 */
|
||||
{ ISFUNC, (Function *)0x0 }, /* 6 */
|
||||
{ ISFUNC, (Function *)0x0 }, /* 7 */
|
||||
{ ISFUNC, (Function *)0x0 }, /* 8 */
|
||||
{ ISFUNC, (Function *)0x0 }, /* 9 */
|
||||
|
||||
/* A little more punctuation. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* : */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ; */
|
||||
{ ISFUNC, (Function *)0x0 }, /* < */
|
||||
{ ISFUNC, (Function *)0x0 }, /* = */
|
||||
{ ISFUNC, (Function *)0x0 }, /* > */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ? */
|
||||
{ ISFUNC, (Function *)0x0 }, /* @ */
|
||||
|
||||
/* Uppercase alphabet. */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* A */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* B */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* C */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* D */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* E */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* F */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* G */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* H */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* I */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* J */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* K */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* L */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* M */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* N */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* O */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* P */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Q */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* R */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* S */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* T */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* U */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* V */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* W */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* X */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Y */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Z */
|
||||
|
||||
/* Some more punctuation. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* [ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* \ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ] */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ^ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* _ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ` */
|
||||
|
||||
/* Lowercase alphabet. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* a */
|
||||
{ ISFUNC, (Function *)0x0 }, /* b */
|
||||
{ ISFUNC, (Function *)0x0 }, /* c */
|
||||
{ ISFUNC, (Function *)0x0 }, /* d */
|
||||
{ ISFUNC, rl_call_last_kbd_macro }, /* e */
|
||||
{ ISFUNC, (Function *)0x0 }, /* f */
|
||||
{ ISFUNC, (Function *)0x0 }, /* g */
|
||||
{ ISFUNC, (Function *)0x0 }, /* h */
|
||||
{ ISFUNC, (Function *)0x0 }, /* i */
|
||||
{ ISFUNC, (Function *)0x0 }, /* j */
|
||||
{ ISFUNC, (Function *)0x0 }, /* k */
|
||||
{ ISFUNC, (Function *)0x0 }, /* l */
|
||||
{ ISFUNC, (Function *)0x0 }, /* m */
|
||||
{ ISFUNC, (Function *)0x0 }, /* n */
|
||||
{ ISFUNC, (Function *)0x0 }, /* o */
|
||||
{ ISFUNC, (Function *)0x0 }, /* p */
|
||||
{ ISFUNC, (Function *)0x0 }, /* q */
|
||||
{ ISFUNC, (Function *)0x0 }, /* r */
|
||||
{ ISFUNC, (Function *)0x0 }, /* s */
|
||||
{ ISFUNC, (Function *)0x0 }, /* t */
|
||||
{ ISFUNC, (Function *)0x0 }, /* u */
|
||||
{ ISFUNC, (Function *)0x0 }, /* v */
|
||||
{ ISFUNC, (Function *)0x0 }, /* w */
|
||||
{ ISFUNC, (Function *)0x0 }, /* x */
|
||||
{ ISFUNC, (Function *)0x0 }, /* y */
|
||||
{ ISFUNC, (Function *)0x0 }, /* z */
|
||||
|
||||
/* Final punctuation. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* { */
|
||||
{ ISFUNC, (Function *)0x0 }, /* | */
|
||||
{ ISFUNC, (Function *)0x0 }, /* } */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ~ */
|
||||
{ ISFUNC, rl_backward_kill_line }, /* RUBOUT */
|
||||
|
||||
#if KEYMAP_SIZE > 128
|
||||
/* Undefined keys. */
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 }
|
||||
#endif /* KEYMAP_SIZE > 128 */
|
||||
};
|
||||
@@ -1,65 +0,0 @@
|
||||
# My ~/.inputrc file is in -*- text -*- for easy editing with Emacs.
|
||||
#
|
||||
# Notice the various bindings which are conditionalized depending
|
||||
# on which program is running, or what terminal is active.
|
||||
#
|
||||
|
||||
# In all programs, all terminals, make sure this is bound.
|
||||
"\C-x\C-r": re-read-init-file
|
||||
|
||||
# Hp terminals (and some others) have ugly default behaviour for C-h.
|
||||
"\C-h": backward-delete-char
|
||||
"\e\C-h": backward-kill-word
|
||||
"\C-xd": dump-functions
|
||||
|
||||
# In xterm windows, make the arrow keys do the right thing.
|
||||
$if TERM=xterm
|
||||
"\e[A": previous-history
|
||||
"\e[B": next-history
|
||||
"\e[C": forward-char
|
||||
"\e[D": backward-char
|
||||
|
||||
# alternate arrow key prefix
|
||||
"\eOA": previous-history
|
||||
"\eOB": next-history
|
||||
"\eOC": forward-char
|
||||
"\eOD": backward-char
|
||||
|
||||
# Under Xterm in Bash, we bind local Function keys to do something useful.
|
||||
$if Bash
|
||||
"\e[11~": "Function Key 1"
|
||||
"\e[12~": "Function Key 2"
|
||||
"\e[13~": "Function Key 3"
|
||||
"\e[14~": "Function Key 4"
|
||||
"\e[15~": "Function Key 5"
|
||||
|
||||
# I know the following escape sequence numbers are 1 greater than
|
||||
# the function key. Don't ask me why, I didn't design the xterm terminal.
|
||||
"\e[17~": "Function Key 6"
|
||||
"\e[18~": "Function Key 7"
|
||||
"\e[19~": "Function Key 8"
|
||||
"\e[20~": "Function Key 9"
|
||||
"\e[21~": "Function Key 10"
|
||||
$endif
|
||||
$endif
|
||||
|
||||
# For Bash, all terminals, add some Bash specific hacks.
|
||||
$if Bash
|
||||
"\C-xv": show-bash-version
|
||||
"\C-x\C-e": shell-expand-line
|
||||
|
||||
# Here is one for editing my path.
|
||||
"\C-xp": "$PATH\C-x\C-e\C-e\"\C-aPATH=\":\C-b"
|
||||
|
||||
# Make C-x r read my mail in emacs.
|
||||
# "\C-xr": "emacs -f rmail\C-j"
|
||||
$endif
|
||||
|
||||
# For FTP, different hacks:
|
||||
$if Ftp
|
||||
"\C-xg": "get \M-?"
|
||||
"\C-xt": "put \M-?"
|
||||
"\M-.": yank-last-arg
|
||||
$endif
|
||||
|
||||
" ": self-insert
|
||||
@@ -1,19 +0,0 @@
|
||||
# This is the Makefile for the examples subdirectory of readline. -*- text -*-
|
||||
#
|
||||
EXECUTABLES = fileman rltest
|
||||
CFLAGS = -g -I../.. -I..
|
||||
LDFLAGS = -g -L..
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
all: $(EXECUTABLES)
|
||||
|
||||
fileman: fileman.o
|
||||
$(CC) $(LDFLAGS) -o $@ fileman.o -lreadline -ltermcap
|
||||
|
||||
rltest: rltest.o
|
||||
$(CC) $(LDFLAGS) -o $@ rltest.o -lreadline -ltermcap
|
||||
|
||||
fileman.o: fileman.c
|
||||
rltest.o: rltest.c
|
||||
@@ -1,426 +0,0 @@
|
||||
/* fileman.c -- A tiny application which demonstrates how to use the
|
||||
GNU Readline library. This application interactively allows users
|
||||
to manipulate files and their modes. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
extern char *getwd ();
|
||||
extern char *xmalloc ();
|
||||
|
||||
/* The names of functions that actually do the manipulation. */
|
||||
int com_list (), com_view (), com_rename (), com_stat (), com_pwd ();
|
||||
int com_delete (), com_help (), com_cd (), com_quit ();
|
||||
|
||||
/* A structure which contains information on the commands this program
|
||||
can understand. */
|
||||
|
||||
typedef struct {
|
||||
char *name; /* User printable name of the function. */
|
||||
Function *func; /* Function to call to do the job. */
|
||||
char *doc; /* Documentation for this function. */
|
||||
} COMMAND;
|
||||
|
||||
COMMAND commands[] = {
|
||||
{ "cd", com_cd, "Change to directory DIR" },
|
||||
{ "delete", com_delete, "Delete FILE" },
|
||||
{ "help", com_help, "Display this text" },
|
||||
{ "?", com_help, "Synonym for `help'" },
|
||||
{ "list", com_list, "List files in DIR" },
|
||||
{ "ls", com_list, "Synonym for `list'" },
|
||||
{ "pwd", com_pwd, "Print the current working directory" },
|
||||
{ "quit", com_quit, "Quit using Fileman" },
|
||||
{ "rename", com_rename, "Rename FILE to NEWNAME" },
|
||||
{ "stat", com_stat, "Print out statistics on FILE" },
|
||||
{ "view", com_view, "View the contents of FILE" },
|
||||
{ (char *)NULL, (Function *)NULL, (char *)NULL }
|
||||
};
|
||||
|
||||
/* Forward declarations. */
|
||||
char *stripwhite ();
|
||||
COMMAND *find_command ();
|
||||
|
||||
/* The name of this program, as taken from argv[0]. */
|
||||
char *progname;
|
||||
|
||||
/* When non-zero, this global means the user is done using this program. */
|
||||
int done;
|
||||
|
||||
char *
|
||||
dupstr (s)
|
||||
int s;
|
||||
{
|
||||
char *r;
|
||||
|
||||
r = xmalloc (strlen (s) + 1);
|
||||
strcpy (r, s);
|
||||
return (r);
|
||||
}
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *line, *s;
|
||||
|
||||
progname = argv[0];
|
||||
|
||||
initialize_readline (); /* Bind our completer. */
|
||||
|
||||
/* Loop reading and executing lines until the user quits. */
|
||||
for ( ; done == 0; )
|
||||
{
|
||||
line = readline ("FileMan: ");
|
||||
|
||||
if (!line)
|
||||
break;
|
||||
|
||||
/* Remove leading and trailing whitespace from the line.
|
||||
Then, if there is anything left, add it to the history list
|
||||
and execute it. */
|
||||
s = stripwhite (line);
|
||||
|
||||
if (*s)
|
||||
{
|
||||
add_history (s);
|
||||
execute_line (s);
|
||||
}
|
||||
|
||||
free (line);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
|
||||
/* Execute a command line. */
|
||||
int
|
||||
execute_line (line)
|
||||
char *line;
|
||||
{
|
||||
register int i;
|
||||
COMMAND *command;
|
||||
char *word;
|
||||
|
||||
/* Isolate the command word. */
|
||||
i = 0;
|
||||
while (line[i] && whitespace (line[i]))
|
||||
i++;
|
||||
word = line + i;
|
||||
|
||||
while (line[i] && !whitespace (line[i]))
|
||||
i++;
|
||||
|
||||
if (line[i])
|
||||
line[i++] = '\0';
|
||||
|
||||
command = find_command (word);
|
||||
|
||||
if (!command)
|
||||
{
|
||||
fprintf (stderr, "%s: No such command for FileMan.\n", word);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Get argument to command, if any. */
|
||||
while (whitespace (line[i]))
|
||||
i++;
|
||||
|
||||
word = line + i;
|
||||
|
||||
/* Call the function. */
|
||||
return ((*(command->func)) (word));
|
||||
}
|
||||
|
||||
/* Look up NAME as the name of a command, and return a pointer to that
|
||||
command. Return a NULL pointer if NAME isn't a command name. */
|
||||
COMMAND *
|
||||
find_command (name)
|
||||
char *name;
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; commands[i].name; i++)
|
||||
if (strcmp (name, commands[i].name) == 0)
|
||||
return (&commands[i]);
|
||||
|
||||
return ((COMMAND *)NULL);
|
||||
}
|
||||
|
||||
/* Strip whitespace from the start and end of STRING. Return a pointer
|
||||
into STRING. */
|
||||
char *
|
||||
stripwhite (string)
|
||||
char *string;
|
||||
{
|
||||
register char *s, *t;
|
||||
|
||||
for (s = string; whitespace (*s); s++)
|
||||
;
|
||||
|
||||
if (*s == 0)
|
||||
return (s);
|
||||
|
||||
t = s + strlen (s) - 1;
|
||||
while (t > s && whitespace (*t))
|
||||
t--;
|
||||
*++t = '\0';
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Interface to Readline Completion */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
char *command_generator ();
|
||||
char **fileman_completion ();
|
||||
|
||||
/* Tell the GNU Readline library how to complete. We want to try to complete
|
||||
on command names if this is the first word in the line, or on filenames
|
||||
if not. */
|
||||
initialize_readline ()
|
||||
{
|
||||
/* Allow conditional parsing of the ~/.inputrc file. */
|
||||
rl_readline_name = "FileMan";
|
||||
|
||||
/* Tell the completer that we want a crack first. */
|
||||
rl_attempted_completion_function = (CPPFunction *)fileman_completion;
|
||||
}
|
||||
|
||||
/* Attempt to complete on the contents of TEXT. START and END bound the
|
||||
region of rl_line_buffer that contains the word to complete. TEXT is
|
||||
the word to complete. We can use the entire contents of rl_line_buffer
|
||||
in case we want to do some simple parsing. Return the array of matches,
|
||||
or NULL if there aren't any. */
|
||||
char **
|
||||
fileman_completion (text, start, end)
|
||||
char *text;
|
||||
int start, end;
|
||||
{
|
||||
char **matches;
|
||||
|
||||
matches = (char **)NULL;
|
||||
|
||||
/* If this word is at the start of the line, then it is a command
|
||||
to complete. Otherwise it is the name of a file in the current
|
||||
directory. */
|
||||
if (start == 0)
|
||||
matches = completion_matches (text, command_generator);
|
||||
|
||||
return (matches);
|
||||
}
|
||||
|
||||
/* Generator function for command completion. STATE lets us know whether
|
||||
to start from scratch; without any state (i.e. STATE == 0), then we
|
||||
start at the top of the list. */
|
||||
char *
|
||||
command_generator (text, state)
|
||||
char *text;
|
||||
int state;
|
||||
{
|
||||
static int list_index, len;
|
||||
char *name;
|
||||
|
||||
/* If this is a new word to complete, initialize now. This includes
|
||||
saving the length of TEXT for efficiency, and initializing the index
|
||||
variable to 0. */
|
||||
if (!state)
|
||||
{
|
||||
list_index = 0;
|
||||
len = strlen (text);
|
||||
}
|
||||
|
||||
/* Return the next name which partially matches from the command list. */
|
||||
while (name = commands[list_index].name)
|
||||
{
|
||||
list_index++;
|
||||
|
||||
if (strncmp (name, text, len) == 0)
|
||||
return (dupstr(name));
|
||||
}
|
||||
|
||||
/* If no names matched, then return NULL. */
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* FileMan Commands */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* String to pass to system (). This is for the LIST, VIEW and RENAME
|
||||
commands. */
|
||||
static char syscom[1024];
|
||||
|
||||
/* List the file(s) named in arg. */
|
||||
com_list (arg)
|
||||
char *arg;
|
||||
{
|
||||
if (!arg)
|
||||
arg = "";
|
||||
|
||||
sprintf (syscom, "ls -FClg %s", arg);
|
||||
return (system (syscom));
|
||||
}
|
||||
|
||||
com_view (arg)
|
||||
char *arg;
|
||||
{
|
||||
if (!valid_argument ("view", arg))
|
||||
return 1;
|
||||
|
||||
sprintf (syscom, "more %s", arg);
|
||||
return (system (syscom));
|
||||
}
|
||||
|
||||
com_rename (arg)
|
||||
char *arg;
|
||||
{
|
||||
too_dangerous ("rename");
|
||||
return (1);
|
||||
}
|
||||
|
||||
com_stat (arg)
|
||||
char *arg;
|
||||
{
|
||||
struct stat finfo;
|
||||
|
||||
if (!valid_argument ("stat", arg))
|
||||
return (1);
|
||||
|
||||
if (stat (arg, &finfo) == -1)
|
||||
{
|
||||
perror (arg);
|
||||
return (1);
|
||||
}
|
||||
|
||||
printf ("Statistics for `%s':\n", arg);
|
||||
|
||||
printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
|
||||
finfo.st_nlink,
|
||||
(finfo.st_nlink == 1) ? "" : "s",
|
||||
finfo.st_size,
|
||||
(finfo.st_size == 1) ? "" : "s");
|
||||
printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
|
||||
printf (" Last access at: %s", ctime (&finfo.st_atime));
|
||||
printf (" Last modified at: %s", ctime (&finfo.st_mtime));
|
||||
return (0);
|
||||
}
|
||||
|
||||
com_delete (arg)
|
||||
char *arg;
|
||||
{
|
||||
too_dangerous ("delete");
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Print out help for ARG, or for all of the commands if ARG is
|
||||
not present. */
|
||||
com_help (arg)
|
||||
char *arg;
|
||||
{
|
||||
register int i;
|
||||
int printed = 0;
|
||||
|
||||
for (i = 0; commands[i].name; i++)
|
||||
{
|
||||
if (!*arg || (strcmp (arg, commands[i].name) == 0))
|
||||
{
|
||||
printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
|
||||
printed++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!printed)
|
||||
{
|
||||
printf ("No commands match `%s'. Possibilties are:\n", arg);
|
||||
|
||||
for (i = 0; commands[i].name; i++)
|
||||
{
|
||||
/* Print in six columns. */
|
||||
if (printed == 6)
|
||||
{
|
||||
printed = 0;
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
printf ("%s\t", commands[i].name);
|
||||
printed++;
|
||||
}
|
||||
|
||||
if (printed)
|
||||
printf ("\n");
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Change to the directory ARG. */
|
||||
com_cd (arg)
|
||||
char *arg;
|
||||
{
|
||||
if (chdir (arg) == -1)
|
||||
{
|
||||
perror (arg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
com_pwd ("");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Print out the current working directory. */
|
||||
com_pwd (ignore)
|
||||
char *ignore;
|
||||
{
|
||||
char dir[1024], *s;
|
||||
|
||||
s = getwd (dir);
|
||||
if (s == 0)
|
||||
{
|
||||
printf ("Error getting pwd: %s\n", dir);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf ("Current directory is %s\n", dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The user wishes to quit using this program. Just set DONE non-zero. */
|
||||
com_quit (arg)
|
||||
char *arg;
|
||||
{
|
||||
done = 1;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Function which tells you that you can't do this. */
|
||||
too_dangerous (caller)
|
||||
char *caller;
|
||||
{
|
||||
fprintf (stderr,
|
||||
"%s: Too dangerous for me to distribute. Write it yourself.\n",
|
||||
caller);
|
||||
}
|
||||
|
||||
/* Return non-zero if ARG is a valid argument for CALLER, else print
|
||||
an error message and return zero. */
|
||||
int
|
||||
valid_argument (caller, arg)
|
||||
char *caller, *arg;
|
||||
{
|
||||
if (!arg || !*arg)
|
||||
{
|
||||
fprintf (stderr, "%s: Argument required.\n", caller);
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
main ()
|
||||
{
|
||||
char line[1024], *t;
|
||||
int len, done = 0;
|
||||
|
||||
line[0] = 0;
|
||||
|
||||
using_history ();
|
||||
while (!done)
|
||||
{
|
||||
printf ("history$ ");
|
||||
fflush (stdout);
|
||||
t = fgets (line, sizeof (line) - 1, stdin);
|
||||
if (t && *t)
|
||||
{
|
||||
len = strlen (t);
|
||||
if (t[len - 1] == '\n')
|
||||
t[len - 1] = '\0';
|
||||
}
|
||||
|
||||
if (!t)
|
||||
strcpy (line, "quit");
|
||||
|
||||
if (line[0])
|
||||
{
|
||||
char *expansion;
|
||||
int result;
|
||||
|
||||
using_history ();
|
||||
|
||||
result = history_expand (line, &expansion);
|
||||
if (result)
|
||||
fprintf (stderr, "%s\n", expansion);
|
||||
|
||||
if (result < 0 || result == 2)
|
||||
{
|
||||
free (expansion);
|
||||
continue;
|
||||
}
|
||||
|
||||
add_history (expansion);
|
||||
strncpy (line, expansion, sizeof (line) - 1);
|
||||
free (expansion);
|
||||
}
|
||||
|
||||
if (strcmp (line, "quit") == 0)
|
||||
done = 1;
|
||||
else if (strcmp (line, "save") == 0)
|
||||
write_history ("history_file");
|
||||
else if (strcmp (line, "read") == 0)
|
||||
read_history ("history_file");
|
||||
else if (strcmp (line, "list") == 0)
|
||||
{
|
||||
register HIST_ENTRY **the_list;
|
||||
register int i;
|
||||
|
||||
the_list = history_list ();
|
||||
if (the_list)
|
||||
for (i = 0; the_list[i]; i++)
|
||||
printf ("%d: %s\n", i + history_base, the_list[i]->line);
|
||||
}
|
||||
else if (strncmp (line, "delete", 6) == 0)
|
||||
{
|
||||
int which;
|
||||
if ((sscanf (line + 6, "%d", &which)) == 1)
|
||||
{
|
||||
HIST_ENTRY *entry = remove_history (which);
|
||||
if (!entry)
|
||||
fprintf (stderr, "No such entry %d\n", which);
|
||||
else
|
||||
{
|
||||
free (entry->line);
|
||||
free (entry);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "non-numeric arg given to `delete'\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
/* manexamp.c -- The examples which appear in the documentation are here. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <readline/readline.h>
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
* How to Emulate gets () */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* A static variable for holding the line. */
|
||||
static char *line_read = (char *)NULL;
|
||||
|
||||
/* Read a string, and return a pointer to it. Returns NULL on EOF. */
|
||||
char *
|
||||
rl_gets ()
|
||||
{
|
||||
/* If the buffer has already been allocated, return the memory
|
||||
to the free pool. */
|
||||
if (line_read)
|
||||
{
|
||||
free (line_read);
|
||||
line_read = (char *)NULL;
|
||||
}
|
||||
|
||||
/* Get a line from the user. */
|
||||
line_read = readline ("");
|
||||
|
||||
/* If the line has any text in it, save it on the history. */
|
||||
if (line_read && *line_read)
|
||||
add_history (line_read);
|
||||
|
||||
return (line_read);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Writing a Function to be Called by Readline. */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Invert the case of the COUNT following characters. */
|
||||
invert_case_line (count, key)
|
||||
int count, key;
|
||||
{
|
||||
register int start, end;
|
||||
|
||||
start = rl_point;
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
direction = -1;
|
||||
count = -count;
|
||||
}
|
||||
else
|
||||
direction = 1;
|
||||
|
||||
/* Find the end of the range to modify. */
|
||||
end = start + (count * direction);
|
||||
|
||||
/* Force it to be within range. */
|
||||
if (end > rl_end)
|
||||
end = rl_end;
|
||||
else if (end < 0)
|
||||
end = -1;
|
||||
|
||||
if (start > end)
|
||||
{
|
||||
int temp = start;
|
||||
start = end;
|
||||
end = temp;
|
||||
}
|
||||
|
||||
if (start == end)
|
||||
return;
|
||||
|
||||
/* Tell readline that we are modifying the line, so save the undo
|
||||
information. */
|
||||
rl_modifying (start, end);
|
||||
|
||||
for (; start != end; start += direction)
|
||||
{
|
||||
if (uppercase_p (rl_line_buffer[start]))
|
||||
rl_line_buffer[start] = to_lower (rl_line_buffer[start]);
|
||||
else if (lowercase_p (rl_line_buffer[start]))
|
||||
rl_line_buffer[start] = to_upper (rl_line_buffer[start]);
|
||||
}
|
||||
|
||||
/* Move point to on top of the last character changed. */
|
||||
rl_point = end - direction;
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Testing Readline */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "../readline.h"
|
||||
#include "../history.h"
|
||||
|
||||
main ()
|
||||
{
|
||||
HIST_ENTRY **history_list ();
|
||||
char *temp = (char *)NULL;
|
||||
char *prompt = "readline$ ";
|
||||
int done = 0;
|
||||
|
||||
while (!done)
|
||||
{
|
||||
temp = readline (prompt);
|
||||
|
||||
/* Test for EOF. */
|
||||
if (!temp)
|
||||
exit (1);
|
||||
|
||||
/* If there is anything on the line, print it and remember it. */
|
||||
if (*temp)
|
||||
{
|
||||
fprintf (stderr, "%s\r\n", temp);
|
||||
add_history (temp);
|
||||
}
|
||||
|
||||
/* Check for `command' that we handle. */
|
||||
if (strcmp (temp, "quit") == 0)
|
||||
done = 1;
|
||||
|
||||
if (strcmp (temp, "list") == 0)
|
||||
{
|
||||
HIST_ENTRY **list = history_list ();
|
||||
register int i;
|
||||
if (list)
|
||||
{
|
||||
for (i = 0; list[i]; i++)
|
||||
{
|
||||
fprintf (stderr, "%d: %s\r\n", i, list[i]->line);
|
||||
free (list[i]->line);
|
||||
}
|
||||
free (list);
|
||||
}
|
||||
}
|
||||
free (temp);
|
||||
}
|
||||
}
|
||||
@@ -1,247 +0,0 @@
|
||||
/* funmap.c -- attach names to functions. */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
#if !defined (BUFSIZ)
|
||||
#include <stdio.h>
|
||||
#endif /* BUFSIZ */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include "rlconf.h"
|
||||
#include "readline.h"
|
||||
|
||||
extern int _rl_qsort_string_compare ();
|
||||
|
||||
FUNMAP **funmap;
|
||||
static int funmap_size;
|
||||
static int funmap_entry;
|
||||
|
||||
/* After initializing the function map, this is the index of the first
|
||||
program specific function. */
|
||||
int funmap_program_specific_entry_start;
|
||||
|
||||
static FUNMAP default_funmap[] = {
|
||||
{ "abort", rl_abort },
|
||||
{ "accept-line", rl_newline },
|
||||
{ "arrow-key-prefix", rl_arrow_keys },
|
||||
{ "backward-char", rl_backward },
|
||||
{ "backward-delete-char", rl_rubout },
|
||||
{ "backward-kill-line", rl_backward_kill_line },
|
||||
{ "backward-kill-word", rl_backward_kill_word },
|
||||
{ "backward-word", rl_backward_word },
|
||||
{ "beginning-of-history", rl_beginning_of_history },
|
||||
{ "beginning-of-line", rl_beg_of_line },
|
||||
{ "call-last-kbd-macro", rl_call_last_kbd_macro },
|
||||
{ "capitalize-word", rl_capitalize_word },
|
||||
{ "character-search", rl_char_search },
|
||||
{ "character-search-backward", rl_backward_char_search },
|
||||
{ "clear-screen", rl_clear_screen },
|
||||
{ "complete", rl_complete },
|
||||
{ "copy-backward-word", rl_copy_backward_word },
|
||||
{ "copy-forward-word", rl_copy_forward_word },
|
||||
{ "copy-region-as-kill", rl_copy_region_to_kill },
|
||||
{ "delete-char", rl_delete },
|
||||
{ "delete-horizontal-space", rl_delete_horizontal_space },
|
||||
{ "digit-argument", rl_digit_argument },
|
||||
{ "do-lowercase-version", rl_do_lowercase_version },
|
||||
{ "downcase-word", rl_downcase_word },
|
||||
{ "dump-functions", rl_dump_functions },
|
||||
{ "dump-variables", rl_dump_variables },
|
||||
{ "emacs-editing-mode", rl_emacs_editing_mode },
|
||||
{ "end-kbd-macro", rl_end_kbd_macro },
|
||||
{ "end-of-history", rl_end_of_history },
|
||||
{ "end-of-line", rl_end_of_line },
|
||||
{ "exchange-point-and-mark", rl_exchange_point_and_mark },
|
||||
{ "forward-char", rl_forward },
|
||||
{ "forward-search-history", rl_forward_search_history },
|
||||
{ "forward-word", rl_forward_word },
|
||||
{ "history-search-backward", rl_history_search_backward },
|
||||
{ "history-search-forward", rl_history_search_forward },
|
||||
{ "insert-comment", rl_insert_comment },
|
||||
{ "insert-completions", rl_insert_completions },
|
||||
{ "kill-whole-line", rl_kill_full_line },
|
||||
{ "kill-line", rl_kill_line },
|
||||
{ "kill-region", rl_kill_region },
|
||||
{ "kill-word", rl_kill_word },
|
||||
{ "next-history", rl_get_next_history },
|
||||
{ "non-incremental-forward-search-history", rl_noninc_forward_search },
|
||||
{ "non-incremental-reverse-search-history", rl_noninc_reverse_search },
|
||||
{ "non-incremental-forward-search-history-again", rl_noninc_forward_search_again },
|
||||
{ "non-incremental-reverse-search-history-again", rl_noninc_reverse_search_again },
|
||||
{ "possible-completions", rl_possible_completions },
|
||||
{ "previous-history", rl_get_previous_history },
|
||||
{ "quoted-insert", rl_quoted_insert },
|
||||
{ "re-read-init-file", rl_re_read_init_file },
|
||||
{ "redraw-current-line", rl_refresh_line},
|
||||
{ "reverse-search-history", rl_reverse_search_history },
|
||||
{ "revert-line", rl_revert_line },
|
||||
{ "self-insert", rl_insert },
|
||||
{ "set-mark", rl_set_mark },
|
||||
{ "start-kbd-macro", rl_start_kbd_macro },
|
||||
{ "tab-insert", rl_tab_insert },
|
||||
{ "tilde-expand", rl_tilde_expand },
|
||||
{ "transpose-chars", rl_transpose_chars },
|
||||
{ "transpose-words", rl_transpose_words },
|
||||
{ "tty-status", rl_tty_status },
|
||||
{ "undo", rl_undo_command },
|
||||
{ "universal-argument", rl_universal_argument },
|
||||
{ "unix-line-discard", rl_unix_line_discard },
|
||||
{ "unix-word-rubout", rl_unix_word_rubout },
|
||||
{ "upcase-word", rl_upcase_word },
|
||||
{ "yank", rl_yank },
|
||||
{ "yank-last-arg", rl_yank_last_arg },
|
||||
{ "yank-nth-arg", rl_yank_nth_arg },
|
||||
{ "yank-pop", rl_yank_pop },
|
||||
|
||||
#if defined (VI_MODE)
|
||||
{ "vi-append-eol", rl_vi_append_eol },
|
||||
{ "vi-append-mode", rl_vi_append_mode },
|
||||
{ "vi-arg-digit", rl_vi_arg_digit },
|
||||
{ "vi-back-to-indent", rl_vi_back_to_indent },
|
||||
{ "vi-bWord", rl_vi_bWord },
|
||||
{ "vi-bracktype", rl_vi_bracktype },
|
||||
{ "vi-bword", rl_vi_bword },
|
||||
{ "vi-change-case", rl_vi_change_case },
|
||||
{ "vi-change-char", rl_vi_change_char },
|
||||
{ "vi-change-to", rl_vi_change_to },
|
||||
{ "vi-char-search", rl_vi_char_search },
|
||||
{ "vi-column", rl_vi_column },
|
||||
{ "vi-complete", rl_vi_complete },
|
||||
{ "vi-delete", rl_vi_delete },
|
||||
{ "vi-delete-to", rl_vi_delete_to },
|
||||
{ "vi-eWord", rl_vi_eWord },
|
||||
{ "vi-editing-mode", rl_vi_editing_mode },
|
||||
{ "vi-end-word", rl_vi_end_word },
|
||||
{ "vi-eof-maybe", rl_vi_eof_maybe },
|
||||
{ "vi-eword", rl_vi_eword },
|
||||
{ "vi-fWord", rl_vi_fWord },
|
||||
{ "vi-fetch-history", rl_vi_fetch_history },
|
||||
{ "vi-first-print", rl_vi_first_print },
|
||||
{ "vi-fword", rl_vi_fword },
|
||||
{ "vi-goto-mark", rl_vi_goto_mark },
|
||||
{ "vi-insert-beg", rl_vi_insert_beg },
|
||||
{ "vi-insertion-mode", rl_vi_insertion_mode },
|
||||
{ "vi-match", rl_vi_match },
|
||||
{ "vi-movement-mode", rl_vi_movement_mode },
|
||||
{ "vi-next-word", rl_vi_next_word },
|
||||
{ "vi-overstrike", rl_vi_overstrike },
|
||||
{ "vi-overstrike-delete", rl_vi_overstrike_delete },
|
||||
{ "vi-prev-word", rl_vi_prev_word },
|
||||
{ "vi-put", rl_vi_put },
|
||||
{ "vi-redo", rl_vi_redo },
|
||||
{ "vi-replace", rl_vi_replace },
|
||||
{ "vi-search", rl_vi_search },
|
||||
{ "vi-search-again", rl_vi_search_again },
|
||||
{ "vi-set-mark", rl_vi_set_mark },
|
||||
{ "vi-subst", rl_vi_subst },
|
||||
{ "vi-tilde-expand", rl_vi_tilde_expand },
|
||||
{ "vi-yank-arg", rl_vi_yank_arg },
|
||||
{ "vi-yank-to", rl_vi_yank_to },
|
||||
#endif /* VI_MODE */
|
||||
|
||||
{(char *)NULL, (Function *)NULL }
|
||||
};
|
||||
|
||||
int
|
||||
rl_add_funmap_entry (name, function)
|
||||
char *name;
|
||||
Function *function;
|
||||
{
|
||||
if (funmap_entry + 2 >= funmap_size)
|
||||
{
|
||||
funmap_size += 64;
|
||||
funmap = (FUNMAP **)xrealloc (funmap, funmap_size * sizeof (FUNMAP *));
|
||||
}
|
||||
|
||||
funmap[funmap_entry] = (FUNMAP *)xmalloc (sizeof (FUNMAP));
|
||||
funmap[funmap_entry]->name = name;
|
||||
funmap[funmap_entry]->function = function;
|
||||
|
||||
funmap[++funmap_entry] = (FUNMAP *)NULL;
|
||||
return funmap_entry;
|
||||
}
|
||||
|
||||
static int funmap_initialized;
|
||||
|
||||
/* Make the funmap contain all of the default entries. */
|
||||
void
|
||||
rl_initialize_funmap ()
|
||||
{
|
||||
register int i;
|
||||
|
||||
if (funmap_initialized)
|
||||
return;
|
||||
|
||||
for (i = 0; default_funmap[i].name; i++)
|
||||
rl_add_funmap_entry (default_funmap[i].name, default_funmap[i].function);
|
||||
|
||||
funmap_initialized = 1;
|
||||
funmap_program_specific_entry_start = i;
|
||||
}
|
||||
|
||||
/* Produce a NULL terminated array of known function names. The array
|
||||
is sorted. The array itself is allocated, but not the strings inside.
|
||||
You should free () the array when you done, but not the pointrs. */
|
||||
char **
|
||||
rl_funmap_names ()
|
||||
{
|
||||
char **result;
|
||||
int result_size, result_index;
|
||||
|
||||
/* Make sure that the function map has been initialized. */
|
||||
rl_initialize_funmap ();
|
||||
|
||||
for (result_index = result_size = 0, result = (char **)NULL; funmap[result_index]; result_index++)
|
||||
{
|
||||
if (result_index + 2 > result_size)
|
||||
{
|
||||
result_size += 20;
|
||||
result = (char **)xrealloc (result, result_size * sizeof (char *));
|
||||
}
|
||||
|
||||
result[result_index] = funmap[result_index]->name;
|
||||
result[result_index + 1] = (char *)NULL;
|
||||
}
|
||||
|
||||
qsort (result, result_index, sizeof (char *), _rl_qsort_string_compare);
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Things that mean `Control'. */
|
||||
char *possible_control_prefixes[] = {
|
||||
"Control-", "C-", "CTRL-", (char *)NULL
|
||||
};
|
||||
|
||||
char *possible_meta_prefixes[] = {
|
||||
"Meta", "M-", (char *)NULL
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,324 +0,0 @@
|
||||
/* histfile.c - functions to manipulate the history file. */
|
||||
|
||||
/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the GNU History Library (the Library), a set of
|
||||
routines for managing the text of previously typed lines.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* The goal is to make the implementation transparent, so that you
|
||||
don't have to know what data types are used, just what functions
|
||||
you can call. I think I have done that. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#include <errno.h>
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
#include "history.h"
|
||||
#include "histlib.h"
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
/* Return the string that should be used in the place of this
|
||||
filename. This only matters when you don't specify the
|
||||
filename to read_history (), or write_history (). */
|
||||
static char *
|
||||
history_filename (filename)
|
||||
char *filename;
|
||||
{
|
||||
char *return_val, *home;
|
||||
int home_len;
|
||||
|
||||
return_val = filename ? savestring (filename) : (char *)NULL;
|
||||
|
||||
if (return_val)
|
||||
return (return_val);
|
||||
|
||||
home = getenv ("HOME");
|
||||
|
||||
if (home == 0)
|
||||
{
|
||||
home = ".";
|
||||
home_len = 1;
|
||||
}
|
||||
else
|
||||
home_len = strlen (home);
|
||||
|
||||
return_val = xmalloc (2 + home_len + 8); /* strlen(".history") == 8 */
|
||||
strcpy (return_val, home);
|
||||
return_val[home_len] = '/';
|
||||
strcpy (return_val + home_len + 1, ".history");
|
||||
|
||||
return (return_val);
|
||||
}
|
||||
|
||||
/* Add the contents of FILENAME to the history list, a line at a time.
|
||||
If FILENAME is NULL, then read from ~/.history. Returns 0 if
|
||||
successful, or errno if not. */
|
||||
int
|
||||
read_history (filename)
|
||||
char *filename;
|
||||
{
|
||||
return (read_history_range (filename, 0, -1));
|
||||
}
|
||||
|
||||
/* Read a range of lines from FILENAME, adding them to the history list.
|
||||
Start reading at the FROM'th line and end at the TO'th. If FROM
|
||||
is zero, start at the beginning. If TO is less than FROM, read
|
||||
until the end of the file. If FILENAME is NULL, then read from
|
||||
~/.history. Returns 0 if successful, or errno if not. */
|
||||
int
|
||||
read_history_range (filename, from, to)
|
||||
char *filename;
|
||||
int from, to;
|
||||
{
|
||||
register int line_start, line_end;
|
||||
char *input, *buffer = (char *)NULL;
|
||||
int file, current_line;
|
||||
struct stat finfo;
|
||||
|
||||
input = history_filename (filename);
|
||||
file = open (input, O_RDONLY, 0666);
|
||||
|
||||
if ((file < 0) || (fstat (file, &finfo) == -1))
|
||||
goto error_and_exit;
|
||||
|
||||
buffer = xmalloc ((int)finfo.st_size + 1);
|
||||
|
||||
if (read (file, buffer, finfo.st_size) != finfo.st_size)
|
||||
{
|
||||
error_and_exit:
|
||||
if (file >= 0)
|
||||
close (file);
|
||||
|
||||
FREE (input);
|
||||
FREE (buffer);
|
||||
|
||||
return (errno);
|
||||
}
|
||||
|
||||
close (file);
|
||||
|
||||
/* Set TO to larger than end of file if negative. */
|
||||
if (to < 0)
|
||||
to = finfo.st_size;
|
||||
|
||||
/* Start at beginning of file, work to end. */
|
||||
line_start = line_end = current_line = 0;
|
||||
|
||||
/* Skip lines until we are at FROM. */
|
||||
while (line_start < finfo.st_size && current_line < from)
|
||||
{
|
||||
for (line_end = line_start; line_end < finfo.st_size; line_end++)
|
||||
if (buffer[line_end] == '\n')
|
||||
{
|
||||
current_line++;
|
||||
line_start = line_end + 1;
|
||||
if (current_line == from)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If there are lines left to gobble, then gobble them now. */
|
||||
for (line_end = line_start; line_end < finfo.st_size; line_end++)
|
||||
if (buffer[line_end] == '\n')
|
||||
{
|
||||
buffer[line_end] = '\0';
|
||||
|
||||
if (buffer[line_start])
|
||||
add_history (buffer + line_start);
|
||||
|
||||
current_line++;
|
||||
|
||||
if (current_line >= to)
|
||||
break;
|
||||
|
||||
line_start = line_end + 1;
|
||||
}
|
||||
|
||||
FREE (input);
|
||||
FREE (buffer);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Truncate the history file FNAME, leaving only LINES trailing lines.
|
||||
If FNAME is NULL, then use ~/.history. */
|
||||
int
|
||||
history_truncate_file (fname, lines)
|
||||
char *fname;
|
||||
register int lines;
|
||||
{
|
||||
register int i;
|
||||
int file, chars_read;
|
||||
char *buffer = (char *)NULL, *filename;
|
||||
struct stat finfo;
|
||||
|
||||
filename = history_filename (fname);
|
||||
file = open (filename, O_RDONLY, 0666);
|
||||
|
||||
if (file == -1 || fstat (file, &finfo) == -1)
|
||||
goto truncate_exit;
|
||||
|
||||
buffer = xmalloc ((int)finfo.st_size + 1);
|
||||
chars_read = read (file, buffer, finfo.st_size);
|
||||
close (file);
|
||||
|
||||
if (chars_read <= 0)
|
||||
goto truncate_exit;
|
||||
|
||||
/* Count backwards from the end of buffer until we have passed
|
||||
LINES lines. */
|
||||
for (i = chars_read - 1; lines && i; i--)
|
||||
{
|
||||
if (buffer[i] == '\n')
|
||||
lines--;
|
||||
}
|
||||
|
||||
/* If this is the first line, then the file contains exactly the
|
||||
number of lines we want to truncate to, so we don't need to do
|
||||
anything. It's the first line if we don't find a newline between
|
||||
the current value of i and 0. Otherwise, write from the start of
|
||||
this line until the end of the buffer. */
|
||||
for ( ; i; i--)
|
||||
if (buffer[i] == '\n')
|
||||
{
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Write only if there are more lines in the file than we want to
|
||||
truncate to. */
|
||||
if (i && ((file = open (filename, O_WRONLY|O_TRUNC, 0666)) != -1))
|
||||
{
|
||||
write (file, buffer + i, finfo.st_size - i);
|
||||
close (file);
|
||||
}
|
||||
|
||||
truncate_exit:
|
||||
|
||||
FREE (buffer);
|
||||
|
||||
free (filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Workhorse function for writing history. Writes NELEMENT entries
|
||||
from the history list to FILENAME. OVERWRITE is non-zero if you
|
||||
wish to replace FILENAME with the entries. */
|
||||
static int
|
||||
history_do_write (filename, nelements, overwrite)
|
||||
char *filename;
|
||||
int nelements, overwrite;
|
||||
{
|
||||
register int i;
|
||||
char *output = history_filename (filename);
|
||||
int file, mode;
|
||||
|
||||
mode = overwrite ? O_WRONLY | O_CREAT | O_TRUNC : O_WRONLY | O_APPEND;
|
||||
|
||||
if ((file = open (output, mode, 0666)) == -1)
|
||||
{
|
||||
FREE (output);
|
||||
return (errno);
|
||||
}
|
||||
|
||||
if (nelements > history_length)
|
||||
nelements = history_length;
|
||||
|
||||
/* Build a buffer of all the lines to write, and write them in one syscall.
|
||||
Suggested by Peter Ho ([email protected]). */
|
||||
{
|
||||
HIST_ENTRY **the_history; /* local */
|
||||
register int j;
|
||||
int buffer_size;
|
||||
char *buffer;
|
||||
|
||||
the_history = history_list ();
|
||||
/* Calculate the total number of bytes to write. */
|
||||
for (buffer_size = 0, i = history_length - nelements; i < history_length; i++)
|
||||
buffer_size += 1 + strlen (the_history[i]->line);
|
||||
|
||||
/* Allocate the buffer, and fill it. */
|
||||
buffer = xmalloc (buffer_size);
|
||||
|
||||
for (j = 0, i = history_length - nelements; i < history_length; i++)
|
||||
{
|
||||
strcpy (buffer + j, the_history[i]->line);
|
||||
j += strlen (the_history[i]->line);
|
||||
buffer[j++] = '\n';
|
||||
}
|
||||
|
||||
write (file, buffer, buffer_size);
|
||||
free (buffer);
|
||||
}
|
||||
|
||||
close (file);
|
||||
|
||||
FREE (output);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Append NELEMENT entries to FILENAME. The entries appended are from
|
||||
the end of the list minus NELEMENTs up to the end of the list. */
|
||||
int
|
||||
append_history (nelements, filename)
|
||||
int nelements;
|
||||
char *filename;
|
||||
{
|
||||
return (history_do_write (filename, nelements, HISTORY_APPEND));
|
||||
}
|
||||
|
||||
/* Overwrite FILENAME with the current history. If FILENAME is NULL,
|
||||
then write the history list to ~/.history. Values returned
|
||||
are as in read_history ().*/
|
||||
int
|
||||
write_history (filename)
|
||||
char *filename;
|
||||
{
|
||||
return (history_do_write (filename, history_length, HISTORY_OVERWRITE));
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/* histlib.h -- internal definitions for the history library. */
|
||||
/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the GNU History Library (the Library), a set of
|
||||
routines for managing the text of previously typed lines.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (_HISTLIB_H_)
|
||||
#define _HISTLIB_H_
|
||||
|
||||
/* Function pointers can be declared as (Function *)foo. */
|
||||
#if !defined (_FUNCTION_DEF)
|
||||
# define _FUNCTION_DEF
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
typedef char *CPFunction ();
|
||||
typedef char **CPPFunction ();
|
||||
#endif /* _FUNCTION_DEF */
|
||||
|
||||
#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
|
||||
#define STREQN(a, b, n) (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
|
||||
|
||||
#ifndef savestring
|
||||
# ifndef strcpy
|
||||
extern char *strcpy ();
|
||||
# endif
|
||||
#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
|
||||
#endif
|
||||
|
||||
#ifndef whitespace
|
||||
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
|
||||
#endif
|
||||
|
||||
#ifndef _rl_digit_p
|
||||
#define _rl_digit_p(c) ((c) >= '0' && (c) <= '9')
|
||||
#endif
|
||||
|
||||
#ifndef _rl_digit_value
|
||||
#define _rl_digit_value(c) ((c) - '0')
|
||||
#endif
|
||||
|
||||
#ifndef member
|
||||
# ifndef strchr
|
||||
extern char *strchr ();
|
||||
# endif
|
||||
#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
|
||||
#endif
|
||||
|
||||
#ifndef FREE
|
||||
# define FREE(x) if (x) free (x)
|
||||
#endif
|
||||
|
||||
/* Possible history errors passed to hist_error. */
|
||||
#define EVENT_NOT_FOUND 0
|
||||
#define BAD_WORD_SPEC 1
|
||||
#define SUBST_FAILED 2
|
||||
#define BAD_MODIFIER 3
|
||||
|
||||
/* Possible definitions for history starting point specification. */
|
||||
#define ANCHORED_SEARCH 1
|
||||
#define NON_ANCHORED_SEARCH 0
|
||||
|
||||
/* Possible definitions for what style of writing the history file we want. */
|
||||
#define HISTORY_APPEND 0
|
||||
#define HISTORY_OVERWRITE 1
|
||||
|
||||
#endif /* !_HISTLIB_H_ */
|
||||
@@ -1,385 +0,0 @@
|
||||
/* History.c -- standalone history library */
|
||||
|
||||
/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the GNU History Library (the Library), a set of
|
||||
routines for managing the text of previously typed lines.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* The goal is to make the implementation transparent, so that you
|
||||
don't have to know what data types are used, just what functions
|
||||
you can call. I think I have done that. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#include "history.h"
|
||||
#include "histlib.h"
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
/* The number of slots to increase the_history by. */
|
||||
#define DEFAULT_HISTORY_GROW_SIZE 50
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* History Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* An array of HIST_ENTRY. This is where we store the history. */
|
||||
static HIST_ENTRY **the_history = (HIST_ENTRY **)NULL;
|
||||
|
||||
/* Non-zero means that we have enforced a limit on the amount of
|
||||
history that we save. */
|
||||
static int history_stifled;
|
||||
|
||||
/* If HISTORY_STIFLED is non-zero, then this is the maximum number of
|
||||
entries to remember. */
|
||||
int max_input_history;
|
||||
|
||||
/* The current location of the interactive history pointer. Just makes
|
||||
life easier for outside callers. */
|
||||
int history_offset;
|
||||
|
||||
/* The number of strings currently stored in the history list. */
|
||||
int history_length;
|
||||
|
||||
/* The current number of slots allocated to the input_history. */
|
||||
static int history_size;
|
||||
|
||||
/* The logical `base' of the history array. It defaults to 1. */
|
||||
int history_base = 1;
|
||||
|
||||
/* Return the current HISTORY_STATE of the history. */
|
||||
HISTORY_STATE *
|
||||
history_get_history_state ()
|
||||
{
|
||||
HISTORY_STATE *state;
|
||||
|
||||
state = (HISTORY_STATE *)xmalloc (sizeof (HISTORY_STATE));
|
||||
state->entries = the_history;
|
||||
state->offset = history_offset;
|
||||
state->length = history_length;
|
||||
state->size = history_size;
|
||||
state->flags = 0;
|
||||
if (history_stifled)
|
||||
state->flags |= HS_STIFLED;
|
||||
|
||||
return (state);
|
||||
}
|
||||
|
||||
/* Set the state of the current history array to STATE. */
|
||||
void
|
||||
history_set_history_state (state)
|
||||
HISTORY_STATE *state;
|
||||
{
|
||||
the_history = state->entries;
|
||||
history_offset = state->offset;
|
||||
history_length = state->length;
|
||||
history_size = state->size;
|
||||
if (state->flags & HS_STIFLED)
|
||||
history_stifled = 1;
|
||||
}
|
||||
|
||||
/* Begin a session in which the history functions might be used. This
|
||||
initializes interactive variables. */
|
||||
void
|
||||
using_history ()
|
||||
{
|
||||
history_offset = history_length;
|
||||
}
|
||||
|
||||
/* Return the number of bytes that the primary history entries are using.
|
||||
This just adds up the lengths of the_history->lines. */
|
||||
int
|
||||
history_total_bytes ()
|
||||
{
|
||||
register int i, result;
|
||||
|
||||
result = 0;
|
||||
|
||||
for (i = 0; the_history && the_history[i]; i++)
|
||||
result += strlen (the_history[i]->line);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Returns the magic number which says what history element we are
|
||||
looking at now. In this implementation, it returns history_offset. */
|
||||
int
|
||||
where_history ()
|
||||
{
|
||||
return (history_offset);
|
||||
}
|
||||
|
||||
/* Make the current history item be the one at POS, an absolute index.
|
||||
Returns zero if POS is out of range, else non-zero. */
|
||||
int
|
||||
history_set_pos (pos)
|
||||
int pos;
|
||||
{
|
||||
if (pos > history_length || pos < 0 || !the_history)
|
||||
return (0);
|
||||
history_offset = pos;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Return the current history array. The caller has to be carefull, since this
|
||||
is the actual array of data, and could be bashed or made corrupt easily.
|
||||
The array is terminated with a NULL pointer. */
|
||||
HIST_ENTRY **
|
||||
history_list ()
|
||||
{
|
||||
return (the_history);
|
||||
}
|
||||
|
||||
/* Return the history entry at the current position, as determined by
|
||||
history_offset. If there is no entry there, return a NULL pointer. */
|
||||
HIST_ENTRY *
|
||||
current_history ()
|
||||
{
|
||||
return ((history_offset == history_length) || the_history == 0)
|
||||
? (HIST_ENTRY *)NULL
|
||||
: the_history[history_offset];
|
||||
}
|
||||
|
||||
/* Back up history_offset to the previous history entry, and return
|
||||
a pointer to that entry. If there is no previous entry then return
|
||||
a NULL pointer. */
|
||||
HIST_ENTRY *
|
||||
previous_history ()
|
||||
{
|
||||
return history_offset ? the_history[--history_offset] : (HIST_ENTRY *)NULL;
|
||||
}
|
||||
|
||||
/* Move history_offset forward to the next history entry, and return
|
||||
a pointer to that entry. If there is no next entry then return a
|
||||
NULL pointer. */
|
||||
HIST_ENTRY *
|
||||
next_history ()
|
||||
{
|
||||
return (history_offset == history_length) ? (HIST_ENTRY *)NULL : the_history[++history_offset];
|
||||
}
|
||||
|
||||
/* Return the history entry which is logically at OFFSET in the history array.
|
||||
OFFSET is relative to history_base. */
|
||||
HIST_ENTRY *
|
||||
history_get (offset)
|
||||
int offset;
|
||||
{
|
||||
int local_index;
|
||||
|
||||
local_index = offset - history_base;
|
||||
return (local_index >= history_length || local_index < 0 || !the_history)
|
||||
? (HIST_ENTRY *)NULL
|
||||
: the_history[local_index];
|
||||
}
|
||||
|
||||
/* Place STRING at the end of the history list. The data field
|
||||
is set to NULL. */
|
||||
void
|
||||
add_history (string)
|
||||
char *string;
|
||||
{
|
||||
HIST_ENTRY *temp;
|
||||
|
||||
if (history_stifled && (history_length == max_input_history))
|
||||
{
|
||||
register int i;
|
||||
|
||||
/* If the history is stifled, and history_length is zero,
|
||||
and it equals max_input_history, we don't save items. */
|
||||
if (history_length == 0)
|
||||
return;
|
||||
|
||||
/* If there is something in the slot, then remove it. */
|
||||
if (the_history[0])
|
||||
{
|
||||
free (the_history[0]->line);
|
||||
free (the_history[0]);
|
||||
}
|
||||
|
||||
/* Copy the rest of the entries, moving down one slot. */
|
||||
for (i = 0; i < history_length; i++)
|
||||
the_history[i] = the_history[i + 1];
|
||||
|
||||
history_base++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (history_size == 0)
|
||||
{
|
||||
history_size = DEFAULT_HISTORY_GROW_SIZE;
|
||||
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
|
||||
history_length = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (history_length == (history_size - 1))
|
||||
{
|
||||
history_size += DEFAULT_HISTORY_GROW_SIZE;
|
||||
the_history = (HIST_ENTRY **)
|
||||
xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
|
||||
}
|
||||
history_length++;
|
||||
}
|
||||
}
|
||||
|
||||
temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
|
||||
temp->line = savestring (string);
|
||||
temp->data = (char *)NULL;
|
||||
|
||||
the_history[history_length] = (HIST_ENTRY *)NULL;
|
||||
the_history[history_length - 1] = temp;
|
||||
}
|
||||
|
||||
/* Make the history entry at WHICH have LINE and DATA. This returns
|
||||
the old entry so you can dispose of the data. In the case of an
|
||||
invalid WHICH, a NULL pointer is returned. */
|
||||
HIST_ENTRY *
|
||||
replace_history_entry (which, line, data)
|
||||
int which;
|
||||
char *line;
|
||||
char *data;
|
||||
{
|
||||
HIST_ENTRY *temp = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
|
||||
HIST_ENTRY *old_value;
|
||||
|
||||
if (which >= history_length)
|
||||
return ((HIST_ENTRY *)NULL);
|
||||
|
||||
old_value = the_history[which];
|
||||
|
||||
temp->line = savestring (line);
|
||||
temp->data = data;
|
||||
the_history[which] = temp;
|
||||
|
||||
return (old_value);
|
||||
}
|
||||
|
||||
/* Remove history element WHICH from the history. The removed
|
||||
element is returned to you so you can free the line, data,
|
||||
and containing structure. */
|
||||
HIST_ENTRY *
|
||||
remove_history (which)
|
||||
int which;
|
||||
{
|
||||
HIST_ENTRY *return_value;
|
||||
|
||||
if (which >= history_length || !history_length)
|
||||
return_value = (HIST_ENTRY *)NULL;
|
||||
else
|
||||
{
|
||||
register int i;
|
||||
return_value = the_history[which];
|
||||
|
||||
for (i = which; i < history_length; i++)
|
||||
the_history[i] = the_history[i + 1];
|
||||
|
||||
history_length--;
|
||||
}
|
||||
|
||||
return (return_value);
|
||||
}
|
||||
|
||||
/* Stifle the history list, remembering only MAX number of lines. */
|
||||
void
|
||||
stifle_history (max)
|
||||
int max;
|
||||
{
|
||||
if (max < 0)
|
||||
max = 0;
|
||||
|
||||
if (history_length > max)
|
||||
{
|
||||
register int i, j;
|
||||
|
||||
/* This loses because we cannot free the data. */
|
||||
for (i = 0, j = history_length - max; i < j; i++)
|
||||
{
|
||||
free (the_history[i]->line);
|
||||
free (the_history[i]);
|
||||
}
|
||||
|
||||
history_base = i;
|
||||
for (j = 0, i = history_length - max; j < max; i++, j++)
|
||||
the_history[j] = the_history[i];
|
||||
the_history[j] = (HIST_ENTRY *)NULL;
|
||||
history_length = j;
|
||||
}
|
||||
|
||||
history_stifled = 1;
|
||||
max_input_history = max;
|
||||
}
|
||||
|
||||
/* Stop stifling the history. This returns the previous amount the
|
||||
history was stifled by. The value is positive if the history was
|
||||
stifled, negative if it wasn't. */
|
||||
int
|
||||
unstifle_history ()
|
||||
{
|
||||
if (history_stifled)
|
||||
{
|
||||
history_stifled = 0;
|
||||
return (-max_input_history);
|
||||
}
|
||||
|
||||
return (max_input_history);
|
||||
}
|
||||
|
||||
int
|
||||
history_is_stifled ()
|
||||
{
|
||||
return (history_stifled);
|
||||
}
|
||||
|
||||
void
|
||||
clear_history ()
|
||||
{
|
||||
register int i;
|
||||
|
||||
/* This loses because we cannot free the data. */
|
||||
for (i = 0; i < history_length; i++)
|
||||
{
|
||||
free (the_history[i]->line);
|
||||
free (the_history[i]);
|
||||
the_history[i] = (HIST_ENTRY *)NULL;
|
||||
}
|
||||
|
||||
history_offset = history_length = 0;
|
||||
}
|
||||
@@ -1,210 +0,0 @@
|
||||
/* History.h -- the names of functions that you can call in history. */
|
||||
/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the GNU History Library (the Library), a set of
|
||||
routines for managing the text of previously typed lines.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef _HISTORY_H_
|
||||
#define _HISTORY_H_
|
||||
|
||||
/* The structure used to store a history entry. */
|
||||
typedef struct _hist_entry {
|
||||
char *line;
|
||||
char *data;
|
||||
} HIST_ENTRY;
|
||||
|
||||
/* A structure used to pass the current state of the history stuff around. */
|
||||
typedef struct _hist_state {
|
||||
HIST_ENTRY **entries; /* Pointer to the entries themselves. */
|
||||
int offset; /* The location pointer within this array. */
|
||||
int length; /* Number of elements within this array. */
|
||||
int size; /* Number of slots allocated to this array. */
|
||||
int flags;
|
||||
} HISTORY_STATE;
|
||||
|
||||
/* Flag values for the `flags' member of HISTORY_STATE. */
|
||||
#define HS_STIFLED 0x01
|
||||
|
||||
/* Initialization and state management. */
|
||||
|
||||
/* Begin a session in which the history functions might be used. This
|
||||
just initializes the interactive variables. */
|
||||
extern void using_history ();
|
||||
|
||||
/* Return the current HISTORY_STATE of the history. */
|
||||
extern HISTORY_STATE *history_get_history_state ();
|
||||
|
||||
/* Set the state of the current history array to STATE. */
|
||||
extern void history_set_history_state ();
|
||||
|
||||
/* Manage the history list. */
|
||||
|
||||
/* Place STRING at the end of the history list.
|
||||
The associated data field (if any) is set to NULL. */
|
||||
extern void add_history ();
|
||||
|
||||
/* A reasonably useless function, only here for completeness. WHICH
|
||||
is the magic number that tells us which element to delete. The
|
||||
elements are numbered from 0. */
|
||||
extern HIST_ENTRY *remove_history ();
|
||||
|
||||
/* Make the history entry at WHICH have LINE and DATA. This returns
|
||||
the old entry so you can dispose of the data. In the case of an
|
||||
invalid WHICH, a NULL pointer is returned. */
|
||||
extern HIST_ENTRY *replace_history_entry ();
|
||||
|
||||
/* Clear the history list and start over. */
|
||||
extern void clear_history ();
|
||||
|
||||
/* Stifle the history list, remembering only MAX number of entries. */
|
||||
extern void stifle_history ();
|
||||
|
||||
/* Stop stifling the history. This returns the previous amount the
|
||||
history was stifled by. The value is positive if the history was
|
||||
stifled, negative if it wasn't. */
|
||||
extern int unstifle_history ();
|
||||
|
||||
/* Return 1 if the history is stifled, 0 if it is not. */
|
||||
extern int history_is_stifled ();
|
||||
|
||||
/* Information about the history list. */
|
||||
|
||||
/* Return a NULL terminated array of HIST_ENTRY which is the current input
|
||||
history. Element 0 of this list is the beginning of time. If there
|
||||
is no history, return NULL. */
|
||||
extern HIST_ENTRY **history_list ();
|
||||
|
||||
/* Returns the number which says what history element we are now
|
||||
looking at. */
|
||||
extern int where_history ();
|
||||
|
||||
/* Return the history entry at the current position, as determined by
|
||||
history_offset. If there is no entry there, return a NULL pointer. */
|
||||
HIST_ENTRY *current_history ();
|
||||
|
||||
/* Return the history entry which is logically at OFFSET in the history
|
||||
array. OFFSET is relative to history_base. */
|
||||
extern HIST_ENTRY *history_get ();
|
||||
|
||||
/* Return the number of bytes that the primary history entries are using.
|
||||
This just adds up the lengths of the_history->lines. */
|
||||
extern int history_total_bytes ();
|
||||
|
||||
/* Moving around the history list. */
|
||||
|
||||
/* Set the position in the history list to POS. */
|
||||
int history_set_pos ();
|
||||
|
||||
/* Back up history_offset to the previous history entry, and return
|
||||
a pointer to that entry. If there is no previous entry, return
|
||||
a NULL pointer. */
|
||||
extern HIST_ENTRY *previous_history ();
|
||||
|
||||
/* Move history_offset forward to the next item in the input_history,
|
||||
and return the a pointer to that entry. If there is no next entry,
|
||||
return a NULL pointer. */
|
||||
extern HIST_ENTRY *next_history ();
|
||||
|
||||
/* Searching the history list. */
|
||||
|
||||
/* Search the history for STRING, starting at history_offset.
|
||||
If DIRECTION < 0, then the search is through previous entries,
|
||||
else through subsequent. If the string is found, then
|
||||
current_history () is the history entry, and the value of this function
|
||||
is the offset in the line of that history entry that the string was
|
||||
found in. Otherwise, nothing is changed, and a -1 is returned. */
|
||||
extern int history_search ();
|
||||
|
||||
/* Search the history for STRING, starting at history_offset.
|
||||
The search is anchored: matching lines must begin with string. */
|
||||
extern int history_search_prefix ();
|
||||
|
||||
/* Search for STRING in the history list, starting at POS, an
|
||||
absolute index into the list. DIR, if negative, says to search
|
||||
backwards from POS, else forwards.
|
||||
Returns the absolute index of the history element where STRING
|
||||
was found, or -1 otherwise. */
|
||||
extern int history_search_pos ();
|
||||
|
||||
/* Managing the history file. */
|
||||
|
||||
/* Add the contents of FILENAME to the history list, a line at a time.
|
||||
If FILENAME is NULL, then read from ~/.history. Returns 0 if
|
||||
successful, or errno if not. */
|
||||
extern int read_history ();
|
||||
|
||||
/* Read a range of lines from FILENAME, adding them to the history list.
|
||||
Start reading at the FROM'th line and end at the TO'th. If FROM
|
||||
is zero, start at the beginning. If TO is less than FROM, read
|
||||
until the end of the file. If FILENAME is NULL, then read from
|
||||
~/.history. Returns 0 if successful, or errno if not. */
|
||||
extern int read_history_range ();
|
||||
|
||||
/* Write the current history to FILENAME. If FILENAME is NULL,
|
||||
then write the history list to ~/.history. Values returned
|
||||
are as in read_history (). */
|
||||
extern int write_history ();
|
||||
|
||||
/* Append NELEMENT entries to FILENAME. The entries appended are from
|
||||
the end of the list minus NELEMENTs up to the end of the list. */
|
||||
int append_history ();
|
||||
|
||||
/* Truncate the history file, leaving only the last NLINES lines. */
|
||||
extern int history_truncate_file ();
|
||||
|
||||
/* History expansion. */
|
||||
|
||||
/* Expand the string STRING, placing the result into OUTPUT, a pointer
|
||||
to a string. Returns:
|
||||
|
||||
0) If no expansions took place (or, if the only change in
|
||||
the text was the de-slashifying of the history expansion
|
||||
character)
|
||||
1) If expansions did take place
|
||||
-1) If there was an error in expansion.
|
||||
2) If the returned line should just be printed.
|
||||
|
||||
If an error ocurred in expansion, then OUTPUT contains a descriptive
|
||||
error message. */
|
||||
extern int history_expand ();
|
||||
|
||||
/* Extract a string segment consisting of the FIRST through LAST
|
||||
arguments present in STRING. Arguments are broken up as in
|
||||
the shell. */
|
||||
extern char *history_arg_extract ();
|
||||
|
||||
/* Return the text of the history event beginning at the current
|
||||
offset into STRING. */
|
||||
extern char *get_history_event ();
|
||||
|
||||
/* Return an array of tokens, much as the shell might. The tokens are
|
||||
parsed out of STRING. */
|
||||
extern char **history_tokenize ();
|
||||
|
||||
/* Exported history variables. */
|
||||
extern int history_base;
|
||||
extern int history_length;
|
||||
extern int max_input_history;
|
||||
extern char history_expansion_char;
|
||||
extern char history_subst_char;
|
||||
extern char history_comment_char;
|
||||
extern char *history_no_expand_chars;
|
||||
extern char *history_search_delimiter_chars;
|
||||
extern int history_quotes_inhibit_expansion;
|
||||
|
||||
#endif /* !_HISTORY_H_ */
|
||||
@@ -1,197 +0,0 @@
|
||||
/* histsearch.c -- searching the history list. */
|
||||
|
||||
/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the GNU History Library (the Library), a set of
|
||||
routines for managing the text of previously typed lines.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#include "history.h"
|
||||
#include "histlib.h"
|
||||
|
||||
/* Variables imported from other history library files. */
|
||||
extern int history_offset;
|
||||
|
||||
/* The list of alternate characters that can delimit a history search
|
||||
string. */
|
||||
char *history_search_delimiter_chars = (char *)NULL;
|
||||
|
||||
/* Search the history for STRING, starting at history_offset.
|
||||
If DIRECTION < 0, then the search is through previous entries, else
|
||||
through subsequent. If ANCHORED is non-zero, the string must
|
||||
appear at the beginning of a history line, otherwise, the string
|
||||
may appear anywhere in the line. If the string is found, then
|
||||
current_history () is the history entry, and the value of this
|
||||
function is the offset in the line of that history entry that the
|
||||
string was found in. Otherwise, nothing is changed, and a -1 is
|
||||
returned. */
|
||||
|
||||
static int
|
||||
history_search_internal (string, direction, anchored)
|
||||
char *string;
|
||||
int direction, anchored;
|
||||
{
|
||||
register int i, reverse;
|
||||
register char *line;
|
||||
register int line_index;
|
||||
int string_len;
|
||||
HIST_ENTRY **the_history; /* local */
|
||||
|
||||
i = history_offset;
|
||||
reverse = (direction < 0);
|
||||
|
||||
/* Take care of trivial cases first. */
|
||||
if (string == 0 || *string == '\0')
|
||||
return (-1);
|
||||
|
||||
if (!history_length || ((i == history_length) && !reverse))
|
||||
return (-1);
|
||||
|
||||
if (reverse && (i == history_length))
|
||||
i--;
|
||||
|
||||
#define NEXT_LINE() do { if (reverse) i--; else i++; } while (0)
|
||||
|
||||
the_history = history_list ();
|
||||
string_len = strlen (string);
|
||||
while (1)
|
||||
{
|
||||
/* Search each line in the history list for STRING. */
|
||||
|
||||
/* At limit for direction? */
|
||||
if ((reverse && i < 0) || (!reverse && i == history_length))
|
||||
return (-1);
|
||||
|
||||
line = the_history[i]->line;
|
||||
line_index = strlen (line);
|
||||
|
||||
/* If STRING is longer than line, no match. */
|
||||
if (string_len > line_index)
|
||||
{
|
||||
NEXT_LINE ();
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Handle anchored searches first. */
|
||||
if (anchored == ANCHORED_SEARCH)
|
||||
{
|
||||
if (STREQN (string, line, string_len))
|
||||
{
|
||||
history_offset = i;
|
||||
return (0);
|
||||
}
|
||||
|
||||
NEXT_LINE ();
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Do substring search. */
|
||||
if (reverse)
|
||||
{
|
||||
line_index -= string_len;
|
||||
|
||||
while (line_index >= 0)
|
||||
{
|
||||
if (STREQN (string, line + line_index, string_len))
|
||||
{
|
||||
history_offset = i;
|
||||
return (line_index);
|
||||
}
|
||||
line_index--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
register int limit;
|
||||
|
||||
limit = line_index - string_len + 1;
|
||||
line_index = 0;
|
||||
|
||||
while (line_index < limit)
|
||||
{
|
||||
if (STREQN (string, line + line_index, string_len))
|
||||
{
|
||||
history_offset = i;
|
||||
return (line_index);
|
||||
}
|
||||
line_index++;
|
||||
}
|
||||
}
|
||||
NEXT_LINE ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Do a non-anchored search for STRING through the history in DIRECTION. */
|
||||
int
|
||||
history_search (string, direction)
|
||||
char *string;
|
||||
int direction;
|
||||
{
|
||||
return (history_search_internal (string, direction, NON_ANCHORED_SEARCH));
|
||||
}
|
||||
|
||||
/* Do an anchored search for string through the history in DIRECTION. */
|
||||
int
|
||||
history_search_prefix (string, direction)
|
||||
char *string;
|
||||
int direction;
|
||||
{
|
||||
return (history_search_internal (string, direction, ANCHORED_SEARCH));
|
||||
}
|
||||
|
||||
/* Search for STRING in the history list. DIR is < 0 for searching
|
||||
backwards. POS is an absolute index into the history list at
|
||||
which point to begin searching. */
|
||||
int
|
||||
history_search_pos (string, dir, pos)
|
||||
char *string;
|
||||
int dir, pos;
|
||||
{
|
||||
int ret, old;
|
||||
|
||||
old = where_history ();
|
||||
history_set_pos (pos);
|
||||
if (history_search (string, dir) == -1)
|
||||
{
|
||||
history_set_pos (old);
|
||||
return (-1);
|
||||
}
|
||||
ret = where_history ();
|
||||
history_set_pos (old);
|
||||
return ret;
|
||||
}
|
||||
@@ -1,449 +0,0 @@
|
||||
/* input.c -- character input functions for readline. */
|
||||
|
||||
/* Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#if defined (HAVE_SYS_FILE_H)
|
||||
# include <sys/file.h>
|
||||
#endif /* HAVE_SYS_FILE_H */
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#if defined (HAVE_SELECT)
|
||||
# if !defined (HAVE_SYS_SELECT_H) || !defined (M_UNIX)
|
||||
# include <sys/time.h>
|
||||
# endif
|
||||
#endif /* HAVE_SELECT */
|
||||
#if defined (HAVE_SYS_SELECT_H)
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#if defined (FIONREAD_IN_SYS_IOCTL)
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
|
||||
/* What kind of non-blocking I/O do we have? */
|
||||
#if !defined (O_NDELAY) && defined (O_NONBLOCK)
|
||||
# define O_NDELAY O_NONBLOCK /* Posix style */
|
||||
#endif
|
||||
|
||||
/* Functions imported from other files in the library. */
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
/* Variables and functions from macro.c. */
|
||||
extern void _rl_add_macro_char ();
|
||||
extern void _rl_with_macro_input ();
|
||||
extern int _rl_next_macro_key ();
|
||||
extern int _rl_defining_kbd_macro;
|
||||
|
||||
#if defined (VI_MODE)
|
||||
extern void _rl_vi_set_last ();
|
||||
extern int _rl_vi_textmod_command ();
|
||||
#endif /* VI_MODE */
|
||||
|
||||
extern FILE *rl_instream, *rl_outstream;
|
||||
extern Function *rl_last_func;
|
||||
extern int rl_key_sequence_length;
|
||||
extern int rl_pending_input;
|
||||
extern int rl_editing_mode;
|
||||
|
||||
extern Keymap _rl_keymap;
|
||||
|
||||
extern int _rl_convert_meta_chars_to_ascii;
|
||||
|
||||
#if defined (__GO32__)
|
||||
# include <pc.h>
|
||||
#endif /* __GO32__ */
|
||||
|
||||
/* Non-null means it is a pointer to a function to run while waiting for
|
||||
character input. */
|
||||
Function *rl_event_hook = (Function *)NULL;
|
||||
|
||||
Function *rl_getc_function = rl_getc;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Character Input Buffering */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
static int pop_index, push_index;
|
||||
static unsigned char ibuffer[512];
|
||||
static int ibuffer_len = sizeof (ibuffer) - 1;
|
||||
|
||||
#define any_typein (push_index != pop_index)
|
||||
|
||||
int
|
||||
_rl_any_typein ()
|
||||
{
|
||||
return any_typein;
|
||||
}
|
||||
|
||||
/* Add KEY to the buffer of characters to be read. */
|
||||
int
|
||||
rl_stuff_char (key)
|
||||
int key;
|
||||
{
|
||||
if (key == EOF)
|
||||
{
|
||||
key = NEWLINE;
|
||||
rl_pending_input = EOF;
|
||||
}
|
||||
ibuffer[push_index++] = key;
|
||||
if (push_index >= ibuffer_len)
|
||||
push_index = 0;
|
||||
return push_index;
|
||||
}
|
||||
|
||||
/* Make C be the next command to be executed. */
|
||||
int
|
||||
rl_execute_next (c)
|
||||
int c;
|
||||
{
|
||||
rl_pending_input = c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return the amount of space available in the
|
||||
buffer for stuffing characters. */
|
||||
static int
|
||||
ibuffer_space ()
|
||||
{
|
||||
if (pop_index > push_index)
|
||||
return (pop_index - push_index);
|
||||
else
|
||||
return (ibuffer_len - (push_index - pop_index));
|
||||
}
|
||||
|
||||
/* Get a key from the buffer of characters to be read.
|
||||
Return the key in KEY.
|
||||
Result is KEY if there was a key, or 0 if there wasn't. */
|
||||
static int
|
||||
rl_get_char (key)
|
||||
int *key;
|
||||
{
|
||||
if (push_index == pop_index)
|
||||
return (0);
|
||||
|
||||
*key = ibuffer[pop_index++];
|
||||
|
||||
if (pop_index >= ibuffer_len)
|
||||
pop_index = 0;
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Stuff KEY into the *front* of the input buffer.
|
||||
Returns non-zero if successful, zero if there is
|
||||
no space left in the buffer. */
|
||||
static int
|
||||
rl_unget_char (key)
|
||||
int key;
|
||||
{
|
||||
if (ibuffer_space ())
|
||||
{
|
||||
pop_index--;
|
||||
if (pop_index < 0)
|
||||
pop_index = ibuffer_len - 1;
|
||||
ibuffer[pop_index] = key;
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* If a character is available to be read, then read it
|
||||
and stuff it into IBUFFER. Otherwise, just return. */
|
||||
static void
|
||||
rl_gather_tyi ()
|
||||
{
|
||||
#if defined (__GO32__)
|
||||
char input;
|
||||
|
||||
if (isatty (0) && kbhit () && ibuffer_space ())
|
||||
{
|
||||
int i;
|
||||
i = (*rl_getc_function) (rl_instream);
|
||||
rl_stuff_char (i);
|
||||
}
|
||||
#else /* !__GO32__ */
|
||||
|
||||
int tty;
|
||||
register int tem, result;
|
||||
int chars_avail;
|
||||
char input;
|
||||
#if defined(HAVE_SELECT)
|
||||
fd_set readfds, exceptfds;
|
||||
struct timeval timeout;
|
||||
#endif
|
||||
|
||||
tty = fileno (rl_instream);
|
||||
|
||||
#if defined (HAVE_SELECT)
|
||||
FD_ZERO (&readfds);
|
||||
FD_ZERO (&exceptfds);
|
||||
FD_SET (tty, &readfds);
|
||||
FD_SET (tty, &exceptfds);
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 100000; /* 0.1 seconds */
|
||||
if (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) <= 0)
|
||||
return; /* Nothing to read. */
|
||||
#endif
|
||||
|
||||
result = -1;
|
||||
#if defined (FIONREAD)
|
||||
result = ioctl (tty, FIONREAD, &chars_avail);
|
||||
#endif
|
||||
|
||||
#if defined (O_NDELAY)
|
||||
if (result == -1)
|
||||
{
|
||||
tem = fcntl (tty, F_GETFL, 0);
|
||||
|
||||
fcntl (tty, F_SETFL, (tem | O_NDELAY));
|
||||
chars_avail = read (tty, &input, 1);
|
||||
|
||||
fcntl (tty, F_SETFL, tem);
|
||||
if (chars_avail == -1 && errno == EAGAIN)
|
||||
return;
|
||||
}
|
||||
#endif /* O_NDELAY */
|
||||
|
||||
/* If there's nothing available, don't waste time trying to read
|
||||
something. */
|
||||
if (chars_avail <= 0)
|
||||
return;
|
||||
|
||||
tem = ibuffer_space ();
|
||||
|
||||
if (chars_avail > tem)
|
||||
chars_avail = tem;
|
||||
|
||||
/* One cannot read all of the available input. I can only read a single
|
||||
character at a time, or else programs which require input can be
|
||||
thwarted. If the buffer is larger than one character, I lose.
|
||||
Damn! */
|
||||
if (tem < ibuffer_len)
|
||||
chars_avail = 0;
|
||||
|
||||
if (result != -1)
|
||||
{
|
||||
while (chars_avail--)
|
||||
rl_stuff_char ((*rl_getc_function) (rl_instream));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (chars_avail)
|
||||
rl_stuff_char (input);
|
||||
}
|
||||
#endif /* !__GO32__ */
|
||||
}
|
||||
|
||||
/* Is there input available to be read on the readline input file
|
||||
descriptor? Only works if the system has select(2) or FIONREAD. */
|
||||
int
|
||||
_rl_input_available ()
|
||||
{
|
||||
#if defined(HAVE_SELECT)
|
||||
fd_set readfds, exceptfds;
|
||||
struct timeval timeout;
|
||||
#endif
|
||||
#if defined(FIONREAD)
|
||||
int chars_avail;
|
||||
#endif
|
||||
int tty;
|
||||
|
||||
tty = fileno (rl_instream);
|
||||
|
||||
#if defined (HAVE_SELECT)
|
||||
FD_ZERO (&readfds);
|
||||
FD_ZERO (&exceptfds);
|
||||
FD_SET (tty, &readfds);
|
||||
FD_SET (tty, &exceptfds);
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 100000; /* 0.1 seconds */
|
||||
return (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) > 0);
|
||||
#endif
|
||||
|
||||
#if defined (FIONREAD)
|
||||
if (ioctl (tty, FIONREAD, &chars_avail) == 0)
|
||||
return (chars_avail);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
_rl_insert_typein (c)
|
||||
int c;
|
||||
{
|
||||
int key, t, i;
|
||||
char *string;
|
||||
|
||||
i = key = 0;
|
||||
string = xmalloc (ibuffer_len + 1);
|
||||
string[i++] = (char) c;
|
||||
|
||||
while ((t = rl_get_char (&key)) &&
|
||||
_rl_keymap[key].type == ISFUNC &&
|
||||
_rl_keymap[key].function == rl_insert)
|
||||
string[i++] = key;
|
||||
|
||||
if (t)
|
||||
rl_unget_char (key);
|
||||
|
||||
string[i] = '\0';
|
||||
rl_insert_text (string);
|
||||
free (string);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Character Input */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Read a key, including pending input. */
|
||||
int
|
||||
rl_read_key ()
|
||||
{
|
||||
int c;
|
||||
|
||||
rl_key_sequence_length++;
|
||||
|
||||
if (rl_pending_input)
|
||||
{
|
||||
c = rl_pending_input;
|
||||
rl_pending_input = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* If input is coming from a macro, then use that. */
|
||||
if (c = _rl_next_macro_key ())
|
||||
return (c);
|
||||
|
||||
/* If the user has an event function, then call it periodically. */
|
||||
if (rl_event_hook)
|
||||
{
|
||||
while (rl_event_hook && rl_get_char (&c) == 0)
|
||||
{
|
||||
(*rl_event_hook) ();
|
||||
rl_gather_tyi ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rl_get_char (&c) == 0)
|
||||
c = (*rl_getc_function) (rl_instream);
|
||||
}
|
||||
}
|
||||
|
||||
return (c);
|
||||
}
|
||||
|
||||
int
|
||||
rl_getc (stream)
|
||||
FILE *stream;
|
||||
{
|
||||
int result, flags;
|
||||
unsigned char c;
|
||||
|
||||
#if defined (__GO32__)
|
||||
if (isatty (0))
|
||||
return (getkey () & 0x7F);
|
||||
#endif /* __GO32__ */
|
||||
|
||||
while (1)
|
||||
{
|
||||
result = read (fileno (stream), &c, sizeof (unsigned char));
|
||||
|
||||
if (result == sizeof (unsigned char))
|
||||
return (c);
|
||||
|
||||
/* If zero characters are returned, then the file that we are
|
||||
reading from is empty! Return EOF in that case. */
|
||||
if (result == 0)
|
||||
return (EOF);
|
||||
|
||||
#if defined (EWOULDBLOCK)
|
||||
if (errno == EWOULDBLOCK)
|
||||
{
|
||||
if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
|
||||
return (EOF);
|
||||
if (flags & O_NDELAY)
|
||||
{
|
||||
flags &= ~O_NDELAY;
|
||||
fcntl (fileno (stream), F_SETFL, flags);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
#endif /* EWOULDBLOCK */
|
||||
|
||||
#if defined (_POSIX_VERSION) && defined (EAGAIN) && defined (O_NONBLOCK)
|
||||
if (errno == EAGAIN)
|
||||
{
|
||||
if ((flags = fcntl (fileno (stream), F_GETFL, 0)) < 0)
|
||||
return (EOF);
|
||||
if (flags & O_NONBLOCK)
|
||||
{
|
||||
flags &= ~O_NONBLOCK;
|
||||
fcntl (fileno (stream), F_SETFL, flags);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif /* _POSIX_VERSION && EAGAIN && O_NONBLOCK */
|
||||
|
||||
#if !defined (__GO32__)
|
||||
/* If the error that we received was SIGINT, then try again,
|
||||
this is simply an interrupted system call to read ().
|
||||
Otherwise, some error ocurred, also signifying EOF. */
|
||||
if (errno != EINTR)
|
||||
return (EOF);
|
||||
#endif /* !__GO32__ */
|
||||
}
|
||||
}
|
||||
@@ -1,410 +0,0 @@
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* I-Search and Searching */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the Readline Library (the Library), a set of
|
||||
routines for providing Emacs style line input to programs that ask
|
||||
for it.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "rldefs.h"
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
/* Variables imported from other files in the readline library. */
|
||||
extern Keymap _rl_keymap;
|
||||
extern HIST_ENTRY *saved_line_for_history;
|
||||
extern int rl_line_buffer_len;
|
||||
extern int rl_point, rl_end;
|
||||
extern char *rl_line_buffer;
|
||||
|
||||
extern void _rl_save_prompt ();
|
||||
extern void _rl_restore_prompt ();
|
||||
|
||||
extern int rl_execute_next ();
|
||||
extern void rl_extend_line_buffer ();
|
||||
|
||||
extern int _rl_input_available ();
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
static int rl_search_history ();
|
||||
|
||||
/* Last line found by the current incremental search, so we don't `find'
|
||||
identical lines many times in a row. */
|
||||
static char *prev_line_found;
|
||||
|
||||
/* Search backwards through the history looking for a string which is typed
|
||||
interactively. Start with the current line. */
|
||||
int
|
||||
rl_reverse_search_history (sign, key)
|
||||
int sign, key;
|
||||
{
|
||||
return (rl_search_history (-sign, key));
|
||||
}
|
||||
|
||||
/* Search forwards through the history looking for a string which is typed
|
||||
interactively. Start with the current line. */
|
||||
int
|
||||
rl_forward_search_history (sign, key)
|
||||
int sign, key;
|
||||
{
|
||||
return (rl_search_history (sign, key));
|
||||
}
|
||||
|
||||
/* Display the current state of the search in the echo-area.
|
||||
SEARCH_STRING contains the string that is being searched for,
|
||||
DIRECTION is zero for forward, or 1 for reverse,
|
||||
WHERE is the history list number of the current line. If it is
|
||||
-1, then this line is the starting one. */
|
||||
static void
|
||||
rl_display_search (search_string, reverse_p, where)
|
||||
char *search_string;
|
||||
int reverse_p, where;
|
||||
{
|
||||
char *message;
|
||||
int msglen, searchlen;
|
||||
|
||||
searchlen = (search_string && *search_string) ? strlen (search_string) : 0;
|
||||
|
||||
message = xmalloc (searchlen + 33);
|
||||
msglen = 0;
|
||||
|
||||
#if defined (NOTDEF)
|
||||
if (where != -1)
|
||||
{
|
||||
sprintf (message, "[%d]", where + history_base);
|
||||
msglen = strlen (message);
|
||||
}
|
||||
#endif /* NOTDEF */
|
||||
|
||||
message[msglen++] = '(';
|
||||
|
||||
if (reverse_p)
|
||||
{
|
||||
strcpy (message + msglen, "reverse-");
|
||||
msglen += 8;
|
||||
}
|
||||
|
||||
strcpy (message + msglen, "i-search)`");
|
||||
msglen += 10;
|
||||
|
||||
if (search_string)
|
||||
{
|
||||
strcpy (message + msglen, search_string);
|
||||
msglen += searchlen;
|
||||
}
|
||||
|
||||
strcpy (message + msglen, "': ");
|
||||
|
||||
rl_message ("%s", message, 0);
|
||||
free (message);
|
||||
(*rl_redisplay_function) ();
|
||||
}
|
||||
|
||||
/* Search through the history looking for an interactively typed string.
|
||||
This is analogous to i-search. We start the search in the current line.
|
||||
DIRECTION is which direction to search; >= 0 means forward, < 0 means
|
||||
backwards. */
|
||||
static int
|
||||
rl_search_history (direction, invoking_key)
|
||||
int direction, invoking_key;
|
||||
{
|
||||
/* The string that the user types in to search for. */
|
||||
char *search_string;
|
||||
|
||||
/* The current length of SEARCH_STRING. */
|
||||
int search_string_index;
|
||||
|
||||
/* The amount of space that SEARCH_STRING has allocated to it. */
|
||||
int search_string_size;
|
||||
|
||||
/* The list of lines to search through. */
|
||||
char **lines, *allocated_line;
|
||||
|
||||
/* The length of LINES. */
|
||||
int hlen;
|
||||
|
||||
/* Where we get LINES from. */
|
||||
HIST_ENTRY **hlist;
|
||||
|
||||
register int i;
|
||||
int orig_point, orig_line, last_found_line;
|
||||
int c, found, failed, sline_len;
|
||||
|
||||
/* The line currently being searched. */
|
||||
char *sline;
|
||||
|
||||
/* Offset in that line. */
|
||||
int line_index;
|
||||
|
||||
/* Non-zero if we are doing a reverse search. */
|
||||
int reverse;
|
||||
|
||||
orig_point = rl_point;
|
||||
last_found_line = orig_line = where_history ();
|
||||
reverse = direction < 0;
|
||||
hlist = history_list ();
|
||||
allocated_line = (char *)NULL;
|
||||
|
||||
/* Create an arrary of pointers to the lines that we want to search. */
|
||||
maybe_replace_line ();
|
||||
i = 0;
|
||||
if (hlist)
|
||||
for (i = 0; hlist[i]; i++);
|
||||
|
||||
/* Allocate space for this many lines, +1 for the current input line,
|
||||
and remember those lines. */
|
||||
lines = (char **)xmalloc ((1 + (hlen = i)) * sizeof (char *));
|
||||
for (i = 0; i < hlen; i++)
|
||||
lines[i] = hlist[i]->line;
|
||||
|
||||
if (saved_line_for_history)
|
||||
lines[i] = saved_line_for_history->line;
|
||||
else
|
||||
{
|
||||
/* Keep track of this so we can free it. */
|
||||
allocated_line = xmalloc (1 + strlen (rl_line_buffer));
|
||||
strcpy (allocated_line, &rl_line_buffer[0]);
|
||||
lines[i] = allocated_line;
|
||||
}
|
||||
|
||||
hlen++;
|
||||
|
||||
/* The line where we start the search. */
|
||||
i = orig_line;
|
||||
|
||||
_rl_save_prompt ();
|
||||
|
||||
/* Initialize search parameters. */
|
||||
search_string = xmalloc (search_string_size = 128);
|
||||
*search_string = '\0';
|
||||
search_string_index = 0;
|
||||
prev_line_found = (char *)0; /* XXX */
|
||||
|
||||
/* Normalize DIRECTION into 1 or -1. */
|
||||
direction = (direction >= 0) ? 1 : -1;
|
||||
|
||||
rl_display_search (search_string, reverse, -1);
|
||||
|
||||
sline = rl_line_buffer;
|
||||
sline_len = strlen (sline);
|
||||
line_index = rl_point;
|
||||
|
||||
found = failed = 0;
|
||||
for (;;)
|
||||
{
|
||||
Function *f = (Function *)NULL;
|
||||
|
||||
/* Read a key and decide how to proceed. */
|
||||
c = rl_read_key ();
|
||||
|
||||
if (_rl_keymap[c].type == ISFUNC)
|
||||
{
|
||||
f = _rl_keymap[c].function;
|
||||
|
||||
if (f == rl_reverse_search_history)
|
||||
c = reverse ? -1 : -2;
|
||||
else if (f == rl_forward_search_history)
|
||||
c = !reverse ? -1 : -2;
|
||||
}
|
||||
|
||||
/* Let NEWLINE (^J) terminate the search for people who don't like
|
||||
using ESC. ^M can still be used to terminate the search and
|
||||
immediately execute the command. */
|
||||
if (c == ESC || c == NEWLINE)
|
||||
{
|
||||
/* ESC still terminates the search, but if there is pending
|
||||
input or if input arrives within 0.1 seconds (on systems
|
||||
with select(2)) it is used as a prefix character
|
||||
with rl_execute_next. WATCH OUT FOR THIS! This is intended
|
||||
to allow the arrow keys to be used like ^F and ^B are used
|
||||
to terminate the search and execute the movement command. */
|
||||
if (c == ESC && _rl_input_available ()) /* XXX */
|
||||
rl_execute_next (ESC);
|
||||
break;
|
||||
}
|
||||
|
||||
if (c >= 0 && (CTRL_CHAR (c) || META_CHAR (c) || c == RUBOUT))
|
||||
{
|
||||
rl_execute_next (c);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case -1:
|
||||
if (search_string_index == 0)
|
||||
continue;
|
||||
else if (reverse)
|
||||
--line_index;
|
||||
else if (line_index != sline_len)
|
||||
++line_index;
|
||||
else
|
||||
ding ();
|
||||
break;
|
||||
|
||||
/* switch directions */
|
||||
case -2:
|
||||
direction = -direction;
|
||||
reverse = direction < 0;
|
||||
break;
|
||||
|
||||
case CTRL ('G'):
|
||||
strcpy (rl_line_buffer, lines[orig_line]);
|
||||
rl_point = orig_point;
|
||||
rl_end = strlen (rl_line_buffer);
|
||||
_rl_restore_prompt();
|
||||
rl_clear_message ();
|
||||
free (allocated_line);
|
||||
free (lines);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
/* Add character to search string and continue search. */
|
||||
if (search_string_index + 2 >= search_string_size)
|
||||
{
|
||||
search_string_size += 128;
|
||||
search_string = xrealloc (search_string, search_string_size);
|
||||
}
|
||||
search_string[search_string_index++] = c;
|
||||
search_string[search_string_index] = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
for (found = failed = 0;;)
|
||||
{
|
||||
int limit = sline_len - search_string_index + 1;
|
||||
|
||||
/* Search the current line. */
|
||||
while (reverse ? (line_index >= 0) : (line_index < limit))
|
||||
{
|
||||
if (STREQN (search_string, sline + line_index, search_string_index))
|
||||
{
|
||||
found++;
|
||||
break;
|
||||
}
|
||||
else
|
||||
line_index += direction;
|
||||
}
|
||||
if (found)
|
||||
break;
|
||||
|
||||
/* Move to the next line, but skip new copies of the line
|
||||
we just found and lines shorter than the string we're
|
||||
searching for. */
|
||||
do
|
||||
{
|
||||
/* Move to the next line. */
|
||||
i += direction;
|
||||
|
||||
/* At limit for direction? */
|
||||
if (reverse ? (i < 0) : (i == hlen))
|
||||
{
|
||||
failed++;
|
||||
break;
|
||||
}
|
||||
|
||||
/* We will need these later. */
|
||||
sline = lines[i];
|
||||
sline_len = strlen (sline);
|
||||
}
|
||||
while ((prev_line_found && STREQ (prev_line_found, lines[i])) ||
|
||||
(search_string_index > sline_len));
|
||||
|
||||
if (failed)
|
||||
break;
|
||||
|
||||
/* Now set up the line for searching... */
|
||||
line_index = reverse ? sline_len - search_string_index : 0;
|
||||
}
|
||||
|
||||
if (failed)
|
||||
{
|
||||
/* We cannot find the search string. Ding the bell. */
|
||||
ding ();
|
||||
i = last_found_line;
|
||||
continue; /* XXX - was break */
|
||||
}
|
||||
|
||||
/* We have found the search string. Just display it. But don't
|
||||
actually move there in the history list until the user accepts
|
||||
the location. */
|
||||
if (found)
|
||||
{
|
||||
int line_len;
|
||||
|
||||
prev_line_found = lines[i];
|
||||
line_len = strlen (lines[i]);
|
||||
|
||||
if (line_len >= rl_line_buffer_len)
|
||||
rl_extend_line_buffer (line_len);
|
||||
|
||||
strcpy (rl_line_buffer, lines[i]);
|
||||
rl_point = line_index;
|
||||
rl_end = line_len;
|
||||
last_found_line = i;
|
||||
rl_display_search (search_string, reverse, (i == orig_line) ? -1 : i);
|
||||
}
|
||||
}
|
||||
|
||||
/* The searching is over. The user may have found the string that she
|
||||
was looking for, or else she may have exited a failing search. If
|
||||
LINE_INDEX is -1, then that shows that the string searched for was
|
||||
not found. We use this to determine where to place rl_point. */
|
||||
|
||||
/* First put back the original state. */
|
||||
strcpy (rl_line_buffer, lines[orig_line]);
|
||||
|
||||
_rl_restore_prompt ();
|
||||
|
||||
/* Free the search string. */
|
||||
free (search_string);
|
||||
|
||||
if (last_found_line < orig_line)
|
||||
rl_get_previous_history (orig_line - last_found_line);
|
||||
else
|
||||
rl_get_next_history (last_found_line - orig_line);
|
||||
|
||||
/* If the string was not found, put point at the end of the line. */
|
||||
if (line_index < 0)
|
||||
line_index = strlen (rl_line_buffer);
|
||||
rl_point = line_index;
|
||||
rl_clear_message ();
|
||||
|
||||
free (allocated_line);
|
||||
free (lines);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
/* keymaps.c -- Functions and keymaps for the GNU Readline library. */
|
||||
|
||||
/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Readline, a library for reading lines
|
||||
of text with interactive input and history editing.
|
||||
|
||||
Readline is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 1, or (at your option) any
|
||||
later version.
|
||||
|
||||
Readline is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Readline; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include "rlconf.h"
|
||||
#include "keymaps.h"
|
||||
#include "emacs_keymap.c"
|
||||
|
||||
#if defined (VI_MODE)
|
||||
#include "vi_keymap.c"
|
||||
#endif
|
||||
|
||||
extern int rl_do_lowercase_version ();
|
||||
extern int rl_rubout (), rl_insert ();
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Functions for manipulating Keymaps. */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
|
||||
/* Return a new, empty keymap.
|
||||
Free it with free() when you are done. */
|
||||
Keymap
|
||||
rl_make_bare_keymap ()
|
||||
{
|
||||
register int i;
|
||||
Keymap keymap = (Keymap)xmalloc (KEYMAP_SIZE * sizeof (KEYMAP_ENTRY));
|
||||
|
||||
for (i = 0; i < KEYMAP_SIZE; i++)
|
||||
{
|
||||
keymap[i].type = ISFUNC;
|
||||
keymap[i].function = (Function *)NULL;
|
||||
}
|
||||
|
||||
for (i = 'A'; i < ('Z' + 1); i++)
|
||||
{
|
||||
keymap[i].type = ISFUNC;
|
||||
keymap[i].function = rl_do_lowercase_version;
|
||||
}
|
||||
|
||||
return (keymap);
|
||||
}
|
||||
|
||||
/* Return a new keymap which is a copy of MAP. */
|
||||
Keymap
|
||||
rl_copy_keymap (map)
|
||||
Keymap map;
|
||||
{
|
||||
register int i;
|
||||
Keymap temp = rl_make_bare_keymap ();
|
||||
|
||||
for (i = 0; i < KEYMAP_SIZE; i++)
|
||||
{
|
||||
temp[i].type = map[i].type;
|
||||
temp[i].function = map[i].function;
|
||||
}
|
||||
return (temp);
|
||||
}
|
||||
|
||||
/* Return a new keymap with the printing characters bound to rl_insert,
|
||||
the uppercase Meta characters bound to run their lowercase equivalents,
|
||||
and the Meta digits bound to produce numeric arguments. */
|
||||
Keymap
|
||||
rl_make_keymap ()
|
||||
{
|
||||
register int i;
|
||||
Keymap newmap;
|
||||
|
||||
newmap = rl_make_bare_keymap ();
|
||||
|
||||
/* All ASCII printing characters are self-inserting. */
|
||||
for (i = ' '; i < 127; i++)
|
||||
newmap[i].function = rl_insert;
|
||||
|
||||
newmap[TAB].function = rl_insert;
|
||||
newmap[RUBOUT].function = rl_rubout; /* RUBOUT == 127 */
|
||||
newmap[CTRL('H')].function = rl_rubout;
|
||||
|
||||
#if KEYMAP_SIZE > 128
|
||||
/* Printing characters in some 8-bit character sets. */
|
||||
for (i = 128; i < 160; i++)
|
||||
newmap[i].function = rl_insert;
|
||||
|
||||
/* ISO Latin-1 printing characters should self-insert. */
|
||||
for (i = 160; i < 256; i++)
|
||||
newmap[i].function = rl_insert;
|
||||
#endif /* KEYMAP_SIZE > 128 */
|
||||
|
||||
return (newmap);
|
||||
}
|
||||
|
||||
/* Free the storage associated with MAP. */
|
||||
void
|
||||
rl_discard_keymap (map)
|
||||
Keymap (map);
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!map)
|
||||
return;
|
||||
|
||||
for (i = 0; i < KEYMAP_SIZE; i++)
|
||||
{
|
||||
switch (map[i].type)
|
||||
{
|
||||
case ISFUNC:
|
||||
break;
|
||||
|
||||
case ISKMAP:
|
||||
rl_discard_keymap ((Keymap)map[i].function);
|
||||
break;
|
||||
|
||||
case ISMACR:
|
||||
free ((char *)map[i].function);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/* keymaps.h -- Manipulation of readline keymaps. */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef _KEYMAPS_H_
|
||||
#define _KEYMAPS_H_
|
||||
|
||||
#if defined (READLINE_LIBRARY)
|
||||
# include "chardefs.h"
|
||||
#else
|
||||
# include <readline/chardefs.h>
|
||||
#endif
|
||||
|
||||
#if !defined (_FUNCTION_DEF)
|
||||
# define _FUNCTION_DEF
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
typedef char *CPFunction ();
|
||||
typedef char **CPPFunction ();
|
||||
#endif
|
||||
|
||||
/* A keymap contains one entry for each key in the ASCII set.
|
||||
Each entry consists of a type and a pointer.
|
||||
POINTER is the address of a function to run, or the
|
||||
address of a keymap to indirect through.
|
||||
TYPE says which kind of thing POINTER is. */
|
||||
typedef struct _keymap_entry {
|
||||
char type;
|
||||
Function *function;
|
||||
} KEYMAP_ENTRY;
|
||||
|
||||
/* This must be large enough to hold bindings for all of the characters
|
||||
in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x,
|
||||
and so on). */
|
||||
#define KEYMAP_SIZE 256
|
||||
|
||||
/* I wanted to make the above structure contain a union of:
|
||||
union { Function *function; struct _keymap_entry *keymap; } value;
|
||||
but this made it impossible for me to create a static array.
|
||||
Maybe I need C lessons. */
|
||||
|
||||
typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
|
||||
typedef KEYMAP_ENTRY *Keymap;
|
||||
|
||||
/* The values that TYPE can have in a keymap entry. */
|
||||
#define ISFUNC 0
|
||||
#define ISKMAP 1
|
||||
#define ISMACR 2
|
||||
|
||||
extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;
|
||||
extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
|
||||
|
||||
/* Return a new, empty keymap.
|
||||
Free it with free() when you are done. */
|
||||
extern Keymap rl_make_bare_keymap ();
|
||||
|
||||
/* Return a new keymap which is a copy of MAP. */
|
||||
extern Keymap rl_copy_keymap ();
|
||||
|
||||
/* Return a new keymap with the printing characters bound to rl_insert,
|
||||
the lowercase Meta characters bound to run their equivalents, and
|
||||
the Meta digits bound to produce numeric arguments. */
|
||||
extern Keymap rl_make_keymap ();
|
||||
|
||||
extern void rl_discard_keymap ();
|
||||
|
||||
/* Return the keymap corresponding to a given name. Names look like
|
||||
`emacs' or `emacs-meta' or `vi-insert'. */
|
||||
extern Keymap rl_get_keymap_by_name ();
|
||||
|
||||
/* Return the current keymap. */
|
||||
extern Keymap rl_get_keymap ();
|
||||
|
||||
/* Set the current keymap to MAP. */
|
||||
extern void rl_set_keymap ();
|
||||
|
||||
#endif /* _KEYMAPS_H_ */
|
||||
@@ -1,547 +0,0 @@
|
||||
/* kill.c -- kill ring management. */
|
||||
|
||||
/* Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h> /* for _POSIX_VERSION */
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
extern int _rl_last_command_was_kill;
|
||||
extern int rl_editing_mode;
|
||||
extern int rl_explicit_arg;
|
||||
extern Function *rl_last_func;
|
||||
|
||||
extern void _rl_init_argument ();
|
||||
extern int _rl_set_mark_at_pos ();
|
||||
extern void _rl_abort_internal ();
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Killing Mechanism */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* What we assume for a max number of kills. */
|
||||
#define DEFAULT_MAX_KILLS 10
|
||||
|
||||
/* The real variable to look at to find out when to flush kills. */
|
||||
static int rl_max_kills = DEFAULT_MAX_KILLS;
|
||||
|
||||
/* Where to store killed text. */
|
||||
static char **rl_kill_ring = (char **)NULL;
|
||||
|
||||
/* Where we are in the kill ring. */
|
||||
static int rl_kill_index;
|
||||
|
||||
/* How many slots we have in the kill ring. */
|
||||
static int rl_kill_ring_length;
|
||||
|
||||
/* How to say that you only want to save a certain amount
|
||||
of kill material. */
|
||||
int
|
||||
rl_set_retained_kills (num)
|
||||
int num;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Add TEXT to the kill ring, allocating a new kill ring slot as necessary.
|
||||
This uses TEXT directly, so the caller must not free it. If APPEND is
|
||||
non-zero, and the last command was a kill, the text is appended to the
|
||||
current kill ring slot, otherwise prepended. */
|
||||
static int
|
||||
_rl_copy_to_kill_ring (text, append)
|
||||
char *text;
|
||||
int append;
|
||||
{
|
||||
char *old, *new;
|
||||
int slot;
|
||||
|
||||
/* First, find the slot to work with. */
|
||||
if (_rl_last_command_was_kill == 0)
|
||||
{
|
||||
/* Get a new slot. */
|
||||
if (rl_kill_ring == 0)
|
||||
{
|
||||
/* If we don't have any defined, then make one. */
|
||||
rl_kill_ring = (char **)
|
||||
xmalloc (((rl_kill_ring_length = 1) + 1) * sizeof (char *));
|
||||
rl_kill_ring[slot = 0] = (char *)NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We have to add a new slot on the end, unless we have
|
||||
exceeded the max limit for remembering kills. */
|
||||
slot = rl_kill_ring_length;
|
||||
if (slot == rl_max_kills)
|
||||
{
|
||||
register int i;
|
||||
free (rl_kill_ring[0]);
|
||||
for (i = 0; i < slot; i++)
|
||||
rl_kill_ring[i] = rl_kill_ring[i + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
slot = rl_kill_ring_length += 1;
|
||||
rl_kill_ring = (char **)xrealloc (rl_kill_ring, slot * sizeof (char *));
|
||||
}
|
||||
rl_kill_ring[--slot] = (char *)NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
slot = rl_kill_ring_length - 1;
|
||||
|
||||
/* If the last command was a kill, prepend or append. */
|
||||
if (_rl_last_command_was_kill && rl_editing_mode != vi_mode)
|
||||
{
|
||||
old = rl_kill_ring[slot];
|
||||
new = xmalloc (1 + strlen (old) + strlen (text));
|
||||
|
||||
if (append)
|
||||
{
|
||||
strcpy (new, old);
|
||||
strcat (new, text);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (new, text);
|
||||
strcat (new, old);
|
||||
}
|
||||
free (old);
|
||||
free (text);
|
||||
rl_kill_ring[slot] = new;
|
||||
}
|
||||
else
|
||||
rl_kill_ring[slot] = text;
|
||||
|
||||
rl_kill_index = slot;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The way to kill something. This appends or prepends to the last
|
||||
kill, if the last command was a kill command. if FROM is less
|
||||
than TO, then the text is appended, otherwise prepended. If the
|
||||
last command was not a kill command, then a new slot is made for
|
||||
this kill. */
|
||||
int
|
||||
rl_kill_text (from, to)
|
||||
int from, to;
|
||||
{
|
||||
char *text;
|
||||
|
||||
/* Is there anything to kill? */
|
||||
if (from == to)
|
||||
{
|
||||
_rl_last_command_was_kill++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
text = rl_copy_text (from, to);
|
||||
|
||||
/* Delete the copied text from the line. */
|
||||
rl_delete_text (from, to);
|
||||
|
||||
_rl_copy_to_kill_ring (text, from < to);
|
||||
|
||||
_rl_last_command_was_kill++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Now REMEMBER! In order to do prepending or appending correctly, kill
|
||||
commands always make rl_point's original position be the FROM argument,
|
||||
and rl_point's extent be the TO argument. */
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Killing Commands */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Delete the word at point, saving the text in the kill ring. */
|
||||
int
|
||||
rl_kill_word (count, key)
|
||||
int count, key;
|
||||
{
|
||||
int orig_point = rl_point;
|
||||
|
||||
if (count < 0)
|
||||
return (rl_backward_kill_word (-count, key));
|
||||
else
|
||||
{
|
||||
rl_forward_word (count, key);
|
||||
|
||||
if (rl_point != orig_point)
|
||||
rl_kill_text (orig_point, rl_point);
|
||||
|
||||
rl_point = orig_point;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Rubout the word before point, placing it on the kill ring. */
|
||||
int
|
||||
rl_backward_kill_word (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
int orig_point = rl_point;
|
||||
|
||||
if (count < 0)
|
||||
return (rl_kill_word (-count, ignore));
|
||||
else
|
||||
{
|
||||
rl_backward_word (count, ignore);
|
||||
|
||||
if (rl_point != orig_point)
|
||||
rl_kill_text (orig_point, rl_point);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Kill from here to the end of the line. If DIRECTION is negative, kill
|
||||
back to the line start instead. */
|
||||
int
|
||||
rl_kill_line (direction, ignore)
|
||||
int direction, ignore;
|
||||
{
|
||||
int orig_point = rl_point;
|
||||
|
||||
if (direction < 0)
|
||||
return (rl_backward_kill_line (1, ignore));
|
||||
else
|
||||
{
|
||||
rl_end_of_line (1, ignore);
|
||||
if (orig_point != rl_point)
|
||||
rl_kill_text (orig_point, rl_point);
|
||||
rl_point = orig_point;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Kill backwards to the start of the line. If DIRECTION is negative, kill
|
||||
forwards to the line end instead. */
|
||||
int
|
||||
rl_backward_kill_line (direction, ignore)
|
||||
int direction, ignore;
|
||||
{
|
||||
int orig_point = rl_point;
|
||||
|
||||
if (direction < 0)
|
||||
return (rl_kill_line (1, ignore));
|
||||
else
|
||||
{
|
||||
if (!rl_point)
|
||||
ding ();
|
||||
else
|
||||
{
|
||||
rl_beg_of_line (1, ignore);
|
||||
rl_kill_text (orig_point, rl_point);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Kill the whole line, no matter where point is. */
|
||||
int
|
||||
rl_kill_full_line (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
rl_begin_undo_group ();
|
||||
rl_point = 0;
|
||||
rl_kill_text (rl_point, rl_end);
|
||||
rl_end_undo_group ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The next two functions mimic unix line editing behaviour, except they
|
||||
save the deleted text on the kill ring. This is safer than not saving
|
||||
it, and since we have a ring, nobody should get screwed. */
|
||||
|
||||
/* This does what C-w does in Unix. We can't prevent people from
|
||||
using behaviour that they expect. */
|
||||
int
|
||||
rl_unix_word_rubout (count, key)
|
||||
int count, key;
|
||||
{
|
||||
int orig_point;
|
||||
|
||||
if (rl_point == 0)
|
||||
ding ();
|
||||
else
|
||||
{
|
||||
orig_point = rl_point;
|
||||
if (count <= 0)
|
||||
count = 1;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
while (rl_point && whitespace (rl_line_buffer[rl_point - 1]))
|
||||
rl_point--;
|
||||
|
||||
while (rl_point && (whitespace (rl_line_buffer[rl_point - 1]) == 0))
|
||||
rl_point--;
|
||||
}
|
||||
|
||||
rl_kill_text (orig_point, rl_point);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Here is C-u doing what Unix does. You don't *have* to use these
|
||||
key-bindings. We have a choice of killing the entire line, or
|
||||
killing from where we are to the start of the line. We choose the
|
||||
latter, because if you are a Unix weenie, then you haven't backspaced
|
||||
into the line at all, and if you aren't, then you know what you are
|
||||
doing. */
|
||||
int
|
||||
rl_unix_line_discard (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (rl_point == 0)
|
||||
ding ();
|
||||
else
|
||||
{
|
||||
rl_kill_text (rl_point, 0);
|
||||
rl_point = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Copy the text in the `region' to the kill ring. If DELETE is non-zero,
|
||||
delete the text from the line as well. */
|
||||
static int
|
||||
region_kill_internal (delete)
|
||||
int delete;
|
||||
{
|
||||
char *text;
|
||||
|
||||
if (rl_mark == rl_point)
|
||||
{
|
||||
_rl_last_command_was_kill++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
text = rl_copy_text (rl_point, rl_mark);
|
||||
if (delete)
|
||||
rl_delete_text (rl_point, rl_mark);
|
||||
_rl_copy_to_kill_ring (text, rl_point < rl_mark);
|
||||
|
||||
_rl_last_command_was_kill++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Copy the text in the region to the kill ring. */
|
||||
int
|
||||
rl_copy_region_to_kill (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
return (region_kill_internal (0));
|
||||
}
|
||||
|
||||
/* Kill the text between the point and mark. */
|
||||
int
|
||||
rl_kill_region (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
return (region_kill_internal (1));
|
||||
}
|
||||
|
||||
/* Copy COUNT words to the kill ring. DIR says which direction we look
|
||||
to find the words. */
|
||||
static int
|
||||
_rl_copy_word_as_kill (count, dir)
|
||||
int count, dir;
|
||||
{
|
||||
int om, op, r;
|
||||
|
||||
om = rl_mark;
|
||||
op = rl_point;
|
||||
|
||||
if (dir > 0)
|
||||
rl_forward_word (count, 0);
|
||||
else
|
||||
rl_backward_word (count, 0);
|
||||
|
||||
rl_mark = rl_point;
|
||||
|
||||
if (dir > 0)
|
||||
rl_backward_word (count, 0);
|
||||
else
|
||||
rl_forward_word (count, 0);
|
||||
|
||||
r = region_kill_internal (0);
|
||||
|
||||
rl_mark = om;
|
||||
rl_point = op;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
rl_copy_forward_word (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (count < 0)
|
||||
return (rl_copy_backward_word (-count, key));
|
||||
|
||||
return (_rl_copy_word_as_kill (count, 1));
|
||||
}
|
||||
|
||||
int
|
||||
rl_copy_backward_word (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (count < 0)
|
||||
return (rl_copy_forward_word (-count, key));
|
||||
|
||||
return (_rl_copy_word_as_kill (count, -1));
|
||||
}
|
||||
|
||||
/* Yank back the last killed text. This ignores arguments. */
|
||||
int
|
||||
rl_yank (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
if (rl_kill_ring == 0)
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
_rl_set_mark_at_pos (rl_point);
|
||||
rl_insert_text (rl_kill_ring[rl_kill_index]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If the last command was yank, or yank_pop, and the text just
|
||||
before point is identical to the current kill item, then
|
||||
delete that text from the line, rotate the index down, and
|
||||
yank back some other text. */
|
||||
int
|
||||
rl_yank_pop (count, key)
|
||||
int count, key;
|
||||
{
|
||||
int l, n;
|
||||
|
||||
if (((rl_last_func != rl_yank_pop) && (rl_last_func != rl_yank)) ||
|
||||
!rl_kill_ring)
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
l = strlen (rl_kill_ring[rl_kill_index]);
|
||||
n = rl_point - l;
|
||||
if (n >= 0 && STREQN (rl_line_buffer + n, rl_kill_ring[rl_kill_index], l))
|
||||
{
|
||||
rl_delete_text (n, rl_point);
|
||||
rl_point = n;
|
||||
rl_kill_index--;
|
||||
if (rl_kill_index < 0)
|
||||
rl_kill_index = rl_kill_ring_length - 1;
|
||||
rl_yank (1, 0);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Yank the COUNTth argument from the previous history line. */
|
||||
int
|
||||
rl_yank_nth_arg (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
register HIST_ENTRY *entry;
|
||||
char *arg;
|
||||
|
||||
entry = previous_history ();
|
||||
if (entry)
|
||||
next_history ();
|
||||
else
|
||||
{
|
||||
ding ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
arg = history_arg_extract (count, count, entry->line);
|
||||
if (!arg || !*arg)
|
||||
{
|
||||
ding ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
rl_begin_undo_group ();
|
||||
|
||||
#if defined (VI_MODE)
|
||||
/* Vi mode always inserts a space before yanking the argument, and it
|
||||
inserts it right *after* rl_point. */
|
||||
if (rl_editing_mode == vi_mode)
|
||||
{
|
||||
rl_vi_append_mode ();
|
||||
rl_insert_text (" ");
|
||||
}
|
||||
#endif /* VI_MODE */
|
||||
|
||||
rl_insert_text (arg);
|
||||
free (arg);
|
||||
|
||||
rl_end_undo_group ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Yank the last argument from the previous history line. This `knows'
|
||||
how rl_yank_nth_arg treats a count of `$'. With an argument, this
|
||||
behaves the same as rl_yank_nth_arg. */
|
||||
int
|
||||
rl_yank_last_arg (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (rl_explicit_arg)
|
||||
return (rl_yank_nth_arg (count, key));
|
||||
else
|
||||
return (rl_yank_nth_arg ('$', key));
|
||||
}
|
||||
@@ -1,277 +0,0 @@
|
||||
/* macro.c -- keyboard macros for readline. */
|
||||
|
||||
/* Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h> /* for _POSIX_VERSION */
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
|
||||
|
||||
/* Forward definitions. */
|
||||
void _rl_push_executing_macro (), _rl_pop_executing_macro ();
|
||||
void _rl_add_macro_char ();
|
||||
|
||||
/* Extern declarations. */
|
||||
extern int rl_explicit_arg;
|
||||
extern int rl_key_sequence_length;
|
||||
|
||||
extern void _rl_abort_internal ();
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Hacking Keyboard Macros */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Non-zero means to save keys that we dispatch on in a kbd macro. */
|
||||
int _rl_defining_kbd_macro = 0;
|
||||
|
||||
/* The currently executing macro string. If this is non-zero,
|
||||
then it is a malloc ()'ed string where input is coming from. */
|
||||
char *_rl_executing_macro = (char *)NULL;
|
||||
|
||||
/* The offset in the above string to the next character to be read. */
|
||||
static int executing_macro_index;
|
||||
|
||||
/* The current macro string being built. Characters get stuffed
|
||||
in here by add_macro_char (). */
|
||||
static char *current_macro = (char *)NULL;
|
||||
|
||||
/* The size of the buffer allocated to current_macro. */
|
||||
static int current_macro_size;
|
||||
|
||||
/* The index at which characters are being added to current_macro. */
|
||||
static int current_macro_index;
|
||||
|
||||
/* A structure used to save nested macro strings.
|
||||
It is a linked list of string/index for each saved macro. */
|
||||
struct saved_macro {
|
||||
struct saved_macro *next;
|
||||
char *string;
|
||||
int sindex;
|
||||
};
|
||||
|
||||
/* The list of saved macros. */
|
||||
static struct saved_macro *macro_list = (struct saved_macro *)NULL;
|
||||
|
||||
/* Set up to read subsequent input from STRING.
|
||||
STRING is free ()'ed when we are done with it. */
|
||||
void
|
||||
_rl_with_macro_input (string)
|
||||
char *string;
|
||||
{
|
||||
_rl_push_executing_macro ();
|
||||
_rl_executing_macro = string;
|
||||
executing_macro_index = 0;
|
||||
}
|
||||
|
||||
/* Return the next character available from a macro, or 0 if
|
||||
there are no macro characters. */
|
||||
int
|
||||
_rl_next_macro_key ()
|
||||
{
|
||||
if (_rl_executing_macro == 0)
|
||||
return (0);
|
||||
|
||||
if (_rl_executing_macro[executing_macro_index] == 0)
|
||||
{
|
||||
_rl_pop_executing_macro ();
|
||||
return (_rl_next_macro_key ());
|
||||
}
|
||||
|
||||
return (_rl_executing_macro[executing_macro_index++]);
|
||||
}
|
||||
|
||||
/* Save the currently executing macro on a stack of saved macros. */
|
||||
void
|
||||
_rl_push_executing_macro ()
|
||||
{
|
||||
struct saved_macro *saver;
|
||||
|
||||
saver = (struct saved_macro *)xmalloc (sizeof (struct saved_macro));
|
||||
saver->next = macro_list;
|
||||
saver->sindex = executing_macro_index;
|
||||
saver->string = _rl_executing_macro;
|
||||
|
||||
macro_list = saver;
|
||||
}
|
||||
|
||||
/* Discard the current macro, replacing it with the one
|
||||
on the top of the stack of saved macros. */
|
||||
void
|
||||
_rl_pop_executing_macro ()
|
||||
{
|
||||
struct saved_macro *macro;
|
||||
|
||||
if (_rl_executing_macro)
|
||||
free (_rl_executing_macro);
|
||||
|
||||
_rl_executing_macro = (char *)NULL;
|
||||
executing_macro_index = 0;
|
||||
|
||||
if (macro_list)
|
||||
{
|
||||
macro = macro_list;
|
||||
_rl_executing_macro = macro_list->string;
|
||||
executing_macro_index = macro_list->sindex;
|
||||
macro_list = macro_list->next;
|
||||
free (macro);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add a character to the macro being built. */
|
||||
void
|
||||
_rl_add_macro_char (c)
|
||||
int c;
|
||||
{
|
||||
if (current_macro_index + 1 >= current_macro_size)
|
||||
{
|
||||
if (current_macro == 0)
|
||||
current_macro = xmalloc (current_macro_size = 25);
|
||||
else
|
||||
current_macro = xrealloc (current_macro, current_macro_size += 25);
|
||||
}
|
||||
|
||||
current_macro[current_macro_index++] = c;
|
||||
current_macro[current_macro_index] = '\0';
|
||||
}
|
||||
|
||||
void
|
||||
_rl_kill_kbd_macro ()
|
||||
{
|
||||
if (current_macro)
|
||||
{
|
||||
free (current_macro);
|
||||
current_macro = (char *) NULL;
|
||||
}
|
||||
current_macro_size = current_macro_index = 0;
|
||||
|
||||
if (_rl_executing_macro)
|
||||
{
|
||||
free (_rl_executing_macro);
|
||||
_rl_executing_macro = (char *) NULL;
|
||||
}
|
||||
executing_macro_index = 0;
|
||||
|
||||
_rl_defining_kbd_macro = 0;
|
||||
}
|
||||
|
||||
/* Begin defining a keyboard macro.
|
||||
Keystrokes are recorded as they are executed.
|
||||
End the definition with rl_end_kbd_macro ().
|
||||
If a numeric argument was explicitly typed, then append this
|
||||
definition to the end of the existing macro, and start by
|
||||
re-executing the existing macro. */
|
||||
int
|
||||
rl_start_kbd_macro (ignore1, ignore2)
|
||||
int ignore1, ignore2;
|
||||
{
|
||||
if (_rl_defining_kbd_macro)
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rl_explicit_arg)
|
||||
{
|
||||
if (current_macro)
|
||||
_rl_with_macro_input (savestring (current_macro));
|
||||
}
|
||||
else
|
||||
current_macro_index = 0;
|
||||
|
||||
_rl_defining_kbd_macro = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Stop defining a keyboard macro.
|
||||
A numeric argument says to execute the macro right now,
|
||||
that many times, counting the definition as the first time. */
|
||||
int
|
||||
rl_end_kbd_macro (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
if (_rl_defining_kbd_macro == 0)
|
||||
{
|
||||
_rl_abort_internal ();
|
||||
return -1;
|
||||
}
|
||||
|
||||
current_macro_index -= rl_key_sequence_length - 1;
|
||||
current_macro[current_macro_index] = '\0';
|
||||
|
||||
_rl_defining_kbd_macro = 0;
|
||||
|
||||
return (rl_call_last_kbd_macro (--count, 0));
|
||||
}
|
||||
|
||||
/* Execute the most recently defined keyboard macro.
|
||||
COUNT says how many times to execute it. */
|
||||
int
|
||||
rl_call_last_kbd_macro (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
if (current_macro == 0)
|
||||
_rl_abort_internal ();
|
||||
|
||||
if (_rl_defining_kbd_macro)
|
||||
{
|
||||
ding (); /* no recursive macros */
|
||||
current_macro[--current_macro_index] = '\0'; /* erase this char */
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (count--)
|
||||
_rl_with_macro_input (savestring (current_macro));
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
rl_push_macro_input (macro)
|
||||
char *macro;
|
||||
{
|
||||
_rl_with_macro_input (macro);
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
/* nls.c -- skeletal internationalization code. */
|
||||
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#if defined (HAVE_LOCALE_H)
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "rldefs.h"
|
||||
|
||||
extern int _rl_convert_meta_chars_to_ascii;
|
||||
extern int _rl_output_meta_chars;
|
||||
extern int _rl_meta_flag;
|
||||
|
||||
/* A list of legal values for the LANG or LC_CTYPE environment variables.
|
||||
If a locale name in this list is the value for the LC_ALL, LC_CTYPE,
|
||||
or LANG environment variable (using the first of those with a value),
|
||||
readline eight-bit mode is enabled. */
|
||||
static char *legal_lang_values[] =
|
||||
{
|
||||
"iso88591",
|
||||
"iso88592",
|
||||
"iso88593",
|
||||
"iso88594",
|
||||
"iso88595",
|
||||
"iso88596",
|
||||
"iso88597",
|
||||
"iso88598",
|
||||
"iso88599",
|
||||
"iso885910",
|
||||
"koi8r",
|
||||
0
|
||||
};
|
||||
|
||||
static char *normalize_codeset ();
|
||||
static char *find_codeset ();
|
||||
|
||||
/* Check for LC_ALL, LC_CTYPE, and LANG and use the first with a value
|
||||
to decide the defaults for 8-bit character input and output. Returns
|
||||
1 if we set eight-bit mode. */
|
||||
int
|
||||
_rl_init_eightbit ()
|
||||
{
|
||||
char *lspec, *t;
|
||||
int i;
|
||||
|
||||
lspec = getenv ("LC_ALL");
|
||||
if (lspec == 0) lspec = getenv ("LC_CTYPE");
|
||||
if (lspec == 0) lspec = getenv ("LANG");
|
||||
if (lspec == 0 || (t = normalize_codeset (lspec)) == 0)
|
||||
return (0);
|
||||
for (i = 0; t && legal_lang_values[i]; i++)
|
||||
if (STREQ (t, legal_lang_values[i]))
|
||||
{
|
||||
_rl_meta_flag = 1;
|
||||
_rl_convert_meta_chars_to_ascii = 0;
|
||||
_rl_output_meta_chars = 1;
|
||||
#if defined (HAVE_SETLOCALE)
|
||||
setlocale (LC_CTYPE, lspec);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
free (t);
|
||||
return (legal_lang_values[i] ? 1 : 0);
|
||||
}
|
||||
|
||||
static char *
|
||||
normalize_codeset (codeset)
|
||||
char *codeset;
|
||||
{
|
||||
size_t namelen, i;
|
||||
int len, all_digits;
|
||||
char *wp, *retval;
|
||||
|
||||
codeset = find_codeset (codeset, &namelen);
|
||||
|
||||
if (codeset == 0)
|
||||
return (codeset);
|
||||
|
||||
all_digits = 1;
|
||||
for (len = 0, i = 0; i < namelen; i++)
|
||||
{
|
||||
if (isalnum (codeset[i]))
|
||||
{
|
||||
len++;
|
||||
all_digits &= isdigit (codeset[i]);
|
||||
}
|
||||
}
|
||||
|
||||
retval = (char *)malloc ((all_digits ? 3 : 0) + len + 1);
|
||||
if (retval == 0)
|
||||
return ((char *)0);
|
||||
|
||||
wp = retval;
|
||||
/* Add `iso' to beginning of an all-digit codeset */
|
||||
if (all_digits)
|
||||
{
|
||||
*wp++ = 'i';
|
||||
*wp++ = 's';
|
||||
*wp++ = 'o';
|
||||
}
|
||||
|
||||
for (i = 0; i < namelen; i++)
|
||||
if (isalpha (codeset[i]))
|
||||
*wp++ = (isupper (codeset[i])) ? tolower (codeset[i]) : codeset[i];
|
||||
else if (isdigit (codeset[i]))
|
||||
*wp++ = codeset[i];
|
||||
*wp = '\0';
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Isolate codeset portion of locale specification. */
|
||||
static char *
|
||||
find_codeset (name, lenp)
|
||||
char *name;
|
||||
size_t *lenp;
|
||||
{
|
||||
char *cp, *language, *result;
|
||||
|
||||
cp = language = name;
|
||||
result = (char *)0;
|
||||
|
||||
while (*cp && *cp != '_' && *cp != '@' && *cp != '+' && *cp != ',')
|
||||
cp++;
|
||||
|
||||
/* This does not make sense: language has to be specified. As
|
||||
an exception we allow the variable to contain only the codeset
|
||||
name. Perhaps there are funny codeset names. */
|
||||
if (language == cp)
|
||||
{
|
||||
*lenp = strlen (language);
|
||||
result = language;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Next is the territory. */
|
||||
if (*cp == '_')
|
||||
do
|
||||
++cp;
|
||||
while (*cp && *cp != '.' && *cp != '@' && *cp != '+' && *cp != ',' && *cp != '_');
|
||||
|
||||
/* Now, finally, is the codeset. */
|
||||
result = cp;
|
||||
if (*cp == '.')
|
||||
do
|
||||
++cp;
|
||||
while (*cp && *cp != '@');
|
||||
|
||||
if (cp - result > 2)
|
||||
{
|
||||
result++;
|
||||
*lenp = cp - result;
|
||||
}
|
||||
else
|
||||
{
|
||||
*lenp = strlen (language);
|
||||
result = language;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
/* parens.c -- Implementation of matching parentheses feature. */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#include "rlconf.h"
|
||||
|
||||
#if !defined (PAREN_MATCHING)
|
||||
extern int rl_insert ();
|
||||
|
||||
int
|
||||
rl_insert_close (count, invoking_key)
|
||||
int count, invoking_key;
|
||||
{
|
||||
return (rl_insert (count, invoking_key));
|
||||
}
|
||||
|
||||
#else /* PAREN_MATCHING */
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (FD_SET) && !defined (HAVE_SELECT)
|
||||
# define HAVE_SELECT
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_SELECT)
|
||||
# include <sys/time.h>
|
||||
#endif /* HAVE_SELECT */
|
||||
#if defined (HAVE_SYS_SELECT_H)
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else /* !HAVE_STRING_H */
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#if !defined (strchr) && !defined (__STDC__)
|
||||
extern char *strchr (), *strrchr ();
|
||||
#endif /* !strchr && !__STDC__ */
|
||||
|
||||
#include "readline.h"
|
||||
|
||||
extern int rl_explicit_arg;
|
||||
|
||||
/* Non-zero means try to blink the matching open parenthesis when the
|
||||
close parenthesis is inserted. */
|
||||
#if defined (HAVE_SELECT)
|
||||
int rl_blink_matching_paren = 1;
|
||||
#else /* !HAVE_SELECT */
|
||||
int rl_blink_matching_paren = 0;
|
||||
#endif /* !HAVE_SELECT */
|
||||
|
||||
static int find_matching_open ();
|
||||
|
||||
int
|
||||
rl_insert_close (count, invoking_key)
|
||||
int count, invoking_key;
|
||||
{
|
||||
if (rl_explicit_arg || !rl_blink_matching_paren)
|
||||
rl_insert (count, invoking_key);
|
||||
else
|
||||
{
|
||||
#if defined (HAVE_SELECT)
|
||||
int orig_point, match_point, ready;
|
||||
struct timeval timer;
|
||||
fd_set readfds;
|
||||
|
||||
rl_insert (1, invoking_key);
|
||||
(*rl_redisplay_function) ();
|
||||
match_point =
|
||||
find_matching_open (rl_line_buffer, rl_point - 2, invoking_key);
|
||||
|
||||
/* Emacs might message or ring the bell here, but I don't. */
|
||||
if (match_point < 0)
|
||||
return -1;
|
||||
|
||||
FD_ZERO (&readfds);
|
||||
FD_SET (fileno (rl_instream), &readfds);
|
||||
timer.tv_sec = 1;
|
||||
timer.tv_usec = 500;
|
||||
|
||||
orig_point = rl_point;
|
||||
rl_point = match_point;
|
||||
(*rl_redisplay_function) ();
|
||||
ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
|
||||
rl_point = orig_point;
|
||||
#else /* !HAVE_SELECT */
|
||||
rl_insert (count, invoking_key);
|
||||
#endif /* !HAVE_SELECT */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
find_matching_open (string, from, closer)
|
||||
char *string;
|
||||
int from, closer;
|
||||
{
|
||||
register int i;
|
||||
int opener, level, delimiter;
|
||||
|
||||
switch (closer)
|
||||
{
|
||||
case ']': opener = '['; break;
|
||||
case '}': opener = '{'; break;
|
||||
case ')': opener = '('; break;
|
||||
default:
|
||||
return (-1);
|
||||
}
|
||||
|
||||
level = 1; /* The closer passed in counts as 1. */
|
||||
delimiter = 0; /* Delimited state unknown. */
|
||||
|
||||
for (i = from; i > -1; i--)
|
||||
{
|
||||
if (delimiter && (string[i] == delimiter))
|
||||
delimiter = 0;
|
||||
else if (rl_basic_quote_characters && strchr (rl_basic_quote_characters, string[i]))
|
||||
delimiter = string[i];
|
||||
else if (!delimiter && (string[i] == closer))
|
||||
level++;
|
||||
else if (!delimiter && (string[i] == opener))
|
||||
level--;
|
||||
|
||||
if (!level)
|
||||
break;
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
#endif /* PAREN_MATCHING */
|
||||
@@ -1,49 +0,0 @@
|
||||
/* posixdir.h -- Posix directory reading includes and defines. */
|
||||
|
||||
/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* This file should be included instead of <dirent.h> or <sys/dir.h>. */
|
||||
|
||||
#if !defined (_POSIXDIR_H_)
|
||||
#define _POSIXDIR_H_
|
||||
|
||||
#if defined (HAVE_DIRENT_H)
|
||||
# include <dirent.h>
|
||||
# define D_NAMLEN(d) (strlen ((d)->d_name))
|
||||
#else
|
||||
# if defined (HAVE_SYS_NDIR_H)
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
# if defined (HAVE_SYS_DIR_H)
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# if defined (HAVE_NDIR_H)
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
# if !defined (dirent)
|
||||
# define dirent direct
|
||||
# endif /* !dirent */
|
||||
# define D_NAMLEN(d) ((d)->d_namlen)
|
||||
#endif /* !HAVE_DIRENT_H */
|
||||
|
||||
#if defined (STRUCT_DIRENT_HAS_D_INO)
|
||||
# define d_fileno d_ino
|
||||
#endif
|
||||
|
||||
#endif /* !_POSIXDIR_H_ */
|
||||
@@ -1,142 +0,0 @@
|
||||
/* posixstat.h -- Posix stat(2) definitions for systems that
|
||||
don't have them. */
|
||||
|
||||
/* Copyright (C) 1987,1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* This file should be included instead of <sys/stat.h>.
|
||||
It relies on the local sys/stat.h to work though. */
|
||||
#if !defined (_POSIXSTAT_H_)
|
||||
#define _POSIXSTAT_H_
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined (STAT_MACROS_BROKEN)
|
||||
# undef S_ISBLK
|
||||
# undef S_ISCHR
|
||||
# undef S_ISDIR
|
||||
# undef S_ISFIFO
|
||||
# undef S_ISREG
|
||||
# undef S_ISLNK
|
||||
#endif /* STAT_MACROS_BROKEN */
|
||||
|
||||
/* These are guaranteed to work only on isc386 */
|
||||
#if !defined (S_IFDIR) && !defined (S_ISDIR)
|
||||
# define S_IFDIR 0040000
|
||||
#endif /* !S_IFDIR && !S_ISDIR */
|
||||
#if !defined (S_IFMT)
|
||||
# define S_IFMT 0170000
|
||||
#endif /* !S_IFMT */
|
||||
|
||||
/* Posix 1003.1 5.6.1.1 <sys/stat.h> file types */
|
||||
|
||||
/* Some Posix-wannabe systems define _S_IF* macros instead of S_IF*, but
|
||||
do not provide the S_IS* macros that Posix requires. */
|
||||
|
||||
#if defined (_S_IFMT) && !defined (S_IFMT)
|
||||
#define S_IFMT _S_IFMT
|
||||
#endif
|
||||
#if defined (_S_IFIFO) && !defined (S_IFIFO)
|
||||
#define S_IFIFO _S_IFIFO
|
||||
#endif
|
||||
#if defined (_S_IFCHR) && !defined (S_IFCHR)
|
||||
#define S_IFCHR _S_IFCHR
|
||||
#endif
|
||||
#if defined (_S_IFDIR) && !defined (S_IFDIR)
|
||||
#define S_IFDIR _S_IFDIR
|
||||
#endif
|
||||
#if defined (_S_IFBLK) && !defined (S_IFBLK)
|
||||
#define S_IFBLK _S_IFBLK
|
||||
#endif
|
||||
#if defined (_S_IFREG) && !defined (S_IFREG)
|
||||
#define S_IFREG _S_IFREG
|
||||
#endif
|
||||
#if defined (_S_IFLNK) && !defined (S_IFLNK)
|
||||
#define S_IFLNK _S_IFLNK
|
||||
#endif
|
||||
#if defined (_S_IFSOCK) && !defined (S_IFSOCK)
|
||||
#define S_IFSOCK _S_IFSOCK
|
||||
#endif
|
||||
|
||||
/* Test for each symbol individually and define the ones necessary (some
|
||||
systems claiming Posix compatibility define some but not all). */
|
||||
|
||||
#if defined (S_IFBLK) && !defined (S_ISBLK)
|
||||
#define S_ISBLK(m) (((m)&S_IFMT) == S_IFBLK) /* block device */
|
||||
#endif
|
||||
|
||||
#if defined (S_IFCHR) && !defined (S_ISCHR)
|
||||
#define S_ISCHR(m) (((m)&S_IFMT) == S_IFCHR) /* character device */
|
||||
#endif
|
||||
|
||||
#if defined (S_IFDIR) && !defined (S_ISDIR)
|
||||
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR) /* directory */
|
||||
#endif
|
||||
|
||||
#if defined (S_IFREG) && !defined (S_ISREG)
|
||||
#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG) /* file */
|
||||
#endif
|
||||
|
||||
#if defined (S_IFIFO) && !defined (S_ISFIFO)
|
||||
#define S_ISFIFO(m) (((m)&S_IFMT) == S_IFIFO) /* fifo - named pipe */
|
||||
#endif
|
||||
|
||||
#if defined (S_IFLNK) && !defined (S_ISLNK)
|
||||
#define S_ISLNK(m) (((m)&S_IFMT) == S_IFLNK) /* symbolic link */
|
||||
#endif
|
||||
|
||||
#if defined (S_IFSOCK) && !defined (S_ISSOCK)
|
||||
#define S_ISSOCK(m) (((m)&S_IFMT) == S_IFSOCK) /* socket */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* POSIX 1003.1 5.6.1.2 <sys/stat.h> File Modes
|
||||
*/
|
||||
|
||||
#if !defined (S_IRWXU)
|
||||
# if !defined (S_IREAD)
|
||||
# define S_IREAD 00400
|
||||
# define S_IWRITE 00200
|
||||
# define S_IEXEC 00100
|
||||
# endif /* S_IREAD */
|
||||
|
||||
# if !defined (S_IRUSR)
|
||||
# define S_IRUSR S_IREAD /* read, owner */
|
||||
# define S_IWUSR S_IWRITE /* write, owner */
|
||||
# define S_IXUSR S_IEXEC /* execute, owner */
|
||||
|
||||
# define S_IRGRP (S_IREAD >> 3) /* read, group */
|
||||
# define S_IWGRP (S_IWRITE >> 3) /* write, group */
|
||||
# define S_IXGRP (S_IEXEC >> 3) /* execute, group */
|
||||
|
||||
# define S_IROTH (S_IREAD >> 6) /* read, other */
|
||||
# define S_IWOTH (S_IWRITE >> 6) /* write, other */
|
||||
# define S_IXOTH (S_IEXEC >> 6) /* execute, other */
|
||||
# endif /* !S_IRUSR */
|
||||
|
||||
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
|
||||
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
|
||||
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
|
||||
#endif /* !S_IRWXU */
|
||||
|
||||
/* These are non-standard, but are used in builtins.c$symbolic_umask() */
|
||||
#define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH)
|
||||
#define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH)
|
||||
#define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
|
||||
|
||||
#endif /* _POSIXSTAT_H_ */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,392 +0,0 @@
|
||||
/* Readline.h -- the names of functions callable from within readline. */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (_READLINE_H_)
|
||||
#define _READLINE_H_
|
||||
|
||||
#if defined (READLINE_LIBRARY)
|
||||
# include "keymaps.h"
|
||||
# include "tilde.h"
|
||||
#else
|
||||
# include <readline/keymaps.h>
|
||||
# include <readline/tilde.h>
|
||||
#endif
|
||||
|
||||
/* Readline data structures. */
|
||||
|
||||
/* Maintaining the state of undo. We remember individual deletes and inserts
|
||||
on a chain of things to do. */
|
||||
|
||||
/* The actions that undo knows how to undo. Notice that UNDO_DELETE means
|
||||
to insert some text, and UNDO_INSERT means to delete some text. I.e.,
|
||||
the code tells undo what to undo, not how to undo it. */
|
||||
enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
|
||||
|
||||
/* What an element of THE_UNDO_LIST looks like. */
|
||||
typedef struct undo_list {
|
||||
struct undo_list *next;
|
||||
int start, end; /* Where the change took place. */
|
||||
char *text; /* The text to insert, if undoing a delete. */
|
||||
enum undo_code what; /* Delete, Insert, Begin, End. */
|
||||
} UNDO_LIST;
|
||||
|
||||
/* The current undo list for RL_LINE_BUFFER. */
|
||||
extern UNDO_LIST *rl_undo_list;
|
||||
|
||||
/* The data structure for mapping textual names to code addresses. */
|
||||
typedef struct _funmap {
|
||||
char *name;
|
||||
Function *function;
|
||||
} FUNMAP;
|
||||
|
||||
extern FUNMAP **funmap;
|
||||
|
||||
/* Functions available to bind to key sequences. */
|
||||
extern int
|
||||
rl_tilde_expand (), rl_set_mark (), rl_exchange_point_and_mark (),
|
||||
rl_beg_of_line (), rl_backward (), rl_delete (), rl_end_of_line (),
|
||||
rl_forward (), ding (), rl_newline (), rl_kill_line (),
|
||||
rl_copy_region_to_kill (), rl_kill_region (), rl_char_search (),
|
||||
rl_clear_screen (), rl_get_next_history (), rl_get_previous_history (),
|
||||
rl_quoted_insert (), rl_reverse_search_history (), rl_transpose_chars (),
|
||||
rl_unix_line_discard (), rl_unix_word_rubout (),
|
||||
rl_yank (), rl_rubout (), rl_backward_word (), rl_kill_word (),
|
||||
rl_forward_word (), rl_tab_insert (), rl_yank_pop (), rl_yank_nth_arg (),
|
||||
rl_backward_kill_word (), rl_backward_kill_line (), rl_transpose_words (),
|
||||
rl_complete (), rl_possible_completions (), rl_insert_completions (),
|
||||
rl_do_lowercase_version (), rl_kill_full_line (),
|
||||
rl_digit_argument (), rl_universal_argument (), rl_abort (),
|
||||
rl_undo_command (), rl_revert_line (), rl_beginning_of_history (),
|
||||
rl_end_of_history (), rl_forward_search_history (), rl_insert (),
|
||||
rl_upcase_word (), rl_downcase_word (), rl_capitalize_word (),
|
||||
rl_restart_output (), rl_re_read_init_file (),
|
||||
rl_dump_functions (), rl_dump_variables (), rl_dump_macros (),
|
||||
rl_delete_horizontal_space (), rl_history_search_forward (),
|
||||
rl_history_search_backward (), rl_tty_status (), rl_yank_last_arg (),
|
||||
rl_insert_comment (), rl_backward_char_search (),
|
||||
rl_copy_forward_word (), rl_copy_backward_word ();
|
||||
|
||||
/* Not available unless readline is compiled -DPAREN_MATCHING. */
|
||||
extern int rl_insert_close ();
|
||||
|
||||
/* Not available unless READLINE_CALLBACKS is defined. */
|
||||
extern void rl_callback_handler_install ();
|
||||
extern void rl_callback_read_char ();
|
||||
extern void rl_callback_handler_remove ();
|
||||
|
||||
/* These are *both* defined even when VI_MODE is not. */
|
||||
extern int rl_vi_editing_mode (), rl_emacs_editing_mode ();
|
||||
|
||||
/* Non incremental history searching. */
|
||||
extern int
|
||||
rl_noninc_forward_search (), rl_noninc_reverse_search (),
|
||||
rl_noninc_forward_search_again (), rl_noninc_reverse_search_again ();
|
||||
|
||||
/* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
|
||||
extern int rl_vi_check (), rl_vi_textmod_command ();
|
||||
extern int
|
||||
rl_vi_undo (), rl_vi_redo (), rl_vi_tilde_expand (),
|
||||
rl_vi_movement_mode (), rl_vi_insertion_mode (), rl_vi_arg_digit (),
|
||||
rl_vi_prev_word (), rl_vi_next_word (), rl_vi_char_search (),
|
||||
rl_vi_eof_maybe (), rl_vi_append_mode (), rl_vi_put (),
|
||||
rl_vi_append_eol (), rl_vi_insert_beg (), rl_vi_delete (),
|
||||
rl_vi_first_print (), rl_vi_fword (), rl_vi_fWord (), rl_vi_bword (),
|
||||
rl_vi_bWord (), rl_vi_eword (), rl_vi_eWord (), rl_vi_end_word (),
|
||||
rl_vi_change_case (), rl_vi_match (), rl_vi_bracktype (),
|
||||
rl_vi_change_char (), rl_vi_yank_arg (), rl_vi_search (),
|
||||
rl_vi_search_again (), rl_vi_subst (), rl_vi_overstrike (),
|
||||
rl_vi_overstrike_delete (), rl_vi_replace(), rl_vi_column (),
|
||||
rl_vi_delete_to (), rl_vi_change_to (), rl_vi_yank_to (),
|
||||
rl_vi_complete (), rl_vi_fetch_history (), rl_vi_set_mark (),
|
||||
rl_vi_goto_mark (), rl_vi_back_to_indent ();
|
||||
|
||||
/* Keyboard macro commands. */
|
||||
extern int rl_start_kbd_macro (), rl_end_kbd_macro ();
|
||||
extern int rl_call_last_kbd_macro ();
|
||||
extern void rl_push_macro_input ();
|
||||
|
||||
extern int rl_arrow_keys(), rl_refresh_line ();
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Well Published Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Readline functions. */
|
||||
/* Read a line of input. Prompt with PROMPT. A NULL PROMPT means none. */
|
||||
extern char *readline ();
|
||||
|
||||
/* These functions are from bind.c. */
|
||||
/* rl_add_defun (char *name, Function *function, int key)
|
||||
Add NAME to the list of named functions. Make FUNCTION
|
||||
be the function that gets called.
|
||||
If KEY is not -1, then bind it. */
|
||||
extern int rl_add_defun ();
|
||||
|
||||
extern Keymap rl_make_bare_keymap ();
|
||||
extern Keymap rl_copy_keymap ();
|
||||
extern Keymap rl_make_keymap ();
|
||||
extern void rl_discard_keymap ();
|
||||
extern Keymap rl_get_keymap (), rl_get_keymap_by_name ();
|
||||
extern void rl_set_keymap ();
|
||||
extern char *rl_get_keymap_name ();
|
||||
|
||||
extern int rl_bind_key (), rl_bind_key_in_map ();
|
||||
extern int rl_unbind_key (), rl_unbind_key_in_map ();
|
||||
extern int rl_set_key ();
|
||||
extern int rl_generic_bind ();
|
||||
extern int rl_parse_and_bind ();
|
||||
/* Backwards compatibility, use rl_generic_bind instead. */
|
||||
extern int rl_macro_bind (), rl_variable_bind ();
|
||||
|
||||
extern int rl_read_init_file ();
|
||||
|
||||
extern Function *rl_named_function (), *rl_function_of_keyseq ();
|
||||
extern char **rl_invoking_keyseqs (), **rl_invoking_keyseqs_in_map ();
|
||||
extern void rl_function_dumper ();
|
||||
extern void rl_variable_dumper ();
|
||||
extern void rl_macro_dumper ();
|
||||
extern void rl_list_funmap_names ();
|
||||
|
||||
/* Undocumented in the texinfo manual; not really useful to programs. */
|
||||
extern int rl_translate_keyseq ();
|
||||
extern void rl_initialize_funmap ();
|
||||
|
||||
/* Functions for undoing. */
|
||||
extern int rl_begin_undo_group (), rl_end_undo_group ();
|
||||
extern void rl_add_undo (), free_undo_list ();
|
||||
extern int rl_do_undo ();
|
||||
extern int rl_modifying ();
|
||||
|
||||
/* Functions for redisplay. */
|
||||
extern void rl_redisplay ();
|
||||
extern int rl_forced_update_display ();
|
||||
extern int rl_clear_message ();
|
||||
extern int rl_reset_line_state ();
|
||||
extern int rl_on_new_line ();
|
||||
|
||||
#if defined (__STDC__) && defined (USE_VARARGS) && defined (PREFER_STDARG)
|
||||
extern int rl_message (const char *, ...);
|
||||
#else
|
||||
extern int rl_message ();
|
||||
#endif
|
||||
|
||||
/* Undocumented in texinfo manual. */
|
||||
extern int rl_character_len ();
|
||||
extern int rl_show_char ();
|
||||
extern int crlf ();
|
||||
|
||||
/* Modifying text. */
|
||||
extern int rl_insert_text (), rl_delete_text ();
|
||||
extern int rl_kill_text ();
|
||||
extern char *rl_copy_text ();
|
||||
|
||||
/* `Public' utility functions. */
|
||||
extern int rl_reset_terminal ();
|
||||
extern int rl_stuff_char ();
|
||||
extern int rl_read_key (), rl_getc ();
|
||||
|
||||
extern int rl_initialize ();
|
||||
|
||||
/* Undocumented. */
|
||||
extern int rl_expand_prompt ();
|
||||
extern int rl_set_signals (), rl_clear_signals ();
|
||||
extern int maybe_save_line (), maybe_unsave_line (), maybe_replace_line ();
|
||||
|
||||
/* Completion functions. */
|
||||
/* These functions are from complete.c. */
|
||||
extern int rl_complete_internal ();
|
||||
|
||||
/* Return an array of strings which are the result of repeatadly calling
|
||||
FUNC with TEXT. */
|
||||
extern char **completion_matches ();
|
||||
extern char *username_completion_function ();
|
||||
extern char *filename_completion_function ();
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Well Published Variables */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* The version of this incarnation of the readline library. */
|
||||
extern char *rl_library_version;
|
||||
|
||||
/* The name of the calling program. You should initialize this to
|
||||
whatever was in argv[0]. It is used when parsing conditionals. */
|
||||
extern char *rl_readline_name;
|
||||
|
||||
/* The line buffer that is in use. */
|
||||
extern char *rl_line_buffer;
|
||||
|
||||
/* The location of point, and end. */
|
||||
extern int rl_point, rl_end;
|
||||
|
||||
extern int rl_mark;
|
||||
|
||||
extern int rl_done;
|
||||
|
||||
extern int rl_pending_input;
|
||||
|
||||
/* The name of the terminal to use. */
|
||||
extern char *rl_terminal_name;
|
||||
|
||||
/* The input and output streams. */
|
||||
extern FILE *rl_instream, *rl_outstream;
|
||||
|
||||
/* If non-zero, then this is the address of a function to call just
|
||||
before readline_internal () prints the first prompt. */
|
||||
extern Function *rl_startup_hook;
|
||||
|
||||
/* The address of a function to call periodically while Readline is
|
||||
awaiting character input, or NULL, for no event handling. */
|
||||
extern Function *rl_event_hook;
|
||||
|
||||
extern Function *rl_getc_function;
|
||||
extern VFunction *rl_redisplay_function;
|
||||
extern VFunction *rl_prep_term_function;
|
||||
extern VFunction *rl_deprep_term_function;
|
||||
|
||||
/* Dispatch variables. */
|
||||
extern Keymap rl_executing_keymap;
|
||||
extern Keymap rl_binding_keymap;
|
||||
|
||||
/* Completion variables. */
|
||||
/* Pointer to the generator function for completion_matches ().
|
||||
NULL means to use filename_entry_function (), the default filename
|
||||
completer. */
|
||||
extern Function *rl_completion_entry_function;
|
||||
|
||||
/* If rl_ignore_some_completions_function is non-NULL it is the address
|
||||
of a function to call after all of the possible matches have been
|
||||
generated, but before the actual completion is done to the input line.
|
||||
The function is called with one argument; a NULL terminated array
|
||||
of (char *). If your function removes any of the elements, they
|
||||
must be free()'ed. */
|
||||
extern Function *rl_ignore_some_completions_function;
|
||||
|
||||
/* Pointer to alternative function to create matches.
|
||||
Function is called with TEXT, START, and END.
|
||||
START and END are indices in RL_LINE_BUFFER saying what the boundaries
|
||||
of TEXT are.
|
||||
If this function exists and returns NULL then call the value of
|
||||
rl_completion_entry_function to try to match, otherwise use the
|
||||
array of strings returned. */
|
||||
extern CPPFunction *rl_attempted_completion_function;
|
||||
|
||||
/* The basic list of characters that signal a break between words for the
|
||||
completer routine. The initial contents of this variable is what
|
||||
breaks words in the shell, i.e. "n\"\\'`@$>". */
|
||||
extern char *rl_basic_word_break_characters;
|
||||
|
||||
/* The list of characters that signal a break between words for
|
||||
rl_complete_internal. The default list is the contents of
|
||||
rl_basic_word_break_characters. */
|
||||
extern char *rl_completer_word_break_characters;
|
||||
|
||||
/* List of characters which can be used to quote a substring of the line.
|
||||
Completion occurs on the entire substring, and within the substring
|
||||
rl_completer_word_break_characters are treated as any other character,
|
||||
unless they also appear within this list. */
|
||||
extern char *rl_completer_quote_characters;
|
||||
|
||||
/* List of quote characters which cause a word break. */
|
||||
extern char *rl_basic_quote_characters;
|
||||
|
||||
/* List of characters that need to be quoted in filenames by the completer. */
|
||||
extern char *rl_filename_quote_characters;
|
||||
|
||||
/* List of characters that are word break characters, but should be left
|
||||
in TEXT when it is passed to the completion function. The shell uses
|
||||
this to help determine what kind of completing to do. */
|
||||
extern char *rl_special_prefixes;
|
||||
|
||||
/* If non-zero, then this is the address of a function to call when
|
||||
completing on a directory name. The function is called with
|
||||
the address of a string (the current directory name) as an arg. */
|
||||
extern Function *rl_directory_completion_hook;
|
||||
|
||||
/* Backwards compatibility with previous versions of readline. */
|
||||
#define rl_symbolic_link_hook rl_directory_completion_hook
|
||||
|
||||
/* Non-zero means that the results of the matches are to be treated
|
||||
as filenames. This is ALWAYS zero on entry, and can only be changed
|
||||
within a completion entry finder function. */
|
||||
extern int rl_filename_completion_desired;
|
||||
|
||||
/* Non-zero means that the results of the matches are to be quoted using
|
||||
double quotes (or an application-specific quoting mechanism) if the
|
||||
filename contains any characters in rl_word_break_chars. This is
|
||||
ALWAYS non-zero on entry, and can only be changed within a completion
|
||||
entry finder function. */
|
||||
extern int rl_filename_quoting_desired;
|
||||
|
||||
/* Set to a function to quote a filename in an application-specific fashion.
|
||||
Called with the text to quote, the type of match found (single or multiple)
|
||||
and a pointer to the quoting character to be used, which the function can
|
||||
reset if desired. */
|
||||
extern CPFunction *rl_filename_quoting_function;
|
||||
|
||||
/* Function to call to remove quoting characters from a filename. Called
|
||||
before completion is attempted, so the embedded quotes do not interfere
|
||||
with matching names in the file system. */
|
||||
extern CPFunction *rl_filename_dequoting_function;
|
||||
|
||||
/* Function to call to decide whether or not a word break character is
|
||||
quoted. If a character is quoted, it does not break words for the
|
||||
completer. */
|
||||
extern Function *rl_char_is_quoted_p;
|
||||
|
||||
/* Non-zero means to suppress normal filename completion after the
|
||||
user-specified completion function has been called. */
|
||||
extern int rl_attempted_completion_over;
|
||||
|
||||
/* Set to a character describing the type of completion being attempted by
|
||||
rl_complete_internal; available for use by application completion
|
||||
functions. */
|
||||
extern int rl_completion_type;
|
||||
|
||||
/* Character appended to completed words when at the end of the line. The
|
||||
default is a space. Nothing is added if this is '\0'. */
|
||||
extern int rl_completion_append_character;
|
||||
|
||||
/* If this is non-zero, completion is (temporarily) inhibited, and the
|
||||
completion character will be inserted as any other. */
|
||||
extern int rl_inhibit_completion;
|
||||
|
||||
/* Definitions available for use by readline clients. */
|
||||
#define RL_PROMPT_START_IGNORE '\001'
|
||||
#define RL_PROMPT_END_IGNORE '\002'
|
||||
|
||||
/* Possible values for do_replace argument to rl_filename_quoting_function,
|
||||
called by rl_complete_internal. */
|
||||
#define NO_MATCH 0
|
||||
#define SINGLE_MATCH 1
|
||||
#define MULT_MATCH 2
|
||||
|
||||
#if !defined (savestring)
|
||||
#define savestring rl_savestring
|
||||
extern char *savestring (); /* XXX backwards compatibility */
|
||||
#endif
|
||||
|
||||
#endif /* _READLINE_H_ */
|
||||
@@ -1,63 +0,0 @@
|
||||
/* rlconf.h -- readline configuration definitions */
|
||||
|
||||
/* Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the Readline Library (the Library), a set of
|
||||
routines for providing Emacs style line input to programs that ask
|
||||
for it.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (_RLCONF_H_)
|
||||
#define _RLCONF_H_
|
||||
|
||||
/* Define this if you want the vi-mode editing available. */
|
||||
#define VI_MODE
|
||||
|
||||
/* Define this to get an indication of file type when listing completions. */
|
||||
#define VISIBLE_STATS
|
||||
|
||||
/* If defined, readline shows opening parens and braces when closing
|
||||
paren or brace entered. */
|
||||
#define PAREN_MATCHING
|
||||
|
||||
/* This definition is needed by readline.c, rltty.c, and signals.c. */
|
||||
/* If on, then readline handles signals in a way that doesn't screw. */
|
||||
#define HANDLE_SIGNALS
|
||||
|
||||
/* Ugly but working hack for binding prefix meta. */
|
||||
#define PREFIX_META_HACK
|
||||
|
||||
/* The final, last-ditch effort file name for an init file. */
|
||||
#define DEFAULT_INPUTRC "~/.inputrc"
|
||||
|
||||
/* If defined, expand tabs to spaces. */
|
||||
#define DISPLAY_TABS
|
||||
|
||||
/* If defined, use the terminal escape sequence to move the cursor forward
|
||||
over a character when updating the line rather than rewriting it. */
|
||||
/* #define HACK_TERMCAP_MOTION */
|
||||
|
||||
/* The string inserted by the `insert comment' command. */
|
||||
#define RL_COMMENT_BEGIN_DEFAULT "#"
|
||||
|
||||
/* Define this if you want code that allows readline to be used in an
|
||||
X `callback' style. */
|
||||
#if !defined (SHELL)
|
||||
# define READLINE_CALLBACKS
|
||||
#endif
|
||||
|
||||
#endif /* _RLCONF_H_ */
|
||||
@@ -1,146 +0,0 @@
|
||||
/* rldefs.h -- an attempt to isolate some of the system-specific defines
|
||||
for readline. This should be included after any files that define
|
||||
system-specific constants like _POSIX_VERSION or USG. */
|
||||
|
||||
/* Copyright (C) 1987,1989 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the Readline Library (the Library), a set of
|
||||
routines for providing Emacs style line input to programs that ask
|
||||
for it.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (_RLDEFS_H_)
|
||||
#define _RLDEFS_H_
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#if defined (_POSIX_VERSION) && !defined (TERMIOS_MISSING)
|
||||
# define TERMIOS_TTY_DRIVER
|
||||
#else
|
||||
# if defined (HAVE_TERMIO_H)
|
||||
# define TERMIO_TTY_DRIVER
|
||||
# else
|
||||
# define NEW_TTY_DRIVER
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_SYS_STREAM_H)
|
||||
# include <sys/stream.h>
|
||||
#endif /* HAVE_SYS_STREAM_H */
|
||||
#if defined (HAVE_SYS_PTEM_H)
|
||||
# include <sys/ptem.h>
|
||||
# define _IO_PTEM_H /* work around SVR4.2 1.1.4 bug */
|
||||
#endif /* HAVE_SYS_PTEM_H */
|
||||
#if defined (HAVE_SYS_PTE_H)
|
||||
# include <sys/pte.h>
|
||||
#endif /* HAVE_SYS_PTE_H */
|
||||
|
||||
/* Posix macro to check file in statbuf for directory-ness.
|
||||
This requires that <sys/stat.h> be included before this test. */
|
||||
#if defined (S_IFDIR) && !defined (S_ISDIR)
|
||||
# define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
/* Decide which flavor of the header file describing the C library
|
||||
string functions to include and include it. */
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else /* !HAVE_STRING_H */
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#if !defined (strchr) && !defined (__STDC__)
|
||||
extern char *strchr (), *strrchr ();
|
||||
#endif /* !strchr && !__STDC__ */
|
||||
|
||||
#if defined (PREFER_STDARG)
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# if defined (PREFER_VARARGS)
|
||||
# include <varargs.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRCASECMP)
|
||||
#define _rl_stricmp strcasecmp
|
||||
#define _rl_strnicmp strncasecmp
|
||||
#else
|
||||
extern int _rl_stricmp (), _rl_strnicmp ();
|
||||
#endif
|
||||
|
||||
#if !defined (emacs_mode)
|
||||
# define no_mode -1
|
||||
# define vi_mode 0
|
||||
# define emacs_mode 1
|
||||
#endif
|
||||
|
||||
/* If you cast map[key].function to type (Keymap) on a Cray,
|
||||
the compiler takes the value of map[key].function and
|
||||
divides it by 4 to convert between pointer types (pointers
|
||||
to functions and pointers to structs are different sizes).
|
||||
This is not what is wanted. */
|
||||
#if defined (CRAY)
|
||||
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function)
|
||||
# define KEYMAP_TO_FUNCTION(data) (Function *)((int)(data))
|
||||
#else
|
||||
# define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function)
|
||||
# define KEYMAP_TO_FUNCTION(data) (Function *)(data)
|
||||
#endif
|
||||
|
||||
#ifndef savestring
|
||||
extern char *xmalloc ();
|
||||
#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
|
||||
#endif
|
||||
|
||||
/* Possible values for _rl_bell_preference. */
|
||||
#define NO_BELL 0
|
||||
#define AUDIBLE_BELL 1
|
||||
#define VISIBLE_BELL 2
|
||||
|
||||
/* Definitions used when searching the line for characters. */
|
||||
/* NOTE: it is necessary that opposite directions are inverses */
|
||||
#define FTO 1 /* forward to */
|
||||
#define BTO -1 /* backward to */
|
||||
#define FFIND 2 /* forward find */
|
||||
#define BFIND -2 /* backward find */
|
||||
|
||||
/* Possible values for the found_quote flags word used by the completion
|
||||
functions. It says what kind of (shell-like) quoting we found anywhere
|
||||
in the line. */
|
||||
#define RL_QF_SINGLE_QUOTE 0x1
|
||||
#define RL_QF_DOUBLE_QUOTE 0x2
|
||||
#define RL_QF_BACKSLASH 0x4
|
||||
|
||||
/* Default readline line buffer length. */
|
||||
#define DEFAULT_BUFFER_SIZE 256
|
||||
|
||||
#if !defined (STREQ)
|
||||
#define STREQ(a, b) (((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
|
||||
#define STREQN(a, b, n) (((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
|
||||
#endif
|
||||
|
||||
#if !defined (FREE)
|
||||
# define FREE(x) if (x) free (x)
|
||||
#endif
|
||||
|
||||
/* CONFIGURATION SECTION */
|
||||
#include "rlconf.h"
|
||||
|
||||
#endif /* !_RLDEFS_H_ */
|
||||
@@ -1,726 +0,0 @@
|
||||
/* rltty.c -- functions to prepare and restore the terminal for readline's
|
||||
use. */
|
||||
|
||||
/* Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#include "rldefs.h"
|
||||
|
||||
#if !defined (SHELL) && defined (GWINSZ_IN_SYS_IOCTL)
|
||||
# include <sys/ioctl.h>
|
||||
#endif /* !SHELL && GWINSZ_IN_SYS_IOCTL */
|
||||
|
||||
#include "rltty.h"
|
||||
#include "readline.h"
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
extern int readline_echoing_p;
|
||||
extern int _rl_eof_char;
|
||||
|
||||
extern int _rl_enable_keypad, _rl_enable_meta;
|
||||
|
||||
#if defined (__GO32__)
|
||||
# include <pc.h>
|
||||
# undef HANDLE_SIGNALS
|
||||
#endif /* __GO32__ */
|
||||
|
||||
/* Indirect functions to allow apps control over terminal management. */
|
||||
extern void rl_prep_terminal (), rl_deprep_terminal ();
|
||||
|
||||
VFunction *rl_prep_term_function = rl_prep_terminal;
|
||||
VFunction *rl_deprep_term_function = rl_deprep_terminal;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Signal Management */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
static sigset_t sigint_set, sigint_oset;
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
# if defined (HAVE_BSD_SIGNALS)
|
||||
static int sigint_oldmask;
|
||||
# endif /* HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
static int sigint_blocked;
|
||||
|
||||
/* Cause SIGINT to not be delivered until the corresponding call to
|
||||
release_sigint(). */
|
||||
static void
|
||||
block_sigint ()
|
||||
{
|
||||
if (sigint_blocked)
|
||||
return;
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigemptyset (&sigint_set);
|
||||
sigemptyset (&sigint_oset);
|
||||
sigaddset (&sigint_set, SIGINT);
|
||||
sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset);
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
# if defined (HAVE_BSD_SIGNALS)
|
||||
sigint_oldmask = sigblock (sigmask (SIGINT));
|
||||
# else /* !HAVE_BSD_SIGNALS */
|
||||
# if defined (HAVE_USG_SIGHOLD)
|
||||
sighold (SIGINT);
|
||||
# endif /* HAVE_USG_SIGHOLD */
|
||||
# endif /* !HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
sigint_blocked = 1;
|
||||
}
|
||||
|
||||
/* Allow SIGINT to be delivered. */
|
||||
static void
|
||||
release_sigint ()
|
||||
{
|
||||
if (!sigint_blocked)
|
||||
return;
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
|
||||
#else
|
||||
# if defined (HAVE_BSD_SIGNALS)
|
||||
sigsetmask (sigint_oldmask);
|
||||
# else /* !HAVE_BSD_SIGNALS */
|
||||
# if defined (HAVE_USG_SIGHOLD)
|
||||
sigrelse (SIGINT);
|
||||
# endif /* HAVE_USG_SIGHOLD */
|
||||
# endif /* !HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
sigint_blocked = 0;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Saving and Restoring the TTY */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Non-zero means that the terminal is in a prepped state. */
|
||||
static int terminal_prepped;
|
||||
|
||||
/* If non-zero, means that this process has called tcflow(fd, TCOOFF)
|
||||
and output is suspended. */
|
||||
#if defined (__ksr1__)
|
||||
static int ksrflow;
|
||||
#endif
|
||||
|
||||
#if !defined (SHELL) && defined (TIOCGWINSZ)
|
||||
/* Dummy call to force a backgrounded readline to stop before it tries
|
||||
to get the tty settings. */
|
||||
static void
|
||||
set_winsize (tty)
|
||||
int tty;
|
||||
{
|
||||
struct winsize w;
|
||||
|
||||
if (ioctl (tty, TIOCGWINSZ, &w) == 0)
|
||||
(void) ioctl (tty, TIOCSWINSZ, &w);
|
||||
}
|
||||
#else /* SHELL || !TIOCGWINSZ */
|
||||
# define set_winsize(tty)
|
||||
#endif /* SHELL || !TIOCGWINSZ */
|
||||
|
||||
#if defined (NEW_TTY_DRIVER)
|
||||
|
||||
/* Values for the `flags' field of a struct bsdtty. This tells which
|
||||
elements of the struct bsdtty have been fetched from the system and
|
||||
are valid. */
|
||||
#define SGTTY_SET 0x01
|
||||
#define LFLAG_SET 0x02
|
||||
#define TCHARS_SET 0x04
|
||||
#define LTCHARS_SET 0x08
|
||||
|
||||
struct bsdtty {
|
||||
struct sgttyb sgttyb; /* Basic BSD tty driver information. */
|
||||
int lflag; /* Local mode flags, like LPASS8. */
|
||||
#if defined (TIOCGETC)
|
||||
struct tchars tchars; /* Terminal special characters, including ^S and ^Q. */
|
||||
#endif
|
||||
#if defined (TIOCGLTC)
|
||||
struct ltchars ltchars; /* 4.2 BSD editing characters */
|
||||
#endif
|
||||
int flags; /* Bitmap saying which parts of the struct are valid. */
|
||||
};
|
||||
|
||||
#define TIOTYPE struct bsdtty
|
||||
|
||||
static TIOTYPE otio;
|
||||
|
||||
static int
|
||||
get_tty_settings (tty, tiop)
|
||||
int tty;
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
set_winsize (tty);
|
||||
|
||||
tiop->flags = tiop->lflag = 0;
|
||||
|
||||
ioctl (tty, TIOCGETP, &(tiop->sgttyb));
|
||||
tiop->flags |= SGTTY_SET;
|
||||
|
||||
#if defined (TIOCLGET)
|
||||
ioctl (tty, TIOCLGET, &(tiop->lflag));
|
||||
tiop->flags |= LFLAG_SET;
|
||||
#endif
|
||||
|
||||
#if defined (TIOCGETC)
|
||||
ioctl (tty, TIOCGETC, &(tiop->tchars));
|
||||
tiop->flags |= TCHARS_SET;
|
||||
#endif
|
||||
|
||||
#if defined (TIOCGLTC)
|
||||
ioctl (tty, TIOCGLTC, &(tiop->ltchars));
|
||||
tiop->flags |= LTCHARS_SET;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
set_tty_settings (tty, tiop)
|
||||
int tty;
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
if (tiop->flags & SGTTY_SET)
|
||||
{
|
||||
ioctl (tty, TIOCSETN, &(tiop->sgttyb));
|
||||
tiop->flags &= ~SGTTY_SET;
|
||||
}
|
||||
readline_echoing_p = 1;
|
||||
|
||||
#if defined (TIOCLSET)
|
||||
if (tiop->flags & LFLAG_SET)
|
||||
{
|
||||
ioctl (tty, TIOCLSET, &(tiop->lflag));
|
||||
tiop->flags &= ~LFLAG_SET;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (TIOCSETC)
|
||||
if (tiop->flags & TCHARS_SET)
|
||||
{
|
||||
ioctl (tty, TIOCSETC, &(tiop->tchars));
|
||||
tiop->flags &= ~TCHARS_SET;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (TIOCSLTC)
|
||||
if (tiop->flags & LTCHARS_SET)
|
||||
{
|
||||
ioctl (tty, TIOCSLTC, &(tiop->ltchars));
|
||||
tiop->flags &= ~LTCHARS_SET;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
prepare_terminal_settings (meta_flag, otio, tiop)
|
||||
int meta_flag;
|
||||
TIOTYPE otio, *tiop;
|
||||
{
|
||||
#if !defined (__GO32__)
|
||||
readline_echoing_p = (otio.sgttyb.sg_flags & ECHO);
|
||||
|
||||
/* Copy the original settings to the structure we're going to use for
|
||||
our settings. */
|
||||
tiop->sgttyb = otio.sgttyb;
|
||||
tiop->lflag = otio.lflag;
|
||||
#if defined (TIOCGETC)
|
||||
tiop->tchars = otio.tchars;
|
||||
#endif
|
||||
#if defined (TIOCGLTC)
|
||||
tiop->ltchars = otio.ltchars;
|
||||
#endif
|
||||
tiop->flags = otio.flags;
|
||||
|
||||
/* First, the basic settings to put us into character-at-a-time, no-echo
|
||||
input mode. */
|
||||
tiop->sgttyb.sg_flags &= ~(ECHO | CRMOD);
|
||||
tiop->sgttyb.sg_flags |= CBREAK;
|
||||
|
||||
/* If this terminal doesn't care how the 8th bit is used, then we can
|
||||
use it for the meta-key. If only one of even or odd parity is
|
||||
specified, then the terminal is using parity, and we cannot. */
|
||||
#if !defined (ANYP)
|
||||
# define ANYP (EVENP | ODDP)
|
||||
#endif
|
||||
if (((otio.sgttyb.sg_flags & ANYP) == ANYP) ||
|
||||
((otio.sgttyb.sg_flags & ANYP) == 0))
|
||||
{
|
||||
tiop->sgttyb.sg_flags |= ANYP;
|
||||
|
||||
/* Hack on local mode flags if we can. */
|
||||
#if defined (TIOCLGET)
|
||||
# if defined (LPASS8)
|
||||
tiop->lflag |= LPASS8;
|
||||
# endif /* LPASS8 */
|
||||
#endif /* TIOCLGET */
|
||||
}
|
||||
|
||||
#if defined (TIOCGETC)
|
||||
# if defined (USE_XON_XOFF)
|
||||
/* Get rid of terminal output start and stop characters. */
|
||||
tiop->tchars.t_stopc = -1; /* C-s */
|
||||
tiop->tchars.t_startc = -1; /* C-q */
|
||||
|
||||
/* If there is an XON character, bind it to restart the output. */
|
||||
if (otio.tchars.t_startc != -1)
|
||||
rl_bind_key (otio.tchars.t_startc, rl_restart_output);
|
||||
# endif /* USE_XON_XOFF */
|
||||
|
||||
/* If there is an EOF char, bind _rl_eof_char to it. */
|
||||
if (otio.tchars.t_eofc != -1)
|
||||
_rl_eof_char = otio.tchars.t_eofc;
|
||||
|
||||
# if defined (NO_KILL_INTR)
|
||||
/* Get rid of terminal-generated SIGQUIT and SIGINT. */
|
||||
tiop->tchars.t_quitc = -1; /* C-\ */
|
||||
tiop->tchars.t_intrc = -1; /* C-c */
|
||||
# endif /* NO_KILL_INTR */
|
||||
#endif /* TIOCGETC */
|
||||
|
||||
#if defined (TIOCGLTC)
|
||||
/* Make the interrupt keys go away. Just enough to make people happy. */
|
||||
tiop->ltchars.t_dsuspc = -1; /* C-y */
|
||||
tiop->ltchars.t_lnextc = -1; /* C-v */
|
||||
#endif /* TIOCGLTC */
|
||||
#endif /* !__GO32__ */
|
||||
}
|
||||
|
||||
#else /* !defined (NEW_TTY_DRIVER) */
|
||||
|
||||
#if !defined (VMIN)
|
||||
# define VMIN VEOF
|
||||
#endif
|
||||
|
||||
#if !defined (VTIME)
|
||||
# define VTIME VEOL
|
||||
#endif
|
||||
|
||||
#if defined (TERMIOS_TTY_DRIVER)
|
||||
# define TIOTYPE struct termios
|
||||
# define DRAIN_OUTPUT(fd) tcdrain (fd)
|
||||
# define GETATTR(tty, tiop) (tcgetattr (tty, tiop))
|
||||
# ifdef M_UNIX
|
||||
# define SETATTR(tty, tiop) (tcsetattr (tty, TCSANOW, tiop))
|
||||
# else
|
||||
# define SETATTR(tty, tiop) (tcsetattr (tty, TCSADRAIN, tiop))
|
||||
# endif /* !M_UNIX */
|
||||
#else
|
||||
# define TIOTYPE struct termio
|
||||
# define DRAIN_OUTPUT(fd)
|
||||
# define GETATTR(tty, tiop) (ioctl (tty, TCGETA, tiop))
|
||||
# define SETATTR(tty, tiop) (ioctl (tty, TCSETA, tiop))
|
||||
#endif /* !TERMIOS_TTY_DRIVER */
|
||||
|
||||
static TIOTYPE otio;
|
||||
|
||||
#if defined (FLUSHO)
|
||||
# define OUTPUT_BEING_FLUSHED(tp) (tp->c_lflag & FLUSHO)
|
||||
#else
|
||||
# define OUTPUT_BEING_FLUSHED(tp) 0
|
||||
#endif
|
||||
|
||||
static void
|
||||
rltty_warning (msg)
|
||||
char *msg;
|
||||
{
|
||||
fprintf (stderr, "readline: warning: %s\n", msg);
|
||||
}
|
||||
|
||||
#if defined (_AIX)
|
||||
void
|
||||
setopost(tp)
|
||||
TIOTYPE *tp;
|
||||
{
|
||||
if ((tp->c_oflag & OPOST) == 0)
|
||||
{
|
||||
rltty_warning ("turning on OPOST for terminal\r");
|
||||
tp->c_oflag |= OPOST|ONLCR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
get_tty_settings (tty, tiop)
|
||||
int tty;
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
int ioctl_ret;
|
||||
set_winsize (tty);
|
||||
|
||||
while (1)
|
||||
{
|
||||
ioctl_ret = GETATTR (tty, tiop);
|
||||
if (ioctl_ret < 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
return -1;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
if (OUTPUT_BEING_FLUSHED (tiop))
|
||||
{
|
||||
#if defined (FLUSHO) && defined (_AIX41)
|
||||
rltty_warning ("turning off output flushing");
|
||||
tiop->c_lflag &= ~FLUSHO;
|
||||
break;
|
||||
#else
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined (_AIX)
|
||||
setopost(tiop);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
set_tty_settings (tty, tiop)
|
||||
int tty;
|
||||
TIOTYPE *tiop;
|
||||
{
|
||||
while (SETATTR (tty, tiop) < 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
return -1;
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
#if defined (TERMIOS_TTY_DRIVER)
|
||||
# if defined (__ksr1__)
|
||||
if (ksrflow)
|
||||
{
|
||||
ksrflow = 0;
|
||||
tcflow (tty, TCOON);
|
||||
}
|
||||
# else /* !ksr1 */
|
||||
tcflow (tty, TCOON); /* Simulate a ^Q. */
|
||||
# endif /* !ksr1 */
|
||||
#else
|
||||
ioctl (tty, TCXONC, 1); /* Simulate a ^Q. */
|
||||
#endif /* !TERMIOS_TTY_DRIVER */
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
prepare_terminal_settings (meta_flag, otio, tiop)
|
||||
int meta_flag;
|
||||
TIOTYPE otio, *tiop;
|
||||
{
|
||||
readline_echoing_p = (otio.c_lflag & ECHO);
|
||||
|
||||
tiop->c_lflag &= ~(ICANON | ECHO);
|
||||
|
||||
if ((unsigned char) otio.c_cc[VEOF] != (unsigned char) _POSIX_VDISABLE)
|
||||
_rl_eof_char = otio.c_cc[VEOF];
|
||||
|
||||
#if defined (USE_XON_XOFF)
|
||||
#if defined (IXANY)
|
||||
tiop->c_iflag &= ~(IXON | IXOFF | IXANY);
|
||||
#else
|
||||
/* `strict' Posix systems do not define IXANY. */
|
||||
tiop->c_iflag &= ~(IXON | IXOFF);
|
||||
#endif /* IXANY */
|
||||
#endif /* USE_XON_XOFF */
|
||||
|
||||
/* Only turn this off if we are using all 8 bits. */
|
||||
if (((tiop->c_cflag & CSIZE) == CS8) || meta_flag)
|
||||
tiop->c_iflag &= ~(ISTRIP | INPCK);
|
||||
|
||||
/* Make sure we differentiate between CR and NL on input. */
|
||||
tiop->c_iflag &= ~(ICRNL | INLCR);
|
||||
|
||||
#if !defined (HANDLE_SIGNALS)
|
||||
tiop->c_lflag &= ~ISIG;
|
||||
#else
|
||||
tiop->c_lflag |= ISIG;
|
||||
#endif
|
||||
|
||||
tiop->c_cc[VMIN] = 1;
|
||||
tiop->c_cc[VTIME] = 0;
|
||||
|
||||
#if defined (FLUSHO)
|
||||
if (OUTPUT_BEING_FLUSHED (tiop))
|
||||
{
|
||||
tiop->c_lflag &= ~FLUSHO;
|
||||
otio.c_lflag &= ~FLUSHO;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Turn off characters that we need on Posix systems with job control,
|
||||
just to be sure. This includes ^Y and ^V. This should not really
|
||||
be necessary. */
|
||||
#if defined (TERMIOS_TTY_DRIVER) && defined (_POSIX_VDISABLE)
|
||||
|
||||
#if defined (VLNEXT)
|
||||
tiop->c_cc[VLNEXT] = _POSIX_VDISABLE;
|
||||
#endif
|
||||
|
||||
#if defined (VDSUSP)
|
||||
tiop->c_cc[VDSUSP] = _POSIX_VDISABLE;
|
||||
#endif
|
||||
|
||||
#endif /* TERMIOS_TTY_DRIVER && _POSIX_VDISABLE */
|
||||
}
|
||||
#endif /* NEW_TTY_DRIVER */
|
||||
|
||||
/* Put the terminal in CBREAK mode so that we can detect key presses. */
|
||||
void
|
||||
rl_prep_terminal (meta_flag)
|
||||
int meta_flag;
|
||||
{
|
||||
#if !defined (__GO32__)
|
||||
int tty;
|
||||
TIOTYPE tio;
|
||||
|
||||
if (terminal_prepped)
|
||||
return;
|
||||
|
||||
/* Try to keep this function from being INTerrupted. */
|
||||
block_sigint ();
|
||||
|
||||
tty = fileno (rl_instream);
|
||||
|
||||
if (get_tty_settings (tty, &tio) < 0)
|
||||
{
|
||||
release_sigint ();
|
||||
return;
|
||||
}
|
||||
|
||||
otio = tio;
|
||||
|
||||
prepare_terminal_settings (meta_flag, otio, &tio);
|
||||
|
||||
if (set_tty_settings (tty, &tio) < 0)
|
||||
{
|
||||
release_sigint ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_rl_enable_keypad)
|
||||
_rl_control_keypad (1);
|
||||
|
||||
fflush (rl_outstream);
|
||||
terminal_prepped = 1;
|
||||
|
||||
release_sigint ();
|
||||
#endif /* !__GO32__ */
|
||||
}
|
||||
|
||||
/* Restore the terminal's normal settings and modes. */
|
||||
void
|
||||
rl_deprep_terminal ()
|
||||
{
|
||||
#if !defined (__GO32__)
|
||||
int tty;
|
||||
|
||||
if (!terminal_prepped)
|
||||
return;
|
||||
|
||||
/* Try to keep this function from being interrupted. */
|
||||
block_sigint ();
|
||||
|
||||
tty = fileno (rl_instream);
|
||||
|
||||
if (_rl_enable_keypad)
|
||||
_rl_control_keypad (0);
|
||||
|
||||
fflush (rl_outstream);
|
||||
|
||||
if (set_tty_settings (tty, &otio) < 0)
|
||||
{
|
||||
release_sigint ();
|
||||
return;
|
||||
}
|
||||
|
||||
terminal_prepped = 0;
|
||||
|
||||
release_sigint ();
|
||||
#endif /* !__GO32__ */
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Bogus Flow Control */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
int
|
||||
rl_restart_output (count, key)
|
||||
int count, key;
|
||||
{
|
||||
int fildes = fileno (rl_outstream);
|
||||
#if defined (TIOCSTART)
|
||||
#if defined (apollo)
|
||||
ioctl (&fildes, TIOCSTART, 0);
|
||||
#else
|
||||
ioctl (fildes, TIOCSTART, 0);
|
||||
#endif /* apollo */
|
||||
|
||||
#else /* !TIOCSTART */
|
||||
# if defined (TERMIOS_TTY_DRIVER)
|
||||
# if defined (__ksr1__)
|
||||
if (ksrflow)
|
||||
{
|
||||
ksrflow = 0;
|
||||
tcflow (fildes, TCOON);
|
||||
}
|
||||
# else /* !ksr1 */
|
||||
tcflow (fildes, TCOON); /* Simulate a ^Q. */
|
||||
# endif /* !ksr1 */
|
||||
# else /* !TERMIOS_TTY_DRIVER */
|
||||
# if defined (TCXONC)
|
||||
ioctl (fildes, TCXONC, TCOON);
|
||||
# endif /* TCXONC */
|
||||
# endif /* !TERMIOS_TTY_DRIVER */
|
||||
#endif /* !TIOCSTART */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rl_stop_output (count, key)
|
||||
int count, key;
|
||||
{
|
||||
int fildes = fileno (rl_instream);
|
||||
|
||||
#if defined (TIOCSTOP)
|
||||
# if defined (apollo)
|
||||
ioctl (&fildes, TIOCSTOP, 0);
|
||||
# else
|
||||
ioctl (fildes, TIOCSTOP, 0);
|
||||
# endif /* apollo */
|
||||
#else /* !TIOCSTOP */
|
||||
# if defined (TERMIOS_TTY_DRIVER)
|
||||
# if defined (__ksr1__)
|
||||
ksrflow = 1;
|
||||
# endif /* ksr1 */
|
||||
tcflow (fildes, TCOOFF);
|
||||
# else
|
||||
# if defined (TCXONC)
|
||||
ioctl (fildes, TCXONC, TCOON);
|
||||
# endif /* TCXONC */
|
||||
# endif /* !TERMIOS_TTY_DRIVER */
|
||||
#endif /* !TIOCSTOP */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Default Key Bindings */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
void
|
||||
rltty_set_default_bindings (kmap)
|
||||
Keymap kmap;
|
||||
{
|
||||
TIOTYPE ttybuff;
|
||||
int tty = fileno (rl_instream);
|
||||
|
||||
#if defined (NEW_TTY_DRIVER)
|
||||
|
||||
#define SET_SPECIAL(sc, func) \
|
||||
do \
|
||||
{ \
|
||||
int ic; \
|
||||
ic = sc; \
|
||||
if (ic != -1 && kmap[ic].type == ISFUNC) \
|
||||
kmap[ic].function = func; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
if (get_tty_settings (tty, &ttybuff) == 0)
|
||||
{
|
||||
if (ttybuff.flags & SGTTY_SET)
|
||||
{
|
||||
SET_SPECIAL (ttybuff.sgttyb.sg_erase, rl_rubout);
|
||||
SET_SPECIAL (ttybuff.sgttyb.sg_kill, rl_unix_line_discard);
|
||||
}
|
||||
|
||||
# if defined (TIOCGLTC)
|
||||
if (ttybuff.flags & LTCHARS_SET)
|
||||
{
|
||||
SET_SPECIAL (ttybuff.ltchars.t_werasc, rl_unix_word_rubout);
|
||||
SET_SPECIAL (ttybuff.ltchars.t_lnextc, rl_quoted_insert);
|
||||
}
|
||||
# endif /* TIOCGLTC */
|
||||
}
|
||||
|
||||
#else /* !NEW_TTY_DRIVER */
|
||||
|
||||
#define SET_SPECIAL(sc, func) \
|
||||
do \
|
||||
{ \
|
||||
unsigned char uc; \
|
||||
uc = ttybuff.c_cc[sc]; \
|
||||
if (uc != (unsigned char)_POSIX_VDISABLE && kmap[uc].type == ISFUNC) \
|
||||
kmap[uc].function = func; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
if (get_tty_settings (tty, &ttybuff) == 0)
|
||||
{
|
||||
SET_SPECIAL (VERASE, rl_rubout);
|
||||
SET_SPECIAL (VKILL, rl_unix_line_discard);
|
||||
|
||||
# if defined (VLNEXT) && defined (TERMIOS_TTY_DRIVER)
|
||||
SET_SPECIAL (VLNEXT, rl_quoted_insert);
|
||||
# endif /* VLNEXT && TERMIOS_TTY_DRIVER */
|
||||
|
||||
# if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER)
|
||||
SET_SPECIAL (VWERASE, rl_unix_word_rubout);
|
||||
# endif /* VWERASE && TERMIOS_TTY_DRIVER */
|
||||
}
|
||||
#endif /* !NEW_TTY_DRIVER */
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/* rltty.h - tty driver-related definitions used by some library files. */
|
||||
|
||||
/* Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the Readline Library (the Library), a set of
|
||||
routines for providing Emacs style line input to programs that ask
|
||||
for it.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (_RLTTY_H_)
|
||||
#define _RLTTY_H
|
||||
|
||||
/* Posix systems use termios and the Posix signal functions. */
|
||||
#if defined (TERMIOS_TTY_DRIVER)
|
||||
# include <termios.h>
|
||||
#endif /* TERMIOS_TTY_DRIVER */
|
||||
|
||||
/* System V machines use termio. */
|
||||
#if defined (TERMIO_TTY_DRIVER)
|
||||
# include <termio.h>
|
||||
# if !defined (TCOON)
|
||||
# define TCOON 1
|
||||
# endif
|
||||
#endif /* TERMIO_TTY_DRIVER */
|
||||
|
||||
/* Other (BSD) machines use sgtty. */
|
||||
#if defined (NEW_TTY_DRIVER)
|
||||
# include <sgtty.h>
|
||||
#endif
|
||||
|
||||
/* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
|
||||
it is not already defined. It is used both to determine if a
|
||||
special character is disabled and to disable certain special
|
||||
characters. Posix systems should set to 0, USG systems to -1. */
|
||||
#if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
|
||||
# if defined (_SVR4_VDISABLE)
|
||||
# define _POSIX_VDISABLE _SVR4_VDISABLE
|
||||
# else
|
||||
# if defined (_POSIX_VERSION)
|
||||
# define _POSIX_VDISABLE 0
|
||||
# else /* !_POSIX_VERSION */
|
||||
# define _POSIX_VDISABLE -1
|
||||
# endif /* !_POSIX_VERSION */
|
||||
# endif /* !_SVR4_DISABLE */
|
||||
#endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
|
||||
|
||||
#endif /* _RLTTY_H_ */
|
||||
@@ -1,369 +0,0 @@
|
||||
/* search.c - code for non-incremental searching in emacs and vi modes. */
|
||||
|
||||
/* Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the Readline Library (the Library), a set of
|
||||
routines for providing Emacs style line input to programs that ask
|
||||
for it.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "rldefs.h"
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
#define abs(x) (((x) > 0) ? (x) : -(x))
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
/* Variables imported from readline.c */
|
||||
extern int rl_point, rl_end, rl_line_buffer_len;
|
||||
extern int rl_editing_mode;
|
||||
extern char *rl_prompt;
|
||||
extern char *rl_line_buffer;
|
||||
extern HIST_ENTRY *saved_line_for_history;
|
||||
extern Function *rl_last_func;
|
||||
|
||||
/* Functions imported from the rest of the library. */
|
||||
extern int _rl_free_history_entry ();
|
||||
extern char *_rl_make_prompt_for_search ();
|
||||
extern void _rl_restore_prompt ();
|
||||
extern void rl_extend_line_buffer ();
|
||||
|
||||
static char *noninc_search_string = (char *) NULL;
|
||||
static int noninc_history_pos;
|
||||
static char *prev_line_found = (char *) NULL;
|
||||
|
||||
/* Search the history list for STRING starting at absolute history position
|
||||
POS. If STRING begins with `^', the search must match STRING at the
|
||||
beginning of a history line, otherwise a full substring match is performed
|
||||
for STRING. DIR < 0 means to search backwards through the history list,
|
||||
DIR >= 0 means to search forward. */
|
||||
static int
|
||||
noninc_search_from_pos (string, pos, dir)
|
||||
char *string;
|
||||
int pos, dir;
|
||||
{
|
||||
int ret, old;
|
||||
|
||||
old = where_history ();
|
||||
history_set_pos (pos);
|
||||
|
||||
if (*string == '^')
|
||||
ret = history_search_prefix (string + 1, dir);
|
||||
else
|
||||
ret = history_search (string, dir);
|
||||
|
||||
if (ret != -1)
|
||||
ret = where_history ();
|
||||
|
||||
history_set_pos (old);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/* Search for a line in the history containing STRING. If DIR is < 0, the
|
||||
search is backwards through previous entries, else through subsequent
|
||||
entries. */
|
||||
static void
|
||||
noninc_dosearch (string, dir)
|
||||
char *string;
|
||||
int dir;
|
||||
{
|
||||
int oldpos, pos, line_len;
|
||||
HIST_ENTRY *entry;
|
||||
|
||||
if (string == 0 || *string == '\0' || noninc_history_pos < 0)
|
||||
{
|
||||
ding ();
|
||||
return;
|
||||
}
|
||||
|
||||
pos = noninc_search_from_pos (string, noninc_history_pos + dir, dir);
|
||||
if (pos == -1)
|
||||
{
|
||||
/* Search failed, current history position unchanged. */
|
||||
maybe_unsave_line ();
|
||||
rl_clear_message ();
|
||||
rl_point = 0;
|
||||
ding ();
|
||||
return;
|
||||
}
|
||||
|
||||
noninc_history_pos = pos;
|
||||
|
||||
oldpos = where_history ();
|
||||
history_set_pos (noninc_history_pos);
|
||||
entry = current_history ();
|
||||
#if defined (VI_MODE)
|
||||
if (rl_editing_mode != vi_mode)
|
||||
#endif
|
||||
history_set_pos (oldpos);
|
||||
|
||||
line_len = strlen (entry->line);
|
||||
if (line_len >= rl_line_buffer_len)
|
||||
rl_extend_line_buffer (line_len);
|
||||
strcpy (rl_line_buffer, entry->line);
|
||||
|
||||
rl_undo_list = (UNDO_LIST *)entry->data;
|
||||
rl_end = strlen (rl_line_buffer);
|
||||
rl_point = 0;
|
||||
rl_clear_message ();
|
||||
|
||||
if (saved_line_for_history)
|
||||
_rl_free_history_entry (saved_line_for_history);
|
||||
saved_line_for_history = (HIST_ENTRY *)NULL;
|
||||
}
|
||||
|
||||
/* Search non-interactively through the history list. DIR < 0 means to
|
||||
search backwards through the history of previous commands; otherwise
|
||||
the search is for commands subsequent to the current position in the
|
||||
history list. PCHAR is the character to use for prompting when reading
|
||||
the search string; if not specified (0), it defaults to `:'. */
|
||||
static void
|
||||
noninc_search (dir, pchar)
|
||||
int dir;
|
||||
int pchar;
|
||||
{
|
||||
int saved_point, c;
|
||||
char *p;
|
||||
|
||||
maybe_save_line ();
|
||||
saved_point = rl_point;
|
||||
|
||||
/* Use the line buffer to read the search string. */
|
||||
rl_line_buffer[0] = 0;
|
||||
rl_end = rl_point = 0;
|
||||
|
||||
p = _rl_make_prompt_for_search (pchar ? pchar : ':');
|
||||
rl_message (p, 0, 0);
|
||||
free (p);
|
||||
|
||||
#define SEARCH_RETURN _rl_restore_prompt (); return
|
||||
|
||||
/* Read the search string. */
|
||||
while (c = rl_read_key ())
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case CTRL('H'):
|
||||
case RUBOUT:
|
||||
if (rl_point == 0)
|
||||
{
|
||||
maybe_unsave_line ();
|
||||
rl_clear_message ();
|
||||
rl_point = saved_point;
|
||||
SEARCH_RETURN;
|
||||
}
|
||||
rl_rubout (1, c);
|
||||
break;
|
||||
|
||||
case CTRL('W'):
|
||||
rl_unix_word_rubout (1, c);
|
||||
break;
|
||||
|
||||
case CTRL('U'):
|
||||
rl_unix_line_discard (1, c);
|
||||
break;
|
||||
|
||||
case RETURN:
|
||||
case NEWLINE:
|
||||
goto dosearch;
|
||||
/* NOTREACHED */
|
||||
break;
|
||||
|
||||
case CTRL('C'):
|
||||
case CTRL('G'):
|
||||
maybe_unsave_line ();
|
||||
rl_clear_message ();
|
||||
rl_point = saved_point;
|
||||
ding ();
|
||||
SEARCH_RETURN;
|
||||
|
||||
default:
|
||||
rl_insert (1, c);
|
||||
break;
|
||||
}
|
||||
(*rl_redisplay_function) ();
|
||||
}
|
||||
|
||||
dosearch:
|
||||
/* If rl_point == 0, we want to re-use the previous search string and
|
||||
start from the saved history position. If there's no previous search
|
||||
string, punt. */
|
||||
if (rl_point == 0)
|
||||
{
|
||||
if (!noninc_search_string)
|
||||
{
|
||||
ding ();
|
||||
SEARCH_RETURN;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We want to start the search from the current history position. */
|
||||
noninc_history_pos = where_history ();
|
||||
if (noninc_search_string)
|
||||
free (noninc_search_string);
|
||||
noninc_search_string = savestring (rl_line_buffer);
|
||||
}
|
||||
|
||||
_rl_restore_prompt ();
|
||||
noninc_dosearch (noninc_search_string, dir);
|
||||
}
|
||||
|
||||
/* Search forward through the history list for a string. If the vi-mode
|
||||
code calls this, KEY will be `?'. */
|
||||
int
|
||||
rl_noninc_forward_search (count, key)
|
||||
int count, key;
|
||||
{
|
||||
noninc_search (1, (key == '?') ? '?' : 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reverse search the history list for a string. If the vi-mode code
|
||||
calls this, KEY will be `/'. */
|
||||
int
|
||||
rl_noninc_reverse_search (count, key)
|
||||
int count, key;
|
||||
{
|
||||
noninc_search (-1, (key == '/') ? '/' : 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Search forward through the history list for the last string searched
|
||||
for. If there is no saved search string, abort. */
|
||||
int
|
||||
rl_noninc_forward_search_again (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (!noninc_search_string)
|
||||
{
|
||||
ding ();
|
||||
return (-1);
|
||||
}
|
||||
noninc_dosearch (noninc_search_string, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reverse search in the history list for the last string searched
|
||||
for. If there is no saved search string, abort. */
|
||||
int
|
||||
rl_noninc_reverse_search_again (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (!noninc_search_string)
|
||||
{
|
||||
ding ();
|
||||
return (-1);
|
||||
}
|
||||
noninc_dosearch (noninc_search_string, -1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rl_history_search_internal (count, direction)
|
||||
int count, direction;
|
||||
{
|
||||
HIST_ENTRY *temp, *old_temp;
|
||||
int line_len;
|
||||
|
||||
maybe_save_line ();
|
||||
|
||||
temp = old_temp = (HIST_ENTRY *)NULL;
|
||||
while (count)
|
||||
{
|
||||
temp = (direction < 0) ? previous_history () : next_history ();
|
||||
if (temp == 0)
|
||||
break;
|
||||
/* On an empty prefix, make this the same as previous-history. */
|
||||
if (rl_point == 0)
|
||||
{
|
||||
count--;
|
||||
continue;
|
||||
}
|
||||
if (STREQN (rl_line_buffer, temp->line, rl_point))
|
||||
{
|
||||
/* Don't find multiple instances of the same line. */
|
||||
if (prev_line_found && STREQ (prev_line_found, temp->line))
|
||||
continue;
|
||||
if (direction < 0)
|
||||
old_temp = temp;
|
||||
prev_line_found = temp->line;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
if (temp == 0)
|
||||
{
|
||||
if (direction < 0 && old_temp)
|
||||
temp = old_temp;
|
||||
else
|
||||
{
|
||||
maybe_unsave_line ();
|
||||
ding ();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
line_len = strlen (temp->line);
|
||||
if (line_len >= rl_line_buffer_len)
|
||||
rl_extend_line_buffer (line_len);
|
||||
strcpy (rl_line_buffer, temp->line);
|
||||
rl_undo_list = (UNDO_LIST *)temp->data;
|
||||
rl_end = line_len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Search forward in the history for the string of characters
|
||||
from the start of the line to rl_point. This is a non-incremental
|
||||
search. */
|
||||
int
|
||||
rl_history_search_forward (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
if (count == 0)
|
||||
return (0);
|
||||
if (rl_last_func != rl_history_search_forward)
|
||||
prev_line_found = (char *)NULL;
|
||||
return (rl_history_search_internal (abs (count), (count > 0) ? 1 : -1));
|
||||
}
|
||||
|
||||
/* Search backward through the history for the string of characters
|
||||
from the start of the line to rl_point. This is a non-incremental
|
||||
search. */
|
||||
int
|
||||
rl_history_search_backward (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
if (count == 0)
|
||||
return (0);
|
||||
if (rl_last_func != rl_history_search_backward)
|
||||
prev_line_found = (char *)NULL;
|
||||
return (rl_history_search_internal (abs (count), (count > 0) ? -1 : 1));
|
||||
}
|
||||
@@ -1,334 +0,0 @@
|
||||
/* signals.c -- signal handling support for readline. */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h> /* Just for NULL. Yuck. */
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
#if defined (GWINSZ_IN_SYS_IOCTL)
|
||||
# include <sys/ioctl.h>
|
||||
#endif /* GWINSZ_IN_SYS_IOCTL */
|
||||
|
||||
#if defined (__GO32__)
|
||||
# undef HANDLE_SIGNALS
|
||||
#endif /* __GO32__ */
|
||||
|
||||
#if defined (HANDLE_SIGNALS)
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
extern int readline_echoing_p;
|
||||
extern int rl_pending_input;
|
||||
extern int _rl_meta_flag;
|
||||
|
||||
extern void free_undo_list ();
|
||||
extern void _rl_get_screen_size ();
|
||||
extern void _rl_redisplay_after_sigwinch ();
|
||||
extern void _rl_clean_up_for_exit ();
|
||||
extern void _rl_kill_kbd_macro ();
|
||||
extern void _rl_init_argument ();
|
||||
extern void rl_deprep_terminal (), rl_prep_terminal ();
|
||||
|
||||
#if !defined (RETSIGTYPE)
|
||||
# if defined (VOID_SIGHANDLER)
|
||||
# define RETSIGTYPE void
|
||||
# else
|
||||
# define RETSIGTYPE int
|
||||
# endif /* !VOID_SIGHANDLER */
|
||||
#endif /* !RETSIGTYPE */
|
||||
|
||||
#if defined (VOID_SIGHANDLER)
|
||||
# define SIGHANDLER_RETURN return
|
||||
#else
|
||||
# define SIGHANDLER_RETURN return (0)
|
||||
#endif
|
||||
|
||||
/* This typedef is equivalant to the one for Function; it allows us
|
||||
to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
|
||||
typedef RETSIGTYPE SigHandler ();
|
||||
|
||||
static SigHandler *rl_set_sighandler ();
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Signal Handling */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
typedef struct sigaction sighandler_cxt;
|
||||
# define rl_sigaction(s, nh, oh) sigaction(s, nh, oh)
|
||||
#else
|
||||
typedef struct { SigHandler *sa_handler; } sighandler_cxt;
|
||||
# define sigemptyset(m)
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
static sighandler_cxt old_int, old_alrm;
|
||||
|
||||
#if !defined (SHELL)
|
||||
static sighandler_cxt old_tstp, old_ttou, old_ttin, old_term;
|
||||
#endif /* !SHELL */
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
static sighandler_cxt old_winch;
|
||||
#endif
|
||||
|
||||
/* Readline signal handler functions. */
|
||||
|
||||
static RETSIGTYPE
|
||||
rl_signal_handler (sig)
|
||||
int sig;
|
||||
{
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigset_t set;
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
# if defined (HAVE_BSD_SIGNALS)
|
||||
long omask;
|
||||
# endif /* HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
#if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
|
||||
/* Since the signal will not be blocked while we are in the signal
|
||||
handler, ignore it until rl_clear_signals resets the catcher. */
|
||||
if (sig == SIGINT || sig == SIGALRM)
|
||||
rl_set_sighandler (sig, SIG_IGN, (sighandler_cxt *)NULL);
|
||||
#endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
|
||||
|
||||
switch (sig)
|
||||
{
|
||||
case SIGINT:
|
||||
{
|
||||
register HIST_ENTRY *entry;
|
||||
|
||||
free_undo_list ();
|
||||
|
||||
entry = current_history ();
|
||||
if (entry)
|
||||
entry->data = (char *)NULL;
|
||||
}
|
||||
_rl_kill_kbd_macro ();
|
||||
rl_clear_message ();
|
||||
_rl_init_argument ();
|
||||
|
||||
#if defined (SIGTSTP)
|
||||
case SIGTSTP:
|
||||
case SIGTTOU:
|
||||
case SIGTTIN:
|
||||
#endif /* SIGTSTP */
|
||||
case SIGALRM:
|
||||
case SIGTERM:
|
||||
_rl_clean_up_for_exit ();
|
||||
(*rl_deprep_term_function) ();
|
||||
rl_clear_signals ();
|
||||
rl_pending_input = 0;
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
|
||||
sigdelset (&set, sig);
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
# if defined (HAVE_BSD_SIGNALS)
|
||||
omask = sigblock (0);
|
||||
# endif /* HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
kill (getpid (), sig);
|
||||
|
||||
/* Let the signal that we just sent through. */
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL);
|
||||
#else /* !HAVE_POSIX_SIGNALS */
|
||||
# if defined (HAVE_BSD_SIGNALS)
|
||||
sigsetmask (omask & ~(sigmask (sig)));
|
||||
# endif /* HAVE_BSD_SIGNALS */
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
(*rl_prep_term_function) (_rl_meta_flag);
|
||||
rl_set_signals ();
|
||||
}
|
||||
|
||||
SIGHANDLER_RETURN;
|
||||
}
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
static RETSIGTYPE
|
||||
rl_handle_sigwinch (sig)
|
||||
int sig;
|
||||
{
|
||||
SigHandler *oh;
|
||||
|
||||
if (readline_echoing_p)
|
||||
{
|
||||
_rl_get_screen_size (fileno (rl_instream), 1);
|
||||
_rl_redisplay_after_sigwinch ();
|
||||
}
|
||||
|
||||
/* If another sigwinch handler has been installed, call it. */
|
||||
oh = (SigHandler *)old_winch.sa_handler;
|
||||
if (oh && oh != (SigHandler *)SIG_IGN && oh != (SigHandler *)SIG_DFL)
|
||||
(*oh) (sig);
|
||||
|
||||
SIGHANDLER_RETURN;
|
||||
}
|
||||
#endif /* SIGWINCH */
|
||||
|
||||
/* Functions to manage signal handling. */
|
||||
|
||||
#if !defined (HAVE_POSIX_SIGNALS)
|
||||
static int
|
||||
rl_sigaction (sig, nh, oh)
|
||||
int sig;
|
||||
sighandler_cxt *nh, *oh;
|
||||
{
|
||||
oh->sa_handler = signal (sig, nh->sa_handler);
|
||||
return 0;
|
||||
}
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
|
||||
/* Set up a readline-specific signal handler, saving the old signal
|
||||
information in OHANDLER. Return the old signal handler, like
|
||||
signal(). */
|
||||
static SigHandler *
|
||||
rl_set_sighandler (sig, handler, ohandler)
|
||||
int sig;
|
||||
SigHandler *handler;
|
||||
sighandler_cxt *ohandler;
|
||||
{
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
struct sigaction act;
|
||||
|
||||
act.sa_handler = handler;
|
||||
act.sa_flags = 0;
|
||||
sigemptyset (&act.sa_mask);
|
||||
sigemptyset (&ohandler->sa_mask);
|
||||
sigaction (sig, &act, ohandler);
|
||||
#else
|
||||
ohandler->sa_handler = (SigHandler *)signal (sig, handler);
|
||||
#endif /* !HAVE_POSIX_SIGNALS */
|
||||
return (ohandler->sa_handler);
|
||||
}
|
||||
|
||||
int
|
||||
rl_set_signals ()
|
||||
{
|
||||
sighandler_cxt dummy;
|
||||
SigHandler *oh;
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigemptyset (&dummy.sa_mask);
|
||||
#endif
|
||||
|
||||
oh = rl_set_sighandler (SIGINT, rl_signal_handler, &old_int);
|
||||
if (oh == (SigHandler *)SIG_IGN)
|
||||
rl_sigaction (SIGINT, &old_int, &dummy);
|
||||
|
||||
oh = rl_set_sighandler (SIGALRM, rl_signal_handler, &old_alrm);
|
||||
if (oh == (SigHandler *)SIG_IGN)
|
||||
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
||||
#if defined (HAVE_POSIX_SIGNALS) && defined (SA_RESTART)
|
||||
/* If the application using readline has already installed a signal
|
||||
handler with SA_RESTART, SIGALRM will cause reads to be restarted
|
||||
automatically, so readline should just get out of the way. Since
|
||||
we tested for SIG_IGN above, we can just test for SIG_DFL here. */
|
||||
if (oh != (SigHandler *)SIG_DFL && (old_alrm.sa_flags & SA_RESTART))
|
||||
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
||||
#endif /* HAVE_POSIX_SIGNALS */
|
||||
|
||||
#if !defined (SHELL)
|
||||
|
||||
#if defined (SIGTSTP)
|
||||
oh = rl_set_sighandler (SIGTSTP, rl_signal_handler, &old_tstp);
|
||||
if (oh == (SigHandler *)SIG_IGN)
|
||||
rl_sigaction (SIGTSTP, &old_tstp, &dummy);
|
||||
#else
|
||||
oh = (SigHandler *)NULL;
|
||||
#endif /* SIGTSTP */
|
||||
|
||||
#if defined (SIGTTOU)
|
||||
rl_set_sighandler (SIGTTOU, rl_signal_handler, &old_ttou);
|
||||
rl_set_sighandler (SIGTTIN, rl_signal_handler, &old_ttin);
|
||||
|
||||
if (oh == (SigHandler *)SIG_IGN)
|
||||
{
|
||||
rl_set_sighandler (SIGTTOU, SIG_IGN, &dummy);
|
||||
rl_set_sighandler (SIGTTIN, SIG_IGN, &dummy);
|
||||
}
|
||||
#endif /* SIGTTOU */
|
||||
|
||||
/* Handle SIGTERM if we're not being compiled as part of bash. */
|
||||
rl_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
|
||||
#endif /* !SHELL */
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
rl_set_sighandler (SIGWINCH, rl_handle_sigwinch, &old_winch);
|
||||
#endif /* SIGWINCH */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rl_clear_signals ()
|
||||
{
|
||||
sighandler_cxt dummy;
|
||||
|
||||
#if defined (HAVE_POSIX_SIGNALS)
|
||||
sigemptyset (&dummy.sa_mask);
|
||||
#endif
|
||||
|
||||
rl_sigaction (SIGINT, &old_int, &dummy);
|
||||
rl_sigaction (SIGALRM, &old_alrm, &dummy);
|
||||
|
||||
#if !defined (SHELL)
|
||||
|
||||
#if defined (SIGTSTP)
|
||||
rl_sigaction (SIGTSTP, &old_tstp, &dummy);
|
||||
#endif
|
||||
|
||||
#if defined (SIGTTOU)
|
||||
rl_sigaction (SIGTTOU, &old_ttou, &dummy);
|
||||
rl_sigaction (SIGTTIN, &old_ttin, &dummy);
|
||||
#endif /* SIGTTOU */
|
||||
|
||||
rl_sigaction (SIGTERM, &old_term, &dummy);
|
||||
|
||||
#endif /* !SHELL */
|
||||
|
||||
#if defined (SIGWINCH)
|
||||
sigemptyset (&dummy.sa_mask);
|
||||
rl_sigaction (SIGWINCH, &old_winch, &dummy);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* HANDLE_SIGNALS */
|
||||
@@ -1,57 +0,0 @@
|
||||
/* tcap.h -- termcap library functions and variables. */
|
||||
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the Readline Library (the Library), a set of
|
||||
routines for providing Emacs style line input to programs that ask
|
||||
for it.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (_RLTCAP_H_)
|
||||
#define _RLTCAP_H_
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_TERMCAP_H)
|
||||
# include <termcap.h>
|
||||
#else
|
||||
|
||||
/* On Solaris2, sys/types.h #includes sys/reg.h, which #defines PC.
|
||||
Unfortunately, PC is a global variable used by the termcap library. */
|
||||
#ifdef PC
|
||||
# undef PC
|
||||
#endif
|
||||
|
||||
extern char PC;
|
||||
extern char *UP, *BC;
|
||||
|
||||
extern short ospeed;
|
||||
|
||||
extern int tgetent ();
|
||||
extern int tgetflag ();
|
||||
extern int tgetnum ();
|
||||
extern char *tgetstr ();
|
||||
|
||||
extern int tputs ();
|
||||
|
||||
extern char *tgoto ();
|
||||
|
||||
#endif /* HAVE_TERMCAP_H */
|
||||
|
||||
#endif /* !_RLTCAP_H_ */
|
||||
@@ -1,554 +0,0 @@
|
||||
/* terminal.c -- controlling the terminal with termcap. */
|
||||
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "posixstat.h"
|
||||
#include <fcntl.h>
|
||||
#if defined (HAVE_SYS_FILE_H)
|
||||
# include <sys/file.h>
|
||||
#endif /* HAVE_SYS_FILE_H */
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#if defined (HAVE_LOCALE_H)
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
#include "tcap.h"
|
||||
|
||||
#if defined (GWINSZ_IN_SYS_IOCTL)
|
||||
# include <sys/ioctl.h>
|
||||
#endif /* GWINSZ_IN_SYS_IOCTL */
|
||||
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
/* Variables and functions imported from readline.c */
|
||||
extern FILE *_rl_in_stream, *_rl_out_stream;
|
||||
extern int readline_echoing_p;
|
||||
extern int _rl_bell_preference;
|
||||
extern Keymap _rl_keymap;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Terminal and Termcap */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
static char *term_buffer = (char *)NULL;
|
||||
static char *term_string_buffer = (char *)NULL;
|
||||
|
||||
static int tcap_initialized;
|
||||
|
||||
/* Non-zero means this terminal can't really do anything. */
|
||||
static int dumb_term;
|
||||
|
||||
#if !defined (__linux__)
|
||||
/* If this causes problems, add back the `extern'. */
|
||||
/*extern*/ char PC, *BC, *UP;
|
||||
#endif /* __linux__ */
|
||||
|
||||
/* Some strings to control terminal actions. These are output by tputs (). */
|
||||
char *term_goto, *term_clreol, *term_cr, *term_clrpag, *term_backspace;
|
||||
char *term_pc;
|
||||
|
||||
/* Non-zero if we determine that the terminal can do character insertion. */
|
||||
int terminal_can_insert = 0;
|
||||
|
||||
/* How to insert characters. */
|
||||
char *term_im, *term_ei, *term_ic, *term_ip, *term_IC;
|
||||
|
||||
/* How to delete characters. */
|
||||
char *term_dc, *term_DC;
|
||||
|
||||
#if defined (HACK_TERMCAP_MOTION)
|
||||
char *term_forward_char;
|
||||
#endif /* HACK_TERMCAP_MOTION */
|
||||
|
||||
/* How to go up a line. */
|
||||
char *term_up;
|
||||
|
||||
/* A visible bell, if the terminal can be made to flash the screen. */
|
||||
static char *visible_bell;
|
||||
|
||||
/* Non-zero means the terminal can auto-wrap lines. */
|
||||
int _rl_term_autowrap;
|
||||
|
||||
/* Non-zero means that this terminal has a meta key. */
|
||||
static int term_has_meta;
|
||||
|
||||
/* The sequences to write to turn on and off the meta key, if this
|
||||
terminal has one. */
|
||||
static char *term_mm, *term_mo;
|
||||
|
||||
/* The key sequences output by the arrow keys, if this terminal has any. */
|
||||
static char *term_ku, *term_kd, *term_kr, *term_kl;
|
||||
|
||||
/* How to initialize and reset the arrow keys, if this terminal has any. */
|
||||
static char *term_ks, *term_ke;
|
||||
|
||||
/* The key sequences sent by the Home and End keys, if any. */
|
||||
static char *term_kh, *term_kH;
|
||||
|
||||
/* Variables that hold the screen dimensions, used by the display code. */
|
||||
int screenwidth, screenheight, screenchars;
|
||||
|
||||
/* Non-zero means the user wants to enable the keypad. */
|
||||
int _rl_enable_keypad;
|
||||
|
||||
/* Non-zero means the user wants to enable a meta key. */
|
||||
int _rl_enable_meta = 1;
|
||||
|
||||
/* Re-initialize the terminal considering that the TERM/TERMCAP variable
|
||||
has changed. */
|
||||
int
|
||||
rl_reset_terminal (terminal_name)
|
||||
char *terminal_name;
|
||||
{
|
||||
_rl_init_terminal_io (terminal_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined (SHELL)
|
||||
static void
|
||||
set_lines_and_columns (lines, cols)
|
||||
int lines, cols;
|
||||
{
|
||||
char *b;
|
||||
|
||||
#if defined (HAVE_PUTENV)
|
||||
b = xmalloc (24);
|
||||
sprintf (b, "LINES=%d", lines);
|
||||
putenv (b);
|
||||
b = xmalloc (24);
|
||||
sprintf (b, "COLUMNS=%d", cols);
|
||||
putenv (b);
|
||||
#else /* !HAVE_PUTENV */
|
||||
# if defined (HAVE_SETENV)
|
||||
b = xmalloc (8);
|
||||
sprintf (b, "%d", lines);
|
||||
setenv ("LINES", b, 1);
|
||||
b = xmalloc (8);
|
||||
sprintf (b, "%d", cols);
|
||||
setenv ("COLUMNS", b, 1);
|
||||
# endif /* HAVE_SETENV */
|
||||
#endif /* !HAVE_PUTENV */
|
||||
}
|
||||
#else /* SHELL */
|
||||
extern void set_lines_and_columns ();
|
||||
#endif /* SHELL */
|
||||
|
||||
/* Get readline's idea of the screen size. TTY is a file descriptor open
|
||||
to the terminal. If IGNORE_ENV is true, we do not pay attention to the
|
||||
values of $LINES and $COLUMNS. The tests for TERM_STRING_BUFFER being
|
||||
non-null serve to check whether or not we have initialized termcap. */
|
||||
void
|
||||
_rl_get_screen_size (tty, ignore_env)
|
||||
int tty, ignore_env;
|
||||
{
|
||||
char *ss;
|
||||
#if defined (TIOCGWINSZ)
|
||||
struct winsize window_size;
|
||||
#endif /* TIOCGWINSZ */
|
||||
|
||||
#if defined (TIOCGWINSZ)
|
||||
if (ioctl (tty, TIOCGWINSZ, &window_size) == 0)
|
||||
{
|
||||
screenwidth = (int) window_size.ws_col;
|
||||
screenheight = (int) window_size.ws_row;
|
||||
}
|
||||
#endif /* TIOCGWINSZ */
|
||||
|
||||
/* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
|
||||
is unset. */
|
||||
if (screenwidth <= 0)
|
||||
{
|
||||
if (ignore_env == 0 && (ss = getenv ("COLUMNS")))
|
||||
screenwidth = atoi (ss);
|
||||
|
||||
if (screenwidth <= 0 && term_string_buffer)
|
||||
screenwidth = tgetnum ("co");
|
||||
}
|
||||
|
||||
/* Environment variable LINES overrides setting of "li" if IGNORE_ENV
|
||||
is unset. */
|
||||
if (screenheight <= 0)
|
||||
{
|
||||
if (ignore_env == 0 && (ss = getenv ("LINES")))
|
||||
screenheight = atoi (ss);
|
||||
|
||||
if (screenheight <= 0 && term_string_buffer)
|
||||
screenheight = tgetnum ("li");
|
||||
}
|
||||
|
||||
/* If all else fails, default to 80x24 terminal. */
|
||||
if (screenwidth <= 1)
|
||||
screenwidth = 80;
|
||||
|
||||
if (screenheight <= 0)
|
||||
screenheight = 24;
|
||||
|
||||
/* If we're being compiled as part of bash, set the environment
|
||||
variables $LINES and $COLUMNS to new values. Otherwise, just
|
||||
do a pair of putenv () or setenv () calls. */
|
||||
set_lines_and_columns (screenheight, screenwidth);
|
||||
|
||||
if (!_rl_term_autowrap)
|
||||
screenwidth--;
|
||||
|
||||
screenchars = screenwidth * screenheight;
|
||||
}
|
||||
|
||||
void
|
||||
_rl_set_screen_size (rows, cols)
|
||||
int rows, cols;
|
||||
{
|
||||
screenheight = rows;
|
||||
screenwidth = cols;
|
||||
|
||||
if (_rl_term_autowrap == 0)
|
||||
screenwidth--;
|
||||
|
||||
screenchars = screenwidth * screenheight;
|
||||
}
|
||||
|
||||
struct _tc_string {
|
||||
char *tc_var;
|
||||
char **tc_value;
|
||||
};
|
||||
|
||||
/* This should be kept sorted, just in case we decide to change the
|
||||
search algorithm to something smarter. */
|
||||
static struct _tc_string tc_strings[] =
|
||||
{
|
||||
"DC", &term_DC,
|
||||
"IC", &term_IC,
|
||||
"ce", &term_clreol,
|
||||
"cl", &term_clrpag,
|
||||
"cr", &term_cr,
|
||||
"dc", &term_dc,
|
||||
"ei", &term_ei,
|
||||
"ic", &term_ic,
|
||||
"im", &term_im,
|
||||
"kd", &term_kd,
|
||||
"kh", &term_kh, /* home */
|
||||
"kH", &term_kH, /* end */
|
||||
"kl", &term_kl,
|
||||
"kr", &term_kr,
|
||||
"ku", &term_ku,
|
||||
"ks", &term_ks,
|
||||
"ke", &term_ke,
|
||||
"le", &term_backspace,
|
||||
"mm", &term_mm,
|
||||
"mo", &term_mo,
|
||||
#if defined (HACK_TERMCAP_MOTION)
|
||||
"nd", &term_forward_char,
|
||||
#endif
|
||||
"pc", &term_pc,
|
||||
"up", &term_up,
|
||||
"vb", &visible_bell,
|
||||
};
|
||||
|
||||
#define NUM_TC_STRINGS (sizeof (tc_strings) / sizeof (struct _tc_string))
|
||||
|
||||
/* Read the desired terminal capability strings into BP. The capabilities
|
||||
are described in the TC_STRINGS table. */
|
||||
static void
|
||||
get_term_capabilities (bp)
|
||||
char **bp;
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < NUM_TC_STRINGS; i++)
|
||||
*(tc_strings[i].tc_value) = tgetstr (tc_strings[i].tc_var, bp);
|
||||
tcap_initialized = 1;
|
||||
}
|
||||
|
||||
int
|
||||
_rl_init_terminal_io (terminal_name)
|
||||
char *terminal_name;
|
||||
{
|
||||
#if defined (__GO32__)
|
||||
screenwidth = ScreenCols ();
|
||||
screenheight = ScreenRows ();
|
||||
screenchars = screenwidth * screenheight;
|
||||
term_cr = "\r";
|
||||
term_im = term_ei = term_ic = term_IC = (char *)NULL;
|
||||
term_up = term_dc = term_DC = visible_bell = (char *)NULL;
|
||||
|
||||
/* Does the __GO32__ have a meta key? I don't know. */
|
||||
term_has_meta = 0;
|
||||
term_mm = term_mo = (char *)NULL;
|
||||
|
||||
/* It probably has arrow keys, but I don't know what they are. */
|
||||
term_ku = term_kd = term_kr = term_kl = (char *)NULL;
|
||||
|
||||
#if defined (HACK_TERMCAP_MOTION)
|
||||
term_forward_char = (char *)NULL;
|
||||
#endif /* HACK_TERMCAP_MOTION */
|
||||
terminal_can_insert = _rl_term_autowrap = 0;
|
||||
return;
|
||||
#else /* !__GO32__ */
|
||||
|
||||
char *term, *buffer;
|
||||
int tty;
|
||||
Keymap xkeymap;
|
||||
|
||||
term = terminal_name ? terminal_name : getenv ("TERM");
|
||||
|
||||
if (term_string_buffer == 0)
|
||||
term_string_buffer = xmalloc (2032);
|
||||
|
||||
if (term_buffer == 0)
|
||||
term_buffer = xmalloc (4080);
|
||||
|
||||
buffer = term_string_buffer;
|
||||
|
||||
term_clrpag = term_cr = term_clreol = (char *)NULL;
|
||||
|
||||
if (term == 0)
|
||||
term = "dumb";
|
||||
|
||||
if (tgetent (term_buffer, term) <= 0)
|
||||
{
|
||||
dumb_term = 1;
|
||||
screenwidth = 79;
|
||||
screenheight = 24;
|
||||
screenchars = 79 * 24;
|
||||
term_cr = "\r";
|
||||
term_im = term_ei = term_ic = term_IC = (char *)NULL;
|
||||
term_up = term_dc = term_DC = visible_bell = (char *)NULL;
|
||||
term_ku = term_kd = term_kl = term_kr = (char *)NULL;
|
||||
#if defined (HACK_TERMCAP_MOTION)
|
||||
term_forward_char = (char *)NULL;
|
||||
#endif
|
||||
terminal_can_insert = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
get_term_capabilities (&buffer);
|
||||
|
||||
/* Set up the variables that the termcap library expects the application
|
||||
to provide. */
|
||||
PC = term_pc ? *term_pc : 0;
|
||||
BC = term_backspace;
|
||||
UP = term_up;
|
||||
|
||||
if (!term_cr)
|
||||
term_cr = "\r";
|
||||
|
||||
tty = rl_instream ? fileno (rl_instream) : 0;
|
||||
|
||||
screenwidth = screenheight = 0;
|
||||
|
||||
_rl_term_autowrap = tgetflag ("am") && tgetflag ("xn");
|
||||
|
||||
_rl_get_screen_size (tty, 0);
|
||||
|
||||
/* "An application program can assume that the terminal can do
|
||||
character insertion if *any one of* the capabilities `IC',
|
||||
`im', `ic' or `ip' is provided." But we can't do anything if
|
||||
only `ip' is provided, so... */
|
||||
terminal_can_insert = (term_IC || term_im || term_ic);
|
||||
|
||||
/* Check to see if this terminal has a meta key and clear the capability
|
||||
variables if there is none. */
|
||||
term_has_meta = (tgetflag ("km") || tgetflag ("MT"));
|
||||
if (!term_has_meta)
|
||||
term_mm = term_mo = (char *)NULL;
|
||||
|
||||
/* Attempt to find and bind the arrow keys. Do not override already
|
||||
bound keys in an overzealous attempt, however. */
|
||||
xkeymap = _rl_keymap;
|
||||
|
||||
_rl_keymap = emacs_standard_keymap;
|
||||
_rl_bind_if_unbound (term_ku, rl_get_previous_history);
|
||||
_rl_bind_if_unbound (term_kd, rl_get_next_history);
|
||||
_rl_bind_if_unbound (term_kr, rl_forward);
|
||||
_rl_bind_if_unbound (term_kl, rl_backward);
|
||||
|
||||
_rl_bind_if_unbound (term_kh, rl_beg_of_line); /* Home */
|
||||
_rl_bind_if_unbound (term_kH, rl_end_of_line); /* End */
|
||||
|
||||
#if defined (VI_MODE)
|
||||
_rl_keymap = vi_movement_keymap;
|
||||
_rl_bind_if_unbound (term_ku, rl_get_previous_history);
|
||||
_rl_bind_if_unbound (term_kd, rl_get_next_history);
|
||||
_rl_bind_if_unbound (term_kr, rl_forward);
|
||||
_rl_bind_if_unbound (term_kl, rl_backward);
|
||||
|
||||
_rl_bind_if_unbound (term_kh, rl_beg_of_line); /* Home */
|
||||
_rl_bind_if_unbound (term_kH, rl_end_of_line); /* End */
|
||||
#endif /* VI_MODE */
|
||||
|
||||
_rl_keymap = xkeymap;
|
||||
|
||||
#endif /* !__GO32__ */
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
rl_get_termcap (cap)
|
||||
char *cap;
|
||||
{
|
||||
register int i;
|
||||
|
||||
if (tcap_initialized == 0)
|
||||
return ((char *)NULL);
|
||||
for (i = 0; i < NUM_TC_STRINGS; i++)
|
||||
{
|
||||
if (tc_strings[i].tc_var[0] == cap[0] && strcmp (tc_strings[i].tc_var, cap) == 0)
|
||||
return *(tc_strings[i].tc_value);
|
||||
}
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
/* A function for the use of tputs () */
|
||||
int
|
||||
_rl_output_character_function (c)
|
||||
int c;
|
||||
{
|
||||
return putc (c, _rl_out_stream);
|
||||
}
|
||||
|
||||
/* Write COUNT characters from STRING to the output stream. */
|
||||
void
|
||||
_rl_output_some_chars (string, count)
|
||||
char *string;
|
||||
int count;
|
||||
{
|
||||
fwrite (string, 1, count, _rl_out_stream);
|
||||
}
|
||||
|
||||
/* Move the cursor back. */
|
||||
int
|
||||
_rl_backspace (count)
|
||||
int count;
|
||||
{
|
||||
register int i;
|
||||
|
||||
#if !defined (__GO32__)
|
||||
if (term_backspace)
|
||||
for (i = 0; i < count; i++)
|
||||
tputs (term_backspace, 1, _rl_output_character_function);
|
||||
else
|
||||
#endif /* !__GO32__ */
|
||||
for (i = 0; i < count; i++)
|
||||
putc ('\b', _rl_out_stream);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Move to the start of the next line. */
|
||||
int
|
||||
crlf ()
|
||||
{
|
||||
#if defined (NEW_TTY_DRIVER)
|
||||
if (term_cr)
|
||||
tputs (term_cr, 1, _rl_output_character_function);
|
||||
#endif /* NEW_TTY_DRIVER */
|
||||
putc ('\n', _rl_out_stream);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Ring the terminal bell. */
|
||||
int
|
||||
ding ()
|
||||
{
|
||||
if (readline_echoing_p)
|
||||
{
|
||||
#if !defined (__GO32__)
|
||||
switch (_rl_bell_preference)
|
||||
{
|
||||
case NO_BELL:
|
||||
default:
|
||||
break;
|
||||
case VISIBLE_BELL:
|
||||
if (visible_bell)
|
||||
{
|
||||
tputs (visible_bell, 1, _rl_output_character_function);
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case AUDIBLE_BELL:
|
||||
fprintf (stderr, "\007");
|
||||
fflush (stderr);
|
||||
break;
|
||||
}
|
||||
#else /* __GO32__ */
|
||||
fprintf (stderr, "\007");
|
||||
fflush (stderr);
|
||||
#endif /* __GO32__ */
|
||||
return (0);
|
||||
}
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Controlling the Meta Key and Keypad */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
static int
|
||||
outchar (c)
|
||||
int c;
|
||||
{
|
||||
return putc (c, rl_outstream);
|
||||
}
|
||||
|
||||
int
|
||||
_rl_enable_meta_key ()
|
||||
{
|
||||
if (term_has_meta && term_mm)
|
||||
tputs (term_mm, 1, outchar);
|
||||
}
|
||||
|
||||
void
|
||||
_rl_control_keypad (on)
|
||||
int on;
|
||||
{
|
||||
if (on && term_ks)
|
||||
tputs (term_ks, 1, outchar);
|
||||
else if (!on && term_ke)
|
||||
tputs (term_ke, 1, outchar);
|
||||
}
|
||||
@@ -1,390 +0,0 @@
|
||||
/* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). */
|
||||
|
||||
/* Copyright (C) 1988,1989 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Readline, a library for reading lines
|
||||
of text with interactive input and history editing.
|
||||
|
||||
Readline is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 1, or (at your option) any
|
||||
later version.
|
||||
|
||||
Readline is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Readline; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
# include <string.h>
|
||||
#else /* !HAVE_STRING_H */
|
||||
# include <strings.h>
|
||||
#endif /* !HAVE_STRING_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#include "tilde.h"
|
||||
|
||||
#if !defined (HAVE_GETPW_DECLS)
|
||||
extern struct passwd *getpwuid (), *getpwnam ();
|
||||
#endif /* !HAVE_GETPW_DECLS */
|
||||
|
||||
#if !defined (savestring)
|
||||
extern char *xmalloc ();
|
||||
# ifndef strcpy
|
||||
extern char *strcpy ();
|
||||
# endif
|
||||
#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
|
||||
#endif /* !savestring */
|
||||
|
||||
#if !defined (NULL)
|
||||
# if defined (__STDC__)
|
||||
# define NULL ((void *) 0)
|
||||
# else
|
||||
# define NULL 0x0
|
||||
# endif /* !__STDC__ */
|
||||
#endif /* !NULL */
|
||||
|
||||
#if defined (TEST) || defined (STATIC_MALLOC)
|
||||
static char *xmalloc (), *xrealloc ();
|
||||
#else
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
#endif /* TEST || STATIC_MALLOC */
|
||||
|
||||
/* The default value of tilde_additional_prefixes. This is set to
|
||||
whitespace preceding a tilde so that simple programs which do not
|
||||
perform any word separation get desired behaviour. */
|
||||
static char *default_prefixes[] =
|
||||
{ " ~", "\t~", (char *)NULL };
|
||||
|
||||
/* The default value of tilde_additional_suffixes. This is set to
|
||||
whitespace or newline so that simple programs which do not
|
||||
perform any word separation get desired behaviour. */
|
||||
static char *default_suffixes[] =
|
||||
{ " ", "\n", (char *)NULL };
|
||||
|
||||
/* If non-null, this contains the address of a function to call if the
|
||||
standard meaning for expanding a tilde fails. The function is called
|
||||
with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
|
||||
which is the expansion, or a NULL pointer if there is no expansion. */
|
||||
CPFunction *tilde_expansion_failure_hook = (CPFunction *)NULL;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which
|
||||
are duplicates for a tilde prefix. Bash uses this to expand
|
||||
`=~' and `:~'. */
|
||||
char **tilde_additional_prefixes = default_prefixes;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which match
|
||||
the end of a username, instead of just "/". Bash sets this to
|
||||
`:' and `=~'. */
|
||||
char **tilde_additional_suffixes = default_suffixes;
|
||||
|
||||
/* Find the start of a tilde expansion in STRING, and return the index of
|
||||
the tilde which starts the expansion. Place the length of the text
|
||||
which identified this tilde starter in LEN, excluding the tilde itself. */
|
||||
static int
|
||||
tilde_find_prefix (string, len)
|
||||
char *string;
|
||||
int *len;
|
||||
{
|
||||
register int i, j, string_len;
|
||||
register char **prefixes = tilde_additional_prefixes;
|
||||
|
||||
string_len = strlen (string);
|
||||
*len = 0;
|
||||
|
||||
if (!*string || *string == '~')
|
||||
return (0);
|
||||
|
||||
if (prefixes)
|
||||
{
|
||||
for (i = 0; i < string_len; i++)
|
||||
{
|
||||
for (j = 0; prefixes[j]; j++)
|
||||
{
|
||||
if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0)
|
||||
{
|
||||
*len = strlen (prefixes[j]) - 1;
|
||||
return (i + *len);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (string_len);
|
||||
}
|
||||
|
||||
/* Find the end of a tilde expansion in STRING, and return the index of
|
||||
the character which ends the tilde definition. */
|
||||
static int
|
||||
tilde_find_suffix (string)
|
||||
char *string;
|
||||
{
|
||||
register int i, j, string_len;
|
||||
register char **suffixes = tilde_additional_suffixes;
|
||||
|
||||
string_len = strlen (string);
|
||||
|
||||
for (i = 0; i < string_len; i++)
|
||||
{
|
||||
if (string[i] == '/' || !string[i])
|
||||
break;
|
||||
|
||||
for (j = 0; suffixes && suffixes[j]; j++)
|
||||
{
|
||||
if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0)
|
||||
return (i);
|
||||
}
|
||||
}
|
||||
return (i);
|
||||
}
|
||||
|
||||
/* Return a new string which is the result of tilde expanding STRING. */
|
||||
char *
|
||||
tilde_expand (string)
|
||||
char *string;
|
||||
{
|
||||
char *result, *tilde_expand_word ();
|
||||
int result_size, result_index;
|
||||
|
||||
result_size = result_index = 0;
|
||||
result = (char *)NULL;
|
||||
|
||||
/* Scan through STRING expanding tildes as we come to them. */
|
||||
while (1)
|
||||
{
|
||||
register int start, end;
|
||||
char *tilde_word, *expansion;
|
||||
int len;
|
||||
|
||||
/* Make START point to the tilde which starts the expansion. */
|
||||
start = tilde_find_prefix (string, &len);
|
||||
|
||||
/* Copy the skipped text into the result. */
|
||||
if ((result_index + start + 1) > result_size)
|
||||
result = xrealloc (result, 1 + (result_size += (start + 20)));
|
||||
|
||||
strncpy (result + result_index, string, start);
|
||||
result_index += start;
|
||||
|
||||
/* Advance STRING to the starting tilde. */
|
||||
string += start;
|
||||
|
||||
/* Make END be the index of one after the last character of the
|
||||
username. */
|
||||
end = tilde_find_suffix (string);
|
||||
|
||||
/* If both START and END are zero, we are all done. */
|
||||
if (!start && !end)
|
||||
break;
|
||||
|
||||
/* Expand the entire tilde word, and copy it into RESULT. */
|
||||
tilde_word = xmalloc (1 + end);
|
||||
strncpy (tilde_word, string, end);
|
||||
tilde_word[end] = '\0';
|
||||
string += end;
|
||||
|
||||
expansion = tilde_expand_word (tilde_word);
|
||||
free (tilde_word);
|
||||
|
||||
len = strlen (expansion);
|
||||
if ((result_index + len + 1) > result_size)
|
||||
result = xrealloc (result, 1 + (result_size += (len + 20)));
|
||||
|
||||
strcpy (result + result_index, expansion);
|
||||
result_index += len;
|
||||
free (expansion);
|
||||
}
|
||||
|
||||
result[result_index] = '\0';
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
|
||||
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
|
||||
char *
|
||||
tilde_expand_word (filename)
|
||||
char *filename;
|
||||
{
|
||||
char *dirname;
|
||||
char *temp_name;
|
||||
|
||||
if (filename == (char *)0)
|
||||
return ((char *)NULL);
|
||||
|
||||
dirname = savestring (filename);
|
||||
|
||||
if (*dirname != '~')
|
||||
return (dirname);
|
||||
|
||||
if (!dirname[1] || dirname[1] == '/')
|
||||
{
|
||||
/* Prepend $HOME to the rest of the string. */
|
||||
char *temp_home = (char *)getenv ("HOME");
|
||||
int home_len;
|
||||
|
||||
/* If there is no HOME variable, look up the directory in
|
||||
the password database. */
|
||||
if (!temp_home)
|
||||
{
|
||||
struct passwd *entry;
|
||||
|
||||
entry = getpwuid (getuid ());
|
||||
if (entry)
|
||||
temp_home = entry->pw_dir;
|
||||
}
|
||||
|
||||
home_len = temp_home ? strlen (temp_home) : 0;
|
||||
temp_name = xmalloc (1 + strlen (dirname + 1) + home_len);
|
||||
|
||||
if (temp_home)
|
||||
strcpy (temp_name, temp_home);
|
||||
strcpy (temp_name + home_len, dirname + 1);
|
||||
free (dirname);
|
||||
dirname = temp_name;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *username;
|
||||
struct passwd *user_entry;
|
||||
int i, len;
|
||||
|
||||
username = xmalloc (strlen (dirname));
|
||||
for (i = 1; dirname[i] && dirname[i] != '/'; i++)
|
||||
username[i - 1] = dirname[i];
|
||||
username[i - 1] = '\0';
|
||||
|
||||
if ((user_entry = getpwnam (username)) == (struct passwd *)0)
|
||||
{
|
||||
/* If the calling program has a special syntax for
|
||||
expanding tildes, and we couldn't find a standard
|
||||
expansion, then let them try. */
|
||||
if (tilde_expansion_failure_hook)
|
||||
{
|
||||
char *expansion;
|
||||
|
||||
expansion = (*tilde_expansion_failure_hook) (username);
|
||||
|
||||
if (expansion)
|
||||
{
|
||||
len = strlen (expansion);
|
||||
temp_name = xmalloc (1 + len + strlen (dirname + i));
|
||||
strcpy (temp_name, expansion);
|
||||
strcpy (temp_name + len, dirname + i);
|
||||
free (expansion);
|
||||
free (dirname);
|
||||
dirname = temp_name;
|
||||
}
|
||||
}
|
||||
/* We shouldn't report errors. */
|
||||
}
|
||||
else
|
||||
{
|
||||
len = strlen (user_entry->pw_dir);
|
||||
temp_name = xmalloc (1 + len + strlen (dirname + i));
|
||||
strcpy (temp_name, user_entry->pw_dir);
|
||||
strcpy (temp_name + len, dirname + i);
|
||||
free (dirname);
|
||||
dirname = temp_name;
|
||||
}
|
||||
endpwent ();
|
||||
free (username);
|
||||
}
|
||||
|
||||
return (dirname);
|
||||
}
|
||||
|
||||
|
||||
#if defined (TEST)
|
||||
#undef NULL
|
||||
#include <stdio.h>
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
char *result, line[512];
|
||||
int done = 0;
|
||||
|
||||
while (!done)
|
||||
{
|
||||
printf ("~expand: ");
|
||||
fflush (stdout);
|
||||
|
||||
if (!gets (line))
|
||||
strcpy (line, "done");
|
||||
|
||||
if ((strcmp (line, "done") == 0) ||
|
||||
(strcmp (line, "quit") == 0) ||
|
||||
(strcmp (line, "exit") == 0))
|
||||
{
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
result = tilde_expand (line);
|
||||
printf (" --> %s\n", result);
|
||||
free (result);
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static void memory_error_and_abort ();
|
||||
|
||||
static char *
|
||||
xmalloc (bytes)
|
||||
int bytes;
|
||||
{
|
||||
char *temp = (char *)malloc (bytes);
|
||||
|
||||
if (!temp)
|
||||
memory_error_and_abort ();
|
||||
return (temp);
|
||||
}
|
||||
|
||||
static char *
|
||||
xrealloc (pointer, bytes)
|
||||
char *pointer;
|
||||
int bytes;
|
||||
{
|
||||
char *temp;
|
||||
|
||||
if (!pointer)
|
||||
temp = (char *)malloc (bytes);
|
||||
else
|
||||
temp = (char *)realloc (pointer, bytes);
|
||||
|
||||
if (!temp)
|
||||
memory_error_and_abort ();
|
||||
|
||||
return (temp);
|
||||
}
|
||||
|
||||
static void
|
||||
memory_error_and_abort ()
|
||||
{
|
||||
fprintf (stderr, "readline: out of virtual memory\n");
|
||||
abort ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* compile-command: "gcc -g -DTEST -o tilde tilde.c"
|
||||
* end:
|
||||
*/
|
||||
#endif /* TEST */
|
||||
@@ -1,59 +0,0 @@
|
||||
/* tilde.h: Externally available variables and function in libtilde.a. */
|
||||
|
||||
/* Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file contains the Readline Library (the Library), a set of
|
||||
routines for providing Emacs style line input to programs that ask
|
||||
for it.
|
||||
|
||||
The Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
The Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (_TILDE_H_)
|
||||
# define _TILDE_H_
|
||||
|
||||
/* Function pointers can be declared as (Function *)foo. */
|
||||
#if !defined (_FUNCTION_DEF)
|
||||
# define _FUNCTION_DEF
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
typedef char *CPFunction ();
|
||||
typedef char **CPPFunction ();
|
||||
#endif /* _FUNCTION_DEF */
|
||||
|
||||
/* If non-null, this contains the address of a function to call if the
|
||||
standard meaning for expanding a tilde fails. The function is called
|
||||
with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
|
||||
which is the expansion, or a NULL pointer if there is no expansion. */
|
||||
extern CPFunction *tilde_expansion_failure_hook;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which
|
||||
are duplicates for a tilde prefix. Bash uses this to expand
|
||||
`=~' and `:~'. */
|
||||
extern char **tilde_additional_prefixes;
|
||||
|
||||
/* When non-null, this is a NULL terminated array of strings which match
|
||||
the end of a username, instead of just "/". Bash sets this to
|
||||
`:' and `=~'. */
|
||||
extern char **tilde_additional_suffixes;
|
||||
|
||||
/* Return a new string which is the result of tilde expanding STRING. */
|
||||
extern char *tilde_expand ();
|
||||
|
||||
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
|
||||
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
|
||||
extern char *tilde_expand_word ();
|
||||
|
||||
#endif /* _TILDE_H_ */
|
||||
@@ -1,261 +0,0 @@
|
||||
/* readline.c -- a general facility for reading lines of input
|
||||
with emacs style editing and completion. */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h> /* for _POSIX_VERSION */
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
#include "history.h"
|
||||
|
||||
#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
|
||||
|
||||
/* Non-zero tells rl_delete_text and rl_insert_text to not add to
|
||||
the undo list. */
|
||||
int _rl_doing_an_undo = 0;
|
||||
|
||||
/* How many unclosed undo groups we currently have. */
|
||||
int _rl_undo_group_level = 0;
|
||||
|
||||
/* The current undo list for THE_LINE. */
|
||||
UNDO_LIST *rl_undo_list = (UNDO_LIST *)NULL;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Undo, and Undoing */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Remember how to undo something. Concatenate some undos if that
|
||||
seems right. */
|
||||
void
|
||||
rl_add_undo (what, start, end, text)
|
||||
enum undo_code what;
|
||||
int start, end;
|
||||
char *text;
|
||||
{
|
||||
UNDO_LIST *temp = (UNDO_LIST *)xmalloc (sizeof (UNDO_LIST));
|
||||
temp->what = what;
|
||||
temp->start = start;
|
||||
temp->end = end;
|
||||
temp->text = text;
|
||||
temp->next = rl_undo_list;
|
||||
rl_undo_list = temp;
|
||||
}
|
||||
|
||||
/* Free the existing undo list. */
|
||||
void
|
||||
free_undo_list ()
|
||||
{
|
||||
while (rl_undo_list)
|
||||
{
|
||||
UNDO_LIST *release = rl_undo_list;
|
||||
rl_undo_list = rl_undo_list->next;
|
||||
|
||||
if (release->what == UNDO_DELETE)
|
||||
free (release->text);
|
||||
|
||||
free (release);
|
||||
}
|
||||
rl_undo_list = (UNDO_LIST *)NULL;
|
||||
}
|
||||
|
||||
/* Undo the next thing in the list. Return 0 if there
|
||||
is nothing to undo, or non-zero if there was. */
|
||||
int
|
||||
rl_do_undo ()
|
||||
{
|
||||
UNDO_LIST *release;
|
||||
int waiting_for_begin = 0;
|
||||
int start, end;
|
||||
|
||||
#define TRANS(i) ((i) == -1 ? rl_point : ((i) == -2 ? rl_end : (i)))
|
||||
|
||||
do
|
||||
{
|
||||
if (!rl_undo_list)
|
||||
return (0);
|
||||
|
||||
_rl_doing_an_undo = 1;
|
||||
|
||||
/* To better support vi-mode, a start or end value of -1 means
|
||||
rl_point, and a value of -2 means rl_end. */
|
||||
if (rl_undo_list->what == UNDO_DELETE || rl_undo_list->what == UNDO_INSERT)
|
||||
{
|
||||
start = TRANS (rl_undo_list->start);
|
||||
end = TRANS (rl_undo_list->end);
|
||||
}
|
||||
|
||||
switch (rl_undo_list->what)
|
||||
{
|
||||
/* Undoing deletes means inserting some text. */
|
||||
case UNDO_DELETE:
|
||||
rl_point = start;
|
||||
rl_insert_text (rl_undo_list->text);
|
||||
free (rl_undo_list->text);
|
||||
break;
|
||||
|
||||
/* Undoing inserts means deleting some text. */
|
||||
case UNDO_INSERT:
|
||||
rl_delete_text (start, end);
|
||||
rl_point = start;
|
||||
break;
|
||||
|
||||
/* Undoing an END means undoing everything 'til we get to a BEGIN. */
|
||||
case UNDO_END:
|
||||
waiting_for_begin++;
|
||||
break;
|
||||
|
||||
/* Undoing a BEGIN means that we are done with this group. */
|
||||
case UNDO_BEGIN:
|
||||
if (waiting_for_begin)
|
||||
waiting_for_begin--;
|
||||
else
|
||||
ding ();
|
||||
break;
|
||||
}
|
||||
|
||||
_rl_doing_an_undo = 0;
|
||||
|
||||
release = rl_undo_list;
|
||||
rl_undo_list = rl_undo_list->next;
|
||||
free (release);
|
||||
}
|
||||
while (waiting_for_begin);
|
||||
|
||||
return (1);
|
||||
}
|
||||
#undef TRANS
|
||||
|
||||
int
|
||||
_rl_fix_last_undo_of_type (type, start, end)
|
||||
int type, start, end;
|
||||
{
|
||||
UNDO_LIST *rl;
|
||||
|
||||
for (rl = rl_undo_list; rl; rl = rl->next)
|
||||
{
|
||||
if (rl->what == type)
|
||||
{
|
||||
rl->start = start;
|
||||
rl->end = end;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Begin a group. Subsequent undos are undone as an atomic operation. */
|
||||
int
|
||||
rl_begin_undo_group ()
|
||||
{
|
||||
rl_add_undo (UNDO_BEGIN, 0, 0, 0);
|
||||
_rl_undo_group_level++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* End an undo group started with rl_begin_undo_group (). */
|
||||
int
|
||||
rl_end_undo_group ()
|
||||
{
|
||||
rl_add_undo (UNDO_END, 0, 0, 0);
|
||||
_rl_undo_group_level--;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Save an undo entry for the text from START to END. */
|
||||
int
|
||||
rl_modifying (start, end)
|
||||
int start, end;
|
||||
{
|
||||
if (start > end)
|
||||
{
|
||||
SWAP (start, end);
|
||||
}
|
||||
|
||||
if (start != end)
|
||||
{
|
||||
char *temp = rl_copy_text (start, end);
|
||||
rl_begin_undo_group ();
|
||||
rl_add_undo (UNDO_DELETE, start, end, temp);
|
||||
rl_add_undo (UNDO_INSERT, start, end, (char *)NULL);
|
||||
rl_end_undo_group ();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Revert the current line to its previous state. */
|
||||
int
|
||||
rl_revert_line (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (!rl_undo_list)
|
||||
ding ();
|
||||
else
|
||||
{
|
||||
while (rl_undo_list)
|
||||
rl_do_undo ();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Do some undoing of things that were done. */
|
||||
int
|
||||
rl_undo_command (count, key)
|
||||
int count, key;
|
||||
{
|
||||
if (count < 0)
|
||||
return 0; /* Nothing to do. */
|
||||
|
||||
while (count)
|
||||
{
|
||||
if (rl_do_undo ())
|
||||
count--;
|
||||
else
|
||||
{
|
||||
ding ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,312 +0,0 @@
|
||||
/* util.c -- readline utility functions */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#define READLINE_LIBRARY
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <setjmp.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
# include <unistd.h> /* for _POSIX_VERSION */
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
/* System-specific feature definitions and include files. */
|
||||
#include "rldefs.h"
|
||||
|
||||
#if defined (TIOCSTAT_IN_SYS_IOCTL)
|
||||
# include <sys/ioctl.h>
|
||||
#endif /* TIOCSTAT_IN_SYS_IOCTL */
|
||||
|
||||
/* Some standard library routines. */
|
||||
#include "readline.h"
|
||||
|
||||
#define SWAP(s, e) do { int t; t = s; s = e; e = t; } while (0)
|
||||
|
||||
/* Pseudo-globals imported from readline.c */
|
||||
extern int readline_echoing_p;
|
||||
extern jmp_buf readline_top_level;
|
||||
extern int rl_line_buffer_len;
|
||||
extern Function *rl_last_func;
|
||||
|
||||
extern int _rl_defining_kbd_macro;
|
||||
extern char *_rl_executing_macro;
|
||||
|
||||
/* Pseudo-global functions imported from other library files. */
|
||||
extern void _rl_pop_executing_macro ();
|
||||
extern void _rl_set_the_line ();
|
||||
extern void _rl_init_argument ();
|
||||
|
||||
extern char *xmalloc (), *xrealloc ();
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Utility Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Return 0 if C is not a member of the class of characters that belong
|
||||
in words, or 1 if it is. */
|
||||
|
||||
int _rl_allow_pathname_alphabetic_chars = 0;
|
||||
static char *pathname_alphabetic_chars = "/-_=~.#$";
|
||||
|
||||
int
|
||||
alphabetic (c)
|
||||
int c;
|
||||
{
|
||||
if (ALPHABETIC (c))
|
||||
return (1);
|
||||
|
||||
return (_rl_allow_pathname_alphabetic_chars &&
|
||||
strchr (pathname_alphabetic_chars, c) != NULL);
|
||||
}
|
||||
|
||||
/* How to abort things. */
|
||||
int
|
||||
_rl_abort_internal ()
|
||||
{
|
||||
ding ();
|
||||
rl_clear_message ();
|
||||
_rl_init_argument ();
|
||||
rl_pending_input = 0;
|
||||
|
||||
_rl_defining_kbd_macro = 0;
|
||||
while (_rl_executing_macro)
|
||||
_rl_pop_executing_macro ();
|
||||
|
||||
rl_last_func = (Function *)NULL;
|
||||
longjmp (readline_top_level, 1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
rl_abort (count, key)
|
||||
int count, key;
|
||||
{
|
||||
return (_rl_abort_internal ());
|
||||
}
|
||||
|
||||
int
|
||||
rl_tty_status (count, key)
|
||||
int count, key;
|
||||
{
|
||||
#if defined (TIOCSTAT)
|
||||
ioctl (1, TIOCSTAT, (char *)0);
|
||||
rl_refresh_line ();
|
||||
#else
|
||||
ding ();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return a copy of the string between FROM and TO.
|
||||
FROM is inclusive, TO is not. */
|
||||
char *
|
||||
rl_copy_text (from, to)
|
||||
int from, to;
|
||||
{
|
||||
register int length;
|
||||
char *copy;
|
||||
|
||||
/* Fix it if the caller is confused. */
|
||||
if (from > to)
|
||||
SWAP (from, to);
|
||||
|
||||
length = to - from;
|
||||
copy = xmalloc (1 + length);
|
||||
strncpy (copy, rl_line_buffer + from, length);
|
||||
copy[length] = '\0';
|
||||
return (copy);
|
||||
}
|
||||
|
||||
/* Increase the size of RL_LINE_BUFFER until it has enough space to hold
|
||||
LEN characters. */
|
||||
void
|
||||
rl_extend_line_buffer (len)
|
||||
int len;
|
||||
{
|
||||
while (len >= rl_line_buffer_len)
|
||||
{
|
||||
rl_line_buffer_len += DEFAULT_BUFFER_SIZE;
|
||||
rl_line_buffer = xrealloc (rl_line_buffer, rl_line_buffer_len);
|
||||
}
|
||||
|
||||
_rl_set_the_line ();
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* String Utility Functions */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Determine if s2 occurs in s1. If so, return a pointer to the
|
||||
match in s1. The compare is case insensitive. */
|
||||
char *
|
||||
_rl_strindex (s1, s2)
|
||||
register char *s1, *s2;
|
||||
{
|
||||
register int i, l, len;
|
||||
|
||||
for (i = 0, l = strlen (s2), len = strlen (s1); (len - i) >= l; i++)
|
||||
if (_rl_strnicmp (s1 + i, s2, l) == 0)
|
||||
return (s1 + i);
|
||||
return ((char *)NULL);
|
||||
}
|
||||
|
||||
#if !defined (HAVE_STRCASECMP)
|
||||
/* Compare at most COUNT characters from string1 to string2. Case
|
||||
doesn't matter. */
|
||||
int
|
||||
_rl_strnicmp (string1, string2, count)
|
||||
char *string1, *string2;
|
||||
int count;
|
||||
{
|
||||
register char ch1, ch2;
|
||||
|
||||
while (count)
|
||||
{
|
||||
ch1 = *string1++;
|
||||
ch2 = *string2++;
|
||||
if (_rl_to_upper(ch1) == _rl_to_upper(ch2))
|
||||
count--;
|
||||
else
|
||||
break;
|
||||
}
|
||||
return (count);
|
||||
}
|
||||
|
||||
/* strcmp (), but caseless. */
|
||||
int
|
||||
_rl_stricmp (string1, string2)
|
||||
char *string1, *string2;
|
||||
{
|
||||
register char ch1, ch2;
|
||||
|
||||
while (*string1 && *string2)
|
||||
{
|
||||
ch1 = *string1++;
|
||||
ch2 = *string2++;
|
||||
if (_rl_to_upper(ch1) != _rl_to_upper(ch2))
|
||||
return (1);
|
||||
}
|
||||
return (*string1 - *string2);
|
||||
}
|
||||
#endif /* !HAVE_STRCASECMP */
|
||||
|
||||
/* Stupid comparison routine for qsort () ing strings. */
|
||||
int
|
||||
_rl_qsort_string_compare (s1, s2)
|
||||
char **s1, **s2;
|
||||
{
|
||||
#if defined (HAVE_STRCOLL)
|
||||
return (strcoll (*s1, *s2));
|
||||
#else
|
||||
int result;
|
||||
|
||||
result = **s1 - **s2;
|
||||
if (result == 0)
|
||||
result = strcmp (*s1, *s2);
|
||||
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined (SHELL)
|
||||
/* Backwards compatibility, now that savestring has been removed from
|
||||
all `public' readline header files. */
|
||||
char *
|
||||
rl_savestring (s)
|
||||
char *s;
|
||||
{
|
||||
return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
|
||||
}
|
||||
#endif /* !SHELL */
|
||||
|
||||
/* Function equivalents for the macros defined in chartypes.h. */
|
||||
#undef _rl_uppercase_p
|
||||
int
|
||||
_rl_uppercase_p (c)
|
||||
int c;
|
||||
{
|
||||
return (isupper (c));
|
||||
}
|
||||
|
||||
#undef _rl_lowercase_p
|
||||
int
|
||||
_rl_lowercase_p (c)
|
||||
int c;
|
||||
{
|
||||
return (islower (c));
|
||||
}
|
||||
|
||||
#undef _rl_pure_alphabetic
|
||||
int
|
||||
_rl_pure_alphabetic (c)
|
||||
int c;
|
||||
{
|
||||
return (isupper (c) || islower (c));
|
||||
}
|
||||
|
||||
#undef _rl_digit_p
|
||||
int
|
||||
_rl_digit_p (c)
|
||||
int c;
|
||||
{
|
||||
return (isdigit (c));
|
||||
}
|
||||
|
||||
#undef _rl_to_lower
|
||||
int
|
||||
_rl_to_lower (c)
|
||||
int c;
|
||||
{
|
||||
return (isupper (c) ? tolower (c) : c);
|
||||
}
|
||||
|
||||
#undef _rl_to_upper
|
||||
int
|
||||
_rl_to_upper (c)
|
||||
int c;
|
||||
{
|
||||
return (islower (c) ? toupper (c) : c);
|
||||
}
|
||||
|
||||
#undef _rl_digit_value
|
||||
int
|
||||
_rl_digit_value (c)
|
||||
int c;
|
||||
{
|
||||
return (isdigit (c) ? c - '0' : c);
|
||||
}
|
||||
@@ -1,877 +0,0 @@
|
||||
/* vi_keymap.c -- the keymap for vi_mode in readline (). */
|
||||
|
||||
/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library, a library for
|
||||
reading lines of text with interactive input and history editing.
|
||||
|
||||
The GNU Readline Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 1, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU Readline Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
The GNU General Public License is often shipped with GNU software, and
|
||||
is generally kept in a file called COPYING or LICENSE. If you do not
|
||||
have a copy of the license, write to the Free Software Foundation,
|
||||
675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (BUFSIZ)
|
||||
#include <stdio.h>
|
||||
#endif /* !BUFSIZ */
|
||||
|
||||
#include "readline.h"
|
||||
|
||||
#if 0
|
||||
extern KEYMAP_ENTRY_ARRAY vi_escape_keymap;
|
||||
#endif
|
||||
|
||||
/* The keymap arrays for handling vi mode. */
|
||||
KEYMAP_ENTRY_ARRAY vi_movement_keymap = {
|
||||
/* The regular control keys come first. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-@ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-a */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-b */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-c */
|
||||
{ ISFUNC, rl_vi_eof_maybe }, /* Control-d */
|
||||
{ ISFUNC, rl_emacs_editing_mode }, /* Control-e */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-f */
|
||||
{ ISFUNC, rl_abort }, /* Control-g */
|
||||
{ ISFUNC, rl_backward }, /* Control-h */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-i */
|
||||
{ ISFUNC, rl_newline }, /* Control-j */
|
||||
{ ISFUNC, rl_kill_line }, /* Control-k */
|
||||
{ ISFUNC, rl_clear_screen }, /* Control-l */
|
||||
{ ISFUNC, rl_newline }, /* Control-m */
|
||||
{ ISFUNC, rl_get_next_history }, /* Control-n */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-o */
|
||||
{ ISFUNC, rl_get_previous_history }, /* Control-p */
|
||||
{ ISFUNC, rl_quoted_insert }, /* Control-q */
|
||||
{ ISFUNC, rl_reverse_search_history }, /* Control-r */
|
||||
{ ISFUNC, rl_forward_search_history }, /* Control-s */
|
||||
{ ISFUNC, rl_transpose_chars }, /* Control-t */
|
||||
{ ISFUNC, rl_unix_line_discard }, /* Control-u */
|
||||
{ ISFUNC, rl_quoted_insert }, /* Control-v */
|
||||
{ ISFUNC, rl_unix_word_rubout }, /* Control-w */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-x */
|
||||
{ ISFUNC, rl_yank }, /* Control-y */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-z */
|
||||
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-[ */ /* vi_escape_keymap */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-\ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-] */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-^ */
|
||||
{ ISFUNC, rl_vi_undo }, /* Control-_ */
|
||||
|
||||
/* The start of printing characters. */
|
||||
{ ISFUNC, rl_forward }, /* SPACE */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ! */
|
||||
{ ISFUNC, (Function *)0x0 }, /* " */
|
||||
{ ISFUNC, rl_insert_comment }, /* # */
|
||||
{ ISFUNC, rl_end_of_line }, /* $ */
|
||||
{ ISFUNC, rl_vi_match }, /* % */
|
||||
{ ISFUNC, rl_vi_tilde_expand }, /* & */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ' */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ( */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ) */
|
||||
{ ISFUNC, rl_vi_complete }, /* * */
|
||||
{ ISFUNC, rl_get_next_history}, /* + */
|
||||
{ ISFUNC, rl_vi_char_search }, /* , */
|
||||
{ ISFUNC, rl_get_previous_history }, /* - */
|
||||
{ ISFUNC, rl_vi_redo }, /* . */
|
||||
{ ISFUNC, rl_vi_search }, /* / */
|
||||
|
||||
/* Regular digits. */
|
||||
{ ISFUNC, rl_beg_of_line }, /* 0 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 1 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 2 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 3 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 4 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 5 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 6 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 7 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 8 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 9 */
|
||||
|
||||
/* A little more punctuation. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* : */
|
||||
{ ISFUNC, rl_vi_char_search }, /* ; */
|
||||
{ ISFUNC, (Function *)0x0 }, /* < */
|
||||
{ ISFUNC, rl_vi_complete }, /* = */
|
||||
{ ISFUNC, (Function *)0x0 }, /* > */
|
||||
{ ISFUNC, rl_vi_search }, /* ? */
|
||||
{ ISFUNC, (Function *)0x0 }, /* @ */
|
||||
|
||||
/* Uppercase alphabet. */
|
||||
{ ISFUNC, rl_vi_append_eol }, /* A */
|
||||
{ ISFUNC, rl_vi_prev_word}, /* B */
|
||||
{ ISFUNC, rl_vi_change_to }, /* C */
|
||||
{ ISFUNC, rl_vi_delete_to }, /* D */
|
||||
{ ISFUNC, rl_vi_end_word }, /* E */
|
||||
{ ISFUNC, rl_vi_char_search }, /* F */
|
||||
{ ISFUNC, rl_vi_fetch_history }, /* G */
|
||||
{ ISFUNC, (Function *)0x0 }, /* H */
|
||||
{ ISFUNC, rl_vi_insert_beg }, /* I */
|
||||
{ ISFUNC, (Function *)0x0 }, /* J */
|
||||
{ ISFUNC, (Function *)0x0 }, /* K */
|
||||
{ ISFUNC, (Function *)0x0 }, /* L */
|
||||
{ ISFUNC, (Function *)0x0 }, /* M */
|
||||
{ ISFUNC, rl_vi_search_again }, /* N */
|
||||
{ ISFUNC, (Function *)0x0 }, /* O */
|
||||
{ ISFUNC, rl_vi_put }, /* P */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Q */
|
||||
{ ISFUNC, rl_vi_replace }, /* R */
|
||||
{ ISFUNC, rl_vi_subst }, /* S */
|
||||
{ ISFUNC, rl_vi_char_search }, /* T */
|
||||
{ ISFUNC, rl_revert_line }, /* U */
|
||||
{ ISFUNC, (Function *)0x0 }, /* V */
|
||||
{ ISFUNC, rl_vi_next_word }, /* W */
|
||||
{ ISFUNC, rl_rubout }, /* X */
|
||||
{ ISFUNC, rl_vi_yank_to }, /* Y */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Z */
|
||||
|
||||
/* Some more punctuation. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* [ */
|
||||
{ ISFUNC, rl_vi_complete }, /* \ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ] */
|
||||
{ ISFUNC, rl_vi_first_print }, /* ^ */
|
||||
{ ISFUNC, rl_vi_yank_arg }, /* _ */
|
||||
{ ISFUNC, rl_vi_goto_mark }, /* ` */
|
||||
|
||||
/* Lowercase alphabet. */
|
||||
{ ISFUNC, rl_vi_append_mode }, /* a */
|
||||
{ ISFUNC, rl_vi_prev_word }, /* b */
|
||||
{ ISFUNC, rl_vi_change_to }, /* c */
|
||||
{ ISFUNC, rl_vi_delete_to }, /* d */
|
||||
{ ISFUNC, rl_vi_end_word }, /* e */
|
||||
{ ISFUNC, rl_vi_char_search }, /* f */
|
||||
{ ISFUNC, (Function *)0x0 }, /* g */
|
||||
{ ISFUNC, rl_backward }, /* h */
|
||||
{ ISFUNC, rl_vi_insertion_mode }, /* i */
|
||||
{ ISFUNC, rl_get_next_history }, /* j */
|
||||
{ ISFUNC, rl_get_previous_history }, /* k */
|
||||
{ ISFUNC, rl_forward }, /* l */
|
||||
{ ISFUNC, rl_vi_set_mark }, /* m */
|
||||
{ ISFUNC, rl_vi_search_again }, /* n */
|
||||
{ ISFUNC, (Function *)0x0 }, /* o */
|
||||
{ ISFUNC, rl_vi_put }, /* p */
|
||||
{ ISFUNC, (Function *)0x0 }, /* q */
|
||||
{ ISFUNC, rl_vi_change_char }, /* r */
|
||||
{ ISFUNC, rl_vi_subst }, /* s */
|
||||
{ ISFUNC, rl_vi_char_search }, /* t */
|
||||
{ ISFUNC, rl_vi_undo }, /* u */
|
||||
{ ISFUNC, (Function *)0x0 }, /* v */
|
||||
{ ISFUNC, rl_vi_next_word }, /* w */
|
||||
{ ISFUNC, rl_vi_delete }, /* x */
|
||||
{ ISFUNC, rl_vi_yank_to }, /* y */
|
||||
{ ISFUNC, (Function *)0x0 }, /* z */
|
||||
|
||||
/* Final punctuation. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* { */
|
||||
{ ISFUNC, rl_vi_column }, /* | */
|
||||
{ ISFUNC, (Function *)0x0 }, /* } */
|
||||
{ ISFUNC, rl_vi_change_case }, /* ~ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* RUBOUT */
|
||||
|
||||
#if KEYMAP_SIZE > 128
|
||||
/* Undefined keys. */
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 }
|
||||
#endif /* KEYMAP_SIZE > 128 */
|
||||
};
|
||||
|
||||
|
||||
KEYMAP_ENTRY_ARRAY vi_insertion_keymap = {
|
||||
/* The regular control keys come first. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-@ */
|
||||
{ ISFUNC, rl_insert }, /* Control-a */
|
||||
{ ISFUNC, rl_insert }, /* Control-b */
|
||||
{ ISFUNC, rl_insert }, /* Control-c */
|
||||
{ ISFUNC, rl_vi_eof_maybe }, /* Control-d */
|
||||
{ ISFUNC, rl_insert }, /* Control-e */
|
||||
{ ISFUNC, rl_insert }, /* Control-f */
|
||||
{ ISFUNC, rl_insert }, /* Control-g */
|
||||
{ ISFUNC, rl_rubout }, /* Control-h */
|
||||
{ ISFUNC, rl_complete }, /* Control-i */
|
||||
{ ISFUNC, rl_newline }, /* Control-j */
|
||||
{ ISFUNC, rl_insert }, /* Control-k */
|
||||
{ ISFUNC, rl_insert }, /* Control-l */
|
||||
{ ISFUNC, rl_newline }, /* Control-m */
|
||||
{ ISFUNC, rl_insert }, /* Control-n */
|
||||
{ ISFUNC, rl_insert }, /* Control-o */
|
||||
{ ISFUNC, rl_insert }, /* Control-p */
|
||||
{ ISFUNC, rl_insert }, /* Control-q */
|
||||
{ ISFUNC, rl_reverse_search_history }, /* Control-r */
|
||||
{ ISFUNC, rl_forward_search_history }, /* Control-s */
|
||||
{ ISFUNC, rl_transpose_chars }, /* Control-t */
|
||||
{ ISFUNC, rl_unix_line_discard }, /* Control-u */
|
||||
{ ISFUNC, rl_quoted_insert }, /* Control-v */
|
||||
{ ISFUNC, rl_unix_word_rubout }, /* Control-w */
|
||||
{ ISFUNC, rl_insert }, /* Control-x */
|
||||
{ ISFUNC, rl_yank }, /* Control-y */
|
||||
{ ISFUNC, rl_insert }, /* Control-z */
|
||||
|
||||
{ ISFUNC, rl_vi_movement_mode }, /* Control-[ */
|
||||
{ ISFUNC, rl_insert }, /* Control-\ */
|
||||
{ ISFUNC, rl_insert }, /* Control-] */
|
||||
{ ISFUNC, rl_insert }, /* Control-^ */
|
||||
{ ISFUNC, rl_vi_undo }, /* Control-_ */
|
||||
|
||||
/* The start of printing characters. */
|
||||
{ ISFUNC, rl_insert }, /* SPACE */
|
||||
{ ISFUNC, rl_insert }, /* ! */
|
||||
{ ISFUNC, rl_insert }, /* " */
|
||||
{ ISFUNC, rl_insert }, /* # */
|
||||
{ ISFUNC, rl_insert }, /* $ */
|
||||
{ ISFUNC, rl_insert }, /* % */
|
||||
{ ISFUNC, rl_insert }, /* & */
|
||||
{ ISFUNC, rl_insert }, /* ' */
|
||||
{ ISFUNC, rl_insert }, /* ( */
|
||||
{ ISFUNC, rl_insert }, /* ) */
|
||||
{ ISFUNC, rl_insert }, /* * */
|
||||
{ ISFUNC, rl_insert }, /* + */
|
||||
{ ISFUNC, rl_insert }, /* , */
|
||||
{ ISFUNC, rl_insert }, /* - */
|
||||
{ ISFUNC, rl_insert }, /* . */
|
||||
{ ISFUNC, rl_insert }, /* / */
|
||||
|
||||
/* Regular digits. */
|
||||
{ ISFUNC, rl_insert }, /* 0 */
|
||||
{ ISFUNC, rl_insert }, /* 1 */
|
||||
{ ISFUNC, rl_insert }, /* 2 */
|
||||
{ ISFUNC, rl_insert }, /* 3 */
|
||||
{ ISFUNC, rl_insert }, /* 4 */
|
||||
{ ISFUNC, rl_insert }, /* 5 */
|
||||
{ ISFUNC, rl_insert }, /* 6 */
|
||||
{ ISFUNC, rl_insert }, /* 7 */
|
||||
{ ISFUNC, rl_insert }, /* 8 */
|
||||
{ ISFUNC, rl_insert }, /* 9 */
|
||||
|
||||
/* A little more punctuation. */
|
||||
{ ISFUNC, rl_insert }, /* : */
|
||||
{ ISFUNC, rl_insert }, /* ; */
|
||||
{ ISFUNC, rl_insert }, /* < */
|
||||
{ ISFUNC, rl_insert }, /* = */
|
||||
{ ISFUNC, rl_insert }, /* > */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* @ */
|
||||
|
||||
/* Uppercase alphabet. */
|
||||
{ ISFUNC, rl_insert }, /* A */
|
||||
{ ISFUNC, rl_insert }, /* B */
|
||||
{ ISFUNC, rl_insert }, /* C */
|
||||
{ ISFUNC, rl_insert }, /* D */
|
||||
{ ISFUNC, rl_insert }, /* E */
|
||||
{ ISFUNC, rl_insert }, /* F */
|
||||
{ ISFUNC, rl_insert }, /* G */
|
||||
{ ISFUNC, rl_insert }, /* H */
|
||||
{ ISFUNC, rl_insert }, /* I */
|
||||
{ ISFUNC, rl_insert }, /* J */
|
||||
{ ISFUNC, rl_insert }, /* K */
|
||||
{ ISFUNC, rl_insert }, /* L */
|
||||
{ ISFUNC, rl_insert }, /* M */
|
||||
{ ISFUNC, rl_insert }, /* N */
|
||||
{ ISFUNC, rl_insert }, /* O */
|
||||
{ ISFUNC, rl_insert }, /* P */
|
||||
{ ISFUNC, rl_insert }, /* Q */
|
||||
{ ISFUNC, rl_insert }, /* R */
|
||||
{ ISFUNC, rl_insert }, /* S */
|
||||
{ ISFUNC, rl_insert }, /* T */
|
||||
{ ISFUNC, rl_insert }, /* U */
|
||||
{ ISFUNC, rl_insert }, /* V */
|
||||
{ ISFUNC, rl_insert }, /* W */
|
||||
{ ISFUNC, rl_insert }, /* X */
|
||||
{ ISFUNC, rl_insert }, /* Y */
|
||||
{ ISFUNC, rl_insert }, /* Z */
|
||||
|
||||
/* Some more punctuation. */
|
||||
{ ISFUNC, rl_insert }, /* [ */
|
||||
{ ISFUNC, rl_insert }, /* \ */
|
||||
{ ISFUNC, rl_insert }, /* ] */
|
||||
{ ISFUNC, rl_insert }, /* ^ */
|
||||
{ ISFUNC, rl_insert }, /* _ */
|
||||
{ ISFUNC, rl_insert }, /* ` */
|
||||
|
||||
/* Lowercase alphabet. */
|
||||
{ ISFUNC, rl_insert }, /* a */
|
||||
{ ISFUNC, rl_insert }, /* b */
|
||||
{ ISFUNC, rl_insert }, /* c */
|
||||
{ ISFUNC, rl_insert }, /* d */
|
||||
{ ISFUNC, rl_insert }, /* e */
|
||||
{ ISFUNC, rl_insert }, /* f */
|
||||
{ ISFUNC, rl_insert }, /* g */
|
||||
{ ISFUNC, rl_insert }, /* h */
|
||||
{ ISFUNC, rl_insert }, /* i */
|
||||
{ ISFUNC, rl_insert }, /* j */
|
||||
{ ISFUNC, rl_insert }, /* k */
|
||||
{ ISFUNC, rl_insert }, /* l */
|
||||
{ ISFUNC, rl_insert }, /* m */
|
||||
{ ISFUNC, rl_insert }, /* n */
|
||||
{ ISFUNC, rl_insert }, /* o */
|
||||
{ ISFUNC, rl_insert }, /* p */
|
||||
{ ISFUNC, rl_insert }, /* q */
|
||||
{ ISFUNC, rl_insert }, /* r */
|
||||
{ ISFUNC, rl_insert }, /* s */
|
||||
{ ISFUNC, rl_insert }, /* t */
|
||||
{ ISFUNC, rl_insert }, /* u */
|
||||
{ ISFUNC, rl_insert }, /* v */
|
||||
{ ISFUNC, rl_insert }, /* w */
|
||||
{ ISFUNC, rl_insert }, /* x */
|
||||
{ ISFUNC, rl_insert }, /* y */
|
||||
{ ISFUNC, rl_insert }, /* z */
|
||||
|
||||
/* Final punctuation. */
|
||||
{ ISFUNC, rl_insert }, /* { */
|
||||
{ ISFUNC, rl_insert }, /* | */
|
||||
{ ISFUNC, rl_insert }, /* } */
|
||||
{ ISFUNC, rl_insert }, /* ~ */
|
||||
{ ISFUNC, rl_rubout }, /* RUBOUT */
|
||||
|
||||
#if KEYMAP_SIZE > 128
|
||||
/* Pure 8-bit characters (128 - 159).
|
||||
These might be used in some
|
||||
character sets. */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
{ ISFUNC, rl_insert }, /* ? */
|
||||
|
||||
/* ISO Latin-1 characters (160 - 255) */
|
||||
{ ISFUNC, rl_insert }, /* No-break space */
|
||||
{ ISFUNC, rl_insert }, /* Inverted exclamation mark */
|
||||
{ ISFUNC, rl_insert }, /* Cent sign */
|
||||
{ ISFUNC, rl_insert }, /* Pound sign */
|
||||
{ ISFUNC, rl_insert }, /* Currency sign */
|
||||
{ ISFUNC, rl_insert }, /* Yen sign */
|
||||
{ ISFUNC, rl_insert }, /* Broken bar */
|
||||
{ ISFUNC, rl_insert }, /* Section sign */
|
||||
{ ISFUNC, rl_insert }, /* Diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Copyright sign */
|
||||
{ ISFUNC, rl_insert }, /* Feminine ordinal indicator */
|
||||
{ ISFUNC, rl_insert }, /* Left pointing double angle quotation mark */
|
||||
{ ISFUNC, rl_insert }, /* Not sign */
|
||||
{ ISFUNC, rl_insert }, /* Soft hyphen */
|
||||
{ ISFUNC, rl_insert }, /* Registered sign */
|
||||
{ ISFUNC, rl_insert }, /* Macron */
|
||||
{ ISFUNC, rl_insert }, /* Degree sign */
|
||||
{ ISFUNC, rl_insert }, /* Plus-minus sign */
|
||||
{ ISFUNC, rl_insert }, /* Superscript two */
|
||||
{ ISFUNC, rl_insert }, /* Superscript three */
|
||||
{ ISFUNC, rl_insert }, /* Acute accent */
|
||||
{ ISFUNC, rl_insert }, /* Micro sign */
|
||||
{ ISFUNC, rl_insert }, /* Pilcrow sign */
|
||||
{ ISFUNC, rl_insert }, /* Middle dot */
|
||||
{ ISFUNC, rl_insert }, /* Cedilla */
|
||||
{ ISFUNC, rl_insert }, /* Superscript one */
|
||||
{ ISFUNC, rl_insert }, /* Masculine ordinal indicator */
|
||||
{ ISFUNC, rl_insert }, /* Right pointing double angle quotation mark */
|
||||
{ ISFUNC, rl_insert }, /* Vulgar fraction one quarter */
|
||||
{ ISFUNC, rl_insert }, /* Vulgar fraction one half */
|
||||
{ ISFUNC, rl_insert }, /* Vulgar fraction three quarters */
|
||||
{ ISFUNC, rl_insert }, /* Inverted questionk mark */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter a with ring above */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter ae */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter c with cedilla */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter e with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter e with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter e with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter e with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter i with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter i with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter i with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter i with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter eth (Icelandic) */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter n with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Multiplication sign */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter o with stroke */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter u with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter u with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter u with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter u with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter Y with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin capital letter thorn (Icelandic) */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter sharp s (German) */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter a with ring above */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter ae */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter c with cedilla */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter e with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter e with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter e with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter e with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter i with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter i with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter i with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter i with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter eth (Icelandic) */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter n with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with tilde */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Division sign */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter o with stroke */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter u with grave */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter u with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter u with circumflex */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter u with diaeresis */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter y with acute */
|
||||
{ ISFUNC, rl_insert }, /* Latin small letter thorn (Icelandic) */
|
||||
{ ISFUNC, rl_insert } /* Latin small letter y with diaeresis */
|
||||
#endif /* KEYMAP_SIZE > 128 */
|
||||
};
|
||||
|
||||
/* Unused for the time being. */
|
||||
#if 0
|
||||
KEYMAP_ENTRY_ARRAY vi_escape_keymap = {
|
||||
/* The regular control keys come first. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-@ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-a */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-b */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-c */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-d */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-e */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-f */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-g */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-h */
|
||||
{ ISFUNC, rl_tab_insert}, /* Control-i */
|
||||
{ ISFUNC, rl_emacs_editing_mode}, /* Control-j */
|
||||
{ ISFUNC, rl_kill_line }, /* Control-k */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-l */
|
||||
{ ISFUNC, rl_emacs_editing_mode}, /* Control-m */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-n */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-o */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-p */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-q */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-r */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-s */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-t */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-u */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-v */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-w */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-x */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-y */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-z */
|
||||
|
||||
{ ISFUNC, rl_vi_movement_mode }, /* Control-[ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-\ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-] */
|
||||
{ ISFUNC, (Function *)0x0 }, /* Control-^ */
|
||||
{ ISFUNC, rl_vi_undo }, /* Control-_ */
|
||||
|
||||
/* The start of printing characters. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* SPACE */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ! */
|
||||
{ ISFUNC, (Function *)0x0 }, /* " */
|
||||
{ ISFUNC, (Function *)0x0 }, /* # */
|
||||
{ ISFUNC, (Function *)0x0 }, /* $ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* % */
|
||||
{ ISFUNC, (Function *)0x0 }, /* & */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ' */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ( */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ) */
|
||||
{ ISFUNC, (Function *)0x0 }, /* * */
|
||||
{ ISFUNC, (Function *)0x0 }, /* + */
|
||||
{ ISFUNC, (Function *)0x0 }, /* , */
|
||||
{ ISFUNC, (Function *)0x0 }, /* - */
|
||||
{ ISFUNC, (Function *)0x0 }, /* . */
|
||||
{ ISFUNC, (Function *)0x0 }, /* / */
|
||||
|
||||
/* Regular digits. */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 0 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 1 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 2 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 3 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 4 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 5 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 6 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 7 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 8 */
|
||||
{ ISFUNC, rl_vi_arg_digit }, /* 9 */
|
||||
|
||||
/* A little more punctuation. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* : */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ; */
|
||||
{ ISFUNC, (Function *)0x0 }, /* < */
|
||||
{ ISFUNC, (Function *)0x0 }, /* = */
|
||||
{ ISFUNC, (Function *)0x0 }, /* > */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ? */
|
||||
{ ISFUNC, (Function *)0x0 }, /* @ */
|
||||
|
||||
/* Uppercase alphabet. */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* A */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* B */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* C */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* D */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* E */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* F */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* G */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* H */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* I */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* J */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* K */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* L */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* M */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* N */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* O */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* P */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Q */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* R */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* S */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* T */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* U */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* V */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* W */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* X */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Y */
|
||||
{ ISFUNC, rl_do_lowercase_version }, /* Z */
|
||||
|
||||
/* Some more punctuation. */
|
||||
{ ISFUNC, rl_arrow_keys }, /* [ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* \ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ] */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ^ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* _ */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ` */
|
||||
|
||||
/* Lowercase alphabet. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* a */
|
||||
{ ISFUNC, (Function *)0x0 }, /* b */
|
||||
{ ISFUNC, (Function *)0x0 }, /* c */
|
||||
{ ISFUNC, (Function *)0x0 }, /* d */
|
||||
{ ISFUNC, (Function *)0x0 }, /* e */
|
||||
{ ISFUNC, (Function *)0x0 }, /* f */
|
||||
{ ISFUNC, (Function *)0x0 }, /* g */
|
||||
{ ISFUNC, (Function *)0x0 }, /* h */
|
||||
{ ISFUNC, (Function *)0x0 }, /* i */
|
||||
{ ISFUNC, (Function *)0x0 }, /* j */
|
||||
{ ISFUNC, (Function *)0x0 }, /* k */
|
||||
{ ISFUNC, (Function *)0x0 }, /* l */
|
||||
{ ISFUNC, (Function *)0x0 }, /* m */
|
||||
{ ISFUNC, (Function *)0x0 }, /* n */
|
||||
{ ISFUNC, rl_arrow_keys }, /* o */
|
||||
{ ISFUNC, (Function *)0x0 }, /* p */
|
||||
{ ISFUNC, (Function *)0x0 }, /* q */
|
||||
{ ISFUNC, (Function *)0x0 }, /* r */
|
||||
{ ISFUNC, (Function *)0x0 }, /* s */
|
||||
{ ISFUNC, (Function *)0x0 }, /* t */
|
||||
{ ISFUNC, (Function *)0x0 }, /* u */
|
||||
{ ISFUNC, (Function *)0x0 }, /* v */
|
||||
{ ISFUNC, (Function *)0x0 }, /* w */
|
||||
{ ISFUNC, (Function *)0x0 }, /* x */
|
||||
{ ISFUNC, (Function *)0x0 }, /* y */
|
||||
{ ISFUNC, (Function *)0x0 }, /* z */
|
||||
|
||||
/* Final punctuation. */
|
||||
{ ISFUNC, (Function *)0x0 }, /* { */
|
||||
{ ISFUNC, (Function *)0x0 }, /* | */
|
||||
{ ISFUNC, (Function *)0x0 }, /* } */
|
||||
{ ISFUNC, (Function *)0x0 }, /* ~ */
|
||||
{ ISFUNC, rl_backward_kill_word }, /* RUBOUT */
|
||||
|
||||
#if KEYMAP_SIZE > 128
|
||||
/* Undefined keys. */
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 },
|
||||
{ ISFUNC, (Function *)0x0 }
|
||||
#endif /* KEYMAP_SIZE > 128 */
|
||||
};
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,87 +0,0 @@
|
||||
/* xmalloc.c -- safe versions of malloc and realloc */
|
||||
|
||||
/* Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Readline, a library for reading lines
|
||||
of text with interactive input and history editing.
|
||||
|
||||
Readline is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 1, or (at your option) any
|
||||
later version.
|
||||
|
||||
Readline is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Readline; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if defined (HAVE_CONFIG_H)
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include "ansi_stdlib.h"
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
static void memory_error_and_abort ();
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Memory Allocation and Deallocation. */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Return a pointer to free()able block of memory large enough
|
||||
to hold BYTES number of bytes. If the memory cannot be allocated,
|
||||
print an error message and abort. */
|
||||
char *
|
||||
xmalloc (bytes)
|
||||
int bytes;
|
||||
{
|
||||
char *temp;
|
||||
|
||||
temp = (char *)malloc (bytes);
|
||||
if (temp == 0)
|
||||
memory_error_and_abort ("xmalloc");
|
||||
return (temp);
|
||||
}
|
||||
|
||||
char *
|
||||
xrealloc (pointer, bytes)
|
||||
char *pointer;
|
||||
int bytes;
|
||||
{
|
||||
char *temp;
|
||||
|
||||
temp = pointer ? (char *)realloc (pointer, bytes) : (char *)malloc (bytes);
|
||||
|
||||
if (temp == 0)
|
||||
memory_error_and_abort ("xrealloc");
|
||||
return (temp);
|
||||
}
|
||||
|
||||
static void
|
||||
memory_error_and_abort (fname)
|
||||
char *fname;
|
||||
{
|
||||
fprintf (stderr, "%s: out of virtual memory\n", fname);
|
||||
exit (2);
|
||||
}
|
||||
|
||||
/* Use this as the function to call when adding unwind protects so we
|
||||
don't need to know what free() returns. */
|
||||
void
|
||||
xfree (string)
|
||||
char *string;
|
||||
{
|
||||
if (string)
|
||||
free (string);
|
||||
}
|
||||
@@ -1,339 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,181 +0,0 @@
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
These are generic installation instructions.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a `Makefile' in each directory of the package.
|
||||
It may also create one or more `.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script `config.status' that
|
||||
you can run in the future to recreate the current configuration, a file
|
||||
`config.cache' that saves the results of its tests to speed up
|
||||
reconfiguring, and a file `config.log' containing compiler output
|
||||
(useful mainly for debugging `configure').
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If at some point `config.cache'
|
||||
contains results you don't want to keep, you may remove or edit it.
|
||||
|
||||
The file `configure.in' is used to create `configure' by a program
|
||||
called `autoconf'. You only need `configure.in' if you want to change
|
||||
it or regenerate `configure' using a newer version of `autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. `cd' to the directory containing the package's source code and type
|
||||
`./configure' to configure the package for your system. If you're
|
||||
using `csh' on an old version of System V, you might need to type
|
||||
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||
`configure' itself.
|
||||
|
||||
Running `configure' takes awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the `configure' options `--x-includes=DIR' and
|
||||
`--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features `configure' can not figure out
|
||||
automatically, but needs to determine by the type of host the package
|
||||
will run on. Usually `configure' can figure that out, but if it prints
|
||||
a message saying it can not guess the host type, give it the
|
||||
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name with three fields:
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the host type.
|
||||
|
||||
If you are building compiler tools for cross-compiling, you can also
|
||||
use the `--target=TYPE' option to select the type of system they will
|
||||
produce code for and the `--build=TYPE' option to select the type of
|
||||
system on which you are compiling the package.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for `configure' scripts to share,
|
||||
you can create a site shell script called `config.site' that gives
|
||||
default values for variables like `CC', `cache_file', and `prefix'.
|
||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
`CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all `configure' scripts look for a site script.
|
||||
|
||||
Operation Controls
|
||||
==================
|
||||
|
||||
`configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Use and save the results of the tests in FILE instead of
|
||||
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||
debugging `configure'.
|
||||
|
||||
`--help'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-q'
|
||||
Do not print messages saying which checks are being made.
|
||||
|
||||
`--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
`configure' can determine that directory automatically.
|
||||
|
||||
`--version'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
Getting Started with Texinfo
|
||||
============================
|
||||
|
||||
25 March 1993
|
||||
|
||||
Most of the installation instructions are described in the file `INSTALL'.
|
||||
One additional note to make is that if your info files are in a nonstandard
|
||||
place (i.e. not in the `info' directory immediately under $prefix) you may
|
||||
wish to change the default info path as specified via DEFAULT_INFOPATH in
|
||||
info/Makefile.in.
|
||||
|
||||
"Texinfo" is a documentation system that uses a single source file to
|
||||
produce both on-line information and printed output. Using Texinfo,
|
||||
you can create a printed document with the normal features of a book,
|
||||
including chapters, sections, cross references, and indices. From the
|
||||
same Texinfo source file, you can create a menu-driven, on-line Info
|
||||
file with nodes, menus, cross references, and indices.
|
||||
|
||||
The name of the Texinfo source documentation file is `texinfo.texi'.
|
||||
You can produce both on-line information and printed output from this
|
||||
source file. The documentation describes Texinfo in detail, including
|
||||
how to write Texinfo files, how to format them for both hard copy and
|
||||
Info, and how to install Info files.
|
||||
|
||||
To get started, you need to create either a printed manual or an
|
||||
on-line Info file from the `texinfo.texi' file. You do not need to
|
||||
create both, although you will probably want both eventually.
|
||||
|
||||
To learn how to use Info, read the info documentation. You can do this in
|
||||
one of two ways: using the standalone `info' program, or using Info mode in
|
||||
GNU Emacs.
|
||||
|
||||
* If you want to use the `info' program, type
|
||||
|
||||
$ info -f info-stnd
|
||||
|
||||
* If you want to use Emacs, start up emacs and type `C-h i' [M-x info].
|
||||
Follow the instructions to learn how to use Info.
|
||||
|
||||
After learning how to use Info, you can read the Texinfo documentation.
|
||||
Using the standalone `info', type the following at the shell prompt:
|
||||
|
||||
$ info -f texinfo
|
||||
|
||||
To use read this manual in Emacs, you first need to edit the Info-directory
|
||||
menu (the file `dir' in the system info directory) to contain the
|
||||
appropriate node. To learn how to do this, see node: Add in the Info
|
||||
documentation.
|
||||
|
||||
The Texinfo documentation describes Texinfo in detail; among other things,
|
||||
it tells how to install Info files in the usual manner. (See node: Install
|
||||
an Info File.)
|
||||
|
||||
The `info-stnd.info' file describes the standalone Info reader in detail. To
|
||||
read this file, type
|
||||
|
||||
$ info -f info-stnd
|
||||
|
||||
If you are using GNU Emacs, you may want to install the Emacs Lisp files
|
||||
permanently. Move them them to a directory in the load-path for Emacs;
|
||||
otherwise Emacs will not be able to load the autoloaded support files, such
|
||||
as `texinfmt.el'.
|
||||
|
||||
The `texinfo.el' file contains the autoload commands; it is the only
|
||||
file that needs to be loaded initially. If your Emacs does not
|
||||
automatically load `texinfo.el', you can tell it to do so by placing
|
||||
the following in `default.el' or in your `.emacs' file:
|
||||
|
||||
(load "texinfo")
|
||||
|
||||
|
||||
To create a printed manual
|
||||
==========================
|
||||
|
||||
You need:
|
||||
|
||||
* The `tex' program, which typesets the manual using TeX.
|
||||
* The `texinfo.tex' definition file that tells TeX how to typeset
|
||||
a Texinfo file.
|
||||
* The `texindex' program, which sorts the unsorted index files
|
||||
created by TeX.
|
||||
* A printing program such as `lp' or `lpr',
|
||||
* A printer.
|
||||
|
||||
This Texinfo distribution package contains `texinfo.tex', the C source
|
||||
for `texindex', and the handy shell script `texi2dvi'. The `tex'
|
||||
program is not part of this distribution, but is available separately.
|
||||
(See `How to Obtain TeX' in the Texinfo documentation.)
|
||||
|
||||
* Install `tex'. (`texindex' is installed automagically by
|
||||
`make install' in this distribution.)
|
||||
|
||||
* Move the `texinfo.tex' file to an appropriate directory; the current
|
||||
directory will do. (`/usr/local/lib/tex/inputs' might be a good place.
|
||||
See ``Preparing to Use TeX'' in the Texinfo manual, for more
|
||||
information.)
|
||||
|
||||
After following those instructions, type the following to make the .dvi
|
||||
files:
|
||||
|
||||
$ make texinfo.dvi
|
||||
$ (cd info; make info.dvi info-stnd.dvi)
|
||||
$ (cd makeinfo; make makeinfo.dvi)
|
||||
|
||||
You can then print the resulting .dvi files with the `lpr' command (on BSD
|
||||
systems. On SysV systems the command is `lp'. Consult your man pages for
|
||||
more information).
|
||||
|
||||
For example, the command to print the texinfo.dvi file might be:
|
||||
|
||||
$ lpr -d texinfo.dvi
|
||||
|
||||
The name of the printing command depends on the system; `lpr -d' is
|
||||
common, and is illustrated here. You may use a different name for the
|
||||
printing command.
|
||||
|
||||
Please report bugs to [email protected].
|
||||
|
||||
Happy formatting.
|
||||
@@ -1,211 +0,0 @@
|
||||
# Makefile for Texinfo distribution.
|
||||
# $Id: Makefile.in,v 1.11 1996/10/04 18:40:33 karl Exp $
|
||||
#
|
||||
# Copyright (C) 1993, 96 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#### Start of system configuration section. ####
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = $(srcdir):$(common)
|
||||
|
||||
common = $(srcdir)/libtxi
|
||||
|
||||
CC = @CC@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
LN = ln
|
||||
RM = rm -f
|
||||
TAR = tar
|
||||
MKDIR = mkdir
|
||||
|
||||
DEFS = @DEFS@
|
||||
LIBS = @LIBS@
|
||||
LOADLIBES = $(LIBS)
|
||||
|
||||
ALLOCA = @ALLOCA@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = $(exec_prefix)/bin
|
||||
# Prefix for each installed program, normally empty or `g'.
|
||||
binprefix =
|
||||
# Prefix for each installed man page, normally empty or `g'.
|
||||
manprefix =
|
||||
manext = 1
|
||||
mandir = $(prefix)/man/man$(manext)
|
||||
infodir = $(prefix)/info
|
||||
|
||||
# For info program.
|
||||
DEFAULT_INFOPATH = $(infodir):.
|
||||
|
||||
#### End of system configuration section. ####
|
||||
|
||||
VERSION = 3.9
|
||||
DISTNAME = texinfo-$(VERSION)
|
||||
|
||||
# Subdirectories that have makefiles
|
||||
SUBDIRS = libtxi makeinfo info util emacs
|
||||
|
||||
# All subdirectories that go into a distribution
|
||||
ALL_SUBDIRS = $(SUBDIRS) makeinfo/macros
|
||||
|
||||
MDEFINES = bindir='$(bindir)' mandir='$(mandir)' manext='$(manext)' \
|
||||
prefix='$(prefix)' binprefix='$(binprefix)' \
|
||||
manprefix='$(manprefix)' infodir='$(infodir)' CFLAGS='$(CFLAGS)' \
|
||||
CC='$(CC)' ALLOCA='$(ALLOCA)' LDFLAGS='$(LDFLAGS)' \
|
||||
DEFAULT_INFOPATH='$(DEFAULT_INFOPATH)'
|
||||
|
||||
all: sub-all texinfo
|
||||
|
||||
install: all installdirs
|
||||
test -f $(infodir)/dir || $(INSTALL_DATA) $(srcdir)/dir $(infodir)
|
||||
for dir in $(SUBDIRS); do \
|
||||
echo making $@ in $$dir; \
|
||||
(cd $$dir && $(MAKE) $(MDEFINES) $@ || exit 1); \
|
||||
done
|
||||
d=$(srcdir); test -f ./texinfo && d=.; \
|
||||
(cd $$d && for f in texinfo texinfo-* ; do \
|
||||
$(INSTALL_DATA) $$f $(infodir)/$$f; done)
|
||||
$(POST_INSTALL)
|
||||
./util/install-info --info-dir=$(infodir) $(infodir)/texinfo
|
||||
@echo Please install $(srcdir)/texinfo.tex manually.
|
||||
|
||||
installdirs:
|
||||
-$(SHELL) $(srcdir)/util/mkinstalldirs $(bindir) $(datadir) $(infodir) $(mandir)
|
||||
|
||||
uninstall:
|
||||
for dir in $(SUBDIRS); do \
|
||||
echo making $@ in $$dir; \
|
||||
(cd $$dir && $(MAKE) $(MDEFINES) $@ || exit 1); \
|
||||
done
|
||||
$(RM) $(infodir)/texinfo $(infodir)/texinfo-*
|
||||
|
||||
Makefile: Makefile.in config.status
|
||||
$(SHELL) ./config.status
|
||||
|
||||
config.status: configure
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
configure: configure.in
|
||||
cd $(srcdir) && autoconf
|
||||
|
||||
sub-all TAGS:
|
||||
for dir in $(SUBDIRS); do \
|
||||
echo making $@ in $$dir; \
|
||||
(cd $$dir && $(MAKE) $(MDEFINES) $@ || exit 1); \
|
||||
done
|
||||
.PHONY: sub-all
|
||||
|
||||
clean mostlyclean:
|
||||
for dir in $(SUBDIRS); do \
|
||||
echo making $@ in $$dir; \
|
||||
(cd $$dir && $(MAKE) $(MDEFINES) $@ || exit 1); \
|
||||
done
|
||||
|
||||
distclean: clean texclean
|
||||
for dir in $(SUBDIRS); do \
|
||||
echo making $@ in $$dir; \
|
||||
(cd $$dir && $(MAKE) $(MDEFINES) $@ || exit 1); \
|
||||
done
|
||||
$(RM) Makefile *.status *.cache *.log texinfo texinfo-? texinfo-??
|
||||
|
||||
texclean:
|
||||
$(RM) *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs
|
||||
$(RM) *.toc *.tp *.tps *.vr *.vrs
|
||||
|
||||
realclean: distclean
|
||||
|
||||
# Let's hope we weren't cross-compiling.
|
||||
# If we depend on sub-all, this always gets remade. Annoying.
|
||||
info texinfo: texinfo.texi
|
||||
./makeinfo/makeinfo -I$(srcdir) texinfo.texi
|
||||
.PHONY: info
|
||||
|
||||
dvi texinfo.dvi:
|
||||
PATH="$(srcdir)/util:$${PATH}" TEXINPUTS="$(srcdir):$(common):$${TEXINPUTS}" texi2dvi $(srcdir)/texinfo.texi
|
||||
.PHONY: dvi
|
||||
|
||||
dist: DISTFILES
|
||||
$(RM) -r $(DISTNAME)
|
||||
$(MKDIR) $(DISTNAME)
|
||||
for d in `find . -type d ! -name RCS -print`; do \
|
||||
d=`echo $$d | grep -v '[@=]'`; \
|
||||
test -z "$$d" || test "$$d" = . || test "$$d" = "./$(DISTNAME)" \
|
||||
|| mkdir $(DISTNAME)/$$d; done
|
||||
for f in `cat DISTFILES`; do \
|
||||
$(LN) $(srcdir)/$$f $(DISTNAME)/$$f || \
|
||||
{ echo copying $$f; cp -p $(srcdir)/$$f $(DISTNAME)/$$f ; } \
|
||||
done
|
||||
(cd $(DISTNAME); $(MAKE) $(MFLAGS) distclean)
|
||||
$(TAR) chvf - $(DISTNAME) | gzip >$(DISTNAME).tar.gz
|
||||
$(RM) -r $(DISTNAME)
|
||||
|
||||
# Gets rid of most of the unwanted files. Verify manually (if necessary)
|
||||
# that this produces a list of all the files desired in the distribution.
|
||||
DISTFILES: force
|
||||
(cd $(srcdir); find . ! -type d -print) \
|
||||
| sed '/\/RCS\//d; \
|
||||
/\/EMACS-BACKUPS\//d; \
|
||||
/\.tar.*/d; \
|
||||
/~$$/d; /\.o$$/d; \
|
||||
/\.gdbinit$$/d; \
|
||||
/\.orig$$/d; \
|
||||
/\#$$/d; \
|
||||
/\/info\/info$$/d; \
|
||||
/\.info$$/d; \
|
||||
/\.elc/d; \
|
||||
/\/makeinfo\/makeinfo$$/d; \
|
||||
/\/$(DISTNAME)\/.*$$/d; \
|
||||
/\/util\/texindex$$/d; \
|
||||
/texinfo$$/d; \
|
||||
/texinfo-[0-9]+$$/d; \
|
||||
/\/.*\.BAK$$/d; \
|
||||
/\/.*\.a$$/d; \
|
||||
/\/core$$/d; \
|
||||
/\/*\.core$$/d; \
|
||||
/\/core\..*$$/d; \
|
||||
/\/a.out$$/d; \
|
||||
/\/[=@]/d; \
|
||||
/\/conftest\.c$$/d; \
|
||||
/\/DISTFILES$$/d; \
|
||||
/\/foo$$/d; \
|
||||
/\/bar$$/d; \
|
||||
/\.toc$$/d; \
|
||||
/\.bak$$/d; \
|
||||
/\.aux$$/d; /\.log$$/d; \
|
||||
/\.cps$$/d; /\.cp$$/d; \
|
||||
/\.fns$$/d; /\.fn$$/d; \
|
||||
/\.tps$$/d; /\.tp$$/d; \
|
||||
/\.vrs$$/d; /\.vr$$/d; \
|
||||
/\.pgs$$/d; /\.pg$$/d; \
|
||||
/\.kys$$/d; /\.ky$$/d; \
|
||||
/\.ops$$/d; /\.op$$/d; \
|
||||
s/^.\///; /^\.$$/d;' \
|
||||
| sort | uniq > DISTFILES
|
||||
|
||||
force:
|
||||
|
||||
# Prevent GNU make v3 from overflowing arg limit on SysV.
|
||||
.NOEXPORT:
|
||||
@@ -1,93 +0,0 @@
|
||||
This file records noteworthy changes.
|
||||
|
||||
3.9 (4 October 1996)
|
||||
* makeinfo:
|
||||
- Give a suppressible (with --no-validate) error for references
|
||||
outside of any node.
|
||||
- Keep track of multitable output correctly for split files; this
|
||||
caused nodes after the first multitable to be ``undefined''.
|
||||
* install-info:
|
||||
- Rename --infodir option to --info-dir.
|
||||
- More robust error checking to avoid various crashes.
|
||||
* configure: Include replacements for memcpy and memmove functions in
|
||||
the distribution, in case they are missing.
|
||||
|
||||
3.8 (30 September 1996)
|
||||
* Define and/or document new and/or previously existing commands:
|
||||
Accents: @" @' @, @" @= @^ @` @~ @H @d @dotaccent @dotless @ringaccent
|
||||
@tieaccent @u @ubaraccent @v
|
||||
Special characters: @AA @AE @L @O @OE @aa @ae @exclamdown @l @o @oe
|
||||
@pounds @questiondown @ss
|
||||
Special punctuation: @! @? @enddots
|
||||
dir file maintenance: @dircategory @direntry; also new program, install-info
|
||||
HTML support: @email @url @ifhtml...@end ifhtml
|
||||
Macros: @macro @unmacro
|
||||
Tables: @multitable @tab
|
||||
Hyphenation: @- @hyphenation
|
||||
Spacing: @ @<TAB> @<NEWLINE>
|
||||
Sectioning:
|
||||
@headings singleafter/doubleafter (change heading style after current page)
|
||||
@centerchap
|
||||
@setchapterstyle
|
||||
Other:
|
||||
@shorttitlepage (simple title pages)
|
||||
@detailmenu...@end detailmenu (help makeinfo parse master menus)
|
||||
* Makeinfo prefers an input file named `foo.texinfo' or `foo.texi' or
|
||||
`foo.txinfo' to just `foo' (the latter most likely being an executable).
|
||||
* Makeinfo implements @. @! @? correctly, as end-of-sentence punctuation.
|
||||
* @key marks its argument with a lozenge in TeX and <...> in Info.
|
||||
* TeX output has substantially decreased interline spacing and other
|
||||
formatting changes.
|
||||
* Remove these obsolete and never-documented commands:
|
||||
@infotop
|
||||
@infoappendix @infoappendixsec @infoappendixsubsec @infoappendixsubsubsec
|
||||
@infochapter @infosection @infosubsection @infosubsubsection
|
||||
@infounnumbered @infounnumberedsec @infounnumberedsubsec
|
||||
@infounnumberedsubsubsec
|
||||
@input
|
||||
@smallbreak @medbreak
|
||||
@overfullrule
|
||||
@br
|
||||
* Deprecate these obsolete commands, to be removed in the next release:
|
||||
@ctrl
|
||||
@infoinclude
|
||||
@iappendix @iappendixsection @iappendixsec @iappendixsubsec
|
||||
@iappendixsubsubsec
|
||||
@ichapter @isection @isubsection @isubsubsection
|
||||
@iunnumbered @iunnumberedsec @iunnumberedsubsec @iunnumberedsubsubsec
|
||||
@setchapterstyle
|
||||
@titlespec
|
||||
|
||||
3.7 (24 December 1995)
|
||||
* Have --version print texinfo release number as well as the individual
|
||||
program version.
|
||||
* Better man page cleaning.
|
||||
* Update Elisp files from current Emacs release.
|
||||
|
||||
3.6 (21 June 1995)
|
||||
* Unmatched brace error reporting improved.
|
||||
* Missing comment terminator prevented compilation.
|
||||
|
||||
3.5 (20 June 1995)
|
||||
* Autoconf update.
|
||||
* Support for parallel makes.
|
||||
* make install does not install Elisp files.
|
||||
|
||||
3.4 (19 June 1995)
|
||||
* Handle @ifhtml in Elisp.
|
||||
* Update FSF address.
|
||||
|
||||
3.3 (15 June 1995)
|
||||
* Portability changes.
|
||||
* Compile Elisp files.
|
||||
* Don't distribute .info* files.
|
||||
|
||||
3.2 (9 June 1995)
|
||||
* Standalone Info can read Unix man pages.
|
||||
* New commands: @! @? @^ @" @enddots.
|
||||
* makeinfo -E does macro expansion (and nothing else).
|
||||
|
||||
3.1 (23 May 1993)
|
||||
Just bug fixes, see ChangeLog for full details.
|
||||
|
||||
texinfo-3.0: first release of Texinfo version 2, with many new commands.
|
||||
@@ -1,163 +0,0 @@
|
||||
Texinfo, Version 3
|
||||
==================
|
||||
|
||||
This is the README file for version 3 of the Texinfo distribution.
|
||||
Files within this distribution have their own version and edition
|
||||
numbers. When you refer to a file, please mention its own number, as
|
||||
well as the version number of the Texinfo distribution.
|
||||
|
||||
PLEASE REPORT BUGS TO: [email protected]
|
||||
|
||||
Texinfo is a documentation system that uses a single source file to
|
||||
produce both on-line information and printed output. This means that
|
||||
instead of writing two different documents, one for the on-line help
|
||||
or other on-line information and the other for a typeset manual or
|
||||
other printed work, you need write only one document. When the work
|
||||
is revised, you need revise only one document. You can read the
|
||||
on-line information, known as an "Info file", with an Info
|
||||
documentation-reading program. By convention, Texinfo source file
|
||||
names end with a `.texi' or `.texinfo' extension. Texinfo is
|
||||
described in the Texinfo manual (the file ./texinfo.texi).
|
||||
|
||||
You can write and format Texinfo files into Info files within GNU Emacs,
|
||||
and read them using the Emacs Info reader. If you do not have Emacs,
|
||||
you can format Texinfo files into Info files using `makeinfo' and read
|
||||
them using `info'. Use TeX, which is not included in this package (see
|
||||
`How to Obtain TeX' in the Texinfo manual for information), to typeset
|
||||
Texinfo files for printing.
|
||||
|
||||
For instructions on compiling and installing info, makeinfo, texi2dvi,
|
||||
and texindex, please read the file `INSTALL'. The Emacs Lisp files are
|
||||
not installed by default; to install them, use `make install' in the
|
||||
`emacs' subdirectory. The Info tree uses a file `dir' as its root node;
|
||||
a sample `dir' file is included in the distribution, but not installed
|
||||
anywhere. Use it or not as you like.
|
||||
|
||||
This distribution includes (but is not limited to) the following files:
|
||||
|
||||
README This file.
|
||||
|
||||
INTRODUCTION This file tells you how to create
|
||||
readable files from the Texinfo source
|
||||
files in this distribution.
|
||||
|
||||
Texinfo source files:
|
||||
|
||||
texinfo.texi This manual describes Texinfo. It
|
||||
tells how to use Texinfo to write
|
||||
documentation, how to use Texinfo mode
|
||||
in GNU Emacs, how to use TeX,
|
||||
makeinfo, and the Emacs Lisp Texinfo
|
||||
formatting commands.
|
||||
|
||||
info.texi This manual tells you how to use
|
||||
Info. This document comes as part of
|
||||
GNU Emacs. If you do not have Emacs,
|
||||
you can format this Texinfo source
|
||||
file with makeinfo or TeX and then
|
||||
read the resulting Info file with the
|
||||
standalone Info reader that is part of
|
||||
this distribution.
|
||||
|
||||
info-stnd.texi This manual tells you how to use
|
||||
the standalone GNU Info reader that is
|
||||
included in this distribution as a C
|
||||
source file, `info.c'.
|
||||
|
||||
makeinfo.texi This manual tells you how to use
|
||||
makeinfo. The same information is
|
||||
contained in a chapter of the Texinfo
|
||||
manual; it has been extracted here for
|
||||
your convenience.
|
||||
|
||||
|
||||
Printing related files:
|
||||
|
||||
texinfo.tex This TeX definitions file tells
|
||||
the TeX program how to typeset a
|
||||
Texinfo file into a DVI file ready for
|
||||
printing.
|
||||
|
||||
texindex.c This file contains the source for
|
||||
the `texindex' program that generates
|
||||
sorted indices used by TeX when
|
||||
typesetting a file for printing.
|
||||
|
||||
texi2dvi This is a shell script for
|
||||
producing an indexed DVI file using
|
||||
TeX and texindex. Must be used if the
|
||||
source document uses Texinfo @macros.
|
||||
|
||||
|
||||
GNU Emacs related files:
|
||||
|
||||
texinfmt.el This Emacs Lisp file provides the
|
||||
functions that GNU Emacs uses to
|
||||
format a Texinfo file into an Info
|
||||
file.
|
||||
|
||||
texinfo.el This file provides Texinfo mode
|
||||
for GNU Emacs.
|
||||
|
||||
texnfo-upd.el These files provides commands to
|
||||
texnfo-tex.el help you write Texinfo files
|
||||
makeinfo.el using GNU Emacs Texinfo mode.
|
||||
|
||||
detexinfo.el This extra utility file contains functions
|
||||
to remove Texinfo commands from a
|
||||
Texinfo source file.
|
||||
|
||||
info.el These are the standard GNU Emacs
|
||||
informat.el Info reading and support files,
|
||||
included here for your convenience.
|
||||
|
||||
|
||||
Source files for standalone C programs:
|
||||
|
||||
makeinfo.c This file contains the source for
|
||||
the `makeinfo' program that you can
|
||||
use to create an Info file from a
|
||||
Texinfo file.
|
||||
|
||||
info.c This file contains the source for
|
||||
the `info' program that you can use to
|
||||
view Info files on an ASCII terminal.
|
||||
|
||||
getopt.c Various support files
|
||||
getopt1.c
|
||||
getopt.h
|
||||
|
||||
|
||||
C Installation files:
|
||||
|
||||
configure This file creates creates a Makefile
|
||||
which in turn creates an `info' or
|
||||
`makeinfo' executable, or a C sources
|
||||
distribution.
|
||||
|
||||
configure.in This is a template for creating
|
||||
`configure' using m4 macros.
|
||||
|
||||
Makefile.in This is a template for `configure'
|
||||
to use to make a Makefile.
|
||||
|
||||
|
||||
Other files:
|
||||
|
||||
NEWS This contains a summary of new
|
||||
features since the first edition
|
||||
of Texinfo.
|
||||
|
||||
info.1 This is a `man' page that briefly
|
||||
describes the standalone `info'
|
||||
program.
|
||||
|
||||
fixfonts This is a shell script to install the
|
||||
`lcircle10' TeX fonts as an alias for
|
||||
the `circle10' fonts. In some older
|
||||
TeX distributions the names are
|
||||
different.
|
||||
|
||||
tex3patch This handles a bug for version
|
||||
3.0 of TeX that does not occur in
|
||||
more recent versions.
|
||||
@@ -1,35 +0,0 @@
|
||||
If you are interested in working on any of these,
|
||||
email [email protected].
|
||||
|
||||
* Use Automake.
|
||||
|
||||
* Use a config header file instead of @DEFS@.
|
||||
|
||||
* A detexinfo program, like detex or delatex. This command would
|
||||
strip all the texinfo commands out, and would be used as a filter on
|
||||
the way to a speller. An option would be to NOT strip comments out.
|
||||
makeinfo --no-headers come close.
|
||||
|
||||
* Change bars. This is difficult or impossible in TeX,
|
||||
unfortunately. To do it right requires device driver support.
|
||||
|
||||
* The dark corner symbol for the gawk manual.
|
||||
|
||||
* Better i18n support, including support for 8-bit input
|
||||
characters. Requires fonts, and the DC fonts are not (as of this
|
||||
writing) free.
|
||||
|
||||
* @exercise/@answer command for, e.g., gawk.
|
||||
|
||||
* @figure.
|
||||
|
||||
* HTML output in makeinfo.
|
||||
|
||||
* Include a complete functional summary, a la a reference card, in the manual.
|
||||
|
||||
* Use @ as the escape character, and Texinfo syntax generally, in the
|
||||
table of contents, aux, and index files. Eliminate all the crazy
|
||||
redefinitions of every Texinfo command (which lists always seem to be
|
||||
incomplete).
|
||||
|
||||
* Improve the manuals for makeinfo, standalone info, etc.
|
||||
Vendored
-1876
File diff suppressed because it is too large.
Load diff
@@ -1,42 +0,0 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl $Id: configure.in,v 1.3 1996/10/03 18:33:52 karl Exp $
|
||||
AC_INIT(texinfo.texi)
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
|
||||
AC_ISC_POSIX
|
||||
AC_MINIX
|
||||
|
||||
dnl Checks for libraries.
|
||||
# Needed on sysV68 for sigblock, sigsetmask.
|
||||
AC_CHECK_LIB(bsd, sigblock)
|
||||
|
||||
TERMLIBS=
|
||||
for termlib in curses termcap terminfo termlib ; do
|
||||
AC_CHECK_LIB(${termlib}, tputs,
|
||||
[TERMLIBS="${TERMLIBS} -l${termlib}"; break])
|
||||
done
|
||||
AC_SUBST(TERMLIBS)
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(unistd.h termios.h termio.h strings.h string.h varargs.h \
|
||||
sys/time.h sys/fcntl.h sys/ttold.h sys/ptem.h sys/file.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_OFF_T
|
||||
AC_C_CONST
|
||||
AC_STRUCT_TM
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_FUNC_ALLOCA
|
||||
AC_FUNC_SETVBUF_REVERSED
|
||||
AC_CHECK_FUNCS(setvbuf getcwd memset bzero strchr strcasecmp \
|
||||
vfprintf vsprintf strerror sigprocmask sigsetmask)
|
||||
dnl strcasecmp, strerror, xmalloc, xrealloc, probably others should be added.
|
||||
AC_REPLACE_FUNCS(memcpy memmove strdup)
|
||||
|
||||
AC_OUTPUT(Makefile libtxi/Makefile makeinfo/Makefile info/Makefile util/Makefile emacs/Makefile)
|
||||
@@ -1,16 +0,0 @@
|
||||
$Id: dir,v 1.2 1996/09/24 18:43:01 karl Exp $
|
||||
This is the file .../info/dir, which contains the topmost node of the
|
||||
Info hierarchy. The first time you invoke Info you start off
|
||||
looking at that node, which is (dir)Top.
|
||||
|
||||
File: dir Node: Top This is the top of the INFO tree
|
||||
|
||||
This (the Directory node) gives a menu of major topics.
|
||||
Typing "q" exits, "?" lists all Info commands, "d" returns here,
|
||||
"h" gives a primer for first-timers,
|
||||
"mEmacs<Return>" visits the Emacs topic, etc.
|
||||
|
||||
In Emacs, you can click mouse button 2 on a menu item or cross reference
|
||||
to select it.
|
||||
|
||||
* Menu:
|
||||
@@ -1,309 +0,0 @@
|
||||
This is the directory file `dir' a.k.a. `DIR', which contains the
|
||||
topmost node of the Info hierarchy. This file is merely made available
|
||||
for your hacking pleasure, not official or standard in any way.
|
||||
If it doesn't make sense to you, or you don't like it, ignore it.
|
||||
|
||||
$Id: dir,v 1.20 1996/10/04 18:39:29 karl Exp $
|
||||
|
||||
File: dir Node: Top This is the top of the INFO tree.
|
||||
|
||||
This node gives a menu of the major topics accessible through Info.
|
||||
|
||||
`q' quits;
|
||||
`?' lists all Info commands;
|
||||
`h' starts the Info tutorial;
|
||||
`mTexinfo RET' visits the Texinfo manual, etc.
|
||||
|
||||
* Menu:
|
||||
|
||||
GNU packages
|
||||
* Bash: (bash). Bourne again shell.
|
||||
* Cpio: (cpio). Cpio archiver.
|
||||
* DC: (dc). Postfix arbitrary expression calculator.
|
||||
* Diff: (diff). Comparing and merging programs.
|
||||
* Ed: (ed). Line editor.
|
||||
* Emacs: (emacs). Extensible self-documenting text editor.
|
||||
* File utilities: (fileutils). GNU file utilities.
|
||||
* Finding files: (find). Operating on files matching certain criteria.
|
||||
* Font utilities: (fontu). Programs for font manipulation.
|
||||
* Gawk: (gawk). A text processing and scanning language.
|
||||
* Gzip: (gzip). General (de)compression.
|
||||
* Identifier DB: (id-utils). Identifier database utilities.
|
||||
* Ispell: (ispell). Interactive spelling corrector.
|
||||
* M4: (m4). Macro processor.
|
||||
* Make: (make). Remake files automatically.
|
||||
* Ptx: (ptx). Permuted index generator.
|
||||
* Shar: (sharutils). Shell archiver, uudecode/uuencode.
|
||||
* Shell utilities: (sh-utils). GNU shell utilities.
|
||||
* Tar: (tar). ``Tape'' archiver.
|
||||
* Text utilities: (textutils). GNU text utilities.
|
||||
* Time: (time). Measuring program resource usage.
|
||||
* UUCP: (uucp). Copying between machines, offline.
|
||||
* Wdiff: (wdiff). Word-by-word comparison.
|
||||
|
||||
GNU programming tools
|
||||
* As: (as). Assembler.
|
||||
* Binutils: (binutils). ar/copy/objdump/nm/size/strip/ranlib.
|
||||
* Bison: (bison). LALR(1) parser generator.
|
||||
* CPP: (cpp). C preprocessor.
|
||||
* CVS: (cvs). Concurrent versions system for source control.
|
||||
* DejaGnu: (dejagnu). Testing framework.
|
||||
* Flex: (flex). A fast scanner generator.
|
||||
* Gasp: (gasp). GNU Assembler preprocessor.
|
||||
* Libtool: (libtool). Generic library support script.
|
||||
* GCC: (gcc). C compiler.
|
||||
* GDB: (gdb). Source-level debugger for C and C++.
|
||||
* Gperf: (gperf). Perfect hash function generator.
|
||||
* Gprof: (gprof). Profiler.
|
||||
* Indent: (indent). Prettyprinter for programs.
|
||||
* Ld: (ld). Linker.
|
||||
|
||||
Texinfo documentation system
|
||||
* Info: (info). Documentation browsing system.
|
||||
* Texinfo: (texinfo). The GNU documentation format.
|
||||
* install-info: (texinfo)Invoking install-info. Updating info/dir entries.
|
||||
* texi2dvi: (texinfo)Format with texi2dvi. Printing Texinfo documentation.
|
||||
* texindex: (texinfo)Format with tex/texindex. Sorting Texinfo index files.
|
||||
* info program: (info-stnd). Standalone Info-reading program.
|
||||
* makeinfo: (makeinfo). Convert Texinfo source to Info or plain ASCII.
|
||||
|
||||
GNU Emacs Lisp
|
||||
* Elisp: (elisp). GNU Emacs Lisp reference manual.
|
||||
* Intro Elisp: (emacs-lisp-intro). Introduction to Elisp programming.
|
||||
|
||||
* Calc: (calc). Calculator and more.
|
||||
* CC-mode: (ccmode). Editing C, C++, and Objective C.
|
||||
* Common Lisp: (cl). Partial Common Lisp support for Emacs Lisp.
|
||||
* Dired-x: (dired-x). Extra directory editor features.
|
||||
* Edebug: (edebug). Source-level debugger for Emacs Lisp.
|
||||
* Ediff: (ediff). Comprehensive visual interface to diff & patch.
|
||||
* EDB: (edb). Database for Emacs.
|
||||
* Forms: (forms). Fill-in-the-form data entry.
|
||||
* Gmhist: (gmhist). Generic minibuffer history.
|
||||
* GNUS: (gnus). Netnews reading and posting.
|
||||
* Mailcrypt: (mailcrypt). Use PGP in Emacs.
|
||||
* MH-E: (mh-e). Emacs interface to the MH mail system.
|
||||
* PCL-CVS: (pcl-cvs). Emacs front end to CVS.
|
||||
* Supercite: (sc). Supercite for including other people's words.
|
||||
* VIP: (vip). vi emulation.
|
||||
* VIPER: (viper). The new VI-emulation mode in Emacs-19.29.
|
||||
* VM: (vm). Mail reader.
|
||||
* W3: (w3). WWW browser.
|
||||
|
||||
GNU admin
|
||||
* Autoconf: (autoconf). Automatic generation of package configuration.
|
||||
* Automake: (automake). Making Makefile.in's.
|
||||
* Configure: (configure). Cygnus configure.
|
||||
* Gettext: (gettext). Internationalization.
|
||||
* Gnats: (gnats). Cygnus bug tracking system.
|
||||
* Maintaining: (maintain). Maintaining GNU software.
|
||||
* Remsync: (remsync). Remote synchronization of directory trees.
|
||||
* Send PR: (send-pr). Cygnus bug reporting for Gnats.
|
||||
* Source config: (cfg-paper). Some theory on configuring source packages.
|
||||
* Standards: (standards). GNU coding standards.
|
||||
|
||||
GNU libraries
|
||||
* Annotate: (annotate). High-level GDB to GUI's.
|
||||
* BFD: (bfd). Binary file descriptors for object file IO.
|
||||
* GDB library: (libgdb). Application programming interface to GDB.
|
||||
* GDBM: (gdbm). Hashed databases.
|
||||
* History: (history). Recall previous lines of input.
|
||||
* Iostream: (iostream). C++ input/output.
|
||||
* Libc: (libc). C library.
|
||||
* Libg++: (libg++). C++ classes.
|
||||
* Mmalloc: (mmalloc). Memory-mapped malloc.
|
||||
* Readline: (readline). General command-line interface.
|
||||
* Regex: (regex). Regular expressions.
|
||||
* Termcap: (termcap). All about /etc/termcap.
|
||||
|
||||
GNU programming documentation
|
||||
* GDB internals: (gdbint). Debugger internals.
|
||||
* Ld internals: (ldint). GNU linker internals.
|
||||
* Stabs: (stabs). Symbol table debugging information format.
|
||||
|
||||
DOS
|
||||
* Demacs: (demacs). GNU Emacs for DOS.
|
||||
* GNUish: (gnuish). GNU utilities for DOS.
|
||||
|
||||
TeX things
|
||||
* Afm2tfm: (dvips)Invoking afm2tfm. Making Type 1 fonts available to TeX.
|
||||
* Dvips: (dvips). DVI-to-PostScript translator.
|
||||
* Eplain: (eplain). Expanding on plain TeX.
|
||||
* Kpathsearch: (kpathsea). File lookup along search paths.
|
||||
* LaTeX: (latex). LaTeX.
|
||||
* MakeIndex: (makeindex). Index creation for TeX.
|
||||
* Naming fonts: (fontname). Filenames for TeX fonts.
|
||||
* TeXDraw: (texdraw). Drawing PostScript diagrams within TeX.
|
||||
* Web2c: (web2c). TeX, Metafont, and their companion programs.
|
||||
|
||||
Other things
|
||||
* Amd: (amdref). Filesystem automounter.
|
||||
* CMUCL: (cmu-user). CMU Common Lisp.
|
||||
* File headers: (filehdr). Bibliographic information for computer files.
|
||||
* HTML: (snafu). Hypertext Markup Language 2.0 specification.
|
||||
* Jargon: (jargon). The jargon file.
|
||||
* Perl: (perl). Practical extraction and report language.
|
||||
* PRCS: (prcs). Project revision control system.
|
||||
* Screen: (screen). Virtual screen manager.
|
||||
* UMB C.S. Dept.: (csinfo). UMass/Boston Computer Science Dept. info.
|
||||
|
||||
Individual utilities
|
||||
* aid: (id-utils)aid invocation. Matching strings.
|
||||
* ar: (binutils)ar. Create/modify/extract archives.
|
||||
* at-pr: (gnats)at-pr. Bug report timely reminders.
|
||||
* autoreconf: (autoconf)Invoking autoreconf. Remake multiple configure's.
|
||||
* autoscan: (autoconf)Invoking autoscan. Automate initial configure.in.
|
||||
* awk: (Gawk)Invoking gawk. Text processing and scanning.
|
||||
* basename: (sh-utils)basename invocation. Strip directory and suffix.
|
||||
* bibtex: (web2c)BibTeX invocation. Maintaining bibliographies.
|
||||
* c++filt: (binutils)c++filt. Demangle C++ symbols.
|
||||
* cat: (textutils)cat invocation. Concatenate and write files.
|
||||
* chgrp: (fileutils)chgrp invocation. Change file groups.
|
||||
* chmod: (fileutils)chmod invocation. Change file permissions.
|
||||
* chown: (fileutils)chown invocation. Change file owners/groups.
|
||||
* chroot: (sh-utils)chroot invocation. Specify the root directory.
|
||||
* cksum: (textutils)cksum invocation. Print POSIX CRC checksum.
|
||||
* cmp: (diff)Invoking cmp. Character-by-character diff.
|
||||
* comm: (textutils)comm invocation. Compare sorted files by line.
|
||||
* cp: (fileutils)cp invocation. Copy files.
|
||||
* csplit: (textutils)csplit invocation. Split by context.
|
||||
* cut: (textutils)cut invocation. Print selected parts of lines.
|
||||
* date: (sh-utils)date invocation. Print/set system date and time.
|
||||
* dd: (fileutils)dd invocation. Copy and convert a file.
|
||||
* df: (fileutils)df invocation. Report filesystems' disk usage.
|
||||
* diff3: (diff)Invoking diff3. Three-way diff.
|
||||
* dir: (fileutils)dir invocation. List directories briefly.
|
||||
* dirname: (sh-utils)dirname invocation. Strip non-directory suffix.
|
||||
* dmp: (web2c)Dmp invocation. Troff->MPX (MetaPost pictures).
|
||||
* du: (fileutils)du invocation. Report on disk usage.
|
||||
* dvicopy: (web2c)DVIcopy invocation. Virtual font expansion
|
||||
* dvitomp: (web2c)DVItoMP invocation. DVI to MPX (MetaPost pictures).
|
||||
* dvitype: (web2c)DVItype invocation. DVI to human-readable text.
|
||||
* echo: (sh-utils)echo invocation. Print a line of text.
|
||||
* edit-pr: (gnats)Invoking edit-pr. Changing bugs.
|
||||
* eid: (id-utils)eid invocation. Invoking an editor on matches.
|
||||
* emacsclient: (emacs)Emacs Server. Connecting to a running Emacs.
|
||||
* emacsserver: (emacs)Emacs Server. Connecting to a running Emacs.
|
||||
* env: (sh-utils)env invocation. Modify the environment.
|
||||
* etags: (emacs)Create Tags Table. Creating a TAGS table.
|
||||
* expand: (textutils)expand invocation. Convert tabs to spaces.
|
||||
* expr: (sh-utils)expr invocation. Evaluate expressions.
|
||||
* false: (sh-utils)false invocation. Do nothing, unsuccessfully.
|
||||
* fid: (id-utils)fid invocation. Listing a file's identifiers.
|
||||
* file-pr: (gnats)file-pr. Processing incoming traffic.
|
||||
* find: (find)Invoking find. Finding and acting on files.
|
||||
* fmt: (textutils)fmt invocation. Reformat paragraph text.
|
||||
* fold: (textutils)fold invocation. Wrap long input lines.
|
||||
* g++: (gcc)Invoking G++. The GNU C++ compiler.
|
||||
* gftodvi: (web2c)GFtoDVI invocation. Generic font proofsheets.
|
||||
* gftopk: (web2c)GFtoPK invocation. Generic to packed fonts.
|
||||
* gftype: (web2c)GFtype invocation. GF to human-readable text.
|
||||
* gid: (id-utils)gid invocation. Listing all matching lines.
|
||||
* groups: (sh-utils)groups invocation. Print group names a user is in.
|
||||
* gunzip: (gzip)Overview. Decompression.
|
||||
* head: (textutils)head invocation. Output the first part of files.
|
||||
* hostname: (sh-utils)hostname invocation. Print or set system name.
|
||||
* id: (sh-utils)id invocation. Print real/effective uid/gid.
|
||||
* idx: (id-utils)idx invocation. Testing mkid scanners.
|
||||
* ifnames: (autoconf)Invoking ifnames. List conditionals in source.
|
||||
* iid: (id-utils)iid invocation. Interactive complex queries.
|
||||
* inimf: (web2c)inimf invocation. Initial Metafont.
|
||||
* inimp: (web2c)inimp invocation. Initial MetaPost.
|
||||
* initex: (web2c)initex invocation. Initial TeX.
|
||||
* install: (fileutils)install invocation. Copy and change attributes.
|
||||
* join: (textutils)join invocation. Join lines on a common field.
|
||||
* kpsewhich: (kpathsea)Invoking kpsewhich. TeX file searching.
|
||||
* lid: (id-utils)lid invocation. Matching identifier patterns.
|
||||
* ln: (fileutils)ln invocation. Make links between files.
|
||||
* locate: (find)Invoking locate. Finding files in a database.
|
||||
* logname: (sh-utils)logname invocation. Print current login name.
|
||||
* ls: (fileutils)ls invocation. List directory contents.
|
||||
* makempx: (web2c)MakeMPX invocation. MetaPost label typesetting.
|
||||
* maketexmf: (kpathsea)MakeTeX scripts. MF source generation.
|
||||
* maketexpk: (kpathsea)MakeTeX scripts. PK bitmap generation.
|
||||
* maketextex: (kpathsea)MakeTeX scripts. TeX source generation.
|
||||
* maketextfm: (kpathsea)MakeTeX scripts. TeX font metric generation.
|
||||
* mf: (web2c)mf invocation. Creating typeface families.
|
||||
* mft: (web2c)MFT invocation. Prettyprinting Metafont source.
|
||||
* mkdir: (fileutils)mkdir invocation. Create directories.
|
||||
* mkfifo: (fileutils)mkfifo invocation. Create FIFOs: (named pipes).
|
||||
* mkid: (id-utils)mkid invocation. Creating an ID database.
|
||||
* mknod: (fileutils)mknod invocation. Create special files.
|
||||
* mp: (web2c)mp invocation. Creating technical diagrams.
|
||||
* mpto: (web2c)MPto invocation. MetaPost label extraction.
|
||||
* mv: (fileutils)mv invocation. Rename files.
|
||||
* newer: (web2c)Newer invocation. Compare modification times.
|
||||
* nice: (sh-utils)nice invocation. Modify scheduling priority.
|
||||
* nl: (textutils)nl invocation. Number lines and write files.
|
||||
* nlmconv: (binutils)nlmconv. Convert object to NetWare LM.
|
||||
* nm: (binutils)nm. List symbols in object files.
|
||||
* nohup: (sh-utils)nohup invocation. Immunize to hangups.
|
||||
* objcopy: (binutils)objcopy. Copy/translate object files.
|
||||
* objdump: (binutils)objdump. Display info from object files.
|
||||
* od: (textutils)od invocation. Dump files in octal, etc.
|
||||
* paste: (textutils)paste invocation. Merge lines of files.
|
||||
* patch: (diff)Invoking patch. Automatically applying diffs.
|
||||
* patgen: (web2c)Patgen invocation. Creating hyphenation patterns.
|
||||
* pathchk: (sh-utils)pathchk invocation. Check file name portability.
|
||||
* pid: (id-utils)pid invocation. Looking up filenames.
|
||||
* pktogf: (web2c)PKtoGF invocation. Packed to generic fonts.
|
||||
* pktype: (web2c)PKtype invocation. PK to human-readable text.
|
||||
* pltotf: (web2c)PLtoTF invocation. Property list to TFM.
|
||||
* pooltype: (web2c)Pooltype invocation. Display WEB pool files.
|
||||
* pr-addr: (gnats)pr-addr. Bug report address retrieval.
|
||||
* pr-edit: (gnats)pr-edit. The edit-pr driver.
|
||||
* pr: (textutils)pr invocation. Paginate or columnate files.
|
||||
* printenv: (sh-utils)printenv invocation. Print environment variables.
|
||||
* printf: (sh-utils)printf invocation. Format and print data.
|
||||
* pwd: (sh-utils)pwd invocation. Print working directory.
|
||||
* query-pr: (gnats)Invoking query-pr. Bug searching/reporting.
|
||||
* queue-pr: (gnats)queue-pr. Handling incoming traffic.
|
||||
* ranlib: (binutils)ranlib. Index archive file contents.
|
||||
* rm: (fileutils)rm invocation. Remove files.
|
||||
* rmdir: (fileutils)rmdir invocation. Remove empty directories.
|
||||
* sdiff: (diff)Invoking sdiff. Interactively merge files.
|
||||
* send-pr: (gnats)Invoking send-pr. Submitting bugs.
|
||||
* shar: (sharutils)shar invocation. Create shell archive.
|
||||
* size: (binutils)size. List object file section sizes.
|
||||
* sleep: (sh-utils)sleep invocation. Delay for a specified time.
|
||||
* sort: (textutils)sort invocation. Sort text files.
|
||||
* split: (textutils)split invocation. Split into fixed-size pieces.
|
||||
* strings: (binutils)strings. List printable strings.
|
||||
* strip: (binutils)strip. Discard symbols.
|
||||
* stty: (sh-utils)stty invocation. Print/change terminal settings.
|
||||
* su: (sh-utils)su invocation. Modify user and group id.
|
||||
* sum: (textutils)sum invocation. Print traditional checksum.
|
||||
* sync: (fileutils)sync invocation. Synchronize memory and disk.
|
||||
* tabs: (tput)Invoking tabs. Tab settings.
|
||||
* tac: (textutils)tac invocation. Reverse files.
|
||||
* tail: (textutils)tail invocation. Output the last part of files.
|
||||
* tangle: (web2c)Tangle invocation. WEB to Pascal.
|
||||
* tee: (sh-utils)tee invocation. Redirect to multiple files.
|
||||
* test: (sh-utils)test invocation. File/string tests.
|
||||
* tex: (web2c)tex invocation. Typesetting.
|
||||
* tftopl: (web2c)TFtoPL invocation. TFM -> property list.
|
||||
* touch: (fileutils)touch invocation. Change file timestamps.
|
||||
* tput: (tput)Invoking tput. Termcap in shell scripts.
|
||||
* tr: (textutils)tr invocation. Translate characters.
|
||||
* true: (sh-utils)true invocation. Do nothing, successfully.
|
||||
* tty: (sh-utils)tty invocation. Print terminal name.
|
||||
* uname: (sh-utils)uname invocation. Print system information.
|
||||
* unexpand: (textutils)unexpand invocation. Convert spaces to tabs.
|
||||
* uniq: (textutils)uniq invocation. Uniqify files.
|
||||
* unshar: (sharutils)unshar invocation. Extract from shell archive.
|
||||
* updatedb: (find)Invoking updatedb. Building the locate database.
|
||||
* users: (sh-utils)users invocation. Print current user names.
|
||||
* vdir: (fileutils)vdir invocation. List directories verbosely.
|
||||
* vftovp: (web2c)VFtoVP invocation. Virtual font -> virtual pl.
|
||||
* view-pr: (gnats)Invoking view-pr. Showing bug reports.
|
||||
* virmf: (web2c)virmf invocation. Virgin Metafont.
|
||||
* virmp: (web2c)virmp invocation. Virgin MetaPost.
|
||||
* virtex: (web2c)virtex invocation. Virgin TeX.
|
||||
* vptovf: (web2c)VPtoVF invocation. Virtual pl -> virtual font.
|
||||
* wc: (textutils)wc invocation. Byte, word, and line counts.
|
||||
* weave: (web2c)Weave invocation. WEB to TeX.
|
||||
* who: (sh-utils)who invocation. Print who is logged in.
|
||||
* whoami: (sh-utils)whoami invocation. Print effective user id.
|
||||
* xargs: (find)Invoking xargs. Operating on many files.
|
||||
* yes: (sh-utils)yes invocation. Print a string indefinitely.
|
||||
* zcat: (gzip)Overview. Decompression to stdout.
|
||||
@@ -1,88 +0,0 @@
|
||||
# Makefile for Texinfo/emacs.
|
||||
# Copyright (C) 1995, 96 Free Software Foundation, Inc.
|
||||
# $Id: Makefile.in,v 1.4 1996/09/28 21:34:34 karl Exp $
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# Author: Brian J. Fox ([email protected])
|
||||
#
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = $(srcdir)
|
||||
SHELL = /bin/sh
|
||||
RM = rm -f
|
||||
|
||||
|
||||
ELISP_SRCS = info.el makeinfo.el texinfo.el texnfo-upd.el \
|
||||
texnfo-tex.el texinfmt.el informat.el detexinfo.el
|
||||
ELISP_OBJS = info.elc makeinfo.elc texinfo.elc texnfo-upd.elc \
|
||||
texnfo-tex.elc texinfmt.elc informat.elc detexinfo.elc
|
||||
|
||||
.SUFFIXES: .el .elc
|
||||
|
||||
.el.elc:
|
||||
$(srcdir)/elisp-comp $<
|
||||
|
||||
all:
|
||||
sub-all: all
|
||||
|
||||
elisp: $(ELISP_OBJS)
|
||||
.PHONY: elisp
|
||||
|
||||
# Nobody likes any of these install targets. Fine. Install it
|
||||
# manually, then.
|
||||
install:
|
||||
@echo Please install the Emacs Lisp files manually.
|
||||
|
||||
uninstall:
|
||||
@echo Please uninstall the Emacs Lisp files manually.
|
||||
|
||||
# install: $(ELISP_OBJS)
|
||||
# @(echo "(print (car load-path))" >/tmp/elc.$$$$; \
|
||||
# lispdir=`emacs -batch -q -l /tmp/elc.$$$$ -nw | grep site-lisp`; \
|
||||
# rm /tmp/elc.$$$$; \
|
||||
# if [ "$$lispdir" != "" ]; then \
|
||||
# lispdir=`echo $$lispdir | sed -e 's/"//g'`; \
|
||||
# echo "Installing .elc files in $$lispdir."; \
|
||||
# $(CP) $(ELISP_OBJS) $$lispdir; \
|
||||
# else \
|
||||
# echo "To install the elisp files, please copy *.elc to the"; \
|
||||
# echo "emacs site-lisp directory."; \
|
||||
# fi)
|
||||
#
|
||||
# install: $(ELISP_OBJS)
|
||||
# for file in $(ELISP_OBJS); do \
|
||||
# $(INSTALL_DATA) $$file $(lispdir); \
|
||||
# done
|
||||
#
|
||||
# uninstall: $(ELISP_OBJS)
|
||||
# cd $(lispdir) && rm -f $(ELISP_OBJS)
|
||||
#
|
||||
informat.elc: info.elc
|
||||
makeinfo.elc: texinfo.elc
|
||||
texinfmt.elc: texinfo.elc
|
||||
texinfmt.elc: texnfo-upd.elc
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in ../config.status
|
||||
cd .. && sh config.status
|
||||
|
||||
realclean distclean: clean
|
||||
$(RM) Makefile *.log
|
||||
|
||||
clean: FORCE
|
||||
$(RM) *.elc
|
||||
|
||||
FORCE:
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
;;; Here is a handy keybinding:
|
||||
|
||||
(global-set-key "\C-x\\" 'detexinfo)
|
||||
|
||||
;;;;;;;;;;;;;;;; detexinfo.el ;;;;;;;;;;;;;;;;
|
||||
;;;
|
||||
;;; Remove Texinfo commands from a Texinfo source file.
|
||||
;;;
|
||||
;;; Copyright (C) 1991, 1992 Free Software Foundation
|
||||
;;; Robert J. Chassell
|
||||
;;; bugs to [email protected]
|
||||
;;;
|
||||
;;; ==> test version <==
|
||||
;;; Fails if Texinfo source file contains formatting errors.
|
||||
;;;
|
||||
;;; Version 0.05 - 3 Jun 1992
|
||||
;;; Add to list of removed commands. Improve messages.
|
||||
;;;
|
||||
;;; Version 0.04 - 27 Jan 1992
|
||||
;;; Rewrite to insert detexinfo'd text into a temporary buffer.
|
||||
;;;
|
||||
;;; Version 0.03 - 27 Dec 1991
|
||||
;;; Improved messages.
|
||||
;;;
|
||||
;;; Version 0.02 - 13 Nov 1991
|
||||
;;; detexinfo-remove-inline-cmd, detexinfo-syntax-table: Handle
|
||||
;;; nested commands.
|
||||
;;; detexinfo: Handle nested @'s, eg @samp{@}} and @samp{@@};
|
||||
;;; replace @TeX{} with TeX.
|
||||
;;;
|
||||
;;; Version 0.01 - 13 Nov 1991
|
||||
;;;
|
||||
;;; Based on detex.el, by Bengt Martensson, 4 Oct 1987
|
||||
;;;
|
||||
;;;;;;;;;;;;;;;;
|
||||
|
||||
(defvar detexinfo-buffer-name "*detexinfo*"
|
||||
"*Name of the temporary buffer used by \\[detexinfo].")
|
||||
|
||||
(defvar detexinfo-syntax-table nil)
|
||||
|
||||
(if detexinfo-syntax-table
|
||||
nil
|
||||
(setq detexinfo-syntax-table (make-syntax-table))
|
||||
(modify-syntax-entry ?\[ "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?\] "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?\" "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?\\ "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?\( "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?\) "." detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?{ "(}" detexinfo-syntax-table)
|
||||
(modify-syntax-entry ?} "){" detexinfo-syntax-table))
|
||||
|
||||
(defun detexinfo ()
|
||||
"Remove Texinfo commands from current buffer, copying result to new buffer.
|
||||
BUG: Fails if Texinfo source file contains formatting errors."
|
||||
(interactive)
|
||||
(let ((input-buffer (current-buffer)))
|
||||
;; Find a buffer to use.
|
||||
(switch-to-buffer (get-buffer-create detexinfo-buffer-name))
|
||||
(setq major-mode 'detexinfo-mode)
|
||||
(set-syntax-table detexinfo-syntax-table)
|
||||
(erase-buffer)
|
||||
(insert-buffer-substring input-buffer)
|
||||
|
||||
;; Replace @{ and @} with %#* and *#% temporarily, so @samp{@{} works.
|
||||
;; What is a better way of doing this??
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "@{" nil t) ; e.g., @samp{@{}
|
||||
(replace-match "%#*"))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "@}" nil t)
|
||||
(forward-char -3) ; e.g., @samp{@@}
|
||||
(if (looking-at "@") ; Two @@ in a row
|
||||
(progn
|
||||
(delete-char 2)
|
||||
(insert "%&%#"))
|
||||
(forward-char 1)
|
||||
(delete-char 2)
|
||||
(insert "*#%")))
|
||||
|
||||
(goto-char (point-min))
|
||||
;; Remove @refill, the only inline command without braces.
|
||||
(while (search-forward "@refill" nil t)
|
||||
(replace-match ""))
|
||||
;; Replace @TeX{} with TeX
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "@TeX{}" nil t) (replace-match "TeX" t t))
|
||||
|
||||
(detexinfo-remove-line-cmds-without-arg)
|
||||
(detexinfo-remove-inline-cmds-without-arg)
|
||||
(detexinfo-remove-inline-cmds-keep-arg)
|
||||
(detexinfo-remove-line-cmds-deletable-arg)
|
||||
(detexinfo-remove-line-cmds-maybe-delete-arg)
|
||||
(detexinfo-remove-line-cmds-keep-arg)
|
||||
|
||||
;; Now replace %#*, *#%, and %&%# with {, }, and @@.
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "%#*" nil t)
|
||||
(replace-match "{"))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "*#%" nil t)
|
||||
(replace-match "}"))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "%&%#" nil t)
|
||||
(replace-match "@@"))
|
||||
|
||||
;; Scan for remaining two character @-commands
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "@" nil t)
|
||||
(cond ((looking-at "[*:]")
|
||||
(delete-region (1- (point)) (1+ (point))))
|
||||
((looking-at "[{}^@.'`]\"?!")
|
||||
(delete-region (1- (point)) (point)))))
|
||||
|
||||
(goto-char (point-min))
|
||||
(message "Done...removed Texinfo commands from buffer. You may save it.")))
|
||||
|
||||
(defun detexinfo-remove-whole-line (cmd)
|
||||
"Delete Texinfo line command CMD at beginning of line and rest of line."
|
||||
(goto-char (point-min))
|
||||
(while
|
||||
(re-search-forward
|
||||
(concat "^@" cmd "[ \n]+") (point-max) t)
|
||||
(goto-char (match-beginning 0))
|
||||
(delete-region
|
||||
(point) (save-excursion (end-of-line) (1+ (point))))))
|
||||
|
||||
(defun detexinfo-remove-inline-cmd (cmd)
|
||||
"Delete Texinfo inline command CMD, eg. @point, @code."
|
||||
(goto-char (point-min))
|
||||
(while
|
||||
(re-search-forward (concat "@" cmd "{") (point-max) t)
|
||||
(save-excursion
|
||||
(forward-char -1)
|
||||
(forward-sexp 1)
|
||||
(delete-char -1)) ; delete right brace
|
||||
(delete-region (point) (match-beginning 0))))
|
||||
|
||||
;;;;;;;;;;;;;;;;
|
||||
|
||||
;;; 1. @setfilename and other line commands with args to delete
|
||||
|
||||
(defvar detexinfo-line-cmds-deletable-arg
|
||||
'("enumerate" "ftable" "vtable" "itemize" "table"
|
||||
"setfilename" "settitle" "setchapternewpage"
|
||||
"footnotestyle" "paragraphindent"
|
||||
"include" "need" "sp"
|
||||
"clear" "ifclear" "ifset" "set"
|
||||
"defcodeindex" "defindex" "syncodeindex" "synindex")
|
||||
"List of Texinfo commands whose arguments should be deleted.")
|
||||
|
||||
(defun detexinfo-remove-line-cmds-deletable-arg ()
|
||||
"Delete Texinfo line commands together with their args, eg @setfilename."
|
||||
(message "Removing commands such as @enumerate...with their arguments...")
|
||||
(mapcar 'detexinfo-remove-whole-line
|
||||
detexinfo-line-cmds-deletable-arg))
|
||||
|
||||
;;; 2. @cindex and other cmds with args that may be deleted
|
||||
;;; This list is here just to make it easier to revise the
|
||||
;;; categories. In particular, you might want to keep the index entries.
|
||||
|
||||
(defvar detexinfo-line-cmds-maybe-delete-arg
|
||||
'("cindex" "findex" "kindex" "pindex" "tindex" "vindex" "node"
|
||||
"c" "comment" "end" "headings" "printindex" "vskip"
|
||||
"evenfooting" "evenheading" "everyfooting" "everyheading"
|
||||
"oddfooting" "oddheading")
|
||||
"List of Texinfo commands whose arguments may possibly be deleted.")
|
||||
|
||||
(defun detexinfo-remove-line-cmds-maybe-delete-arg ()
|
||||
"Delete Texinfo line commands together with their arguments, eg, @cindex."
|
||||
(message "Removing commands such as @cindex...with their arguments...")
|
||||
(mapcar 'detexinfo-remove-whole-line
|
||||
detexinfo-line-cmds-maybe-delete-arg))
|
||||
|
||||
;;; 3. @chapter and other line cmds with args to keep.
|
||||
|
||||
(defvar detexinfo-line-cmds-keep-arg
|
||||
'("top" "chapter" "section" "subsection" "subsubsection"
|
||||
"unnumbered" "unnumberedsec" "unnumberedsubsec" "unnumberedsubsubsec"
|
||||
"majorheading" "chapheading" "heading" "subheading" "subsubheading"
|
||||
"appendix" "appendixsec" "appendixsubsec" "appendixsubsubsec"
|
||||
"item" "itemx"
|
||||
"title" "subtitle" "center" "author" "exdent"
|
||||
"defcv" "deffn" "defivar" "defmac" "defmethod" "defop" "defopt"
|
||||
"defspec" "deftp" "deftypefn" "deftypefun" "deftypvr"
|
||||
"deftypevar" "defun" "defvar" "defvr")
|
||||
"List of Texinfo line commands whose arguments should be kept.")
|
||||
|
||||
(defun detexinfo-remove-line-cmds-keep-arg ()
|
||||
"Delete Texinfo line commands but keep their arguments, eg @chapter."
|
||||
(message "Removing commands such as @chapter...but not their arguments...")
|
||||
(mapcar 'detexinfo-remove-line-cmd-keep-arg
|
||||
detexinfo-line-cmds-keep-arg))
|
||||
|
||||
(defun detexinfo-remove-line-cmd-keep-arg (cmd)
|
||||
"Delete Texinfo line command CMD but keep its argument, eg @chapter."
|
||||
(goto-char (point-min))
|
||||
(while
|
||||
(re-search-forward
|
||||
(concat "^@" cmd "[ \n]+") (point-max) t)
|
||||
(delete-region (match-beginning 0) (match-end 0))))
|
||||
|
||||
;;; 4. @bye and other line commands without args.
|
||||
|
||||
(defvar detexinfo-line-cmds-without-arg
|
||||
'("bye" "contents" "display" "example" "finalout"
|
||||
"flushleft" "flushright" "format" "group" "ifhtml" "ifinfo" "iftex"
|
||||
"ignore" "lisp" "menu" "noindent" "page" "quotation"
|
||||
"shortcontents" "smallbook" "smallexample" "smalllisp"
|
||||
"summarycontents" "tex" "thischapter" "thischaptername"
|
||||
"thisfile" "thispage" "thissection" "thistitle" "titlepage")
|
||||
"List of Texinfo commands without arguments that should be deleted.")
|
||||
|
||||
(defun detexinfo-remove-line-cmds-without-arg ()
|
||||
"Delete line Texinfo commands that lack args, eg. @example."
|
||||
(message "Removing commands such as @example...that lack arguments...")
|
||||
(mapcar 'detexinfo-remove-whole-line
|
||||
detexinfo-line-cmds-without-arg))
|
||||
|
||||
;;; 5. @equiv and other inline cmds without args.
|
||||
|
||||
(defvar detexinfo-inline-cmds-without-arg
|
||||
'("equiv" "error" "expansion" "point" "print" "result"
|
||||
"asis" "br" "bullet" "dots" "minus" "today")
|
||||
"List of Texinfo inline commands without arguments that should be deleted.")
|
||||
|
||||
(defun detexinfo-remove-inline-cmds-without-arg ()
|
||||
"Delete Texinfo inline commands in that lack arguments."
|
||||
(message "Removing within line commands such as @result...")
|
||||
(mapcar 'detexinfo-remove-inline-cmd
|
||||
detexinfo-inline-cmds-without-arg))
|
||||
|
||||
;;; 6. @code and other inline cmds with args to keep
|
||||
|
||||
(defvar detexinfo-inline-cmds-keep-arg
|
||||
'("b" "cartouche" "cite" "code" "copyright" "ctrl" "dfn" "dmn"
|
||||
"emph" "file" "footnote" "i" "inforef"
|
||||
"kbd" "key" "pxref" "r" "ref" "samp" "sc" "titlefont"
|
||||
"strong" "t" "var" "w" "xref")
|
||||
"List of Texinfo inline commands with arguments that should be kept.")
|
||||
|
||||
(defun detexinfo-remove-inline-cmds-keep-arg ()
|
||||
"Delete Texinfo inline commands but keep its arg, eg. @code."
|
||||
(message
|
||||
"Removing within line commands such as @code...but not their arguments...")
|
||||
(mapcar 'detexinfo-remove-inline-cmd
|
||||
detexinfo-inline-cmds-keep-arg))
|
||||
|
||||
;;;;;;;;;;;;;;;; end detexinfo.el ;;;;;;;;;;;;;;;;
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
# $Id: elisp-comp,v 1.2 1996/09/26 23:41:08 karl Exp $
|
||||
# Trivial script to compile the Elisp files.
|
||||
setpath=${TMPDIR-/tmp}/elc.$$
|
||||
echo "(setq load-path (cons nil load-path))" > $setpath
|
||||
emacs -batch -l $setpath -f batch-byte-compile "$@"
|
||||
rm -f $setpath
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,429 +0,0 @@
|
||||
;;; informat.el --- info support functions package for Emacs
|
||||
|
||||
;; Copyright (C) 1986 Free Software Foundation, Inc.
|
||||
|
||||
;; Maintainer: FSF
|
||||
;; Keywords: help
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
||||
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'info)
|
||||
|
||||
;;;###autoload
|
||||
(defun Info-tagify ()
|
||||
"Create or update Info-file tag table in current buffer."
|
||||
(interactive)
|
||||
;; Save and restore point and restrictions.
|
||||
;; save-restrictions would not work
|
||||
;; because it records the old max relative to the end.
|
||||
;; We record it relative to the beginning.
|
||||
(message "Tagifying %s ..." (file-name-nondirectory (buffer-file-name)))
|
||||
(let ((omin (point-min))
|
||||
(omax (point-max))
|
||||
(nomax (= (point-max) (1+ (buffer-size))))
|
||||
(opoint (point)))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(if (search-forward "\^_\nIndirect:\n" nil t)
|
||||
(message "Cannot tagify split info file")
|
||||
(let ((regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
|
||||
(case-fold-search t)
|
||||
list)
|
||||
(while (search-forward "\n\^_" nil t)
|
||||
;; We want the 0-origin character position of the ^_.
|
||||
;; That is the same as the Emacs (1-origin) position
|
||||
;; of the newline before it.
|
||||
(let ((beg (match-beginning 0)))
|
||||
(forward-line 2)
|
||||
(if (re-search-backward regexp beg t)
|
||||
(setq list
|
||||
(cons (list (buffer-substring-no-properties
|
||||
(match-beginning 1)
|
||||
(match-end 1))
|
||||
beg)
|
||||
list)))))
|
||||
(goto-char (point-max))
|
||||
(forward-line -8)
|
||||
(let ((buffer-read-only nil))
|
||||
(if (search-forward "\^_\nEnd tag table\n" nil t)
|
||||
(let ((end (point)))
|
||||
(search-backward "\nTag table:\n")
|
||||
(beginning-of-line)
|
||||
(delete-region (point) end)))
|
||||
(goto-char (point-max))
|
||||
(insert "\^_\f\nTag table:\n")
|
||||
(move-marker Info-tag-table-marker (point))
|
||||
(setq list (nreverse list))
|
||||
(while list
|
||||
(insert "Node: " (car (car list)) ?\177)
|
||||
(princ (car (cdr (car list))) (current-buffer))
|
||||
(insert ?\n)
|
||||
(setq list (cdr list)))
|
||||
(insert "\^_\nEnd tag table\n")))))
|
||||
(goto-char opoint)
|
||||
(narrow-to-region omin (if nomax (1+ (buffer-size))
|
||||
(min omax (point-max))))))
|
||||
(message "Tagifying %s ... done" (file-name-nondirectory (buffer-file-name))))
|
||||
|
||||
;;;###autoload
|
||||
(defun Info-split ()
|
||||
"Split an info file into an indirect file plus bounded-size subfiles.
|
||||
Each subfile will be up to 50,000 characters plus one node.
|
||||
|
||||
To use this command, first visit a large Info file that has a tag
|
||||
table. The buffer is modified into a (small) indirect info file which
|
||||
should be saved in place of the original visited file.
|
||||
|
||||
The subfiles are written in the same directory the original file is
|
||||
in, with names generated by appending `-' and a number to the original
|
||||
file name. The indirect file still functions as an Info file, but it
|
||||
contains just the tag table and a directory of subfiles."
|
||||
|
||||
(interactive)
|
||||
(if (< (buffer-size) 70000)
|
||||
(error "This is too small to be worth splitting"))
|
||||
(goto-char (point-min))
|
||||
(search-forward "\^_")
|
||||
(forward-char -1)
|
||||
(let ((start (point))
|
||||
(chars-deleted 0)
|
||||
subfiles
|
||||
(subfile-number 1)
|
||||
(case-fold-search t)
|
||||
(filename (file-name-sans-versions buffer-file-name)))
|
||||
(goto-char (point-max))
|
||||
(forward-line -8)
|
||||
(setq buffer-read-only nil)
|
||||
(or (search-forward "\^_\nEnd tag table\n" nil t)
|
||||
(error "Tag table required; use M-x Info-tagify"))
|
||||
(search-backward "\nTag table:\n")
|
||||
(if (looking-at "\nTag table:\n\^_")
|
||||
(error "Tag table is just a skeleton; use M-x Info-tagify"))
|
||||
(beginning-of-line)
|
||||
(forward-char 1)
|
||||
(save-restriction
|
||||
(narrow-to-region (point-min) (point))
|
||||
(goto-char (point-min))
|
||||
(while (< (1+ (point)) (point-max))
|
||||
(goto-char (min (+ (point) 50000) (point-max)))
|
||||
(search-forward "\^_" nil 'move)
|
||||
(setq subfiles
|
||||
(cons (list (+ start chars-deleted)
|
||||
(concat (file-name-nondirectory filename)
|
||||
(format "-%d" subfile-number)))
|
||||
subfiles))
|
||||
;; Put a newline at end of split file, to make Unix happier.
|
||||
(insert "\n")
|
||||
(write-region (point-min) (point)
|
||||
(concat filename (format "-%d" subfile-number)))
|
||||
(delete-region (1- (point)) (point))
|
||||
;; Back up over the final ^_.
|
||||
(forward-char -1)
|
||||
(setq chars-deleted (+ chars-deleted (- (point) start)))
|
||||
(delete-region start (point))
|
||||
(setq subfile-number (1+ subfile-number))))
|
||||
(while subfiles
|
||||
(goto-char start)
|
||||
(insert (nth 1 (car subfiles))
|
||||
(format ": %d" (1- (car (car subfiles))))
|
||||
"\n")
|
||||
(setq subfiles (cdr subfiles)))
|
||||
(goto-char start)
|
||||
(insert "\^_\nIndirect:\n")
|
||||
(search-forward "\nTag Table:\n")
|
||||
(insert "(Indirect)\n")))
|
||||
|
||||
;;;###autoload
|
||||
(defun Info-validate ()
|
||||
"Check current buffer for validity as an Info file.
|
||||
Check that every node pointer points to an existing node."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(if (search-forward "\nTag table:\n(Indirect)\n" nil t)
|
||||
(error "Don't yet know how to validate indirect info files: \"%s\""
|
||||
(buffer-name (current-buffer))))
|
||||
(goto-char (point-min))
|
||||
(let ((allnodes '(("*")))
|
||||
(regexp "Node:[ \t]*\\([^,\n\t]*\\)[,\t\n]")
|
||||
(case-fold-search t)
|
||||
(tags-losing nil)
|
||||
(lossages ()))
|
||||
(while (search-forward "\n\^_" nil t)
|
||||
(forward-line 1)
|
||||
(let ((beg (point)))
|
||||
(forward-line 1)
|
||||
(if (re-search-backward regexp beg t)
|
||||
(let ((name (downcase
|
||||
(buffer-substring-no-properties
|
||||
(match-beginning 1)
|
||||
(progn
|
||||
(goto-char (match-end 1))
|
||||
(skip-chars-backward " \t")
|
||||
(point))))))
|
||||
(if (assoc name allnodes)
|
||||
(setq lossages
|
||||
(cons (list name "Duplicate node-name" nil)
|
||||
lossages))
|
||||
(setq allnodes
|
||||
(cons (list name
|
||||
(progn
|
||||
(end-of-line)
|
||||
(and (re-search-backward
|
||||
"prev[ious]*:" beg t)
|
||||
(progn
|
||||
(goto-char (match-end 0))
|
||||
(downcase
|
||||
(Info-following-node-name)))))
|
||||
beg)
|
||||
allnodes)))))))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "\n\^_" nil t)
|
||||
(forward-line 1)
|
||||
(let ((beg (point))
|
||||
thisnode next)
|
||||
(forward-line 1)
|
||||
(if (re-search-backward regexp beg t)
|
||||
(save-restriction
|
||||
(search-forward "\n\^_" nil 'move)
|
||||
(narrow-to-region beg (point))
|
||||
(setq thisnode (downcase
|
||||
(buffer-substring-no-properties
|
||||
(match-beginning 1)
|
||||
(progn
|
||||
(goto-char (match-end 1))
|
||||
(skip-chars-backward " \t")
|
||||
(point)))))
|
||||
(end-of-line)
|
||||
(and (search-backward "next:" nil t)
|
||||
(setq next (Info-validate-node-name "invalid Next"))
|
||||
(assoc next allnodes)
|
||||
(if (equal (car (cdr (assoc next allnodes)))
|
||||
thisnode)
|
||||
;; allow multiple `next' pointers to one node
|
||||
(let ((tem lossages))
|
||||
(while tem
|
||||
(if (and (equal (car (cdr (car tem)))
|
||||
"should have Previous")
|
||||
(equal (car (car tem))
|
||||
next))
|
||||
(setq lossages (delq (car tem) lossages)))
|
||||
(setq tem (cdr tem))))
|
||||
(setq lossages
|
||||
(cons (list next
|
||||
"should have Previous"
|
||||
thisnode)
|
||||
lossages))))
|
||||
(end-of-line)
|
||||
(if (re-search-backward "prev[ious]*:" nil t)
|
||||
(Info-validate-node-name "invalid Previous"))
|
||||
(end-of-line)
|
||||
(if (search-backward "up:" nil t)
|
||||
(Info-validate-node-name "invalid Up"))
|
||||
(if (re-search-forward "\n* Menu:" nil t)
|
||||
(while (re-search-forward "\n\\* " nil t)
|
||||
(Info-validate-node-name
|
||||
(concat "invalid menu item "
|
||||
(buffer-substring (point)
|
||||
(save-excursion
|
||||
(skip-chars-forward "^:")
|
||||
(point))))
|
||||
(Info-extract-menu-node-name))))
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "\\*note[ \n]*[^:\t]*:" nil t)
|
||||
(goto-char (+ (match-beginning 0) 5))
|
||||
(skip-chars-forward " \n")
|
||||
(Info-validate-node-name
|
||||
(concat "invalid reference "
|
||||
(buffer-substring (point)
|
||||
(save-excursion
|
||||
(skip-chars-forward "^:")
|
||||
(point))))
|
||||
(Info-extract-menu-node-name "Bad format cross-reference")))))))
|
||||
(setq tags-losing (not (Info-validate-tags-table)))
|
||||
(if (or lossages tags-losing)
|
||||
(with-output-to-temp-buffer " *problems in info file*"
|
||||
(while lossages
|
||||
(princ "In node \"")
|
||||
(princ (car (car lossages)))
|
||||
(princ "\", ")
|
||||
(let ((tem (nth 1 (car lossages))))
|
||||
(cond ((string-match "\n" tem)
|
||||
(princ (substring tem 0 (match-beginning 0)))
|
||||
(princ "..."))
|
||||
(t
|
||||
(princ tem))))
|
||||
(if (nth 2 (car lossages))
|
||||
(progn
|
||||
(princ ": ")
|
||||
(let ((tem (nth 2 (car lossages))))
|
||||
(cond ((string-match "\n" tem)
|
||||
(princ (substring tem 0 (match-beginning 0)))
|
||||
(princ "..."))
|
||||
(t
|
||||
(princ tem))))))
|
||||
(terpri)
|
||||
(setq lossages (cdr lossages)))
|
||||
(if tags-losing (princ "\nTags table must be recomputed\n")))
|
||||
;; Here if info file is valid.
|
||||
;; If we already made a list of problems, clear it out.
|
||||
(save-excursion
|
||||
(if (get-buffer " *problems in info file*")
|
||||
(progn
|
||||
(set-buffer " *problems in info file*")
|
||||
(kill-buffer (current-buffer)))))
|
||||
(message "File appears valid"))))))
|
||||
|
||||
(defun Info-validate-node-name (kind &optional name)
|
||||
(if name
|
||||
nil
|
||||
(goto-char (match-end 0))
|
||||
(skip-chars-forward " \t")
|
||||
(if (= (following-char) ?\()
|
||||
nil
|
||||
(setq name
|
||||
(buffer-substring-no-properties
|
||||
(point)
|
||||
(progn
|
||||
(skip-chars-forward "^,\t\n")
|
||||
(skip-chars-backward " ")
|
||||
(point))))))
|
||||
(if (null name)
|
||||
nil
|
||||
(setq name (downcase name))
|
||||
(or (and (> (length name) 0) (= (aref name 0) ?\())
|
||||
(assoc name allnodes)
|
||||
(setq lossages
|
||||
(cons (list thisnode kind name) lossages))))
|
||||
name)
|
||||
|
||||
(defun Info-validate-tags-table ()
|
||||
(goto-char (point-min))
|
||||
(if (not (search-forward "\^_\nEnd tag table\n" nil t))
|
||||
t
|
||||
(not (catch 'losing
|
||||
(let* ((end (match-beginning 0))
|
||||
(start (progn (search-backward "\nTag table:\n")
|
||||
(1- (match-end 0))))
|
||||
tem)
|
||||
(setq tem allnodes)
|
||||
(while tem
|
||||
(goto-char start)
|
||||
(or (equal (car (car tem)) "*")
|
||||
(search-forward (concat "Node: "
|
||||
(car (car tem))
|
||||
"\177")
|
||||
end t)
|
||||
(throw 'losing 'x))
|
||||
(setq tem (cdr tem)))
|
||||
(goto-char (1+ start))
|
||||
(while (looking-at ".*Node: \\(.*\\)\177\\([0-9]+\\)$")
|
||||
(setq tem (downcase (buffer-substring-no-properties
|
||||
(match-beginning 1)
|
||||
(match-end 1))))
|
||||
(setq tem (assoc tem allnodes))
|
||||
(if (or (not tem)
|
||||
(< 1000 (progn
|
||||
(goto-char (match-beginning 2))
|
||||
(setq tem (- (car (cdr (cdr tem)))
|
||||
(read (current-buffer))))
|
||||
(if (> tem 0) tem (- tem)))))
|
||||
(throw 'losing 'y))
|
||||
(forward-line 1)))
|
||||
(if (looking-at "\^_\n")
|
||||
(forward-line 1))
|
||||
(or (looking-at "End tag table\n")
|
||||
(throw 'losing 'z))
|
||||
nil))))
|
||||
|
||||
;;;###autoload
|
||||
(defun batch-info-validate ()
|
||||
"Runs `Info-validate' on the files remaining on the command line.
|
||||
Must be used only with -batch, and kills Emacs on completion.
|
||||
Each file will be processed even if an error occurred previously.
|
||||
For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\""
|
||||
(if (not noninteractive)
|
||||
(error "batch-info-validate may only be used -batch."))
|
||||
(let ((version-control t)
|
||||
(auto-save-default nil)
|
||||
(find-file-run-dired nil)
|
||||
(kept-old-versions 259259)
|
||||
(kept-new-versions 259259))
|
||||
(let ((error 0)
|
||||
file
|
||||
(files ()))
|
||||
(while command-line-args-left
|
||||
(setq file (expand-file-name (car command-line-args-left)))
|
||||
(cond ((not (file-exists-p file))
|
||||
(message ">> %s does not exist!" file)
|
||||
(setq error 1
|
||||
command-line-args-left (cdr command-line-args-left)))
|
||||
((file-directory-p file)
|
||||
(setq command-line-args-left (nconc (directory-files file)
|
||||
(cdr command-line-args-left))))
|
||||
(t
|
||||
(setq files (cons file files)
|
||||
command-line-args-left (cdr command-line-args-left)))))
|
||||
(while files
|
||||
(setq file (car files)
|
||||
files (cdr files))
|
||||
(let ((lose nil))
|
||||
(condition-case err
|
||||
(progn
|
||||
(if buffer-file-name (kill-buffer (current-buffer)))
|
||||
(find-file file)
|
||||
(buffer-disable-undo (current-buffer))
|
||||
(set-buffer-modified-p nil)
|
||||
(fundamental-mode)
|
||||
(let ((case-fold-search nil))
|
||||
(goto-char (point-max))
|
||||
(cond ((search-backward "\n\^_\^L\nTag table:\n" nil t)
|
||||
(message "%s already tagified" file))
|
||||
((< (point-max) 30000)
|
||||
(message "%s too small to bother tagifying" file))
|
||||
(t
|
||||
(Info-tagify))))
|
||||
(let ((loss-name " *problems in info file*"))
|
||||
(message "Checking validity of info file %s..." file)
|
||||
(if (get-buffer loss-name)
|
||||
(kill-buffer loss-name))
|
||||
(Info-validate)
|
||||
(if (not (get-buffer loss-name))
|
||||
nil ;(message "Checking validity of info file %s... OK" file)
|
||||
(message "----------------------------------------------------------------------")
|
||||
(message ">> PROBLEMS IN INFO FILE %s" file)
|
||||
(save-excursion
|
||||
(set-buffer loss-name)
|
||||
(princ (buffer-substring-no-properties
|
||||
(point-min) (point-max))))
|
||||
(message "----------------------------------------------------------------------")
|
||||
(setq error 1 lose t)))
|
||||
(if (and (buffer-modified-p)
|
||||
(not lose))
|
||||
(progn (message "Saving modified %s" file)
|
||||
(save-buffer))))
|
||||
(error (message ">> Error: %s" (prin1-to-string err))))))
|
||||
(kill-emacs error))))
|
||||
|
||||
;;; informat.el ends here
|
||||
@@ -1,247 +0,0 @@
|
||||
;;; makeinfo.el --- run makeinfo conveniently
|
||||
|
||||
;; Copyright (C) 1991, 1993 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Robert J. Chassell
|
||||
;; Maintainer: FSF
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
||||
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; The Texinfo mode `makeinfo' related commands are:
|
||||
|
||||
;; makeinfo-region to run makeinfo on the current region.
|
||||
;; makeinfo-buffer to run makeinfo on the current buffer, or
|
||||
;; with optional prefix arg, on current region
|
||||
;; kill-compilation to kill currently running makeinfo job
|
||||
;; makeinfo-recenter-makeinfo-buffer to redisplay *compilation* buffer
|
||||
|
||||
;;; Keybindings (defined in `texinfo.el')
|
||||
|
||||
;; makeinfo bindings
|
||||
; (define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region)
|
||||
; (define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer)
|
||||
; (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation)
|
||||
; (define-key texinfo-mode-map "\C-c\C-m\C-l"
|
||||
; 'makeinfo-recenter-compilation-buffer)
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Variables used by `makeinfo'
|
||||
|
||||
(require 'compile)
|
||||
|
||||
(defvar makeinfo-run-command "makeinfo"
|
||||
"*Command used to run `makeinfo' subjob.
|
||||
The name of the file is appended to this string, separated by a space.")
|
||||
|
||||
(defvar makeinfo-options "--fill-column=70"
|
||||
"*String containing options for running `makeinfo'.
|
||||
Do not include `--footnote-style' or `--paragraph-indent';
|
||||
the proper way to specify those is with the Texinfo commands
|
||||
`@footnotestyle` and `@paragraphindent'.")
|
||||
|
||||
(require 'texinfo)
|
||||
|
||||
(defvar makeinfo-compilation-process nil
|
||||
"Process that runs `makeinfo'. Should start out nil.")
|
||||
|
||||
(defvar makeinfo-temp-file nil
|
||||
"Temporary file name used for text being sent as input to `makeinfo'.")
|
||||
|
||||
(defvar makeinfo-output-file-name nil
|
||||
"Info file name used for text output by `makeinfo'.")
|
||||
|
||||
|
||||
;;; The `makeinfo' function definitions
|
||||
|
||||
(defun makeinfo-region (region-beginning region-end)
|
||||
"Make Info file from region of current Texinfo file, and switch to it.
|
||||
|
||||
This command does not offer the `next-error' feature since it would
|
||||
apply to a temporary file, not the original; use the `makeinfo-buffer'
|
||||
command to gain use of `next-error'."
|
||||
|
||||
(interactive "r")
|
||||
(let (filename-or-header
|
||||
filename-or-header-beginning
|
||||
filename-or-header-end)
|
||||
;; Cannot use `let' for makeinfo-temp-file or
|
||||
;; makeinfo-output-file-name since `makeinfo-compilation-sentinel'
|
||||
;; needs them.
|
||||
|
||||
(setq makeinfo-temp-file
|
||||
(concat
|
||||
(make-temp-name
|
||||
(substring (buffer-file-name)
|
||||
0
|
||||
(or (string-match "\\.tex" (buffer-file-name))
|
||||
(length (buffer-file-name)))))
|
||||
".texinfo"))
|
||||
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(let ((search-end (save-excursion (forward-line 100) (point))))
|
||||
;; Find and record the Info filename,
|
||||
;; or else explain that a filename is needed.
|
||||
(if (re-search-forward
|
||||
"^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
|
||||
search-end t)
|
||||
(setq makeinfo-output-file-name
|
||||
(buffer-substring (match-beginning 1) (match-end 1)))
|
||||
(error
|
||||
"The texinfo file needs a line saying: @setfilename <name>"))
|
||||
|
||||
;; Find header and specify its beginning and end.
|
||||
(goto-char (point-min))
|
||||
(if (and
|
||||
(prog1
|
||||
(search-forward tex-start-of-header search-end t)
|
||||
(beginning-of-line)
|
||||
;; Mark beginning of header.
|
||||
(setq filename-or-header-beginning (point)))
|
||||
(prog1
|
||||
(search-forward tex-end-of-header nil t)
|
||||
(beginning-of-line)
|
||||
;; Mark end of header
|
||||
(setq filename-or-header-end (point))))
|
||||
|
||||
;; Insert the header into the temporary file.
|
||||
(write-region
|
||||
(min filename-or-header-beginning region-beginning)
|
||||
filename-or-header-end
|
||||
makeinfo-temp-file nil nil)
|
||||
|
||||
;; Else no header; insert @filename line into temporary file.
|
||||
(goto-char (point-min))
|
||||
(search-forward "@setfilename" search-end t)
|
||||
(beginning-of-line)
|
||||
(setq filename-or-header-beginning (point))
|
||||
(forward-line 1)
|
||||
(setq filename-or-header-end (point))
|
||||
(write-region
|
||||
(min filename-or-header-beginning region-beginning)
|
||||
filename-or-header-end
|
||||
makeinfo-temp-file nil nil))
|
||||
|
||||
;; Insert the region into the file.
|
||||
(write-region
|
||||
(max region-beginning filename-or-header-end)
|
||||
region-end
|
||||
makeinfo-temp-file t nil)
|
||||
|
||||
;; Run the `makeinfo-compile' command in the *compilation* buffer
|
||||
(save-excursion
|
||||
(makeinfo-compile
|
||||
(concat makeinfo-run-command
|
||||
" "
|
||||
makeinfo-options
|
||||
" "
|
||||
makeinfo-temp-file)
|
||||
"Use `makeinfo-buffer' to gain use of the `next-error' command"
|
||||
nil)))))))
|
||||
|
||||
;;; Actually run makeinfo. COMMAND is the command to run.
|
||||
;;; ERROR-MESSAGE is what to say when next-error can't find another error.
|
||||
;;; If PARSE-ERRORS is non-nil, do try to parse error messages.
|
||||
(defun makeinfo-compile (command error-message parse-errors)
|
||||
(let ((buffer
|
||||
(compile-internal command error-message nil
|
||||
(and (not parse-errors)
|
||||
;; If we do want to parse errors, pass nil.
|
||||
;; Otherwise, use this function, which won't
|
||||
;; ever find any errors.
|
||||
'(lambda (&rest ignore)
|
||||
(setq compilation-error-list nil))))))
|
||||
(set-process-sentinel (get-buffer-process buffer)
|
||||
'makeinfo-compilation-sentinel)))
|
||||
|
||||
;; Delete makeinfo-temp-file after processing is finished,
|
||||
;; and visit Info file.
|
||||
;; This function is called when the compilation process changes state.
|
||||
;; Based on `compilation-sentinel' in compile.el
|
||||
(defun makeinfo-compilation-sentinel (proc msg)
|
||||
(compilation-sentinel proc msg)
|
||||
(if (and makeinfo-temp-file (file-exists-p makeinfo-temp-file))
|
||||
(delete-file makeinfo-temp-file))
|
||||
;; Always use the version on disk.
|
||||
(if (get-file-buffer makeinfo-output-file-name)
|
||||
(progn (set-buffer makeinfo-output-file-name)
|
||||
(revert-buffer t t))
|
||||
(find-file makeinfo-output-file-name))
|
||||
(goto-char (point-min)))
|
||||
|
||||
(defun makeinfo-buffer ()
|
||||
"Make Info file from current buffer.
|
||||
|
||||
Use the \\[next-error] command to move to the next error
|
||||
\(if there are errors\)."
|
||||
|
||||
(interactive)
|
||||
(cond ((null buffer-file-name)
|
||||
(error "Buffer not visiting any file"))
|
||||
((buffer-modified-p)
|
||||
(if (y-or-n-p "Buffer modified; do you want to save it? ")
|
||||
(save-buffer))))
|
||||
|
||||
;; Find and record the Info filename,
|
||||
;; or else explain that a filename is needed.
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(let ((search-end (save-excursion (forward-line 100) (point))))
|
||||
(if (re-search-forward
|
||||
"^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
|
||||
search-end t)
|
||||
(setq makeinfo-output-file-name
|
||||
(buffer-substring (match-beginning 1) (match-end 1)))
|
||||
(error
|
||||
"The texinfo file needs a line saying: @setfilename <name>"))))
|
||||
|
||||
(save-excursion
|
||||
(makeinfo-compile
|
||||
(concat makeinfo-run-command " " makeinfo-options
|
||||
" " buffer-file-name)
|
||||
"No more errors."
|
||||
t)))
|
||||
|
||||
(defun makeinfo-recenter-compilation-buffer (linenum)
|
||||
"Redisplay `*compilation*' buffer so most recent output can be seen.
|
||||
The last line of the buffer is displayed on
|
||||
line LINE of the window, or centered if LINE is nil."
|
||||
(interactive "P")
|
||||
(let ((makeinfo-buffer (get-buffer "*compilation*"))
|
||||
(old-buffer (current-buffer)))
|
||||
(if (null makeinfo-buffer)
|
||||
(message "No *compilation* buffer")
|
||||
(pop-to-buffer makeinfo-buffer)
|
||||
(bury-buffer makeinfo-buffer)
|
||||
(goto-char (point-max))
|
||||
(recenter (if linenum
|
||||
(prefix-numeric-value linenum)
|
||||
(/ (window-height) 2)))
|
||||
(pop-to-buffer old-buffer)
|
||||
)))
|
||||
|
||||
;;; Place `provide' at end of file.
|
||||
(provide 'makeinfo)
|
||||
|
||||
;;; makeinfo.el ends here
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
;; -*- Mode: Emacs-Lisp -*-
|
||||
|
||||
;; This is the `new-useful-setqs' file
|
||||
;; This overrides old defvars since they were revised.
|
||||
|
||||
(setq texinfmt-version "2.35 of 10 September 1996")
|
||||
|
||||
(setq texinfo-master-menu-header
|
||||
"\n@detailmenu\n --- The Detailed Node Listing ---\n")
|
||||
|
||||
(setq texinfo-environment-regexp
|
||||
(concat
|
||||
"^@"
|
||||
"\\("
|
||||
"cartouche\\|"
|
||||
"display\\|"
|
||||
"end\\|"
|
||||
"enumerate\\|"
|
||||
"example\\|"
|
||||
"f?table\\|"
|
||||
"flushleft\\|"
|
||||
"flushright\\|"
|
||||
"format\\|"
|
||||
"group\\|"
|
||||
"ifhtml\\|"
|
||||
"ifinfo\\|"
|
||||
"iftex\\|"
|
||||
"ignore\\|"
|
||||
"itemize\\|"
|
||||
"lisp\\|"
|
||||
"macro\\|"
|
||||
"multitable\\|"
|
||||
"quotation\\|"
|
||||
"smallexample\\|"
|
||||
"smalllisp\\|"
|
||||
"tex"
|
||||
"\\)")
|
||||
)
|
||||
|
||||
(setq texinfo-no-refill-regexp
|
||||
(concat
|
||||
"^@"
|
||||
"\\("
|
||||
"example\\|"
|
||||
"smallexample\\|"
|
||||
"lisp\\|"
|
||||
"smalllisp\\|"
|
||||
"display\\|"
|
||||
"format\\|"
|
||||
"flushleft\\|"
|
||||
"flushright\\|"
|
||||
"menu\\|"
|
||||
"multitable\\|"
|
||||
"titlepage\\|"
|
||||
"iftex\\|"
|
||||
"ifhtml\\|"
|
||||
"tex\\|"
|
||||
"html"
|
||||
"\\)"))
|
||||
|
||||
|
||||
(setq texinfo-accent-commands
|
||||
(concat
|
||||
"@OE\\|"
|
||||
"@oe\\|"
|
||||
"@AA\\|"
|
||||
"@aa\\|"
|
||||
"@AE\\|"
|
||||
"@ae\\|"
|
||||
"@ss\\|"
|
||||
"@^\\|"
|
||||
"@`\\|"
|
||||
"@'\\|"
|
||||
"@\"\\|"
|
||||
"@,\\|"
|
||||
"@=\\|"
|
||||
"@~\\|"
|
||||
"@questiondown{\\|"
|
||||
"@exclamdown{\\|"
|
||||
"@L{\\|"
|
||||
"@l{\\|"
|
||||
"@O{\\|"
|
||||
"@o{\\|"
|
||||
"@dotaccent{\\|"
|
||||
"@ubaraccent{\\|"
|
||||
"@d{\\|"
|
||||
"@H{\\|"
|
||||
"@ringaccent{\\|"
|
||||
"@tieaccent{\\|"
|
||||
"@u{\\|"
|
||||
"@v{\\|"
|
||||
"@dotless{"
|
||||
))
|
||||
|
||||
(setq texinfo-part-of-para-regexp
|
||||
(concat
|
||||
"^@"
|
||||
"\\("
|
||||
"b{\\|"
|
||||
"bullet{\\|"
|
||||
"cite{\\|"
|
||||
"code{\\|"
|
||||
"emph{\\|"
|
||||
"equiv{\\|"
|
||||
"error{\\|"
|
||||
"expansion{\\|"
|
||||
"file{\\|"
|
||||
"i{\\|"
|
||||
"inforef{\\|"
|
||||
"kbd{\\|"
|
||||
"key{\\|"
|
||||
"lisp{\\|"
|
||||
"email{\\|"
|
||||
"minus{\\|"
|
||||
"point{\\|"
|
||||
"print{\\|"
|
||||
"pxref{\\|"
|
||||
"r{\\|"
|
||||
"ref{\\|"
|
||||
"result{\\|"
|
||||
"samp{\\|"
|
||||
"sc{\\|"
|
||||
"t{\\|"
|
||||
"TeX{\\|"
|
||||
"today{\\|"
|
||||
"url{\\|"
|
||||
"var{\\|"
|
||||
"w{\\|"
|
||||
"xref{\\|"
|
||||
"@-\\|" ; @- is a descretionary hyphen (not an accent) (a noop).
|
||||
texinfo-accent-commands
|
||||
"\\)"
|
||||
))
|
||||
|
||||
(setq texinfo-raisesections-alist
|
||||
'((@chapter . @chapter) ; Cannot go higher
|
||||
(@unnumbered . @unnumbered)
|
||||
(@centerchap . @unnumbered)
|
||||
|
||||
(@majorheading . @majorheading)
|
||||
(@chapheading . @chapheading)
|
||||
(@appendix . @appendix)
|
||||
|
||||
(@section . @chapter)
|
||||
(@unnumberedsec . @unnumbered)
|
||||
(@heading . @chapheading)
|
||||
(@appendixsec . @appendix)
|
||||
|
||||
(@subsection . @section)
|
||||
(@unnumberedsubsec . @unnumberedsec)
|
||||
(@subheading . @heading)
|
||||
(@appendixsubsec . @appendixsec)
|
||||
|
||||
(@subsubsection . @subsection)
|
||||
(@unnumberedsubsubsec . @unnumberedsubsec)
|
||||
(@subsubheading . @subheading)
|
||||
(@appendixsubsubsec . @appendixsubsec)))
|
||||
|
||||
(setq texinfo-lowersections-alist
|
||||
'((@chapter . @section)
|
||||
(@unnumbered . @unnumberedsec)
|
||||
(@centerchap . @unnumberedsec)
|
||||
(@majorheading . @heading)
|
||||
(@chapheading . @heading)
|
||||
(@appendix . @appendixsec)
|
||||
|
||||
(@section . @subsection)
|
||||
(@unnumberedsec . @unnumberedsubsec)
|
||||
(@heading . @subheading)
|
||||
(@appendixsec . @appendixsubsec)
|
||||
|
||||
(@subsection . @subsubsection)
|
||||
(@unnumberedsubsec . @unnumberedsubsubsec)
|
||||
(@subheading . @subsubheading)
|
||||
(@appendixsubsec . @appendixsubsubsec)
|
||||
|
||||
(@subsubsection . @subsubsection) ; Cannot go lower.
|
||||
(@unnumberedsubsubsec . @unnumberedsubsubsec)
|
||||
(@subsubheading . @subsubheading)
|
||||
(@appendixsubsubsec . @appendixsubsubsec)))
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,932 +0,0 @@
|
||||
;;; texinfo.el--major mode for editing Texinfo files.
|
||||
|
||||
;; Copyright (C) 1985, '88, '89, '90, '91,
|
||||
;; '92, '93, '96 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Robert J. Chassell
|
||||
;; Date: 6 Sep 1996
|
||||
;; Maintainer: [email protected]
|
||||
;; Keywords: maint, tex, docs
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
||||
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
;; Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
;;; Autoloads:
|
||||
|
||||
(autoload 'makeinfo-region
|
||||
"makeinfo"
|
||||
"Make Info file from region of current Texinfo file, and switch to it.
|
||||
|
||||
This command does not offer the `next-error' feature since it would
|
||||
apply to a temporary file, not the original; use the `makeinfo-buffer'
|
||||
command to gain use of `next-error'."
|
||||
t nil)
|
||||
|
||||
(autoload 'makeinfo-buffer
|
||||
"makeinfo"
|
||||
"Make Info file from current buffer.
|
||||
|
||||
Use the \\[next-error] command to move to the next error
|
||||
\(if there are errors\)."
|
||||
t nil)
|
||||
|
||||
(autoload 'kill-compilation
|
||||
"compile"
|
||||
"Kill the process made by the \\[compile] command."
|
||||
t nil)
|
||||
|
||||
(autoload 'makeinfo-recenter-compilation-buffer
|
||||
"makeinfo"
|
||||
"Redisplay `*compilation*' buffer so most recent output can be seen.
|
||||
The last line of the buffer is displayed on
|
||||
line LINE of the window, or centered if LINE is nil."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-update-node
|
||||
"texnfo-upd"
|
||||
"Without any prefix argument, update the node in which point is located.
|
||||
Non-nil argument (prefix, if interactive) means update the nodes in the
|
||||
marked region.
|
||||
|
||||
The functions for creating or updating nodes and menus, and their
|
||||
keybindings, are:
|
||||
|
||||
texinfo-update-node (&optional region-p) \\[texinfo-update-node]
|
||||
texinfo-every-node-update () \\[texinfo-every-node-update]
|
||||
texinfo-sequential-node-update (&optional region-p)
|
||||
|
||||
texinfo-make-menu (&optional region-p) \\[texinfo-make-menu]
|
||||
texinfo-all-menus-update () \\[texinfo-all-menus-update]
|
||||
texinfo-master-menu ()
|
||||
|
||||
texinfo-indent-menu-description (column &optional region-p)
|
||||
|
||||
The `texinfo-column-for-description' variable specifies the column to
|
||||
which menu descriptions are indented. Its default value is 32."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-every-node-update
|
||||
"texnfo-upd"
|
||||
"Update every node in a Texinfo file."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-sequential-node-update
|
||||
"texnfo-upd"
|
||||
"Update one node (or many) in a Texinfo file with sequential pointers.
|
||||
|
||||
This function causes the `Next' or `Previous' pointer to point to the
|
||||
immediately preceding or following node, even if it is at a higher or
|
||||
lower hierarchical level in the document. Continually pressing `n' or
|
||||
`p' takes you straight through the file.
|
||||
|
||||
Without any prefix argument, update the node in which point is located.
|
||||
Non-nil argument (prefix, if interactive) means update the nodes in the
|
||||
marked region.
|
||||
|
||||
This command makes it awkward to navigate among sections and
|
||||
subsections; it should be used only for those documents that are meant
|
||||
to be read like a novel rather than a reference, and for which the
|
||||
Info `g*' command is inadequate."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-make-menu
|
||||
"texnfo-upd"
|
||||
"Without any prefix argument, make or update a menu.
|
||||
Make the menu for the section enclosing the node found following point.
|
||||
|
||||
Non-nil argument (prefix, if interactive) means make or update menus
|
||||
for nodes within or part of the marked region.
|
||||
|
||||
Whenever a menu exists, and is being updated, the descriptions that
|
||||
are associated with node names in the pre-existing menu are
|
||||
incorporated into the new menu. Otherwise, the nodes' section titles
|
||||
are inserted as descriptions."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-all-menus-update
|
||||
"texnfo-upd"
|
||||
"Update every regular menu in a Texinfo file.
|
||||
Remove pre-existing master menu, if there is one.
|
||||
|
||||
If called with a non-nil argument, this function first updates all the
|
||||
nodes in the buffer before updating the menus."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-master-menu
|
||||
"texnfo-upd"
|
||||
"Make a master menu for a whole Texinfo file.
|
||||
Non-nil argument (prefix, if interactive) means first update all
|
||||
existing nodes and menus. Remove pre-existing master menu, if there is one.
|
||||
|
||||
This function creates a master menu that follows the top node. The
|
||||
master menu includes every entry from all the other menus. It
|
||||
replaces any existing ordinary menu that follows the top node.
|
||||
|
||||
If called with a non-nil argument, this function first updates all the
|
||||
menus in the buffer (incorporating descriptions from pre-existing
|
||||
menus) before it constructs the master menu.
|
||||
|
||||
The function removes the detailed part of an already existing master
|
||||
menu. This action depends on the pre-existing master menu using the
|
||||
standard `texinfo-master-menu-header'.
|
||||
|
||||
The master menu has the following format, which is adapted from the
|
||||
recommendation in the Texinfo Manual:
|
||||
|
||||
* The first part contains the major nodes in the Texinfo file: the
|
||||
nodes for the chapters, chapter-like sections, and the major
|
||||
appendices. This includes the indices, so long as they are in
|
||||
chapter-like sections, such as unnumbered sections.
|
||||
|
||||
* The second and subsequent parts contain a listing of the other,
|
||||
lower level menus, in order. This way, an inquirer can go
|
||||
directly to a particular node if he or she is searching for
|
||||
specific information.
|
||||
|
||||
Each of the menus in the detailed node listing is introduced by the
|
||||
title of the section containing the menu."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-indent-menu-description
|
||||
"texnfo-upd"
|
||||
"Indent every description in menu following point to COLUMN.
|
||||
Non-nil argument (prefix, if interactive) means indent every
|
||||
description in every menu in the region. Does not indent second and
|
||||
subsequent lines of a multi-line description."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-insert-node-lines
|
||||
"texnfo-upd"
|
||||
"Insert missing `@node' lines in region of Texinfo file.
|
||||
Non-nil argument (prefix, if interactive) means also to insert the
|
||||
section titles as node names; and also to insert the section titles as
|
||||
node names in pre-existing @node lines that lack names."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-start-menu-description
|
||||
"texnfo-upd"
|
||||
"In this menu entry, insert the node's section title as a description.
|
||||
Position point at beginning of description ready for editing.
|
||||
Do not insert a title if the line contains an existing description.
|
||||
|
||||
You will need to edit the inserted text since a useful description
|
||||
complements the node name rather than repeats it as a title does."
|
||||
t nil)
|
||||
|
||||
(autoload 'texinfo-multiple-files-update
|
||||
"texnfo-upd"
|
||||
"Update first node pointers in each file included in OUTER-FILE;
|
||||
create or update main menu in the outer file that refers to such nodes.
|
||||
This does not create or update menus or pointers within the included files.
|
||||
|
||||
With optional MAKE-MASTER-MENU argument (prefix arg, if interactive),
|
||||
insert a master menu in OUTER-FILE. This does not create or update
|
||||
menus or pointers within the included files.
|
||||
|
||||
With optional UPDATE-EVERYTHING argument (numeric prefix arg, if
|
||||
interactive), update all the menus and all the `Next', `Previous', and
|
||||
`Up' pointers of all the files included in OUTER-FILE before inserting
|
||||
a master menu in OUTER-FILE.
|
||||
|
||||
The command also updates the `Top' level node pointers of OUTER-FILE.
|
||||
|
||||
Notes:
|
||||
|
||||
* this command does NOT save any files--you must save the
|
||||
outer file and any modified, included files.
|
||||
|
||||
* except for the `Top' node, this command does NOT handle any
|
||||
pre-existing nodes in the outer file; hence, indices must be
|
||||
enclosed in an included file.
|
||||
|
||||
Requirements:
|
||||
|
||||
* each of the included files must contain exactly one highest
|
||||
hierarchical level node,
|
||||
* this highest node must be the first node in the included file,
|
||||
* each highest hierarchical level node must be of the same type.
|
||||
|
||||
Thus, normally, each included file contains one, and only one,
|
||||
chapter."
|
||||
t nil)
|
||||
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;; Don't you dare insert any `require' calls at top level in this file--rms.
|
||||
|
||||
;;; Syntax table
|
||||
|
||||
(defvar texinfo-mode-syntax-table nil)
|
||||
|
||||
(if texinfo-mode-syntax-table
|
||||
nil
|
||||
(setq texinfo-mode-syntax-table (make-syntax-table))
|
||||
(modify-syntax-entry ?\" " " texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?\\ " " texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?@ "\\" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?\^q "\\" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?\[ "(]" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?\] ")[" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?{ "(}" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?} "){" texinfo-mode-syntax-table)
|
||||
(modify-syntax-entry ?\' "w" texinfo-mode-syntax-table))
|
||||
|
||||
;; Written by Wolfgang Bangerth <[email protected]>
|
||||
;; To override this example, set either `imenu-generic-expression'
|
||||
;; or `imenu-create-index-function'.
|
||||
(defvar texinfo-imenu-generic-expression
|
||||
'((nil "^@node[ \t]+\\([^,\n]*\\)" 1)
|
||||
("Chapters" "^@chapter[ \t]+\\(.*\\)$" 1))
|
||||
|
||||
"Imenu generic expression for TexInfo mode. See `imenu-generic-expression'.")
|
||||
|
||||
(defvar texinfo-font-lock-keywords
|
||||
'(;; All but the first 2 had an OVERRIDE of t.
|
||||
;; It didn't seem to be any better, and it's slower--simon.
|
||||
("^\\(@c\\|@comment\\)\\>.*" . font-lock-comment-face) ;comments
|
||||
;; Robert J. Chassell <[email protected]> says remove this line.
|
||||
;("\\$\\([^$]*\\)\\$" 1 font-lock-string-face t)
|
||||
("@\\([a-zA-Z]+\\|[^ \t\n]\\)" 1 font-lock-keyword-face) ;commands
|
||||
("^\\*\\(.*\\)[\t ]*$" 1 font-lock-function-name-face t) ;menu items
|
||||
("@\\(emph\\|strong\\|b\\|i\\){\\([^}]+\\)" 2 font-lock-comment-face)
|
||||
("@\\(file\\|kbd\\|key\\){\\([^}]+\\)" 2 font-lock-string-face)
|
||||
("@\\(samp\\|code\\|var\\|math\\){\\([^}]+\\)"
|
||||
2 font-lock-variable-name-face)
|
||||
("@\\(cite\\|xref\\|pxref\\){\\([^}]+\\)" 2 font-lock-reference-face)
|
||||
("@\\(end\\|itemx?\\) +\\(.+\\)" 2 font-lock-function-name-face keep)
|
||||
)
|
||||
"Additional expressions to highlight in TeXinfo mode.")
|
||||
|
||||
(defvar texinfo-section-list
|
||||
'(("top" 1)
|
||||
("majorheading" 1)
|
||||
("chapter" 2)
|
||||
("unnumbered" 2)
|
||||
("appendix" 2)
|
||||
("chapheading" 2)
|
||||
("section" 3)
|
||||
("unnumberedsec" 3)
|
||||
("appendixsec" 3)
|
||||
("heading" 3)
|
||||
("subsection" 4)
|
||||
("unnumberedsubsec" 4)
|
||||
("appendixsubsec" 4)
|
||||
("subheading" 4)
|
||||
("subsubsection" 5)
|
||||
("unnumberedsubsubsec" 5)
|
||||
("appendixsubsubsec" 5)
|
||||
("subsubheading" 5))
|
||||
"Alist of sectioning commands and their relative level.")
|
||||
|
||||
(defun texinfo-outline-level ()
|
||||
;; Calculate level of current texinfo outline heading.
|
||||
(save-excursion
|
||||
(if (bobp)
|
||||
0
|
||||
(forward-char 1)
|
||||
(let* ((word (buffer-substring-no-properties
|
||||
(point) (progn (forward-word 1) (point))))
|
||||
(entry (assoc word texinfo-section-list)))
|
||||
(if entry
|
||||
(nth 1 entry)
|
||||
5)))))
|
||||
|
||||
|
||||
;;; Keybindings
|
||||
(defvar texinfo-mode-map nil)
|
||||
|
||||
;;; Keys common both to Texinfo mode and to TeX shell.
|
||||
|
||||
(defun texinfo-define-common-keys (keymap)
|
||||
"Define the keys both in Texinfo mode and in the texinfo-tex-shell."
|
||||
(define-key keymap "\C-c\C-t\C-k" 'tex-kill-job)
|
||||
(define-key keymap "\C-c\C-t\C-x" 'texinfo-quit-job)
|
||||
(define-key keymap "\C-c\C-t\C-l" 'tex-recenter-output-buffer)
|
||||
(define-key keymap "\C-c\C-t\C-d" 'texinfo-delete-from-print-queue)
|
||||
(define-key keymap "\C-c\C-t\C-q" 'tex-show-print-queue)
|
||||
(define-key keymap "\C-c\C-t\C-p" 'texinfo-tex-print)
|
||||
(define-key keymap "\C-c\C-t\C-i" 'texinfo-texindex)
|
||||
|
||||
(define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region)
|
||||
(define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer))
|
||||
|
||||
;; Mode documentation displays commands in reverse order
|
||||
;; from how they are listed in the texinfo-mode-map.
|
||||
|
||||
(if texinfo-mode-map
|
||||
nil
|
||||
(setq texinfo-mode-map (make-sparse-keymap))
|
||||
|
||||
;; bindings for `texnfo-tex.el'
|
||||
(texinfo-define-common-keys texinfo-mode-map)
|
||||
|
||||
;; bindings for `makeinfo.el'
|
||||
(define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation)
|
||||
(define-key texinfo-mode-map "\C-c\C-m\C-l"
|
||||
'makeinfo-recenter-compilation-buffer)
|
||||
(define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region)
|
||||
(define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer)
|
||||
|
||||
;; bindings for `texinfmt.el'
|
||||
(define-key texinfo-mode-map "\C-c\C-e\C-r" 'texinfo-format-region)
|
||||
(define-key texinfo-mode-map "\C-c\C-e\C-b" 'texinfo-format-buffer)
|
||||
|
||||
;; bindings for updating nodes and menus
|
||||
|
||||
(define-key texinfo-mode-map "\C-c\C-um" 'texinfo-master-menu)
|
||||
|
||||
(define-key texinfo-mode-map "\C-c\C-u\C-m" 'texinfo-make-menu)
|
||||
(define-key texinfo-mode-map "\C-c\C-u\C-n" 'texinfo-update-node)
|
||||
(define-key texinfo-mode-map "\C-c\C-u\C-e" 'texinfo-every-node-update)
|
||||
(define-key texinfo-mode-map "\C-c\C-u\C-a" 'texinfo-all-menus-update)
|
||||
|
||||
(define-key texinfo-mode-map "\C-c\C-s" 'texinfo-show-structure)
|
||||
|
||||
(define-key texinfo-mode-map "\C-c}" 'up-list)
|
||||
(define-key texinfo-mode-map "\C-c]" 'up-list)
|
||||
(define-key texinfo-mode-map "\C-c{" 'texinfo-insert-braces)
|
||||
|
||||
;; bindings for inserting strings
|
||||
|
||||
(define-key texinfo-mode-map "\C-c\C-c\C-d" 'texinfo-start-menu-description)
|
||||
|
||||
(define-key texinfo-mode-map "\C-c\C-cv" 'texinfo-insert-@var)
|
||||
(define-key texinfo-mode-map "\C-c\C-ct" 'texinfo-insert-@table)
|
||||
(define-key texinfo-mode-map "\C-c\C-cs" 'texinfo-insert-@samp)
|
||||
(define-key texinfo-mode-map "\C-c\C-co" 'texinfo-insert-@noindent)
|
||||
(define-key texinfo-mode-map "\C-c\C-cn" 'texinfo-insert-@node)
|
||||
(define-key texinfo-mode-map "\C-c\C-ck" 'texinfo-insert-@kbd)
|
||||
(define-key texinfo-mode-map "\C-c\C-ci" 'texinfo-insert-@item)
|
||||
(define-key texinfo-mode-map "\C-c\C-cf" 'texinfo-insert-@file)
|
||||
(define-key texinfo-mode-map "\C-c\C-cx" 'texinfo-insert-@example)
|
||||
(define-key texinfo-mode-map "\C-c\C-ce" 'texinfo-insert-@end)
|
||||
(define-key texinfo-mode-map "\C-c\C-cd" 'texinfo-insert-@dfn)
|
||||
(define-key texinfo-mode-map "\C-c\C-cc" 'texinfo-insert-@code))
|
||||
|
||||
|
||||
;;; Texinfo mode
|
||||
|
||||
(defvar texinfo-chapter-level-regexp
|
||||
"chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading"
|
||||
"Regular expression matching Texinfo chapter-level headings.
|
||||
This does not match `@node' and does not match the `@top' command.")
|
||||
|
||||
;;;###autoload
|
||||
(defun texinfo-mode ()
|
||||
"Major mode for editing Texinfo files.
|
||||
|
||||
It has these extra commands:
|
||||
\\{texinfo-mode-map}
|
||||
|
||||
These are files that are used as input for TeX to make printed manuals
|
||||
and also to be turned into Info files with \\[makeinfo-buffer] or
|
||||
the `makeinfo' program. These files must be written in a very restricted and
|
||||
modified version of TeX input format.
|
||||
|
||||
Editing commands are like text-mode except that the syntax table is
|
||||
set up so expression commands skip Texinfo bracket groups. To see
|
||||
what the Info version of a region of the Texinfo file will look like,
|
||||
use \\[makeinfo-region], which runs `makeinfo' on the current region.
|
||||
|
||||
You can show the structure of a Texinfo file with \\[texinfo-show-structure].
|
||||
This command shows the structure of a Texinfo file by listing the
|
||||
lines with the @-sign commands for @chapter, @section, and the like.
|
||||
These lines are displayed in another window called the *Occur* window.
|
||||
In that window, you can position the cursor over one of the lines and
|
||||
use \\[occur-mode-goto-occurrence], to jump to the corresponding spot
|
||||
in the Texinfo file.
|
||||
|
||||
In addition, Texinfo mode provides commands that insert various
|
||||
frequently used @-sign commands into the buffer. You can use these
|
||||
commands to save keystrokes. And you can insert balanced braces with
|
||||
\\[texinfo-insert-braces] and later use the command \\[up-list] to
|
||||
move forward past the closing brace.
|
||||
|
||||
Also, Texinfo mode provides functions for automatically creating or
|
||||
updating menus and node pointers. These functions
|
||||
|
||||
* insert the `Next', `Previous' and `Up' pointers of a node,
|
||||
* insert or update the menu for a section, and
|
||||
* create a master menu for a Texinfo source file.
|
||||
|
||||
Here are the functions:
|
||||
|
||||
texinfo-update-node \\[texinfo-update-node]
|
||||
texinfo-every-node-update \\[texinfo-every-node-update]
|
||||
texinfo-sequential-node-update
|
||||
|
||||
texinfo-make-menu \\[texinfo-make-menu]
|
||||
texinfo-all-menus-update \\[texinfo-all-menus-update]
|
||||
texinfo-master-menu
|
||||
|
||||
texinfo-indent-menu-description (column &optional region-p)
|
||||
|
||||
The `texinfo-column-for-description' variable specifies the column to
|
||||
which menu descriptions are indented.
|
||||
|
||||
Passed an argument (a prefix argument, if interactive), the
|
||||
`texinfo-update-node' and `texinfo-make-menu' functions do their jobs
|
||||
in the region.
|
||||
|
||||
To use the updating commands, you must structure your Texinfo file
|
||||
hierarchically, such that each `@node' line, with the exception of the
|
||||
Top node, is accompanied by some kind of section line, such as an
|
||||
`@chapter' or `@section' line.
|
||||
|
||||
If the file has a `top' node, it must be called `top' or `Top' and
|
||||
be the first node in the file.
|
||||
|
||||
Entering Texinfo mode calls the value of text-mode-hook, and then the
|
||||
value of texinfo-mode-hook."
|
||||
(interactive)
|
||||
(text-mode)
|
||||
(setq mode-name "Texinfo")
|
||||
(setq major-mode 'texinfo-mode)
|
||||
(use-local-map texinfo-mode-map)
|
||||
(set-syntax-table texinfo-mode-syntax-table)
|
||||
(make-local-variable 'page-delimiter)
|
||||
(setq page-delimiter
|
||||
(concat
|
||||
"^@node [ \t]*[Tt]op\\|^@\\("
|
||||
texinfo-chapter-level-regexp
|
||||
"\\)"))
|
||||
(make-local-variable 'require-final-newline)
|
||||
(setq require-final-newline t)
|
||||
(make-local-variable 'indent-tabs-mode)
|
||||
(setq indent-tabs-mode nil)
|
||||
(make-local-variable 'paragraph-separate)
|
||||
(setq paragraph-separate (concat "^\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-separate))
|
||||
(make-local-variable 'paragraph-start)
|
||||
(setq paragraph-start (concat "^\b\\|^@[a-zA-Z]*[ \n]\\|" paragraph-start))
|
||||
(make-local-variable 'fill-column)
|
||||
(setq fill-column 72)
|
||||
(make-local-variable 'comment-start)
|
||||
(setq comment-start "@c ")
|
||||
(make-local-variable 'comment-start-skip)
|
||||
(setq comment-start-skip "@c +")
|
||||
(make-local-variable 'words-include-escapes)
|
||||
(setq words-include-escapes t)
|
||||
(make-local-variable 'imenu-generic-expression)
|
||||
(setq imenu-generic-expression texinfo-imenu-generic-expression)
|
||||
(make-local-variable 'font-lock-defaults)
|
||||
(setq font-lock-defaults '(texinfo-font-lock-keywords t))
|
||||
(make-local-variable 'outline-regexp)
|
||||
(setq outline-regexp
|
||||
(concat "@\\("
|
||||
(mapconcat 'car texinfo-section-list "\\>\\|")
|
||||
"\\>\\)"))
|
||||
(make-local-variable 'outline-level)
|
||||
(setq outline-level 'texinfo-outline-level)
|
||||
(make-local-variable 'tex-start-of-header)
|
||||
(setq tex-start-of-header "%**start")
|
||||
(make-local-variable 'tex-end-of-header)
|
||||
(setq tex-end-of-header "%**end")
|
||||
(run-hooks 'text-mode-hook 'texinfo-mode-hook))
|
||||
|
||||
|
||||
;;; Insert string commands
|
||||
|
||||
;; Keep as concatinated lists for ease of maintenance
|
||||
(defconst texinfo-environment-regexp
|
||||
(concat
|
||||
"^@"
|
||||
"\\("
|
||||
"cartouche\\|"
|
||||
"display\\|"
|
||||
"end\\|"
|
||||
"enumerate\\|"
|
||||
"example\\|"
|
||||
"f?table\\|"
|
||||
"flushleft\\|"
|
||||
"flushright\\|"
|
||||
"format\\|"
|
||||
"group\\|"
|
||||
"ifhtml\\|"
|
||||
"ifinfo\\|"
|
||||
"iftex\\|"
|
||||
"ignore\\|"
|
||||
"itemize\\|"
|
||||
"lisp\\|"
|
||||
"macro\\|"
|
||||
"multitable\\|"
|
||||
"quotation\\|"
|
||||
"smallexample\\|"
|
||||
"smalllisp\\|"
|
||||
"tex"
|
||||
"\\)")
|
||||
"Regexp for environment-like TexInfo list commands.
|
||||
Subexpression 1 is what goes into the corresponding `@end' statement.")
|
||||
|
||||
;; The following texinfo-insert-@end command not only inserts a SPC
|
||||
;; after the @end, but tries to find out what belongs there. It is
|
||||
;; not very smart: it does not understand nested lists.
|
||||
|
||||
(defun texinfo-insert-@end ()
|
||||
"Insert the matching `@end' for the last Texinfo command that needs one."
|
||||
(interactive)
|
||||
(let ((depth 1) string)
|
||||
(save-excursion
|
||||
(while (and (> depth 0)
|
||||
(re-search-backward texinfo-environment-regexp nil t)
|
||||
(if (looking-at "@end")
|
||||
(setq depth (1+ depth))
|
||||
(setq depth (1- depth)))))
|
||||
(looking-at texinfo-environment-regexp)
|
||||
(if (zerop depth)
|
||||
(setq string
|
||||
(buffer-substring (match-beginning 1)
|
||||
(match-end 1)))))
|
||||
(insert "@end ")
|
||||
(if string (insert string "\n"))))
|
||||
|
||||
;; The following insert commands accept a prefix arg N, which is the
|
||||
;; number of words (actually s-exprs) that should be surrounded by
|
||||
;; braces. Thus you can first paste a variable name into a .texinfo
|
||||
;; buffer, then say C-u 1 C-c C-c v at the beginning of the just
|
||||
;; pasted variable name to put @var{...} *around* the variable name.
|
||||
;; Operate on previous word or words with negative arg.
|
||||
|
||||
;; These commands use texinfo-insert-@-with-arg
|
||||
(defun texinfo-insert-@-with-arg (string &optional arg)
|
||||
(if arg
|
||||
(progn
|
||||
(setq arg (prefix-numeric-value arg))
|
||||
(if (< arg 0)
|
||||
(progn
|
||||
(skip-chars-backward " \t\n\r\f")
|
||||
(save-excursion
|
||||
(forward-sexp arg)
|
||||
(insert "@" string "{"))
|
||||
(insert "}"))
|
||||
(skip-chars-forward " \t\n\r\f")
|
||||
(insert "@" string "{")
|
||||
(forward-sexp arg)
|
||||
(insert "}")))
|
||||
(insert "@" string "{}")
|
||||
(backward-char)))
|
||||
|
||||
(defun texinfo-insert-braces ()
|
||||
"Make a pair of braces and be poised to type inside of them.
|
||||
Use \\[up-list] to move forward out of the braces."
|
||||
(interactive)
|
||||
(insert "{}")
|
||||
(backward-char))
|
||||
|
||||
(defun texinfo-insert-@code (&optional arg)
|
||||
"Insert a `@code{...}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "code" arg))
|
||||
|
||||
(defun texinfo-insert-@dfn (&optional arg)
|
||||
"Insert a `@dfn{...}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "dfn" arg))
|
||||
|
||||
(defun texinfo-insert-@example ()
|
||||
"Insert the string `@example' in a Texinfo buffer."
|
||||
(interactive)
|
||||
(insert "@example\n"))
|
||||
|
||||
(defun texinfo-insert-@file (&optional arg)
|
||||
"Insert a `@file{...}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "file" arg))
|
||||
|
||||
(defun texinfo-insert-@item ()
|
||||
"Insert the string `@item' in a Texinfo buffer."
|
||||
(interactive)
|
||||
(insert "@item")
|
||||
(newline))
|
||||
|
||||
(defun texinfo-insert-@kbd (&optional arg)
|
||||
"Insert a `@kbd{...}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "kbd" arg))
|
||||
|
||||
(defun texinfo-insert-@node ()
|
||||
"Insert the string `@node' in a Texinfo buffer.
|
||||
This also inserts on the following line a comment indicating
|
||||
the order of arguments to @node."
|
||||
(interactive)
|
||||
(insert "@node \n@comment node-name, next, previous, up")
|
||||
(forward-line -1)
|
||||
(forward-char 6))
|
||||
|
||||
(defun texinfo-insert-@noindent ()
|
||||
"Insert the string `@noindent' in a Texinfo buffer."
|
||||
(interactive)
|
||||
(insert "@noindent\n"))
|
||||
|
||||
(defun texinfo-insert-@samp (&optional arg)
|
||||
"Insert a `@samp{...}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "samp" arg))
|
||||
|
||||
(defun texinfo-insert-@table (&optional arg)
|
||||
"Insert the string `@table' in a Texinfo buffer."
|
||||
(interactive "P")
|
||||
(insert "@table "))
|
||||
|
||||
(defun texinfo-insert-@var (&optional arg)
|
||||
"Insert a `@var{}' command in a Texinfo buffer.
|
||||
A numeric argument says how many words the braces should surround.
|
||||
The default is not to surround any existing words with the braces."
|
||||
(interactive "P")
|
||||
(texinfo-insert-@-with-arg "var" arg))
|
||||
|
||||
;;; Texinfo file structure
|
||||
|
||||
;; These are defined in texnfo-upd.el.
|
||||
;; texinfo-section-types-regexp
|
||||
;; texinfo-section-level-regexp
|
||||
;; texinfo-subsection-level-regexp
|
||||
;; texinfo-subsubsection-level-regexp
|
||||
|
||||
;; `texinfo-show-structure' requires texnfo-upd.el
|
||||
(defun texinfo-show-structure (&optional nodes-too)
|
||||
"Show the structure of a Texinfo file.
|
||||
List the lines in the file that begin with the @-sign commands for
|
||||
@chapter, @section, and the like.
|
||||
|
||||
With optional argument (prefix if interactive), list both the lines
|
||||
with @-sign commands for @chapter, @section, and the like, and list
|
||||
@node lines.
|
||||
|
||||
Lines with structuring commands beginning in them are displayed in
|
||||
another buffer named `*Occur*'. In that buffer, you can move point to
|
||||
one of those lines and then use \\<occur-mode-map>\\[occur-mode-goto-occurrence],
|
||||
to jump to the corresponding spot in the Texinfo source file."
|
||||
|
||||
(interactive "P")
|
||||
(require 'texnfo-upd)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(if nodes-too
|
||||
(occur (concat "\\(^@node\\)\\|" texinfo-section-types-regexp))
|
||||
(occur texinfo-section-types-regexp)))
|
||||
(pop-to-buffer "*Occur*")
|
||||
(goto-char (point-min))
|
||||
(flush-lines "-----")
|
||||
;; Now format the "*Occur*" buffer to show the structure.
|
||||
;; Thanks to [email protected] (Per Cederqvist)
|
||||
(goto-char (point-max))
|
||||
(let ((margin 5))
|
||||
(while (re-search-backward "^ *[0-9]*:" nil 0)
|
||||
(re-search-forward ":")
|
||||
(setq margin
|
||||
(cond
|
||||
((looking-at
|
||||
(concat "@\\(" texinfo-chapter-level-regexp "\\)")) 5)
|
||||
;; ((looking-at "@chapter ") 5)
|
||||
;; ((looking-at "@unnumbered ") 5)
|
||||
;; ((looking-at "@appendix ") 5)
|
||||
;; ((looking-at "@majorheading ") 5)
|
||||
;; ((looking-at "@chapheading ") 5)
|
||||
|
||||
((looking-at
|
||||
(concat "@\\(" texinfo-section-level-regexp "\\)")) 9)
|
||||
;; ((looking-at "@section ") 9)
|
||||
;; ((looking-at "@unnumberedsec ") 9)
|
||||
;; ((looking-at "@appendixsec ") 9)
|
||||
;; ((looking-at "@heading ") 9)
|
||||
|
||||
((looking-at
|
||||
(concat "@\\(" texinfo-subsection-level-regexp "\\)")) 13)
|
||||
;; ((looking-at "@subsection ") 13)
|
||||
;; ((looking-at "@unnumberedsubsec ") 13)
|
||||
;; ((looking-at "@appendixsubsec ") 13)
|
||||
;; ((looking-at "@subheading ") 13)
|
||||
|
||||
((looking-at
|
||||
(concat "@\\(" texinfo-subsubsection-level-regexp "\\)")) 17)
|
||||
;; ((looking-at "@subsubsection ") 17)
|
||||
;; ((looking-at "@unnumberedsubsubsec ") 17)
|
||||
;; ((looking-at "@appendixsubsubsec ") 17)
|
||||
;; ((looking-at "@subsubheading ") 17)
|
||||
(t margin)))
|
||||
(indent-to-column margin)
|
||||
(beginning-of-line))))
|
||||
|
||||
;;; The tex and print function definitions:
|
||||
|
||||
(defvar texinfo-texi2dvi-command "texi2dvi"
|
||||
"*Command used by `texinfo-tex-buffer' to run TeX and texindex on a buffer.")
|
||||
|
||||
(defvar texinfo-tex-command "tex"
|
||||
"*Command used by `texinfo-tex-region' to run TeX on a region.")
|
||||
|
||||
(defvar texinfo-texindex-command "texindex"
|
||||
"*Command used by `texinfo-texindex' to sort unsorted index files.")
|
||||
|
||||
(defvar texinfo-delete-from-print-queue-command "lprm"
|
||||
"*Command string used to delete a job from the line printer queue.
|
||||
Command is used by \\[texinfo-delete-from-print-queue] based on
|
||||
number provided by a previous \\[tex-show-print-queue]
|
||||
command.")
|
||||
|
||||
(defvar texinfo-tex-trailer "@bye"
|
||||
"String appended after a region sent to TeX by `texinfo-tex-region'.")
|
||||
|
||||
(defun texinfo-tex-region (beg end)
|
||||
"Run TeX on the current region.
|
||||
This works by writing a temporary file (`tex-zap-file') in the directory
|
||||
that is the value of `tex-directory', then running TeX on that file.
|
||||
|
||||
The first line of the buffer is copied to the
|
||||
temporary file; and if the buffer has a header, it is written to the
|
||||
temporary file before the region itself. The buffer's header is all lines
|
||||
between the strings defined by `tex-start-of-header' and `tex-end-of-header'
|
||||
inclusive. The header must start in the first 100 lines.
|
||||
|
||||
The value of `texinfo-tex-trailer' is appended to the temporary file after the region."
|
||||
(interactive "r")
|
||||
(require 'tex-mode)
|
||||
(if (get-buffer "*tex-shell*")
|
||||
(tex-kill-job)
|
||||
(tex-start-shell))
|
||||
(or tex-zap-file (setq tex-zap-file (make-temp-name "#tz")))
|
||||
(let ((tex-out-file (concat tex-zap-file ".tex"))
|
||||
(temp-buffer (get-buffer-create " tex-Output-Buffer"))
|
||||
(zap-directory
|
||||
(file-name-as-directory (expand-file-name tex-directory))))
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(forward-line 100)
|
||||
(let ((search-end (point))
|
||||
(hbeg (point-min)) (hend (point-min))
|
||||
(default-directory zap-directory))
|
||||
(goto-char (point-min))
|
||||
|
||||
;; Copy first line, the `\input texinfo' line, to temp file
|
||||
(write-region (point)
|
||||
(save-excursion (end-of-line) (point))
|
||||
tex-out-file nil nil)
|
||||
|
||||
;; Don't copy first line twice if region includes it.
|
||||
(forward-line 1)
|
||||
(if (< beg (point)) (setq beg (point)))
|
||||
|
||||
;; Initialize the temp file with either the header or nothing
|
||||
(if (search-forward tex-start-of-header search-end t)
|
||||
(progn
|
||||
(beginning-of-line)
|
||||
(setq hbeg (point)) ; Mark beginning of header.
|
||||
(if (search-forward tex-end-of-header nil t)
|
||||
(progn (beginning-of-line)
|
||||
(setq hend (point))) ; Mark end of header.
|
||||
(setq hbeg (point-min))))) ; Else no header.
|
||||
|
||||
;; Copy header to temp file.
|
||||
(write-region (min hbeg beg) hend tex-out-file t nil)
|
||||
|
||||
;; Copy region to temp file.
|
||||
(write-region (max beg hend) end tex-out-file t nil))
|
||||
|
||||
;; This is a kludge to insert the tex-trailer into the tex-out-file.
|
||||
;; We have to create a special buffer in which to insert
|
||||
;; the tex-trailer first because there is no function with
|
||||
;; which to append a literal string directly to a file.
|
||||
(let ((local-tex-trailer texinfo-tex-trailer))
|
||||
(set-buffer temp-buffer)
|
||||
(erase-buffer)
|
||||
;; make sure trailer isn't hidden by a comment
|
||||
(insert-string "\n")
|
||||
(if local-tex-trailer (insert-string local-tex-trailer))
|
||||
(tex-set-buffer-directory temp-buffer zap-directory)
|
||||
(write-region (point-min) (point-max) tex-out-file t nil))
|
||||
|
||||
;;; The following is sufficient in Emacs 19.
|
||||
;;; (write-region (concat "\n" texinfo-tex-trailer) nil
|
||||
;;; tex-out-file t nil)
|
||||
))
|
||||
|
||||
(tex-set-buffer-directory "*tex-shell*" zap-directory)
|
||||
(tex-send-command tex-shell-cd-command zap-directory)
|
||||
(tex-send-command texinfo-tex-command tex-out-file)
|
||||
;; alternatively:
|
||||
;; (send-string "tex-shell" (concat tex-shell-cd-command " "
|
||||
;; zap-directory "\n"))
|
||||
;; (send-string "tex-shell" (concat texinfo-tex-command " "
|
||||
;; tex-out-file "\n"))
|
||||
(tex-recenter-output-buffer 0)))
|
||||
|
||||
(defun texinfo-tex-buffer ()
|
||||
"Run TeX on visited file, once or twice, to make a correct `.dvi' file."
|
||||
(interactive)
|
||||
|
||||
;; Make sure TeX shell is running.
|
||||
(require 'tex-mode)
|
||||
(if (get-buffer "*tex-shell*")
|
||||
(quit-process (get-process "tex-shell") t)
|
||||
(tex-start-shell))
|
||||
|
||||
(cond ((null buffer-file-name)
|
||||
(error "Buffer not visiting any file!"))
|
||||
((buffer-modified-p)
|
||||
(error "Buffer has been modified since last saved!")))
|
||||
|
||||
(setq tex-zap-file buffer-file-name)
|
||||
|
||||
(tex-send-command tex-shell-cd-command (file-name-directory tex-zap-file))
|
||||
|
||||
(tex-send-command texinfo-texi2dvi-command tex-zap-file)
|
||||
|
||||
;; alternatively:
|
||||
;; (send-string "tex-shell"
|
||||
;; (concat tex-shell-cd-command
|
||||
;; " " (file-name-directory tex-zap-file) "\n"))
|
||||
;; )
|
||||
;;
|
||||
;; (send-string "tex-shell"
|
||||
;; (concat texinfo-texi2dvi-command " " tex-zap-file "\n"))
|
||||
|
||||
|
||||
(tex-recenter-output-buffer 0))
|
||||
|
||||
(defun texinfo-texindex ()
|
||||
"Run `texindex' on unsorted index files.
|
||||
The index files are made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
|
||||
This runs the shell command defined by `texinfo-texindex-command'."
|
||||
(interactive)
|
||||
(require 'tex-mode)
|
||||
(tex-send-command texinfo-texindex-command (concat tex-zap-file ".??"))
|
||||
;; alternatively
|
||||
;; (send-string "tex-shell"
|
||||
;; (concat texinfo-texindex-command
|
||||
;; " " tex-zap-file ".??" "\n"))
|
||||
(tex-recenter-output-buffer nil))
|
||||
|
||||
(defun texinfo-tex-print ()
|
||||
"Print `.dvi' file made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
|
||||
This runs the shell command defined by `tex-dvi-print-command'."
|
||||
(interactive)
|
||||
(require 'tex-mode)
|
||||
(tex-send-command tex-dvi-print-command (concat tex-zap-file ".dvi"))
|
||||
;; alternatively:
|
||||
;; (send-string "tex-shell"
|
||||
;; (concat tex-dvi-print-command
|
||||
;; " " tex-zap-file ".dvi" "\n"))
|
||||
(tex-recenter-output-buffer nil))
|
||||
|
||||
(defun texinfo-quit-job ()
|
||||
"Quit currently running TeX job, by sending an `x' to it."
|
||||
(interactive)
|
||||
(if (not (get-process "tex-shell"))
|
||||
(error "No TeX shell running"))
|
||||
(tex-send-command "x"))
|
||||
;; alternatively:
|
||||
;; save-excursion
|
||||
;; (set-buffer (get-buffer "*tex-shell*"))
|
||||
;; (goto-char (point-max))
|
||||
;; (insert "x")
|
||||
;; (comint-send-input)
|
||||
|
||||
(defun texinfo-delete-from-print-queue (job-number)
|
||||
"Delete job from the line printer spooling queue.
|
||||
You are prompted for the job number (use a number shown by a previous
|
||||
\\[tex-show-print-queue] command)."
|
||||
(interactive "nPrinter job number for deletion: ")
|
||||
(require 'tex-mode)
|
||||
(if (tex-shell-running)
|
||||
(tex-kill-job)
|
||||
(tex-start-shell))
|
||||
(tex-send-command texinfo-delete-from-print-queue-command job-number)
|
||||
;; alternatively
|
||||
;; (send-string "tex-shell"
|
||||
;; (concat
|
||||
;; texinfo-delete-from-print-queue-command
|
||||
;; " "
|
||||
;; job-number"\n"))
|
||||
(tex-recenter-output-buffer nil))
|
||||
|
||||
(provide 'texinfo)
|
||||
|
||||
;;; texinfo.el ends here
|
||||
@@ -1,346 +0,0 @@
|
||||
;;;; texnfo-tex.el
|
||||
|
||||
;;; Texinfo mode TeX and hardcopy printing commands.
|
||||
|
||||
;; These commands are for running TeX on a region of a Texinfo file in
|
||||
;; GNU Emacs, or on the whole buffer, and for printing the resulting
|
||||
;; DVI file.
|
||||
|
||||
;;; Version 2.07 22 October 1991
|
||||
;;; Robert J. Chassell
|
||||
;;; Please send bug reports to: [email protected]
|
||||
|
||||
;;; Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
;;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to
|
||||
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
|
||||
|
||||
;;; The Texinfo mode TeX related commands are:
|
||||
|
||||
; texinfo-tex-region to run tex on the current region.
|
||||
; texinfo-tex-buffer to run tex on the current buffer.
|
||||
; texinfo-texindex to sort unsorted index files.
|
||||
; texinfo-tex-print to print the .dvi file made by tex.
|
||||
; texinfo-kill-tex-job to kill the currently running tex job.
|
||||
; texinfo-recenter-tex-output-buffer to redisplay tex output buffer.
|
||||
; texinfo-show-tex-print-queue to show the print queue.
|
||||
|
||||
|
||||
;;; Keys common both to Texinfo mode and to TeX shell.
|
||||
|
||||
;; Defined in `texinfo.el'
|
||||
; (defun texinfo-define-common-keys (keymap)
|
||||
; "Define the keys both in Texinfo mode and in the texinfo-tex-shell."
|
||||
; (define-key keymap "\C-c\C-t\C-k" 'texinfo-kill-tex-job)
|
||||
; (define-key keymap "\C-c\C-t\C-x" 'texinfo-quit-tex-job)
|
||||
; (define-key keymap "\C-c\C-t\C-l" 'texinfo-recenter-tex-output-buffer)
|
||||
; (define-key keymap "\C-c\C-t\C-d" 'texinfo-delete-from-tex-print-queue)
|
||||
; (define-key keymap "\C-c\C-t\C-q" 'texinfo-show-tex-print-queue)
|
||||
; (define-key keymap "\C-c\C-t\C-p" 'texinfo-tex-print)
|
||||
; (define-key keymap "\C-c\C-t\C-i" 'texinfo-texindex)
|
||||
; (define-key keymap "\C-c\C-t\C-r" 'texinfo-tex-region)
|
||||
; (define-key keymap "\C-c\C-t\C-b" 'texinfo-tex-buffer))
|
||||
|
||||
;; See also texinfo-tex-start-shell.
|
||||
;; The following is executed in the `texinfo.el' file
|
||||
;(texinfo-define-common-keys texinfo-mode-map)
|
||||
|
||||
|
||||
;;; Variable definitions:
|
||||
|
||||
(require 'shell)
|
||||
|
||||
(defvar texinfo-tex-shell-cd-command "cd"
|
||||
"Command to give to shell running TeX to change directory.")
|
||||
|
||||
(defvar texinfo-tex-command "tex"
|
||||
"*Command used by texinfo-tex-region to run tex on a region.")
|
||||
|
||||
(defvar texinfo-texindex-command "texindex"
|
||||
"*Command used by texinfo-texindex to sort unsorted index files.")
|
||||
|
||||
(defvar texinfo-tex-dvi-print-command "lpr -d"
|
||||
"*Command string used by \\[tex-print] to print a .dvi file.")
|
||||
|
||||
(defvar texinfo-show-tex-queue-command "lpq"
|
||||
"*Command string used to show the Texinfo TeX print queue.
|
||||
Command is used by \\[texinfo-show-tex-print-queue] and it
|
||||
should show the queue that \\[texinfo-tex-print] puts jobs on.")
|
||||
|
||||
(defvar texinfo-delete-from-print-queue-command "lprm"
|
||||
"*Command string used to delete a job from the line printer queue.
|
||||
Command is used by \\[texinfo-delete-from-tex-print-queue] based on
|
||||
number provided by a previous \\[texinfo-show-tex-print-queue]
|
||||
command.")
|
||||
|
||||
(defvar texinfo-tex-trailer "@bye"
|
||||
"String appended after a region sent to TeX by texinfo-tex-region.")
|
||||
|
||||
(defvar texinfo-tex-original-file ""
|
||||
"Original name of file on which to run TeX.")
|
||||
|
||||
(defvar texinfo-tex-temp-file nil
|
||||
"Temporary file name used for text being sent as input to TeX.")
|
||||
|
||||
(defvar texinfo-tex-root-temp-file nil
|
||||
"Temporary file name used for text being sent as input to TeX.")
|
||||
|
||||
|
||||
;;; Texinfo TeX main functions
|
||||
|
||||
(defun texinfo-tex-region (beginning end)
|
||||
"Run tex on the current region.
|
||||
|
||||
A temporary file is written in the default directory, and tex is run
|
||||
in that directory. The first line of the file is copied to the
|
||||
temporary file; and if the buffer has a header, it is written to the
|
||||
temporary file before the region itself. The buffer's header is all
|
||||
lines between the strings defined by texinfo-start-of-header and
|
||||
texinfo-end-of-header inclusive. The header must start in the first 100
|
||||
lines. The value of texinfo-tex-trailer is appended to the temporary file
|
||||
after the region."
|
||||
|
||||
(interactive "r")
|
||||
(if (get-buffer "*texinfo-tex-shell*")
|
||||
(quit-process (get-process "texinfo-tex-shell") t)
|
||||
(texinfo-tex-start-shell))
|
||||
|
||||
(setq texinfo-tex-root-temp-file
|
||||
(expand-file-name
|
||||
(make-temp-name
|
||||
(prin1-to-string (read (buffer-name))))))
|
||||
|
||||
(let ((texinfo-tex-temp-file (concat texinfo-tex-root-temp-file ".tex")))
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(forward-line 100)
|
||||
(let ((search-end (point))
|
||||
(header-beginning (point-min)) (header-end (point-min)))
|
||||
(goto-char (point-min))
|
||||
;; Copy first line, the `\input texinfo' line, to temp file
|
||||
(write-region (point)
|
||||
(save-excursion (forward-line 1) (point))
|
||||
texinfo-tex-temp-file nil nil)
|
||||
;; Don't copy first line twice if region includes it.
|
||||
(forward-line 1)
|
||||
(if (< beginning (point)) (setq beginning (point)))
|
||||
;; Initialize the temp file with either the header or nothing
|
||||
(if (search-forward texinfo-start-of-header search-end t)
|
||||
(progn
|
||||
(beginning-of-line)
|
||||
(setq header-beginning (point)) ; Mark beginning of header.
|
||||
(if (search-forward texinfo-end-of-header nil t)
|
||||
(progn (beginning-of-line)
|
||||
(setq header-end (point))) ; Mark end of header.
|
||||
(setq header-beginning (point-min))))) ; Else no header.
|
||||
;; Copy header to temp file.
|
||||
(write-region
|
||||
(min header-beginning beginning )
|
||||
header-end
|
||||
texinfo-tex-temp-file t nil)
|
||||
;; Copy region to temp file.
|
||||
(write-region
|
||||
(max beginning header-end)
|
||||
end
|
||||
texinfo-tex-temp-file t nil)
|
||||
;; This is a kludge to insert the texinfo-tex-trailer into the
|
||||
;; texinfo-tex-temp-file. We have to create a special buffer
|
||||
;; in which to insert the texinfo-tex-trailer first because there is
|
||||
;; no function with which to append a literal string directly
|
||||
;; to a file.
|
||||
(let ((local-tex-trailer texinfo-tex-trailer)
|
||||
(temp-buffer (get-buffer-create " texinfo-trailer-buffer")))
|
||||
(set-buffer temp-buffer)
|
||||
(erase-buffer)
|
||||
;; make sure trailer isn't hidden by a comment
|
||||
(insert-string "\n")
|
||||
(if local-tex-trailer (insert local-tex-trailer))
|
||||
(write-region (point-min) (point-max)
|
||||
texinfo-tex-temp-file t nil)))
|
||||
(set-process-sentinel (get-process "texinfo-tex-shell")
|
||||
'texinfo-tex-shell-sentinel)
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-tex-shell-cd-command " "
|
||||
default-directory "\n"))
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-tex-command " "
|
||||
texinfo-tex-temp-file "\n "))
|
||||
(texinfo-recenter-tex-output-buffer 0)))))
|
||||
|
||||
(defun texinfo-tex-buffer (buffer)
|
||||
"Run TeX on current buffer.
|
||||
After running TeX the first time, you may have to run \\[texinfo-texindex]
|
||||
and then \\[texinfo-tex-buffer] again."
|
||||
(interactive
|
||||
(list
|
||||
;; Sometimes you put point into *texinfo-tex-shell*; this prompts
|
||||
;; you for the correct file regardless.
|
||||
(if (and
|
||||
(string= (buffer-name (current-buffer)) "*texinfo-tex-shell*")
|
||||
texinfo-tex-root-temp-file)
|
||||
(read-string (format "Run TeX on: ")
|
||||
texinfo-tex-original-file)
|
||||
(read-string (format "Run TeX on: ") (buffer-name (current-buffer))))))
|
||||
|
||||
;; Set to original buffer if in *texinfo-tex-shell*; otherwise,
|
||||
;; record name of current buffer.
|
||||
(if (string= (buffer-name (current-buffer)) "*texinfo-tex-shell*")
|
||||
(set-buffer buffer)
|
||||
(setq texinfo-tex-original-file
|
||||
(buffer-name (current-buffer))))
|
||||
|
||||
(if (get-buffer "*texinfo-tex-shell*")
|
||||
(quit-process (get-process "texinfo-tex-shell") t)
|
||||
(texinfo-tex-start-shell))
|
||||
(cond ((null buffer-file-name)
|
||||
(error "Buffer not visiting any file!"))
|
||||
((buffer-modified-p)
|
||||
(error "Buffer has been modified since last saved!"))
|
||||
(t (set-process-sentinel (get-process "texinfo-tex-shell")
|
||||
'texinfo-tex-shell-sentinel)
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-tex-shell-cd-command
|
||||
" "
|
||||
(file-name-directory
|
||||
(buffer-file-name
|
||||
(get-buffer buffer)))
|
||||
"\n"))
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-tex-command " " buffer "\n "))
|
||||
|
||||
;; so the texinfo-tex-print command works
|
||||
(setq texinfo-tex-root-temp-file
|
||||
(substring buffer 0
|
||||
(or (string-match "\\.tex" buffer)
|
||||
(length buffer))))
|
||||
|
||||
(texinfo-recenter-tex-output-buffer 0))))
|
||||
|
||||
(defun texinfo-texindex ()
|
||||
"Run texindex on unsorted index files.
|
||||
The index files are made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
|
||||
Runs the shell command defined by texinfo-texindex-command."
|
||||
(interactive)
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-texindex-command
|
||||
" " texinfo-tex-root-temp-file ".??" "\n"))
|
||||
(texinfo-recenter-tex-output-buffer nil))
|
||||
|
||||
(defun texinfo-tex-print ()
|
||||
"Print .dvi file made by \\[texinfo-tex-region] or \\[texinfo-tex-buffer].
|
||||
Runs the shell command defined by texinfo-tex-dvi-print-command."
|
||||
(interactive)
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-tex-dvi-print-command
|
||||
" " texinfo-tex-root-temp-file ".dvi" "\n"))
|
||||
(texinfo-recenter-tex-output-buffer nil))
|
||||
|
||||
|
||||
;;; Texinfo TeX utility functions
|
||||
|
||||
(defun texinfo-tex-start-shell ()
|
||||
(save-excursion
|
||||
(require 'texinfo)
|
||||
(set-buffer (make-shell "texinfo-tex-shell" "/bin/sh" nil "-v"))
|
||||
(setq texinfo-tex-shell-map (copy-keymap shell-mode-map))
|
||||
(texinfo-define-common-keys texinfo-tex-shell-map)
|
||||
(use-local-map texinfo-tex-shell-map)
|
||||
(run-hooks 'texinfo-tex-shell-hook)
|
||||
(if (zerop (buffer-size))
|
||||
(sleep-for 1))))
|
||||
|
||||
(defun texinfo-quit-tex-job ()
|
||||
"Quit currently running TeX job, by sending an `x' to it."
|
||||
(interactive)
|
||||
(if (not (get-process "texinfo-tex-shell"))
|
||||
(error "No TeX shell running."))
|
||||
(save-excursion
|
||||
(set-buffer (get-buffer "*texinfo-tex-shell*"))
|
||||
(goto-char (point-max))
|
||||
(insert "x")
|
||||
(shell-send-input)))
|
||||
|
||||
(defun texinfo-kill-tex-job ()
|
||||
"Kill the currently running TeX job."
|
||||
(interactive)
|
||||
(if (get-process "texinfo-tex-shell")
|
||||
;; Use `texinfo-tex-shell-sentinel' to restart
|
||||
;; texinfo-tex-shell after it is killed.
|
||||
(kill-process (get-process "texinfo-tex-shell"))))
|
||||
|
||||
(defun texinfo-tex-shell-sentinel (process event)
|
||||
"Restart texinfo-tex-shell after it is killed."
|
||||
(if (equal event "killed\n")
|
||||
(save-excursion
|
||||
(set-buffer "*texinfo-tex-shell*")
|
||||
(insert "\n")
|
||||
(texinfo-tex-start-shell))))
|
||||
|
||||
(defun texinfo-recenter-tex-output-buffer (linenum)
|
||||
"Redisplay buffer of TeX job output so that most recent output can be seen.
|
||||
The last line of the buffer is displayed on
|
||||
line LINE of the window, or centered if LINE is nil."
|
||||
(interactive "P")
|
||||
(let ((texinfo-tex-shell (get-buffer "*texinfo-tex-shell*"))
|
||||
(old-buffer (current-buffer)))
|
||||
(if (null texinfo-tex-shell)
|
||||
(message "No TeX output buffer")
|
||||
(pop-to-buffer texinfo-tex-shell)
|
||||
(bury-buffer texinfo-tex-shell)
|
||||
(goto-char (point-max))
|
||||
(recenter (if linenum
|
||||
(prefix-numeric-value linenum)
|
||||
(/ (window-height) 2)))
|
||||
(pop-to-buffer old-buffer)
|
||||
)))
|
||||
|
||||
(defun texinfo-show-tex-print-queue ()
|
||||
"Show the print queue that \\[texinfo-tex-print] put your job on.
|
||||
Runs the shell command defined by texinfo-show-tex-queue-command."
|
||||
(interactive)
|
||||
(if (not (texinfo-tex-shell-running-p))
|
||||
(texinfo-tex-start-shell))
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat texinfo-show-tex-queue-command "\n"))
|
||||
(texinfo-recenter-tex-output-buffer nil))
|
||||
|
||||
(defun texinfo-delete-from-tex-print-queue (job-number)
|
||||
"Delete job from the line printer spooling queue.
|
||||
You are prompted for the job number (shown by a previous
|
||||
\\[texinfo-show-tex-print-queue] command."
|
||||
(interactive "nPrinter job number for deletion: ")
|
||||
(if (texinfo-tex-shell-running-p)
|
||||
(texinfo-kill-tex-job)
|
||||
(texinfo-tex-start-shell))
|
||||
(send-string "texinfo-tex-shell"
|
||||
(concat
|
||||
texinfo-delete-from-print-queue-command
|
||||
" "
|
||||
job-number"\n"))
|
||||
(texinfo-recenter-tex-output-buffer nil))
|
||||
|
||||
(defun texinfo-tex-shell-running-p ()
|
||||
(and (get-process "texinfo-tex-shell")
|
||||
(eq (process-status (get-process "texinfo-tex-shell")) 'run)))
|
||||
|
||||
|
||||
;;; Place `provide' at end of file.
|
||||
(provide 'texnfo-tex)
|
||||
;;;;;;;;;;;;;;;; end texnfo-tex.el ;;;;;;;;;;;;;;;;
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,227 +0,0 @@
|
||||
# Makefile for texinfo/info. -*- Indented-Text -*-
|
||||
# $Id: Makefile.in,v 1.9 1996/10/01 21:44:44 karl Exp $
|
||||
#
|
||||
# Copyright (C) 1993,96 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#### Start of system configuration section. ####
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = $(srcdir):$(common)
|
||||
|
||||
common = $(srcdir)/../libtxi
|
||||
util = $(srcdir)/../util
|
||||
|
||||
CC = @CC@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
LN = ln
|
||||
RM = rm -f
|
||||
MKDIR = mkdir
|
||||
MAKEINFO= ../makeinfo/makeinfo
|
||||
|
||||
DEFS = @DEFS@
|
||||
|
||||
LDEFS = -DHANDLE_MAN_PAGES -DNAMED_FUNCTIONS=1 -DDEFAULT_INFOPATH='"$(DEFAULT_INFOPATH)"'
|
||||
|
||||
TERMLIBS = @TERMLIBS@
|
||||
LIBS = $(TERMLIBS) -L../libtxi -ltxi @LIBS@
|
||||
LOADLIBES = $(LIBS)
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CFLAGS = @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = $(exec_prefix)/bin
|
||||
# Prefix for each installed program, normally empty or `g'.
|
||||
binprefix =
|
||||
# Prefix for each installed man page, normally empty or `g'.
|
||||
manprefix =
|
||||
mandir = $(prefix)/man/man1
|
||||
manext = 1
|
||||
infodir = $(prefix)/info
|
||||
DEFAULT_INFOPATH= $(infodir):.
|
||||
|
||||
#### End of system configuration section. ####
|
||||
|
||||
SRCS = dir.c display.c echo_area.c filesys.c \
|
||||
info-utils.c info.c infodoc.c infomap.c \
|
||||
m-x.c nodes.c search.c session.c \
|
||||
signals.c terminal.c tilde.c window.c \
|
||||
xmalloc.c indices.c makedoc.c nodemenu.c \
|
||||
footnotes.c dribble.c variables.c gc.c man.c \
|
||||
clib.c
|
||||
|
||||
HDRS = display.h doc.h echo_area.h filesys.h \
|
||||
general.h getopt.h info-utils.h info.h \
|
||||
infomap.h nodes.h search.h session.h \
|
||||
signals.h termdep.h terminal.h tilde.h \
|
||||
indices.h window.h footnotes.h dribble.h \
|
||||
variables.h gc.h clib.h
|
||||
|
||||
OBJS = dir.o display.o doc.o echo_area.o filesys.o info-utils.o info.o \
|
||||
infodoc.o infomap.o m-x.o nodes.o search.o session.o signals.o \
|
||||
terminal.o tilde.o window.o indices.o xmalloc.o nodemenu.o \
|
||||
footnotes.o dribble.o variables.o gc.o man.o clib.o
|
||||
|
||||
# The names of files which declare info commands.
|
||||
CMDFILES = $(srcdir)/session.c $(srcdir)/echo_area.c $(srcdir)/infodoc.c \
|
||||
$(srcdir)/m-x.c $(srcdir)/indices.c $(srcdir)/nodemenu.c \
|
||||
$(srcdir)/footnotes.c $(srcdir)/variables.c
|
||||
|
||||
# The name of the program which builds documentation structure from CMDFILES.
|
||||
MAKEDOC_OBJECTS = makedoc.o clib.o xmalloc.o
|
||||
MAKEDOC_SOURCE = makedoc.c clib.c xmalloc.c
|
||||
|
||||
infofiles = info.info info-stnd.info
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CPPFLAGS) $(LDEFS) $(DEFS) -I. -I$(srcdir) -I$(common) $(CFLAGS) $<
|
||||
|
||||
all: info $(infofiles)
|
||||
sub-all: all
|
||||
|
||||
install: all
|
||||
$(INSTALL_PROGRAM) info $(bindir)/$(binprefix)info
|
||||
-d=$(srcdir); test -f ./info.info && d=.; $(INSTALL_DATA) $$d/info.info $(infodir)/info.info
|
||||
-d=$(srcdir); test -f ./info-stnd.info && d=.; $(INSTALL_DATA) $$d/info-stnd.info $(infodir)/info-stnd.info
|
||||
-$(INSTALL_DATA) $(srcdir)/info.1 $(mandir)/$(manprefix)info.$(manext)
|
||||
$(POST_INSTALL)
|
||||
../util/install-info --info-dir=$(infodir) $(infodir)/info.info
|
||||
../util/install-info --info-dir=$(infodir) $(infodir)/info-stnd.info
|
||||
|
||||
uninstall:
|
||||
$(RM) $(bindir)/info
|
||||
$(RM) $(infodir)/info.info
|
||||
$(RM) $(infodir)/info-stnd.info
|
||||
$(RM) $(mandir)/$(manprefix)info.$(manext)
|
||||
|
||||
info: $(OBJS) ../libtxi/libtxi.a
|
||||
$(CC) $(LDFLAGS) -o info $(OBJS) $(LOADLIBES)
|
||||
|
||||
all-info: info.info info-stnd.info
|
||||
|
||||
info.info: info.texi
|
||||
$(MAKEINFO) --no-split -I$(srcdir) info.texi
|
||||
|
||||
info-stnd.info: info-stnd.texi
|
||||
$(MAKEINFO) --no-split -I$(srcdir) info-stnd.texi
|
||||
|
||||
dvi all-dvi: info.dvi info-stnd.dvi
|
||||
info.dvi: info.texi
|
||||
PATH="$(util):$${PATH}" TEXINPUTS="$(srcdir):$(common):$${TEXINPUTS}" texi2dvi $(srcdir)/info.texi
|
||||
|
||||
info-stnd.dvi: info-stnd.texi
|
||||
PATH="$(util):$${PATH}" TEXINPUTS="$(srcdir):$(common):$${TEXINPUTS}" texi2dvi $(srcdir)/info-stnd.texi
|
||||
|
||||
makedoc: $(MAKEDOC_OBJECTS) ../libtxi/libtxi.a
|
||||
$(CC) $(LDFLAGS) -o makedoc $(MAKEDOC_OBJECTS) $(LOADLIBES)
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in ../config.status
|
||||
cd ..; sh config.status
|
||||
|
||||
clean:
|
||||
$(RM) info funs.h doc.c makedoc $(OBJS) $(MAKEDOC_OBJECTS)
|
||||
|
||||
distclean: clean texclean
|
||||
$(RM) Makefile config.status config.cache *~ core core.* *.core
|
||||
$(RM) *.BAK makedoc-TAGS TAGS \#* *.info*
|
||||
|
||||
mostlyclean: clean
|
||||
|
||||
realclean: distclean
|
||||
$(RM) info.info info-stnd.info
|
||||
|
||||
TAGS: $(SRCS) makedoc-TAGS
|
||||
etags $(SRCS)
|
||||
cat makedoc-TAGS >>TAGS && $(RM) makedoc-TAGS
|
||||
|
||||
makedoc-TAGS: $(CMDFILES)
|
||||
./makedoc -tags $(CMDFILES) >makedoc-TAGS
|
||||
|
||||
texclean:
|
||||
$(RM) *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky *.cps
|
||||
$(RM) *.tps *.fns *.kys *.pgs *.vrs
|
||||
|
||||
check: info
|
||||
|
||||
# The files `doc.c' and `funs.h' are created by ./makedoc run over the source
|
||||
# files which contain DECLARE_INFO_COMMAND. `funs.h' is a header file
|
||||
# listing the functions found. `doc.c' is a structure containing pointers
|
||||
# to those functions along with completable names and documentation strings.
|
||||
funs.h: makedoc $(CMDFILES)
|
||||
-@if test -f funs.h; then mv -f funs.h old-funs.h; fi; :
|
||||
-@if test -f doc.c; then mv -f doc.c old-doc.c; fi; :
|
||||
./makedoc $(CMDFILES)
|
||||
-@if cmp -s old-funs.h funs.h; then mv old-funs.h funs.h; \
|
||||
else $(RM) old-funs.h; fi; :
|
||||
-@if cmp -s old-doc.c doc.c; then mv old-doc.c doc.c; \
|
||||
else $(RM) old-doc.c; fi; :
|
||||
|
||||
doc.c: funs.h
|
||||
dribble.o: dribble.c dribble.h
|
||||
display.o: display.c
|
||||
echo_area.o: echo_area.c
|
||||
filesys.o: filesys.c
|
||||
info-utils.o: info-utils.c
|
||||
info.o: info.c filesys.h
|
||||
infodoc.o: infodoc.c
|
||||
infomap.o: infomap.c
|
||||
m-x.o: m-x.c
|
||||
nodes.o: nodes.c
|
||||
search.o: search.c
|
||||
session.o: session.c
|
||||
signals.o: signals.c
|
||||
terminal.o: terminal.c
|
||||
tilde.o: tilde.c
|
||||
window.o: window.c
|
||||
xmalloc.o: xmalloc.c
|
||||
indices.o: indices.c
|
||||
makedoc.o: makedoc.c
|
||||
|
||||
dir.o: dir.c
|
||||
display.o: nodes.h info-utils.h search.h
|
||||
display.o: terminal.h window.h display.h
|
||||
echo_area.o: info.h
|
||||
filesys.o: general.h tilde.h filesys.h
|
||||
footnotes.o: footnotes.h
|
||||
info-utils.o: info-utils.h nodes.h search.h
|
||||
info.o: info.h $(common)/getopt.h
|
||||
infodoc.o: info.h doc.h
|
||||
infomap.o: infomap.h funs.h
|
||||
gc.o: info.h
|
||||
m-x.o: info.h
|
||||
nodes.o: search.h filesys.h
|
||||
nodes.o: nodes.h info-utils.h
|
||||
search.o: general.h search.h nodes.h
|
||||
session.o: info.h
|
||||
signals.o: info.h signals.h
|
||||
terminal.o: terminal.h termdep.h
|
||||
tilde.o: tilde.h
|
||||
variables.c: variables.h
|
||||
window.o: nodes.h window.h display.h
|
||||
window.o: info-utils.h search.h infomap.h
|
||||
|
||||
# Prevent GNU make v3 from overflowing arg limit on SysV.
|
||||
.NOEXPORT:
|
||||
|
||||
# eof
|
||||
@@ -1,200 +0,0 @@
|
||||
This release of Info is version 2.11. Please read the file README.
|
||||
|
||||
Version 2.11, Sat Apr 1 09:15:21 1995
|
||||
|
||||
Changes since 2.7 beta:
|
||||
|
||||
Although the basic code remains the same, there are numerous nits
|
||||
fixed, including some display bugs, and a memory leak. Some changes
|
||||
that have taken place with larger impact include the way in which the
|
||||
(dir) node is built; I have added in support for "localdir"
|
||||
directories among other things. Info files may be stored in
|
||||
compressed formats, and in their own subdirectories; menu items which
|
||||
do not explicitly name the node to which they are attached have the
|
||||
menu item name looked up as an Info file if it is not found within the
|
||||
current document. This means that the menu item:
|
||||
|
||||
* Info:: The Info documentation reader.
|
||||
|
||||
in (dir) refers to the info node "(info)Top".
|
||||
|
||||
Please see the ChangeLog and documentation for details on other
|
||||
changes.
|
||||
|
||||
Version 2.7 beta, Wed Dec 30 02:02:38 1992
|
||||
Version 2.6 beta, Tue Dec 22 03:58:07 1992
|
||||
Version 2.5 beta, Tue Dec 8 14:50:35 1992
|
||||
Version 2.4 beta, Sat Nov 28 14:34:02 1992
|
||||
Version 2.3 beta, Fri Nov 27 01:04:13 1992
|
||||
Version 2.2 beta, Tue Nov 24 09:36:08 1992
|
||||
Version 2.1 beta, Tue Nov 17 23:29:36 1992
|
||||
|
||||
Changes since 2.5 beta:
|
||||
|
||||
Note that versions 2.6 and 2.7 Beta were only released to a select group.
|
||||
|
||||
* "info-" removed from the front of M-x commands.
|
||||
|
||||
* Automatic footnote display. When you enter a node which contains
|
||||
footnotes, and the variable "automatic-footnotes" is "On", Info pops
|
||||
up a window containing the footnotes. Likewise, when you leave that
|
||||
node, the window containing the footnotes goes away.
|
||||
|
||||
* Cleaner built in documentation, and documentation functions.
|
||||
|
||||
Use:
|
||||
o `M-x describe-variable' to read a variable's documenation
|
||||
o `M-x describe-key' to find out what a particular keystroke does.
|
||||
o `M-x describe-function' to read a function's documentation.
|
||||
o `M-x where-is' to find out what keys invoke a particular function.
|
||||
|
||||
* Info can "tile" the displayed windows (via "M-x tile-windows"). If
|
||||
the variable "automatic-tiling" is "On", then splitting a window or
|
||||
deleting a window causes the remaining windows to be retiled.
|
||||
|
||||
* You can save every keystroke you type in a "dribble file" by using the
|
||||
`--dribble FILENAME' option. You can initially read keystrokes from an
|
||||
alternate input stream with `--restore FILENAME', or by redirecting
|
||||
input on the command line `info < old-dribble'.
|
||||
|
||||
* New behaviour of menu items. If the label is the same as the
|
||||
target node name, and the node couldn't be found in the current file,
|
||||
treat the label as a file name. For example, a menu entry in "DIR"
|
||||
might contain:
|
||||
|
||||
* Emacs:: Cool text-editor.
|
||||
|
||||
Info would not find the node "(dir)Emacs", so just plain "(emacs)"
|
||||
would be tried.
|
||||
|
||||
* New variable "ISO-Latin" allows you to use European machines with
|
||||
8-bit character sets.
|
||||
|
||||
* Cleanups in echo area reading, and redisplay. Cleanups in handling the
|
||||
window which shows possible completions.
|
||||
|
||||
* Info can now read files that have been compressed. An array in filesys.c
|
||||
maps extensions to programs that can decompress stdin, and write the results
|
||||
to stdout. Currently, ".Z"/uncompress, ".z"/gunzip, and ".Y"/unyabba are
|
||||
supported. The modeline for a compressed file shows "zz" in it.
|
||||
|
||||
* There is a new variable "gc-compressed-files" which, if non-zero, says
|
||||
it is okay to reclaim the file buffer space allocated to a file which
|
||||
was compressed, if, and only if, that file's contents do not appear in
|
||||
any history node.
|
||||
|
||||
* New file `nodemenu.c' implements a few functions for manipulating
|
||||
previously visited nodes. `C-x C-b' (list-visited-nodes) produces a
|
||||
menu of the nodes that could be reached by info-history-node in some
|
||||
window. `C-x b' (select-visited-node) is similar, but reads one of
|
||||
the node names with completion.
|
||||
|
||||
* Keystroke `M-r' (move_to_screen_line) allows the user to place the cursor at
|
||||
the start of a specific screen line. Without a numeric argument, place the
|
||||
cursor on the center line; with an arg, place the cursor on that line.
|
||||
|
||||
* Interruptible display implemented. Basic display speedups and hacks.
|
||||
* The message "*** Tags Out of Date ***" now means what it says.
|
||||
* Index searching with `,' (info-index-next) has been improved.
|
||||
* When scrolling with C-v, C-M-v, or M-v, only "Page Only" scrolling
|
||||
will happen.
|
||||
|
||||
* Continous scrolling (along with `]' (info-global-next) and `['
|
||||
(info-global-prev) works better. `]' and `[' accept numeric
|
||||
arguments, moving that many nodes in that case.
|
||||
|
||||
* `C-x w' (info-toggle-wrap) controls how lines wider than the width
|
||||
of the screen are displayed. If a line is too long, a `$' is
|
||||
displayed in the rightmost column of the window.
|
||||
|
||||
* There are some new variables for controlling the behaviour of Info
|
||||
interactively. The current list of variables is as follows:
|
||||
|
||||
Variable Name Default Value Description
|
||||
------------- ------------- -----------
|
||||
`automatic-footnotes' On When "On", footnotes appear and
|
||||
disappear automatically.
|
||||
|
||||
`automatic-tiling' Off When "On", creating of deleting a
|
||||
window resizes other windows.
|
||||
|
||||
`visible-bell' Off If non-zero, try to use a visible bell.
|
||||
|
||||
`errors-ring-bell' On If non-zero, errors cause a ring.
|
||||
|
||||
`show-index-match' On If non-zero, the portion of the string
|
||||
matched is highlighted by changing its
|
||||
case.
|
||||
|
||||
`scroll-behaviour' Continuous One of "Continuous", "Next Only", or
|
||||
"Page Only". "Page Only" prevents you from
|
||||
scrolling past the bottom or top of a node.
|
||||
"Next Only" causes the Next or Prev node to
|
||||
be selected when you scroll past the bottom
|
||||
or top of a node. "Continous" moves
|
||||
linearly through the files hierchichal
|
||||
structure.
|
||||
|
||||
`scroll-step' 0 Controls how scrolling is done for you when
|
||||
the cursor moves out of the current window.
|
||||
Non-zero means it is the number of lines
|
||||
you would like the screen to shift. A
|
||||
value of 0 means to center the line
|
||||
containing the cursor in the window.
|
||||
|
||||
`gc-compressed-files' Off If non-zero means it is okay to reclaim the
|
||||
file buffer space allocated to a file which
|
||||
was compressed, if, and only if, that
|
||||
file's contents do not appear in the node
|
||||
list of any window.
|
||||
|
||||
`ISO-Latin' Off Non-zero means that you are using an ISO
|
||||
Latin character set. By default, standard
|
||||
ASCII characters are assumed.
|
||||
________________________________________
|
||||
This release of Info is version 2.5 beta.
|
||||
|
||||
Changes since 2.4 beta:
|
||||
|
||||
* Index (i) and (,) commands fully implemented.
|
||||
* "configure" script now shipped with Info.
|
||||
* New function "set-variable" allows users to set various variables.
|
||||
* User-settable behaviour on end or beginning of node scrolling. This
|
||||
supercedes the SPC and DEL changes in 2.3 beta.
|
||||
|
||||
________________________________________
|
||||
This release of Info is version 2.4 beta.
|
||||
|
||||
Changes since 2.3 beta:
|
||||
|
||||
* info-last-node now means move to the last node of this info file.
|
||||
* info-history-node means move backwards through this window's node history.
|
||||
* info-first-node moves to the first node in the Info file. This node is
|
||||
not necessarily "Top"!
|
||||
* SPC and DEL can select the Next or Prev node after printing an informative
|
||||
message when pressed at the end/beg of a node.
|
||||
|
||||
----------------------------------------
|
||||
This release of Info is version 2.3 beta.
|
||||
|
||||
Changes since 2.2 beta:
|
||||
|
||||
* M-x command lines if NAMED_COMMANDS is #defined. Variable in Makefile.
|
||||
* Screen height changes made quite robust.
|
||||
* Interactive function "set-screen-height" implements user height changes.
|
||||
* Scrolling on some terminals is faster now.
|
||||
* C-l with numeric arguement is fixed.
|
||||
|
||||
----------------------------------------
|
||||
This release of Info is version 2.2 beta.
|
||||
|
||||
Changes since 2.0:
|
||||
|
||||
* C-g can now interrupt multi-file searches.
|
||||
* Incremental search is fully implemented.
|
||||
* Loading large tag tables is much faster now.
|
||||
* makedoc.c replaces shell script, speeding incremental builds.
|
||||
* Scrolling in redisplay is implemented.
|
||||
* Recursive uses of the echo area made more robust.
|
||||
* Garbage collection of unreferenced nodes.
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
The file NEWS contains information about what has changed since the last
|
||||
release.
|
||||
|
||||
The file ../INSTALL contains instructions on how to install Info.
|
||||
|
||||
|
||||
Info 2.0 is a complete rewrite of the original standalone Info I wrote in
|
||||
1987, the first program I wrote for rms. That program was something like
|
||||
my second Unix program ever, and my die-hard machine language coding habits
|
||||
tended to show through. I found the original Info hard to read and
|
||||
maintain, and thus decided to write this one.
|
||||
|
||||
The rewrite consists of about 12,000 lines of code written in about 12
|
||||
days. I believe this version of Info to be in much better shape than the
|
||||
original Info, and the only reason it is in Beta test is because of its
|
||||
short life span.
|
||||
|
||||
Info 2.0 is substantially different from its original standalone
|
||||
predecessor. It appears almost identical to the GNU Emacs version, but has
|
||||
the advantages of smaller size, ease of portability, and a built in library
|
||||
which can be used in other programs (to get or display documentation from
|
||||
Info files, for example).
|
||||
|
||||
I eagerly await responses to this newer version of Info; comments on its
|
||||
portability, ease of use and user interface, code quality, and general
|
||||
usefulness are all of interest to me, and I will appreciate any comments
|
||||
that you would care to make.
|
||||
|
||||
A full listing of the commands available in Info can be gotten by typing
|
||||
`?' while within an Info window. This produces a node in a window which
|
||||
can be viewed just like any Info node.
|
||||
|
||||
Please send your comments, bug reports, and suggestions to
|
||||
|
||||
[email protected]
|
||||
|
||||
--Brian Fox <[email protected]>
|
||||
@@ -1,112 +0,0 @@
|
||||
/* clib.c: Functions which we normally expect to find in the C library.
|
||||
$Id: clib.c,v 1.2 1996/10/03 16:58:31 karl Exp $
|
||||
|
||||
This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox ([email protected]). */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined (HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STDLIB_H)
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if defined (HAVE_STRING_H)
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include <sys/errno.h>
|
||||
|
||||
extern void *xmalloc (), *xrealloc ();
|
||||
#include "general.h"
|
||||
|
||||
#if !defined (errno)
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_STRERROR)
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
|
||||
char *
|
||||
strerror (num)
|
||||
int num;
|
||||
{
|
||||
if (num >= sys_nerr)
|
||||
return ("");
|
||||
else
|
||||
return (sys_errlist[num]);
|
||||
}
|
||||
#endif /* !HAVE_STRERROR */
|
||||
|
||||
#if !defined (HAVE_STRCASECMP)
|
||||
/* This Unix doesn't have the strcasecmp () function. */
|
||||
int
|
||||
strcasecmp (string1, string2)
|
||||
char *string1, *string2;
|
||||
{
|
||||
char ch1, ch2;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
ch1 = *string1++;
|
||||
ch2 = *string2++;
|
||||
|
||||
if (!(ch1 | ch2))
|
||||
return (0);
|
||||
|
||||
ch1 = info_toupper (ch1);
|
||||
ch2 = info_toupper (ch2);
|
||||
|
||||
if (ch1 != ch2)
|
||||
return (ch1 - ch2);
|
||||
}
|
||||
}
|
||||
|
||||
/* Compare at most COUNT characters from string1 to string2. Case
|
||||
doesn't matter. */
|
||||
int
|
||||
strncasecmp (string1, string2, count)
|
||||
char *string1, *string2;
|
||||
int count;
|
||||
{
|
||||
register char ch1, ch2;
|
||||
|
||||
while (count)
|
||||
{
|
||||
ch1 = *string1++;
|
||||
ch2 = *string2++;
|
||||
|
||||
ch1 = info_toupper (ch1);
|
||||
ch2 = info_toupper (ch2);
|
||||
|
||||
if (ch1 == ch2)
|
||||
count--;
|
||||
else
|
||||
break;
|
||||
}
|
||||
return (count);
|
||||
}
|
||||
#endif /* !STRCASECMP */
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/* clib.h: Declarations of functions which appear in clib.c (or libc.a). */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox ([email protected]). */
|
||||
|
||||
#if !defined (_CLIB_H_)
|
||||
#define _CLIB_H_
|
||||
|
||||
#if !defined (HAVE_STRDUP)
|
||||
extern char *strdup ();
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_STRERROR)
|
||||
extern char *strerror ();
|
||||
#endif
|
||||
|
||||
#if !defined (HAVE_STRCASECMP)
|
||||
extern int strcasecmp ();
|
||||
extern int strncasecmp ();
|
||||
#endif
|
||||
|
||||
#endif /* !_CLIB_H_ */
|
||||
|
||||
|
||||
@@ -1,273 +0,0 @@
|
||||
/* dir.c -- How to build a special "dir" node from "localdir" files. */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox ([email protected]). */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#if defined (HAVE_SYS_FILE_H)
|
||||
#include <sys/file.h>
|
||||
#endif /* HAVE_SYS_FILE_H */
|
||||
#include <sys/errno.h>
|
||||
#include "info-utils.h"
|
||||
#include "filesys.h"
|
||||
#include "tilde.h"
|
||||
|
||||
/* The "dir" node can be built from the contents of a file called "dir",
|
||||
with the addition of the menus of every file named in the array
|
||||
dirs_to_add which are found in INFOPATH. */
|
||||
|
||||
static void add_menu_to_file_buffer (), insert_text_into_fb_at_binding ();
|
||||
static void build_dir_node_internal ();
|
||||
|
||||
static char *dirs_to_add[] = {
|
||||
"dir", "localdir", (char *)NULL
|
||||
};
|
||||
|
||||
void
|
||||
maybe_build_dir_node (dirname)
|
||||
char *dirname;
|
||||
{
|
||||
FILE_BUFFER *dir_buffer;
|
||||
int path_index, update_tags;
|
||||
char *this_dir;
|
||||
|
||||
/* Check to see if the file has already been built. If so, then
|
||||
do not build it again. */
|
||||
dir_buffer = info_find_file (dirname);
|
||||
|
||||
/* If there is no "dir" in the current info path, we cannot build one
|
||||
from nothing. */
|
||||
if (!dir_buffer)
|
||||
return;
|
||||
|
||||
/* If this directory has already been built, return now. */
|
||||
if (dir_buffer->flags & N_CannotGC)
|
||||
return;
|
||||
|
||||
path_index = update_tags = 0;
|
||||
|
||||
/* Using each element of the path, check for one of the files in
|
||||
DIRS_TO_ADD. Do not check for "localdir.info.Z" or anything else.
|
||||
Only files explictly named are eligible. This is a design decision.
|
||||
There can be an info file name "localdir.info" which contains
|
||||
information on the setting up of "localdir" files. */
|
||||
while (this_dir = extract_colon_unit (infopath, &path_index))
|
||||
{
|
||||
register int da_index;
|
||||
char *from_file;
|
||||
|
||||
/* Expand a leading tilde if one is present. */
|
||||
if (*this_dir == '~')
|
||||
{
|
||||
char *tilde_expanded_dirname;
|
||||
|
||||
tilde_expanded_dirname = tilde_expand_word (this_dir);
|
||||
if (tilde_expanded_dirname != this_dir)
|
||||
{
|
||||
free (this_dir);
|
||||
this_dir = tilde_expanded_dirname;
|
||||
}
|
||||
}
|
||||
|
||||
/* For every file named in DIRS_TO_ADD found in the search path,
|
||||
add the contents of that file's menu to our "dir" node. */
|
||||
for (da_index = 0; from_file = dirs_to_add[da_index]; da_index++)
|
||||
{
|
||||
struct stat finfo;
|
||||
char *fullpath;
|
||||
int namelen, statable;
|
||||
|
||||
namelen = strlen (from_file);
|
||||
|
||||
fullpath = (char *)xmalloc (3 + strlen (this_dir) + namelen);
|
||||
strcpy (fullpath, this_dir);
|
||||
if (fullpath[strlen (fullpath) - 1] != '/')
|
||||
strcat (fullpath, "/");
|
||||
strcat (fullpath, from_file);
|
||||
|
||||
statable = (stat (fullpath, &finfo) == 0);
|
||||
|
||||
/* Only add the contents of this file if it is not identical to the
|
||||
file of the DIR buffer. */
|
||||
if ((statable && S_ISREG (finfo.st_mode)) &&
|
||||
(strcmp (dir_buffer->fullpath, fullpath) != 0))
|
||||
{
|
||||
long filesize;
|
||||
char *contents;
|
||||
|
||||
contents = filesys_read_info_file (fullpath, &filesize, &finfo);
|
||||
|
||||
if (contents)
|
||||
{
|
||||
update_tags++;
|
||||
add_menu_to_file_buffer (contents, filesize, dir_buffer);
|
||||
free (contents);
|
||||
}
|
||||
}
|
||||
|
||||
free (fullpath);
|
||||
}
|
||||
free (this_dir);
|
||||
}
|
||||
|
||||
if (update_tags)
|
||||
build_tags_and_nodes (dir_buffer);
|
||||
|
||||
/* Flag that the dir buffer has been built. */
|
||||
dir_buffer->flags |= N_CannotGC;
|
||||
}
|
||||
|
||||
/* Given CONTENTS and FB (a file buffer), add the menu found in CONTENTS
|
||||
to the menu found in FB->contents. Second argument SIZE is the total
|
||||
size of CONTENTS. */
|
||||
static void
|
||||
add_menu_to_file_buffer (contents, size, fb)
|
||||
char *contents;
|
||||
long size;
|
||||
FILE_BUFFER *fb;
|
||||
{
|
||||
SEARCH_BINDING contents_binding, fb_binding;
|
||||
long contents_offset, fb_offset;
|
||||
|
||||
contents_binding.buffer = contents;
|
||||
contents_binding.start = 0;
|
||||
contents_binding.end = size;
|
||||
contents_binding.flags = S_FoldCase | S_SkipDest;
|
||||
|
||||
fb_binding.buffer = fb->contents;
|
||||
fb_binding.start = 0;
|
||||
fb_binding.end = fb->filesize;
|
||||
fb_binding.flags = S_FoldCase | S_SkipDest;
|
||||
|
||||
/* Move to the start of the menus in CONTENTS and FB. */
|
||||
contents_offset = search_forward (INFO_MENU_LABEL, &contents_binding);
|
||||
fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding);
|
||||
|
||||
/* If there is no menu in CONTENTS, quit now. */
|
||||
if (contents_offset == -1)
|
||||
return;
|
||||
|
||||
/* There is a menu in CONTENTS, and contents_offset points to the first
|
||||
character following the menu starter string. Skip all whitespace
|
||||
and newline characters. */
|
||||
contents_offset += skip_whitespace_and_newlines (contents + contents_offset);
|
||||
|
||||
/* If there is no menu in FB, make one. */
|
||||
if (fb_offset == -1)
|
||||
{
|
||||
/* Find the start of the second node in this file buffer. If there
|
||||
is only one node, we will be adding the contents to the end of
|
||||
this node. */
|
||||
fb_offset = find_node_separator (&fb_binding);
|
||||
|
||||
/* If not even a single node separator, give up. */
|
||||
if (fb_offset == -1)
|
||||
return;
|
||||
|
||||
fb_binding.start = fb_offset;
|
||||
fb_binding.start +=
|
||||
skip_node_separator (fb_binding.buffer + fb_binding.start);
|
||||
|
||||
/* Try to find the next node separator. */
|
||||
fb_offset = find_node_separator (&fb_binding);
|
||||
|
||||
/* If found one, consider that the start of the menu. Otherwise, the
|
||||
start of this menu is the end of the file buffer (i.e., fb->size). */
|
||||
if (fb_offset != -1)
|
||||
fb_binding.start = fb_offset;
|
||||
else
|
||||
fb_binding.start = fb_binding.end;
|
||||
|
||||
insert_text_into_fb_at_binding
|
||||
(fb, &fb_binding, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL));
|
||||
|
||||
fb_binding.buffer = fb->contents;
|
||||
fb_binding.start = 0;
|
||||
fb_binding.end = fb->filesize;
|
||||
fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding);
|
||||
if (fb_offset == -1)
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* CONTENTS_OFFSET and FB_OFFSET point to the starts of the menus that
|
||||
appear in their respective buffers. Add the remainder of CONTENTS
|
||||
to the end of FB's menu. */
|
||||
fb_binding.start = fb_offset;
|
||||
fb_offset = find_node_separator (&fb_binding);
|
||||
if (fb_offset != -1)
|
||||
fb_binding.start = fb_offset;
|
||||
else
|
||||
fb_binding.start = fb_binding.end;
|
||||
|
||||
/* Leave exactly one blank line between directory entries. */
|
||||
{
|
||||
int num_found = 0;
|
||||
|
||||
while ((fb_binding.start > 0) &&
|
||||
(whitespace_or_newline (fb_binding.buffer[fb_binding.start - 1])))
|
||||
{
|
||||
num_found++;
|
||||
fb_binding.start--;
|
||||
}
|
||||
|
||||
/* Optimize if possible. */
|
||||
if (num_found >= 2)
|
||||
{
|
||||
fb_binding.buffer[fb_binding.start++] = '\n';
|
||||
fb_binding.buffer[fb_binding.start++] = '\n';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Do it the hard way. */
|
||||
insert_text_into_fb_at_binding (fb, &fb_binding, "\n\n", 2);
|
||||
fb_binding.start += 2;
|
||||
}
|
||||
}
|
||||
|
||||
/* Insert the new menu. */
|
||||
insert_text_into_fb_at_binding
|
||||
(fb, &fb_binding, contents + contents_offset, size - contents_offset);
|
||||
}
|
||||
|
||||
static void
|
||||
insert_text_into_fb_at_binding (fb, binding, text, textlen)
|
||||
FILE_BUFFER *fb;
|
||||
SEARCH_BINDING *binding;
|
||||
char *text;
|
||||
int textlen;
|
||||
{
|
||||
char *contents;
|
||||
long start, end;
|
||||
|
||||
start = binding->start;
|
||||
end = fb->filesize;
|
||||
|
||||
contents = (char *)xmalloc (fb->filesize + textlen + 1);
|
||||
memcpy (contents, fb->contents, start);
|
||||
memcpy (contents + start, text, textlen);
|
||||
memcpy (contents + start + textlen, fb->contents + start, end - start);
|
||||
free (fb->contents);
|
||||
fb->contents = contents;
|
||||
fb->filesize += textlen;
|
||||
fb->finfo.st_size = fb->filesize;
|
||||
}
|
||||
@@ -1,561 +0,0 @@
|
||||
/* display.c -- How to display Info windows. */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox ([email protected]). */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "display.h"
|
||||
|
||||
extern int info_any_buffered_input_p (); /* Found in session.c. */
|
||||
|
||||
static void free_display ();
|
||||
static DISPLAY_LINE **make_display ();
|
||||
|
||||
/* An array of display lines which tell us what is currently visible on
|
||||
the display. */
|
||||
DISPLAY_LINE **the_display = (DISPLAY_LINE **)NULL;
|
||||
|
||||
/* Non-zero means do no output. */
|
||||
int display_inhibited = 0;
|
||||
|
||||
/* Initialize THE_DISPLAY to WIDTH and HEIGHT, with nothing in it. */
|
||||
void
|
||||
display_initialize_display (width, height)
|
||||
int width, height;
|
||||
{
|
||||
free_display (the_display);
|
||||
the_display = make_display (width, height);
|
||||
display_clear_display (the_display);
|
||||
}
|
||||
|
||||
/* Clear all of the lines in DISPLAY making the screen blank. */
|
||||
void
|
||||
display_clear_display (display)
|
||||
DISPLAY_LINE **display;
|
||||
{
|
||||
register int i;
|
||||
register DISPLAY_LINE *display_line;
|
||||
|
||||
for (i = 0; display_line = display[i]; i++)
|
||||
{
|
||||
display[i]->text[0] = '\0';
|
||||
display[i]->textlen = 0;
|
||||
display[i]->inverse = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Non-zero if we didn't completely redisplay a window. */
|
||||
int display_was_interrupted_p = 0;
|
||||
|
||||
/* Update the windows pointed to by WINDOW in the_display. This actually
|
||||
writes the text on the screen. */
|
||||
void
|
||||
display_update_display (window)
|
||||
WINDOW *window;
|
||||
{
|
||||
register WINDOW *win;
|
||||
|
||||
display_was_interrupted_p = 0;
|
||||
|
||||
/* For every window in the list, check contents against the display. */
|
||||
for (win = window; win; win = win->next)
|
||||
{
|
||||
/* Only re-display visible windows which need updating. */
|
||||
if (((win->flags & W_WindowVisible) == 0) ||
|
||||
((win->flags & W_UpdateWindow) == 0) ||
|
||||
(win->height == 0))
|
||||
continue;
|
||||
|
||||
display_update_one_window (win);
|
||||
if (display_was_interrupted_p)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Always update the echo area. */
|
||||
display_update_one_window (the_echo_area);
|
||||
}
|
||||
|
||||
/* Display WIN on the_display. Unlike display_update_display (), this
|
||||
function only does one window. */
|
||||
void
|
||||
display_update_one_window (win)
|
||||
WINDOW *win;
|
||||
{
|
||||
register char *nodetext; /* Current character to display. */
|
||||
register char *last_node_char; /* Position of the last character in node. */
|
||||
register int i; /* General use index. */
|
||||
char *printed_line; /* Buffer for a printed line. */
|
||||
int pl_index = 0; /* Index into PRINTED_LINE. */
|
||||
int line_index = 0; /* Number of lines done so far. */
|
||||
DISPLAY_LINE **display = the_display;
|
||||
|
||||
/* If display is inhibited, that counts as an interrupted display. */
|
||||
if (display_inhibited)
|
||||
display_was_interrupted_p = 1;
|
||||
|
||||
/* If the window has no height, or display is inhibited, quit now. */
|
||||
if (!win->height || display_inhibited)
|
||||
return;
|
||||
|
||||
/* If the window's first row doesn't appear in the_screen, then it
|
||||
cannot be displayed. This can happen when the_echo_area is the
|
||||
window to be displayed, and the screen has shrunk to less than one
|
||||
line. */
|
||||
if ((win->first_row < 0) || (win->first_row > the_screen->height))
|
||||
return;
|
||||
|
||||
/* Print each line in the window into our local buffer, and then
|
||||
check the contents of that buffer against the display. If they
|
||||
differ, update the display. */
|
||||
printed_line = (char *)xmalloc (1 + win->width);
|
||||
|
||||
if (!win->node || !win->line_starts)
|
||||
goto done_with_node_display;
|
||||
|
||||
nodetext = win->line_starts[win->pagetop];
|
||||
last_node_char = win->node->contents + win->node->nodelen;
|
||||
|
||||
for (; nodetext < last_node_char; nodetext++)
|
||||
{
|
||||
char *rep, *rep_carried_over, rep_temp[2];
|
||||
int replen;
|
||||
|
||||
if (isprint (*nodetext))
|
||||
{
|
||||
rep_temp[0] = *nodetext;
|
||||
replen = 1;
|
||||
rep_temp[1] = '\0';
|
||||
rep = rep_temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*nodetext == '\r' || *nodetext == '\n')
|
||||
{
|
||||
replen = win->width - pl_index;
|
||||
}
|
||||
else
|
||||
{
|
||||
rep = printed_representation (*nodetext, pl_index);
|
||||
replen = strlen (rep);
|
||||
}
|
||||
}
|
||||
|
||||
/* If this character can be printed without passing the width of
|
||||
the line, then stuff it into the line. */
|
||||
if (replen + pl_index < win->width)
|
||||
{
|
||||
/* Optimize if possible. */
|
||||
if (replen == 1)
|
||||
{
|
||||
printed_line[pl_index++] = *rep;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < replen; i++)
|
||||
printed_line[pl_index++] = rep[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPLAY_LINE *entry;
|
||||
|
||||
/* If this character cannot be printed in this line, we have
|
||||
found the end of this line as it would appear on the screen.
|
||||
Carefully print the end of the line, and then compare. */
|
||||
if (*nodetext == '\n' || *nodetext == '\r' || *nodetext == '\t')
|
||||
{
|
||||
printed_line[pl_index] = '\0';
|
||||
rep_carried_over = (char *)NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The printed representation of this character extends into
|
||||
the next line. Remember the offset of the last character
|
||||
printed out of REP so that we can carry the character over
|
||||
to the next line. */
|
||||
for (i = 0; pl_index < (win->width - 1);)
|
||||
printed_line[pl_index++] = rep[i++];
|
||||
|
||||
rep_carried_over = rep + i;
|
||||
|
||||
/* If printing the last character in this window couldn't
|
||||
possibly cause the screen to scroll, place a backslash
|
||||
in the rightmost column. */
|
||||
if (1 + line_index + win->first_row < the_screen->height)
|
||||
{
|
||||
if (win->flags & W_NoWrap)
|
||||
printed_line[pl_index++] = '$';
|
||||
else
|
||||
printed_line[pl_index++] = '\\';
|
||||
}
|
||||
printed_line[pl_index] = '\0';
|
||||
}
|
||||
|
||||
/* We have the exact line as it should appear on the screen.
|
||||
Check to see if this line matches the one already appearing
|
||||
on the screen. */
|
||||
entry = display[line_index + win->first_row];
|
||||
|
||||
/* If the screen line is inversed, then we have to clear
|
||||
the line from the screen first. Why, I don't know. */
|
||||
if (entry->inverse)
|
||||
{
|
||||
terminal_goto_xy (0, line_index + win->first_row);
|
||||
terminal_clear_to_eol ();
|
||||
entry->inverse = 0;
|
||||
entry->text[0] = '\0';
|
||||
entry->textlen = 0;
|
||||
}
|
||||
|
||||
/* Find the offset where these lines differ. */
|
||||
for (i = 0; i < pl_index; i++)
|
||||
if (printed_line[i] != entry->text[i])
|
||||
break;
|
||||
|
||||
/* If the lines are not the same length, or if they differed
|
||||
at all, we must do some redrawing. */
|
||||
if ((i != pl_index) || (pl_index != entry->textlen))
|
||||
{
|
||||
/* Move to the proper point on the terminal. */
|
||||
terminal_goto_xy (i, line_index + win->first_row);
|
||||
|
||||
/* If there is any text to print, print it. */
|
||||
if (i != pl_index)
|
||||
terminal_put_text (printed_line + i);
|
||||
|
||||
/* If the printed text didn't extend all the way to the edge
|
||||
of the window, and text was appearing between here and the
|
||||
edge of the window, clear from here to the end of the line. */
|
||||
if ((pl_index < win->width && pl_index < entry->textlen) ||
|
||||
(entry->inverse))
|
||||
terminal_clear_to_eol ();
|
||||
|
||||
fflush (stdout);
|
||||
|
||||
/* Update the display text buffer. */
|
||||
strcpy (entry->text + i, printed_line + i);
|
||||
entry->textlen = pl_index;
|
||||
|
||||
/* Lines showing node text are not in inverse. Only modelines
|
||||
have that distinction. */
|
||||
entry->inverse = 0;
|
||||
}
|
||||
|
||||
/* We have done at least one line. Increment our screen line
|
||||
index, and check against the bottom of the window. */
|
||||
if (++line_index == win->height)
|
||||
break;
|
||||
|
||||
/* A line has been displayed, and the screen reflects that state.
|
||||
If there is typeahead pending, then let that typeahead be read
|
||||
now, instead of continuing with the display. */
|
||||
if (info_any_buffered_input_p ())
|
||||
{
|
||||
free (printed_line);
|
||||
display_was_interrupted_p = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Reset PL_INDEX to the start of the line. */
|
||||
pl_index = 0;
|
||||
|
||||
/* If there are characters from REP left to print, stuff them
|
||||
into the buffer now. */
|
||||
if (rep_carried_over)
|
||||
for (; rep[pl_index]; pl_index++)
|
||||
printed_line[pl_index] = rep[pl_index];
|
||||
|
||||
/* If this window has chosen not to wrap lines, skip to the end
|
||||
of the physical line in the buffer, and start a new line here. */
|
||||
if (pl_index && (win->flags & W_NoWrap))
|
||||
{
|
||||
char *begin;
|
||||
|
||||
pl_index = 0;
|
||||
printed_line[0] = '\0';
|
||||
|
||||
begin = nodetext;
|
||||
|
||||
while ((nodetext < last_node_char) && (*nodetext != '\n'))
|
||||
nodetext++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done_with_node_display:
|
||||
/* We have reached the end of the node or the end of the window. If it
|
||||
is the end of the node, then clear the lines of the window from here
|
||||
to the end of the window. */
|
||||
for (; line_index < win->height; line_index++)
|
||||
{
|
||||
DISPLAY_LINE *entry = display[line_index + win->first_row];
|
||||
|
||||
/* If this line has text on it then make it go away. */
|
||||
if (entry && entry->textlen)
|
||||
{
|
||||
entry->textlen = 0;
|
||||
entry->text[0] = '\0';
|
||||
|
||||
terminal_goto_xy (0, line_index + win->first_row);
|
||||
terminal_clear_to_eol ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally, if this window has a modeline it might need to be redisplayed.
|
||||
Check the window's modeline against the one in the display, and update
|
||||
if necessary. */
|
||||
if ((win->flags & W_InhibitMode) == 0)
|
||||
{
|
||||
window_make_modeline (win);
|
||||
line_index = win->first_row + win->height;
|
||||
|
||||
/* This display line must both be in inverse, and have the same
|
||||
contents. */
|
||||
if ((!display[line_index]->inverse) ||
|
||||
(strcmp (display[line_index]->text, win->modeline) != 0))
|
||||
{
|
||||
terminal_goto_xy (0, line_index);
|
||||
terminal_begin_inverse ();
|
||||
terminal_put_text (win->modeline);
|
||||
terminal_end_inverse ();
|
||||
strcpy (display[line_index]->text, win->modeline);
|
||||
display[line_index]->inverse = 1;
|
||||
display[line_index]->textlen = strlen (win->modeline);
|
||||
fflush (stdout);
|
||||
}
|
||||
}
|
||||
|
||||
/* Okay, this window doesn't need updating anymore. */
|
||||
win->flags &= ~W_UpdateWindow;
|
||||
free (printed_line);
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
/* Scroll the region of the_display starting at START, ending at END, and
|
||||
moving the lines AMOUNT lines. If AMOUNT is less than zero, the lines
|
||||
are moved up in the screen, otherwise down. Actually, it is possible
|
||||
for no scrolling to take place in the case that the terminal doesn't
|
||||
support it. This doesn't matter to us. */
|
||||
void
|
||||
display_scroll_display (start, end, amount)
|
||||
int start, end, amount;
|
||||
{
|
||||
register int i, last;
|
||||
DISPLAY_LINE *temp;
|
||||
|
||||
/* If this terminal cannot do scrolling, give up now. */
|
||||
if (!terminal_can_scroll)
|
||||
return;
|
||||
|
||||
/* If there isn't anything displayed on the screen because it is too
|
||||
small, quit now. */
|
||||
if (!the_display[0])
|
||||
return;
|
||||
|
||||
/* If there is typeahead pending, then don't actually do any scrolling. */
|
||||
if (info_any_buffered_input_p ())
|
||||
return;
|
||||
|
||||
/* Do it on the screen. */
|
||||
terminal_scroll_terminal (start, end, amount);
|
||||
|
||||
/* Now do it in the display buffer so our contents match the screen. */
|
||||
if (amount > 0)
|
||||
{
|
||||
last = end + amount;
|
||||
|
||||
/* Shift the lines to scroll right into place. */
|
||||
for (i = 0; i < (end - start); i++)
|
||||
{
|
||||
temp = the_display[last - i];
|
||||
the_display[last - i] = the_display[end - i];
|
||||
the_display[end - i] = temp;
|
||||
}
|
||||
|
||||
/* The lines have been shifted down in the buffer. Clear all of the
|
||||
lines that were vacated. */
|
||||
for (i = start; i != (start + amount); i++)
|
||||
{
|
||||
the_display[i]->text[0] = '\0';
|
||||
the_display[i]->textlen = 0;
|
||||
the_display[i]->inverse = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (amount < 0)
|
||||
{
|
||||
last = start + amount;
|
||||
for (i = 0; i < (end - start); i++)
|
||||
{
|
||||
temp = the_display[last + i];
|
||||
the_display[last + i] = the_display[start + i];
|
||||
the_display[start + i] = temp;
|
||||
}
|
||||
|
||||
/* The lines have been shifted up in the buffer. Clear all of the
|
||||
lines that are left over. */
|
||||
for (i = end + amount; i != end; i++)
|
||||
{
|
||||
the_display[i]->text[0] = '\0';
|
||||
the_display[i]->textlen = 0;
|
||||
the_display[i]->inverse = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Try to scroll lines in WINDOW. OLD_PAGETOP is the pagetop of WINDOW before
|
||||
having had its line starts recalculated. OLD_STARTS is the list of line
|
||||
starts that used to appear in this window. OLD_COUNT is the number of lines
|
||||
that appear in the OLD_STARTS array. */
|
||||
void
|
||||
display_scroll_line_starts (window, old_pagetop, old_starts, old_count)
|
||||
WINDOW *window;
|
||||
int old_pagetop, old_count;
|
||||
char **old_starts;
|
||||
{
|
||||
register int i, old, new; /* Indices into the line starts arrays. */
|
||||
int last_new, last_old; /* Index of the last visible line. */
|
||||
int old_first, new_first; /* Index of the first changed line. */
|
||||
int unchanged_at_top = 0;
|
||||
int already_scrolled = 0;
|
||||
|
||||
/* Locate the first line which was displayed on the old window. */
|
||||
old_first = old_pagetop;
|
||||
new_first = window->pagetop;
|
||||
|
||||
/* Find the last line currently visible in this window. */
|
||||
last_new = window->pagetop + (window->height - 1);
|
||||
if (last_new > window->line_count)
|
||||
last_new = window->line_count - 1;
|
||||
|
||||
/* Find the last line which used to be currently visible in this window. */
|
||||
last_old = old_pagetop + (window->height - 1);
|
||||
if (last_old > old_count)
|
||||
last_old = old_count - 1;
|
||||
|
||||
for (old = old_first, new = new_first;
|
||||
old < last_old && new < last_new;
|
||||
old++, new++)
|
||||
if (old_starts[old] != window->line_starts[new])
|
||||
break;
|
||||
else
|
||||
unchanged_at_top++;
|
||||
|
||||
/* Loop through the old lines looking for a match in the new lines. */
|
||||
for (old = old_first + unchanged_at_top; old < last_old; old++)
|
||||
{
|
||||
for (new = new_first; new < last_new; new++)
|
||||
if (old_starts[old] == window->line_starts[new])
|
||||
{
|
||||
/* Find the extent of the matching lines. */
|
||||
for (i = 0; (old + i) < last_old; i++)
|
||||
if (old_starts[old + i] != window->line_starts[new + i])
|
||||
break;
|
||||
|
||||
/* Scroll these lines if there are enough of them. */
|
||||
{
|
||||
int start, end, amount;
|
||||
|
||||
start = (window->first_row
|
||||
+ ((old + already_scrolled) - old_pagetop));
|
||||
amount = new - (old + already_scrolled);
|
||||
end = window->first_row + window->height;
|
||||
|
||||
/* If we are shifting the block of lines down, then the last
|
||||
AMOUNT lines will become invisible. Thus, don't bother
|
||||
scrolling them. */
|
||||
if (amount > 0)
|
||||
end -= amount;
|
||||
|
||||
if ((end - start) > 0)
|
||||
{
|
||||
display_scroll_display (start, end, amount);
|
||||
|
||||
/* Some lines have been scrolled. Simulate the scrolling
|
||||
by offsetting the value of the old index. */
|
||||
old += i;
|
||||
already_scrolled += amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Move the screen cursor to directly over the current character in WINDOW. */
|
||||
void
|
||||
display_cursor_at_point (window)
|
||||
WINDOW *window;
|
||||
{
|
||||
int vpos, hpos;
|
||||
|
||||
vpos = window_line_of_point (window) - window->pagetop + window->first_row;
|
||||
hpos = window_get_cursor_column (window);
|
||||
terminal_goto_xy (hpos, vpos);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Functions Static to this File */
|
||||
/* */
|
||||
/* **************************************************************** */
|
||||
|
||||
/* Make a DISPLAY_LINE ** with width and height. */
|
||||
static DISPLAY_LINE **
|
||||
make_display (width, height)
|
||||
int width, height;
|
||||
{
|
||||
register int i;
|
||||
DISPLAY_LINE **display;
|
||||
|
||||
display = (DISPLAY_LINE **)xmalloc ((1 + height) * sizeof (DISPLAY_LINE *));
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
display[i] = (DISPLAY_LINE *)xmalloc (sizeof (DISPLAY_LINE));
|
||||
display[i]->text = (char *)xmalloc (1 + width);
|
||||
display[i]->textlen = 0;
|
||||
display[i]->inverse = 0;
|
||||
}
|
||||
display[i] = (DISPLAY_LINE *)NULL;
|
||||
return (display);
|
||||
}
|
||||
|
||||
/* Free the storage allocated to DISPLAY. */
|
||||
static void
|
||||
free_display (display)
|
||||
DISPLAY_LINE **display;
|
||||
{
|
||||
register int i;
|
||||
register DISPLAY_LINE *display_line;
|
||||
|
||||
if (!display)
|
||||
return;
|
||||
|
||||
for (i = 0; display_line = display[i]; i++)
|
||||
{
|
||||
free (display_line->text);
|
||||
free (display_line);
|
||||
}
|
||||
free (display);
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/* display.h -- How the display in Info is done. */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox ([email protected]). */
|
||||
|
||||
#if !defined (_DISPLAY_H_)
|
||||
#define _DISPLAY_H_
|
||||
|
||||
#include "info-utils.h"
|
||||
#include "terminal.h"
|
||||
|
||||
typedef struct {
|
||||
char *text; /* Text of the line as it appears. */
|
||||
int textlen; /* Printable Length of TEXT. */
|
||||
int inverse; /* Non-zero means this line is inverse. */
|
||||
} DISPLAY_LINE;
|
||||
|
||||
/* An array of display lines which tell us what is currently visible on
|
||||
the display. */
|
||||
extern DISPLAY_LINE **the_display;
|
||||
|
||||
/* Non-zero means do no output. */
|
||||
extern int display_inhibited;
|
||||
|
||||
/* Non-zero if we didn't completely redisplay a window. */
|
||||
extern int display_was_interrupted_p;
|
||||
|
||||
/* Initialize THE_DISPLAY to WIDTH and HEIGHT, with nothing in it. */
|
||||
extern void display_initialize_display ();
|
||||
|
||||
/* Clear all of the lines in DISPLAY making the screen blank. */
|
||||
extern void display_clear_display ();
|
||||
|
||||
/* Update the windows pointed to by WINDOWS in THE_DISPLAY. This actually
|
||||
writes the text on the screen. */
|
||||
extern void display_update_display ();
|
||||
|
||||
/* Display WIN on THE_DISPLAY. Unlike display_update_display (), this
|
||||
function only does one window. */
|
||||
extern void display_update_one_window ();
|
||||
|
||||
/* Move the screen cursor to directly over the current character in WINDOW. */
|
||||
extern void display_cursor_at_point ();
|
||||
|
||||
/* Scroll the region of the_display starting at START, ending at END, and
|
||||
moving the lines AMOUNT lines. If AMOUNT is less than zero, the lines
|
||||
are moved up in the screen, otherwise down. Actually, it is possible
|
||||
for no scrolling to take place in the case that the terminal doesn't
|
||||
support it. This doesn't matter to us. */
|
||||
extern void display_scroll_display ();
|
||||
|
||||
/* Try to scroll lines in WINDOW. OLD_PAGETOP is the pagetop of WINDOW before
|
||||
having had its line starts recalculated. OLD_STARTS is the list of line
|
||||
starts that used to appear in this window. OLD_COUNT is the number of lines
|
||||
that appear in the OLD_STARTS array. */
|
||||
extern void display_scroll_line_starts ();
|
||||
|
||||
#endif /* !_DISPLAY_H_ */
|
||||
@@ -1,129 +0,0 @@
|
||||
/* doc.c -- Generated structure containing function names and doc strings.
|
||||
|
||||
This file was automatically made from various source files with the
|
||||
command "./makedoc". DO NOT EDIT THIS FILE, only "./makedoc.c".
|
||||
Source files groveled to make this file include:
|
||||
|
||||
./session.c
|
||||
./echo_area.c
|
||||
./infodoc.c
|
||||
./m-x.c
|
||||
./indices.c
|
||||
./nodemenu.c
|
||||
./footnotes.c
|
||||
./variables.c
|
||||
|
||||
An entry in the array FUNCTION_DOC_ARRAY is made for each command
|
||||
found in the above files; each entry consists of a function pointer,
|
||||
a string which is the user-visible name of the function,
|
||||
and a string which documents its purpose. */
|
||||
|
||||
#include "doc.h"
|
||||
#include "funs.h"
|
||||
|
||||
FUNCTION_DOC function_doc_array[] = {
|
||||
|
||||
/* Commands found in "./session.c". */
|
||||
{ info_next_line, "next-line", "Move down to the next line" },
|
||||
{ info_prev_line, "prev-line", "Move up to the previous line" },
|
||||
{ info_end_of_line, "end-of-line", "Move to the end of the line" },
|
||||
{ info_beginning_of_line, "beginning-of-line", "Move to the start of the line" },
|
||||
{ info_forward_char, "forward-char", "Move forward a character" },
|
||||
{ info_backward_char, "backward-char", "Move backward a character" },
|
||||
{ info_forward_word, "forward-word", "Move forward a word" },
|
||||
{ info_backward_word, "backward-word", "Move backward a word" },
|
||||
{ info_global_next_node, "global-next-node", "Move forwards or down through node structure" },
|
||||
{ info_global_prev_node, "global-prev-node", "Move backwards or up through node structure" },
|
||||
{ info_scroll_forward, "scroll-forward", "Scroll forward in this window" },
|
||||
{ info_scroll_backward, "scroll-backward", "Scroll backward in this window" },
|
||||
{ info_beginning_of_node, "beginning-of-node", "Move to the start of this node" },
|
||||
{ info_end_of_node, "end-of-node", "Move to the end of this node" },
|
||||
{ info_next_window, "next-window", "Select the next window" },
|
||||
{ info_prev_window, "prev-window", "Select the previous window" },
|
||||
{ info_split_window, "split-window", "Split the current window" },
|
||||
{ info_delete_window, "delete-window", "Delete the current window" },
|
||||
{ info_keep_one_window, "keep-one-window", "Delete all other windows" },
|
||||
{ info_scroll_other_window, "scroll-other-window", "Scroll the other window" },
|
||||
{ info_grow_window, "grow-window", "Grow (or shrink) this window" },
|
||||
{ info_tile_windows, "tile-windows", "Divide the available screen space among the visible windows" },
|
||||
{ info_toggle_wrap, "toggle-wrap", "Toggle the state of line wrapping in the current window" },
|
||||
{ info_next_node, "next-node", "Select the `Next' node" },
|
||||
{ info_prev_node, "prev-node", "Select the `Prev' node" },
|
||||
{ info_up_node, "up-node", "Select the `Up' node" },
|
||||
{ info_last_node, "last-node", "Select the last node in this file" },
|
||||
{ info_first_node, "first-node", "Select the first node in this file" },
|
||||
{ info_history_node, "history-node", "Select the most recently selected node" },
|
||||
{ info_last_menu_item, "last-menu-item", "Select the last item in this node's menu" },
|
||||
{ info_menu_digit, "menu-digit", "Select this menu item" },
|
||||
{ info_menu_item, "menu-item", "Read a menu item and select its node" },
|
||||
{ info_xref_item, "xref-item", "Read a footnote or cross reference and select its node" },
|
||||
{ info_find_menu, "find-menu", "Move to the start of this node's menu" },
|
||||
{ info_visit_menu, "visit-menu", "Visit as many menu items at once as possible" },
|
||||
{ info_goto_node, "goto-node", "Read a node name and select it" },
|
||||
{ info_man, "man", "Read a manpage reference and select it" },
|
||||
{ info_top_node, "top-node", "Select the node `Top' in this file" },
|
||||
{ info_dir_node, "dir-node", "Select the node `(dir)'" },
|
||||
{ info_kill_node, "kill-node", "Kill this node" },
|
||||
{ info_view_file, "view-file", "Read the name of a file and select it" },
|
||||
{ info_print_node, "print-node", "Pipe the contents of this node through INFO_PRINT_COMMAND" },
|
||||
{ info_search, "search", "Read a string and search for it" },
|
||||
{ isearch_forward, "isearch-forward", "Search interactively for a string as you type it" },
|
||||
{ isearch_backward, "isearch-backward", "Search interactively for a string as you type it" },
|
||||
{ info_move_to_prev_xref, "move-to-prev-xref", "Move to the previous cross reference" },
|
||||
{ info_move_to_next_xref, "move-to-next-xref", "Move to the next cross reference" },
|
||||
{ info_select_reference_this_line, "select-reference-this-line", "Select reference or menu item appearing on this line" },
|
||||
{ info_abort_key, "abort-key", "Cancel current operation" },
|
||||
{ info_move_to_window_line, "move-to-window-line", "Move to the cursor to a specific line of the window" },
|
||||
{ info_redraw_display, "redraw-display", "Redraw the display" },
|
||||
{ info_quit, "quit", "Quit using Info" },
|
||||
{ info_do_lowercase_version, "do-lowercase-version", "" },
|
||||
{ info_add_digit_to_numeric_arg, "add-digit-to-numeric-arg", "Add this digit to the current numeric argument" },
|
||||
{ info_universal_argument, "universal-argument", "Start (or multiply by 4) the current numeric argument" },
|
||||
{ info_numeric_arg_digit_loop, "numeric-arg-digit-loop", "Internally used by \\[universal-argument]" },
|
||||
/* Commands found in "./echo_area.c". */
|
||||
{ ea_forward, "echo-area-forward", "Move forward a character" },
|
||||
{ ea_backward, "echo-area-backward", "Move backward a character" },
|
||||
{ ea_beg_of_line, "echo-area-beg-of-line", "Move to the start of this line" },
|
||||
{ ea_end_of_line, "echo-area-end-of-line", "Move to the end of this line" },
|
||||
{ ea_forward_word, "echo-area-forward-word", "Move forward a word" },
|
||||
{ ea_backward_word, "echo-area-backward-word", "Move backward a word" },
|
||||
{ ea_delete, "echo-area-delete", "Delete the character under the cursor" },
|
||||
{ ea_rubout, "echo-area-rubout", "Delete the character behind the cursor" },
|
||||
{ ea_abort, "echo-area-abort", "Cancel or quit operation" },
|
||||
{ ea_newline, "echo-area-newline", "Accept (or force completion of) this line" },
|
||||
{ ea_quoted_insert, "echo-area-quoted-insert", "Insert next character verbatim" },
|
||||
{ ea_insert, "echo-area-insert", "Insert this character" },
|
||||
{ ea_tab_insert, "echo-area-tab-insert", "Insert a TAB character" },
|
||||
{ ea_transpose_chars, "echo-area-transpose-chars", "Transpose characters at point" },
|
||||
{ ea_yank, "echo-area-yank", "Yank back the contents of the last kill" },
|
||||
{ ea_yank_pop, "echo-area-yank-pop", "Yank back a previous kill" },
|
||||
{ ea_kill_line, "echo-area-kill-line", "Kill to the end of the line" },
|
||||
{ ea_backward_kill_line, "echo-area-backward-kill-line", "Kill to the beginning of the line" },
|
||||
{ ea_kill_word, "echo-area-kill-word", "Kill the word following the cursor" },
|
||||
{ ea_backward_kill_word, "echo-area-backward-kill-word", "Kill the word preceding the cursor" },
|
||||
{ ea_possible_completions, "echo-area-possible-completions", "List possible completions" },
|
||||
{ ea_complete, "echo-area-complete", "Insert completion" },
|
||||
{ ea_scroll_completions_window, "echo-area-scroll-completions-window", "Scroll the completions window" },
|
||||
/* Commands found in "./infodoc.c". */
|
||||
{ info_get_help_window, "get-help-window", "Display help message" },
|
||||
{ info_get_info_help_node, "get-info-help-node", "Visit Info node `(info)Help'" },
|
||||
{ describe_key, "describe-key", "Print documentation for KEY" },
|
||||
{ info_where_is, "where-is", "Show what to type to execute a given command" },
|
||||
/* Commands found in "./m-x.c". */
|
||||
{ describe_command, "describe-command", "Read the name of an Info command and describe it" },
|
||||
{ info_execute_command, "execute-command", "Read a command name in the echo area and execute it" },
|
||||
{ set_screen_height, "set-screen-height", "Set the height of the displayed window" },
|
||||
/* Commands found in "./indices.c". */
|
||||
{ info_index_search, "index-search", "Look up a string in the index for this file" },
|
||||
{ info_next_index_match, "next-index-match", "Go to the next matching index item from the last `\\[index-search]' command" },
|
||||
{ info_index_apropos, "index-apropos", "Grovel all known info file's indices for a string and build a menu" },
|
||||
/* Commands found in "./nodemenu.c". */
|
||||
{ list_visited_nodes, "list-visited-nodes", "Make a window containing a menu of all of the currently visited nodes" },
|
||||
{ select_visited_node, "select-visited-node", "Select a node which has been previously visited in a visible window" },
|
||||
/* Commands found in "./footnotes.c". */
|
||||
{ info_show_footnotes, "show-footnotes", "Show the footnotes associated with this node in another window" },
|
||||
/* Commands found in "./variables.c". */
|
||||
{ describe_variable, "describe-variable", "Explain the use of a variable" },
|
||||
{ set_variable, "set-variable", "Set the value of an Info variable" },
|
||||
{ (VFunction *)NULL, (char *)NULL, (char *)NULL }
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
/* doc.h -- Structure associating function pointers with documentation. */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox ([email protected]). */
|
||||
|
||||
#if !defined (_DOC_H_)
|
||||
#define _DOC_H_
|
||||
|
||||
#if !defined (NULL)
|
||||
# define NULL 0x0
|
||||
#endif /* !NULL */
|
||||
|
||||
#if !defined (__FUNCTION_DEF)
|
||||
# define __FUNCTION_DEF
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
#endif /* _FUNCTION_DEF */
|
||||
|
||||
typedef struct {
|
||||
VFunction *func;
|
||||
#if defined (NAMED_FUNCTIONS)
|
||||
char *func_name;
|
||||
#endif /* NAMED_FUNCTIONS */
|
||||
char *doc;
|
||||
} FUNCTION_DOC;
|
||||
|
||||
extern FUNCTION_DOC function_doc_array[];
|
||||
|
||||
extern char *function_documentation ();
|
||||
extern char *key_documentation ();
|
||||
extern char *pretty_keyname ();
|
||||
extern char *replace_in_documentation ();
|
||||
extern void info_document_key ();
|
||||
extern void dump_map_to_message_buffer ();
|
||||
|
||||
#if defined (NAMED_FUNCTIONS)
|
||||
extern char *function_name ();
|
||||
extern VFunction *named_function ();
|
||||
#endif /* NAMED_FUNCTIONS */
|
||||
#endif /* !_DOC_H_ */
|
||||
@@ -1,5 +0,0 @@
|
||||
mfoo
|
||||
em
|
||||
buffers
|
||||
|
||||
ââ
|
||||
@@ -1,71 +0,0 @@
|
||||
/* dribble.c -- Dribble files for Info. */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox ([email protected]). */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "dribble.h"
|
||||
|
||||
/* When non-zero, it is a stream to write all input characters to for the
|
||||
duration of this info session. */
|
||||
FILE *info_dribble_file = (FILE *)NULL;
|
||||
|
||||
/* Open a dribble file named NAME, perhaps closing an already open one.
|
||||
This sets the global variable INFO_DRIBBLE_FILE to the open stream. */
|
||||
void
|
||||
open_dribble_file (name)
|
||||
char *name;
|
||||
{
|
||||
/* Perhaps close existing dribble file. */
|
||||
close_dribble_file ();
|
||||
|
||||
info_dribble_file = fopen (name, "w");
|
||||
|
||||
#if defined (HAVE_SETVBUF)
|
||||
if (info_dribble_file)
|
||||
# if defined (SETVBUF_REVERSED)
|
||||
setvbuf (info_dribble_file, _IONBF, (char *)NULL, 1);
|
||||
# else
|
||||
setvbuf (info_dribble_file, (char *)NULL, _IONBF, 1);
|
||||
# endif /* !SETVBUF_REVERSED */
|
||||
#endif /* HAVE_SETVBUF */
|
||||
}
|
||||
|
||||
/* If there is a dribble file already open, close it. */
|
||||
void
|
||||
close_dribble_file ()
|
||||
{
|
||||
if (info_dribble_file)
|
||||
{
|
||||
fflush (info_dribble_file);
|
||||
fclose (info_dribble_file);
|
||||
info_dribble_file = (FILE *)NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Write some output to our existing dribble file. */
|
||||
void
|
||||
dribble (byte)
|
||||
unsigned char byte;
|
||||
{
|
||||
if (info_dribble_file)
|
||||
fwrite (&byte, sizeof (unsigned char), 1, info_dribble_file);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/* dribble.h -- Functions and vars declared in dribble.c. */
|
||||
|
||||
/* This file is part of GNU Info, a program for reading online documentation
|
||||
stored in Info format.
|
||||
|
||||
Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Written by Brian Fox ([email protected]). */
|
||||
|
||||
#if !defined (_DRIBBLE_H_)
|
||||
#define _DRIBBLE_H_
|
||||
|
||||
/* When non-zero, it is a stream to write all input characters to for the
|
||||
duration of this info session. */
|
||||
extern FILE *info_dribble_file;
|
||||
|
||||
/* Open a dribble file named NAME, perhaps closing an already open one.
|
||||
This sets the global variable INFO_DRIBBLE_FILE to the open stream. */
|
||||
extern void open_dribble_file ();
|
||||
|
||||
/* If there is a dribble file already open, close it. */
|
||||
extern void close_dribble_file ();
|
||||
|
||||
/* Write some output to our existing dribble file. */
|
||||
extern void dribble ();
|
||||
|
||||
#endif /* !_DRIBBLE_H_ */
|
||||
Loaded 100 of 264 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user