mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-30 12:25:10 +01:00
Compare commits
46
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ee4b1b8af | ||
|
|
743b545096 | ||
|
|
87171ce124 | ||
|
|
604cd0a919 | ||
|
|
03f3c3054e | ||
|
|
0deaf185c8 | ||
|
|
7e8494c27c | ||
|
|
6a01154641 | ||
|
|
6bc15edce0 | ||
|
|
f2b26d876a | ||
|
|
c1ab2ae1e4 | ||
|
|
e0780e591c | ||
|
|
1a96bc0610 | ||
|
|
98aa18983b | ||
|
|
77526ff9ce | ||
|
|
58d9ac9f54 | ||
|
|
57030429bb | ||
|
|
5c7cadf334 | ||
|
|
d28c978997 | ||
|
|
a58b0410de | ||
|
|
ad79b7c2b1 | ||
|
|
68ea10afbe | ||
|
|
23b0d2c809 | ||
|
|
179e6bdd65 | ||
|
|
8074dba866 | ||
|
|
e6668cfa13 | ||
|
|
8130415f01 | ||
|
|
75570d5cc3 | ||
|
|
3d08e5b799 | ||
|
|
e39b0579cb | ||
|
|
456827fd5d | ||
|
|
8424357963 | ||
|
|
d7d6cf19e6 | ||
|
|
49d1c1fbad | ||
|
|
1673fa9d35 | ||
|
|
02cb4a841b | ||
|
|
fff1673f65 | ||
|
|
7f2d28f6d6 | ||
|
|
e679a41204 | ||
|
|
c758a8a6b1 | ||
|
|
aefd1c7092 | ||
|
|
4322357136 | ||
|
|
bae23ad7ce | ||
|
|
ec4f412952 | ||
|
|
30f17eb0b1 | ||
|
|
195d201029 |
No files matched your search
+1
-1
@@ -513,7 +513,7 @@ update:
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR}; cvs -q update -rRELENG_4 -P -d
|
||||
cd ${.CURDIR}; cvs -q update -rRELENG_4_5 -P -d
|
||||
.endif
|
||||
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Updating Information for FreeBSD STABLE users
|
||||
Updating Information for FreeBSD STABLE users, 4.5 security branch
|
||||
|
||||
This file is maintained and copyrighted by M. Warner Losh
|
||||
<[email protected]>. Please send new entries directly to him. See end
|
||||
@@ -9,6 +9,16 @@ A reverse chronology since 4.0 was released is included, followed by
|
||||
the common items quick how-tos, followed by entries for versions of
|
||||
-current prior to 4.0 Release.
|
||||
|
||||
This is for the 4.5 release branch. All entries since 4.5 are an
|
||||
itemized list of commits to this branch, numbered from the beginning.
|
||||
By this count, we're at 4.5.0.
|
||||
|
||||
The security advisories related to various patches contain information
|
||||
on how to build/install a minimal set of binaries and start/stop a
|
||||
minimal number of processes, if possible, for that patch. For those
|
||||
updates that don't have an advisory, or to be safe, you can do a full
|
||||
build and install as described in the COMMON ITEMS section.
|
||||
|
||||
20020105:
|
||||
The locale names have been renamed in -stable to match
|
||||
-current:
|
||||
|
||||
+3
-3
@@ -211,11 +211,11 @@ symbol ``X'' are only meaningful in conjunction with the
|
||||
.Ar op
|
||||
symbol ``+'', and are ignored in all other cases.
|
||||
.It u
|
||||
The user permission bits in the original mode of the file.
|
||||
The user permission bits in the mode of the original file.
|
||||
.It g
|
||||
The group permission bits in the original mode of the file.
|
||||
The group permission bits in the mode of the original file.
|
||||
.It o
|
||||
The other permission bits in the original mode of the file.
|
||||
The other permission bits in the mode of the original file.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
.Op Fl p Ar pid
|
||||
.Op Fl t Ar tty
|
||||
.Op Fl U Ar username
|
||||
.Op Fl W Ar swap
|
||||
.Nm
|
||||
.Op Fl L
|
||||
.Sh DESCRIPTION
|
||||
@@ -165,6 +166,9 @@ The
|
||||
option implies the
|
||||
.Fl m
|
||||
option.
|
||||
.It Fl W
|
||||
Extract swap information from the specified file instead of
|
||||
using libkvm.
|
||||
.It Fl w
|
||||
Use 132 columns to display information, instead of the default which
|
||||
is your window size.
|
||||
@@ -479,6 +483,10 @@ exit or stop status (valid only for stopped or zombie process)
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width /var/db/kvm_kernel.db -compact
|
||||
.It Pa /dev
|
||||
special files and device names
|
||||
.It Pa /dev/drum
|
||||
default swap device
|
||||
.It Pa /dev/kmem
|
||||
default kernel memory
|
||||
.It Pa /var/run/dev.db
|
||||
|
||||
+13
-7
@@ -126,7 +126,7 @@ main(argc, argv)
|
||||
uid_t *uids;
|
||||
int all, ch, flag, i, fmt, lineno, nentries, dropgid;
|
||||
int prtheader, wflag, what, xflg, uid, nuids;
|
||||
char *nlistf, *memf, errbuf[_POSIX2_LINE_MAX];
|
||||
char *nlistf, *memf, *swapf, errbuf[_POSIX2_LINE_MAX];
|
||||
|
||||
(void) setlocale(LC_ALL, "");
|
||||
|
||||
@@ -147,12 +147,12 @@ main(argc, argv)
|
||||
uids = NULL;
|
||||
ttydev = NODEV;
|
||||
dropgid = 0;
|
||||
memf = nlistf = _PATH_DEVNULL;
|
||||
memf = nlistf = swapf = _PATH_DEVNULL;
|
||||
while ((ch = getopt(argc, argv,
|
||||
#if defined(LAZY_PS)
|
||||
"aCcefghjLlM:mN:O:o:p:rSTt:U:uvwx")) != -1)
|
||||
"aCcefghjLlM:mN:O:o:p:rSTt:U:uvW:wx")) != -1)
|
||||
#else
|
||||
"aCceghjLlM:mN:O:o:p:rSTt:U:uvwx")) != -1)
|
||||
"aCceghjLlM:mN:O:o:p:rSTt:U:uvW:wx")) != -1)
|
||||
#endif
|
||||
switch((char)ch) {
|
||||
case 'a':
|
||||
@@ -261,6 +261,10 @@ main(argc, argv)
|
||||
fmt = 1;
|
||||
vfmt[0] = '\0';
|
||||
break;
|
||||
case 'W':
|
||||
swapf = optarg;
|
||||
dropgid = 1;
|
||||
break;
|
||||
case 'w':
|
||||
if (wflag)
|
||||
termwidth = UNLIMITED;
|
||||
@@ -284,6 +288,8 @@ main(argc, argv)
|
||||
nlistf = *argv;
|
||||
if (*++argv) {
|
||||
memf = *argv;
|
||||
if (*++argv)
|
||||
swapf = *argv;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -296,7 +302,7 @@ main(argc, argv)
|
||||
setuid(getuid());
|
||||
}
|
||||
|
||||
kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, errbuf);
|
||||
kd = kvm_openfiles(nlistf, memf, swapf, O_RDONLY, errbuf);
|
||||
if (kd == 0)
|
||||
errx(1, "%s", errbuf);
|
||||
|
||||
@@ -605,7 +611,7 @@ kludge_oldps_options(s)
|
||||
* option string, the remainder of the string is the argument to
|
||||
* that flag; do not modify that argument.
|
||||
*/
|
||||
if (strcspn(s, "MNOoU") == len && *cp == 't' && *s != '-')
|
||||
if (strcspn(s, "MNOoUW") == len && *cp == 't' && *s != '-')
|
||||
*cp = 'T';
|
||||
else {
|
||||
/*
|
||||
@@ -637,7 +643,7 @@ usage()
|
||||
|
||||
(void)fprintf(stderr, "%s\n%s\n%s\n",
|
||||
"usage: ps [-aChjlmrSTuvwx] [-O|o fmt] [-p pid] [-t tty] [-U user]",
|
||||
" [-M core] [-N system]",
|
||||
" [-M core] [-N system] [-W swap]",
|
||||
" ps [-L]");
|
||||
exit(1);
|
||||
}
|
||||
+4
-4
@@ -145,8 +145,11 @@ again:
|
||||
}
|
||||
if (!try) {
|
||||
sv->renamed[fd] = i;
|
||||
close(fd);
|
||||
}
|
||||
INTON;
|
||||
} else {
|
||||
close(fd);
|
||||
}
|
||||
if (fd == 0)
|
||||
fd0_redirected++;
|
||||
@@ -183,7 +186,6 @@ openredirect(redir, memory)
|
||||
error("cannot open %s: %s", fname, errmsg(errno, E_OPEN));
|
||||
movefd:
|
||||
if (f != fd) {
|
||||
close(fd);
|
||||
copyfd(f, fd);
|
||||
close(f);
|
||||
}
|
||||
@@ -236,10 +238,8 @@ movefd:
|
||||
if (redir->ndup.dupfd >= 0) { /* if not ">&-" */
|
||||
if (memory[redir->ndup.dupfd])
|
||||
memory[fd] = 1;
|
||||
else {
|
||||
close(fd);
|
||||
else
|
||||
copyfd(redir->ndup.dupfd, fd);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NHERE:
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
directory /var/named
|
||||
forwarders 1.2.3.4 1.2.3.5
|
||||
limit datasize 10000000
|
||||
limit files 1000
|
||||
limit transfers-in 100
|
||||
limit transfers-per-ns 20
|
||||
; no-round-robin in HP specific
|
||||
options no-round-robin fake-iquery forward-only no-fetch-glue no-recursion
|
||||
slave
|
||||
tcplist 10.0.0.1
|
||||
xfrnets 10.0.0.2
|
||||
cache . rootservers
|
||||
primary example.net example.net.db
|
||||
secondary example.com 127.0.0.1 example.com.db
|
||||
stub example.org 127.0.0.1 example.org.db
|
||||
primary/IN example.net example.net.db
|
||||
secondary/IN example.com 127.0.0.1 example.com.db
|
||||
stub/IN example.org 127.0.0.1 example.org.db
|
||||
secondary/IN example.com 127.0.0.1
|
||||
stub/IN example.org 127.0.0.1
|
||||
primary/CHAOS example.net example.net.db
|
||||
secondary/CHAOS example.com 127.0.0.1 example.com.db
|
||||
stub/CHAOS example.org 127.0.0.1 example.org.db
|
||||
secondary/CHAOS example.com 127.0.0.1
|
||||
stub/CHAOS example.org 127.0.0.1
|
||||
primary/HS example.net example.net.db
|
||||
secondary/HS example.com 127.0.0.1 example.com.db
|
||||
stub/HS example.org 127.0.0.1 example.org.db
|
||||
secondary/HS example.com 127.0.0.1
|
||||
stub/HS example.org 127.0.0.1
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef netgroup_h
|
||||
#define netgroup_h
|
||||
|
||||
int getnetgrent(const char **machinep, const char **userp,
|
||||
const char **domainp);
|
||||
|
||||
int getnetgrent_r(char **machinep, char **userp, char **domainp,
|
||||
char *buffer, int buflen);
|
||||
|
||||
void setnetgrent(const char *netgroup);
|
||||
|
||||
void endnetgrent(void);
|
||||
|
||||
int innetgr(const char *netgroup, const char *machine,
|
||||
const char *user, const char *domain);
|
||||
|
||||
#endif
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1995-1999 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 char rcsid[] = "$Id: inet_data.c,v 1.2 2001/06/20 22:06:36 marka Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "port_before.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <arpa/nameser.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <resolv.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "port_after.h"
|
||||
|
||||
const struct in6_addr isc_in6addr_any = IN6ADDR_ANY_INIT;
|
||||
const struct in6_addr isc_in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
|
||||
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001 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 <port_before.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <isc/misc.h>
|
||||
#include <port_after.h>
|
||||
|
||||
static const char hex[17] = "0123456789abcdef";
|
||||
|
||||
int
|
||||
isc_gethexstring(unsigned char *buf, size_t len, int count, FILE *fp,
|
||||
int *multiline)
|
||||
{
|
||||
int c, n;
|
||||
unsigned char x;
|
||||
char *s;
|
||||
int result = count;
|
||||
|
||||
x = 0; /* silence compiler */
|
||||
n = 0;
|
||||
while (count > 0) {
|
||||
c = fgetc(fp);
|
||||
|
||||
if ((c == EOF) ||
|
||||
(c == '\n' && !*multiline) ||
|
||||
(c == '(' && *multiline) ||
|
||||
(c == ')' && !*multiline))
|
||||
goto formerr;
|
||||
/* comment */
|
||||
if (c == ';') {
|
||||
while ((c = fgetc(fp)) != EOF && c != '\n')
|
||||
/* empty */
|
||||
if (c == '\n' && *multiline)
|
||||
continue;
|
||||
goto formerr;
|
||||
}
|
||||
/* white space */
|
||||
if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
|
||||
continue;
|
||||
/* multiline */
|
||||
if ('(' == c || c == ')') {
|
||||
*multiline = (c == '(' /*)*/);
|
||||
continue;
|
||||
}
|
||||
if ((s = strchr(hex, tolower(c))) == NULL)
|
||||
goto formerr;
|
||||
x = (x<<4) | (s - hex);
|
||||
if (++n == 2) {
|
||||
if (len > 0) {
|
||||
*buf++ = x;
|
||||
len--;
|
||||
} else
|
||||
result = -1;
|
||||
count--;
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
return (result);
|
||||
|
||||
formerr:
|
||||
if (c == '\n')
|
||||
ungetc(c, fp);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
void
|
||||
isc_puthexstring(FILE *fp, const unsigned char *buf, size_t buflen,
|
||||
size_t len1, size_t len2, const char *sep)
|
||||
{
|
||||
size_t i = 0;
|
||||
|
||||
if (len1 < 4)
|
||||
len1 = 4;
|
||||
if (len2 < 4)
|
||||
len2 = 4;
|
||||
while (buflen > 0) {
|
||||
fputc(hex[(buf[0]>>4)&0xf], fp);
|
||||
fputc(hex[buf[0]&0xf], fp);
|
||||
i += 2;
|
||||
buflen--;
|
||||
buf++;
|
||||
if (i >= len1 && sep != NULL) {
|
||||
fputs(sep, fp);
|
||||
i = 0;
|
||||
len1 = len2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
isc_tohex(const unsigned char *buf, size_t buflen, char *t) {
|
||||
while (buflen > 0) {
|
||||
*t++ = hex[(buf[0]>>4)&0xf];
|
||||
*t++ = hex[buf[0]&0xf];
|
||||
buf++;
|
||||
buflen--;
|
||||
}
|
||||
*t = '\0';
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef res_private_h
|
||||
#define res_private_h
|
||||
|
||||
struct __res_state_ext {
|
||||
union res_sockaddr_union nsaddrs[MAXNS];
|
||||
struct sort_list {
|
||||
int af;
|
||||
union {
|
||||
struct in_addr ina;
|
||||
struct in6_addr in6a;
|
||||
} addr, mask;
|
||||
} sort_list[MAXRESOLVSORT];
|
||||
char nsuffix[64];
|
||||
char bsuffix[64];
|
||||
};
|
||||
|
||||
extern int
|
||||
res_ourserver_p(const res_state statp, const struct sockaddr *sa);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,245 +0,0 @@
|
||||
/* MIPS-specific support for 64-bit ELF
|
||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
Ian Lance Taylor, Cygnus Support
|
||||
Linker support added by Mark Mitchell, CodeSourcery, LLC.
|
||||
<[email protected]>
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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. */
|
||||
|
||||
/* This file supports the 64-bit (MIPS) ELF archives. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "aout/ar.h"
|
||||
|
||||
/* Irix 6 defines a 64bit archive map format, so that they can
|
||||
have archives more than 4 GB in size. */
|
||||
|
||||
boolean bfd_elf64_archive_slurp_armap PARAMS ((bfd *));
|
||||
boolean bfd_elf64_archive_write_armap
|
||||
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
|
||||
|
||||
/* Read an Irix 6 armap. */
|
||||
|
||||
boolean
|
||||
bfd_elf64_archive_slurp_armap (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct artdata *ardata = bfd_ardata (abfd);
|
||||
char nextname[17];
|
||||
file_ptr arhdrpos;
|
||||
bfd_size_type i, parsed_size, nsymz, stringsize, carsym_size, ptrsize;
|
||||
struct areltdata *mapdata;
|
||||
bfd_byte int_buf[8];
|
||||
char *stringbase;
|
||||
bfd_byte *raw_armap = NULL;
|
||||
carsym *carsyms;
|
||||
bfd_size_type amt;
|
||||
|
||||
ardata->symdefs = NULL;
|
||||
|
||||
/* Get the name of the first element. */
|
||||
arhdrpos = bfd_tell (abfd);
|
||||
i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
|
||||
if (i == 0)
|
||||
return true;
|
||||
if (i != 16)
|
||||
return false;
|
||||
|
||||
if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
|
||||
return false;
|
||||
|
||||
/* Archives with traditional armaps are still permitted. */
|
||||
if (strncmp (nextname, "/ ", 16) == 0)
|
||||
return bfd_slurp_armap (abfd);
|
||||
|
||||
if (strncmp (nextname, "/SYM64/ ", 16) != 0)
|
||||
{
|
||||
bfd_has_map (abfd) = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
|
||||
if (mapdata == NULL)
|
||||
return false;
|
||||
parsed_size = mapdata->parsed_size;
|
||||
bfd_release (abfd, (PTR) mapdata);
|
||||
|
||||
if (bfd_bread (int_buf, (bfd_size_type) 8, abfd) != 8)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_malformed_archive);
|
||||
return false;
|
||||
}
|
||||
|
||||
nsymz = bfd_getb64 (int_buf);
|
||||
stringsize = parsed_size - 8 * nsymz - 8;
|
||||
|
||||
carsym_size = nsymz * sizeof (carsym);
|
||||
ptrsize = 8 * nsymz;
|
||||
|
||||
amt = carsym_size + stringsize + 1;
|
||||
ardata->symdefs = (carsym *) bfd_zalloc (abfd, amt);
|
||||
if (ardata->symdefs == NULL)
|
||||
return false;
|
||||
carsyms = ardata->symdefs;
|
||||
stringbase = ((char *) ardata->symdefs) + carsym_size;
|
||||
|
||||
raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
|
||||
if (raw_armap == NULL)
|
||||
goto release_symdefs;
|
||||
|
||||
if (bfd_bread (raw_armap, ptrsize, abfd) != ptrsize
|
||||
|| bfd_bread (stringbase, stringsize, abfd) != stringsize)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_malformed_archive);
|
||||
goto release_raw_armap;
|
||||
}
|
||||
|
||||
for (i = 0; i < nsymz; i++)
|
||||
{
|
||||
carsyms->file_offset = bfd_getb64 (raw_armap + i * 8);
|
||||
carsyms->name = stringbase;
|
||||
stringbase += strlen (stringbase) + 1;
|
||||
++carsyms;
|
||||
}
|
||||
*stringbase = '\0';
|
||||
|
||||
ardata->symdef_count = nsymz;
|
||||
ardata->first_file_filepos = bfd_tell (abfd);
|
||||
/* Pad to an even boundary if you have to. */
|
||||
ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
|
||||
|
||||
bfd_has_map (abfd) = true;
|
||||
bfd_release (abfd, raw_armap);
|
||||
|
||||
return true;
|
||||
|
||||
release_raw_armap:
|
||||
bfd_release (abfd, raw_armap);
|
||||
release_symdefs:
|
||||
bfd_release (abfd, ardata->symdefs);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Write out an Irix 6 armap. The Irix 6 tools are supposed to be
|
||||
able to handle ordinary ELF armaps, but at least on Irix 6.2 the
|
||||
linker crashes. */
|
||||
|
||||
boolean
|
||||
bfd_elf64_archive_write_armap (arch, elength, map, symbol_count, stridx)
|
||||
bfd *arch;
|
||||
unsigned int elength;
|
||||
struct orl *map;
|
||||
unsigned int symbol_count;
|
||||
int stridx;
|
||||
{
|
||||
unsigned int ranlibsize = (symbol_count * 8) + 8;
|
||||
unsigned int stringsize = stridx;
|
||||
unsigned int mapsize = stringsize + ranlibsize;
|
||||
file_ptr archive_member_file_ptr;
|
||||
bfd *current = arch->archive_head;
|
||||
unsigned int count;
|
||||
struct ar_hdr hdr;
|
||||
unsigned int i;
|
||||
int padding;
|
||||
bfd_byte buf[8];
|
||||
|
||||
padding = BFD_ALIGN (mapsize, 8) - mapsize;
|
||||
mapsize += padding;
|
||||
|
||||
/* work out where the first object file will go in the archive */
|
||||
archive_member_file_ptr = (mapsize
|
||||
+ elength
|
||||
+ sizeof (struct ar_hdr)
|
||||
+ SARMAG);
|
||||
|
||||
memset ((char *) (&hdr), 0, sizeof (struct ar_hdr));
|
||||
strcpy (hdr.ar_name, "/SYM64/");
|
||||
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
|
||||
sprintf (hdr.ar_date, "%ld", (long) time (NULL));
|
||||
/* This, at least, is what Intel coff sets the values to.: */
|
||||
sprintf ((hdr.ar_uid), "%d", 0);
|
||||
sprintf ((hdr.ar_gid), "%d", 0);
|
||||
sprintf ((hdr.ar_mode), "%-7o", (unsigned) 0);
|
||||
strncpy (hdr.ar_fmag, ARFMAG, 2);
|
||||
|
||||
for (i = 0; i < sizeof (struct ar_hdr); i++)
|
||||
if (((char *) (&hdr))[i] == '\0')
|
||||
(((char *) (&hdr))[i]) = ' ';
|
||||
|
||||
/* Write the ar header for this item and the number of symbols */
|
||||
|
||||
if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), arch)
|
||||
!= sizeof (struct ar_hdr))
|
||||
return false;
|
||||
|
||||
bfd_putb64 ((bfd_vma) symbol_count, buf);
|
||||
if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8)
|
||||
return false;
|
||||
|
||||
/* Two passes, first write the file offsets for each symbol -
|
||||
remembering that each offset is on a two byte boundary. */
|
||||
|
||||
/* Write out the file offset for the file associated with each
|
||||
symbol, and remember to keep the offsets padded out. */
|
||||
|
||||
current = arch->archive_head;
|
||||
count = 0;
|
||||
while (current != (bfd *) NULL && count < symbol_count)
|
||||
{
|
||||
/* For each symbol which is used defined in this object, write out
|
||||
the object file's address in the archive */
|
||||
|
||||
while (map[count].u.abfd == current)
|
||||
{
|
||||
bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf);
|
||||
if (bfd_bwrite (buf, (bfd_size_type) 8, arch) != 8)
|
||||
return false;
|
||||
count++;
|
||||
}
|
||||
/* Add size of this archive entry */
|
||||
archive_member_file_ptr += (arelt_size (current)
|
||||
+ sizeof (struct ar_hdr));
|
||||
/* remember about the even alignment */
|
||||
archive_member_file_ptr += archive_member_file_ptr % 2;
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
/* now write the strings themselves */
|
||||
for (count = 0; count < symbol_count; count++)
|
||||
{
|
||||
size_t len = strlen (*map[count].name) + 1;
|
||||
|
||||
if (bfd_bwrite (*map[count].name, (bfd_size_type) len, arch) != len)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* The spec says that this should be padded to an 8 byte boundary.
|
||||
However, the Irix 6.2 tools do not appear to do this. */
|
||||
while (padding != 0)
|
||||
{
|
||||
if (bfd_bwrite ("", (bfd_size_type) 1, arch) != 1)
|
||||
return false;
|
||||
--padding;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
s|\(.*\) [^ ]*header.sed.*|\1|
|
||||
s|[^ ]*/||g
|
||||
s|^ *|"|
|
||||
s| |", "|g
|
||||
s|$|"|
|
||||
s|, \([^ ]*\)$| and \1|
|
||||
s|^|/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically generated from |
|
||||
s|\(.\{60\}[^ ]* \)|\1\
|
||||
|g
|
||||
s|$|.\
|
||||
Run "make headers" in your build bfd/ to regenerate. */\
|
||||
|
|
||||
@@ -1,449 +0,0 @@
|
||||
/* ELF strtab with GC and suffix merging support.
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
Written by Jakub Jelinek <[email protected]>.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
#include "hashtab.h"
|
||||
|
||||
/* An entry in the strtab hash table. */
|
||||
|
||||
struct elf_strtab_hash_entry
|
||||
{
|
||||
struct bfd_hash_entry root;
|
||||
/* Length of this entry. */
|
||||
unsigned int len;
|
||||
unsigned int refcount;
|
||||
union {
|
||||
/* Index within the merged section. */
|
||||
bfd_size_type index;
|
||||
/* Entry this is a suffix of (if len is 0). */
|
||||
struct elf_strtab_hash_entry *suffix;
|
||||
struct elf_strtab_hash_entry *next;
|
||||
} u;
|
||||
};
|
||||
|
||||
/* The strtab hash table. */
|
||||
|
||||
struct elf_strtab_hash
|
||||
{
|
||||
struct bfd_hash_table table;
|
||||
/* Next available index. */
|
||||
bfd_size_type size;
|
||||
/* Number of array entries alloced. */
|
||||
bfd_size_type alloced;
|
||||
/* Final strtab size. */
|
||||
bfd_size_type sec_size;
|
||||
/* Array of pointers to strtab entries. */
|
||||
struct elf_strtab_hash_entry **array;
|
||||
};
|
||||
|
||||
static struct bfd_hash_entry *elf_strtab_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
static int cmplengthentry PARAMS ((const PTR, const PTR));
|
||||
static int last4_eq PARAMS ((const PTR, const PTR));
|
||||
|
||||
/* Routine to create an entry in a section merge hashtab. */
|
||||
|
||||
static struct bfd_hash_entry *
|
||||
elf_strtab_hash_newfunc (entry, table, string)
|
||||
struct bfd_hash_entry *entry;
|
||||
struct bfd_hash_table *table;
|
||||
const char *string;
|
||||
{
|
||||
struct elf_strtab_hash_entry *ret = (struct elf_strtab_hash_entry *) entry;
|
||||
|
||||
/* Allocate the structure if it has not already been allocated by a
|
||||
subclass. */
|
||||
if (ret == (struct elf_strtab_hash_entry *) NULL)
|
||||
ret = ((struct elf_strtab_hash_entry *)
|
||||
bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry)));
|
||||
if (ret == (struct elf_strtab_hash_entry *) NULL)
|
||||
return NULL;
|
||||
|
||||
/* Call the allocation method of the superclass. */
|
||||
ret = ((struct elf_strtab_hash_entry *)
|
||||
bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string));
|
||||
|
||||
if (ret)
|
||||
{
|
||||
/* Initialize the local fields. */
|
||||
ret->u.index = -1;
|
||||
ret->refcount = 0;
|
||||
ret->len = 0;
|
||||
}
|
||||
|
||||
return (struct bfd_hash_entry *)ret;
|
||||
}
|
||||
|
||||
/* Create a new hash table. */
|
||||
|
||||
struct elf_strtab_hash *
|
||||
_bfd_elf_strtab_init ()
|
||||
{
|
||||
struct elf_strtab_hash *table;
|
||||
bfd_size_type amt = sizeof (struct elf_strtab_hash);
|
||||
|
||||
table = (struct elf_strtab_hash *) bfd_malloc (amt);
|
||||
if (table == NULL)
|
||||
return NULL;
|
||||
|
||||
if (! bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc))
|
||||
{
|
||||
free (table);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
table->sec_size = 0;
|
||||
table->size = 1;
|
||||
table->alloced = 64;
|
||||
amt = sizeof (struct elf_strtab_hasn_entry *);
|
||||
table->array = (struct elf_strtab_hash_entry **)
|
||||
bfd_malloc (table->alloced * amt);
|
||||
if (table->array == NULL)
|
||||
{
|
||||
free (table);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
table->array[0] = NULL;
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
/* Free a strtab. */
|
||||
|
||||
void
|
||||
_bfd_elf_strtab_free (tab)
|
||||
struct elf_strtab_hash *tab;
|
||||
{
|
||||
bfd_hash_table_free (&tab->table);
|
||||
free (tab->array);
|
||||
free (tab);
|
||||
}
|
||||
|
||||
/* Get the index of an entity in a hash table, adding it if it is not
|
||||
already present. */
|
||||
|
||||
bfd_size_type
|
||||
_bfd_elf_strtab_add (tab, str, copy)
|
||||
struct elf_strtab_hash *tab;
|
||||
const char *str;
|
||||
boolean copy;
|
||||
{
|
||||
register struct elf_strtab_hash_entry *entry;
|
||||
|
||||
/* We handle this specially, since we don't want to do refcounting
|
||||
on it. */
|
||||
if (*str == '\0')
|
||||
return 0;
|
||||
|
||||
BFD_ASSERT (tab->sec_size == 0);
|
||||
entry = (struct elf_strtab_hash_entry *)
|
||||
bfd_hash_lookup (&tab->table, str, true, copy);
|
||||
|
||||
if (entry == NULL)
|
||||
return (bfd_size_type) -1;
|
||||
|
||||
entry->refcount++;
|
||||
if (entry->len == 0)
|
||||
{
|
||||
entry->len = strlen (str) + 1;
|
||||
if (tab->size == tab->alloced)
|
||||
{
|
||||
bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *);
|
||||
tab->alloced *= 2;
|
||||
tab->array = (struct elf_strtab_hash_entry **)
|
||||
bfd_realloc (tab->array, tab->alloced * amt);
|
||||
if (tab->array == NULL)
|
||||
return (bfd_size_type) -1;
|
||||
}
|
||||
|
||||
entry->u.index = tab->size++;
|
||||
tab->array[entry->u.index] = entry;
|
||||
}
|
||||
return entry->u.index;
|
||||
}
|
||||
|
||||
void
|
||||
_bfd_elf_strtab_addref (tab, idx)
|
||||
struct elf_strtab_hash *tab;
|
||||
bfd_size_type idx;
|
||||
{
|
||||
if (idx == 0 || idx == (bfd_size_type) -1)
|
||||
return;
|
||||
BFD_ASSERT (tab->sec_size == 0);
|
||||
BFD_ASSERT (idx < tab->size);
|
||||
++tab->array[idx]->refcount;
|
||||
}
|
||||
|
||||
void
|
||||
_bfd_elf_strtab_delref (tab, idx)
|
||||
struct elf_strtab_hash *tab;
|
||||
bfd_size_type idx;
|
||||
{
|
||||
if (idx == 0 || idx == (bfd_size_type) -1)
|
||||
return;
|
||||
BFD_ASSERT (tab->sec_size == 0);
|
||||
BFD_ASSERT (idx < tab->size);
|
||||
BFD_ASSERT (tab->array[idx]->refcount > 0);
|
||||
--tab->array[idx]->refcount;
|
||||
}
|
||||
|
||||
void
|
||||
_bfd_elf_strtab_clear_all_refs (tab)
|
||||
struct elf_strtab_hash *tab;
|
||||
{
|
||||
bfd_size_type idx;
|
||||
|
||||
for (idx = 1; idx < tab->size; ++idx)
|
||||
tab->array[idx]->refcount = 0;
|
||||
}
|
||||
|
||||
bfd_size_type
|
||||
_bfd_elf_strtab_size (tab)
|
||||
struct elf_strtab_hash *tab;
|
||||
{
|
||||
return tab->sec_size ? tab->sec_size : tab->size;
|
||||
}
|
||||
|
||||
bfd_size_type
|
||||
_bfd_elf_strtab_offset (tab, idx)
|
||||
struct elf_strtab_hash *tab;
|
||||
bfd_size_type idx;
|
||||
{
|
||||
struct elf_strtab_hash_entry *entry;
|
||||
|
||||
if (idx == 0)
|
||||
return 0;
|
||||
BFD_ASSERT (idx < tab->size);
|
||||
BFD_ASSERT (tab->sec_size);
|
||||
entry = tab->array[idx];
|
||||
BFD_ASSERT (entry->refcount > 0);
|
||||
entry->refcount--;
|
||||
return tab->array[idx]->u.index;
|
||||
}
|
||||
|
||||
boolean
|
||||
_bfd_elf_strtab_emit (abfd, tab)
|
||||
register bfd *abfd;
|
||||
struct elf_strtab_hash *tab;
|
||||
{
|
||||
bfd_size_type off = 1, i;
|
||||
|
||||
if (bfd_bwrite ("", 1, abfd) != 1)
|
||||
return false;
|
||||
|
||||
for (i = 1; i < tab->size; ++i)
|
||||
{
|
||||
register const char *str;
|
||||
register size_t len;
|
||||
|
||||
str = tab->array[i]->root.string;
|
||||
len = tab->array[i]->len;
|
||||
BFD_ASSERT (tab->array[i]->refcount == 0);
|
||||
if (len == 0)
|
||||
continue;
|
||||
|
||||
if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
|
||||
return false;
|
||||
|
||||
off += len;
|
||||
}
|
||||
|
||||
BFD_ASSERT (off == tab->sec_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Compare two elf_strtab_hash_entry structures. This is called via qsort. */
|
||||
|
||||
static int
|
||||
cmplengthentry (a, b)
|
||||
const PTR a;
|
||||
const PTR b;
|
||||
{
|
||||
struct elf_strtab_hash_entry * A = *(struct elf_strtab_hash_entry **) a;
|
||||
struct elf_strtab_hash_entry * B = *(struct elf_strtab_hash_entry **) b;
|
||||
|
||||
if (A->len < B->len)
|
||||
return 1;
|
||||
else if (A->len > B->len)
|
||||
return -1;
|
||||
|
||||
return memcmp (A->root.string, B->root.string, A->len);
|
||||
}
|
||||
|
||||
static int
|
||||
last4_eq (a, b)
|
||||
const PTR a;
|
||||
const PTR b;
|
||||
{
|
||||
struct elf_strtab_hash_entry * A = (struct elf_strtab_hash_entry *) a;
|
||||
struct elf_strtab_hash_entry * B = (struct elf_strtab_hash_entry *) b;
|
||||
|
||||
if (memcmp (A->root.string + A->len - 5, B->root.string + B->len - 5, 4)
|
||||
!= 0)
|
||||
/* This was a hashtable collision. */
|
||||
return 0;
|
||||
|
||||
if (A->len <= B->len)
|
||||
/* B cannot be a suffix of A unless A is equal to B, which is guaranteed
|
||||
not to be equal by the hash table. */
|
||||
return 0;
|
||||
|
||||
return memcmp (A->root.string + (A->len - B->len),
|
||||
B->root.string, B->len - 5) == 0;
|
||||
}
|
||||
|
||||
/* This function assigns final string table offsets for used strings,
|
||||
merging strings matching suffixes of longer strings if possible. */
|
||||
|
||||
void
|
||||
_bfd_elf_strtab_finalize (tab)
|
||||
struct elf_strtab_hash *tab;
|
||||
{
|
||||
struct elf_strtab_hash_entry **array, **a, **end, *e;
|
||||
htab_t last4tab = NULL;
|
||||
bfd_size_type size, amt;
|
||||
struct elf_strtab_hash_entry *last[256], **last_ptr[256];
|
||||
|
||||
/* GCC 2.91.66 (egcs-1.1.2) on i386 miscompiles this function when i is
|
||||
a 64-bit bfd_size_type: a 64-bit target or --enable-64-bit-bfd.
|
||||
Besides, indexing with a long long wouldn't give anything but extra
|
||||
cycles. */
|
||||
size_t i;
|
||||
|
||||
/* Now sort the strings by length, longest first. */
|
||||
array = NULL;
|
||||
amt = tab->size * sizeof (struct elf_strtab_hash_entry *);
|
||||
array = (struct elf_strtab_hash_entry **) bfd_malloc (amt);
|
||||
if (array == NULL)
|
||||
goto alloc_failure;
|
||||
|
||||
memset (last, 0, sizeof (last));
|
||||
for (i = 0; i < 256; ++i)
|
||||
last_ptr[i] = &last[i];
|
||||
for (i = 1, a = array; i < tab->size; ++i)
|
||||
if (tab->array[i]->refcount)
|
||||
*a++ = tab->array[i];
|
||||
else
|
||||
tab->array[i]->len = 0;
|
||||
|
||||
size = a - array;
|
||||
|
||||
qsort (array, size, sizeof (struct elf_strtab_hash_entry *), cmplengthentry);
|
||||
|
||||
last4tab = htab_create (size * 4, NULL, last4_eq, NULL);
|
||||
if (last4tab == NULL)
|
||||
goto alloc_failure;
|
||||
|
||||
/* Now insert the strings into hash tables (strings with last 4 characters
|
||||
and strings with last character equal), look for longer strings which
|
||||
we're suffix of. */
|
||||
for (a = array, end = array + size; a < end; a++)
|
||||
{
|
||||
register hashval_t hash;
|
||||
unsigned int c;
|
||||
unsigned int j;
|
||||
const unsigned char *s;
|
||||
PTR *p;
|
||||
|
||||
e = *a;
|
||||
if (e->len > 4)
|
||||
{
|
||||
s = e->root.string + e->len - 1;
|
||||
hash = 0;
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
c = *--s;
|
||||
hash += c + (c << 17);
|
||||
hash ^= hash >> 2;
|
||||
}
|
||||
p = htab_find_slot_with_hash (last4tab, e, hash, INSERT);
|
||||
if (p == NULL)
|
||||
goto alloc_failure;
|
||||
if (*p)
|
||||
{
|
||||
struct elf_strtab_hash_entry *ent;
|
||||
|
||||
ent = (struct elf_strtab_hash_entry *) *p;
|
||||
e->u.suffix = ent;
|
||||
e->len = 0;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
*p = (PTR) e;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct elf_strtab_hash_entry *tem;
|
||||
|
||||
c = e->root.string[e->len - 2] & 0xff;
|
||||
|
||||
for (tem = last[c]; tem; tem = tem->u.next)
|
||||
if (tem->len > e->len
|
||||
&& memcmp (tem->root.string + (tem->len - e->len),
|
||||
e->root.string, e->len - 1) == 0)
|
||||
break;
|
||||
if (tem)
|
||||
{
|
||||
e->u.suffix = tem;
|
||||
e->len = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
c = e->root.string[e->len - 2] & 0xff;
|
||||
/* Put longest strings first. */
|
||||
*last_ptr[c] = e;
|
||||
last_ptr[c] = &e->u.next;
|
||||
e->u.next = NULL;
|
||||
}
|
||||
|
||||
alloc_failure:
|
||||
if (array)
|
||||
free (array);
|
||||
if (last4tab)
|
||||
htab_delete (last4tab);
|
||||
|
||||
/* Now assign positions to the strings we want to keep. */
|
||||
size = 1;
|
||||
for (i = 1; i < tab->size; ++i)
|
||||
{
|
||||
e = tab->array[i];
|
||||
if (e->refcount && e->len)
|
||||
{
|
||||
e->u.index = size;
|
||||
size += e->len;
|
||||
}
|
||||
}
|
||||
|
||||
tab->sec_size = size;
|
||||
|
||||
/* And now adjust the rest. */
|
||||
for (i = 1; i < tab->size; ++i)
|
||||
{
|
||||
e = tab->array[i];
|
||||
if (e->refcount && ! e->len)
|
||||
e->u.index = e->u.suffix->u.index
|
||||
+ (e->u.suffix->len - strlen (e->root.string) - 1);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,207 +0,0 @@
|
||||
@c Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
@c This is part of the GAS manual.
|
||||
@c For copying conditions, see the file as.texinfo.
|
||||
|
||||
@ifset GENERIC
|
||||
@page
|
||||
@node ARC-Dependent
|
||||
@chapter ARC Dependent Features
|
||||
@end ifset
|
||||
|
||||
@ifclear GENERIC
|
||||
@node Machine Dependencies
|
||||
@chapter ARC Dependent Features
|
||||
@end ifclear
|
||||
|
||||
@set ARC_CORE_DEFAULT 6
|
||||
|
||||
@cindex ARC support
|
||||
@menu
|
||||
* ARC Options:: Options
|
||||
* ARC Syntax:: Syntax
|
||||
* ARC Floating Point:: Floating Point
|
||||
* ARC Directives:: ARC Machine Directives
|
||||
* ARC Opcodes:: Opcodes
|
||||
@end menu
|
||||
|
||||
|
||||
@node ARC Options
|
||||
@section Options
|
||||
@cindex ARC options (none)
|
||||
@cindex options for ARC (none)
|
||||
|
||||
@table @code
|
||||
|
||||
@cindex @code{-marc[5|6|7|8]} command line option, ARC
|
||||
@item -marc[5|6|7|8]
|
||||
This option selects the core processor variant. Using
|
||||
@code{-marc} is the same as @code{-marc@value{ARC_CORE_DEFAULT}}, which
|
||||
is also the default.
|
||||
|
||||
@table @code
|
||||
|
||||
@cindex @code{arc5} arc5, ARC
|
||||
@item arc5
|
||||
Base instruction set.
|
||||
|
||||
@cindex @code{arc6} arc6, ARC
|
||||
@item arc6
|
||||
Jump-and-link (jl) instruction. No requirement of an instruction between
|
||||
setting flags and conditional jump. For example:
|
||||
|
||||
@smallexample
|
||||
mov.f r0,r1
|
||||
beq foo
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{arc7} arc7, ARC
|
||||
@item arc7
|
||||
Break (brk) and sleep (sleep) instructions.
|
||||
|
||||
@cindex @code{arc8} arc8, ARC
|
||||
@item arc8
|
||||
Software interrupt (swi) instruction.
|
||||
|
||||
@end table
|
||||
|
||||
Note: the @code{.option} directive can to be used to select a core
|
||||
variant from within assembly code.
|
||||
|
||||
@cindex @code{-EB} command line option, ARC
|
||||
@item -EB
|
||||
This option specifies that the output generated by the assembler should
|
||||
be marked as being encoded for a big-endian processor.
|
||||
|
||||
@cindex @code{-EL} command line option, ARC
|
||||
@item -EL
|
||||
This option specifies that the output generated by the assembler should
|
||||
be marked as being encoded for a little-endian processor - this is the
|
||||
default.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node ARC Syntax
|
||||
@section Syntax
|
||||
@menu
|
||||
* ARC-Chars:: Special Characters
|
||||
* ARC-Regs:: Register Names
|
||||
@end menu
|
||||
|
||||
@node ARC-Chars
|
||||
@subsection Special Characters
|
||||
|
||||
@cindex ARC special characters
|
||||
@cindex special characters, ARC
|
||||
*TODO*
|
||||
|
||||
@node ARC-Regs
|
||||
@subsection Register Names
|
||||
|
||||
@cindex ARC register names
|
||||
@cindex register names, ARC
|
||||
*TODO*
|
||||
|
||||
|
||||
@node ARC Floating Point
|
||||
@section Floating Point
|
||||
|
||||
@cindex floating point, ARC (@sc{ieee})
|
||||
@cindex ARC floating point (@sc{ieee})
|
||||
The ARC core does not currently have hardware floating point
|
||||
support. Software floating point support is provided by @code{GCC}
|
||||
and uses @sc{ieee} floating-point numbers.
|
||||
|
||||
|
||||
@node ARC Directives
|
||||
@section ARC Machine Directives
|
||||
|
||||
@cindex machine directives, ARC
|
||||
@cindex ARC machine directives
|
||||
The ARC version of @code{@value{AS}} supports the following additional
|
||||
machine directives:
|
||||
|
||||
@table @code
|
||||
|
||||
@cindex @code{2byte} directive, ARC
|
||||
@item .2byte @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{3byte} directive, ARC
|
||||
@item .3byte @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{4byte} directive, ARC
|
||||
@item .4byte @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{extAuxRegister} directive, ARC
|
||||
@item .extAuxRegister @var{name},@var{address},@var{mode}
|
||||
*TODO*
|
||||
|
||||
@smallexample
|
||||
.extAuxRegister mulhi,0x12,w
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{extCondCode} directive, ARC
|
||||
@item .extCondCode @var{suffix},@var{value}
|
||||
*TODO*
|
||||
|
||||
@smallexample
|
||||
.extCondCode is_busy,0x14
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{extCoreRegister} directive, ARC
|
||||
@item .extCoreRegister @var{name},@var{regnum},@var{mode},@var{shortcut}
|
||||
*TODO*
|
||||
|
||||
@smallexample
|
||||
.extCoreRegister mlo,57,r,can_shortcut
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{extInstruction} directive, ARC
|
||||
@item .extInstruction @var{name},@var{opcode},@var{subopcode},@var{suffixclass},@var{syntaxclass}
|
||||
*TODO*
|
||||
|
||||
@smallexample
|
||||
.extInstruction mul64,0x14,0x0,SUFFIX_COND,SYNTAX_3OP|OP1_MUST_BE_IMM
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{half} directive, ARC
|
||||
@item .half @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{long} directive, ARC
|
||||
@item .long @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{option} directive, ARC
|
||||
@item .option @var{arc|arc5|arc6|arc7|arc8}
|
||||
The @code{.option} directive must be followed by the desired core
|
||||
version. Again @code{arc} is an alias for
|
||||
@code{arc@value{ARC_CORE_DEFAULT}}.
|
||||
|
||||
Note: the @code{.option} directive overrides the command line option
|
||||
@code{-marc}; a warning is emitted when the version is not consistent
|
||||
between the two - even for the implicit default core version
|
||||
(arc@value{ARC_CORE_DEFAULT}).
|
||||
|
||||
@cindex @code{short} directive, ARC
|
||||
@item .short @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@cindex @code{word} directive, ARC
|
||||
@item .word @var{expressions}
|
||||
*TODO*
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@node ARC Opcodes
|
||||
@section Opcodes
|
||||
|
||||
@cindex ARC opcodes
|
||||
@cindex opcodes for ARC
|
||||
|
||||
For information on the ARC instruction set, see @cite{ARC Programmers
|
||||
Reference Manual}, ARC Cores Ltd.
|
||||
@@ -1,254 +0,0 @@
|
||||
/* external.h -- External COFF structures
|
||||
|
||||
Copyright 2001 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 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. */
|
||||
|
||||
#ifndef COFF_EXTERNAL_H
|
||||
#define COFF_EXTERNAL_H
|
||||
|
||||
#ifndef DO_NOT_DEFINE_FILHDR
|
||||
/********************** FILE HEADER **********************/
|
||||
|
||||
struct external_filehdr
|
||||
{
|
||||
char f_magic[2]; /* magic number */
|
||||
char f_nscns[2]; /* number of sections */
|
||||
char f_timdat[4]; /* time & date stamp */
|
||||
char f_symptr[4]; /* file pointer to symtab */
|
||||
char f_nsyms[4]; /* number of symtab entries */
|
||||
char f_opthdr[2]; /* sizeof(optional hdr) */
|
||||
char f_flags[2]; /* flags */
|
||||
};
|
||||
|
||||
#define FILHDR struct external_filehdr
|
||||
#define FILHSZ 20
|
||||
#endif
|
||||
|
||||
#ifndef DO_NOT_DEFINE_AOUTHDR
|
||||
/********************** AOUT "OPTIONAL HEADER" **********************/
|
||||
|
||||
typedef struct external_aouthdr
|
||||
{
|
||||
char magic[2]; /* type of file */
|
||||
char vstamp[2]; /* version stamp */
|
||||
char tsize[4]; /* text size in bytes, padded to FW bdry*/
|
||||
char dsize[4]; /* initialized data " " */
|
||||
char bsize[4]; /* uninitialized data " " */
|
||||
char entry[4]; /* entry pt. */
|
||||
char text_start[4]; /* base of text used for this file */
|
||||
char data_start[4]; /* base of data used for this file */
|
||||
}
|
||||
AOUTHDR;
|
||||
|
||||
#define AOUTHDRSZ 28
|
||||
#define AOUTSZ 28
|
||||
#endif
|
||||
|
||||
#ifndef DO_NOT_DEFINE_SCNHDR
|
||||
/********************** SECTION HEADER **********************/
|
||||
|
||||
struct external_scnhdr
|
||||
{
|
||||
char s_name[8]; /* section name */
|
||||
char s_paddr[4]; /* physical address, aliased s_nlib */
|
||||
char s_vaddr[4]; /* virtual address */
|
||||
char s_size[4]; /* section size */
|
||||
char s_scnptr[4]; /* file ptr to raw data for section */
|
||||
char s_relptr[4]; /* file ptr to relocation */
|
||||
char s_lnnoptr[4]; /* file ptr to line numbers */
|
||||
char s_nreloc[2]; /* number of relocation entries */
|
||||
char s_nlnno[2]; /* number of line number entries */
|
||||
char s_flags[4]; /* flags */
|
||||
};
|
||||
|
||||
#define SCNHDR struct external_scnhdr
|
||||
#define SCNHSZ 40
|
||||
|
||||
/* Names of "special" sections. */
|
||||
|
||||
#define _TEXT ".text"
|
||||
#define _DATA ".data"
|
||||
#define _BSS ".bss"
|
||||
#define _COMMENT ".comment"
|
||||
#define _LIB ".lib"
|
||||
#endif /* not DO_NOT_DEFINE_SCNHDR */
|
||||
|
||||
#ifndef DO_NOT_DEFINE_LINENO
|
||||
|
||||
/********************** LINE NUMBERS **********************/
|
||||
|
||||
#ifndef L_LNNO_SIZE
|
||||
#error L_LNNO_SIZE needs to be defined
|
||||
#endif
|
||||
|
||||
/* 1 line number entry for every "breakpointable" source line in a section.
|
||||
Line numbers are grouped on a per function basis; first entry in a function
|
||||
grouping will have l_lnno = 0 and in place of physical address will be the
|
||||
symbol table index of the function name. */
|
||||
struct external_lineno
|
||||
{
|
||||
union
|
||||
{
|
||||
char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
|
||||
char l_paddr[4]; /* (physical) address of line number */
|
||||
} l_addr;
|
||||
|
||||
char l_lnno[L_LNNO_SIZE]; /* line number */
|
||||
};
|
||||
|
||||
#define LINENO struct external_lineno
|
||||
#define LINESZ (4 + L_LNNO_SIZE)
|
||||
|
||||
#if L_LNNO_SIZE == 4
|
||||
#define GET_LINENO_LNNO(abfd, ext) H_GET_32 (abfd, (ext->l_lnno))
|
||||
#define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_32 (abfd, val, (ext->l_lnno))
|
||||
#endif
|
||||
#if L_LNNO_SIZE == 2
|
||||
#define GET_LINENO_LNNO(abfd, ext) H_GET_16 (abfd, (ext->l_lnno))
|
||||
#define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_16 (abfd, val, (ext->l_lnno))
|
||||
#endif
|
||||
|
||||
#endif /* not DO_NOT_DEFINE_LINENO */
|
||||
|
||||
#ifndef DO_NOT_DEFINE_SYMENT
|
||||
/********************** SYMBOLS **********************/
|
||||
|
||||
#define E_SYMNMLEN 8 /* # characters in a symbol name */
|
||||
#ifndef E_FILNMLEN
|
||||
#define E_FILNMLEN 14
|
||||
#endif
|
||||
#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
|
||||
|
||||
struct external_syment
|
||||
{
|
||||
union
|
||||
{
|
||||
char e_name[E_SYMNMLEN];
|
||||
|
||||
struct
|
||||
{
|
||||
char e_zeroes[4];
|
||||
char e_offset[4];
|
||||
} e;
|
||||
} e;
|
||||
|
||||
char e_value[4];
|
||||
char e_scnum[2];
|
||||
char e_type[2];
|
||||
char e_sclass[1];
|
||||
char e_numaux[1];
|
||||
};
|
||||
|
||||
#define SYMENT struct external_syment
|
||||
#define SYMESZ 18
|
||||
|
||||
#ifndef N_BTMASK
|
||||
#define N_BTMASK 0xf
|
||||
#endif
|
||||
|
||||
#ifndef N_TMASK
|
||||
#define N_TMASK 0x30
|
||||
#endif
|
||||
|
||||
#ifndef N_BTSHFT
|
||||
#define N_BTSHFT 4
|
||||
#endif
|
||||
|
||||
#ifndef N_TSHIFT
|
||||
#define N_TSHIFT 2
|
||||
#endif
|
||||
|
||||
#endif /* not DO_NOT_DEFINE_SYMENT */
|
||||
|
||||
#ifndef DO_NOT_DEFINE_AUXENT
|
||||
|
||||
union external_auxent
|
||||
{
|
||||
struct
|
||||
{
|
||||
char x_tagndx[4]; /* str, un, or enum tag indx */
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
char x_lnno[2]; /* declaration line number */
|
||||
char x_size[2]; /* str/union/array size */
|
||||
} x_lnsz;
|
||||
|
||||
char x_fsize[4]; /* size of function */
|
||||
|
||||
} x_misc;
|
||||
|
||||
union
|
||||
{
|
||||
struct /* if ISFCN, tag, or .bb */
|
||||
{
|
||||
char x_lnnoptr[4]; /* ptr to fcn line # */
|
||||
char x_endndx[4]; /* entry ndx past block end */
|
||||
} x_fcn;
|
||||
|
||||
struct /* if ISARY, up to 4 dimen. */
|
||||
{
|
||||
char x_dimen[E_DIMNUM][2];
|
||||
} x_ary;
|
||||
|
||||
} x_fcnary;
|
||||
|
||||
char x_tvndx[2]; /* tv index */
|
||||
|
||||
} x_sym;
|
||||
|
||||
union
|
||||
{
|
||||
char x_fname[E_FILNMLEN];
|
||||
|
||||
struct
|
||||
{
|
||||
char x_zeroes[4];
|
||||
char x_offset[4];
|
||||
} x_n;
|
||||
|
||||
} x_file;
|
||||
|
||||
struct
|
||||
{
|
||||
char x_scnlen[4]; /* section length */
|
||||
char x_nreloc[2]; /* # relocation entries */
|
||||
char x_nlinno[2]; /* # line numbers */
|
||||
#ifdef INCLUDE_COMDAT_FIELDS_IN_AUXENT
|
||||
char x_checksum[4]; /* section COMDAT checksum */
|
||||
char x_associated[2]; /* COMDAT associated section index */
|
||||
char x_comdat[1]; /* COMDAT selection number */
|
||||
#endif
|
||||
} x_scn;
|
||||
|
||||
struct
|
||||
{
|
||||
char x_tvfill[4]; /* tv fill value */
|
||||
char x_tvlen[2]; /* length of .tv */
|
||||
char x_tvran[2][2]; /* tv range */
|
||||
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
|
||||
};
|
||||
|
||||
#define AUXENT union external_auxent
|
||||
#define AUXESZ 18
|
||||
|
||||
#define _ETEXT "etext"
|
||||
|
||||
#endif /* not DO_NOT_DEFINE_AUXENT */
|
||||
|
||||
#endif /* COFF_EXTERNAL_H */
|
||||
@@ -1,96 +0,0 @@
|
||||
/* H8300/h8500 ELF support for BFD.
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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. */
|
||||
|
||||
#ifndef _ELF_H8_H
|
||||
#define _ELF_H8_H
|
||||
|
||||
#include "elf/reloc-macros.h"
|
||||
|
||||
/* Relocations. */
|
||||
/* Relocations 59..63 are GNU extensions. */
|
||||
START_RELOC_NUMBERS (elf_h8_reloc_type)
|
||||
RELOC_NUMBER (R_H8_NONE, 0)
|
||||
RELOC_NUMBER (R_H8_DIR32, 1)
|
||||
RELOC_NUMBER (R_H8_DIR32_28, 2)
|
||||
RELOC_NUMBER (R_H8_DIR32_24, 3)
|
||||
RELOC_NUMBER (R_H8_DIR32_16, 4)
|
||||
RELOC_NUMBER (R_H8_DIR32U, 6)
|
||||
RELOC_NUMBER (R_H8_DIR32U_28, 7)
|
||||
RELOC_NUMBER (R_H8_DIR32U_24, 8)
|
||||
RELOC_NUMBER (R_H8_DIR32U_20, 9)
|
||||
RELOC_NUMBER (R_H8_DIR32U_16, 10)
|
||||
RELOC_NUMBER (R_H8_DIR24, 11)
|
||||
RELOC_NUMBER (R_H8_DIR24_20, 12)
|
||||
RELOC_NUMBER (R_H8_DIR24_16, 13)
|
||||
RELOC_NUMBER (R_H8_DIR24U, 14)
|
||||
RELOC_NUMBER (R_H8_DIR24U_20, 15)
|
||||
RELOC_NUMBER (R_H8_DIR24U_16, 16)
|
||||
RELOC_NUMBER (R_H8_DIR16, 17)
|
||||
RELOC_NUMBER (R_H8_DIR16U, 18)
|
||||
RELOC_NUMBER (R_H8_DIR16S_32, 19)
|
||||
RELOC_NUMBER (R_H8_DIR16S_28, 20)
|
||||
RELOC_NUMBER (R_H8_DIR16S_24, 21)
|
||||
RELOC_NUMBER (R_H8_DIR16S_20, 22)
|
||||
RELOC_NUMBER (R_H8_DIR16S, 23)
|
||||
RELOC_NUMBER (R_H8_DIR8, 24)
|
||||
RELOC_NUMBER (R_H8_DIR8U, 25)
|
||||
RELOC_NUMBER (R_H8_DIR8Z_32, 26)
|
||||
RELOC_NUMBER (R_H8_DIR8Z_28, 27)
|
||||
RELOC_NUMBER (R_H8_DIR8Z_24, 28)
|
||||
RELOC_NUMBER (R_H8_DIR8Z_20, 29)
|
||||
RELOC_NUMBER (R_H8_DIR8Z_16, 30)
|
||||
RELOC_NUMBER (R_H8_PCREL16, 31)
|
||||
RELOC_NUMBER (R_H8_PCREL8, 32)
|
||||
RELOC_NUMBER (R_H8_BPOS, 33)
|
||||
FAKE_RELOC (R_H8_FIRST_INVALID_DIR_RELOC, 34)
|
||||
FAKE_RELOC (R_H8_LAST_INVALID_DIR_RELOC, 58)
|
||||
RELOC_NUMBER (R_H8_DIR16A8, 59)
|
||||
RELOC_NUMBER (R_H8_DIR16R8, 60)
|
||||
RELOC_NUMBER (R_H8_DIR24A8, 61)
|
||||
RELOC_NUMBER (R_H8_DIR24R8, 62)
|
||||
RELOC_NUMBER (R_H8_DIR32A16, 63)
|
||||
RELOC_NUMBER (R_H8_ABS32, 65)
|
||||
RELOC_NUMBER (R_H8_ABS32A16, 127)
|
||||
RELOC_NUMBER (R_H8_SYM, 128)
|
||||
RELOC_NUMBER (R_H8_OPneg, 129)
|
||||
RELOC_NUMBER (R_H8_OPadd, 130)
|
||||
RELOC_NUMBER (R_H8_OPsub, 131)
|
||||
RELOC_NUMBER (R_H8_OPmul, 132)
|
||||
RELOC_NUMBER (R_H8_OPdiv, 133)
|
||||
RELOC_NUMBER (R_H8_OPshla, 134)
|
||||
RELOC_NUMBER (R_H8_OPshra, 135)
|
||||
RELOC_NUMBER (R_H8_OPsctsize, 136)
|
||||
RELOC_NUMBER (R_H8_OPhword, 137)
|
||||
RELOC_NUMBER (R_H8_OPlword, 138)
|
||||
RELOC_NUMBER (R_H8_OPhigh, 139)
|
||||
RELOC_NUMBER (R_H8_OPlow, 140)
|
||||
RELOC_NUMBER (R_H8_OPscttop, 141)
|
||||
END_RELOC_NUMBERS (R_H8_max)
|
||||
|
||||
/* Machine variant if we know it. This field was invented at Cygnus,
|
||||
but it is hoped that other vendors will adopt it. If some standard
|
||||
is developed, this code should be changed to follow it. */
|
||||
|
||||
#define EF_H8_MACH 0x00FF0000
|
||||
|
||||
#define E_H8_MACH_H8300 0x00800000
|
||||
#define E_H8_MACH_H8300H 0x00810000
|
||||
#define E_H8_MACH_H8300S 0x00820000
|
||||
|
||||
#endif
|
||||
@@ -1,39 +0,0 @@
|
||||
/* OpenRISC ELF support for BFD.
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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. */
|
||||
|
||||
#ifndef _ELF_OPENRISC_H
|
||||
#define _ELF_OPENRISC_H
|
||||
|
||||
#include "elf/reloc-macros.h"
|
||||
|
||||
/* Relocations. */
|
||||
START_RELOC_NUMBERS (elf_openrisc_reloc_type)
|
||||
RELOC_NUMBER (R_OPENRISC_NONE, 0)
|
||||
RELOC_NUMBER (R_OPENRISC_INSN_REL_26, 1)
|
||||
RELOC_NUMBER (R_OPENRISC_INSN_ABS_26, 2)
|
||||
RELOC_NUMBER (R_OPENRISC_LO_16_IN_INSN, 3)
|
||||
RELOC_NUMBER (R_OPENRISC_HI_16_IN_INSN, 4)
|
||||
RELOC_NUMBER (R_OPENRISC_8, 5)
|
||||
RELOC_NUMBER (R_OPENRISC_16, 6)
|
||||
RELOC_NUMBER (R_OPENRISC_32, 7)
|
||||
RELOC_NUMBER (R_OPENRISC_GNU_VTINHERIT, 8)
|
||||
RELOC_NUMBER (R_OPENRISC_GNU_VTENTRY, 9)
|
||||
END_RELOC_NUMBERS (R_OPENRISC_max)
|
||||
|
||||
#endif /* _ELF_OPENRISC_H */
|
||||
@@ -1,73 +0,0 @@
|
||||
/* 390 ELF support for BFD.
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Carl B. Pedersen and Martin Schwidefsky.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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. */
|
||||
|
||||
#ifndef _ELF_390_H
|
||||
#define _ELF_390_H
|
||||
|
||||
/* Processor specific flags for the ELF header e_flags field. */
|
||||
|
||||
/* Symbol types. */
|
||||
|
||||
#define STACK_REG 15 /* Global Stack reg */
|
||||
#define BACKL_REG 14 /* Global Backlink reg */
|
||||
#define BASE_REG 13 /* Global Base reg */
|
||||
#define GOT_REG 12 /* Holds addr of GOT */
|
||||
|
||||
#include "elf/reloc-macros.h"
|
||||
|
||||
/* Relocation types. */
|
||||
|
||||
START_RELOC_NUMBERS (elf_s390_reloc_type)
|
||||
RELOC_NUMBER (R_390_NONE, 0) /* No reloc. */
|
||||
RELOC_NUMBER (R_390_8, 1) /* Direct 8 bit. */
|
||||
RELOC_NUMBER (R_390_12, 2) /* Direct 12 bit. */
|
||||
RELOC_NUMBER (R_390_16, 3) /* Direct 16 bit. */
|
||||
RELOC_NUMBER (R_390_32, 4) /* Direct 32 bit. */
|
||||
RELOC_NUMBER (R_390_PC32, 5) /* PC relative 32 bit. */
|
||||
RELOC_NUMBER (R_390_GOT12, 6) /* 12 bit GOT offset. */
|
||||
RELOC_NUMBER (R_390_GOT32, 7) /* 32 bit GOT offset. */
|
||||
RELOC_NUMBER (R_390_PLT32, 8) /* 32 bit PC relative PLT address. */
|
||||
RELOC_NUMBER (R_390_COPY, 9) /* Copy symbol at runtime. */
|
||||
RELOC_NUMBER (R_390_GLOB_DAT, 10) /* Create GOT entry. */
|
||||
RELOC_NUMBER (R_390_JMP_SLOT, 11) /* Create PLT entry. */
|
||||
RELOC_NUMBER (R_390_RELATIVE, 12) /* Adjust by program base. */
|
||||
RELOC_NUMBER (R_390_GOTOFF, 13) /* 32 bit offset to GOT. */
|
||||
RELOC_NUMBER (R_390_GOTPC, 14) /* 32 bit PC relative offset to GOT. */
|
||||
RELOC_NUMBER (R_390_GOT16, 15) /* 16 bit GOT offset. */
|
||||
RELOC_NUMBER (R_390_PC16, 16) /* PC relative 16 bit. */
|
||||
RELOC_NUMBER (R_390_PC16DBL, 17) /* PC relative 16 bit shifted by 1. */
|
||||
RELOC_NUMBER (R_390_PLT16DBL, 18) /* 16 bit PC rel. PLT shifted by 1. */
|
||||
RELOC_NUMBER (R_390_PC32DBL, 19) /* PC relative 32 bit shifted by 1. */
|
||||
RELOC_NUMBER (R_390_PLT32DBL, 20) /* 32 bit PC rel. PLT shifted by 1. */
|
||||
RELOC_NUMBER (R_390_GOTPCDBL, 21) /* 32 bit PC rel. GOT shifted by 1. */
|
||||
RELOC_NUMBER (R_390_64, 22) /* Direct 64 bit. */
|
||||
RELOC_NUMBER (R_390_PC64, 23) /* PC relative 64 bit. */
|
||||
RELOC_NUMBER (R_390_GOT64, 24) /* 64 bit GOT offset. */
|
||||
RELOC_NUMBER (R_390_PLT64, 25) /* 64 bit PC relative PLT address. */
|
||||
RELOC_NUMBER (R_390_GOTENT, 26) /* 32 bit PC rel. to GOT entry >> 1. */
|
||||
/* These are GNU extensions to enable C++ vtable garbage collection. */
|
||||
RELOC_NUMBER (R_390_GNU_VTINHERIT, 250)
|
||||
RELOC_NUMBER (R_390_GNU_VTENTRY, 251)
|
||||
END_RELOC_NUMBERS (R_390_max)
|
||||
|
||||
#endif /* _ELF_390_H */
|
||||
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/* XSTORMY16 ELF support for BFD.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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. */
|
||||
|
||||
#ifndef _ELF_XSTORMY16_H
|
||||
#define _ELF_XSTORMY16_H
|
||||
|
||||
#include "elf/reloc-macros.h"
|
||||
|
||||
/* Relocations. */
|
||||
START_RELOC_NUMBERS (elf_xstormy16_reloc_type)
|
||||
RELOC_NUMBER (R_XSTORMY16_NONE, 0)
|
||||
|
||||
RELOC_NUMBER (R_XSTORMY16_32, 1)
|
||||
RELOC_NUMBER (R_XSTORMY16_16, 2)
|
||||
RELOC_NUMBER (R_XSTORMY16_8, 3)
|
||||
RELOC_NUMBER (R_XSTORMY16_PC32, 4)
|
||||
RELOC_NUMBER (R_XSTORMY16_PC16, 5)
|
||||
RELOC_NUMBER (R_XSTORMY16_PC8, 6)
|
||||
|
||||
RELOC_NUMBER (R_XSTORMY16_REL_12, 7)
|
||||
RELOC_NUMBER (R_XSTORMY16_24, 8)
|
||||
RELOC_NUMBER (R_XSTORMY16_FPTR16, 9)
|
||||
|
||||
RELOC_NUMBER (R_XSTORMY16_GNU_VTINHERIT, 128)
|
||||
RELOC_NUMBER (R_XSTORMY16_GNU_VTENTRY, 129)
|
||||
END_RELOC_NUMBERS (R_XSTORMY16_max)
|
||||
|
||||
/* Define the data & instruction memory discriminator. In a linked
|
||||
executable, an symbol should be deemed to point to an instruction
|
||||
if ((address & XSTORMY16_INSN_MASK) == XSTORMY16_INSN_VALUE), and similarly
|
||||
for the data space. See also `ld/emulparams/elf32xstormy16.sh'. */
|
||||
#define XSTORMY16_DATA_MASK 0xffc00000
|
||||
#define XSTORMY16_DATA_VALUE 0x00000000
|
||||
#define XSTORMY16_INSN_MASK 0xffc00000
|
||||
#define XSTORMY16_INSN_VALUE 0x00400000
|
||||
|
||||
#endif /* _ELF_XSTORMY16_H */
|
||||
@@ -1,81 +0,0 @@
|
||||
/* A Fibonacci heap datatype.
|
||||
Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Daniel Berlin ([email protected]).
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
GCC 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.
|
||||
|
||||
GCC 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 GCC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Fibonacci heaps are somewhat complex, but, there's an article in
|
||||
DDJ that explains them pretty well:
|
||||
|
||||
http://www.ddj.com/articles/1997/9701/9701o/9701o.htm?topic=algoritms
|
||||
|
||||
Introduction to algorithms by Corman and Rivest also goes over them.
|
||||
|
||||
The original paper that introduced them is "Fibonacci heaps and their
|
||||
uses in improved network optimization algorithms" by Tarjan and
|
||||
Fredman (JACM 34(3), July 1987).
|
||||
|
||||
Amortized and real worst case time for operations:
|
||||
|
||||
ExtractMin: O(lg n) amortized. O(n) worst case.
|
||||
DecreaseKey: O(1) amortized. O(lg n) worst case.
|
||||
Insert: O(2) amortized. O(1) actual.
|
||||
Union: O(1) amortized. O(1) actual. */
|
||||
|
||||
#ifndef _FIBHEAP_H_
|
||||
#define _FIBHEAP_H_
|
||||
|
||||
#include <ansidecl.h>
|
||||
|
||||
typedef long fibheapkey_t;
|
||||
|
||||
typedef struct fibheap
|
||||
{
|
||||
size_t nodes;
|
||||
struct fibnode *min;
|
||||
struct fibnode *root;
|
||||
} *fibheap_t;
|
||||
|
||||
typedef struct fibnode
|
||||
{
|
||||
struct fibnode *parent;
|
||||
struct fibnode *child;
|
||||
struct fibnode *left;
|
||||
struct fibnode *right;
|
||||
fibheapkey_t key;
|
||||
void *data;
|
||||
unsigned int degree : 31;
|
||||
unsigned int mark : 1;
|
||||
} *fibnode_t;
|
||||
|
||||
extern fibheap_t fibheap_new PARAMS ((void));
|
||||
extern fibnode_t fibheap_insert PARAMS ((fibheap_t, fibheapkey_t, void *));
|
||||
extern int fibheap_empty PARAMS ((fibheap_t));
|
||||
extern fibheapkey_t fibheap_min_key PARAMS ((fibheap_t));
|
||||
extern fibheapkey_t fibheap_replace_key PARAMS ((fibheap_t, fibnode_t,
|
||||
fibheapkey_t));
|
||||
extern void *fibheap_replace_key_data PARAMS ((fibheap_t, fibnode_t,
|
||||
fibheapkey_t, void *));
|
||||
extern void *fibheap_extract_min PARAMS ((fibheap_t));
|
||||
extern void *fibheap_min PARAMS ((fibheap_t));
|
||||
extern void *fibheap_replace_data PARAMS ((fibheap_t, fibnode_t, void *));
|
||||
extern void *fibheap_delete_node PARAMS ((fibheap_t, fibnode_t));
|
||||
extern void fibheap_delete PARAMS ((fibheap_t));
|
||||
extern fibheap_t fibheap_union PARAMS ((fibheap_t, fibheap_t));
|
||||
|
||||
#endif /* _FIBHEAP_H_ */
|
||||
@@ -1,51 +0,0 @@
|
||||
/* ternary.h - Ternary Search Trees
|
||||
Copyright 2001 Free Software Foundation, Inc.
|
||||
|
||||
Contributed by Daniel Berlin ([email protected])
|
||||
|
||||
|
||||
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. */
|
||||
#ifndef TERNARY_H_
|
||||
#define TERNARY_H_
|
||||
/* Ternary search trees */
|
||||
|
||||
typedef struct ternary_node_def *ternary_tree;
|
||||
|
||||
typedef struct ternary_node_def
|
||||
{
|
||||
char splitchar;
|
||||
ternary_tree lokid;
|
||||
ternary_tree eqkid;
|
||||
ternary_tree hikid;
|
||||
}
|
||||
ternary_node;
|
||||
|
||||
/* Insert string S into tree P, associating it with DATA.
|
||||
Return the data in the tree associated with the string if it's
|
||||
already there, and replace is 0.
|
||||
Otherwise, replaces if it it exists, inserts if it doesn't, and
|
||||
returns the data you passed in. */
|
||||
PTR ternary_insert PARAMS ((ternary_tree *p, const char *s,
|
||||
PTR data, int replace));
|
||||
|
||||
/* Delete the ternary search tree rooted at P.
|
||||
Does NOT delete the data you associated with the strings. */
|
||||
void ternary_cleanup PARAMS ((ternary_tree p));
|
||||
|
||||
/* Search the ternary tree for string S, returning the data associated
|
||||
with it if found. */
|
||||
PTR ternary_search PARAMS ((const ternary_node *p, const char *s));
|
||||
#endif
|
||||
@@ -1,28 +0,0 @@
|
||||
/* This file redefines all regex external names before including
|
||||
a renamed copy of glibc's regex.h. */
|
||||
|
||||
#ifndef _XREGEX_H
|
||||
#define _XREGEX_H 1
|
||||
|
||||
# define regfree xregfree
|
||||
# define regexec xregexec
|
||||
# define regcomp xregcomp
|
||||
# define regerror xregerror
|
||||
# define re_set_registers xre_set_registers
|
||||
# define re_match_2 xre_match_2
|
||||
# define re_match xre_match
|
||||
# define re_search xre_search
|
||||
# define re_compile_pattern xre_compile_pattern
|
||||
# define re_set_syntax xre_set_syntax
|
||||
# define re_search_2 xre_search_2
|
||||
# define re_compile_fastmap xre_compile_fastmap
|
||||
# define re_syntax_options xre_syntax_options
|
||||
# define re_max_failures xre_max_failures
|
||||
|
||||
# define _REGEX_RE_COMP
|
||||
# define re_comp xre_comp
|
||||
# define re_exec xre_exec
|
||||
|
||||
#include "xregex2.h"
|
||||
|
||||
#endif /* xregex.h */
|
||||
@@ -1,565 +0,0 @@
|
||||
/* Definitions for data structures and routines for the regular
|
||||
expression library, version 0.12.
|
||||
Copyright (C) 1985,1989-1993,1995-1998, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#ifndef _REGEX_H
|
||||
#define _REGEX_H 1
|
||||
|
||||
/* Allow the use in C++ code. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* POSIX says that <sys/types.h> must be included (by the caller) before
|
||||
<regex.h>. */
|
||||
|
||||
#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS
|
||||
/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
|
||||
should be there. */
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
/* The following two types have to be signed and unsigned integer type
|
||||
wide enough to hold a value of a pointer. For most ANSI compilers
|
||||
ptrdiff_t and size_t should be likely OK. Still size of these two
|
||||
types is 2 for Microsoft C. Ugh... */
|
||||
typedef long int s_reg_t;
|
||||
typedef unsigned long int active_reg_t;
|
||||
|
||||
/* The following bits are used to determine the regexp syntax we
|
||||
recognize. The set/not-set meanings are chosen so that Emacs syntax
|
||||
remains the value 0. The bits are given in alphabetical order, and
|
||||
the definitions shifted by one from the previous bit; thus, when we
|
||||
add or remove a bit, only one other definition need change. */
|
||||
typedef unsigned long int reg_syntax_t;
|
||||
|
||||
/* If this bit is not set, then \ inside a bracket expression is literal.
|
||||
If set, then such a \ quotes the following character. */
|
||||
#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
|
||||
|
||||
/* If this bit is not set, then + and ? are operators, and \+ and \? are
|
||||
literals.
|
||||
If set, then \+ and \? are operators and + and ? are literals. */
|
||||
#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
|
||||
|
||||
/* If this bit is set, then character classes are supported. They are:
|
||||
[:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
|
||||
[:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
|
||||
If not set, then character classes are not supported. */
|
||||
#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
|
||||
|
||||
/* If this bit is set, then ^ and $ are always anchors (outside bracket
|
||||
expressions, of course).
|
||||
If this bit is not set, then it depends:
|
||||
^ is an anchor if it is at the beginning of a regular
|
||||
expression or after an open-group or an alternation operator;
|
||||
$ is an anchor if it is at the end of a regular expression, or
|
||||
before a close-group or an alternation operator.
|
||||
|
||||
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
|
||||
POSIX draft 11.2 says that * etc. in leading positions is undefined.
|
||||
We already implemented a previous draft which made those constructs
|
||||
invalid, though, so we haven't changed the code back. */
|
||||
#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
|
||||
|
||||
/* If this bit is set, then special characters are always special
|
||||
regardless of where they are in the pattern.
|
||||
If this bit is not set, then special characters are special only in
|
||||
some contexts; otherwise they are ordinary. Specifically,
|
||||
* + ? and intervals are only special when not after the beginning,
|
||||
open-group, or alternation operator. */
|
||||
#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
|
||||
|
||||
/* If this bit is set, then *, +, ?, and { cannot be first in an re or
|
||||
immediately after an alternation or begin-group operator. */
|
||||
#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
|
||||
|
||||
/* If this bit is set, then . matches newline.
|
||||
If not set, then it doesn't. */
|
||||
#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
|
||||
|
||||
/* If this bit is set, then . doesn't match NUL.
|
||||
If not set, then it does. */
|
||||
#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
|
||||
|
||||
/* If this bit is set, nonmatching lists [^...] do not match newline.
|
||||
If not set, they do. */
|
||||
#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
|
||||
|
||||
/* If this bit is set, either \{...\} or {...} defines an
|
||||
interval, depending on RE_NO_BK_BRACES.
|
||||
If not set, \{, \}, {, and } are literals. */
|
||||
#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
|
||||
|
||||
/* If this bit is set, +, ? and | aren't recognized as operators.
|
||||
If not set, they are. */
|
||||
#define RE_LIMITED_OPS (RE_INTERVALS << 1)
|
||||
|
||||
/* If this bit is set, newline is an alternation operator.
|
||||
If not set, newline is literal. */
|
||||
#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
|
||||
|
||||
/* If this bit is set, then `{...}' defines an interval, and \{ and \}
|
||||
are literals.
|
||||
If not set, then `\{...\}' defines an interval. */
|
||||
#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
|
||||
|
||||
/* If this bit is set, (...) defines a group, and \( and \) are literals.
|
||||
If not set, \(...\) defines a group, and ( and ) are literals. */
|
||||
#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
|
||||
|
||||
/* If this bit is set, then \<digit> matches <digit>.
|
||||
If not set, then \<digit> is a back-reference. */
|
||||
#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
|
||||
|
||||
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
||||
If not set, then \| is an alternation operator, and | is literal. */
|
||||
#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
|
||||
|
||||
/* If this bit is set, then an ending range point collating higher
|
||||
than the starting range point, as in [z-a], is invalid.
|
||||
If not set, then when ending range point collates higher than the
|
||||
starting range point, the range is ignored. */
|
||||
#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
|
||||
|
||||
/* If this bit is set, then an unmatched ) is ordinary.
|
||||
If not set, then an unmatched ) is invalid. */
|
||||
#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
|
||||
|
||||
/* If this bit is set, succeed as soon as we match the whole pattern,
|
||||
without further backtracking. */
|
||||
#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
|
||||
|
||||
/* If this bit is set, do not process the GNU regex operators.
|
||||
If not set, then the GNU regex operators are recognized. */
|
||||
#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
|
||||
|
||||
/* If this bit is set, turn on internal regex debugging.
|
||||
If not set, and debugging was on, turn it off.
|
||||
This only works if regex.c is compiled -DDEBUG.
|
||||
We define this bit always, so that all that's needed to turn on
|
||||
debugging is to recompile regex.c; the calling code can always have
|
||||
this bit set, and it won't affect anything in the normal case. */
|
||||
#define RE_DEBUG (RE_NO_GNU_OPS << 1)
|
||||
|
||||
/* If this bit is set, a syntactically invalid interval is treated as
|
||||
a string of ordinary characters. For example, the ERE 'a{1' is
|
||||
treated as 'a\{1'. */
|
||||
#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
|
||||
|
||||
/* This global variable defines the particular regexp syntax to use (for
|
||||
some interfaces). When a regexp is compiled, the syntax used is
|
||||
stored in the pattern buffer, so changing this does not affect
|
||||
already-compiled regexps. */
|
||||
extern reg_syntax_t re_syntax_options;
|
||||
|
||||
/* Define combinations of the above bits for the standard possibilities.
|
||||
(The [[[ comments delimit what gets put into the Texinfo file, so
|
||||
don't delete them!) */
|
||||
/* [[[begin syntaxes]]] */
|
||||
#define RE_SYNTAX_EMACS 0
|
||||
|
||||
#define RE_SYNTAX_AWK \
|
||||
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
|
||||
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
|
||||
|
||||
#define RE_SYNTAX_GNU_AWK \
|
||||
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
|
||||
& ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS))
|
||||
|
||||
#define RE_SYNTAX_POSIX_AWK \
|
||||
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
|
||||
| RE_INTERVALS | RE_NO_GNU_OPS)
|
||||
|
||||
#define RE_SYNTAX_GREP \
|
||||
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
|
||||
| RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
|
||||
| RE_NEWLINE_ALT)
|
||||
|
||||
#define RE_SYNTAX_EGREP \
|
||||
(RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
|
||||
| RE_NEWLINE_ALT | RE_NO_BK_PARENS \
|
||||
| RE_NO_BK_VBAR)
|
||||
|
||||
#define RE_SYNTAX_POSIX_EGREP \
|
||||
(RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \
|
||||
| RE_INVALID_INTERVAL_ORD)
|
||||
|
||||
/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
|
||||
#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
|
||||
|
||||
#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
|
||||
|
||||
/* Syntax bits common to both basic and extended POSIX regex syntax. */
|
||||
#define _RE_SYNTAX_POSIX_COMMON \
|
||||
(RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
|
||||
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
|
||||
|
||||
#define RE_SYNTAX_POSIX_BASIC \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
|
||||
|
||||
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
|
||||
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
|
||||
isn't minimal, since other operators, such as \`, aren't disabled. */
|
||||
#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
|
||||
|
||||
#define RE_SYNTAX_POSIX_EXTENDED \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_VBAR \
|
||||
| RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
|
||||
/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
|
||||
removed and RE_NO_BK_REFS is added. */
|
||||
#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
|
||||
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
|
||||
| RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
/* [[[end syntaxes]]] */
|
||||
|
||||
/* Maximum number of duplicates an interval can allow. Some systems
|
||||
(erroneously) define this in other header files, but we want our
|
||||
value, so remove any previous define. */
|
||||
#ifdef RE_DUP_MAX
|
||||
# undef RE_DUP_MAX
|
||||
#endif
|
||||
/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
|
||||
#define RE_DUP_MAX (0x7fff)
|
||||
|
||||
|
||||
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
|
||||
|
||||
/* If this bit is set, then use extended regular expression syntax.
|
||||
If not set, then use basic regular expression syntax. */
|
||||
#define REG_EXTENDED 1
|
||||
|
||||
/* If this bit is set, then ignore case when matching.
|
||||
If not set, then case is significant. */
|
||||
#define REG_ICASE (REG_EXTENDED << 1)
|
||||
|
||||
/* If this bit is set, then anchors do not match at newline
|
||||
characters in the string.
|
||||
If not set, then anchors do match at newlines. */
|
||||
#define REG_NEWLINE (REG_ICASE << 1)
|
||||
|
||||
/* If this bit is set, then report only success or fail in regexec.
|
||||
If not set, then returns differ between not matching and errors. */
|
||||
#define REG_NOSUB (REG_NEWLINE << 1)
|
||||
|
||||
|
||||
/* POSIX `eflags' bits (i.e., information for regexec). */
|
||||
|
||||
/* If this bit is set, then the beginning-of-line operator doesn't match
|
||||
the beginning of the string (presumably because it's not the
|
||||
beginning of a line).
|
||||
If not set, then the beginning-of-line operator does match the
|
||||
beginning of the string. */
|
||||
#define REG_NOTBOL 1
|
||||
|
||||
/* Like REG_NOTBOL, except for the end-of-line. */
|
||||
#define REG_NOTEOL (1 << 1)
|
||||
|
||||
|
||||
/* If any error codes are removed, changed, or added, update the
|
||||
`re_error_msg' table in regex.c. */
|
||||
typedef enum
|
||||
{
|
||||
#ifdef _XOPEN_SOURCE
|
||||
REG_ENOSYS = -1, /* This will never happen for this implementation. */
|
||||
#endif
|
||||
|
||||
REG_NOERROR = 0, /* Success. */
|
||||
REG_NOMATCH, /* Didn't find a match (for regexec). */
|
||||
|
||||
/* POSIX regcomp return error codes. (In the order listed in the
|
||||
standard.) */
|
||||
REG_BADPAT, /* Invalid pattern. */
|
||||
REG_ECOLLATE, /* Not implemented. */
|
||||
REG_ECTYPE, /* Invalid character class name. */
|
||||
REG_EESCAPE, /* Trailing backslash. */
|
||||
REG_ESUBREG, /* Invalid back reference. */
|
||||
REG_EBRACK, /* Unmatched left bracket. */
|
||||
REG_EPAREN, /* Parenthesis imbalance. */
|
||||
REG_EBRACE, /* Unmatched \{. */
|
||||
REG_BADBR, /* Invalid contents of \{\}. */
|
||||
REG_ERANGE, /* Invalid range end. */
|
||||
REG_ESPACE, /* Ran out of memory. */
|
||||
REG_BADRPT, /* No preceding re for repetition op. */
|
||||
|
||||
/* Error codes we've added. */
|
||||
REG_EEND, /* Premature end. */
|
||||
REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
|
||||
REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
|
||||
} reg_errcode_t;
|
||||
|
||||
/* This data structure represents a compiled pattern. Before calling
|
||||
the pattern compiler, the fields `buffer', `allocated', `fastmap',
|
||||
`translate', and `no_sub' can be set. After the pattern has been
|
||||
compiled, the `re_nsub' field is available. All other fields are
|
||||
private to the regex routines. */
|
||||
|
||||
#ifndef RE_TRANSLATE_TYPE
|
||||
# define RE_TRANSLATE_TYPE char *
|
||||
#endif
|
||||
|
||||
struct re_pattern_buffer
|
||||
{
|
||||
/* [[[begin pattern_buffer]]] */
|
||||
/* Space that holds the compiled pattern. It is declared as
|
||||
`unsigned char *' because its elements are
|
||||
sometimes used as array indexes. */
|
||||
unsigned char *buffer;
|
||||
|
||||
/* Number of bytes to which `buffer' points. */
|
||||
unsigned long int allocated;
|
||||
|
||||
/* Number of bytes actually used in `buffer'. */
|
||||
unsigned long int used;
|
||||
|
||||
/* Syntax setting with which the pattern was compiled. */
|
||||
reg_syntax_t syntax;
|
||||
|
||||
/* Pointer to a fastmap, if any, otherwise zero. re_search uses
|
||||
the fastmap, if there is one, to skip over impossible
|
||||
starting points for matches. */
|
||||
char *fastmap;
|
||||
|
||||
/* Either a translate table to apply to all characters before
|
||||
comparing them, or zero for no translation. The translation
|
||||
is applied to a pattern when it is compiled and to a string
|
||||
when it is matched. */
|
||||
RE_TRANSLATE_TYPE translate;
|
||||
|
||||
/* Number of subexpressions found by the compiler. */
|
||||
size_t re_nsub;
|
||||
|
||||
/* Zero if this pattern cannot match the empty string, one else.
|
||||
Well, in truth it's used only in `re_search_2', to see
|
||||
whether or not we should use the fastmap, so we don't set
|
||||
this absolutely perfectly; see `re_compile_fastmap' (the
|
||||
`duplicate' case). */
|
||||
unsigned can_be_null : 1;
|
||||
|
||||
/* If REGS_UNALLOCATED, allocate space in the `regs' structure
|
||||
for `max (RE_NREGS, re_nsub + 1)' groups.
|
||||
If REGS_REALLOCATE, reallocate space if necessary.
|
||||
If REGS_FIXED, use what's there. */
|
||||
#define REGS_UNALLOCATED 0
|
||||
#define REGS_REALLOCATE 1
|
||||
#define REGS_FIXED 2
|
||||
unsigned regs_allocated : 2;
|
||||
|
||||
/* Set to zero when `regex_compile' compiles a pattern; set to one
|
||||
by `re_compile_fastmap' if it updates the fastmap. */
|
||||
unsigned fastmap_accurate : 1;
|
||||
|
||||
/* If set, `re_match_2' does not return information about
|
||||
subexpressions. */
|
||||
unsigned no_sub : 1;
|
||||
|
||||
/* If set, a beginning-of-line anchor doesn't match at the
|
||||
beginning of the string. */
|
||||
unsigned not_bol : 1;
|
||||
|
||||
/* Similarly for an end-of-line anchor. */
|
||||
unsigned not_eol : 1;
|
||||
|
||||
/* If true, an anchor at a newline matches. */
|
||||
unsigned newline_anchor : 1;
|
||||
|
||||
/* [[[end pattern_buffer]]] */
|
||||
};
|
||||
|
||||
typedef struct re_pattern_buffer regex_t;
|
||||
|
||||
/* Type for byte offsets within the string. POSIX mandates this. */
|
||||
typedef int regoff_t;
|
||||
|
||||
|
||||
/* This is the structure we store register match data in. See
|
||||
regex.texinfo for a full description of what registers match. */
|
||||
struct re_registers
|
||||
{
|
||||
unsigned num_regs;
|
||||
regoff_t *start;
|
||||
regoff_t *end;
|
||||
};
|
||||
|
||||
|
||||
/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
|
||||
`re_match_2' returns information about at least this many registers
|
||||
the first time a `regs' structure is passed. */
|
||||
#ifndef RE_NREGS
|
||||
# define RE_NREGS 30
|
||||
#endif
|
||||
|
||||
|
||||
/* POSIX specification for registers. Aside from the different names than
|
||||
`re_registers', POSIX uses an array of structures, instead of a
|
||||
structure of arrays. */
|
||||
typedef struct
|
||||
{
|
||||
regoff_t rm_so; /* Byte offset from string's start to substring's start. */
|
||||
regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
|
||||
} regmatch_t;
|
||||
|
||||
/* Declarations for routines. */
|
||||
|
||||
/* To avoid duplicating every routine declaration -- once with a
|
||||
prototype (if we are ANSI), and once without (if we aren't) -- we
|
||||
use the following macro to declare argument types. This
|
||||
unfortunately clutters up the declarations a bit, but I think it's
|
||||
worth it. */
|
||||
|
||||
#if __STDC__
|
||||
|
||||
# define _RE_ARGS(args) args
|
||||
|
||||
#else /* not __STDC__ */
|
||||
|
||||
# define _RE_ARGS(args) ()
|
||||
|
||||
#endif /* not __STDC__ */
|
||||
|
||||
/* Sets the current default syntax to SYNTAX, and return the old syntax.
|
||||
You can also simply assign to the `re_syntax_options' variable. */
|
||||
extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
|
||||
|
||||
/* Compile the regular expression PATTERN, with length LENGTH
|
||||
and syntax given by the global `re_syntax_options', into the buffer
|
||||
BUFFER. Return NULL if successful, and an error string if not. */
|
||||
extern const char *re_compile_pattern
|
||||
_RE_ARGS ((const char *pattern, size_t length,
|
||||
struct re_pattern_buffer *buffer));
|
||||
|
||||
|
||||
/* Compile a fastmap for the compiled pattern in BUFFER; used to
|
||||
accelerate searches. Return 0 if successful and -2 if was an
|
||||
internal error. */
|
||||
extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
|
||||
|
||||
|
||||
/* Search in the string STRING (with length LENGTH) for the pattern
|
||||
compiled into BUFFER. Start searching at position START, for RANGE
|
||||
characters. Return the starting position of the match, -1 for no
|
||||
match, or -2 for an internal error. Also return register
|
||||
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
|
||||
extern int re_search
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
||||
int length, int start, int range, struct re_registers *regs));
|
||||
|
||||
|
||||
/* Like `re_search', but search in the concatenation of STRING1 and
|
||||
STRING2. Also, stop searching at index START + STOP. */
|
||||
extern int re_search_2
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||
int length1, const char *string2, int length2,
|
||||
int start, int range, struct re_registers *regs, int stop));
|
||||
|
||||
|
||||
/* Like `re_search', but return how many characters in STRING the regexp
|
||||
in BUFFER matched, starting at position START. */
|
||||
extern int re_match
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
|
||||
int length, int start, struct re_registers *regs));
|
||||
|
||||
|
||||
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
|
||||
extern int re_match_2
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
|
||||
int length1, const char *string2, int length2,
|
||||
int start, struct re_registers *regs, int stop));
|
||||
|
||||
|
||||
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
|
||||
ENDS. Subsequent matches using BUFFER and REGS will use this memory
|
||||
for recording register information. STARTS and ENDS must be
|
||||
allocated with malloc, and must each be at least `NUM_REGS * sizeof
|
||||
(regoff_t)' bytes long.
|
||||
|
||||
If NUM_REGS == 0, then subsequent matches should allocate their own
|
||||
register data.
|
||||
|
||||
Unless this function is called, the first search or match using
|
||||
PATTERN_BUFFER will allocate its own register data, without
|
||||
freeing the old data. */
|
||||
extern void re_set_registers
|
||||
_RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
|
||||
unsigned num_regs, regoff_t *starts, regoff_t *ends));
|
||||
|
||||
#if defined _REGEX_RE_COMP || defined _LIBC
|
||||
# ifndef _CRAY
|
||||
/* 4.2 bsd compatibility. */
|
||||
extern char *re_comp _RE_ARGS ((const char *));
|
||||
extern int re_exec _RE_ARGS ((const char *));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* GCC 2.95 and later have "__restrict"; C99 compilers have
|
||||
"restrict", and "configure" may have defined "restrict". */
|
||||
#ifndef __restrict
|
||||
# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
|
||||
# if defined restrict || 199901L <= __STDC_VERSION__
|
||||
# define __restrict restrict
|
||||
# else
|
||||
# define __restrict
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
/* For now unconditionally define __restrict_arr to expand to nothing.
|
||||
Ideally we would have a test for the compiler which allows defining
|
||||
it to restrict. */
|
||||
#define __restrict_arr
|
||||
|
||||
/* POSIX compatibility. */
|
||||
extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
|
||||
const char *__restrict __pattern,
|
||||
int __cflags));
|
||||
|
||||
extern int regexec _RE_ARGS ((const regex_t *__restrict __preg,
|
||||
const char *__restrict __string, size_t __nmatch,
|
||||
regmatch_t __pmatch[__restrict_arr],
|
||||
int __eflags));
|
||||
|
||||
extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
|
||||
char *__errbuf, size_t __errbuf_size));
|
||||
|
||||
extern void regfree _RE_ARGS ((regex_t *__preg));
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* C++ */
|
||||
|
||||
#endif /* regex.h */
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
make-backup-files: t
|
||||
version-control: t
|
||||
trim-versions-without-asking: nil
|
||||
End:
|
||||
*/
|
||||
@@ -1,2 +0,0 @@
|
||||
. ${srcdir}/emulparams/elf64alpha.sh
|
||||
ENTRY=__start
|
||||
@@ -1,12 +0,0 @@
|
||||
SCRIPT_NAME=elf
|
||||
OUTPUT_FORMAT="elf32-i386"
|
||||
TEXT_START_ADDR=0x08048000
|
||||
MAXPAGESIZE=0x1000
|
||||
NONPAGED_TEXT_START_ADDR=0x08048000
|
||||
ARCH=i386
|
||||
MACHINE=
|
||||
NOP=0x90909090
|
||||
TEMPLATE_NAME=elf32
|
||||
GENERATE_SHLIB_SCRIPT=yes
|
||||
ELF_INTERPRETER_NAME=\"/usr/lib/ld.so.1\"
|
||||
NO_SMALL_DATA=yes
|
||||
@@ -1,40 +0,0 @@
|
||||
# This shell script emits a C file. -*- C -*-
|
||||
# Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GLD, the Gnu Linker.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# This file is sourced from elf32.em. It is used by targets for
|
||||
# which relaxation is not just an optimization, but for correctness.
|
||||
|
||||
LDEMUL_BEFORE_ALLOCATION=need_relax_${EMULATION_NAME}_before_allocation
|
||||
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
|
||||
static void need_relax_${EMULATION_NAME}_before_allocation PARAMS ((void));
|
||||
|
||||
static void
|
||||
need_relax_${EMULATION_NAME}_before_allocation ()
|
||||
{
|
||||
/* Call main function; we're just extending it. */
|
||||
gld${EMULATION_NAME}_before_allocation ();
|
||||
|
||||
/* Force -relax on if not doing a relocatable link. */
|
||||
if (! link_info.relocateable)
|
||||
command_line.relax = true;
|
||||
}
|
||||
EOF
|
||||
@@ -1,303 +0,0 @@
|
||||
/* Provide a version of _doprnt in terms of fprintf.
|
||||
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Contributed by Kaveh Ghazi ([email protected]) 3/29/98
|
||||
|
||||
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "config.h"
|
||||
#include "ansidecl.h"
|
||||
#include "safe-ctype.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef ANSI_PROTOTYPES
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#undef _doprnt
|
||||
|
||||
#ifdef HAVE__DOPRNT
|
||||
#define TEST
|
||||
#endif
|
||||
|
||||
#ifdef TEST /* Make sure to use the internal one. */
|
||||
#define _doprnt my_doprnt
|
||||
#endif
|
||||
|
||||
#define COPY_VA_INT \
|
||||
do { \
|
||||
const int value = abs (va_arg (ap, int)); \
|
||||
char buf[32]; \
|
||||
ptr++; /* Go past the asterisk. */ \
|
||||
*sptr = '\0'; /* NULL terminate sptr. */ \
|
||||
sprintf(buf, "%d", value); \
|
||||
strcat(sptr, buf); \
|
||||
while (*sptr) sptr++; \
|
||||
} while (0)
|
||||
|
||||
#define PRINT_CHAR(CHAR) \
|
||||
do { \
|
||||
putc(CHAR, stream); \
|
||||
ptr++; \
|
||||
total_printed++; \
|
||||
continue; \
|
||||
} while (0)
|
||||
|
||||
#define PRINT_TYPE(TYPE) \
|
||||
do { \
|
||||
int result; \
|
||||
TYPE value = va_arg (ap, TYPE); \
|
||||
*sptr++ = *ptr++; /* Copy the type specifier. */ \
|
||||
*sptr = '\0'; /* NULL terminate sptr. */ \
|
||||
result = fprintf(stream, specifier, value); \
|
||||
if (result == -1) \
|
||||
return -1; \
|
||||
else \
|
||||
{ \
|
||||
total_printed += result; \
|
||||
continue; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
int
|
||||
_doprnt (format, ap, stream)
|
||||
const char * format;
|
||||
va_list ap;
|
||||
FILE * stream;
|
||||
{
|
||||
const char * ptr = format;
|
||||
char specifier[128];
|
||||
int total_printed = 0;
|
||||
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
if (*ptr != '%') /* While we have regular characters, print them. */
|
||||
PRINT_CHAR(*ptr);
|
||||
else /* We got a format specifier! */
|
||||
{
|
||||
char * sptr = specifier;
|
||||
int wide_width = 0, short_width = 0;
|
||||
|
||||
*sptr++ = *ptr++; /* Copy the % and move forward. */
|
||||
|
||||
while (strchr ("-+ #0", *ptr)) /* Move past flags. */
|
||||
*sptr++ = *ptr++;
|
||||
|
||||
if (*ptr == '*')
|
||||
COPY_VA_INT;
|
||||
else
|
||||
while (ISDIGIT(*ptr)) /* Handle explicit numeric value. */
|
||||
*sptr++ = *ptr++;
|
||||
|
||||
if (*ptr == '.')
|
||||
{
|
||||
*sptr++ = *ptr++; /* Copy and go past the period. */
|
||||
if (*ptr == '*')
|
||||
COPY_VA_INT;
|
||||
else
|
||||
while (ISDIGIT(*ptr)) /* Handle explicit numeric value. */
|
||||
*sptr++ = *ptr++;
|
||||
}
|
||||
while (strchr ("hlL", *ptr))
|
||||
{
|
||||
switch (*ptr)
|
||||
{
|
||||
case 'h':
|
||||
short_width = 1;
|
||||
break;
|
||||
case 'l':
|
||||
wide_width++;
|
||||
break;
|
||||
case 'L':
|
||||
wide_width = 2;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
*sptr++ = *ptr++;
|
||||
}
|
||||
|
||||
switch (*ptr)
|
||||
{
|
||||
case 'd':
|
||||
case 'i':
|
||||
case 'o':
|
||||
case 'u':
|
||||
case 'x':
|
||||
case 'X':
|
||||
case 'c':
|
||||
{
|
||||
/* Short values are promoted to int, so just copy it
|
||||
as an int and trust the C library printf to cast it
|
||||
to the right width. */
|
||||
if (short_width)
|
||||
PRINT_TYPE(int);
|
||||
else
|
||||
{
|
||||
switch (wide_width)
|
||||
{
|
||||
case 0:
|
||||
PRINT_TYPE(int);
|
||||
break;
|
||||
case 1:
|
||||
PRINT_TYPE(long);
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
#if defined(__GNUC__) || defined(HAVE_LONG_LONG)
|
||||
PRINT_TYPE(long long);
|
||||
#else
|
||||
PRINT_TYPE(long); /* Fake it and hope for the best. */
|
||||
#endif
|
||||
break;
|
||||
} /* End of switch (wide_width) */
|
||||
} /* End of else statement */
|
||||
} /* End of integer case */
|
||||
break;
|
||||
case 'f':
|
||||
case 'e':
|
||||
case 'E':
|
||||
case 'g':
|
||||
case 'G':
|
||||
{
|
||||
if (wide_width == 0)
|
||||
PRINT_TYPE(double);
|
||||
else
|
||||
{
|
||||
#if defined(__GNUC__) || defined(HAVE_LONG_DOUBLE)
|
||||
PRINT_TYPE(long double);
|
||||
#else
|
||||
PRINT_TYPE(double); /* Fake it and hope for the best. */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
PRINT_TYPE(char *);
|
||||
break;
|
||||
case 'p':
|
||||
PRINT_TYPE(void *);
|
||||
break;
|
||||
case '%':
|
||||
PRINT_CHAR('%');
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
} /* End of switch (*ptr) */
|
||||
} /* End of else statement */
|
||||
}
|
||||
|
||||
return total_printed;
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <math.h>
|
||||
#ifndef M_PI
|
||||
#define M_PI (3.1415926535897932385)
|
||||
#endif
|
||||
|
||||
#define RESULT(x) do \
|
||||
{ \
|
||||
int i = (x); \
|
||||
printf ("printed %d characters\n", i); \
|
||||
fflush(stdin); \
|
||||
} while (0)
|
||||
|
||||
static int checkit PARAMS ((const char * format, ...)) ATTRIBUTE_PRINTF_1;
|
||||
|
||||
static int
|
||||
checkit VPARAMS ((const char* format, ...))
|
||||
{
|
||||
int result;
|
||||
VA_OPEN (args, format);
|
||||
VA_FIXEDARG (args, char *, format);
|
||||
|
||||
result = _doprnt (format, args, stdout);
|
||||
VA_CLOSE (args);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
RESULT(checkit ("<%d>\n", 0x12345678));
|
||||
RESULT(printf ("<%d>\n", 0x12345678));
|
||||
|
||||
RESULT(checkit ("<%200d>\n", 5));
|
||||
RESULT(printf ("<%200d>\n", 5));
|
||||
|
||||
RESULT(checkit ("<%.300d>\n", 6));
|
||||
RESULT(printf ("<%.300d>\n", 6));
|
||||
|
||||
RESULT(checkit ("<%100.150d>\n", 7));
|
||||
RESULT(printf ("<%100.150d>\n", 7));
|
||||
|
||||
RESULT(checkit ("<%s>\n",
|
||||
"jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
|
||||
777777777777777777333333333333366666666666622222222222777777777777733333"));
|
||||
RESULT(printf ("<%s>\n",
|
||||
"jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
|
||||
777777777777777777333333333333366666666666622222222222777777777777733333"));
|
||||
|
||||
RESULT(checkit ("<%f><%0+#f>%s%d%s>\n",
|
||||
1.0, 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"));
|
||||
RESULT(printf ("<%f><%0+#f>%s%d%s>\n",
|
||||
1.0, 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx"));
|
||||
|
||||
RESULT(checkit ("<%4f><%.4f><%%><%4.4f>\n", M_PI, M_PI, M_PI));
|
||||
RESULT(printf ("<%4f><%.4f><%%><%4.4f>\n", M_PI, M_PI, M_PI));
|
||||
|
||||
RESULT(checkit ("<%*f><%.*f><%%><%*.*f>\n", 3, M_PI, 3, M_PI, 3, 3, M_PI));
|
||||
RESULT(printf ("<%*f><%.*f><%%><%*.*f>\n", 3, M_PI, 3, M_PI, 3, 3, M_PI));
|
||||
|
||||
RESULT(checkit ("<%d><%i><%o><%u><%x><%X><%c>\n",
|
||||
75, 75, 75, 75, 75, 75, 75));
|
||||
RESULT(printf ("<%d><%i><%o><%u><%x><%X><%c>\n",
|
||||
75, 75, 75, 75, 75, 75, 75));
|
||||
|
||||
RESULT(checkit ("<%d><%i><%o><%u><%x><%X><%c>\n",
|
||||
75, 75, 75, 75, 75, 75, 75));
|
||||
RESULT(printf ("<%d><%i><%o><%u><%x><%X><%c>\n",
|
||||
75, 75, 75, 75, 75, 75, 75));
|
||||
|
||||
RESULT(checkit ("Testing (hd) short: <%d><%ld><%hd><%hd><%d>\n", 123, (long)234, 345, 123456789, 456));
|
||||
RESULT(printf ("Testing (hd) short: <%d><%ld><%hd><%hd><%d>\n", 123, (long)234, 345, 123456789, 456));
|
||||
|
||||
#if defined(__GNUC__) || defined (HAVE_LONG_LONG)
|
||||
RESULT(checkit ("Testing (lld) long long: <%d><%lld><%d>\n", 123, 234234234234234234LL, 345));
|
||||
RESULT(printf ("Testing (lld) long long: <%d><%lld><%d>\n", 123, 234234234234234234LL, 345));
|
||||
RESULT(checkit ("Testing (Ld) long long: <%d><%Ld><%d>\n", 123, 234234234234234234LL, 345));
|
||||
RESULT(printf ("Testing (Ld) long long: <%d><%Ld><%d>\n", 123, 234234234234234234LL, 345));
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined (HAVE_LONG_DOUBLE)
|
||||
RESULT(checkit ("Testing (Lf) long double: <%.20f><%.20Lf><%0+#.20f>\n",
|
||||
1.23456, 1.234567890123456789L, 1.23456));
|
||||
RESULT(printf ("Testing (Lf) long double: <%.20f><%.20Lf><%0+#.20f>\n",
|
||||
1.23456, 1.234567890123456789L, 1.23456));
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* TEST */
|
||||
@@ -1,565 +0,0 @@
|
||||
@node Library Copying
|
||||
@appendixsec GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
@cindex LGPL, Lesser General Public License
|
||||
@center Version 2.1, February 1999
|
||||
|
||||
@display
|
||||
Copyright @copyright{} 1991, 1999 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.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence the
|
||||
version number 2.1.]
|
||||
@end display
|
||||
|
||||
@appendixsubsec Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software---to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software---typically libraries---of the Free
|
||||
Software Foundation and other authors who decide to use it. You can use
|
||||
it too, but we suggest you first think carefully about whether this
|
||||
license or the ordinary General Public License is the better strategy to
|
||||
use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
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 and use pieces of it
|
||||
in new free programs; and that you are informed that you can do these
|
||||
things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the @dfn{Lesser} General Public License because it
|
||||
does @emph{Less} to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
``work based on the library'' and a ``work that uses the library''. The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
@iftex
|
||||
@appendixsubsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center GNU LESSER GENERAL PUBLIC LICENSE
|
||||
@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
@end ifinfo
|
||||
|
||||
@enumerate 0
|
||||
@item
|
||||
This License Agreement applies to any software library or other program
|
||||
which contains a notice placed by the copyright holder or other
|
||||
authorized party saying it may be distributed under the terms of this
|
||||
Lesser General Public License (also called ``this License''). Each
|
||||
licensee is addressed as ``you''.
|
||||
|
||||
A ``library'' means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The ``Library'', below, refers to any such software library or work
|
||||
which has been distributed under these terms. A ``work based on the
|
||||
Library'' means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term ``modification''.)
|
||||
|
||||
``Source code'' for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, 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 library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
@item
|
||||
You may copy and distribute verbatim copies of the Library's
|
||||
complete 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 distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
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.
|
||||
|
||||
@item
|
||||
You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
The modified work must itself be a software library.
|
||||
|
||||
@item
|
||||
You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
@item
|
||||
You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
@item
|
||||
If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
@end enumerate
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
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 Library, 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 Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
@item
|
||||
You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
@item
|
||||
You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you 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.
|
||||
|
||||
If distribution of 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 satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
@item
|
||||
A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a ``work that uses the Library''. Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a ``work that uses the Library'' with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a ``work that uses the
|
||||
library''. The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a ``work that uses the Library'' uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
@item
|
||||
As an exception to the Sections above, you may also combine or
|
||||
link a ``work that uses the Library'' with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable ``work that
|
||||
uses the Library'', as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
@item
|
||||
Use a suitable shared library mechanism for linking with the Library. A
|
||||
suitable mechanism is one that (1) uses at run time a copy of the
|
||||
library already present on the user's computer system, rather than
|
||||
copying library functions into the executable, and (2) will operate
|
||||
properly with a modified version of the library, if the user installs
|
||||
one, as long as the modified version is interface-compatible with the
|
||||
version that the work was made with.
|
||||
|
||||
@item
|
||||
Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
@item
|
||||
If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
@item
|
||||
Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
@end enumerate
|
||||
|
||||
For an executable, the required form of the ``work that uses the
|
||||
Library'' must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be 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.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
@item
|
||||
You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
@enumerate a
|
||||
@item
|
||||
Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
@item
|
||||
Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
@end enumerate
|
||||
|
||||
@item
|
||||
You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library 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.
|
||||
|
||||
@item
|
||||
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 Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
@item
|
||||
Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
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 with
|
||||
this License.
|
||||
|
||||
@item
|
||||
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 Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library 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 Library.
|
||||
|
||||
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.
|
||||
|
||||
@item
|
||||
If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library 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.
|
||||
|
||||
@item
|
||||
The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser 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 Library
|
||||
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 Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
@item
|
||||
If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
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.
|
||||
|
||||
@iftex
|
||||
@heading NO WARRANTY
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center NO WARRANTY
|
||||
@end ifinfo
|
||||
|
||||
@item
|
||||
BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY ``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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
@item
|
||||
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 LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
@end enumerate
|
||||
|
||||
@iftex
|
||||
@heading END OF TERMS AND CONDITIONS
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@center END OF TERMS AND CONDITIONS
|
||||
@end ifinfo
|
||||
|
||||
@page
|
||||
@appendixsubsec How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. 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.
|
||||
|
||||
@smallexample
|
||||
@var{one line to give the library's name and an idea of what it does.}
|
||||
Copyright (C) @var{year} @var{name of author}
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or (at
|
||||
your option) any later version.
|
||||
|
||||
This 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
@end smallexample
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a ``copyright disclaimer'' for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
@smallexample
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the library
|
||||
`Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
@var{signature of Ty Coon}, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
@end smallexample
|
||||
|
||||
That's all there is to it!
|
||||
@@ -1,27 +0,0 @@
|
||||
/* ffs -- Find the first bit set in the parameter
|
||||
|
||||
@deftypefn Supplemental int ffs (int @var{valu})
|
||||
|
||||
Find the first (least significant) bit set in @var{valu}. Bits are
|
||||
numbered from right to left, starting with bit 1 (corresponding to the
|
||||
value 1). If @var{valu} is zero, zero is returned.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
*/
|
||||
|
||||
int
|
||||
ffs (valu)
|
||||
register int valu;
|
||||
{
|
||||
register int bit;
|
||||
|
||||
if (valu == 0)
|
||||
return 0;
|
||||
|
||||
for (bit = 1; !(valu & 1); bit++)
|
||||
valu >>= 1;
|
||||
|
||||
return bit;
|
||||
}
|
||||
|
||||
@@ -1,523 +0,0 @@
|
||||
/* A Fibonacci heap datatype.
|
||||
Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Daniel Berlin ([email protected]).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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 CC 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 CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#include "libiberty.h"
|
||||
#include "fibheap.h"
|
||||
|
||||
|
||||
#define FIBHEAPKEY_MIN LONG_MIN
|
||||
|
||||
static void fibheap_ins_root PARAMS ((fibheap_t, fibnode_t));
|
||||
static void fibheap_rem_root PARAMS ((fibheap_t, fibnode_t));
|
||||
static void fibheap_consolidate PARAMS ((fibheap_t));
|
||||
static void fibheap_link PARAMS ((fibheap_t, fibnode_t, fibnode_t));
|
||||
static void fibheap_cut PARAMS ((fibheap_t, fibnode_t, fibnode_t));
|
||||
static void fibheap_cascading_cut PARAMS ((fibheap_t, fibnode_t));
|
||||
static fibnode_t fibheap_extr_min_node PARAMS ((fibheap_t));
|
||||
static int fibheap_compare PARAMS ((fibheap_t, fibnode_t, fibnode_t));
|
||||
static int fibheap_comp_data PARAMS ((fibheap_t, fibheapkey_t, void *,
|
||||
fibnode_t));
|
||||
static fibnode_t fibnode_new PARAMS ((void));
|
||||
static void fibnode_insert_after PARAMS ((fibnode_t, fibnode_t));
|
||||
#define fibnode_insert_before(a, b) fibnode_insert_after (a->left, b)
|
||||
static fibnode_t fibnode_remove PARAMS ((fibnode_t));
|
||||
|
||||
|
||||
/* Create a new fibonacci heap. */
|
||||
fibheap_t
|
||||
fibheap_new ()
|
||||
{
|
||||
return (fibheap_t) xcalloc (1, sizeof (struct fibheap));
|
||||
}
|
||||
|
||||
/* Create a new fibonacci heap node. */
|
||||
static fibnode_t
|
||||
fibnode_new ()
|
||||
{
|
||||
fibnode_t node;
|
||||
|
||||
node = xcalloc (1, sizeof *node);
|
||||
node->left = node;
|
||||
node->right = node;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static inline int
|
||||
fibheap_compare (heap, a, b)
|
||||
fibheap_t heap ATTRIBUTE_UNUSED;
|
||||
fibnode_t a;
|
||||
fibnode_t b;
|
||||
{
|
||||
if (a->key < b->key)
|
||||
return -1;
|
||||
if (a->key > b->key)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
fibheap_comp_data (heap, key, data, b)
|
||||
fibheap_t heap;
|
||||
fibheapkey_t key;
|
||||
void *data;
|
||||
fibnode_t b;
|
||||
{
|
||||
struct fibnode a;
|
||||
|
||||
a.key = key;
|
||||
a.data = data;
|
||||
|
||||
return fibheap_compare (heap, &a, b);
|
||||
}
|
||||
|
||||
/* Insert DATA, with priority KEY, into HEAP. */
|
||||
fibnode_t
|
||||
fibheap_insert (heap, key, data)
|
||||
fibheap_t heap;
|
||||
fibheapkey_t key;
|
||||
void *data;
|
||||
{
|
||||
fibnode_t node;
|
||||
|
||||
/* Create the new node. */
|
||||
node = fibnode_new ();
|
||||
|
||||
/* Set the node's data. */
|
||||
node->data = data;
|
||||
node->key = key;
|
||||
|
||||
/* Insert it into the root list. */
|
||||
fibheap_ins_root (heap, node);
|
||||
|
||||
/* If their was no minimum, or this key is less than the min,
|
||||
it's the new min. */
|
||||
if (heap->min == NULL || node->key < heap->min->key)
|
||||
heap->min = node;
|
||||
|
||||
heap->nodes++;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
/* Return the data of the minimum node (if we know it). */
|
||||
void *
|
||||
fibheap_min (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
/* If there is no min, we can't easily return it. */
|
||||
if (heap->min == NULL)
|
||||
return NULL;
|
||||
return heap->min->data;
|
||||
}
|
||||
|
||||
/* Return the key of the minimum node (if we know it). */
|
||||
fibheapkey_t
|
||||
fibheap_min_key (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
/* If there is no min, we can't easily return it. */
|
||||
if (heap->min == NULL)
|
||||
return 0;
|
||||
return heap->min->key;
|
||||
}
|
||||
|
||||
/* Union HEAPA and HEAPB into a new heap. */
|
||||
fibheap_t
|
||||
fibheap_union (heapa, heapb)
|
||||
fibheap_t heapa;
|
||||
fibheap_t heapb;
|
||||
{
|
||||
fibnode_t a_root, b_root, temp;
|
||||
|
||||
/* If one of the heaps is empty, the union is just the other heap. */
|
||||
if ((a_root = heapa->root) == NULL)
|
||||
{
|
||||
free (heapa);
|
||||
return heapb;
|
||||
}
|
||||
if ((b_root = heapb->root) == NULL)
|
||||
{
|
||||
free (heapb);
|
||||
return heapa;
|
||||
}
|
||||
|
||||
/* Merge them to the next nodes on the opposite chain. */
|
||||
a_root->left->right = b_root;
|
||||
b_root->left->right = a_root;
|
||||
temp = a_root->left;
|
||||
a_root->left = b_root->left;
|
||||
b_root->left = temp;
|
||||
heapa->nodes += heapb->nodes;
|
||||
|
||||
/* And set the new minimum, if it's changed. */
|
||||
if (fibheap_compare (heapa, heapb->min, heapa->min) < 0)
|
||||
heapa->min = heapb->min;
|
||||
|
||||
free (heapb);
|
||||
return heapa;
|
||||
}
|
||||
|
||||
/* Extract the data of the minimum node from HEAP. */
|
||||
void *
|
||||
fibheap_extract_min (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
fibnode_t z;
|
||||
void *ret = NULL;
|
||||
|
||||
/* If we don't have a min set, it means we have no nodes. */
|
||||
if (heap->min != NULL)
|
||||
{
|
||||
/* Otherwise, extract the min node, free the node, and return the
|
||||
node's data. */
|
||||
z = fibheap_extr_min_node (heap);
|
||||
ret = z->data;
|
||||
free (z);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Replace both the KEY and the DATA associated with NODE. */
|
||||
void *
|
||||
fibheap_replace_key_data (heap, node, key, data)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
fibheapkey_t key;
|
||||
void *data;
|
||||
{
|
||||
void *odata;
|
||||
int okey;
|
||||
fibnode_t y;
|
||||
|
||||
/* If we wanted to, we could actually do a real increase by redeleting and
|
||||
inserting. However, this would require O (log n) time. So just bail out
|
||||
for now. */
|
||||
if (fibheap_comp_data (heap, key, data, node) > 0)
|
||||
return NULL;
|
||||
|
||||
odata = node->data;
|
||||
okey = node->key;
|
||||
node->data = data;
|
||||
node->key = key;
|
||||
y = node->parent;
|
||||
|
||||
if (okey == key)
|
||||
return odata;
|
||||
|
||||
/* These two compares are specifically <= 0 to make sure that in the case
|
||||
of equality, a node we replaced the data on, becomes the new min. This
|
||||
is needed so that delete's call to extractmin gets the right node. */
|
||||
if (y != NULL && fibheap_compare (heap, node, y) <= 0)
|
||||
{
|
||||
fibheap_cut (heap, node, y);
|
||||
fibheap_cascading_cut (heap, y);
|
||||
}
|
||||
|
||||
if (fibheap_compare (heap, node, heap->min) <= 0)
|
||||
heap->min = node;
|
||||
|
||||
return odata;
|
||||
}
|
||||
|
||||
/* Replace the DATA associated with NODE. */
|
||||
void *
|
||||
fibheap_replace_data (heap, node, data)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
void *data;
|
||||
{
|
||||
return fibheap_replace_key_data (heap, node, node->key, data);
|
||||
}
|
||||
|
||||
/* Replace the KEY associated with NODE. */
|
||||
fibheapkey_t
|
||||
fibheap_replace_key (heap, node, key)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
fibheapkey_t key;
|
||||
{
|
||||
int okey = node->key;
|
||||
fibheap_replace_key_data (heap, node, key, node->data);
|
||||
return okey;
|
||||
}
|
||||
|
||||
/* Delete NODE from HEAP. */
|
||||
void *
|
||||
fibheap_delete_node (heap, node)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
{
|
||||
void *ret = node->data;
|
||||
|
||||
/* To perform delete, we just make it the min key, and extract. */
|
||||
fibheap_replace_key (heap, node, FIBHEAPKEY_MIN);
|
||||
fibheap_extract_min (heap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Delete HEAP. */
|
||||
void
|
||||
fibheap_delete (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
while (heap->min != NULL)
|
||||
free (fibheap_extr_min_node (heap));
|
||||
|
||||
free (heap);
|
||||
}
|
||||
|
||||
/* Determine if HEAP is empty. */
|
||||
int
|
||||
fibheap_empty (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
return heap->nodes == 0;
|
||||
}
|
||||
|
||||
/* Extract the minimum node of the heap. */
|
||||
static fibnode_t
|
||||
fibheap_extr_min_node (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
fibnode_t ret = heap->min;
|
||||
fibnode_t x, y, orig;
|
||||
|
||||
/* Attach the child list of the minimum node to the root list of the heap.
|
||||
If there is no child list, we don't do squat. */
|
||||
for (x = ret->child, orig = NULL; x != orig && x != NULL; x = y)
|
||||
{
|
||||
if (orig == NULL)
|
||||
orig = x;
|
||||
y = x->right;
|
||||
x->parent = NULL;
|
||||
fibheap_ins_root (heap, x);
|
||||
}
|
||||
|
||||
/* Remove the old root. */
|
||||
fibheap_rem_root (heap, ret);
|
||||
heap->nodes--;
|
||||
|
||||
/* If we are left with no nodes, then the min is NULL. */
|
||||
if (heap->nodes == 0)
|
||||
heap->min = NULL;
|
||||
else
|
||||
{
|
||||
/* Otherwise, consolidate to find new minimum, as well as do the reorg
|
||||
work that needs to be done. */
|
||||
heap->min = ret->right;
|
||||
fibheap_consolidate (heap);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Insert NODE into the root list of HEAP. */
|
||||
static void
|
||||
fibheap_ins_root (heap, node)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
{
|
||||
/* If the heap is currently empty, the new node becomes the singleton
|
||||
circular root list. */
|
||||
if (heap->root == NULL)
|
||||
{
|
||||
heap->root = node;
|
||||
node->left = node;
|
||||
node->right = node;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Otherwise, insert it in the circular root list between the root
|
||||
and it's right node. */
|
||||
fibnode_insert_after (heap->root, node);
|
||||
}
|
||||
|
||||
/* Remove NODE from the rootlist of HEAP. */
|
||||
static void
|
||||
fibheap_rem_root (heap, node)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
{
|
||||
if (node->left == node)
|
||||
heap->root = NULL;
|
||||
else
|
||||
heap->root = fibnode_remove (node);
|
||||
}
|
||||
|
||||
/* Consolidate the heap. */
|
||||
static void
|
||||
fibheap_consolidate (heap)
|
||||
fibheap_t heap;
|
||||
{
|
||||
fibnode_t a[1 + 8 * sizeof (long)];
|
||||
fibnode_t w;
|
||||
fibnode_t y;
|
||||
fibnode_t x;
|
||||
int i;
|
||||
int d;
|
||||
int D;
|
||||
|
||||
D = 1 + 8 * sizeof (long);
|
||||
|
||||
memset (a, 0, sizeof (fibnode_t) * D);
|
||||
|
||||
while ((w = heap->root) != NULL)
|
||||
{
|
||||
x = w;
|
||||
fibheap_rem_root (heap, w);
|
||||
d = x->degree;
|
||||
while (a[d] != NULL)
|
||||
{
|
||||
y = a[d];
|
||||
if (fibheap_compare (heap, x, y) > 0)
|
||||
{
|
||||
fibnode_t temp;
|
||||
temp = x;
|
||||
x = y;
|
||||
y = temp;
|
||||
}
|
||||
fibheap_link (heap, y, x);
|
||||
a[d] = NULL;
|
||||
d++;
|
||||
}
|
||||
a[d] = x;
|
||||
}
|
||||
heap->min = NULL;
|
||||
for (i = 0; i < D; i++)
|
||||
if (a[i] != NULL)
|
||||
{
|
||||
fibheap_ins_root (heap, a[i]);
|
||||
if (heap->min == NULL || fibheap_compare (heap, a[i], heap->min) < 0)
|
||||
heap->min = a[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* Make NODE a child of PARENT. */
|
||||
static void
|
||||
fibheap_link (heap, node, parent)
|
||||
fibheap_t heap ATTRIBUTE_UNUSED;
|
||||
fibnode_t node;
|
||||
fibnode_t parent;
|
||||
{
|
||||
if (parent->child == NULL)
|
||||
parent->child = node;
|
||||
else
|
||||
fibnode_insert_before (parent->child, node);
|
||||
node->parent = parent;
|
||||
parent->degree++;
|
||||
node->mark = 0;
|
||||
}
|
||||
|
||||
/* Remove NODE from PARENT's child list. */
|
||||
static void
|
||||
fibheap_cut (heap, node, parent)
|
||||
fibheap_t heap;
|
||||
fibnode_t node;
|
||||
fibnode_t parent;
|
||||
{
|
||||
fibnode_remove (node);
|
||||
parent->degree--;
|
||||
fibheap_ins_root (heap, node);
|
||||
node->parent = NULL;
|
||||
node->mark = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
fibheap_cascading_cut (heap, y)
|
||||
fibheap_t heap;
|
||||
fibnode_t y;
|
||||
{
|
||||
fibnode_t z;
|
||||
|
||||
while ((z = y->parent) != NULL)
|
||||
{
|
||||
if (y->mark == 0)
|
||||
{
|
||||
y->mark = 1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
fibheap_cut (heap, y, z);
|
||||
y = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fibnode_insert_after (a, b)
|
||||
fibnode_t a;
|
||||
fibnode_t b;
|
||||
{
|
||||
if (a == a->right)
|
||||
{
|
||||
a->right = b;
|
||||
a->left = b;
|
||||
b->right = a;
|
||||
b->left = a;
|
||||
}
|
||||
else
|
||||
{
|
||||
b->right = a->right;
|
||||
a->right->left = b;
|
||||
a->right = b;
|
||||
b->left = a;
|
||||
}
|
||||
}
|
||||
|
||||
static fibnode_t
|
||||
fibnode_remove (node)
|
||||
fibnode_t node;
|
||||
{
|
||||
fibnode_t ret;
|
||||
|
||||
if (node == node->left)
|
||||
ret = NULL;
|
||||
else
|
||||
ret = node->left;
|
||||
|
||||
if (node->parent != NULL && node->parent->child == node)
|
||||
node->parent->child = ret;
|
||||
|
||||
node->right->left = node->left;
|
||||
node->left->right = node->right;
|
||||
|
||||
node->parent = NULL;
|
||||
node->left = node;
|
||||
node->right = node;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
@deftypefn Replacement int fnmatch (const char *@var{pattern}, const char *@var{string}, int @var{flags})
|
||||
|
||||
Matches @var{string} against @var{pattern}, returning zero if it
|
||||
matches, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
|
||||
wildcards @code{?} to match any one character, @code{*} to match any
|
||||
zero or more characters, or a set of alternate characters in square
|
||||
brackets, like @samp{[a-gt8]}, which match one character (@code{a}
|
||||
through @code{g}, or @code{t}, or @code{8}, in this example) if that one
|
||||
character is in the set. A set may be inverted (i.e., match anything
|
||||
except what's in the set) by giving @code{^} or @code{!} as the first
|
||||
character in the set. To include those characters in the set, list them
|
||||
as anything other than the first character of the set. To include a
|
||||
dash in the set, list it last in the set. A backslash character makes
|
||||
the following character not special, so for example you could match
|
||||
against a literal asterisk with @samp{\*}. To match a literal
|
||||
backslash, use @samp{\\}.
|
||||
|
||||
@code{flags} controls various aspects of the matching process, and is a
|
||||
boolean OR of zero or more of the following values (defined in
|
||||
@code{<fnmatch.h>}):
|
||||
|
||||
@table @code
|
||||
|
||||
@item FNM_PATHNAME
|
||||
@itemx FNM_FILE_NAME
|
||||
@var{string} is assumed to be a path name. No wildcard will ever match
|
||||
@code{/}.
|
||||
|
||||
@item FNM_NOESCAPE
|
||||
Do not interpret backslashes as quoting the following special character.
|
||||
|
||||
@item FNM_PERIOD
|
||||
A leading period (at the beginning of @var{string}, or if
|
||||
@code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
|
||||
@code{?} but must be matched explicitly.
|
||||
|
||||
@item FNM_LEADING_DIR
|
||||
Means that @var{string} also matches @var{pattern} if some initial part
|
||||
of @var{string} matches, and is followed by @code{/} and zero or more
|
||||
characters. For example, @samp{foo*} would match either @samp{foobar}
|
||||
or @samp{foobar/grill}.
|
||||
|
||||
@item FNM_CASEFOLD
|
||||
Ignores case when performing the comparison.
|
||||
|
||||
@end table
|
||||
|
||||
@end deftypefn
|
||||
@@ -1,937 +0,0 @@
|
||||
@c Automatically generated from *.c and others (the comments before
|
||||
@c each entry tell you which file and where in that file). DO NOT EDIT!
|
||||
@c Edit the *.c files, configure with --enable-maintainer-mode,
|
||||
@c and let gather-docs build you a new copy.
|
||||
|
||||
@c alloca.c:26
|
||||
@deftypefn Replacement void* alloca (size_t @var{size})
|
||||
|
||||
This function allocates memory which will be automatically reclaimed
|
||||
after the procedure exits. The @libib{} implementation does not free
|
||||
the memory immediately but will do so eventually during subsequent
|
||||
calls to this function. Memory is allocated using @code{xmalloc} under
|
||||
normal circumstances.
|
||||
|
||||
The header file @file{alloca-conf.h} can be used in conjunction with the
|
||||
GNU Autoconf test @code{AC_FUNC_ALLOCA} to test for and properly make
|
||||
available this function. The @code{AC_FUNC_ALLOCA} test requires that
|
||||
client code use a block of preprocessor code to be safe (see the Autoconf
|
||||
manual for more); this header incorporates that logic and more, including
|
||||
the possibility of a GCC built-in function.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c asprintf.c:33
|
||||
@deftypefn Extension int asprintf (char **@var{resptr}, const char *@var{format}, ...)
|
||||
|
||||
Like @code{sprintf}, but instead of passing a pointer to a buffer, you
|
||||
pass a pointer to a pointer. This function will compute the size of
|
||||
the buffer needed, allocate memory with @code{malloc}, and store a
|
||||
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
||||
returned is the same as @code{sprintf} would return. If memory could
|
||||
not be allocated, zero is returned and @code{NULL} is stored in
|
||||
@code{*@var{resptr}}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c atexit.c:6
|
||||
@deftypefn Supplemental int atexit (void (*@var{f})())
|
||||
|
||||
Causes function @var{f} to be called at exit. Returns 0.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c basename.c:6
|
||||
@deftypefn Supplemental char* basename (const char *@var{name})
|
||||
|
||||
Returns a pointer to the last component of pathname @var{name}.
|
||||
Behavior is undefined if the pathname ends in a directory separator.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c bcmp.c:6
|
||||
@deftypefn Supplemental int bcmp (char *@var{x}, char *@var{y}, int @var{count})
|
||||
|
||||
Compares the first @var{count} bytes of two areas of memory. Returns
|
||||
zero if they are the same, nonzero otherwise. Returns zero if
|
||||
@var{count} is zero. A nonzero result only indicates a difference,
|
||||
it does not indicate any sorting order (say, by having a positive
|
||||
result mean @var{x} sorts before @var{y}).
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c bcopy.c:3
|
||||
@deftypefn Supplemental void bcopy (char *@var{in}, char *@var{out}, int @var{length})
|
||||
|
||||
Copies @var{length} bytes from memory region @var{in} to region
|
||||
@var{out}. The use of @code{bcopy} is deprecated in new programs.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c bsearch.c:33
|
||||
@deftypefn Supplemental void* bsearch (const void *@var{key}, const void *@var{base}, size_t @var{nmemb}, size_t @var{size}, int (*@var{compar})(const void *, const void *))
|
||||
|
||||
Performs a search over an array of @var{nmemb} elements pointed to by
|
||||
@var{base} for a member that matches the object pointed to by @var{key}.
|
||||
The size of each member is specified by @var{size}. The array contents
|
||||
should be sorted in ascending order according to the @var{compar}
|
||||
comparison function. This routine should take two arguments pointing to
|
||||
the @var{key} and to an array member, in that order, and should return an
|
||||
integer less than, equal to, or greater than zero if the @var{key} object
|
||||
is respectively less than, matching, or greater than the array member.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c argv.c:139
|
||||
@deftypefn Extension char** buildargv (char *@var{sp})
|
||||
|
||||
Given a pointer to a string, parse the string extracting fields
|
||||
separated by whitespace and optionally enclosed within either single
|
||||
or double quotes (which are stripped off), and build a vector of
|
||||
pointers to copies of the string for each field. The input string
|
||||
remains unchanged. The last element of the vector is followed by a
|
||||
@code{NULL} element.
|
||||
|
||||
All of the memory for the pointer array and copies of the string
|
||||
is obtained from @code{malloc}. All of the memory can be returned to the
|
||||
system with the single function call @code{freeargv}, which takes the
|
||||
returned result of @code{buildargv}, as it's argument.
|
||||
|
||||
Returns a pointer to the argument vector if successful. Returns
|
||||
@code{NULL} if @var{sp} is @code{NULL} or if there is insufficient
|
||||
memory to complete building the argument vector.
|
||||
|
||||
If the input is a null string (as opposed to a @code{NULL} pointer),
|
||||
then buildarg returns an argument vector that has one arg, a null
|
||||
string.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c bzero.c:6
|
||||
@deftypefn Supplemental void bzero (char *@var{mem}, int @var{count})
|
||||
|
||||
Zeros @var{count} bytes starting at @var{mem}. Use of this function
|
||||
is deprecated in favor of @code{memset}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c calloc.c:6
|
||||
@deftypefn Supplemental void* calloc (size_t @var{nelem}, size_t @var{elsize})
|
||||
|
||||
Uses @code{malloc} to allocate storage for @var{nelem} objects of
|
||||
@var{elsize} bytes each, then zeros the memory.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c choose-temp.c:42
|
||||
@deftypefn Extension char* choose_temp_base (void)
|
||||
|
||||
Return a prefix for temporary file names or @code{NULL} if unable to
|
||||
find one. The current directory is chosen if all else fails so the
|
||||
program is exited if a temporary directory can't be found (@code{mktemp}
|
||||
fails). The buffer for the result is obtained with @code{xmalloc}.
|
||||
|
||||
This function is provided for backwards compatability only. Its use is
|
||||
not recommended.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c make-temp-file.c:88
|
||||
@deftypefn Replacement char* choose_tmpdir ()
|
||||
|
||||
Returns a pointer to a directory path suitable for creating temporary
|
||||
files in.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c clock.c:27
|
||||
@deftypefn Supplemental long clock (void)
|
||||
|
||||
Returns an approximation of the CPU time used by the process as a
|
||||
@code{clock_t}; divide this number by @samp{CLOCKS_PER_SEC} to get the
|
||||
number of seconds used.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c concat.c:24
|
||||
@deftypefn Extension char* concat (const char *@var{s1}, const char *@var{s2}, @dots{}, @code{NULL})
|
||||
|
||||
Concatenate zero or more of strings and return the result in freshly
|
||||
@code{xmalloc}ed memory. Returns @code{NULL} if insufficient memory is
|
||||
available. The argument list is terminated by the first @code{NULL}
|
||||
pointer encountered. Pointers to empty strings are ignored.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c argv.c:65
|
||||
@deftypefn Extension char** dupargv (char **@var{vector})
|
||||
|
||||
Duplicate an argument vector. Simply scans through @var{vector},
|
||||
duplicating each argument until the terminating @code{NULL} is found.
|
||||
Returns a pointer to the argument vector if successful. Returns
|
||||
@code{NULL} if there is insufficient memory to complete building the
|
||||
argument vector.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strerror.c:566
|
||||
@deftypefn Extension int errno_max (void)
|
||||
|
||||
Returns the maximum @code{errno} value for which a corresponding
|
||||
symbolic name or message is available. Note that in the case where we
|
||||
use the @code{sys_errlist} supplied by the system, it is possible for
|
||||
there to be more symbolic names than messages, or vice versa. In
|
||||
fact, the manual page for @code{perror(3C)} explicitly warns that one
|
||||
should check the size of the table (@code{sys_nerr}) before indexing
|
||||
it, since new error codes may be added to the system before they are
|
||||
added to the table. Thus @code{sys_nerr} might be smaller than value
|
||||
implied by the largest @code{errno} value defined in @code{<errno.h>}.
|
||||
|
||||
We return the maximum value that can be used to obtain a meaningful
|
||||
symbolic name or message.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c fdmatch.c:23
|
||||
@deftypefn Extension int fdmatch (int @var{fd1}, int @var{fd2})
|
||||
|
||||
Check to see if two open file descriptors refer to the same file.
|
||||
This is useful, for example, when we have an open file descriptor for
|
||||
an unnamed file, and the name of a file that we believe to correspond
|
||||
to that fd. This can happen when we are exec'd with an already open
|
||||
file (@code{stdout} for example) or from the SVR4 @file{/proc} calls
|
||||
that return open file descriptors for mapped address spaces. All we
|
||||
have to do is open the file by name and check the two file descriptors
|
||||
for a match, which is done by comparing major and minor device numbers
|
||||
and inode numbers.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c ffs.c:3
|
||||
@deftypefn Supplemental int ffs (int @var{valu})
|
||||
|
||||
Find the first (least significant) bit set in @var{valu}. Bits are
|
||||
numbered from right to left, starting with bit 1 (corresponding to the
|
||||
value 1). If @var{valu} is zero, zero is returned.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c fnmatch.txh:1
|
||||
@deftypefn Replacement int fnmatch (const char *@var{pattern}, const char *@var{string}, int @var{flags})
|
||||
|
||||
Matches @var{string} against @var{pattern}, returning zero if it
|
||||
matches, @code{FNM_NOMATCH} if not. @var{pattern} may contain the
|
||||
wildcards @code{?} to match any one character, @code{*} to match any
|
||||
zero or more characters, or a set of alternate characters in square
|
||||
brackets, like @samp{[a-gt8]}, which match one character (@code{a}
|
||||
through @code{g}, or @code{t}, or @code{8}, in this example) if that one
|
||||
character is in the set. A set may be inverted (i.e., match anything
|
||||
except what's in the set) by giving @code{^} or @code{!} as the first
|
||||
character in the set. To include those characters in the set, list them
|
||||
as anything other than the first character of the set. To include a
|
||||
dash in the set, list it last in the set. A backslash character makes
|
||||
the following character not special, so for example you could match
|
||||
against a literal asterisk with @samp{\*}. To match a literal
|
||||
backslash, use @samp{\\}.
|
||||
|
||||
@code{flags} controls various aspects of the matching process, and is a
|
||||
boolean OR of zero or more of the following values (defined in
|
||||
@code{<fnmatch.h>}):
|
||||
|
||||
@table @code
|
||||
|
||||
@item FNM_PATHNAME
|
||||
@itemx FNM_FILE_NAME
|
||||
@var{string} is assumed to be a path name. No wildcard will ever match
|
||||
@code{/}.
|
||||
|
||||
@item FNM_NOESCAPE
|
||||
Do not interpret backslashes as quoting the following special character.
|
||||
|
||||
@item FNM_PERIOD
|
||||
A leading period (at the beginning of @var{string}, or if
|
||||
@code{FNM_PATHNAME} after a slash) is not matched by @code{*} or
|
||||
@code{?} but must be matched explicitly.
|
||||
|
||||
@item FNM_LEADING_DIR
|
||||
Means that @var{string} also matches @var{pattern} if some initial part
|
||||
of @var{string} matches, and is followed by @code{/} and zero or more
|
||||
characters. For example, @samp{foo*} would match either @samp{foobar}
|
||||
or @samp{foobar/grill}.
|
||||
|
||||
@item FNM_CASEFOLD
|
||||
Ignores case when performing the comparison.
|
||||
|
||||
@end table
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c argv.c:111
|
||||
@deftypefn Extension void freeargv (char **@var{vector})
|
||||
|
||||
Free an argument vector that was built using @code{buildargv}. Simply
|
||||
scans through @var{vector}, freeing the memory for each argument until
|
||||
the terminating @code{NULL} is found, and then frees @var{vector}
|
||||
itself.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c getruntime.c:78
|
||||
@deftypefn Replacement long get_run_time (void)
|
||||
|
||||
Returns the time used so far, in microseconds. If possible, this is
|
||||
the time used by this process, else it is the elapsed time since the
|
||||
process started.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c getcwd.c:6
|
||||
@deftypefn Supplemental char* getcwd (char *@var{pathname}, int @var{len})
|
||||
|
||||
Copy the absolute pathname for the current working directory into
|
||||
@var{pathname}, which is assumed to point to a buffer of at least
|
||||
@var{len} bytes, and return a pointer to the buffer. If the current
|
||||
directory's path doesn't fit in @var{len} characters, the result is
|
||||
@code{NULL} and @code{errno} is set. If @var{pathname} is a null pointer,
|
||||
@code{getcwd} will obtain @var{len} bytes of space using
|
||||
@code{malloc}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c getpagesize.c:5
|
||||
@deftypefn Supplemental int getpagesize (void)
|
||||
|
||||
Returns the number of bytes in a page of memory. This is the
|
||||
granularity of many of the system memory management routines. No
|
||||
guarantee is made as to whether or not it is the same as the basic
|
||||
memory management hardware page size.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c getpwd.c:5
|
||||
@deftypefn Supplemental char* getpwd (void)
|
||||
|
||||
Returns the current working directory. This implementation caches the
|
||||
result on the assumption that the process will not call @code{chdir}
|
||||
between calls to @code{getpwd}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c index.c:5
|
||||
@deftypefn Supplemental char* index (char *@var{s}, int @var{c})
|
||||
|
||||
Returns a pointer to the first occurrence of the character @var{c} in
|
||||
the string @var{s}, or @code{NULL} if not found. The use of @code{index} is
|
||||
deprecated in new programs in favor of @code{strchr}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c insque.c:6
|
||||
@deftypefn Supplemental void insque (struct qelem *@var{elem}, struct qelem *@var{pred})
|
||||
@deftypefnx Supplemental void remque (struct qelem *@var{elem})
|
||||
|
||||
Routines to manipulate queues built from doubly linked lists. The
|
||||
@code{insque} routine inserts @var{elem} in the queue immediately
|
||||
after @var{pred}. The @code{remque} routine removes @var{elem} from
|
||||
its containing queue. These routines expect to be passed pointers to
|
||||
structures which have as their first members a forward pointer and a
|
||||
back pointer, like this prototype (although no prototype is provided):
|
||||
|
||||
@example
|
||||
struct qelem @{
|
||||
struct qelem *q_forw;
|
||||
struct qelem *q_back;
|
||||
char q_data[];
|
||||
@};
|
||||
@end example
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c lbasename.c:23
|
||||
@deftypefn Replacement {const char*} lbasename (const char *@var{name})
|
||||
|
||||
Given a pointer to a string containing a typical pathname
|
||||
(@samp{/usr/src/cmd/ls/ls.c} for example), returns a pointer to the
|
||||
last component of the pathname (@samp{ls.c} in this case). The
|
||||
returned pointer is guaranteed to lie within the original
|
||||
string. This latter fact is not true of many vendor C
|
||||
libraries, which return special strings or modify the passed
|
||||
strings for particular input.
|
||||
|
||||
In particular, the empty string returns the same empty string,
|
||||
and a path ending in @code{/} returns the empty string after it.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c make-temp-file.c:138
|
||||
@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
|
||||
|
||||
Return a temporary file name (as a string) or @code{NULL} if unable to
|
||||
create one. @var{suffix} is a suffix to append to the file name. The
|
||||
string is @code{malloc}ed, and the temporary file has been created.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c memchr.c:3
|
||||
@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n})
|
||||
|
||||
This function searches memory starting at @code{*@var{s}} for the
|
||||
character @var{c}. The search only ends with the first occurrence of
|
||||
@var{c}, or after @var{length} characters; in particular, a null
|
||||
character does not terminate the search. If the character @var{c} is
|
||||
found within @var{length} characters of @code{*@var{s}}, a pointer
|
||||
to the character is returned. If @var{c} is not found, then @code{NULL} is
|
||||
returned.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c memcmp.c:6
|
||||
@deftypefn Supplemental int memcmp (const void *@var{x}, const void *@var{y}, size_t @var{count})
|
||||
|
||||
Compares the first @var{count} bytes of two areas of memory. Returns
|
||||
zero if they are the same, a value less than zero if @var{x} is
|
||||
lexically less than @var{y}, or a value greater than zero if @var{x}
|
||||
is lexically greater than @var{y}. Note that lexical order is determined
|
||||
as if comparing unsigned char arrays.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c memcpy.c:6
|
||||
@deftypefn Supplemental void* memcpy (void *@var{out}, const void *@var{in}, size_t @var{length})
|
||||
|
||||
Copies @var{length} bytes from memory region @var{in} to region
|
||||
@var{out}. Returns a pointer to @var{out}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c memmove.c:6
|
||||
@deftypefn Supplemental void* memmove (void *@var{from}, const void *@var{to}, size_t @var{count})
|
||||
|
||||
Copies @var{count} bytes from memory area @var{from} to memory area
|
||||
@var{to}, returning a pointer to @var{to}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c memset.c:6
|
||||
@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count})
|
||||
|
||||
Sets the first @var{count} bytes of @var{s} to the constant byte
|
||||
@var{c}, returning a pointer to @var{s}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c mkstemps.c:54
|
||||
@deftypefn Replacement int mkstemps (char *@var{template}, int @var{suffix_len})
|
||||
|
||||
Generate a unique temporary file name from @var{template}.
|
||||
@var{template} has the form:
|
||||
|
||||
@example
|
||||
@var{path}/ccXXXXXX@var{suffix}
|
||||
@end example
|
||||
|
||||
@var{suffix_len} tells us how long @var{suffix} is (it can be zero
|
||||
length). The last six characters of @var{template} before @var{suffix}
|
||||
must be @samp{XXXXXX}; they are replaced with a string that makes the
|
||||
filename unique. Returns a file descriptor open on the file for
|
||||
reading and writing.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c pexecute.c:67
|
||||
@deftypefn Extension int pexecute (const char *@var{program}, char * const *@var{argv}, const char *@var{this_pname}, const char *@var{temp_base}, char **@var{errmsg_fmt}, char **@var{errmsg_arg}, int flags)
|
||||
|
||||
Executes a program.
|
||||
|
||||
@var{program} and @var{argv} are the arguments to
|
||||
@code{execv}/@code{execvp}.
|
||||
|
||||
@var{this_pname} is name of the calling program (i.e., @code{argv[0]}).
|
||||
|
||||
@var{temp_base} is the path name, sans suffix, of a temporary file to
|
||||
use if needed. This is currently only needed for MS-DOS ports that
|
||||
don't use @code{go32} (do any still exist?). Ports that don't need it
|
||||
can pass @code{NULL}.
|
||||
|
||||
(@code{@var{flags} & PEXECUTE_SEARCH}) is non-zero if @env{PATH} should be searched
|
||||
(??? It's not clear that GCC passes this flag correctly). (@code{@var{flags} &
|
||||
PEXECUTE_FIRST}) is nonzero for the first process in chain.
|
||||
(@code{@var{flags} & PEXECUTE_FIRST}) is nonzero for the last process
|
||||
in chain. The first/last flags could be simplified to only mark the
|
||||
last of a chain of processes but that requires the caller to always
|
||||
mark the last one (and not give up early if some error occurs).
|
||||
It's more robust to require the caller to mark both ends of the chain.
|
||||
|
||||
The result is the pid on systems like Unix where we
|
||||
@code{fork}/@code{exec} and on systems like WIN32 and OS/2 where we
|
||||
use @code{spawn}. It is up to the caller to wait for the child.
|
||||
|
||||
The result is the @code{WEXITSTATUS} on systems like MS-DOS where we
|
||||
@code{spawn} and wait for the child here.
|
||||
|
||||
Upon failure, @var{errmsg_fmt} and @var{errmsg_arg} are set to the
|
||||
text of the error message with an optional argument (if not needed,
|
||||
@var{errmsg_arg} is set to @code{NULL}), and @minus{}1 is returned.
|
||||
@code{errno} is available to the caller to use.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strsignal.c:547
|
||||
@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message})
|
||||
|
||||
Print @var{message} to the standard error, followed by a colon,
|
||||
followed by the description of the signal specified by @var{signo},
|
||||
followed by a newline.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c putenv.c:21
|
||||
@deftypefn Supplemental int putenv (const char *@var{string})
|
||||
|
||||
Uses @code{setenv} or @code{unsetenv} to put @var{string} into
|
||||
the environment or remove it. If @var{string} is of the form
|
||||
@samp{name=value} the string is added; if no @samp{=} is present the
|
||||
name is unset/removed.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c pexecute.c:104
|
||||
@deftypefn Extension int pwait (int @var{pid}, int *@var{status}, int @var{flags})
|
||||
|
||||
Waits for a program started by @code{pexecute} to finish.
|
||||
|
||||
@var{pid} is the process id of the task to wait for. @var{status} is
|
||||
the `status' argument to wait. @var{flags} is currently unused (allows
|
||||
future enhancement without breaking upward compatibility). Pass 0 for now.
|
||||
|
||||
The result is the pid of the child reaped, or -1 for failure
|
||||
(@code{errno} says why).
|
||||
|
||||
On systems that don't support waiting for a particular child, @var{pid} is
|
||||
ignored. On systems like MS-DOS that don't really multitask @code{pwait}
|
||||
is just a mechanism to provide a consistent interface for the caller.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c random.c:39
|
||||
@deftypefn Supplement {long int} random (void)
|
||||
@deftypefnx Supplement void srandom (unsigned int @var{seed})
|
||||
@deftypefnx Supplement void* initstate (unsigned int @var{seed}, void *@var{arg_state}, unsigned long @var{n})
|
||||
@deftypefnx Supplement void* setstate (void *@var{arg_state})
|
||||
|
||||
Random number functions. @code{random} returns a random number in the
|
||||
range 0 to @code{LONG_MAX}. @code{srandom} initializes the random
|
||||
number generator to some starting point determined by @var{seed}
|
||||
(else, the values returned by @code{random} are always the same for each
|
||||
run of the program). @code{initstate} and @code{setstate} allow fine-grained
|
||||
control over the state of the random number generator.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c concat.c:177
|
||||
@deftypefn Extension char* reconcat (char *@var{optr}, const char *@var{s1}, @dots{}, @code{NULL})
|
||||
|
||||
Same as @code{concat}, except that if @var{optr} is not @code{NULL} it
|
||||
is freed after the string is created. This is intended to be useful
|
||||
when you're extending an existing string or building up a string in a
|
||||
loop:
|
||||
|
||||
@example
|
||||
str = reconcat (str, "pre-", str, NULL);
|
||||
@end example
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c rename.c:6
|
||||
@deftypefn Supplemental int rename (const char *@var{old}, const char *@var{new})
|
||||
|
||||
Renames a file from @var{old} to @var{new}. If @var{new} already
|
||||
exists, it is removed.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c rindex.c:5
|
||||
@deftypefn Supplemental char* rindex (const char *@var{s}, int @var{c})
|
||||
|
||||
Returns a pointer to the last occurrence of the character @var{c} in
|
||||
the string @var{s}, or @code{NULL} if not found. The use of @code{rindex} is
|
||||
deprecated in new programs in favor of @code{strrchr}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c setenv.c:22
|
||||
@deftypefn Supplemental int setenv (const char *@var{name}, const char *@var{value}, int @var{overwrite})
|
||||
@deftypefnx Supplemental void unsetenv (const char *@var{name})
|
||||
|
||||
@code{setenv} adds @var{name} to the environment with value
|
||||
@var{value}. If the name was already present in the environment,
|
||||
the new value will be stored only if @var{overwrite} is nonzero.
|
||||
The companion @code{unsetenv} function removes @var{name} from the
|
||||
environment. This implementation is not safe for multithreaded code.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strsignal.c:353
|
||||
@deftypefn Extension int signo_max (void)
|
||||
|
||||
Returns the maximum signal value for which a corresponding symbolic
|
||||
name or message is available. Note that in the case where we use the
|
||||
@code{sys_siglist} supplied by the system, it is possible for there to
|
||||
be more symbolic names than messages, or vice versa. In fact, the
|
||||
manual page for @code{psignal(3b)} explicitly warns that one should
|
||||
check the size of the table (@code{NSIG}) before indexing it, since
|
||||
new signal codes may be added to the system before they are added to
|
||||
the table. Thus @code{NSIG} might be smaller than value implied by
|
||||
the largest signo value defined in @code{<signal.h>}.
|
||||
|
||||
We return the maximum value that can be used to obtain a meaningful
|
||||
symbolic name or message.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c sigsetmask.c:8
|
||||
@deftypefn Supplemental int sigsetmask (int @var{set})
|
||||
|
||||
Sets the signal mask to the one provided in @var{set} and returns
|
||||
the old mask (which, for libiberty's implementation, will always
|
||||
be the value @code{1}).
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c spaces.c:22
|
||||
@deftypefn Extension char* spaces (int @var{count})
|
||||
|
||||
Returns a pointer to a memory region filled with the specified
|
||||
number of spaces and null terminated. The returned pointer is
|
||||
valid until at least the next call.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strcasecmp.c:15
|
||||
@deftypefn Supplemental int strcasecmp (const char *@var{s1}, const char *@var{s2})
|
||||
|
||||
A case-insensitive @code{strcmp}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strchr.c:6
|
||||
@deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c})
|
||||
|
||||
Returns a pointer to the first occurrence of the character @var{c} in
|
||||
the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
|
||||
null character, the results are undefined.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strdup.c:3
|
||||
@deftypefn Supplemental char* strdup (const char *@var{s})
|
||||
|
||||
Returns a pointer to a copy of @var{s} in memory obtained from
|
||||
@code{malloc}, or @code{NULL} if insufficient memory was available.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strerror.c:670
|
||||
@deftypefn Replacement {const char*} strerrno (int @var{errnum})
|
||||
|
||||
Given an error number returned from a system call (typically returned
|
||||
in @code{errno}), returns a pointer to a string containing the
|
||||
symbolic name of that error number, as found in @code{<errno.h>}.
|
||||
|
||||
If the supplied error number is within the valid range of indices for
|
||||
symbolic names, but no name is available for the particular error
|
||||
number, then returns the string @samp{Error @var{num}}, where @var{num}
|
||||
is the error number.
|
||||
|
||||
If the supplied error number is not within the range of valid
|
||||
indices, then returns @code{NULL}.
|
||||
|
||||
The contents of the location pointed to are only guaranteed to be
|
||||
valid until the next call to @code{strerrno}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strerror.c:602
|
||||
@deftypefn Supplemental char* strerror (int @var{errnoval})
|
||||
|
||||
Maps an @code{errno} number to an error message string, the contents
|
||||
of which are implementation defined. On systems which have the
|
||||
external variables @code{sys_nerr} and @code{sys_errlist}, these
|
||||
strings will be the same as the ones used by @code{perror}.
|
||||
|
||||
If the supplied error number is within the valid range of indices for
|
||||
the @code{sys_errlist}, but no message is available for the particular
|
||||
error number, then returns the string @samp{Error @var{num}}, where
|
||||
@var{num} is the error number.
|
||||
|
||||
If the supplied error number is not a valid index into
|
||||
@code{sys_errlist}, returns @code{NULL}.
|
||||
|
||||
The returned string is only guaranteed to be valid only until the
|
||||
next call to @code{strerror}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strncasecmp.c:15
|
||||
@deftypefn Supplemental int strncasecmp (const char *@var{s1}, const char *@var{s2})
|
||||
|
||||
A case-insensitive @code{strncmp}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strncmp.c:6
|
||||
@deftypefn Supplemental int strncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n})
|
||||
|
||||
Compares the first @var{n} bytes of two strings, returning a value as
|
||||
@code{strcmp}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strrchr.c:6
|
||||
@deftypefn Supplemental char* strrchr (const char *@var{s}, int @var{c})
|
||||
|
||||
Returns a pointer to the last occurrence of the character @var{c} in
|
||||
the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
|
||||
null character, the results are undefined.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strsignal.c:388
|
||||
@deftypefn Supplemental {const char *} strsignal (int @var{signo})
|
||||
|
||||
Maps an signal number to an signal message string, the contents of
|
||||
which are implementation defined. On systems which have the external
|
||||
variable @code{sys_siglist}, these strings will be the same as the
|
||||
ones used by @code{psignal()}.
|
||||
|
||||
If the supplied signal number is within the valid range of indices for
|
||||
the @code{sys_siglist}, but no message is available for the particular
|
||||
signal number, then returns the string @samp{Signal @var{num}}, where
|
||||
@var{num} is the signal number.
|
||||
|
||||
If the supplied signal number is not a valid index into
|
||||
@code{sys_siglist}, returns @code{NULL}.
|
||||
|
||||
The returned string is only guaranteed to be valid only until the next
|
||||
call to @code{strsignal}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strsignal.c:452
|
||||
@deftypefn Extension {const char*} strsigno (int @var{signo})
|
||||
|
||||
Given an signal number, returns a pointer to a string containing the
|
||||
symbolic name of that signal number, as found in @code{<signal.h>}.
|
||||
|
||||
If the supplied signal number is within the valid range of indices for
|
||||
symbolic names, but no name is available for the particular signal
|
||||
number, then returns the string @samp{Signal @var{num}}, where
|
||||
@var{num} is the signal number.
|
||||
|
||||
If the supplied signal number is not within the range of valid
|
||||
indices, then returns @code{NULL}.
|
||||
|
||||
The contents of the location pointed to are only guaranteed to be
|
||||
valid until the next call to @code{strsigno}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strstr.c:6
|
||||
@deftypefn Supplemental char* strstr (const char *@var{string}, const char *@var{sub})
|
||||
|
||||
This function searches for the substring @var{sub} in the string
|
||||
@var{string}, not including the terminating null characters. A pointer
|
||||
to the first occurrence of @var{sub} is returned, or @code{NULL} if the
|
||||
substring is absent. If @var{sub} points to a string with zero
|
||||
length, the function returns @var{string}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strtod.c:27
|
||||
@deftypefn Supplemental double strtod (const char *@var{string}, char **@var{endptr})
|
||||
|
||||
This ISO C function converts the initial portion of @var{string} to a
|
||||
@code{double}. If @var{endptr} is not @code{NULL}, a pointer to the
|
||||
character after the last character used in the conversion is stored in
|
||||
the location referenced by @var{endptr}. If no conversion is
|
||||
performed, zero is returned and the value of @var{string} is stored in
|
||||
the location referenced by @var{endptr}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strerror.c:730
|
||||
@deftypefn Extension int strtoerrno (const char *@var{name})
|
||||
|
||||
Given the symbolic name of a error number (e.g., @code{EACCES}), map it
|
||||
to an errno value. If no translation is found, returns 0.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strtol.c:33
|
||||
@deftypefn Supplemental {long int} strtol (const char *@var{string}, char **@var{endptr}, int @var{base})
|
||||
@deftypefnx Supplemental {unsigned long int} strtoul (const char *@var{string}, char **@var{endptr}, int @var{base})
|
||||
|
||||
The @code{strtol} function converts the string in @var{string} to a
|
||||
long integer value according to the given @var{base}, which must be
|
||||
between 2 and 36 inclusive, or be the special value 0. If @var{base}
|
||||
is 0, @code{strtol} will look for the prefixes @code{0} and @code{0x}
|
||||
to indicate bases 8 and 16, respectively, else default to base 10.
|
||||
When the base is 16 (either explicitly or implicitly), a prefix of
|
||||
@code{0x} is allowed. The handling of @var{endptr} is as that of
|
||||
@code{strtod} above. The @code{strtoul} function is the same, except
|
||||
that the converted value is unsigned.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c strsignal.c:507
|
||||
@deftypefn Extension int strtosigno (const char *@var{name})
|
||||
|
||||
Given the symbolic name of a signal, map it to a signal number. If no
|
||||
translation is found, returns 0.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c tmpnam.c:3
|
||||
@deftypefn Supplemental char* tmpnam (char *@var{s})
|
||||
|
||||
This function attempts to create a name for a temporary file, which
|
||||
will be a valid file name yet not exist when @code{tmpnam} checks for
|
||||
it. @var{s} must point to a buffer of at least @code{L_tmpnam} bytes,
|
||||
or be @code{NULL}. Use of this function creates a security risk, and it must
|
||||
not be used in new projects. Use @code{mkstemp} instead.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c vasprintf.c:48
|
||||
@deftypefn Extension int vasprintf (char **@var{resptr}, const char *@var{format}, va_list @var{args})
|
||||
|
||||
Like @code{vsprintf}, but instead of passing a pointer to a buffer,
|
||||
you pass a pointer to a pointer. This function will compute the size
|
||||
of the buffer needed, allocate memory with @code{malloc}, and store a
|
||||
pointer to the allocated memory in @code{*@var{resptr}}. The value
|
||||
returned is the same as @code{vsprintf} would return. If memory could
|
||||
not be allocated, zero is returned and @code{NULL} is stored in
|
||||
@code{*@var{resptr}}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c vfork.c:6
|
||||
@deftypefn Supplemental int vfork (void)
|
||||
|
||||
Emulates @code{vfork} by calling @code{fork} and returning its value.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c vprintf.c:3
|
||||
@deftypefn Supplemental int vprintf (const char *@var{format}, va_list @var{ap})
|
||||
@deftypefnx Supplemental int vfprintf (FILE *@var{stream}, const char *@var{format}, va_list @var{ap})
|
||||
@deftypefnx Supplemental int vsprintf (char *@var{str}, const char *@var{format}, va_list @var{ap})
|
||||
|
||||
These functions are the same as @code{printf}, @code{fprintf}, and
|
||||
@code{sprintf}, respectively, except that they are called with a
|
||||
@code{va_list} instead of a variable number of arguments. Note that
|
||||
they do not call @code{va_end}; this is the application's
|
||||
responsibility. In @libib{} they are implemented in terms of the
|
||||
nonstandard but common function @code{_doprnt}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c waitpid.c:3
|
||||
@deftypefn Supplemental int waitpid (int @var{pid}, int *@var{status}, int)
|
||||
|
||||
This is a wrapper around the @code{wait} function. Any ``special''
|
||||
values of @var{pid} depend on your implementation of @code{wait}, as
|
||||
does the return value. The third argument is unused in @libib{}.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xatexit.c:11
|
||||
@deftypefun int xatexit (void (*@var{fn}) (void))
|
||||
|
||||
Behaves as the standard @code{atexit} function, but with no limit on
|
||||
the number of registered functions. Returns 0 on success, or @minus{}1 on
|
||||
failure. If you use @code{xatexit} to register functions, you must use
|
||||
@code{xexit} to terminate your program.
|
||||
|
||||
@end deftypefun
|
||||
|
||||
@c xmalloc.c:38
|
||||
@deftypefn Replacement void* xcalloc (size_t @var{nelem}, size_t @var{elsize})
|
||||
|
||||
Allocate memory without fail, and set it to zero. This routine functions
|
||||
like @code{calloc}, but will behave the same as @code{xmalloc} if memory
|
||||
cannot be found.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xexit.c:22
|
||||
@deftypefn Replacement void xexit (int @var{code})
|
||||
|
||||
Terminates the program. If any functions have been registered with
|
||||
the @code{xatexit} replacement function, they will be called first.
|
||||
Termination is handled via the system's normal @code{exit} call.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xmalloc.c:22
|
||||
@deftypefn Replacement void* xmalloc (size_t)
|
||||
|
||||
Allocate memory without fail. If @code{malloc} fails, this will print
|
||||
a message to @code{stderr} (using the name set by
|
||||
@code{xmalloc_set_program_name},
|
||||
if any) and then call @code{xexit}. Note that it is therefore safe for
|
||||
a program to contain @code{#define malloc xmalloc} in its source.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xmalloc.c:53
|
||||
@deftypefn Replacement void xmalloc_failed (size_t)
|
||||
|
||||
This function is not meant to be called by client code, and is listed
|
||||
here for completeness only. If any of the allocation routines fail, this
|
||||
function will be called to print an error message and terminate execution.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xmalloc.c:46
|
||||
@deftypefn Replacement void xmalloc_set_program_name (const char *@var{name})
|
||||
|
||||
You can use this to set the name of the program used by
|
||||
@code{xmalloc_failed} when printing a failure message.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xmemdup.c:7
|
||||
@deftypefn Replacement void* xmemdup (void *@var{input}, size_t @var{copy_size}, size_t @var{alloc_size})
|
||||
|
||||
Duplicates a region of memory without fail. First, @var{alloc_size} bytes
|
||||
are allocated, then @var{copy_size} bytes from @var{input} are copied into
|
||||
it, and the new memory is returned. If fewer bytes are copied than were
|
||||
allocated, the remaining memory is zeroed.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xmalloc.c:32
|
||||
@deftypefn Replacement void* xrealloc (void *@var{ptr}, size_t @var{size})
|
||||
Reallocate memory without fail. This routine functions like @code{realloc},
|
||||
but will behave the same as @code{xmalloc} if memory cannot be found.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xstrdup.c:7
|
||||
@deftypefn Replacement char* xstrdup (const char *@var{s})
|
||||
|
||||
Duplicates a character string without fail, using @code{xmalloc} to
|
||||
obtain memory.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
@c xstrerror.c:7
|
||||
@deftypefn Replacement char* xstrerror (int @var{errnum})
|
||||
|
||||
Behaves exactly like the standard @code{strerror} function, but
|
||||
will never return a @code{NULL} pointer.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# -*- perl -*-
|
||||
|
||||
# Copyright (C) 2001
|
||||
# Free Software Foundation
|
||||
#
|
||||
# This file is part of the libiberty library.
|
||||
# Libiberty is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# Libiberty 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with libiberty; see the file COPYING.LIB. If not,
|
||||
# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# Originally written by DJ Delorie <[email protected]>
|
||||
|
||||
|
||||
|
||||
# This program looks for texinfo snippets in source files and other
|
||||
# files, and builds per-category files with entries sorted in
|
||||
# alphabetical order.
|
||||
|
||||
# The syntax it looks for is lines starting with '@def' in *.c and
|
||||
# other files (see TEXIFILES in Makefile.in). Entries are terminated
|
||||
# at the next @def* (which begins a new entry) or, for C files, a line
|
||||
# that begins with '*/' without leading spaces (this assumes that the
|
||||
# texinfo snippet is within a C-style /* */ comment).
|
||||
|
||||
#
|
||||
|
||||
|
||||
|
||||
if ($ARGV[0] eq "-v") {
|
||||
$verbose = 1;
|
||||
shift;
|
||||
}
|
||||
|
||||
$srcdir = shift;
|
||||
$outfile = shift;
|
||||
|
||||
if ($outfile !~ /\S/ || ! -f "$srcdir/Makefile.in" ) {
|
||||
print STDERR "Usage: gather-docs [-v] srcdir outfile.txi [files with snippets in them ...]\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
$errors = 0;
|
||||
|
||||
for $in (@ARGV) {
|
||||
|
||||
if (!open(IN, "$srcdir/$in")) {
|
||||
print STDERR "Cannot open $srcdir/$in for reading: $!\n";
|
||||
$errors ++;
|
||||
|
||||
} else {
|
||||
$first = 1;
|
||||
$pertinent = 0;
|
||||
$man_mode = 0;
|
||||
$line = 0;
|
||||
|
||||
while (<IN>) {
|
||||
$line ++;
|
||||
$pertinent = 1 if /^\@def[a-z]*[a-wyz] /;
|
||||
$pertinent = 0 if /^\*\//;
|
||||
next unless $pertinent;
|
||||
|
||||
if (/^\@def[a-z]*[a-wyz] /) {
|
||||
|
||||
($name) = m/[^\(]* ([^\( \t\r\n]+) *\(/;
|
||||
$name =~ s/[ ]*$//;
|
||||
$key = $name;
|
||||
$key =~ tr/A-Z/a-z/;
|
||||
$key =~ s/[^a-z0-9]+/ /g;
|
||||
$name{$key} = $node;
|
||||
$lines{$key} = '';
|
||||
$src_file{$key} = $in;
|
||||
$src_line{$key} = $line;
|
||||
print "\nReading $in :" if $verbose && $first;
|
||||
$first = 0;
|
||||
print " $name" if $verbose;
|
||||
$node_lines{$key} .= $_;
|
||||
|
||||
} else {
|
||||
$node_lines{$key} .= $_;
|
||||
}
|
||||
|
||||
$pertinent = 0 if /^\@end def/;
|
||||
}
|
||||
close (IN);
|
||||
}
|
||||
}
|
||||
|
||||
print "\n" if $verbose;
|
||||
exit $errors if $errors;
|
||||
|
||||
if (!open (OUT, "> $outfile")) {
|
||||
print STDERR "Cannot open $outfile for writing: $!\n";
|
||||
$errors ++;
|
||||
next;
|
||||
}
|
||||
print "Writing $outfile\n" if $verbose;
|
||||
|
||||
print OUT "\@c Automatically generated from *.c and others (the comments before\n";
|
||||
print OUT "\@c each entry tell you which file and where in that file). DO NOT EDIT!\n";
|
||||
print OUT "\@c Edit the *.c files, configure with --enable-maintainer-mode,\n";
|
||||
print OUT "\@c and let gather-docs build you a new copy.\n\n";
|
||||
|
||||
for $key (sort keys %name) {
|
||||
print OUT "\@c $src_file{$key}:$src_line{$key}\n";
|
||||
print OUT $node_lines{$key};
|
||||
print OUT "\n";
|
||||
}
|
||||
|
||||
if (! print OUT "\n") {
|
||||
print STDERR "Disk full writing $srcdir/$cat.texi\n";
|
||||
$errors ++;
|
||||
}
|
||||
|
||||
close (OUT);
|
||||
|
||||
exit $errors;
|
||||
@@ -1,324 +0,0 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename libiberty.info
|
||||
@settitle @sc{gnu} libiberty
|
||||
@c %**end of header
|
||||
|
||||
@syncodeindex fn cp
|
||||
@syncodeindex vr cp
|
||||
@syncodeindex pg cp
|
||||
|
||||
@finalout
|
||||
@c %**end of header
|
||||
|
||||
@dircategory GNU libraries
|
||||
@direntry
|
||||
* Libiberty: (libiberty). Library of utility functions which
|
||||
are missing or broken on some systems.
|
||||
@end direntry
|
||||
|
||||
@macro libib
|
||||
@code{libiberty}
|
||||
@end macro
|
||||
|
||||
@c The edition date is written in three locations. Search for 'thedate'.
|
||||
@ifinfo
|
||||
This manual describes the GNU @libib library of utility subroutines.
|
||||
This edition accompanies GCC 3, September 2001.
|
||||
|
||||
Copyright @copyright{} 2001 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, with no Front-Cover Texts, and with no
|
||||
Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled ``GNU Free Documentation License''.
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file through TeX and print the
|
||||
results, provided the printed document carries a 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
|
||||
@end ifinfo
|
||||
|
||||
|
||||
@c The edition date is written in three locations. Search for 'thedate'.
|
||||
@titlepage
|
||||
@title @sc{gnu} libiberty
|
||||
@subtitle September 2001
|
||||
@subtitle for GCC 3
|
||||
@author Phil Edwards et al.
|
||||
@page
|
||||
|
||||
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 2001 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, with no Front-Cover Texts, and with no
|
||||
Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled ``GNU Free Documentation License''.
|
||||
|
||||
@end titlepage
|
||||
@contents
|
||||
@page
|
||||
|
||||
@ifnottex
|
||||
@node Top,Using,,
|
||||
@top Introduction
|
||||
|
||||
The @libib{} library is a collection of subroutines used by various
|
||||
GNU programs. It is available under the Library General Public
|
||||
License; for more information, see @ref{Library Copying}.
|
||||
|
||||
@c The edition date is written in three locations. Search for 'thedate'.
|
||||
This edition accompanies GCC 3, September 2001.
|
||||
|
||||
@end ifnottex
|
||||
|
||||
@menu
|
||||
* Using:: How to use libiberty in your code.
|
||||
|
||||
* Overview:: Overview of available function groups.
|
||||
|
||||
* Functions:: Available functions, macros, and global variables.
|
||||
|
||||
* Obstacks:: Object Stacks.
|
||||
|
||||
* Licenses:: The various licenses under which libiberty sources are
|
||||
distributed.
|
||||
|
||||
* Index:: Index of functions and categories.
|
||||
@end menu
|
||||
|
||||
@node Using
|
||||
@chapter Using
|
||||
@cindex using libiberty
|
||||
@cindex libiberty usage
|
||||
@cindex how to use
|
||||
|
||||
@c THIS SECTION IS CRAP AND NEEDS REWRITING BADLY.
|
||||
|
||||
To date, @libib{} is generally not installed on its own. It has evolved
|
||||
over years but does not have its own version number nor release schedule.
|
||||
|
||||
Possibly the easiest way to use @libib{} in your projects is to drop the
|
||||
@libib{} code into your project's sources, and to build the library along
|
||||
with your own sources; the library would then be linked in at the end. This
|
||||
prevents any possible version mismatches with other copies of libiberty
|
||||
elsewhere on the system.
|
||||
|
||||
Passing @option{--enable-install-libiberty} to the @command{configure}
|
||||
script when building @libib{} causes the header files and archive library
|
||||
to be installed when @kbd{make install} is run. This option also takes
|
||||
an (optional) argument to specify the installation location, in the same
|
||||
manner as @option{--prefix}.
|
||||
|
||||
For your own projects, an approach which offers stability and flexibility
|
||||
is to include @libib{} with your code, but allow the end user to optionally
|
||||
choose to use a previously-installed version instead. In this way the
|
||||
user may choose (for example) to install @libib{} as part of GCC, and use
|
||||
that version for all software built with that compiler. (This approach
|
||||
has proven useful with software using the GNU @code{readline} library.)
|
||||
|
||||
Making use of @libib{} code usually requires that you include one or more
|
||||
header files from the @libib{} distribution. (They will be named as
|
||||
necessary in the function descriptions.) At link time, you will need to
|
||||
add @option{-liberty} to your link command invocation.
|
||||
|
||||
|
||||
@node Overview
|
||||
@chapter Overview
|
||||
|
||||
Functions contained in @libib{} can be divided into three general categories.
|
||||
|
||||
|
||||
@menu
|
||||
* Supplemental Functions:: Providing functions which don't exist
|
||||
on older operating systems.
|
||||
|
||||
* Replacement Functions:: These functions are sometimes buggy or
|
||||
unpredictable on some operating systems.
|
||||
|
||||
* Extensions:: Functions which provide useful extensions
|
||||
or safety wrappers around existing code.
|
||||
@end menu
|
||||
|
||||
@node Supplemental Functions
|
||||
@section Supplemental Functions
|
||||
@cindex supplemental functions
|
||||
@cindex functions, supplemental
|
||||
@cindex functions, missing
|
||||
|
||||
Certain operating systems do not provide functions which have since
|
||||
become standardized, or at least common. For example, the Single
|
||||
Unix Specification Version 2 requires that the @code{basename}
|
||||
function be provided, but an OS which predates that specification
|
||||
might not have this function. This should not prevent well-written
|
||||
code from running on such a system.
|
||||
|
||||
Similarly, some functions exist only among a particular ``flavor''
|
||||
or ``family'' of operating systems. As an example, the @code{bzero}
|
||||
function is often not present on systems outside the BSD-derived
|
||||
family of systems.
|
||||
|
||||
Many such functions are provided in @libib{}. They are quickly
|
||||
listed here with little description, as systems which lack them
|
||||
become less and less common. Each function @var{foo} is implemented
|
||||
in @file{@var{foo}.c} but not declared in any @libib{} header file; more
|
||||
comments and caveats for each function's implementation are often
|
||||
available in the source file. Generally, the function can simply
|
||||
be declared as @code{extern}.
|
||||
|
||||
|
||||
|
||||
@node Replacement Functions
|
||||
@section Replacement Functions
|
||||
@cindex replacement functions
|
||||
@cindex functions, replacement
|
||||
|
||||
Some functions have extremely limited implementations on different
|
||||
platforms. Other functions are tedious to use correctly; for example,
|
||||
proper use of @code{malloc} calls for the return value to be checked and
|
||||
appropriate action taken if memory has been exhausted. A group of
|
||||
``replacement functions'' is available in @libib{} to address these issues
|
||||
for some of the most commonly used subroutines.
|
||||
|
||||
All of these functions are declared in the @file{libiberty.h} header
|
||||
file. Many of the implementations will use preprocessor macros set by
|
||||
GNU Autoconf, if you decide to make use of that program. Some of these
|
||||
functions may call one another.
|
||||
|
||||
|
||||
@menu
|
||||
* Memory Allocation:: Testing and handling failed memory
|
||||
requests automatically.
|
||||
* Exit Handlers:: Calling routines on program exit.
|
||||
* Error Reporting:: Mapping errno and signal numbers to
|
||||
more useful string formats.
|
||||
@end menu
|
||||
|
||||
@node Memory Allocation
|
||||
@subsection Memory Allocation
|
||||
@cindex memory allocation
|
||||
|
||||
The functions beginning with the letter @samp{x} are wrappers around
|
||||
standard functions; the functions provided by the system environment
|
||||
are called and their results checked before the results are passed back
|
||||
to client code. If the standard functions fail, these wrappers will
|
||||
terminate the program. Thus, these versions can be used with impunity.
|
||||
|
||||
|
||||
@node Exit Handlers
|
||||
@subsection Exit Handlers
|
||||
@cindex exit handlers
|
||||
|
||||
The existence and implementation of the @code{atexit} routine varies
|
||||
amongst the flavors of Unix. @libib{} provides an unvarying dependable
|
||||
implementation via @code{xatexit} and @code{xexit}.
|
||||
|
||||
|
||||
@node Error Reporting
|
||||
@subsection Error Reporting
|
||||
@cindex error reporting
|
||||
|
||||
These are a set of routines to facilitate programming with the system
|
||||
@code{errno} interface. The @libib{} source file @file{strerror.c}
|
||||
contains a good deal of documentation for these functions.
|
||||
|
||||
@c signal stuff
|
||||
|
||||
|
||||
@node Extensions
|
||||
@section Extensions
|
||||
@cindex extensions
|
||||
@cindex functions, extension
|
||||
|
||||
@libib{} includes additional functionality above and beyond standard
|
||||
functions, which has proven generically useful in GNU programs, such as
|
||||
obstacks and regex. These functions are often copied from other
|
||||
projects as they gain popularity, and are included here to provide a
|
||||
central location from which to use, maintain, and distribute them.
|
||||
|
||||
@menu
|
||||
* Obstacks:: Stacks of arbitrary objects.
|
||||
@end menu
|
||||
|
||||
@c This is generated from the glibc manual using a make-obstacks-texi.sh
|
||||
@c script of Phil's. Hope it's accurate.
|
||||
@include obstacks.texi
|
||||
|
||||
@node Functions
|
||||
@chapter Function, Variable, and Macro Listing.
|
||||
@include functions.texi
|
||||
|
||||
@node Licenses
|
||||
@appendix Licenses
|
||||
|
||||
@menu
|
||||
|
||||
* Library Copying:: The GNU Library General Public License
|
||||
* BSD:: Regents of the University of California
|
||||
|
||||
@end menu
|
||||
|
||||
@c This takes care of Library Copying. It is the copying-lib.texi from the
|
||||
@c GNU web site, with its @node line altered to make makeinfo shut up.
|
||||
@include copying-lib.texi
|
||||
|
||||
@page
|
||||
@node BSD
|
||||
@appendixsec BSD
|
||||
|
||||
Copyright @copyright{} 1990 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:
|
||||
|
||||
@enumerate
|
||||
|
||||
@item
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
@item
|
||||
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.
|
||||
|
||||
@item
|
||||
[rescinded 22 July 1999]
|
||||
|
||||
@item
|
||||
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.
|
||||
|
||||
@end enumerate
|
||||
|
||||
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.
|
||||
|
||||
@node Index
|
||||
@unnumbered Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@bye
|
||||
|
||||
@@ -1,278 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# -*- perl -*-
|
||||
|
||||
# Copyright (C) 2001
|
||||
# Free Software Foundation
|
||||
#
|
||||
# This file is part of the libiberty library.
|
||||
# Libiberty is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# Libiberty 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with libiberty; see the file COPYING.LIB. If not,
|
||||
# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# Originally written by DJ Delorie <[email protected]>
|
||||
|
||||
|
||||
# This is a trivial script which checks the lists of C and O files in
|
||||
# the Makefile for consistency.
|
||||
|
||||
$mode = shift;
|
||||
$srcdir = ".";
|
||||
|
||||
if ($mode eq "-s") {
|
||||
$srcdir = shift;
|
||||
$mode = shift;
|
||||
}
|
||||
|
||||
&missing() if $mode eq "missing";
|
||||
&undoc() if $mode eq "undoc";
|
||||
&deps() if $mode eq "deps";
|
||||
|
||||
exit 0;
|
||||
|
||||
format STDOUT =
|
||||
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~
|
||||
$out
|
||||
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
|
||||
$out
|
||||
.
|
||||
|
||||
######################################################################
|
||||
|
||||
sub missing {
|
||||
|
||||
opendir(S, $srcdir);
|
||||
while ($f = readdir S) {
|
||||
$have{$f} = 1;
|
||||
}
|
||||
closedir(S);
|
||||
opendir(S, ".");
|
||||
while ($f = readdir S) {
|
||||
$have{$f} = 1;
|
||||
}
|
||||
closedir(S);
|
||||
|
||||
for $a (@ARGV) {
|
||||
$listed{$a} = 1;
|
||||
$have{$a} = 0;
|
||||
}
|
||||
|
||||
for $f (sort keys %have) {
|
||||
next unless $have{$f};
|
||||
if ($f =~ /\.c$/) {
|
||||
print "S $f\n";
|
||||
}
|
||||
}
|
||||
for $f (sort keys %listed) {
|
||||
if ($f =~ /(.*)\.c$/) {
|
||||
$base = $1;
|
||||
if (! $listed{"$base.o"}) {
|
||||
print "O $f\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
|
||||
sub undoc {
|
||||
|
||||
opendir(S, $srcdir);
|
||||
while ($file = readdir S) {
|
||||
if ($file =~ /\.texi$/) {
|
||||
open(T, "$srcdir/$file");
|
||||
while (<T>) {
|
||||
if (/^\@deftype[^\(]* ([^\s\(]+) *\(/) {
|
||||
$documented{$1} = 1;
|
||||
}
|
||||
}
|
||||
close(T);
|
||||
}
|
||||
if ($file =~ /\.c$/) {
|
||||
open(C, "$srcdir/$file");
|
||||
while (<C>) {
|
||||
if (/\@undocumented (\S+)/) {
|
||||
$documented{$1} = 1;
|
||||
}
|
||||
if (/^static /) {
|
||||
if (! /[\(;]/) {
|
||||
s/[\r\n]+$/ /;
|
||||
$_ .= <C>;
|
||||
}
|
||||
while ($_ =~ /\([^\)]*$/) {
|
||||
s/[\r\n]+$/ /;
|
||||
$_ .= <C>;
|
||||
}
|
||||
}
|
||||
s/ VPARAMS([ \(])/$1/;
|
||||
s/PREFIX\(([^\)]*)\)/byte_$1/;
|
||||
if (/^static [^\(]* ([^\s\(]+) *\(.*\)$/) {
|
||||
$documented{$1} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(D);
|
||||
|
||||
# $out = join(' ', sort keys %documented);
|
||||
# write;
|
||||
# print "\n";
|
||||
|
||||
system "etags $srcdir/*.c $srcdir/../include/*.h";
|
||||
open(TAGS, "TAGS");
|
||||
while (<TAGS>) {
|
||||
s/[\r\n]+$//;
|
||||
if (/^\014$/) {
|
||||
$filename = <TAGS>;
|
||||
$filename =~ s/[\r\n]+$//;
|
||||
$filename =~ s/,\d+$//;
|
||||
$filename =~ s@.*[/\\]@@;
|
||||
next;
|
||||
}
|
||||
if ($filename =~ /\.c$/ ) {
|
||||
next unless /^[_a-zA-Z]/;
|
||||
} else {
|
||||
next unless /^\# *define/;
|
||||
s/\# *define *//;
|
||||
}
|
||||
next if $filename =~ /mpw\.c/;
|
||||
|
||||
s/ VPARAMS//;
|
||||
s/ *\177.*//;
|
||||
s/,$//;
|
||||
s/DEFUN\(//;
|
||||
s/\(//;
|
||||
|
||||
next if /^static /;
|
||||
next if /\s/;
|
||||
next if /^_/;
|
||||
next if $documented{$_};
|
||||
next if /_H_?$/;
|
||||
|
||||
if ($seen_in{$_} ne $filename) {
|
||||
$saw{$_} ++;
|
||||
}
|
||||
$seen_in{$_} = $filename;
|
||||
}
|
||||
|
||||
for $k (keys %saw) {
|
||||
delete $saw{$k} if $saw{$k} > 1;
|
||||
}
|
||||
|
||||
for $k (sort keys %saw) {
|
||||
$fromfile{$seen_in{$k}} .= " " if $fromfile{$seen_in{$k}};
|
||||
$fromfile{$seen_in{$k}} .= $k;
|
||||
}
|
||||
|
||||
for $f (sort keys %fromfile) {
|
||||
$out = "$f: $fromfile{$f}";
|
||||
write;
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
|
||||
sub deps_for {
|
||||
my($f) = @_;
|
||||
my(%d);
|
||||
open(F, $f);
|
||||
%d = ();
|
||||
while (<F>) {
|
||||
if (/^#\s*include\s+["<](.*)[">]/) {
|
||||
$d{$1} = 1;
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
return keys %d;
|
||||
}
|
||||
|
||||
sub canonicalize {
|
||||
my ($p) = @_;
|
||||
0 while $p =~ s@/\./@/@g;
|
||||
0 while $p =~ s@^\./@@g;
|
||||
0 while $p =~ s@/[^/]+/\.\./@/@g;
|
||||
return $p;
|
||||
}
|
||||
|
||||
sub locals_first {
|
||||
my ($a,$b) = @_;
|
||||
return -1 if $a eq "config.h";
|
||||
return 1 if $b eq "config.h";
|
||||
return $a cmp $b;
|
||||
}
|
||||
|
||||
sub deps {
|
||||
|
||||
$incdir = shift @ARGV;
|
||||
|
||||
opendir(INC, $incdir);
|
||||
while ($f = readdir INC) {
|
||||
next unless $f =~ /\.h$/;
|
||||
$mine{$f} = "\$(INCDIR)/$f";
|
||||
$deps{$f} = join(' ', &deps_for("$incdir/$f"));
|
||||
}
|
||||
$mine{'config.h'} = "config.h";
|
||||
|
||||
open(IN, "$srcdir/Makefile.in");
|
||||
open(OUT, ">$srcdir/Makefile.tmp");
|
||||
while (<IN>) {
|
||||
last if /remainder of this file/;
|
||||
print OUT;
|
||||
}
|
||||
print OUT "# The dependencies in the remainder of this file are automatically\n";
|
||||
print OUT "# generated by \"make maint-deps\". Manual edits will be lost.\n\n";
|
||||
|
||||
opendir(S, $srcdir);
|
||||
for $f (sort readdir S) {
|
||||
if ($f =~ /\.c$/) {
|
||||
|
||||
%scanned = ();
|
||||
@pending = &deps_for("$srcdir/$f");
|
||||
while (@pending) {
|
||||
@tmp = @pending;
|
||||
@pending = ();
|
||||
for $p (@tmp) {
|
||||
next unless $mine{$p};
|
||||
if (!$scanned{$p}) {
|
||||
push(@pending, split(' ', $deps{$p}));
|
||||
$scanned{$p} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@deps = sort { &locals_first($a,$b) } keys %scanned;
|
||||
$obj = $f;
|
||||
$obj =~ s/\.c$/.o/;
|
||||
$obj = "$obj:";
|
||||
if ($#deps >= 0) {
|
||||
print OUT $obj;
|
||||
$len = length($obj);
|
||||
for $dt (@deps) {
|
||||
$d = $mine{$dt};
|
||||
if ($len + length($d) > 70) {
|
||||
printf OUT " \\\n\t$d";
|
||||
$len = 8 + length($d);
|
||||
} else {
|
||||
print OUT " $d";
|
||||
$len += length($d) + 1;
|
||||
}
|
||||
}
|
||||
print OUT "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(S);
|
||||
close(IN);
|
||||
close(OUT);
|
||||
|
||||
rename("$srcdir/Makefile.tmp", "$srcdir/Makefile.in");
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
/* Utility to pick a temporary filename prefix.
|
||||
Copyright (C) 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the libiberty library.
|
||||
Libiberty is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
Libiberty 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with libiberty; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h> /* May get P_tmpdir. */
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h> /* May get R_OK, etc. on some systems. */
|
||||
#endif
|
||||
|
||||
#ifndef R_OK
|
||||
#define R_OK 4
|
||||
#define W_OK 2
|
||||
#define X_OK 1
|
||||
#endif
|
||||
|
||||
#include "libiberty.h"
|
||||
extern int mkstemps PARAMS ((char *, int));
|
||||
|
||||
/* '/' works just fine on MS-DOS based systems. */
|
||||
#ifndef DIR_SEPARATOR
|
||||
#define DIR_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
/* Name of temporary file.
|
||||
mktemp requires 6 trailing X's. */
|
||||
#define TEMP_FILE "ccXXXXXX"
|
||||
#define TEMP_FILE_LEN (sizeof(TEMP_FILE) - 1)
|
||||
|
||||
/* Subroutine of choose_tmpdir.
|
||||
If BASE is non-NULL, return it.
|
||||
Otherwise it checks if DIR is a usable directory.
|
||||
If success, DIR is returned.
|
||||
Otherwise NULL is returned. */
|
||||
|
||||
static inline const char *try PARAMS ((const char *, const char *));
|
||||
|
||||
static inline const char *
|
||||
try (dir, base)
|
||||
const char *dir, *base;
|
||||
{
|
||||
if (base != 0)
|
||||
return base;
|
||||
if (dir != 0
|
||||
&& access (dir, R_OK | W_OK | X_OK) == 0)
|
||||
return dir;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
|
||||
static const char usrtmp[] =
|
||||
{ DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
|
||||
static const char vartmp[] =
|
||||
{ DIR_SEPARATOR, 'v', 'a', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
|
||||
|
||||
static char *memoized_tmpdir;
|
||||
|
||||
/*
|
||||
|
||||
@deftypefn Replacement char* choose_tmpdir ()
|
||||
|
||||
Returns a pointer to a directory path suitable for creating temporary
|
||||
files in.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
*/
|
||||
|
||||
char *
|
||||
choose_tmpdir ()
|
||||
{
|
||||
const char *base = 0;
|
||||
char *tmpdir;
|
||||
unsigned int len;
|
||||
|
||||
if (memoized_tmpdir)
|
||||
return memoized_tmpdir;
|
||||
|
||||
base = try (getenv ("TMPDIR"), base);
|
||||
base = try (getenv ("TMP"), base);
|
||||
base = try (getenv ("TEMP"), base);
|
||||
|
||||
#ifdef P_tmpdir
|
||||
base = try (P_tmpdir, base);
|
||||
#endif
|
||||
|
||||
/* Try /var/tmp, /usr/tmp, then /tmp. */
|
||||
base = try (vartmp, base);
|
||||
base = try (usrtmp, base);
|
||||
base = try (tmp, base);
|
||||
|
||||
/* If all else fails, use the current directory! */
|
||||
if (base == 0)
|
||||
base = ".";
|
||||
|
||||
/* Append DIR_SEPARATOR to the directory we've chosen
|
||||
and return it. */
|
||||
len = strlen (base);
|
||||
tmpdir = xmalloc (len + 2);
|
||||
strcpy (tmpdir, base);
|
||||
tmpdir[len] = DIR_SEPARATOR;
|
||||
tmpdir[len+1] = '\0';
|
||||
|
||||
memoized_tmpdir = tmpdir;
|
||||
return tmpdir;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@deftypefn Replacement char* make_temp_file (const char *@var{suffix})
|
||||
|
||||
Return a temporary file name (as a string) or @code{NULL} if unable to
|
||||
create one. @var{suffix} is a suffix to append to the file name. The
|
||||
string is @code{malloc}ed, and the temporary file has been created.
|
||||
|
||||
@end deftypefn
|
||||
|
||||
*/
|
||||
|
||||
char *
|
||||
make_temp_file (suffix)
|
||||
const char *suffix;
|
||||
{
|
||||
const char *base = choose_tmpdir ();
|
||||
char *temp_filename;
|
||||
int base_len, suffix_len;
|
||||
int fd;
|
||||
|
||||
if (suffix == 0)
|
||||
suffix = "";
|
||||
|
||||
base_len = strlen (base);
|
||||
suffix_len = strlen (suffix);
|
||||
|
||||
temp_filename = xmalloc (base_len
|
||||
+ TEMP_FILE_LEN
|
||||
+ suffix_len + 1);
|
||||
strcpy (temp_filename, base);
|
||||
strcpy (temp_filename + base_len, TEMP_FILE);
|
||||
strcpy (temp_filename + base_len + TEMP_FILE_LEN, suffix);
|
||||
|
||||
fd = mkstemps (temp_filename, suffix_len);
|
||||
/* If mkstemps failed, then something bad is happening. Maybe we should
|
||||
issue a message about a possible security attack in progress? */
|
||||
if (fd == -1)
|
||||
abort ();
|
||||
/* Similarly if we can not close the file. */
|
||||
if (close (fd))
|
||||
abort ();
|
||||
return temp_filename;
|
||||
}
|
||||
@@ -1,758 +0,0 @@
|
||||
@node Obstacks,Licenses,Functions,Top
|
||||
@chapter Obstacks
|
||||
@cindex obstacks
|
||||
|
||||
An @dfn{obstack} is a pool of memory containing a stack of objects. You
|
||||
can create any number of separate obstacks, and then allocate objects in
|
||||
specified obstacks. Within each obstack, the last object allocated must
|
||||
always be the first one freed, but distinct obstacks are independent of
|
||||
each other.
|
||||
|
||||
Aside from this one constraint of order of freeing, obstacks are totally
|
||||
general: an obstack can contain any number of objects of any size. They
|
||||
are implemented with macros, so allocation is usually very fast as long as
|
||||
the objects are usually small. And the only space overhead per object is
|
||||
the padding needed to start each object on a suitable boundary.
|
||||
|
||||
@menu
|
||||
* Creating Obstacks:: How to declare an obstack in your program.
|
||||
* Preparing for Obstacks:: Preparations needed before you can
|
||||
use obstacks.
|
||||
* Allocation in an Obstack:: Allocating objects in an obstack.
|
||||
* Freeing Obstack Objects:: Freeing objects in an obstack.
|
||||
* Obstack Functions:: The obstack functions are both
|
||||
functions and macros.
|
||||
* Growing Objects:: Making an object bigger by stages.
|
||||
* Extra Fast Growing:: Extra-high-efficiency (though more
|
||||
complicated) growing objects.
|
||||
* Status of an Obstack:: Inquiries about the status of an obstack.
|
||||
* Obstacks Data Alignment:: Controlling alignment of objects in obstacks.
|
||||
* Obstack Chunks:: How obstacks obtain and release chunks;
|
||||
efficiency considerations.
|
||||
* Summary of Obstacks::
|
||||
@end menu
|
||||
|
||||
@node Creating Obstacks
|
||||
@section Creating Obstacks
|
||||
|
||||
The utilities for manipulating obstacks are declared in the header
|
||||
file @file{obstack.h}.
|
||||
@pindex obstack.h
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftp {Data Type} {struct obstack}
|
||||
An obstack is represented by a data structure of type @code{struct
|
||||
obstack}. This structure has a small fixed size; it records the status
|
||||
of the obstack and how to find the space in which objects are allocated.
|
||||
It does not contain any of the objects themselves. You should not try
|
||||
to access the contents of the structure directly; use only the functions
|
||||
described in this chapter.
|
||||
@end deftp
|
||||
|
||||
You can declare variables of type @code{struct obstack} and use them as
|
||||
obstacks, or you can allocate obstacks dynamically like any other kind
|
||||
of object. Dynamic allocation of obstacks allows your program to have a
|
||||
variable number of different stacks. (You can even allocate an
|
||||
obstack structure in another obstack, but this is rarely useful.)
|
||||
|
||||
All the functions that work with obstacks require you to specify which
|
||||
obstack to use. You do this with a pointer of type @code{struct obstack
|
||||
*}. In the following, we often say ``an obstack'' when strictly
|
||||
speaking the object at hand is such a pointer.
|
||||
|
||||
The objects in the obstack are packed into large blocks called
|
||||
@dfn{chunks}. The @code{struct obstack} structure points to a chain of
|
||||
the chunks currently in use.
|
||||
|
||||
The obstack library obtains a new chunk whenever you allocate an object
|
||||
that won't fit in the previous chunk. Since the obstack library manages
|
||||
chunks automatically, you don't need to pay much attention to them, but
|
||||
you do need to supply a function which the obstack library should use to
|
||||
get a chunk. Usually you supply a function which uses @code{malloc}
|
||||
directly or indirectly. You must also supply a function to free a chunk.
|
||||
These matters are described in the following section.
|
||||
|
||||
@node Preparing for Obstacks
|
||||
@section Preparing for Using Obstacks
|
||||
|
||||
Each source file in which you plan to use the obstack functions
|
||||
must include the header file @file{obstack.h}, like this:
|
||||
|
||||
@smallexample
|
||||
#include <obstack.h>
|
||||
@end smallexample
|
||||
|
||||
@findex obstack_chunk_alloc
|
||||
@findex obstack_chunk_free
|
||||
Also, if the source file uses the macro @code{obstack_init}, it must
|
||||
declare or define two functions or macros that will be called by the
|
||||
obstack library. One, @code{obstack_chunk_alloc}, is used to allocate
|
||||
the chunks of memory into which objects are packed. The other,
|
||||
@code{obstack_chunk_free}, is used to return chunks when the objects in
|
||||
them are freed. These macros should appear before any use of obstacks
|
||||
in the source file.
|
||||
|
||||
Usually these are defined to use @code{malloc} via the intermediary
|
||||
@code{xmalloc} (@pxref{Unconstrained Allocation, , , libc, The GNU C Library Reference Manual}). This is done with
|
||||
the following pair of macro definitions:
|
||||
|
||||
@smallexample
|
||||
#define obstack_chunk_alloc xmalloc
|
||||
#define obstack_chunk_free free
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Though the memory you get using obstacks really comes from @code{malloc},
|
||||
using obstacks is faster because @code{malloc} is called less often, for
|
||||
larger blocks of memory. @xref{Obstack Chunks}, for full details.
|
||||
|
||||
At run time, before the program can use a @code{struct obstack} object
|
||||
as an obstack, it must initialize the obstack by calling
|
||||
@code{obstack_init}.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun int obstack_init (struct obstack *@var{obstack-ptr})
|
||||
Initialize obstack @var{obstack-ptr} for allocation of objects. This
|
||||
function calls the obstack's @code{obstack_chunk_alloc} function. If
|
||||
allocation of memory fails, the function pointed to by
|
||||
@code{obstack_alloc_failed_handler} is called. The @code{obstack_init}
|
||||
function always returns 1 (Compatibility notice: Former versions of
|
||||
obstack returned 0 if allocation failed).
|
||||
@end deftypefun
|
||||
|
||||
Here are two examples of how to allocate the space for an obstack and
|
||||
initialize it. First, an obstack that is a static variable:
|
||||
|
||||
@smallexample
|
||||
static struct obstack myobstack;
|
||||
@dots{}
|
||||
obstack_init (&myobstack);
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Second, an obstack that is itself dynamically allocated:
|
||||
|
||||
@smallexample
|
||||
struct obstack *myobstack_ptr
|
||||
= (struct obstack *) xmalloc (sizeof (struct obstack));
|
||||
|
||||
obstack_init (myobstack_ptr);
|
||||
@end smallexample
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@defvar obstack_alloc_failed_handler
|
||||
The value of this variable is a pointer to a function that
|
||||
@code{obstack} uses when @code{obstack_chunk_alloc} fails to allocate
|
||||
memory. The default action is to print a message and abort.
|
||||
You should supply a function that either calls @code{exit}
|
||||
(@pxref{Program Termination, , , libc, The GNU C Library Reference Manual}) or @code{longjmp} (@pxref{Non-Local
|
||||
Exits, , , libc, The GNU C Library Reference Manual}) and doesn't return.
|
||||
|
||||
@smallexample
|
||||
void my_obstack_alloc_failed (void)
|
||||
@dots{}
|
||||
obstack_alloc_failed_handler = &my_obstack_alloc_failed;
|
||||
@end smallexample
|
||||
|
||||
@end defvar
|
||||
|
||||
@node Allocation in an Obstack
|
||||
@section Allocation in an Obstack
|
||||
@cindex allocation (obstacks)
|
||||
|
||||
The most direct way to allocate an object in an obstack is with
|
||||
@code{obstack_alloc}, which is invoked almost like @code{malloc}.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
This allocates an uninitialized block of @var{size} bytes in an obstack
|
||||
and returns its address. Here @var{obstack-ptr} specifies which obstack
|
||||
to allocate the block in; it is the address of the @code{struct obstack}
|
||||
object which represents the obstack. Each obstack function or macro
|
||||
requires you to specify an @var{obstack-ptr} as the first argument.
|
||||
|
||||
This function calls the obstack's @code{obstack_chunk_alloc} function if
|
||||
it needs to allocate a new chunk of memory; it calls
|
||||
@code{obstack_alloc_failed_handler} if allocation of memory by
|
||||
@code{obstack_chunk_alloc} failed.
|
||||
@end deftypefun
|
||||
|
||||
For example, here is a function that allocates a copy of a string @var{str}
|
||||
in a specific obstack, which is in the variable @code{string_obstack}:
|
||||
|
||||
@smallexample
|
||||
struct obstack string_obstack;
|
||||
|
||||
char *
|
||||
copystring (char *string)
|
||||
@{
|
||||
size_t len = strlen (string) + 1;
|
||||
char *s = (char *) obstack_alloc (&string_obstack, len);
|
||||
memcpy (s, string, len);
|
||||
return s;
|
||||
@}
|
||||
@end smallexample
|
||||
|
||||
To allocate a block with specified contents, use the function
|
||||
@code{obstack_copy}, declared like this:
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
This allocates a block and initializes it by copying @var{size}
|
||||
bytes of data starting at @var{address}. It calls
|
||||
@code{obstack_alloc_failed_handler} if allocation of memory by
|
||||
@code{obstack_chunk_alloc} failed.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
Like @code{obstack_copy}, but appends an extra byte containing a null
|
||||
character. This extra byte is not counted in the argument @var{size}.
|
||||
@end deftypefun
|
||||
|
||||
The @code{obstack_copy0} function is convenient for copying a sequence
|
||||
of characters into an obstack as a null-terminated string. Here is an
|
||||
example of its use:
|
||||
|
||||
@smallexample
|
||||
char *
|
||||
obstack_savestring (char *addr, int size)
|
||||
@{
|
||||
return obstack_copy0 (&myobstack, addr, size);
|
||||
@}
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Contrast this with the previous example of @code{savestring} using
|
||||
@code{malloc} (@pxref{Basic Allocation, , , libc, The GNU C Library Reference Manual}).
|
||||
|
||||
@node Freeing Obstack Objects
|
||||
@section Freeing Objects in an Obstack
|
||||
@cindex freeing (obstacks)
|
||||
|
||||
To free an object allocated in an obstack, use the function
|
||||
@code{obstack_free}. Since the obstack is a stack of objects, freeing
|
||||
one object automatically frees all other objects allocated more recently
|
||||
in the same obstack.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_free (struct obstack *@var{obstack-ptr}, void *@var{object})
|
||||
If @var{object} is a null pointer, everything allocated in the obstack
|
||||
is freed. Otherwise, @var{object} must be the address of an object
|
||||
allocated in the obstack. Then @var{object} is freed, along with
|
||||
everything allocated in @var{obstack} since @var{object}.
|
||||
@end deftypefun
|
||||
|
||||
Note that if @var{object} is a null pointer, the result is an
|
||||
uninitialized obstack. To free all memory in an obstack but leave it
|
||||
valid for further allocation, call @code{obstack_free} with the address
|
||||
of the first object allocated on the obstack:
|
||||
|
||||
@smallexample
|
||||
obstack_free (obstack_ptr, first_object_allocated_ptr);
|
||||
@end smallexample
|
||||
|
||||
Recall that the objects in an obstack are grouped into chunks. When all
|
||||
the objects in a chunk become free, the obstack library automatically
|
||||
frees the chunk (@pxref{Preparing for Obstacks}). Then other
|
||||
obstacks, or non-obstack allocation, can reuse the space of the chunk.
|
||||
|
||||
@node Obstack Functions
|
||||
@section Obstack Functions and Macros
|
||||
@cindex macros
|
||||
|
||||
The interfaces for using obstacks may be defined either as functions or
|
||||
as macros, depending on the compiler. The obstack facility works with
|
||||
all C compilers, including both @w{ISO C} and traditional C, but there are
|
||||
precautions you must take if you plan to use compilers other than GNU C.
|
||||
|
||||
If you are using an old-fashioned @w{non-ISO C} compiler, all the obstack
|
||||
``functions'' are actually defined only as macros. You can call these
|
||||
macros like functions, but you cannot use them in any other way (for
|
||||
example, you cannot take their address).
|
||||
|
||||
Calling the macros requires a special precaution: namely, the first
|
||||
operand (the obstack pointer) may not contain any side effects, because
|
||||
it may be computed more than once. For example, if you write this:
|
||||
|
||||
@smallexample
|
||||
obstack_alloc (get_obstack (), 4);
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
you will find that @code{get_obstack} may be called several times.
|
||||
If you use @code{*obstack_list_ptr++} as the obstack pointer argument,
|
||||
you will get very strange results since the incrementation may occur
|
||||
several times.
|
||||
|
||||
In @w{ISO C}, each function has both a macro definition and a function
|
||||
definition. The function definition is used if you take the address of the
|
||||
function without calling it. An ordinary call uses the macro definition by
|
||||
default, but you can request the function definition instead by writing the
|
||||
function name in parentheses, as shown here:
|
||||
|
||||
@smallexample
|
||||
char *x;
|
||||
void *(*funcp) ();
|
||||
/* @r{Use the macro}. */
|
||||
x = (char *) obstack_alloc (obptr, size);
|
||||
/* @r{Call the function}. */
|
||||
x = (char *) (obstack_alloc) (obptr, size);
|
||||
/* @r{Take the address of the function}. */
|
||||
funcp = obstack_alloc;
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This is the same situation that exists in @w{ISO C} for the standard library
|
||||
functions. @xref{Macro Definitions, , , libc, The GNU C Library Reference Manual}.
|
||||
|
||||
@strong{Warning:} When you do use the macros, you must observe the
|
||||
precaution of avoiding side effects in the first operand, even in @w{ISO C}.
|
||||
|
||||
If you use the GNU C compiler, this precaution is not necessary, because
|
||||
various language extensions in GNU C permit defining the macros so as to
|
||||
compute each argument only once.
|
||||
|
||||
@node Growing Objects
|
||||
@section Growing Objects
|
||||
@cindex growing objects (in obstacks)
|
||||
@cindex changing the size of a block (obstacks)
|
||||
|
||||
Because memory in obstack chunks is used sequentially, it is possible to
|
||||
build up an object step by step, adding one or more bytes at a time to the
|
||||
end of the object. With this technique, you do not need to know how much
|
||||
data you will put in the object until you come to the end of it. We call
|
||||
this the technique of @dfn{growing objects}. The special functions
|
||||
for adding data to the growing object are described in this section.
|
||||
|
||||
You don't need to do anything special when you start to grow an object.
|
||||
Using one of the functions to add data to the object automatically
|
||||
starts it. However, it is necessary to say explicitly when the object is
|
||||
finished. This is done with the function @code{obstack_finish}.
|
||||
|
||||
The actual address of the object thus built up is not known until the
|
||||
object is finished. Until then, it always remains possible that you will
|
||||
add so much data that the object must be copied into a new chunk.
|
||||
|
||||
While the obstack is in use for a growing object, you cannot use it for
|
||||
ordinary allocation of another object. If you try to do so, the space
|
||||
already added to the growing object will become part of the other object.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
The most basic function for adding to a growing object is
|
||||
@code{obstack_blank}, which adds space without initializing it.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size})
|
||||
To add a block of initialized space, use @code{obstack_grow}, which is
|
||||
the growing-object analogue of @code{obstack_copy}. It adds @var{size}
|
||||
bytes of data to the growing object, copying the contents from
|
||||
@var{data}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{data}, int @var{size})
|
||||
This is the growing-object analogue of @code{obstack_copy0}. It adds
|
||||
@var{size} bytes copied from @var{data}, followed by an additional null
|
||||
character.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{c})
|
||||
To add one character at a time, use the function @code{obstack_1grow}.
|
||||
It adds a single byte containing @var{c} to the growing object.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_ptr_grow (struct obstack *@var{obstack-ptr}, void *@var{data})
|
||||
Adding the value of a pointer one can use the function
|
||||
@code{obstack_ptr_grow}. It adds @code{sizeof (void *)} bytes
|
||||
containing the value of @var{data}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_int_grow (struct obstack *@var{obstack-ptr}, int @var{data})
|
||||
A single value of type @code{int} can be added by using the
|
||||
@code{obstack_int_grow} function. It adds @code{sizeof (int)} bytes to
|
||||
the growing object and initializes them with the value of @var{data}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_finish (struct obstack *@var{obstack-ptr})
|
||||
When you are finished growing the object, use the function
|
||||
@code{obstack_finish} to close it off and return its final address.
|
||||
|
||||
Once you have finished the object, the obstack is available for ordinary
|
||||
allocation or for growing another object.
|
||||
|
||||
This function can return a null pointer under the same conditions as
|
||||
@code{obstack_alloc} (@pxref{Allocation in an Obstack}).
|
||||
@end deftypefun
|
||||
|
||||
When you build an object by growing it, you will probably need to know
|
||||
afterward how long it became. You need not keep track of this as you grow
|
||||
the object, because you can find out the length from the obstack just
|
||||
before finishing the object with the function @code{obstack_object_size},
|
||||
declared as follows:
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr})
|
||||
This function returns the current size of the growing object, in bytes.
|
||||
Remember to call this function @emph{before} finishing the object.
|
||||
After it is finished, @code{obstack_object_size} will return zero.
|
||||
@end deftypefun
|
||||
|
||||
If you have started growing an object and wish to cancel it, you should
|
||||
finish it and then free it, like this:
|
||||
|
||||
@smallexample
|
||||
obstack_free (obstack_ptr, obstack_finish (obstack_ptr));
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
This has no effect if no object was growing.
|
||||
|
||||
@cindex shrinking objects
|
||||
You can use @code{obstack_blank} with a negative size argument to make
|
||||
the current object smaller. Just don't try to shrink it beyond zero
|
||||
length---there's no telling what will happen if you do that.
|
||||
|
||||
@node Extra Fast Growing
|
||||
@section Extra Fast Growing Objects
|
||||
@cindex efficiency and obstacks
|
||||
|
||||
The usual functions for growing objects incur overhead for checking
|
||||
whether there is room for the new growth in the current chunk. If you
|
||||
are frequently constructing objects in small steps of growth, this
|
||||
overhead can be significant.
|
||||
|
||||
You can reduce the overhead by using special ``fast growth''
|
||||
functions that grow the object without checking. In order to have a
|
||||
robust program, you must do the checking yourself. If you do this checking
|
||||
in the simplest way each time you are about to add data to the object, you
|
||||
have not saved anything, because that is what the ordinary growth
|
||||
functions do. But if you can arrange to check less often, or check
|
||||
more efficiently, then you make the program faster.
|
||||
|
||||
The function @code{obstack_room} returns the amount of room available
|
||||
in the current chunk. It is declared as follows:
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun int obstack_room (struct obstack *@var{obstack-ptr})
|
||||
This returns the number of bytes that can be added safely to the current
|
||||
growing object (or to an object about to be started) in obstack
|
||||
@var{obstack} using the fast growth functions.
|
||||
@end deftypefun
|
||||
|
||||
While you know there is room, you can use these fast growth functions
|
||||
for adding data to a growing object:
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{c})
|
||||
The function @code{obstack_1grow_fast} adds one byte containing the
|
||||
character @var{c} to the growing object in obstack @var{obstack-ptr}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_ptr_grow_fast (struct obstack *@var{obstack-ptr}, void *@var{data})
|
||||
The function @code{obstack_ptr_grow_fast} adds @code{sizeof (void *)}
|
||||
bytes containing the value of @var{data} to the growing object in
|
||||
obstack @var{obstack-ptr}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_int_grow_fast (struct obstack *@var{obstack-ptr}, int @var{data})
|
||||
The function @code{obstack_int_grow_fast} adds @code{sizeof (int)} bytes
|
||||
containing the value of @var{data} to the growing object in obstack
|
||||
@var{obstack-ptr}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
The function @code{obstack_blank_fast} adds @var{size} bytes to the
|
||||
growing object in obstack @var{obstack-ptr} without initializing them.
|
||||
@end deftypefun
|
||||
|
||||
When you check for space using @code{obstack_room} and there is not
|
||||
enough room for what you want to add, the fast growth functions
|
||||
are not safe. In this case, simply use the corresponding ordinary
|
||||
growth function instead. Very soon this will copy the object to a
|
||||
new chunk; then there will be lots of room available again.
|
||||
|
||||
So, each time you use an ordinary growth function, check afterward for
|
||||
sufficient space using @code{obstack_room}. Once the object is copied
|
||||
to a new chunk, there will be plenty of space again, so the program will
|
||||
start using the fast growth functions again.
|
||||
|
||||
Here is an example:
|
||||
|
||||
@smallexample
|
||||
@group
|
||||
void
|
||||
add_string (struct obstack *obstack, const char *ptr, int len)
|
||||
@{
|
||||
while (len > 0)
|
||||
@{
|
||||
int room = obstack_room (obstack);
|
||||
if (room == 0)
|
||||
@{
|
||||
/* @r{Not enough room. Add one character slowly,}
|
||||
@r{which may copy to a new chunk and make room.} */
|
||||
obstack_1grow (obstack, *ptr++);
|
||||
len--;
|
||||
@}
|
||||
else
|
||||
@{
|
||||
if (room > len)
|
||||
room = len;
|
||||
/* @r{Add fast as much as we have room for.} */
|
||||
len -= room;
|
||||
while (room-- > 0)
|
||||
obstack_1grow_fast (obstack, *ptr++);
|
||||
@}
|
||||
@}
|
||||
@}
|
||||
@end group
|
||||
@end smallexample
|
||||
|
||||
@node Status of an Obstack
|
||||
@section Status of an Obstack
|
||||
@cindex obstack status
|
||||
@cindex status of obstack
|
||||
|
||||
Here are functions that provide information on the current status of
|
||||
allocation in an obstack. You can use them to learn about an object while
|
||||
still growing it.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_base (struct obstack *@var{obstack-ptr})
|
||||
This function returns the tentative address of the beginning of the
|
||||
currently growing object in @var{obstack-ptr}. If you finish the object
|
||||
immediately, it will have that address. If you make it larger first, it
|
||||
may outgrow the current chunk---then its address will change!
|
||||
|
||||
If no object is growing, this value says where the next object you
|
||||
allocate will start (once again assuming it fits in the current
|
||||
chunk).
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun {void *} obstack_next_free (struct obstack *@var{obstack-ptr})
|
||||
This function returns the address of the first free byte in the current
|
||||
chunk of obstack @var{obstack-ptr}. This is the end of the currently
|
||||
growing object. If no object is growing, @code{obstack_next_free}
|
||||
returns the same value as @code{obstack_base}.
|
||||
@end deftypefun
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefun int obstack_object_size (struct obstack *@var{obstack-ptr})
|
||||
This function returns the size in bytes of the currently growing object.
|
||||
This is equivalent to
|
||||
|
||||
@smallexample
|
||||
obstack_next_free (@var{obstack-ptr}) - obstack_base (@var{obstack-ptr})
|
||||
@end smallexample
|
||||
@end deftypefun
|
||||
|
||||
@node Obstacks Data Alignment
|
||||
@section Alignment of Data in Obstacks
|
||||
@cindex alignment (in obstacks)
|
||||
|
||||
Each obstack has an @dfn{alignment boundary}; each object allocated in
|
||||
the obstack automatically starts on an address that is a multiple of the
|
||||
specified boundary. By default, this boundary is 4 bytes.
|
||||
|
||||
To access an obstack's alignment boundary, use the macro
|
||||
@code{obstack_alignment_mask}, whose function prototype looks like
|
||||
this:
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefn Macro int obstack_alignment_mask (struct obstack *@var{obstack-ptr})
|
||||
The value is a bit mask; a bit that is 1 indicates that the corresponding
|
||||
bit in the address of an object should be 0. The mask value should be one
|
||||
less than a power of 2; the effect is that all object addresses are
|
||||
multiples of that power of 2. The default value of the mask is 3, so that
|
||||
addresses are multiples of 4. A mask value of 0 means an object can start
|
||||
on any multiple of 1 (that is, no alignment is required).
|
||||
|
||||
The expansion of the macro @code{obstack_alignment_mask} is an lvalue,
|
||||
so you can alter the mask by assignment. For example, this statement:
|
||||
|
||||
@smallexample
|
||||
obstack_alignment_mask (obstack_ptr) = 0;
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
has the effect of turning off alignment processing in the specified obstack.
|
||||
@end deftypefn
|
||||
|
||||
Note that a change in alignment mask does not take effect until
|
||||
@emph{after} the next time an object is allocated or finished in the
|
||||
obstack. If you are not growing an object, you can make the new
|
||||
alignment mask take effect immediately by calling @code{obstack_finish}.
|
||||
This will finish a zero-length object and then do proper alignment for
|
||||
the next object.
|
||||
|
||||
@node Obstack Chunks
|
||||
@section Obstack Chunks
|
||||
@cindex efficiency of chunks
|
||||
@cindex chunks
|
||||
|
||||
Obstacks work by allocating space for themselves in large chunks, and
|
||||
then parceling out space in the chunks to satisfy your requests. Chunks
|
||||
are normally 4096 bytes long unless you specify a different chunk size.
|
||||
The chunk size includes 8 bytes of overhead that are not actually used
|
||||
for storing objects. Regardless of the specified size, longer chunks
|
||||
will be allocated when necessary for long objects.
|
||||
|
||||
The obstack library allocates chunks by calling the function
|
||||
@code{obstack_chunk_alloc}, which you must define. When a chunk is no
|
||||
longer needed because you have freed all the objects in it, the obstack
|
||||
library frees the chunk by calling @code{obstack_chunk_free}, which you
|
||||
must also define.
|
||||
|
||||
These two must be defined (as macros) or declared (as functions) in each
|
||||
source file that uses @code{obstack_init} (@pxref{Creating Obstacks}).
|
||||
Most often they are defined as macros like this:
|
||||
|
||||
@smallexample
|
||||
#define obstack_chunk_alloc malloc
|
||||
#define obstack_chunk_free free
|
||||
@end smallexample
|
||||
|
||||
Note that these are simple macros (no arguments). Macro definitions with
|
||||
arguments will not work! It is necessary that @code{obstack_chunk_alloc}
|
||||
or @code{obstack_chunk_free}, alone, expand into a function name if it is
|
||||
not itself a function name.
|
||||
|
||||
If you allocate chunks with @code{malloc}, the chunk size should be a
|
||||
power of 2. The default chunk size, 4096, was chosen because it is long
|
||||
enough to satisfy many typical requests on the obstack yet short enough
|
||||
not to waste too much memory in the portion of the last chunk not yet used.
|
||||
|
||||
@comment obstack.h
|
||||
@comment GNU
|
||||
@deftypefn Macro int obstack_chunk_size (struct obstack *@var{obstack-ptr})
|
||||
This returns the chunk size of the given obstack.
|
||||
@end deftypefn
|
||||
|
||||
Since this macro expands to an lvalue, you can specify a new chunk size by
|
||||
assigning it a new value. Doing so does not affect the chunks already
|
||||
allocated, but will change the size of chunks allocated for that particular
|
||||
obstack in the future. It is unlikely to be useful to make the chunk size
|
||||
smaller, but making it larger might improve efficiency if you are
|
||||
allocating many objects whose size is comparable to the chunk size. Here
|
||||
is how to do so cleanly:
|
||||
|
||||
@smallexample
|
||||
if (obstack_chunk_size (obstack_ptr) < @var{new-chunk-size})
|
||||
obstack_chunk_size (obstack_ptr) = @var{new-chunk-size};
|
||||
@end smallexample
|
||||
|
||||
@node Summary of Obstacks
|
||||
@section Summary of Obstack Functions
|
||||
|
||||
Here is a summary of all the functions associated with obstacks. Each
|
||||
takes the address of an obstack (@code{struct obstack *}) as its first
|
||||
argument.
|
||||
|
||||
@table @code
|
||||
@item void obstack_init (struct obstack *@var{obstack-ptr})
|
||||
Initialize use of an obstack. @xref{Creating Obstacks}.
|
||||
|
||||
@item void *obstack_alloc (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
Allocate an object of @var{size} uninitialized bytes.
|
||||
@xref{Allocation in an Obstack}.
|
||||
|
||||
@item void *obstack_copy (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
Allocate an object of @var{size} bytes, with contents copied from
|
||||
@var{address}. @xref{Allocation in an Obstack}.
|
||||
|
||||
@item void *obstack_copy0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
Allocate an object of @var{size}+1 bytes, with @var{size} of them copied
|
||||
from @var{address}, followed by a null character at the end.
|
||||
@xref{Allocation in an Obstack}.
|
||||
|
||||
@item void obstack_free (struct obstack *@var{obstack-ptr}, void *@var{object})
|
||||
Free @var{object} (and everything allocated in the specified obstack
|
||||
more recently than @var{object}). @xref{Freeing Obstack Objects}.
|
||||
|
||||
@item void obstack_blank (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
Add @var{size} uninitialized bytes to a growing object.
|
||||
@xref{Growing Objects}.
|
||||
|
||||
@item void obstack_grow (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
Add @var{size} bytes, copied from @var{address}, to a growing object.
|
||||
@xref{Growing Objects}.
|
||||
|
||||
@item void obstack_grow0 (struct obstack *@var{obstack-ptr}, void *@var{address}, int @var{size})
|
||||
Add @var{size} bytes, copied from @var{address}, to a growing object,
|
||||
and then add another byte containing a null character. @xref{Growing
|
||||
Objects}.
|
||||
|
||||
@item void obstack_1grow (struct obstack *@var{obstack-ptr}, char @var{data-char})
|
||||
Add one byte containing @var{data-char} to a growing object.
|
||||
@xref{Growing Objects}.
|
||||
|
||||
@item void *obstack_finish (struct obstack *@var{obstack-ptr})
|
||||
Finalize the object that is growing and return its permanent address.
|
||||
@xref{Growing Objects}.
|
||||
|
||||
@item int obstack_object_size (struct obstack *@var{obstack-ptr})
|
||||
Get the current size of the currently growing object. @xref{Growing
|
||||
Objects}.
|
||||
|
||||
@item void obstack_blank_fast (struct obstack *@var{obstack-ptr}, int @var{size})
|
||||
Add @var{size} uninitialized bytes to a growing object without checking
|
||||
that there is enough room. @xref{Extra Fast Growing}.
|
||||
|
||||
@item void obstack_1grow_fast (struct obstack *@var{obstack-ptr}, char @var{data-char})
|
||||
Add one byte containing @var{data-char} to a growing object without
|
||||
checking that there is enough room. @xref{Extra Fast Growing}.
|
||||
|
||||
@item int obstack_room (struct obstack *@var{obstack-ptr})
|
||||
Get the amount of room now available for growing the current object.
|
||||
@xref{Extra Fast Growing}.
|
||||
|
||||
@item int obstack_alignment_mask (struct obstack *@var{obstack-ptr})
|
||||
The mask used for aligning the beginning of an object. This is an
|
||||
lvalue. @xref{Obstacks Data Alignment}.
|
||||
|
||||
@item int obstack_chunk_size (struct obstack *@var{obstack-ptr})
|
||||
The size for allocating chunks. This is an lvalue. @xref{Obstack Chunks}.
|
||||
|
||||
@item void *obstack_base (struct obstack *@var{obstack-ptr})
|
||||
Tentative starting address of the currently growing object.
|
||||
@xref{Status of an Obstack}.
|
||||
|
||||
@item void *obstack_next_free (struct obstack *@var{obstack-ptr})
|
||||
Address just after the end of the currently growing object.
|
||||
@xref{Status of an Obstack}.
|
||||
@end table
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,166 +0,0 @@
|
||||
/* ternary.c - Ternary Search Trees
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
Contributed by Daniel Berlin (dan@cgsoftware.com)
|
||||
|
||||
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. */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "libiberty.h"
|
||||
#include "ternary.h"
|
||||
|
||||
/* Non-recursive so we don't waste stack space/time on large
|
||||
insertions. */
|
||||
|
||||
PTR
|
||||
ternary_insert (root, s, data, replace)
|
||||
ternary_tree *root;
|
||||
const char *s;
|
||||
PTR data;
|
||||
int replace;
|
||||
{
|
||||
int diff;
|
||||
ternary_tree curr, *pcurr;
|
||||
|
||||
/* Start at the root. */
|
||||
pcurr = root;
|
||||
/* Loop until we find the right position */
|
||||
while ((curr = *pcurr))
|
||||
{
|
||||
/* Calculate the difference */
|
||||
diff = *s - curr->splitchar;
|
||||
/* Handle current char equal to node splitchar */
|
||||
if (diff == 0)
|
||||
{
|
||||
/* Handle the case of a string we already have */
|
||||
if (*s++ == 0)
|
||||
{
|
||||
if (replace)
|
||||
curr->eqkid = (ternary_tree) data;
|
||||
return (PTR) curr->eqkid;
|
||||
}
|
||||
pcurr = &(curr->eqkid);
|
||||
}
|
||||
/* Handle current char less than node splitchar */
|
||||
else if (diff < 0)
|
||||
{
|
||||
pcurr = &(curr->lokid);
|
||||
}
|
||||
/* Handle current char greater than node splitchar */
|
||||
else
|
||||
{
|
||||
pcurr = &(curr->hikid);
|
||||
}
|
||||
}
|
||||
/* It's not a duplicate string, and we should insert what's left of
|
||||
the string, into the tree rooted at curr */
|
||||
for (;;)
|
||||
{
|
||||
/* Allocate the memory for the node, and fill it in */
|
||||
*pcurr = (ternary_tree) xmalloc (sizeof (ternary_node));
|
||||
curr = *pcurr;
|
||||
curr->splitchar = *s;
|
||||
curr->lokid = curr->hikid = curr->eqkid = 0;
|
||||
|
||||
/* Place nodes until we hit the end of the string.
|
||||
When we hit it, place the data in the right place, and
|
||||
return.
|
||||
*/
|
||||
if (*s++ == 0)
|
||||
{
|
||||
curr->eqkid = (ternary_tree) data;
|
||||
return data;
|
||||
}
|
||||
pcurr = &(curr->eqkid);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free the ternary search tree rooted at p. */
|
||||
void
|
||||
ternary_cleanup (p)
|
||||
ternary_tree p;
|
||||
{
|
||||
if (p)
|
||||
{
|
||||
ternary_cleanup (p->lokid);
|
||||
if (p->splitchar)
|
||||
ternary_cleanup (p->eqkid);
|
||||
ternary_cleanup (p->hikid);
|
||||
free (p);
|
||||
}
|
||||
}
|
||||
|
||||
/* Non-recursive find of a string in the ternary tree */
|
||||
PTR
|
||||
ternary_search (p, s)
|
||||
const ternary_node *p;
|
||||
const char *s;
|
||||
{
|
||||
const ternary_node *curr;
|
||||
int diff, spchar;
|
||||
spchar = *s;
|
||||
curr = p;
|
||||
/* Loop while we haven't hit a NULL node or returned */
|
||||
while (curr)
|
||||
{
|
||||
/* Calculate the difference */
|
||||
diff = spchar - curr->splitchar;
|
||||
/* Handle the equal case */
|
||||
if (diff == 0)
|
||||
{
|
||||
if (spchar == 0)
|
||||
return (PTR) curr->eqkid;
|
||||
spchar = *++s;
|
||||
curr = curr->eqkid;
|
||||
}
|
||||
/* Handle the less than case */
|
||||
else if (diff < 0)
|
||||
curr = curr->lokid;
|
||||
/* All that's left is greater than */
|
||||
else
|
||||
curr = curr->hikid;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* For those who care, the recursive version of the search. Useful if
|
||||
you want a starting point for pmsearch or nearsearch. */
|
||||
static PTR
|
||||
ternary_recursivesearch (p, s)
|
||||
const ternary_node *p;
|
||||
const char *s;
|
||||
{
|
||||
if (!p)
|
||||
return 0;
|
||||
if (*s < p->splitchar)
|
||||
return ternary_recursivesearch (p->lokid, s);
|
||||
else if (*s > p->splitchar)
|
||||
return ternary_recursivesearch (p->hikid, s);
|
||||
else
|
||||
{
|
||||
if (*s == 0)
|
||||
return (PTR) p->eqkid;
|
||||
return ternary_recursivesearch (p->eqkid, ++s);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,651 +0,0 @@
|
||||
#### This script is meant to be sourced by ltconfig.
|
||||
|
||||
# ltcf-gcj.sh - Create a GCJ compiler specific configuration
|
||||
#
|
||||
# Copyright (C) 1996-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
# Originally by Gordon Matzigkeit <[email protected]>, 1996
|
||||
#
|
||||
# Original GCJ support by:
|
||||
# Alexandre Oliva <[email protected]>
|
||||
#
|
||||
# This file 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.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Source file extension for Java test sources.
|
||||
ac_ext=java
|
||||
|
||||
# Object file extension for compiled Java test sources.
|
||||
objext=o
|
||||
|
||||
# Code to be used in simple compile tests
|
||||
lt_simple_compile_test_code="class foo {}"
|
||||
|
||||
# Code to be used in simple link tests
|
||||
lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }'
|
||||
|
||||
## Linker Characteristics
|
||||
case $host_os in
|
||||
cygwin* | mingw*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$with_gcc" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
# If archive_cmds runs LD, not CC, wlarc should be empty
|
||||
wlarc='${wl}'
|
||||
|
||||
# See if GNU ld supports shared libraries.
|
||||
case $host_os in
|
||||
aix3* | aix4* | aix5*)
|
||||
# On AIX/PPC, the GNU linker is very broken
|
||||
if test "$host_cpu" != ia64; then
|
||||
ld_shlibs=no
|
||||
cat <<EOF 1>&2
|
||||
|
||||
*** Warning: the GNU linker, at least up to release 2.9.1, is reported
|
||||
*** to be unable to reliably create shared libraries on AIX.
|
||||
*** Therefore, libtool is disabling shared libraries support. If you
|
||||
*** really care for shared libraries, you may want to modify your PATH
|
||||
*** so that a non-GNU linker is found, and then restart.
|
||||
|
||||
EOF
|
||||
fi
|
||||
;;
|
||||
|
||||
amigaos*)
|
||||
archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
|
||||
# Samuel A. Falvo II <[email protected]> reports
|
||||
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||
# to version 4, is to share data among multiple programs linked
|
||||
# with the same dynamic library. Since this doesn't match the
|
||||
# behavior of shared libraries on other platforms, we can use
|
||||
# them.
|
||||
ld_shlibs=no
|
||||
;;
|
||||
|
||||
beos*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
allow_undefined_flag=unsupported
|
||||
# Joseph Beckenbach <[email protected]> says some releases of gcc
|
||||
# support --undefined. This deserves some investigation. FIXME
|
||||
archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
|
||||
cygwin* | mingw*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
allow_undefined_flag=unsupported
|
||||
always_export_symbols=yes
|
||||
|
||||
extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
|
||||
sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~
|
||||
test -f $output_objdir/impgen.exe || (cd $output_objdir && \
|
||||
if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
|
||||
else $CC -o impgen impgen.c ; fi)~
|
||||
$output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
|
||||
|
||||
old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
|
||||
|
||||
# cygwin and mingw dlls have different entry points and sets of symbols
|
||||
# to exclude.
|
||||
# FIXME: what about values for MSVC?
|
||||
dll_entry=__cygwin_dll_entry@12
|
||||
dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
|
||||
case $host_os in
|
||||
mingw*)
|
||||
# mingw values
|
||||
dll_entry=_DllMainCRTStartup@12
|
||||
dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
|
||||
;;
|
||||
esac
|
||||
|
||||
# mingw and cygwin differ, and it's simplest to just exclude the union
|
||||
# of the two symbol sets.
|
||||
dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
|
||||
|
||||
# recent cygwin and mingw systems supply a stub DllMain which the user
|
||||
# can override, but on older systems we have to supply one (in ltdll.c)
|
||||
if test "x$lt_cv_need_dllmain" = "xyes"; then
|
||||
ltdll_obj='$output_objdir/$soname-ltdll.'"$objext "
|
||||
ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~
|
||||
test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
|
||||
else
|
||||
ltdll_obj=
|
||||
ltdll_cmds=
|
||||
fi
|
||||
|
||||
# Extract the symbol export list from an `--export-all' def file,
|
||||
# then regenerate the def file from the symbol export list, so that
|
||||
# the compiled dll only exports the symbol export list.
|
||||
# Be careful not to strip the DATA tag left be newer dlltools.
|
||||
export_symbols_cmds="$ltdll_cmds"'
|
||||
$DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
|
||||
sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
|
||||
|
||||
# If the export-symbols file already is a .def file (1st line
|
||||
# is EXPORTS), use it as is.
|
||||
# If DATA tags from a recent dlltool are present, honour them!
|
||||
archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
|
||||
cp $export_symbols $output_objdir/$soname-def;
|
||||
else
|
||||
echo EXPORTS > $output_objdir/$soname-def;
|
||||
_lt_hint=1;
|
||||
cat $export_symbols | while read symbol; do
|
||||
set dummy \$symbol;
|
||||
case \[$]# in
|
||||
2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
|
||||
*) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
|
||||
esac;
|
||||
_lt_hint=`expr 1 + \$_lt_hint`;
|
||||
done;
|
||||
fi~
|
||||
'"$ltdll_cmds"'
|
||||
$CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
|
||||
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
|
||||
$CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
|
||||
$DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
|
||||
$CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
|
||||
;;
|
||||
|
||||
netbsd*)
|
||||
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
|
||||
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
|
||||
wlarc=
|
||||
else
|
||||
archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
fi
|
||||
;;
|
||||
|
||||
solaris* | sysv5*)
|
||||
if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
cat <<EOF 1>&2
|
||||
|
||||
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
|
||||
*** create shared libraries on Solaris systems. Therefore, libtool
|
||||
*** is disabling shared libraries support. We urge you to upgrade GNU
|
||||
*** binutils to release 2.9.1 or newer. Another option is to modify
|
||||
*** your PATH or compiler configuration so that the native linker is
|
||||
*** used, and then restart.
|
||||
|
||||
EOF
|
||||
elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
|
||||
sunos4*)
|
||||
archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
|
||||
wlarc=
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "$ld_shlibs" = yes; then
|
||||
runpath_var=LD_RUN_PATH
|
||||
hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
|
||||
export_dynamic_flag_spec='${wl}--export-dynamic'
|
||||
case $host_os in
|
||||
cygwin* | mingw*)
|
||||
# dlltool doesn't understand --whole-archive et. al.
|
||||
whole_archive_flag_spec=
|
||||
;;
|
||||
*)
|
||||
# ancient GNU ld didn't support --whole-archive et. al.
|
||||
if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
|
||||
whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
|
||||
else
|
||||
whole_archive_flag_spec=
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
# PORTME fill in a description of your system's linker (not GNU ld)
|
||||
case $host_os in
|
||||
aix3*)
|
||||
allow_undefined_flag=unsupported
|
||||
always_export_symbols=yes
|
||||
archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$with_gcc" = yes && test -z "$link_static_flag"; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
|
||||
aix4* | aix5*)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
link_all_deplibs=yes
|
||||
# When large executables or shared objects are built, AIX ld can
|
||||
# have problems creating the table of contents. If linking a library
|
||||
# or program results in "error TOC overflow" add -mminimal-toc to
|
||||
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
|
||||
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
|
||||
if test "$with_gcc" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
# We only want to do this on AIX 4.2 and lower, the check
|
||||
# below for broken collect2 doesn't work under 4.3+
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
hardcode_direct=yes
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
# It fails to find uninstalled libraries when the uninstalled
|
||||
# path is not listed in the libpath. Setting hardcode_minus_L
|
||||
# to unsupported forces relinking
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
esac
|
||||
shared_flag='-shared'
|
||||
else
|
||||
# not using gcc
|
||||
if test "$host_cpu" = ia64; then
|
||||
shared_flag='${wl}-G'
|
||||
else
|
||||
shared_flag='${wl}-bM:SRE'
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
if test $with_gnu_ld = no; then
|
||||
exp_sym_flag='-Bexport'
|
||||
no_entry_flag=""
|
||||
fi
|
||||
else
|
||||
# Test if we are trying to use run time linking, or normal AIX style linking.
|
||||
# If -brtl is somewhere in LDFLAGS, we need to do run time linking.
|
||||
aix_use_runtimelinking=no
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
exp_sym_flag='-bexport'
|
||||
no_entry_flag='-bnoentry'
|
||||
fi
|
||||
# -bexpall does not export symbols beginning with underscore (_)
|
||||
always_export_symbols=yes
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
# Warning - without using the other run time loading flags (-brtl), -berok will
|
||||
# link without error, but may produce a broken library.
|
||||
allow_undefined_flag=' ${wl}-berok'
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
if test $with_gnu_ld = no; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
allow_undefined_flag="-z nodefs"
|
||||
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
|
||||
fi
|
||||
else
|
||||
allow_undefined_flag=' ${wl}-berok'
|
||||
# -bexpall does not export symbols beginning with underscore (_)
|
||||
always_export_symbols=yes
|
||||
# Exported symbols can be pulled into shared objects from archives
|
||||
whole_archive_flag_spec=' '
|
||||
build_libtool_need_lc=yes
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
# This is similar to how AIX traditionally builds it's shared libraries.
|
||||
archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
amigaos*)
|
||||
archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# see comment about different semantics on the GNU ld section
|
||||
ld_shlibs=no
|
||||
;;
|
||||
|
||||
cygwin* | mingw*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
allow_undefined_flag=unsupported
|
||||
# Tell ltmain to make .lib files, not .a files.
|
||||
libext=lib
|
||||
# FIXME: Setting linknames here is a bad hack.
|
||||
archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
|
||||
# The linker will automatically build a .lib file if we build a DLL.
|
||||
old_archive_from_new_cmds='true'
|
||||
# FIXME: Should let the user specify the lib program.
|
||||
old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
|
||||
fix_srcfile_path='`cygpath -w "$srcfile"`'
|
||||
;;
|
||||
|
||||
freebsd1*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
|
||||
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
|
||||
# support. Future versions do this automatically, but an explicit c++rt0.o
|
||||
# does not break anything, and helps significantly (at the cost of a little
|
||||
# extra space).
|
||||
freebsd2.2*)
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
|
||||
freebsd2*)
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
|
||||
freebsd*)
|
||||
archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
case $host_os in
|
||||
hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
|
||||
*) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
|
||||
esac
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes # Not in the search PATH, but as the default
|
||||
# location of the library.
|
||||
export_dynamic_flag_spec='${wl}-E'
|
||||
;;
|
||||
|
||||
irix5* | irix6*)
|
||||
if test "$with_gcc" = yes; then
|
||||
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
|
||||
else
|
||||
archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
|
||||
fi
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
link_all_deplibs=yes
|
||||
;;
|
||||
|
||||
netbsd*)
|
||||
if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
|
||||
else
|
||||
archive_cmds='$LD -shared -nodefaultlibs -o $lib $libobjs $deplibs $linker_flags' # ELF
|
||||
fi
|
||||
hardcode_libdir_flag_spec='${wl}-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
openbsd*)
|
||||
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
allow_undefined_flag=unsupported
|
||||
archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
|
||||
old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
|
||||
;;
|
||||
|
||||
osf3*)
|
||||
if test "$with_gcc" = yes; then
|
||||
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
|
||||
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
|
||||
else
|
||||
allow_undefined_flag=' -expect_unresolved \*'
|
||||
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
|
||||
fi
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
|
||||
osf4* | osf5*) # as osf3* with the addition of -msym flag
|
||||
if test "$with_gcc" = yes; then
|
||||
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
|
||||
archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib'
|
||||
else
|
||||
allow_undefined_flag=' -expect_unresolved \*'
|
||||
archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib'
|
||||
fi
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
|
||||
sco3.2v5*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_shlibpath_var=no
|
||||
runpath_var=LD_RUN_PATH
|
||||
hardcode_runpath_var=yes
|
||||
;;
|
||||
|
||||
solaris*)
|
||||
no_undefined_flag=' ${wl}-z ${wl}defs'
|
||||
archive_cmds='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib'
|
||||
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
|
||||
$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp'
|
||||
|
||||
# Commands to make compiler produce verbose output that lists
|
||||
# what "hidden" libraries, object files and flags are used when
|
||||
# linking a shared library.
|
||||
output_verbose_link_cmds="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep \"\-L\""
|
||||
|
||||
hardcode_libdir_flag_spec='${wl}-R $wl$libdir'
|
||||
hardcode_shlibpath_var=no
|
||||
case $host_os in
|
||||
solaris2.[0-5] | solaris2.[0-5].*) ;;
|
||||
*) # Supported since Solaris 2.6 (maybe 2.5.1?)
|
||||
whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;;
|
||||
esac
|
||||
link_all_deplibs=yes
|
||||
;;
|
||||
|
||||
sunos4*)
|
||||
archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
sysv4)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
runpath_var='LD_RUN_PATH'
|
||||
hardcode_shlibpath_var=no
|
||||
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
||||
;;
|
||||
|
||||
sysv4.3*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_shlibpath_var=no
|
||||
export_dynamic_flag_spec='-Bexport'
|
||||
;;
|
||||
|
||||
sysv5*)
|
||||
no_undefined_flag=' -z text'
|
||||
# $CC -shared without GNU ld will not create a library from C++
|
||||
# object files and a static libstdc++, better avoid it by now
|
||||
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
|
||||
$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_shlibpath_var=no
|
||||
runpath_var='LD_RUN_PATH'
|
||||
;;
|
||||
|
||||
uts4*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
dgux*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_shlibpath_var=no
|
||||
runpath_var=LD_RUN_PATH
|
||||
hardcode_runpath_var=yes
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
|
||||
sysv4.2uw2*)
|
||||
archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=no
|
||||
hardcode_shlibpath_var=no
|
||||
hardcode_runpath_var=yes
|
||||
runpath_var=LD_RUN_PATH
|
||||
;;
|
||||
|
||||
sysv5uw7* | unixware7*)
|
||||
no_undefined_flag='${wl}-z ${wl}text'
|
||||
if test "$GCC" = yes; then
|
||||
archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
|
||||
else
|
||||
archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
|
||||
fi
|
||||
runpath_var='LD_RUN_PATH'
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
## Compiler Characteristics: PIC flags, static flags, etc
|
||||
|
||||
# We don't use cached values here since only the C compiler
|
||||
# characteristics should be cached.
|
||||
ac_cv_prog_cc_pic=
|
||||
ac_cv_prog_cc_shlib=
|
||||
ac_cv_prog_cc_wl=
|
||||
ac_cv_prog_cc_static=
|
||||
ac_cv_prog_cc_no_builtin=
|
||||
ac_cv_prog_cc_can_build_shared=$can_build_shared
|
||||
|
||||
ac_cv_prog_cc_wl='-Wl,'
|
||||
ac_cv_prog_cc_static='-static'
|
||||
|
||||
case $host_os in
|
||||
beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
|
||||
# PIC is the default for these OSes.
|
||||
;;
|
||||
aix*)
|
||||
# Below there is a dirty hack to force normal static linking with -ldl
|
||||
# The problem is because libdl dynamically linked with both libc and
|
||||
# libC (AIX C++ library), which obviously doesn't included in libraries
|
||||
# list by gcc. This cause undefined symbols with -static flags.
|
||||
# This hack allows C programs to be linked with "-static -ldl", but
|
||||
# we not sure about C++ programs.
|
||||
ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC"
|
||||
;;
|
||||
*djgpp*)
|
||||
# DJGPP does not suppot shared libraries at all
|
||||
ac_cv_prog_cc_pic=
|
||||
;;
|
||||
cygwin* | mingw* | os2*)
|
||||
# This hack is so that the source file can tell whether it is being
|
||||
# built for inclusion in a dll (and should export symbols for example).
|
||||
ac_cv_prog_cc_pic='-DDLL_EXPORT'
|
||||
;;
|
||||
amigaos*)
|
||||
# FIXME: we need at least 68020 code to build shared libraries, but
|
||||
# adding the `-m68020' flag to GCC prevents building anything better,
|
||||
# like `-m68040'.
|
||||
ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ac_cv_prog_cc_pic=-Kconform_pic
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
ac_cv_prog_cc_pic='-fPIC'
|
||||
;;
|
||||
esac
|
||||
|
||||
# GCJ did not exist at the time GCC didn't implicitly link libc in.
|
||||
need_lc=no
|
||||
|
||||
# All existing releases of GCJ support `-c -o'.
|
||||
lt_cv_compiler_c_o=yes
|
||||
@@ -1,32 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
Julian Seward's bzip2
|
||||
originals can be found at: http://sources.redhat.com/bzip2/
|
||||
|
||||
Imported by:
|
||||
|
||||
cvs import -m "Virgin import (trimmed) of Bzip2 version 1.0.2." \
|
||||
src/contrib/bzip2 BZIP2 v1_0_2
|
||||
|
||||
Notes:
|
||||
1. The following log shows details of trimming:
|
||||
|
||||
$ tar xvfz bzip2-1.0.2.tar.gz
|
||||
$ cd bzip2-1.0.2
|
||||
$ rm bzdiff bzdiff.1 bzgrep bzgrep.1 bzip2.1.preformatted bzip2.txt
|
||||
$ rm bzmore bzmore.1 dlltest.dsp libbz2.dsp manual.html manual.pdf
|
||||
$ rm manual.ps manual_1.html manual_2.html manual_3.html manual_4.html
|
||||
$ rm manual_abt.html manual_ovr.html manual_toc.html mk251.c
|
||||
$ uuencode sample1.bz2 sample1.bz2 > sample1.bz2.uu
|
||||
$ uuencode sample2.bz2 sample2.bz2 > sample2.bz2.uu
|
||||
$ uuencode sample3.bz2 sample3.bz2 > sample3.bz2.uu
|
||||
$ gzip -9 sample1.ref sample2.ref sample3.ref
|
||||
$ uuencode sample1.ref.gz sample1.ref.gz > sample1.ref.gz.uu
|
||||
$ uuencode sample2.ref.gz sample2.ref.gz > sample2.ref.gz.uu
|
||||
$ uuencode sample3.ref.gz sample3.ref.gz > sample3.ref.gz.uu
|
||||
$ rm sample1.bz2 sample1.ref.gz sample2.bz2 sample2.ref.gz
|
||||
$ rm sample3.bz2 sample3.ref.gz
|
||||
|
||||
|
||||
[email protected]
|
||||
1 February 2002
|
||||
@@ -1,6 +0,0 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# citrus locale declaration
|
||||
#
|
||||
|
||||
0 string RuneCT Citrus locale declaration for LC_CTYPE
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# natinst: file(1) magic for National Instruments Code Files
|
||||
|
||||
#
|
||||
# From <[email protected]> Enrique Gámez-Flores
|
||||
# version 1
|
||||
# Many formats still missing, we use, for the moment LabVIEW
|
||||
# We guess VXI format file. VISA, LabWindowsCVI, BridgeVIEW, etc, are missing
|
||||
#
|
||||
0 string RSRC National Instruments,
|
||||
# Check if it's a LabVIEW File
|
||||
>8 string LV LabVIEW File,
|
||||
# Check wich kind of file is
|
||||
>>10 string SB Code Resource File, data
|
||||
>>10 string IN Virtual Instrument Program, data
|
||||
>>10 string AR VI Library, data
|
||||
# This is for Menu Libraries
|
||||
>8 string LMNULBVW Portable File Names, data
|
||||
# This is for General Resources
|
||||
>8 string rsc Resources File, data
|
||||
# This is for VXI Package
|
||||
0 string VMAP National Instruments, VXI File, data
|
||||
@@ -1,47 +0,0 @@
|
||||
Copyright 2001 Luke Mewburn <[email protected]>. 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 Luke Mewburn.
|
||||
4. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
|
||||
This product also contains software developed by other people, and you
|
||||
are advised to read the various source files to read the full details
|
||||
of the other licenses. Those licenses also require the following
|
||||
acknowledgements:
|
||||
|
||||
This product includes software developed by the NetBSD Foundation,
|
||||
Inc. and its contributors. Those contributors include:
|
||||
- Simon Burge
|
||||
- Luke Mewburn
|
||||
- Christos Zoulas
|
||||
|
||||
This product includes software developed by the University of
|
||||
California, Berkeley and its contributors. Those contributors
|
||||
include:
|
||||
- Michael Fischbein
|
||||
- Guido van Rossum
|
||||
- Institute of Electrical and Electronics Engineers, Inc
|
||||
|
||||
This product includes software developed by Christos Zoulas.
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# $Id: Makefile.in,v 1.1 2000/07/29 13:34:15 lukem Exp $
|
||||
#
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
SHELL = /bin/sh
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SUBDIRS = libukem src
|
||||
|
||||
all: ftpd
|
||||
|
||||
ftpd: @LIBUKEM@
|
||||
( cd src; ${MAKE} )
|
||||
|
||||
libukem.a:
|
||||
( cd libukem; ${MAKE} )
|
||||
|
||||
install clean:
|
||||
@for i in ${SUBDIRS}; do \
|
||||
( echo "$@ ===> $$i" ; cd $$i ; ${MAKE} $@ ); \
|
||||
done
|
||||
|
||||
distclean: clean
|
||||
@for i in ${SUBDIRS}; do \
|
||||
( echo "$@ ===> $$i" ; cd $$i ; ${MAKE} $@ ); \
|
||||
done
|
||||
rm -f Makefile config.cache config.log config.status config.h
|
||||
@@ -1,101 +0,0 @@
|
||||
/* $Id: acconfig.h,v 1.9 2001/04/28 07:11:06 lukem Exp $ */
|
||||
|
||||
@TOP@
|
||||
@BOTTOM@
|
||||
|
||||
/* Define if your compiler supports `long long' */
|
||||
#undef HAVE_LONG_LONG
|
||||
|
||||
/* Define if *printf() uses %qd to print `long long' (otherwise uses %lld) */
|
||||
#undef HAVE_PRINTF_QD
|
||||
|
||||
/* Define if in_port_t exists */
|
||||
#undef HAVE_IN_PORT_T
|
||||
|
||||
/* Define if struct sockaddr.sa_len exists (implies sockaddr_in.sin_len, etc) */
|
||||
#undef HAVE_SOCKADDR_SA_LEN
|
||||
|
||||
/* Define if socklen_t exists */
|
||||
#undef HAVE_SOCKLEN_T
|
||||
|
||||
/* Define if AF_INET6 exists in <sys/socket.h> */
|
||||
#undef HAVE_AF_INET6
|
||||
|
||||
/* Define if `struct sockaddr_in6' exists in <netinet/in.h> */
|
||||
#undef HAVE_SOCKADDR_IN6
|
||||
|
||||
/* Define if `struct addrinfo' exists in <netdb.h> */
|
||||
#undef HAVE_ADDRINFO
|
||||
|
||||
/*
|
||||
* Define if <netdb.h> contains AI_NUMERICHOST et al.
|
||||
* Systems which only implement RFC2133 will need this.
|
||||
*/
|
||||
#undef HAVE_RFC2553_NETDB
|
||||
|
||||
/* Define if `struct direct' has a d_namlen element */
|
||||
#undef HAVE_D_NAMLEN
|
||||
|
||||
/* Define if struct passwd.pw_expire exists. */
|
||||
#undef HAVE_PW_EXPIRE
|
||||
|
||||
/* Define if GLOB_BRACE, gl_path and gl_match exist in <glob.h> */
|
||||
#undef HAVE_WORKING_GLOB
|
||||
|
||||
/* Define if crypt() is declared in <unistd.h> */
|
||||
#undef HAVE_CRYPT_D
|
||||
|
||||
/* Define if fclose() is declared in <stdio.h> */
|
||||
#undef HAVE_FCLOSE_D
|
||||
|
||||
/* Define if optarg is declared in <stdlib.h> or <unistd.h> */
|
||||
#undef HAVE_OPTARG_D
|
||||
|
||||
/* Define if optind is declared in <stdlib.h> or <unistd.h> */
|
||||
#undef HAVE_OPTIND_D
|
||||
|
||||
/* Define if optreset exists */
|
||||
#undef HAVE_OPTRESET
|
||||
|
||||
/* Define if pclose() is declared in <stdio.h> */
|
||||
#undef HAVE_PCLOSE_D
|
||||
|
||||
/* Define if getusershell() is declared in <unistd.h> */
|
||||
#undef HAVE_GETUSERSHELL_D
|
||||
|
||||
/* Define if `long long' is supported and sizeof(off_t) >= 8 */
|
||||
#undef HAVE_QUAD_SUPPORT
|
||||
|
||||
/* Define if not using in-built /bin/ls code */
|
||||
#undef NO_INTERNAL_LS
|
||||
|
||||
/* Define if using S/Key */
|
||||
#undef SKEY
|
||||
|
||||
/*
|
||||
* Define this if compiling with SOCKS (the firewall traversal library).
|
||||
* Also, you must define connect, getsockname, bind, accept, listen, and
|
||||
* select to their R-versions.
|
||||
*/
|
||||
#undef SOCKS
|
||||
#undef SOCKS4
|
||||
#undef SOCKS5
|
||||
#undef connect
|
||||
#undef getsockname
|
||||
#undef bind
|
||||
#undef accept
|
||||
#undef listen
|
||||
#undef select
|
||||
#undef dup
|
||||
#undef dup2
|
||||
#undef fclose
|
||||
#undef gethostbyname
|
||||
#undef getpeername
|
||||
#undef read
|
||||
#undef recv
|
||||
#undef recvfrom
|
||||
#undef rresvport
|
||||
#undef send
|
||||
#undef sendto
|
||||
#undef shutdown
|
||||
#undef write
|
||||
Vendored
-257
@@ -1,257 +0,0 @@
|
||||
dnl $Id: aclocal.m4,v 1.1 2000/07/29 13:34:15 lukem Exp $
|
||||
dnl
|
||||
|
||||
dnl
|
||||
dnl AC_MSG_TRY_COMPILE
|
||||
dnl
|
||||
dnl Written by Luke Mewburn <[email protected]>
|
||||
dnl
|
||||
dnl Usage:
|
||||
dnl AC_MSG_TRY_COMPILE(Message, CacheVar, Includes, Code,
|
||||
dnl ActionPass [,ActionFail] )
|
||||
dnl
|
||||
dnl effectively does:
|
||||
dnl AC_CACHE_CHECK(Message, CacheVar,
|
||||
dnl AC_TRY_COMPILE(Includes, Code, CacheVar = yes, CacheVar = no)
|
||||
dnl if CacheVar == yes
|
||||
dnl AC_MESSAGE_RESULT(yes)
|
||||
dnl ActionPass
|
||||
dnl else
|
||||
dnl AC_MESSAGE_RESULT(no)
|
||||
dnl ActionFail
|
||||
dnl )
|
||||
dnl
|
||||
AC_DEFUN(AC_MSG_TRY_COMPILE, [
|
||||
AC_CACHE_CHECK($1, $2, [
|
||||
AC_TRY_COMPILE([ $3 ], [ $4; ], [ $2=yes ], [ $2=no ])
|
||||
])
|
||||
if test "x[$]$2" = "xyes"; then
|
||||
$5
|
||||
else
|
||||
$6
|
||||
:
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_MSG_TRY_LINK
|
||||
dnl
|
||||
dnl Usage:
|
||||
dnl AC_MSG_TRY_LINK(Message, CacheVar, Includes, Code,
|
||||
dnl ActionPass [,ActionFail] )
|
||||
dnl
|
||||
dnl as AC_MSG_TRY_COMPILE, but uses AC_TRY_LINK instead of AC_TRY_COMPILE
|
||||
dnl
|
||||
AC_DEFUN(AC_MSG_TRY_LINK, [
|
||||
AC_CACHE_CHECK($1, $2, [
|
||||
AC_TRY_LINK([ $3 ], [ $4; ], [ $2=yes ], [ $2=no ])
|
||||
])
|
||||
if test "x[$]$2" = "xyes"; then
|
||||
$5
|
||||
else
|
||||
$6
|
||||
:
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl AC_LIBRARY_NET: #Id: net.m4,v 1.5 1997/11/09 21:36:54 jhawk Exp #
|
||||
dnl
|
||||
dnl Written by John Hawkinson <[email protected]>. This code is in the Public
|
||||
dnl Domain.
|
||||
dnl
|
||||
dnl This test is for network applications that need socket() and
|
||||
dnl gethostbyname() -ish functions. Under Solaris, those applications need to
|
||||
dnl link with "-lsocket -lnsl". Under IRIX, they should *not* link with
|
||||
dnl "-lsocket" because libsocket.a breaks a number of things (for instance:
|
||||
dnl gethostbyname() under IRIX 5.2, and snoop sockets under most versions of
|
||||
dnl IRIX).
|
||||
dnl
|
||||
dnl Unfortunately, many application developers are not aware of this, and
|
||||
dnl mistakenly write tests that cause -lsocket to be used under IRIX. It is
|
||||
dnl also easy to write tests that cause -lnsl to be used under operating
|
||||
dnl systems where neither are necessary (or useful), such as SunOS 4.1.4, which
|
||||
dnl uses -lnsl for TLI.
|
||||
dnl
|
||||
dnl This test exists so that every application developer does not test this in
|
||||
dnl a different, and subtly broken fashion.
|
||||
dnl
|
||||
dnl It has been argued that this test should be broken up into two seperate
|
||||
dnl tests, one for the resolver libraries, and one for the libraries necessary
|
||||
dnl for using Sockets API. Unfortunately, the two are carefully intertwined and
|
||||
dnl allowing the autoconf user to use them independantly potentially results in
|
||||
dnl unfortunate ordering dependancies -- as such, such component macros would
|
||||
dnl have to carefully use indirection and be aware if the other components were
|
||||
dnl executed. Since other autoconf macros do not go to this trouble, and almost
|
||||
dnl no applications use sockets without the resolver, this complexity has not
|
||||
dnl been implemented.
|
||||
dnl
|
||||
dnl The check for libresolv is in case you are attempting to link statically
|
||||
dnl and happen to have a libresolv.a lying around (and no libnsl.a).
|
||||
dnl
|
||||
AC_DEFUN(AC_LIBRARY_NET, [
|
||||
# Most operating systems have gethostbyname() in the default searched
|
||||
# libraries (i.e. libc):
|
||||
AC_CHECK_FUNC(gethostbyname, ,
|
||||
# Some OSes (eg. Solaris) place it in libnsl:
|
||||
AC_CHECK_LIB(nsl, gethostbyname, ,
|
||||
# Some strange OSes (SINIX) have it in libsocket:
|
||||
AC_CHECK_LIB(socket, gethostbyname, ,
|
||||
# Unfortunately libsocket sometimes depends on libnsl.
|
||||
# AC_CHECK_LIB's API is essentially broken so the following
|
||||
# ugliness is necessary:
|
||||
AC_CHECK_LIB(socket, gethostbyname,
|
||||
LIBS="-lsocket -lnsl $LIBS",
|
||||
AC_CHECK_LIB(resolv, gethostbyname),
|
||||
-lnsl)
|
||||
)
|
||||
)
|
||||
)
|
||||
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
|
||||
AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)))
|
||||
])
|
||||
|
||||
|
||||
dnl Checks for SOCKS firewall support.
|
||||
dnl
|
||||
dnl Written by Matthew R. Green <[email protected]>
|
||||
dnl
|
||||
AC_DEFUN(AC_LIBRARY_SOCKS, [
|
||||
AC_MSG_CHECKING(whether to support SOCKS)
|
||||
AC_ARG_WITH(socks,
|
||||
[ --with-socks Compile with SOCKS firewall traversal support.],
|
||||
[
|
||||
case "$withval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
yes)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_CHECK_LIB(socks5, SOCKSconnect, [
|
||||
socks=5
|
||||
LIBS="-lsocks5 $LIBS"], [
|
||||
AC_CHECK_LIB(socks, Rconnect, [
|
||||
socks=4
|
||||
LIBS="-lsocks $LIBS"], [
|
||||
AC_MSG_ERROR(Could not find socks library. You must first install socks.) ] ) ] )
|
||||
;;
|
||||
esac
|
||||
],
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
if test "x$socks" = "x"; then
|
||||
AC_MSG_CHECKING(whether to support SOCKS5)
|
||||
AC_ARG_WITH(socks5,
|
||||
[ --with-socks5[=PATH] Compile with SOCKS5 firewall traversal support.],
|
||||
[
|
||||
case "$withval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
socks=5
|
||||
if test "x$withval" = "xyes"; then
|
||||
withval="-lsocks5"
|
||||
else
|
||||
if test -d "$withval"; then
|
||||
if test -d "$withval/include"; then
|
||||
CFLAGS="$CFLAGS -I$withval/include"
|
||||
else
|
||||
CFLAGS="$CFLAGS -I$withval"
|
||||
fi
|
||||
if test -d "$withval/lib"; then
|
||||
withval="-L$withval/lib -lsocks5"
|
||||
else
|
||||
withval="-L$withval -lsocks5"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
LIBS="$withval $LIBS"
|
||||
# If Socks was compiled with Kerberos support, we will need
|
||||
# to link against kerberos libraries. Temporarily append
|
||||
# to LIBS. This is harmless if there is no kerberos support.
|
||||
TMPLIBS="$LIBS"
|
||||
LIBS="$LIBS $KERBEROS_LIBS"
|
||||
AC_TRY_LINK([],
|
||||
[ SOCKSconnect(); ],
|
||||
[],
|
||||
[ AC_MSG_ERROR(Could not find the $withval library. You must first install socks5.) ])
|
||||
LIBS="$TMPLIBS"
|
||||
;;
|
||||
esac
|
||||
],
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
fi
|
||||
|
||||
if test "x$socks" = "x"; then
|
||||
AC_MSG_CHECKING(whether to support SOCKS4)
|
||||
AC_ARG_WITH(socks4,
|
||||
[ --with-socks4[=PATH] Compile with SOCKS4 firewall traversal support.],
|
||||
[
|
||||
case "$withval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
socks=4
|
||||
if test "x$withval" = "xyes"; then
|
||||
withval="-lsocks"
|
||||
else
|
||||
if test -d "$withval"; then
|
||||
withval="-L$withval -lsocks"
|
||||
fi
|
||||
fi
|
||||
LIBS="$withval $LIBS"
|
||||
AC_TRY_LINK([],
|
||||
[ Rconnect(); ],
|
||||
[],
|
||||
[ AC_MSG_ERROR(Could not find the $withval library. You must first install socks.) ])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
fi
|
||||
|
||||
if test "x$socks" = "x4"; then
|
||||
AC_DEFINE(SOCKS)
|
||||
AC_DEFINE(SOCKS4)
|
||||
AC_DEFINE(connect, Rconnect)
|
||||
AC_DEFINE(getsockname, Rgetsockname)
|
||||
AC_DEFINE(bind, Rbind)
|
||||
AC_DEFINE(accept, Raccept)
|
||||
AC_DEFINE(listen, Rlisten)
|
||||
AC_DEFINE(select, Rselect)
|
||||
fi
|
||||
|
||||
if test "x$socks" = "x5"; then
|
||||
AC_DEFINE(SOCKS)
|
||||
AC_DEFINE(SOCKS5)
|
||||
AC_DEFINE(connect,SOCKSconnect)
|
||||
AC_DEFINE(getsockname,SOCKSgetsockname)
|
||||
AC_DEFINE(getpeername,SOCKSgetpeername)
|
||||
AC_DEFINE(bind,SOCKSbind)
|
||||
AC_DEFINE(accept,SOCKSaccept)
|
||||
AC_DEFINE(listen,SOCKSlisten)
|
||||
AC_DEFINE(select,SOCKSselect)
|
||||
AC_DEFINE(recvfrom,SOCKSrecvfrom)
|
||||
AC_DEFINE(sendto,SOCKSsendto)
|
||||
AC_DEFINE(recv,SOCKSrecv)
|
||||
AC_DEFINE(send,SOCKSsend)
|
||||
AC_DEFINE(read,SOCKSread)
|
||||
AC_DEFINE(write,SOCKSwrite)
|
||||
AC_DEFINE(rresvport,SOCKSrresvport)
|
||||
AC_DEFINE(shutdown,SOCKSshutdown)
|
||||
AC_DEFINE(listen,SOCKSlisten)
|
||||
AC_DEFINE(close,SOCKSclose)
|
||||
AC_DEFINE(dup,SOCKSdup)
|
||||
AC_DEFINE(dup2,SOCKSdup2)
|
||||
AC_DEFINE(fclose,SOCKSfclose)
|
||||
AC_DEFINE(gethostbyname,SOCKSgethostbyname)
|
||||
fi
|
||||
])
|
||||
@@ -1,274 +0,0 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/* $Id: config.h.in,v 1.15 2001/04/28 07:11:46 lukem Exp $ */
|
||||
|
||||
|
||||
/* Define if the closedir function returns void instead of int. */
|
||||
#undef CLOSEDIR_VOID
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define if your Fortran 77 compiler doesn't accept -c and -o together. */
|
||||
#undef F77_NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define to the type of arg1 for select(). */
|
||||
#undef SELECT_TYPE_ARG1
|
||||
|
||||
/* Define to the type of args 2, 3 and 4 for select(). */
|
||||
#undef SELECT_TYPE_ARG234
|
||||
|
||||
/* Define to the type of arg5 for select(). */
|
||||
#undef SELECT_TYPE_ARG5
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define if the closedir function returns void instead of int. */
|
||||
#undef VOID_CLOSEDIR
|
||||
|
||||
/* The number of bytes in a off_t. */
|
||||
#undef SIZEOF_OFF_T
|
||||
|
||||
/* Define if you have the err function. */
|
||||
#undef HAVE_ERR
|
||||
|
||||
/* Define if you have the fgetln function. */
|
||||
#undef HAVE_FGETLN
|
||||
|
||||
/* Define if you have the flock function. */
|
||||
#undef HAVE_FLOCK
|
||||
|
||||
/* Define if you have the fparseln function. */
|
||||
#undef HAVE_FPARSELN
|
||||
|
||||
/* Define if you have the fts_open function. */
|
||||
#undef HAVE_FTS_OPEN
|
||||
|
||||
/* Define if you have the getaddrinfo function. */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define if you have the getgrouplist function. */
|
||||
#undef HAVE_GETGROUPLIST
|
||||
|
||||
/* Define if you have the getnameinfo function. */
|
||||
#undef HAVE_GETNAMEINFO
|
||||
|
||||
/* Define if you have the getspnam function. */
|
||||
#undef HAVE_GETSPNAM
|
||||
|
||||
/* Define if you have the getusershell function. */
|
||||
#undef HAVE_GETUSERSHELL
|
||||
|
||||
/* Define if you have the inet_net_pton function. */
|
||||
#undef HAVE_INET_NET_PTON
|
||||
|
||||
/* Define if you have the inet_ntop function. */
|
||||
#undef HAVE_INET_NTOP
|
||||
|
||||
/* Define if you have the inet_pton function. */
|
||||
#undef HAVE_INET_PTON
|
||||
|
||||
/* Define if you have the lockf function. */
|
||||
#undef HAVE_LOCKF
|
||||
|
||||
/* Define if you have the mkstemp function. */
|
||||
#undef HAVE_MKSTEMP
|
||||
|
||||
/* Define if you have the setlogin function. */
|
||||
#undef HAVE_SETLOGIN
|
||||
|
||||
/* Define if you have the setproctitle function. */
|
||||
#undef HAVE_SETPROCTITLE
|
||||
|
||||
/* Define if you have the sl_init function. */
|
||||
#undef HAVE_SL_INIT
|
||||
|
||||
/* Define if you have the snprintf function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define if you have the strdup function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* Define if you have the strlcat function. */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define if you have the strlcpy function. */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define if you have the strmode function. */
|
||||
#undef HAVE_STRMODE
|
||||
|
||||
/* Define if you have the strsep function. */
|
||||
#undef HAVE_STRSEP
|
||||
|
||||
/* Define if you have the strtoll function. */
|
||||
#undef HAVE_STRTOLL
|
||||
|
||||
/* Define if you have the user_from_uid function. */
|
||||
#undef HAVE_USER_FROM_UID
|
||||
|
||||
/* Define if you have the usleep function. */
|
||||
#undef HAVE_USLEEP
|
||||
|
||||
/* Define if you have the vfork function. */
|
||||
#undef HAVE_VFORK
|
||||
|
||||
/* Define if you have the vsyslog function. */
|
||||
#undef HAVE_VSYSLOG
|
||||
|
||||
/* Define if you have the <arpa/nameser.h> header file. */
|
||||
#undef HAVE_ARPA_NAMESER_H
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the <err.h> header file. */
|
||||
#undef HAVE_ERR_H
|
||||
|
||||
/* Define if you have the <fts.h> header file. */
|
||||
#undef HAVE_FTS_H
|
||||
|
||||
/* Define if you have the <libutil.h> header file. */
|
||||
#undef HAVE_LIBUTIL_H
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define if you have the <paths.h> header file. */
|
||||
#undef HAVE_PATHS_H
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define if you have the <sys/sysmacros.h> header file. */
|
||||
#undef HAVE_SYS_SYSMACROS_H
|
||||
|
||||
/* Define if you have the <util.h> header file. */
|
||||
#undef HAVE_UTIL_H
|
||||
|
||||
/* Define if you have the crypt library (-lcrypt). */
|
||||
#undef HAVE_LIBCRYPT
|
||||
|
||||
/* Define if you have the nsl library (-lnsl). */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define if you have the skey library (-lskey). */
|
||||
#undef HAVE_LIBSKEY
|
||||
|
||||
/* Define if you have the socket library (-lsocket). */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Define if you have the util library (-lutil). */
|
||||
#undef HAVE_LIBUTIL
|
||||
|
||||
/* Define if your compiler supports `long long' */
|
||||
#undef HAVE_LONG_LONG
|
||||
|
||||
/* Define if *printf() uses %qd to print `long long' (otherwise uses %lld) */
|
||||
#undef HAVE_PRINTF_QD
|
||||
|
||||
/* Define if in_port_t exists */
|
||||
#undef HAVE_IN_PORT_T
|
||||
|
||||
/* Define if struct sockaddr.sa_len exists (implies sockaddr_in.sin_len, etc) */
|
||||
#undef HAVE_SOCKADDR_SA_LEN
|
||||
|
||||
/* Define if socklen_t exists */
|
||||
#undef HAVE_SOCKLEN_T
|
||||
|
||||
/* Define if AF_INET6 exists in <sys/socket.h> */
|
||||
#undef HAVE_AF_INET6
|
||||
|
||||
/* Define if `struct sockaddr_in6' exists in <netinet/in.h> */
|
||||
#undef HAVE_SOCKADDR_IN6
|
||||
|
||||
/* Define if `struct addrinfo' exists in <netdb.h> */
|
||||
#undef HAVE_ADDRINFO
|
||||
|
||||
/*
|
||||
* Define if <netdb.h> contains AI_NUMERICHOST et al.
|
||||
* Systems which only implement RFC2133 will need this.
|
||||
*/
|
||||
#undef HAVE_RFC2553_NETDB
|
||||
|
||||
/* Define if `struct direct' has a d_namlen element */
|
||||
#undef HAVE_D_NAMLEN
|
||||
|
||||
/* Define if struct passwd.pw_expire exists. */
|
||||
#undef HAVE_PW_EXPIRE
|
||||
|
||||
/* Define if GLOB_BRACE, gl_path and gl_match exist in <glob.h> */
|
||||
#undef HAVE_WORKING_GLOB
|
||||
|
||||
/* Define if crypt() is declared in <unistd.h> */
|
||||
#undef HAVE_CRYPT_D
|
||||
|
||||
/* Define if fclose() is declared in <stdio.h> */
|
||||
#undef HAVE_FCLOSE_D
|
||||
|
||||
/* Define if optarg is declared in <stdlib.h> or <unistd.h> */
|
||||
#undef HAVE_OPTARG_D
|
||||
|
||||
/* Define if optind is declared in <stdlib.h> or <unistd.h> */
|
||||
#undef HAVE_OPTIND_D
|
||||
|
||||
/* Define if optreset exists */
|
||||
#undef HAVE_OPTRESET
|
||||
|
||||
/* Define if pclose() is declared in <stdio.h> */
|
||||
#undef HAVE_PCLOSE_D
|
||||
|
||||
/* Define if getusershell() is declared in <unistd.h> */
|
||||
#undef HAVE_GETUSERSHELL_D
|
||||
|
||||
/* Define if `long long' is supported and sizeof(off_t) >= 8 */
|
||||
#undef HAVE_QUAD_SUPPORT
|
||||
|
||||
/* Define if not using in-built /bin/ls code */
|
||||
#undef NO_INTERNAL_LS
|
||||
|
||||
/* Define if using S/Key */
|
||||
#undef SKEY
|
||||
|
||||
/*
|
||||
* Define this if compiling with SOCKS (the firewall traversal library).
|
||||
* Also, you must define connect, getsockname, bind, accept, listen, and
|
||||
* select to their R-versions.
|
||||
*/
|
||||
#undef SOCKS
|
||||
#undef SOCKS4
|
||||
#undef SOCKS5
|
||||
#undef connect
|
||||
#undef getsockname
|
||||
#undef bind
|
||||
#undef accept
|
||||
#undef listen
|
||||
#undef select
|
||||
#undef dup
|
||||
#undef dup2
|
||||
#undef fclose
|
||||
#undef gethostbyname
|
||||
#undef getpeername
|
||||
#undef read
|
||||
#undef recv
|
||||
#undef recvfrom
|
||||
#undef rresvport
|
||||
#undef send
|
||||
#undef sendto
|
||||
#undef shutdown
|
||||
#undef write
|
||||
@@ -1,251 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -1,61 +0,0 @@
|
||||
# $Id: Makefile.in,v 1.5 2001/03/29 05:29:07 lukem Exp $
|
||||
#
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
SHELL = /bin/sh
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
mandir = @mandir@
|
||||
sbindir = @sbindir@
|
||||
|
||||
mandircat5 = ${mandir}/cat5
|
||||
mandircat8 = ${mandir}/cat8
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS = -I${srcdir} -I${srcdir}/.. -I. -I.. @INCLUDES@ @CFLAGS@
|
||||
LIBS = @LIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
PROG = ftpd
|
||||
OBJS = cmds.o conf.o ftpd.o ftpcmd.o popen.o @LSOBJS@
|
||||
# removed: logutmp.o logwtmp.o
|
||||
|
||||
all: ${PROG}
|
||||
|
||||
cmp.o: ${srcdir}/../ls/cmp.c
|
||||
${CC} ${CFLAGS} -c -o cmp.o ${srcdir}/../ls/cmp.c
|
||||
|
||||
ls.o: ${srcdir}/../ls/ls.c
|
||||
${CC} ${CFLAGS} -c -o ls.o ${srcdir}/../ls/ls.c
|
||||
|
||||
print.o: ${srcdir}/../ls/print.c
|
||||
${CC} ${CFLAGS} -c -o print.o ${srcdir}/../ls/print.c
|
||||
|
||||
stat_flags.o: ${srcdir}/../ls/stat_flags.c
|
||||
${CC} ${CFLAGS} -c -o stat_flags.o ${srcdir}/../ls/stat_flags.c
|
||||
|
||||
util.o: ${srcdir}/../ls/util.c
|
||||
${CC} ${CFLAGS} -c -o util.o ${srcdir}/../ls/util.c
|
||||
|
||||
install: all
|
||||
-mkdir -p ${sbindir}
|
||||
${INSTALL} -m 555 ${PROG} ${sbindir}
|
||||
-mkdir -p ${mandircat5}
|
||||
${INSTALL} -m 444 ${srcdir}/ftpd.conf.cat5 ${mandircat5}/ftpd.conf.5
|
||||
${INSTALL} -m 444 ${srcdir}/ftpusers.cat5 ${mandircat5}/ftpusers.5
|
||||
-mkdir -p ${mandircat8}
|
||||
${INSTALL} -m 444 ${srcdir}/${PROG}.cat8 ${mandircat8}/${PROG}.8
|
||||
|
||||
${PROG}: ${OBJS} @LIBDEPENDS@
|
||||
${CC} ${CFLAGS} ${LDFLAGS} -o ${PROG} ${OBJS} ${LIBS}
|
||||
|
||||
clean:
|
||||
rm -f core ${PROG} ${OBJS}
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile
|
||||
@@ -1,111 +0,0 @@
|
||||
/* $NetBSD: ftp.h,v 1.5 1998/02/10 00:32:50 perry Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1989, 1993
|
||||
* 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.
|
||||
*
|
||||
* @(#)ftp.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _ARPA_FTP_H_
|
||||
#define _ARPA_FTP_H_
|
||||
|
||||
/* Definitions for FTP; see RFC-765. */
|
||||
|
||||
/*
|
||||
* Reply codes.
|
||||
*/
|
||||
#define PRELIM 1 /* positive preliminary */
|
||||
#define COMPLETE 2 /* positive completion */
|
||||
#define CONTINUE 3 /* positive intermediate */
|
||||
#define TRANSIENT 4 /* transient negative completion */
|
||||
#define ERROR 5 /* permanent negative completion */
|
||||
|
||||
/*
|
||||
* Type codes
|
||||
*/
|
||||
#define TYPE_A 1 /* ASCII */
|
||||
#define TYPE_E 2 /* EBCDIC */
|
||||
#define TYPE_I 3 /* image */
|
||||
#define TYPE_L 4 /* local byte size */
|
||||
|
||||
#ifdef FTP_NAMES
|
||||
char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" };
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Form codes
|
||||
*/
|
||||
#define FORM_N 1 /* non-print */
|
||||
#define FORM_T 2 /* telnet format effectors */
|
||||
#define FORM_C 3 /* carriage control (ASA) */
|
||||
#ifdef FTP_NAMES
|
||||
char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" };
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure codes
|
||||
*/
|
||||
#define STRU_F 1 /* file (no record structure) */
|
||||
#define STRU_R 2 /* record structure */
|
||||
#define STRU_P 3 /* page structure */
|
||||
#ifdef FTP_NAMES
|
||||
char *strunames[] = {"0", "File", "Record", "Page" };
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Mode types
|
||||
*/
|
||||
#define MODE_S 1 /* stream */
|
||||
#define MODE_B 2 /* block */
|
||||
#define MODE_C 3 /* compressed */
|
||||
#ifdef FTP_NAMES
|
||||
char *modenames[] = {"0", "Stream", "Block", "Compressed" };
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Record Tokens
|
||||
*/
|
||||
#define REC_ESC '\377' /* Record-mode Escape */
|
||||
#define REC_EOR '\001' /* Record-mode End-of-Record */
|
||||
#define REC_EOF '\002' /* Record-mode End-of-File */
|
||||
|
||||
/*
|
||||
* Block Header
|
||||
*/
|
||||
#define BLK_EOR 0x80 /* Block is End-of-Record */
|
||||
#define BLK_EOF 0x40 /* Block is End-of-File */
|
||||
#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */
|
||||
#define BLK_RESTART 0x10 /* Block is Restart Marker */
|
||||
|
||||
#define BLK_BYTECOUNT 2 /* Bytes in this block */
|
||||
|
||||
#endif /* _ARPA_FTP_H_ */
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Portions Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* Portions Copyright (c) 1996, Jason Downs. 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.
|
||||
*/
|
||||
|
||||
#include "lukemftpd.h"
|
||||
|
||||
typedef struct utmp UTMP;
|
||||
|
||||
static int fd = -1;
|
||||
static int topslot = -1;
|
||||
|
||||
/*
|
||||
* Special versions of login()/logout() which hold the utmp file open,
|
||||
* for use with ftpd.
|
||||
*/
|
||||
|
||||
void
|
||||
login(const UTMP *ut)
|
||||
{
|
||||
UTMP ubuf;
|
||||
|
||||
/*
|
||||
* First, loop through /etc/ttys, if needed, to initialize the
|
||||
* top of the tty slots, since ftpd has no tty.
|
||||
*/
|
||||
if (topslot < 0) {
|
||||
topslot = 0;
|
||||
while (getttyent() != (struct ttyent *)NULL)
|
||||
topslot++;
|
||||
}
|
||||
if ((topslot < 0) || ((fd < 0)
|
||||
&& (fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644)) < 0))
|
||||
return;
|
||||
|
||||
/*
|
||||
* Now find a slot that's not in use...
|
||||
*/
|
||||
(void)lseek(fd, (off_t)(topslot * sizeof(UTMP)), SEEK_SET);
|
||||
|
||||
while (1) {
|
||||
if (read(fd, &ubuf, sizeof(UTMP)) == sizeof(UTMP)) {
|
||||
if (!ubuf.ut_name[0]) {
|
||||
(void)lseek(fd, -(off_t)sizeof(UTMP), SEEK_CUR);
|
||||
break;
|
||||
}
|
||||
topslot++;
|
||||
} else {
|
||||
(void)lseek(fd, (off_t)(topslot * sizeof(UTMP)),
|
||||
SEEK_SET);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
(void)write(fd, ut, sizeof(UTMP));
|
||||
}
|
||||
|
||||
int
|
||||
logout(const char *line)
|
||||
{
|
||||
UTMP ut;
|
||||
int rval;
|
||||
|
||||
rval = 0;
|
||||
if (fd < 0)
|
||||
return(rval);
|
||||
|
||||
(void)lseek(fd, 0, SEEK_SET);
|
||||
|
||||
while (read(fd, &ut, sizeof(UTMP)) == sizeof(UTMP)) {
|
||||
if (!ut.ut_name[0]
|
||||
|| strncmp(ut.ut_line, line, UT_LINESIZE))
|
||||
continue;
|
||||
memset(ut.ut_name, 0, UT_NAMESIZE);
|
||||
memset(ut.ut_host, 0, UT_HOSTSIZE);
|
||||
(void)time(&ut.ut_time);
|
||||
(void)lseek(fd, -(off_t)sizeof(UTMP), SEEK_CUR);
|
||||
(void)write(fd, &ut, sizeof(UTMP));
|
||||
rval = 1;
|
||||
}
|
||||
return(rval);
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/* $NetBSD: pathnames.h,v 1.10 2000/03/06 21:42:26 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* 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.
|
||||
*
|
||||
* @(#)pathnames.h 8.1 (Berkeley) 6/4/93
|
||||
*/
|
||||
|
||||
#ifndef _DEFAULT_CONFDIR
|
||||
#define _DEFAULT_CONFDIR "/etc"
|
||||
#endif
|
||||
|
||||
#define _PATH_FTPCHROOT "ftpchroot"
|
||||
#define _PATH_FTPDCONF "ftpd.conf"
|
||||
#define _PATH_FTPLOGINMESG "motd"
|
||||
#undef _PATH_FTPUSERS
|
||||
#define _PATH_FTPUSERS "ftpusers"
|
||||
#define _PATH_FTPWELCOME "ftpwelcome"
|
||||
|
||||
#define _PATH_CLASSPIDS "/var/run/ftpd.pids-"
|
||||
|
||||
#define TMPFILE "/tmp/ftpdXXXXXXX"
|
||||
@@ -1,529 +0,0 @@
|
||||
.de EX
|
||||
.nf
|
||||
.ft CW
|
||||
..
|
||||
.de EE
|
||||
.br
|
||||
.fi
|
||||
.ft 1
|
||||
..
|
||||
awk
|
||||
.TH AWK 1
|
||||
.CT 1 files prog_other
|
||||
.SH NAME
|
||||
awk \- pattern-directed scanning and processing language
|
||||
.SH SYNOPSIS
|
||||
.B awk
|
||||
[
|
||||
.BI \-F
|
||||
.I fs
|
||||
]
|
||||
[
|
||||
.BI \-v
|
||||
.I var=value
|
||||
]
|
||||
[
|
||||
.I 'prog'
|
||||
|
|
||||
.BI \-f
|
||||
.I progfile
|
||||
]
|
||||
[
|
||||
.I file ...
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
.I Awk
|
||||
scans each input
|
||||
.I file
|
||||
for lines that match any of a set of patterns specified literally in
|
||||
.IR prog
|
||||
or in one or more files
|
||||
specified as
|
||||
.B \-f
|
||||
.IR progfile .
|
||||
With each pattern
|
||||
there can be an associated action that will be performed
|
||||
when a line of a
|
||||
.I file
|
||||
matches the pattern.
|
||||
Each line is matched against the
|
||||
pattern portion of every pattern-action statement;
|
||||
the associated action is performed for each matched pattern.
|
||||
The file name
|
||||
.B \-
|
||||
means the standard input.
|
||||
Any
|
||||
.IR file
|
||||
of the form
|
||||
.I var=value
|
||||
is treated as an assignment, not a filename,
|
||||
and is executed at the time it would have been opened if it were a filename.
|
||||
The option
|
||||
.B \-v
|
||||
followed by
|
||||
.I var=value
|
||||
is an assignment to be done before
|
||||
.I prog
|
||||
is executed;
|
||||
any number of
|
||||
.B \-v
|
||||
options may be present.
|
||||
The
|
||||
.B \-F
|
||||
.IR fs
|
||||
option defines the input field separator to be the regular expression
|
||||
.IR fs.
|
||||
.PP
|
||||
An input line is normally made up of fields separated by white space,
|
||||
or by regular expression
|
||||
.BR FS .
|
||||
The fields are denoted
|
||||
.BR $1 ,
|
||||
.BR $2 ,
|
||||
\&..., while
|
||||
.B $0
|
||||
refers to the entire line.
|
||||
If
|
||||
.BR FS
|
||||
is null, the input line is split into one field per character.
|
||||
.PP
|
||||
A pattern-action statement has the form
|
||||
.IP
|
||||
.IB pattern " { " action " }
|
||||
.PP
|
||||
A missing
|
||||
.BI { " action " }
|
||||
means print the line;
|
||||
a missing pattern always matches.
|
||||
Pattern-action statements are separated by newlines or semicolons.
|
||||
.PP
|
||||
An action is a sequence of statements.
|
||||
A statement can be one of the following:
|
||||
.PP
|
||||
.EX
|
||||
.ta \w'\f(CWdelete array[expression]'u
|
||||
.RS
|
||||
.nf
|
||||
.ft CW
|
||||
if(\fI expression \fP)\fI statement \fP\fR[ \fPelse\fI statement \fP\fR]\fP
|
||||
while(\fI expression \fP)\fI statement\fP
|
||||
for(\fI expression \fP;\fI expression \fP;\fI expression \fP)\fI statement\fP
|
||||
for(\fI var \fPin\fI array \fP)\fI statement\fP
|
||||
do\fI statement \fPwhile(\fI expression \fP)
|
||||
break
|
||||
continue
|
||||
{\fR [\fP\fI statement ... \fP\fR] \fP}
|
||||
\fIexpression\fP #\fR commonly\fP\fI var = expression\fP
|
||||
print\fR [ \fP\fIexpression-list \fP\fR] \fP\fR[ \fP>\fI expression \fP\fR]\fP
|
||||
printf\fI format \fP\fR[ \fP,\fI expression-list \fP\fR] \fP\fR[ \fP>\fI expression \fP\fR]\fP
|
||||
return\fR [ \fP\fIexpression \fP\fR]\fP
|
||||
next #\fR skip remaining patterns on this input line\fP
|
||||
nextfile #\fR skip rest of this file, open next, start at top\fP
|
||||
delete\fI array\fP[\fI expression \fP] #\fR delete an array element\fP
|
||||
delete\fI array\fP #\fR delete all elements of array\fP
|
||||
exit\fR [ \fP\fIexpression \fP\fR]\fP #\fR exit immediately; status is \fP\fIexpression\fP
|
||||
.fi
|
||||
.RE
|
||||
.EE
|
||||
.DT
|
||||
.PP
|
||||
Statements are terminated by
|
||||
semicolons, newlines or right braces.
|
||||
An empty
|
||||
.I expression-list
|
||||
stands for
|
||||
.BR $0 .
|
||||
String constants are quoted \&\f(CW"\ "\fR,
|
||||
with the usual C escapes recognized within.
|
||||
Expressions take on string or numeric values as appropriate,
|
||||
and are built using the operators
|
||||
.B + \- * / % ^
|
||||
(exponentiation), and concatenation (indicated by white space).
|
||||
The operators
|
||||
.B
|
||||
! ++ \-\- += \-= *= /= %= ^= > >= < <= == != ?:
|
||||
are also available in expressions.
|
||||
Variables may be scalars, array elements
|
||||
(denoted
|
||||
.IB x [ i ] )
|
||||
or fields.
|
||||
Variables are initialized to the null string.
|
||||
Array subscripts may be any string,
|
||||
not necessarily numeric;
|
||||
this allows for a form of associative memory.
|
||||
Multiple subscripts such as
|
||||
.B [i,j,k]
|
||||
are permitted; the constituents are concatenated,
|
||||
separated by the value of
|
||||
.BR SUBSEP .
|
||||
.PP
|
||||
The
|
||||
.B print
|
||||
statement prints its arguments on the standard output
|
||||
(or on a file if
|
||||
.BI > file
|
||||
or
|
||||
.BI >> file
|
||||
is present or on a pipe if
|
||||
.BI | cmd
|
||||
is present), separated by the current output field separator,
|
||||
and terminated by the output record separator.
|
||||
.I file
|
||||
and
|
||||
.I cmd
|
||||
may be literal names or parenthesized expressions;
|
||||
identical string values in different statements denote
|
||||
the same open file.
|
||||
The
|
||||
.B printf
|
||||
statement formats its expression list according to the format
|
||||
(see
|
||||
.IR printf (3)) .
|
||||
The built-in function
|
||||
.BI close( expr )
|
||||
closes the file or pipe
|
||||
.IR expr .
|
||||
The built-in function
|
||||
.BI fflush( expr )
|
||||
flushes any buffered output for the file or pipe
|
||||
.IR expr .
|
||||
.PP
|
||||
The mathematical functions
|
||||
.BR exp ,
|
||||
.BR log ,
|
||||
.BR sqrt ,
|
||||
.BR sin ,
|
||||
.BR cos ,
|
||||
and
|
||||
.BR atan2
|
||||
are built in.
|
||||
Other built-in functions:
|
||||
.TF length
|
||||
.TP
|
||||
.B length
|
||||
the length of its argument
|
||||
taken as a string,
|
||||
or of
|
||||
.B $0
|
||||
if no argument.
|
||||
.TP
|
||||
.B rand
|
||||
random number on (0,1)
|
||||
.TP
|
||||
.B srand
|
||||
sets seed for
|
||||
.B rand
|
||||
and returns the previous seed.
|
||||
.TP
|
||||
.B int
|
||||
truncates to an integer value
|
||||
.TP
|
||||
.BI substr( s , " m" , " n\fB)
|
||||
the
|
||||
.IR n -character
|
||||
substring of
|
||||
.I s
|
||||
that begins at position
|
||||
.IR m
|
||||
counted from 1.
|
||||
.TP
|
||||
.BI index( s , " t" )
|
||||
the position in
|
||||
.I s
|
||||
where the string
|
||||
.I t
|
||||
occurs, or 0 if it does not.
|
||||
.TP
|
||||
.BI match( s , " r" )
|
||||
the position in
|
||||
.I s
|
||||
where the regular expression
|
||||
.I r
|
||||
occurs, or 0 if it does not.
|
||||
The variables
|
||||
.B RSTART
|
||||
and
|
||||
.B RLENGTH
|
||||
are set to the position and length of the matched string.
|
||||
.TP
|
||||
.BI split( s , " a" , " fs\fB)
|
||||
splits the string
|
||||
.I s
|
||||
into array elements
|
||||
.IB a [1] ,
|
||||
.IB a [2] ,
|
||||
\&...,
|
||||
.IB a [ n ] ,
|
||||
and returns
|
||||
.IR n .
|
||||
The separation is done with the regular expression
|
||||
.I fs
|
||||
or with the field separator
|
||||
.B FS
|
||||
if
|
||||
.I fs
|
||||
is not given.
|
||||
An empty string as field separator splits the string
|
||||
into one array element per character.
|
||||
.TP
|
||||
.BI sub( r , " t" , " s\fB)
|
||||
substitutes
|
||||
.I t
|
||||
for the first occurrence of the regular expression
|
||||
.I r
|
||||
in the string
|
||||
.IR s .
|
||||
If
|
||||
.I s
|
||||
is not given,
|
||||
.B $0
|
||||
is used.
|
||||
.TP
|
||||
.B gsub
|
||||
same as
|
||||
.B sub
|
||||
except that all occurrences of the regular expression
|
||||
are replaced;
|
||||
.B sub
|
||||
and
|
||||
.B gsub
|
||||
return the number of replacements.
|
||||
.TP
|
||||
.BI sprintf( fmt , " expr" , " ...\fB )
|
||||
the string resulting from formatting
|
||||
.I expr ...
|
||||
according to the
|
||||
.IR printf (3)
|
||||
format
|
||||
.I fmt
|
||||
.TP
|
||||
.BI system( cmd )
|
||||
executes
|
||||
.I cmd
|
||||
and returns its exit status
|
||||
.TP
|
||||
.BI tolower( str )
|
||||
returns a copy of
|
||||
.I str
|
||||
with all upper-case characters translated to their
|
||||
corresponding lower-case equivalents.
|
||||
.TP
|
||||
.BI toupper( str )
|
||||
returns a copy of
|
||||
.I str
|
||||
with all lower-case characters translated to their
|
||||
corresponding upper-case equivalents.
|
||||
.PD
|
||||
.PP
|
||||
The ``function''
|
||||
.B getline
|
||||
sets
|
||||
.B $0
|
||||
to the next input record from the current input file;
|
||||
.B getline
|
||||
.BI < file
|
||||
sets
|
||||
.B $0
|
||||
to the next record from
|
||||
.IR file .
|
||||
.B getline
|
||||
.I x
|
||||
sets variable
|
||||
.I x
|
||||
instead.
|
||||
Finally,
|
||||
.IB cmd " | getline
|
||||
pipes the output of
|
||||
.I cmd
|
||||
into
|
||||
.BR getline ;
|
||||
each call of
|
||||
.B getline
|
||||
returns the next line of output from
|
||||
.IR cmd .
|
||||
In all cases,
|
||||
.B getline
|
||||
returns 1 for a successful input,
|
||||
0 for end of file, and \-1 for an error.
|
||||
.PP
|
||||
Patterns are arbitrary Boolean combinations
|
||||
(with
|
||||
.BR "! || &&" )
|
||||
of regular expressions and
|
||||
relational expressions.
|
||||
Regular expressions are as in
|
||||
.IR egrep ;
|
||||
see
|
||||
.IR grep (1).
|
||||
Isolated regular expressions
|
||||
in a pattern apply to the entire line.
|
||||
Regular expressions may also occur in
|
||||
relational expressions, using the operators
|
||||
.BR ~
|
||||
and
|
||||
.BR !~ .
|
||||
.BI / re /
|
||||
is a constant regular expression;
|
||||
any string (constant or variable) may be used
|
||||
as a regular expression, except in the position of an isolated regular expression
|
||||
in a pattern.
|
||||
.PP
|
||||
A pattern may consist of two patterns separated by a comma;
|
||||
in this case, the action is performed for all lines
|
||||
from an occurrence of the first pattern
|
||||
though an occurrence of the second.
|
||||
.PP
|
||||
A relational expression is one of the following:
|
||||
.IP
|
||||
.I expression matchop regular-expression
|
||||
.br
|
||||
.I expression relop expression
|
||||
.br
|
||||
.IB expression " in " array-name
|
||||
.br
|
||||
.BI ( expr , expr,... ") in " array-name
|
||||
.PP
|
||||
where a relop is any of the six relational operators in C,
|
||||
and a matchop is either
|
||||
.B ~
|
||||
(matches)
|
||||
or
|
||||
.B !~
|
||||
(does not match).
|
||||
A conditional is an arithmetic expression,
|
||||
a relational expression,
|
||||
or a Boolean combination
|
||||
of these.
|
||||
.PP
|
||||
The special patterns
|
||||
.B BEGIN
|
||||
and
|
||||
.B END
|
||||
may be used to capture control before the first input line is read
|
||||
and after the last.
|
||||
.B BEGIN
|
||||
and
|
||||
.B END
|
||||
do not combine with other patterns.
|
||||
.PP
|
||||
Variable names with special meanings:
|
||||
.TF FILENAME
|
||||
.TP
|
||||
.B CONVFMT
|
||||
conversion format used when converting numbers
|
||||
(default
|
||||
.BR "%.6g" )
|
||||
.TP
|
||||
.B FS
|
||||
regular expression used to separate fields; also settable
|
||||
by option
|
||||
.BI \-F fs.
|
||||
.TP
|
||||
.BR NF
|
||||
number of fields in the current record
|
||||
.TP
|
||||
.B NR
|
||||
ordinal number of the current record
|
||||
.TP
|
||||
.B FNR
|
||||
ordinal number of the current record in the current file
|
||||
.TP
|
||||
.B FILENAME
|
||||
the name of the current input file
|
||||
.TP
|
||||
.B RS
|
||||
input record separator (default newline)
|
||||
.TP
|
||||
.B OFS
|
||||
output field separator (default blank)
|
||||
.TP
|
||||
.B ORS
|
||||
output record separator (default newline)
|
||||
.TP
|
||||
.B OFMT
|
||||
output format for numbers (default
|
||||
.BR "%.6g" )
|
||||
.TP
|
||||
.B SUBSEP
|
||||
separates multiple subscripts (default 034)
|
||||
.TP
|
||||
.B ARGC
|
||||
argument count, assignable
|
||||
.TP
|
||||
.B ARGV
|
||||
argument array, assignable;
|
||||
non-null members are taken as filenames
|
||||
.TP
|
||||
.B ENVIRON
|
||||
array of environment variables; subscripts are names.
|
||||
.PD
|
||||
.PP
|
||||
Functions may be defined (at the position of a pattern-action statement) thus:
|
||||
.IP
|
||||
.B
|
||||
function foo(a, b, c) { ...; return x }
|
||||
.PP
|
||||
Parameters are passed by value if scalar and by reference if array name;
|
||||
functions may be called recursively.
|
||||
Parameters are local to the function; all other variables are global.
|
||||
Thus local variables may be created by providing excess parameters in
|
||||
the function definition.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
.EX
|
||||
length($0) > 72
|
||||
.EE
|
||||
Print lines longer than 72 characters.
|
||||
.TP
|
||||
.EX
|
||||
{ print $2, $1 }
|
||||
.EE
|
||||
Print first two fields in opposite order.
|
||||
.PP
|
||||
.EX
|
||||
BEGIN { FS = ",[ \et]*|[ \et]+" }
|
||||
{ print $2, $1 }
|
||||
.EE
|
||||
.ns
|
||||
.IP
|
||||
Same, with input fields separated by comma and/or blanks and tabs.
|
||||
.PP
|
||||
.EX
|
||||
.nf
|
||||
{ s += $1 }
|
||||
END { print "sum is", s, " average is", s/NR }
|
||||
.fi
|
||||
.EE
|
||||
.ns
|
||||
.IP
|
||||
Add up first column, print sum and average.
|
||||
.TP
|
||||
.EX
|
||||
/start/, /stop/
|
||||
.EE
|
||||
Print all lines between start/stop pairs.
|
||||
.PP
|
||||
.EX
|
||||
.nf
|
||||
BEGIN { # Simulate echo(1)
|
||||
for (i = 1; i < ARGC; i++) printf "%s ", ARGV[i]
|
||||
printf "\en"
|
||||
exit }
|
||||
.fi
|
||||
.EE
|
||||
.SH SEE ALSO
|
||||
.IR lex (1),
|
||||
.IR sed (1)
|
||||
.br
|
||||
A. V. Aho, B. W. Kernighan, P. J. Weinberger,
|
||||
.I
|
||||
The AWK Programming Language,
|
||||
Addison-Wesley, 1988. ISBN 0-201-07981-X
|
||||
.SH BUGS
|
||||
There are no explicit conversions between numbers and strings.
|
||||
To force an expression to be treated as a number add 0 to it;
|
||||
to force it to be treated as a string concatenate
|
||||
\&\f(CW""\fP to it.
|
||||
.br
|
||||
The scope rules for variables in functions are a botch;
|
||||
the syntax is worse.
|
||||
@@ -1,231 +0,0 @@
|
||||
/****************************************************************
|
||||
Copyright (C) Lucent Technologies 1997
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name Lucent Technologies or any of
|
||||
its entities not be used in advertising or publicity pertaining
|
||||
to distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
||||
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
|
||||
SPECIAL, 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.
|
||||
****************************************************************/
|
||||
|
||||
typedef double Awkfloat;
|
||||
|
||||
/* unsigned char is more trouble than it's worth */
|
||||
|
||||
typedef unsigned char uschar;
|
||||
|
||||
#define xfree(a) { if ((a) != NULL) { free((char *) a); a = NULL; } }
|
||||
|
||||
#define DEBUG
|
||||
#ifdef DEBUG
|
||||
/* uses have to be doubly parenthesized */
|
||||
# define dprintf(x) if (dbg) printf x
|
||||
#else
|
||||
# define dprintf(x)
|
||||
#endif
|
||||
|
||||
extern char errbuf[];
|
||||
|
||||
extern int compile_time; /* 1 if compiling, 0 if running */
|
||||
extern int safe; /* 0 => unsafe, 1 => safe */
|
||||
|
||||
#define RECSIZE (8 * 1024) /* sets limit on records, fields, etc., etc. */
|
||||
extern int recsize; /* size of current record, orig RECSIZE */
|
||||
|
||||
extern char **FS;
|
||||
extern char **RS;
|
||||
extern char **ORS;
|
||||
extern char **OFS;
|
||||
extern char **OFMT;
|
||||
extern Awkfloat *NR;
|
||||
extern Awkfloat *FNR;
|
||||
extern Awkfloat *NF;
|
||||
extern char **FILENAME;
|
||||
extern char **SUBSEP;
|
||||
extern Awkfloat *RSTART;
|
||||
extern Awkfloat *RLENGTH;
|
||||
|
||||
extern char *record; /* points to $0 */
|
||||
extern int lineno; /* line number in awk program */
|
||||
extern int errorflag; /* 1 if error has occurred */
|
||||
extern int donefld; /* 1 if record broken into fields */
|
||||
extern int donerec; /* 1 if record is valid (no fld has changed */
|
||||
extern char inputFS[]; /* FS at time of input, for field splitting */
|
||||
|
||||
extern int dbg;
|
||||
|
||||
extern char *patbeg; /* beginning of pattern matched */
|
||||
extern int patlen; /* length of pattern matched. set in b.c */
|
||||
|
||||
/* Cell: all information about a variable or constant */
|
||||
|
||||
typedef struct Cell {
|
||||
uschar ctype; /* OCELL, OBOOL, OJUMP, etc. */
|
||||
uschar csub; /* CCON, CTEMP, CFLD, etc. */
|
||||
char *nval; /* name, for variables only */
|
||||
char *sval; /* string value */
|
||||
Awkfloat fval; /* value as number */
|
||||
int tval; /* type info: STR|NUM|ARR|FCN|FLD|CON|DONTFREE */
|
||||
struct Cell *cnext; /* ptr to next if chained */
|
||||
} Cell;
|
||||
|
||||
typedef struct Array { /* symbol table array */
|
||||
int nelem; /* elements in table right now */
|
||||
int size; /* size of tab */
|
||||
Cell **tab; /* hash table pointers */
|
||||
} Array;
|
||||
|
||||
#define NSYMTAB 50 /* initial size of a symbol table */
|
||||
extern Array *symtab;
|
||||
|
||||
extern Cell *nrloc; /* NR */
|
||||
extern Cell *fnrloc; /* FNR */
|
||||
extern Cell *nfloc; /* NF */
|
||||
extern Cell *rstartloc; /* RSTART */
|
||||
extern Cell *rlengthloc; /* RLENGTH */
|
||||
|
||||
/* Cell.tval values: */
|
||||
#define NUM 01 /* number value is valid */
|
||||
#define STR 02 /* string value is valid */
|
||||
#define DONTFREE 04 /* string space is not freeable */
|
||||
#define CON 010 /* this is a constant */
|
||||
#define ARR 020 /* this is an array */
|
||||
#define FCN 040 /* this is a function name */
|
||||
#define FLD 0100 /* this is a field $1, $2, ... */
|
||||
#define REC 0200 /* this is $0 */
|
||||
|
||||
|
||||
/* function types */
|
||||
#define FLENGTH 1
|
||||
#define FSQRT 2
|
||||
#define FEXP 3
|
||||
#define FLOG 4
|
||||
#define FINT 5
|
||||
#define FSYSTEM 6
|
||||
#define FRAND 7
|
||||
#define FSRAND 8
|
||||
#define FSIN 9
|
||||
#define FCOS 10
|
||||
#define FATAN 11
|
||||
#define FTOUPPER 12
|
||||
#define FTOLOWER 13
|
||||
#define FFLUSH 14
|
||||
|
||||
/* Node: parse tree is made of nodes, with Cell's at bottom */
|
||||
|
||||
typedef struct Node {
|
||||
int ntype;
|
||||
struct Node *nnext;
|
||||
int lineno;
|
||||
int nobj;
|
||||
struct Node *narg[1]; /* variable: actual size set by calling malloc */
|
||||
} Node;
|
||||
|
||||
#define NIL ((Node *) 0)
|
||||
|
||||
extern Node *winner;
|
||||
extern Node *nullstat;
|
||||
extern Node *nullnode;
|
||||
|
||||
/* ctypes */
|
||||
#define OCELL 1
|
||||
#define OBOOL 2
|
||||
#define OJUMP 3
|
||||
|
||||
/* Cell subtypes: csub */
|
||||
#define CFREE 7
|
||||
#define CCOPY 6
|
||||
#define CCON 5
|
||||
#define CTEMP 4
|
||||
#define CNAME 3
|
||||
#define CVAR 2
|
||||
#define CFLD 1
|
||||
#define CUNK 0
|
||||
|
||||
/* bool subtypes */
|
||||
#define BTRUE 11
|
||||
#define BFALSE 12
|
||||
|
||||
/* jump subtypes */
|
||||
#define JEXIT 21
|
||||
#define JNEXT 22
|
||||
#define JBREAK 23
|
||||
#define JCONT 24
|
||||
#define JRET 25
|
||||
#define JNEXTFILE 26
|
||||
|
||||
/* node types */
|
||||
#define NVALUE 1
|
||||
#define NSTAT 2
|
||||
#define NEXPR 3
|
||||
|
||||
|
||||
extern int pairstack[], paircnt;
|
||||
|
||||
#define notlegal(n) (n <= FIRSTTOKEN || n >= LASTTOKEN || proctab[n-FIRSTTOKEN] == nullproc)
|
||||
#define isvalue(n) ((n)->ntype == NVALUE)
|
||||
#define isexpr(n) ((n)->ntype == NEXPR)
|
||||
#define isjump(n) ((n)->ctype == OJUMP)
|
||||
#define isexit(n) ((n)->csub == JEXIT)
|
||||
#define isbreak(n) ((n)->csub == JBREAK)
|
||||
#define iscont(n) ((n)->csub == JCONT)
|
||||
#define isnext(n) ((n)->csub == JNEXT || (n)->csub == JNEXTFILE)
|
||||
#define isret(n) ((n)->csub == JRET)
|
||||
#define isrec(n) ((n)->tval & REC)
|
||||
#define isfld(n) ((n)->tval & FLD)
|
||||
#define isstr(n) ((n)->tval & STR)
|
||||
#define isnum(n) ((n)->tval & NUM)
|
||||
#define isarr(n) ((n)->tval & ARR)
|
||||
#define isfcn(n) ((n)->tval & FCN)
|
||||
#define istrue(n) ((n)->csub == BTRUE)
|
||||
#define istemp(n) ((n)->csub == CTEMP)
|
||||
#define isargument(n) ((n)->nobj == ARG)
|
||||
/* #define freeable(p) (!((p)->tval & DONTFREE)) */
|
||||
#define freeable(p) ( ((p)->tval & (STR|DONTFREE)) == STR )
|
||||
|
||||
/* structures used by regular expression matching machinery, mostly b.c: */
|
||||
|
||||
#define NCHARS (256+1) /* 256 handles 8-bit chars; 128 does 7-bit */
|
||||
/* watch out in match(), etc. */
|
||||
#define NSTATES 32
|
||||
|
||||
typedef struct rrow {
|
||||
long ltype; /* long avoids pointer warnings on 64-bit */
|
||||
union {
|
||||
int i;
|
||||
Node *np;
|
||||
uschar *up;
|
||||
} lval; /* because Al stores a pointer in it! */
|
||||
int *lfollow;
|
||||
} rrow;
|
||||
|
||||
typedef struct fa {
|
||||
uschar gototab[NSTATES][NCHARS];
|
||||
uschar out[NSTATES];
|
||||
uschar *restr;
|
||||
int *posns[NSTATES];
|
||||
int anchor;
|
||||
int use;
|
||||
int initstat;
|
||||
int curstat;
|
||||
int accept;
|
||||
int reset;
|
||||
struct rrow re[1]; /* variable: actual size set by calling malloc */
|
||||
} fa;
|
||||
|
||||
|
||||
#include "proto.h"
|
||||
@@ -1,486 +0,0 @@
|
||||
/****************************************************************
|
||||
Copyright (C) Lucent Technologies 1997
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name Lucent Technologies or any of
|
||||
its entities not be used in advertising or publicity pertaining
|
||||
to distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
||||
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
|
||||
SPECIAL, 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 <stdio.h>
|
||||
#include <string.h>
|
||||
#include "awk.h"
|
||||
|
||||
void checkdup(Node *list, Cell *item);
|
||||
int yywrap(void) { return(1); }
|
||||
|
||||
Node *beginloc = 0;
|
||||
Node *endloc = 0;
|
||||
int infunc = 0; /* = 1 if in arglist or body of func */
|
||||
int inloop = 0; /* = 1 if in while, for, do */
|
||||
char *curfname = 0; /* current function name */
|
||||
Node *arglist = 0; /* list of args for current function */
|
||||
%}
|
||||
|
||||
%union {
|
||||
Node *p;
|
||||
Cell *cp;
|
||||
int i;
|
||||
char *s;
|
||||
}
|
||||
|
||||
%token <i> FIRSTTOKEN /* must be first */
|
||||
%token <p> PROGRAM PASTAT PASTAT2 XBEGIN XEND
|
||||
%token <i> NL ',' '{' '(' '|' ';' '/' ')' '}' '[' ']'
|
||||
%token <i> ARRAY
|
||||
%token <i> MATCH NOTMATCH MATCHOP
|
||||
%token <i> FINAL DOT ALL CCL NCCL CHAR OR STAR QUEST PLUS
|
||||
%token <i> AND BOR APPEND EQ GE GT LE LT NE IN
|
||||
%token <i> ARG BLTIN BREAK CLOSE CONTINUE DELETE DO EXIT FOR FUNC
|
||||
%token <i> SUB GSUB IF INDEX LSUBSTR MATCHFCN NEXT NEXTFILE
|
||||
%token <i> ADD MINUS MULT DIVIDE MOD
|
||||
%token <i> ASSIGN ASGNOP ADDEQ SUBEQ MULTEQ DIVEQ MODEQ POWEQ
|
||||
%token <i> PRINT PRINTF SPRINTF
|
||||
%token <p> ELSE INTEST CONDEXPR
|
||||
%token <i> POSTINCR PREINCR POSTDECR PREDECR
|
||||
%token <cp> VAR IVAR VARNF CALL NUMBER STRING
|
||||
%token <s> REGEXPR
|
||||
|
||||
%type <p> pas pattern ppattern plist pplist patlist prarg term re
|
||||
%type <p> pa_pat pa_stat pa_stats
|
||||
%type <s> reg_expr
|
||||
%type <p> simple_stmt opt_simple_stmt stmt stmtlist
|
||||
%type <p> var varname funcname varlist
|
||||
%type <p> for if else while
|
||||
%type <i> do st
|
||||
%type <i> pst opt_pst lbrace rbrace rparen comma nl opt_nl and bor
|
||||
%type <i> subop print
|
||||
|
||||
%right ASGNOP
|
||||
%right '?'
|
||||
%right ':'
|
||||
%left BOR
|
||||
%left AND
|
||||
%left GETLINE
|
||||
%nonassoc APPEND EQ GE GT LE LT NE MATCHOP IN '|'
|
||||
%left ARG BLTIN BREAK CALL CLOSE CONTINUE DELETE DO EXIT FOR FUNC
|
||||
%left GSUB IF INDEX LSUBSTR MATCHFCN NEXT NUMBER
|
||||
%left PRINT PRINTF RETURN SPLIT SPRINTF STRING SUB SUBSTR
|
||||
%left REGEXPR VAR VARNF IVAR WHILE '('
|
||||
%left CAT
|
||||
%left '+' '-'
|
||||
%left '*' '/' '%'
|
||||
%left NOT UMINUS
|
||||
%right POWER
|
||||
%right DECR INCR
|
||||
%left INDIRECT
|
||||
%token LASTTOKEN /* must be last */
|
||||
|
||||
%%
|
||||
|
||||
program:
|
||||
pas { if (errorflag==0)
|
||||
winner = (Node *)stat3(PROGRAM, beginloc, $1, endloc); }
|
||||
| error { yyclearin; bracecheck(); SYNTAX("bailing out"); }
|
||||
;
|
||||
|
||||
and:
|
||||
AND | and NL
|
||||
;
|
||||
|
||||
bor:
|
||||
BOR | bor NL
|
||||
;
|
||||
|
||||
comma:
|
||||
',' | comma NL
|
||||
;
|
||||
|
||||
do:
|
||||
DO | do NL
|
||||
;
|
||||
|
||||
else:
|
||||
ELSE | else NL
|
||||
;
|
||||
|
||||
for:
|
||||
FOR '(' opt_simple_stmt ';' opt_nl pattern ';' opt_nl opt_simple_stmt rparen {inloop++;} stmt
|
||||
{ --inloop; $$ = stat4(FOR, $3, notnull($6), $9, $12); }
|
||||
| FOR '(' opt_simple_stmt ';' ';' opt_nl opt_simple_stmt rparen {inloop++;} stmt
|
||||
{ --inloop; $$ = stat4(FOR, $3, NIL, $7, $10); }
|
||||
| FOR '(' varname IN varname rparen {inloop++;} stmt
|
||||
{ --inloop; $$ = stat3(IN, $3, makearr($5), $8); }
|
||||
;
|
||||
|
||||
funcname:
|
||||
VAR { setfname($1); }
|
||||
| CALL { setfname($1); }
|
||||
;
|
||||
|
||||
if:
|
||||
IF '(' pattern rparen { $$ = notnull($3); }
|
||||
;
|
||||
|
||||
lbrace:
|
||||
'{' | lbrace NL
|
||||
;
|
||||
|
||||
nl:
|
||||
NL | nl NL
|
||||
;
|
||||
|
||||
opt_nl:
|
||||
/* empty */ { $$ = 0; }
|
||||
| nl
|
||||
;
|
||||
|
||||
opt_pst:
|
||||
/* empty */ { $$ = 0; }
|
||||
| pst
|
||||
;
|
||||
|
||||
|
||||
opt_simple_stmt:
|
||||
/* empty */ { $$ = 0; }
|
||||
| simple_stmt
|
||||
;
|
||||
|
||||
pas:
|
||||
opt_pst { $$ = 0; }
|
||||
| opt_pst pa_stats opt_pst { $$ = $2; }
|
||||
;
|
||||
|
||||
pa_pat:
|
||||
pattern { $$ = notnull($1); }
|
||||
;
|
||||
|
||||
pa_stat:
|
||||
pa_pat { $$ = stat2(PASTAT, $1, stat2(PRINT, rectonode(), NIL)); }
|
||||
| pa_pat lbrace stmtlist '}' { $$ = stat2(PASTAT, $1, $3); }
|
||||
| pa_pat ',' pa_pat { $$ = pa2stat($1, $3, stat2(PRINT, rectonode(), NIL)); }
|
||||
| pa_pat ',' pa_pat lbrace stmtlist '}' { $$ = pa2stat($1, $3, $5); }
|
||||
| lbrace stmtlist '}' { $$ = stat2(PASTAT, NIL, $2); }
|
||||
| XBEGIN lbrace stmtlist '}'
|
||||
{ beginloc = linkum(beginloc, $3); $$ = 0; }
|
||||
| XEND lbrace stmtlist '}'
|
||||
{ endloc = linkum(endloc, $3); $$ = 0; }
|
||||
| FUNC funcname '(' varlist rparen {infunc++;} lbrace stmtlist '}'
|
||||
{ infunc--; curfname=0; defn((Cell *)$2, $4, $8); $$ = 0; }
|
||||
;
|
||||
|
||||
pa_stats:
|
||||
pa_stat
|
||||
| pa_stats opt_pst pa_stat { $$ = linkum($1, $3); }
|
||||
;
|
||||
|
||||
patlist:
|
||||
pattern
|
||||
| patlist comma pattern { $$ = linkum($1, $3); }
|
||||
;
|
||||
|
||||
ppattern:
|
||||
var ASGNOP ppattern { $$ = op2($2, $1, $3); }
|
||||
| ppattern '?' ppattern ':' ppattern %prec '?'
|
||||
{ $$ = op3(CONDEXPR, notnull($1), $3, $5); }
|
||||
| ppattern bor ppattern %prec BOR
|
||||
{ $$ = op2(BOR, notnull($1), notnull($3)); }
|
||||
| ppattern and ppattern %prec AND
|
||||
{ $$ = op2(AND, notnull($1), notnull($3)); }
|
||||
| ppattern MATCHOP reg_expr { $$ = op3($2, NIL, $1, (Node*)makedfa($3, 0)); }
|
||||
| ppattern MATCHOP ppattern
|
||||
{ if (constnode($3))
|
||||
$$ = op3($2, NIL, $1, (Node*)makedfa(strnode($3), 0));
|
||||
else
|
||||
$$ = op3($2, (Node *)1, $1, $3); }
|
||||
| ppattern IN varname { $$ = op2(INTEST, $1, makearr($3)); }
|
||||
| '(' plist ')' IN varname { $$ = op2(INTEST, $2, makearr($5)); }
|
||||
| ppattern term %prec CAT { $$ = op2(CAT, $1, $2); }
|
||||
| re
|
||||
| term
|
||||
;
|
||||
|
||||
pattern:
|
||||
var ASGNOP pattern { $$ = op2($2, $1, $3); }
|
||||
| pattern '?' pattern ':' pattern %prec '?'
|
||||
{ $$ = op3(CONDEXPR, notnull($1), $3, $5); }
|
||||
| pattern bor pattern %prec BOR
|
||||
{ $$ = op2(BOR, notnull($1), notnull($3)); }
|
||||
| pattern and pattern %prec AND
|
||||
{ $$ = op2(AND, notnull($1), notnull($3)); }
|
||||
| pattern EQ pattern { $$ = op2($2, $1, $3); }
|
||||
| pattern GE pattern { $$ = op2($2, $1, $3); }
|
||||
| pattern GT pattern { $$ = op2($2, $1, $3); }
|
||||
| pattern LE pattern { $$ = op2($2, $1, $3); }
|
||||
| pattern LT pattern { $$ = op2($2, $1, $3); }
|
||||
| pattern NE pattern { $$ = op2($2, $1, $3); }
|
||||
| pattern MATCHOP reg_expr { $$ = op3($2, NIL, $1, (Node*)makedfa($3, 0)); }
|
||||
| pattern MATCHOP pattern
|
||||
{ if (constnode($3))
|
||||
$$ = op3($2, NIL, $1, (Node*)makedfa(strnode($3), 0));
|
||||
else
|
||||
$$ = op3($2, (Node *)1, $1, $3); }
|
||||
| pattern IN varname { $$ = op2(INTEST, $1, makearr($3)); }
|
||||
| '(' plist ')' IN varname { $$ = op2(INTEST, $2, makearr($5)); }
|
||||
| pattern '|' GETLINE var {
|
||||
if (safe) SYNTAX("cmd | getline is unsafe");
|
||||
else $$ = op3(GETLINE, $4, itonp($2), $1); }
|
||||
| pattern '|' GETLINE {
|
||||
if (safe) SYNTAX("cmd | getline is unsafe");
|
||||
else $$ = op3(GETLINE, (Node*)0, itonp($2), $1); }
|
||||
| pattern term %prec CAT { $$ = op2(CAT, $1, $2); }
|
||||
| re
|
||||
| term
|
||||
;
|
||||
|
||||
plist:
|
||||
pattern comma pattern { $$ = linkum($1, $3); }
|
||||
| plist comma pattern { $$ = linkum($1, $3); }
|
||||
;
|
||||
|
||||
pplist:
|
||||
ppattern
|
||||
| pplist comma ppattern { $$ = linkum($1, $3); }
|
||||
;
|
||||
|
||||
prarg:
|
||||
/* empty */ { $$ = rectonode(); }
|
||||
| pplist
|
||||
| '(' plist ')' { $$ = $2; }
|
||||
;
|
||||
|
||||
print:
|
||||
PRINT | PRINTF
|
||||
;
|
||||
|
||||
pst:
|
||||
NL | ';' | pst NL | pst ';'
|
||||
;
|
||||
|
||||
rbrace:
|
||||
'}' | rbrace NL
|
||||
;
|
||||
|
||||
re:
|
||||
reg_expr
|
||||
{ $$ = op3(MATCH, NIL, rectonode(), (Node*)makedfa($1, 0)); }
|
||||
| NOT re { $$ = op1(NOT, notnull($2)); }
|
||||
;
|
||||
|
||||
reg_expr:
|
||||
'/' {startreg();} REGEXPR '/' { $$ = $3; }
|
||||
;
|
||||
|
||||
rparen:
|
||||
')' | rparen NL
|
||||
;
|
||||
|
||||
simple_stmt:
|
||||
print prarg '|' term {
|
||||
if (safe) SYNTAX("print | is unsafe");
|
||||
else $$ = stat3($1, $2, itonp($3), $4); }
|
||||
| print prarg APPEND term {
|
||||
if (safe) SYNTAX("print >> is unsafe");
|
||||
else $$ = stat3($1, $2, itonp($3), $4); }
|
||||
| print prarg GT term {
|
||||
if (safe) SYNTAX("print > is unsafe");
|
||||
else $$ = stat3($1, $2, itonp($3), $4); }
|
||||
| print prarg { $$ = stat3($1, $2, NIL, NIL); }
|
||||
| DELETE varname '[' patlist ']' { $$ = stat2(DELETE, makearr($2), $4); }
|
||||
| DELETE varname { $$ = stat2(DELETE, makearr($2), 0); }
|
||||
| pattern { $$ = exptostat($1); }
|
||||
| error { yyclearin; SYNTAX("illegal statement"); }
|
||||
;
|
||||
|
||||
st:
|
||||
nl
|
||||
| ';' opt_nl
|
||||
;
|
||||
|
||||
stmt:
|
||||
BREAK st { if (!inloop) SYNTAX("break illegal outside of loops");
|
||||
$$ = stat1(BREAK, NIL); }
|
||||
| CONTINUE st { if (!inloop) SYNTAX("continue illegal outside of loops");
|
||||
$$ = stat1(CONTINUE, NIL); }
|
||||
| do {inloop++;} stmt {--inloop;} WHILE '(' pattern ')' st
|
||||
{ $$ = stat2(DO, $3, notnull($7)); }
|
||||
| EXIT pattern st { $$ = stat1(EXIT, $2); }
|
||||
| EXIT st { $$ = stat1(EXIT, NIL); }
|
||||
| for
|
||||
| if stmt else stmt { $$ = stat3(IF, $1, $2, $4); }
|
||||
| if stmt { $$ = stat3(IF, $1, $2, NIL); }
|
||||
| lbrace stmtlist rbrace { $$ = $2; }
|
||||
| NEXT st { if (infunc)
|
||||
SYNTAX("next is illegal inside a function");
|
||||
$$ = stat1(NEXT, NIL); }
|
||||
| NEXTFILE st { if (infunc)
|
||||
SYNTAX("nextfile is illegal inside a function");
|
||||
$$ = stat1(NEXTFILE, NIL); }
|
||||
| RETURN pattern st { $$ = stat1(RETURN, $2); }
|
||||
| RETURN st { $$ = stat1(RETURN, NIL); }
|
||||
| simple_stmt st
|
||||
| while {inloop++;} stmt { --inloop; $$ = stat2(WHILE, $1, $3); }
|
||||
| ';' opt_nl { $$ = 0; }
|
||||
;
|
||||
|
||||
stmtlist:
|
||||
stmt
|
||||
| stmtlist stmt { $$ = linkum($1, $2); }
|
||||
;
|
||||
|
||||
subop:
|
||||
SUB | GSUB
|
||||
;
|
||||
|
||||
term:
|
||||
term '/' ASGNOP term { $$ = op2(DIVEQ, $1, $4); }
|
||||
| term '+' term { $$ = op2(ADD, $1, $3); }
|
||||
| term '-' term { $$ = op2(MINUS, $1, $3); }
|
||||
| term '*' term { $$ = op2(MULT, $1, $3); }
|
||||
| term '/' term { $$ = op2(DIVIDE, $1, $3); }
|
||||
| term '%' term { $$ = op2(MOD, $1, $3); }
|
||||
| term POWER term { $$ = op2(POWER, $1, $3); }
|
||||
| '-' term %prec UMINUS { $$ = op1(UMINUS, $2); }
|
||||
| '+' term %prec UMINUS { $$ = $2; }
|
||||
| NOT term %prec UMINUS { $$ = op1(NOT, notnull($2)); }
|
||||
| BLTIN '(' ')' { $$ = op2(BLTIN, itonp($1), rectonode()); }
|
||||
| BLTIN '(' patlist ')' { $$ = op2(BLTIN, itonp($1), $3); }
|
||||
| BLTIN { $$ = op2(BLTIN, itonp($1), rectonode()); }
|
||||
| CALL '(' ')' { $$ = op2(CALL, celltonode($1,CVAR), NIL); }
|
||||
| CALL '(' patlist ')' { $$ = op2(CALL, celltonode($1,CVAR), $3); }
|
||||
| CLOSE term { $$ = op1(CLOSE, $2); }
|
||||
| DECR var { $$ = op1(PREDECR, $2); }
|
||||
| INCR var { $$ = op1(PREINCR, $2); }
|
||||
| var DECR { $$ = op1(POSTDECR, $1); }
|
||||
| var INCR { $$ = op1(POSTINCR, $1); }
|
||||
| GETLINE var LT term { $$ = op3(GETLINE, $2, itonp($3), $4); }
|
||||
| GETLINE LT term { $$ = op3(GETLINE, NIL, itonp($2), $3); }
|
||||
| GETLINE var { $$ = op3(GETLINE, $2, NIL, NIL); }
|
||||
| GETLINE { $$ = op3(GETLINE, NIL, NIL, NIL); }
|
||||
| INDEX '(' pattern comma pattern ')'
|
||||
{ $$ = op2(INDEX, $3, $5); }
|
||||
| INDEX '(' pattern comma reg_expr ')'
|
||||
{ SYNTAX("index() doesn't permit regular expressions");
|
||||
$$ = op2(INDEX, $3, (Node*)$5); }
|
||||
| '(' pattern ')' { $$ = $2; }
|
||||
| MATCHFCN '(' pattern comma reg_expr ')'
|
||||
{ $$ = op3(MATCHFCN, NIL, $3, (Node*)makedfa($5, 1)); }
|
||||
| MATCHFCN '(' pattern comma pattern ')'
|
||||
{ if (constnode($5))
|
||||
$$ = op3(MATCHFCN, NIL, $3, (Node*)makedfa(strnode($5), 1));
|
||||
else
|
||||
$$ = op3(MATCHFCN, (Node *)1, $3, $5); }
|
||||
| NUMBER { $$ = celltonode($1, CCON); }
|
||||
| SPLIT '(' pattern comma varname comma pattern ')' /* string */
|
||||
{ $$ = op4(SPLIT, $3, makearr($5), $7, (Node*)STRING); }
|
||||
| SPLIT '(' pattern comma varname comma reg_expr ')' /* const /regexp/ */
|
||||
{ $$ = op4(SPLIT, $3, makearr($5), (Node*)makedfa($7, 1), (Node *)REGEXPR); }
|
||||
| SPLIT '(' pattern comma varname ')'
|
||||
{ $$ = op4(SPLIT, $3, makearr($5), NIL, (Node*)STRING); } /* default */
|
||||
| SPRINTF '(' patlist ')' { $$ = op1($1, $3); }
|
||||
| STRING { $$ = celltonode($1, CCON); }
|
||||
| subop '(' reg_expr comma pattern ')'
|
||||
{ $$ = op4($1, NIL, (Node*)makedfa($3, 1), $5, rectonode()); }
|
||||
| subop '(' pattern comma pattern ')'
|
||||
{ if (constnode($3))
|
||||
$$ = op4($1, NIL, (Node*)makedfa(strnode($3), 1), $5, rectonode());
|
||||
else
|
||||
$$ = op4($1, (Node *)1, $3, $5, rectonode()); }
|
||||
| subop '(' reg_expr comma pattern comma var ')'
|
||||
{ $$ = op4($1, NIL, (Node*)makedfa($3, 1), $5, $7); }
|
||||
| subop '(' pattern comma pattern comma var ')'
|
||||
{ if (constnode($3))
|
||||
$$ = op4($1, NIL, (Node*)makedfa(strnode($3), 1), $5, $7);
|
||||
else
|
||||
$$ = op4($1, (Node *)1, $3, $5, $7); }
|
||||
| SUBSTR '(' pattern comma pattern comma pattern ')'
|
||||
{ $$ = op3(SUBSTR, $3, $5, $7); }
|
||||
| SUBSTR '(' pattern comma pattern ')'
|
||||
{ $$ = op3(SUBSTR, $3, $5, NIL); }
|
||||
| var
|
||||
;
|
||||
|
||||
var:
|
||||
varname
|
||||
| varname '[' patlist ']' { $$ = op2(ARRAY, makearr($1), $3); }
|
||||
| IVAR { $$ = op1(INDIRECT, celltonode($1, CVAR)); }
|
||||
| INDIRECT term { $$ = op1(INDIRECT, $2); }
|
||||
;
|
||||
|
||||
varlist:
|
||||
/* nothing */ { arglist = $$ = 0; }
|
||||
| VAR { arglist = $$ = celltonode($1,CVAR); }
|
||||
| varlist comma VAR {
|
||||
checkdup($1, $3);
|
||||
arglist = $$ = linkum($1,celltonode($3,CVAR)); }
|
||||
;
|
||||
|
||||
varname:
|
||||
VAR { $$ = celltonode($1, CVAR); }
|
||||
| ARG { $$ = op1(ARG, itonp($1)); }
|
||||
| VARNF { $$ = op1(VARNF, (Node *) $1); }
|
||||
;
|
||||
|
||||
|
||||
while:
|
||||
WHILE '(' pattern rparen { $$ = notnull($3); }
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
void setfname(Cell *p)
|
||||
{
|
||||
if (isarr(p))
|
||||
SYNTAX("%s is an array, not a function", p->nval);
|
||||
else if (isfcn(p))
|
||||
SYNTAX("you can't define function %s more than once", p->nval);
|
||||
curfname = p->nval;
|
||||
}
|
||||
|
||||
int constnode(Node *p)
|
||||
{
|
||||
return isvalue(p) && ((Cell *) (p->narg[0]))->csub == CCON;
|
||||
}
|
||||
|
||||
char *strnode(Node *p)
|
||||
{
|
||||
return ((Cell *)(p->narg[0]))->sval;
|
||||
}
|
||||
|
||||
Node *notnull(Node *n)
|
||||
{
|
||||
switch (n->nobj) {
|
||||
case LE: case LT: case EQ: case NE: case GT: case GE:
|
||||
case BOR: case AND: case NOT:
|
||||
return n;
|
||||
default:
|
||||
return op2(NE, n, nullnode);
|
||||
}
|
||||
}
|
||||
|
||||
void checkdup(Node *vl, Cell *cp) /* check if name already in list */
|
||||
{
|
||||
char *s = cp->nval;
|
||||
for ( ; vl; vl = vl->nnext) {
|
||||
if (strcmp(s, ((Cell *)(vl->narg[0]))->nval) == 0) {
|
||||
SYNTAX("duplicate argument %s", s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,682 +0,0 @@
|
||||
/****************************************************************
|
||||
Copyright (C) Lucent Technologies 1997
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name Lucent Technologies or any of
|
||||
its entities not be used in advertising or publicity pertaining
|
||||
to distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
||||
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
|
||||
SPECIAL, 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.
|
||||
****************************************************************/
|
||||
|
||||
#define DEBUG
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include "awk.h"
|
||||
#include "ytab.h"
|
||||
|
||||
FILE *infile = NULL;
|
||||
char *file = "";
|
||||
char *record;
|
||||
int recsize = RECSIZE;
|
||||
char *fields;
|
||||
int fieldssize = RECSIZE;
|
||||
|
||||
Cell **fldtab; /* pointers to Cells */
|
||||
char inputFS[100] = " ";
|
||||
|
||||
#define MAXFLD 200
|
||||
int nfields = MAXFLD; /* last allocated slot for $i */
|
||||
|
||||
int donefld; /* 1 = implies rec broken into fields */
|
||||
int donerec; /* 1 = record is valid (no flds have changed) */
|
||||
|
||||
int lastfld = 0; /* last used field */
|
||||
int argno = 1; /* current input argument number */
|
||||
extern Awkfloat *ARGC;
|
||||
|
||||
static Cell dollar0 = { OCELL, CFLD, NULL, "", 0.0, REC|STR|DONTFREE };
|
||||
static Cell dollar1 = { OCELL, CFLD, NULL, "", 0.0, FLD|STR|DONTFREE };
|
||||
|
||||
void recinit(unsigned int n)
|
||||
{
|
||||
record = (char *) malloc(n);
|
||||
fields = (char *) malloc(n);
|
||||
fldtab = (Cell **) malloc((nfields+1) * sizeof(Cell *));
|
||||
if (record == NULL || fields == NULL || fldtab == NULL)
|
||||
FATAL("out of space for $0 and fields");
|
||||
|
||||
fldtab[0] = (Cell *) malloc(sizeof (Cell));
|
||||
*fldtab[0] = dollar0;
|
||||
fldtab[0]->sval = record;
|
||||
fldtab[0]->nval = tostring("0");
|
||||
makefields(1, nfields);
|
||||
}
|
||||
|
||||
void makefields(int n1, int n2) /* create $n1..$n2 inclusive */
|
||||
{
|
||||
char temp[50];
|
||||
int i;
|
||||
|
||||
for (i = n1; i <= n2; i++) {
|
||||
fldtab[i] = (Cell *) malloc(sizeof (struct Cell));
|
||||
if (fldtab[i] == NULL)
|
||||
FATAL("out of space in makefields %d", i);
|
||||
*fldtab[i] = dollar1;
|
||||
sprintf(temp, "%d", i);
|
||||
fldtab[i]->nval = tostring(temp);
|
||||
}
|
||||
}
|
||||
|
||||
void initgetrec(void)
|
||||
{
|
||||
int i;
|
||||
char *p;
|
||||
|
||||
for (i = 1; i < *ARGC; i++) {
|
||||
if (!isclvar(p = getargv(i))) { /* find 1st real filename */
|
||||
setsval(lookup("FILENAME", symtab), getargv(i));
|
||||
return;
|
||||
}
|
||||
setclvar(p); /* a commandline assignment before filename */
|
||||
argno++;
|
||||
}
|
||||
infile = stdin; /* no filenames, so use stdin */
|
||||
}
|
||||
|
||||
int getrec(char **pbuf, int *pbufsize, int isrecord) /* get next input record */
|
||||
{ /* note: cares whether buf == record */
|
||||
int c;
|
||||
static int firsttime = 1;
|
||||
char *buf = *pbuf;
|
||||
int bufsize = *pbufsize;
|
||||
|
||||
if (firsttime) {
|
||||
firsttime = 0;
|
||||
initgetrec();
|
||||
}
|
||||
dprintf( ("RS=<%s>, FS=<%s>, ARGC=%g, FILENAME=%s\n",
|
||||
*RS, *FS, *ARGC, *FILENAME) );
|
||||
if (isrecord) {
|
||||
donefld = 0;
|
||||
donerec = 1;
|
||||
}
|
||||
buf[0] = 0;
|
||||
while (argno < *ARGC || infile == stdin) {
|
||||
dprintf( ("argno=%d, file=|%s|\n", argno, file) );
|
||||
if (infile == NULL) { /* have to open a new file */
|
||||
file = getargv(argno);
|
||||
if (*file == '\0') { /* it's been zapped */
|
||||
argno++;
|
||||
continue;
|
||||
}
|
||||
if (isclvar(file)) { /* a var=value arg */
|
||||
setclvar(file);
|
||||
argno++;
|
||||
continue;
|
||||
}
|
||||
*FILENAME = file;
|
||||
dprintf( ("opening file %s\n", file) );
|
||||
if (*file == '-' && *(file+1) == '\0')
|
||||
infile = stdin;
|
||||
else if ((infile = fopen(file, "r")) == NULL)
|
||||
FATAL("can't open file %s", file);
|
||||
setfval(fnrloc, 0.0);
|
||||
}
|
||||
c = readrec(&buf, &bufsize, infile);
|
||||
if (c != 0 || buf[0] != '\0') { /* normal record */
|
||||
if (isrecord) {
|
||||
if (freeable(fldtab[0]))
|
||||
xfree(fldtab[0]->sval);
|
||||
fldtab[0]->sval = buf; /* buf == record */
|
||||
fldtab[0]->tval = REC | STR | DONTFREE;
|
||||
if (is_number(fldtab[0]->sval)) {
|
||||
fldtab[0]->fval = atof(fldtab[0]->sval);
|
||||
fldtab[0]->tval |= NUM;
|
||||
}
|
||||
}
|
||||
setfval(nrloc, nrloc->fval+1);
|
||||
setfval(fnrloc, fnrloc->fval+1);
|
||||
*pbuf = buf;
|
||||
*pbufsize = bufsize;
|
||||
return 1;
|
||||
}
|
||||
/* EOF arrived on this file; set up next */
|
||||
if (infile != stdin)
|
||||
fclose(infile);
|
||||
infile = NULL;
|
||||
argno++;
|
||||
}
|
||||
*pbuf = buf;
|
||||
*pbufsize = bufsize;
|
||||
return 0; /* true end of file */
|
||||
}
|
||||
|
||||
void nextfile(void)
|
||||
{
|
||||
if (infile != stdin)
|
||||
fclose(infile);
|
||||
infile = NULL;
|
||||
argno++;
|
||||
}
|
||||
|
||||
int readrec(char **pbuf, int *pbufsize, FILE *inf) /* read one record into buf */
|
||||
{
|
||||
int sep, c;
|
||||
char *rr, *buf = *pbuf;
|
||||
int bufsize = *pbufsize;
|
||||
|
||||
if (strlen(*FS) >= sizeof(inputFS))
|
||||
FATAL("field separator %.10s... is too long", *FS);
|
||||
strcpy(inputFS, *FS); /* for subsequent field splitting */
|
||||
if ((sep = **RS) == 0) {
|
||||
sep = '\n';
|
||||
while ((c=getc(inf)) == '\n' && c != EOF) /* skip leading \n's */
|
||||
;
|
||||
if (c != EOF)
|
||||
ungetc(c, inf);
|
||||
}
|
||||
for (rr = buf; ; ) {
|
||||
for (; (c=getc(inf)) != sep && c != EOF; ) {
|
||||
if (rr-buf+1 > bufsize)
|
||||
if (!adjbuf(&buf, &bufsize, 1+rr-buf, recsize, &rr, "readrec 1"))
|
||||
FATAL("input record `%.30s...' too long", buf);
|
||||
*rr++ = c;
|
||||
}
|
||||
if (**RS == sep || c == EOF)
|
||||
break;
|
||||
if ((c = getc(inf)) == '\n' || c == EOF) /* 2 in a row */
|
||||
break;
|
||||
if (!adjbuf(&buf, &bufsize, 2+rr-buf, recsize, &rr, "readrec 2"))
|
||||
FATAL("input record `%.30s...' too long", buf);
|
||||
*rr++ = '\n';
|
||||
*rr++ = c;
|
||||
}
|
||||
if (!adjbuf(&buf, &bufsize, 1+rr-buf, recsize, &rr, "readrec 3"))
|
||||
FATAL("input record `%.30s...' too long", buf);
|
||||
*rr = 0;
|
||||
dprintf( ("readrec saw <%s>, returns %d\n", buf, c == EOF && rr == buf ? 0 : 1) );
|
||||
*pbuf = buf;
|
||||
*pbufsize = bufsize;
|
||||
return c == EOF && rr == buf ? 0 : 1;
|
||||
}
|
||||
|
||||
char *getargv(int n) /* get ARGV[n] */
|
||||
{
|
||||
Cell *x;
|
||||
char *s, temp[50];
|
||||
extern Array *ARGVtab;
|
||||
|
||||
sprintf(temp, "%d", n);
|
||||
x = setsymtab(temp, "", 0.0, STR, ARGVtab);
|
||||
s = getsval(x);
|
||||
dprintf( ("getargv(%d) returns |%s|\n", n, s) );
|
||||
return s;
|
||||
}
|
||||
|
||||
void setclvar(char *s) /* set var=value from s */
|
||||
{
|
||||
char *p;
|
||||
Cell *q;
|
||||
|
||||
for (p=s; *p != '='; p++)
|
||||
;
|
||||
*p++ = 0;
|
||||
p = qstring(p, '\0');
|
||||
q = setsymtab(s, p, 0.0, STR, symtab);
|
||||
setsval(q, p);
|
||||
if (is_number(q->sval)) {
|
||||
q->fval = atof(q->sval);
|
||||
q->tval |= NUM;
|
||||
}
|
||||
dprintf( ("command line set %s to |%s|\n", s, p) );
|
||||
}
|
||||
|
||||
|
||||
void fldbld(void) /* create fields from current record */
|
||||
{
|
||||
/* this relies on having fields[] the same length as $0 */
|
||||
/* the fields are all stored in this one array with \0's */
|
||||
char *r, *fr, sep;
|
||||
Cell *p;
|
||||
int i, j, n;
|
||||
|
||||
if (donefld)
|
||||
return;
|
||||
if (!isstr(fldtab[0]))
|
||||
getsval(fldtab[0]);
|
||||
r = fldtab[0]->sval;
|
||||
n = strlen(r);
|
||||
if (n > fieldssize) {
|
||||
xfree(fields);
|
||||
if ((fields = (char *) malloc(n+1)) == NULL)
|
||||
FATAL("out of space for fields in fldbld %d", n);
|
||||
fieldssize = n;
|
||||
}
|
||||
fr = fields;
|
||||
i = 0; /* number of fields accumulated here */
|
||||
if (strlen(inputFS) > 1) { /* it's a regular expression */
|
||||
i = refldbld(r, inputFS);
|
||||
} else if ((sep = *inputFS) == ' ') { /* default whitespace */
|
||||
for (i = 0; ; ) {
|
||||
while (*r == ' ' || *r == '\t' || *r == '\n')
|
||||
r++;
|
||||
if (*r == 0)
|
||||
break;
|
||||
i++;
|
||||
if (i > nfields)
|
||||
growfldtab(i);
|
||||
if (freeable(fldtab[i]))
|
||||
xfree(fldtab[i]->sval);
|
||||
fldtab[i]->sval = fr;
|
||||
fldtab[i]->tval = FLD | STR | DONTFREE;
|
||||
do
|
||||
*fr++ = *r++;
|
||||
while (*r != ' ' && *r != '\t' && *r != '\n' && *r != '\0');
|
||||
*fr++ = 0;
|
||||
}
|
||||
*fr = 0;
|
||||
} else if ((sep = *inputFS) == 0) { /* new: FS="" => 1 char/field */
|
||||
for (i = 0; *r != 0; r++) {
|
||||
char buf[2];
|
||||
i++;
|
||||
if (i > nfields)
|
||||
growfldtab(i);
|
||||
if (freeable(fldtab[i]))
|
||||
xfree(fldtab[i]->sval);
|
||||
buf[0] = *r;
|
||||
buf[1] = 0;
|
||||
fldtab[i]->sval = tostring(buf);
|
||||
fldtab[i]->tval = FLD | STR;
|
||||
}
|
||||
*fr = 0;
|
||||
} else if (*r != 0) { /* if 0, it's a null field */
|
||||
for (;;) {
|
||||
i++;
|
||||
if (i > nfields)
|
||||
growfldtab(i);
|
||||
if (freeable(fldtab[i]))
|
||||
xfree(fldtab[i]->sval);
|
||||
fldtab[i]->sval = fr;
|
||||
fldtab[i]->tval = FLD | STR | DONTFREE;
|
||||
while (*r != sep && *r != '\n' && *r != '\0') /* \n is always a separator */
|
||||
*fr++ = *r++;
|
||||
*fr++ = 0;
|
||||
if (*r++ == 0)
|
||||
break;
|
||||
}
|
||||
*fr = 0;
|
||||
}
|
||||
if (i > nfields)
|
||||
FATAL("record `%.30s...' has too many fields; can't happen", r);
|
||||
cleanfld(i+1, lastfld); /* clean out junk from previous record */
|
||||
lastfld = i;
|
||||
donefld = 1;
|
||||
for (j = 1; j <= lastfld; j++) {
|
||||
p = fldtab[j];
|
||||
if(is_number(p->sval)) {
|
||||
p->fval = atof(p->sval);
|
||||
p->tval |= NUM;
|
||||
}
|
||||
}
|
||||
setfval(nfloc, (Awkfloat) lastfld);
|
||||
if (dbg) {
|
||||
for (j = 0; j <= lastfld; j++) {
|
||||
p = fldtab[j];
|
||||
printf("field %d (%s): |%s|\n", j, p->nval, p->sval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cleanfld(int n1, int n2) /* clean out fields n1 .. n2 inclusive */
|
||||
{ /* nvals remain intact */
|
||||
Cell *p;
|
||||
int i;
|
||||
|
||||
for (i = n1; i <= n2; i++) {
|
||||
p = fldtab[i];
|
||||
if (freeable(p))
|
||||
xfree(p->sval);
|
||||
p->sval = "";
|
||||
p->tval = FLD | STR | DONTFREE;
|
||||
}
|
||||
}
|
||||
|
||||
void newfld(int n) /* add field n after end of existing lastfld */
|
||||
{
|
||||
if (n > nfields)
|
||||
growfldtab(n);
|
||||
cleanfld(lastfld+1, n);
|
||||
lastfld = n;
|
||||
setfval(nfloc, (Awkfloat) n);
|
||||
}
|
||||
|
||||
Cell *fieldadr(int n) /* get nth field */
|
||||
{
|
||||
if (n < 0)
|
||||
FATAL("trying to access field %d", n);
|
||||
if (n > nfields) /* fields after NF are empty */
|
||||
growfldtab(n); /* but does not increase NF */
|
||||
return(fldtab[n]);
|
||||
}
|
||||
|
||||
void growfldtab(int n) /* make new fields up to at least $n */
|
||||
{
|
||||
int nf = 2 * nfields;
|
||||
|
||||
if (n > nf)
|
||||
nf = n;
|
||||
fldtab = (Cell **) realloc(fldtab, (nf+1) * (sizeof (struct Cell *)));
|
||||
if (fldtab == NULL)
|
||||
FATAL("out of space creating %d fields", nf);
|
||||
makefields(nfields+1, nf);
|
||||
nfields = nf;
|
||||
}
|
||||
|
||||
int refldbld(char *rec, char *fs) /* build fields from reg expr in FS */
|
||||
{
|
||||
/* this relies on having fields[] the same length as $0 */
|
||||
/* the fields are all stored in this one array with \0's */
|
||||
char *fr;
|
||||
int i, tempstat, n;
|
||||
fa *pfa;
|
||||
|
||||
n = strlen(rec);
|
||||
if (n > fieldssize) {
|
||||
xfree(fields);
|
||||
if ((fields = (char *) malloc(n+1)) == NULL)
|
||||
FATAL("out of space for fields in refldbld %d", n);
|
||||
fieldssize = n;
|
||||
}
|
||||
fr = fields;
|
||||
*fr = '\0';
|
||||
if (*rec == '\0')
|
||||
return 0;
|
||||
pfa = makedfa(fs, 1);
|
||||
dprintf( ("into refldbld, rec = <%s>, pat = <%s>\n", rec, fs) );
|
||||
tempstat = pfa->initstat;
|
||||
for (i = 1; ; i++) {
|
||||
if (i > nfields)
|
||||
growfldtab(i);
|
||||
if (freeable(fldtab[i]))
|
||||
xfree(fldtab[i]->sval);
|
||||
fldtab[i]->tval = FLD | STR | DONTFREE;
|
||||
fldtab[i]->sval = fr;
|
||||
dprintf( ("refldbld: i=%d\n", i) );
|
||||
if (nematch(pfa, rec)) {
|
||||
pfa->initstat = 2; /* horrible coupling to b.c */
|
||||
dprintf( ("match %s (%d chars)\n", patbeg, patlen) );
|
||||
strncpy(fr, rec, patbeg-rec);
|
||||
fr += patbeg - rec + 1;
|
||||
*(fr-1) = '\0';
|
||||
rec = patbeg + patlen;
|
||||
} else {
|
||||
dprintf( ("no match %s\n", rec) );
|
||||
strcpy(fr, rec);
|
||||
pfa->initstat = tempstat;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void recbld(void) /* create $0 from $1..$NF if necessary */
|
||||
{
|
||||
int i;
|
||||
char *r, *p;
|
||||
|
||||
if (donerec == 1)
|
||||
return;
|
||||
r = record;
|
||||
for (i = 1; i <= *NF; i++) {
|
||||
p = getsval(fldtab[i]);
|
||||
if (!adjbuf(&record, &recsize, 1+strlen(p)+r-record, recsize, &r, "recbld 1"))
|
||||
FATAL("created $0 `%.30s...' too long", record);
|
||||
while ((*r = *p++) != 0)
|
||||
r++;
|
||||
if (i < *NF) {
|
||||
if (!adjbuf(&record, &recsize, 2+strlen(*OFS)+r-record, recsize, &r, "recbld 2"))
|
||||
FATAL("created $0 `%.30s...' too long", record);
|
||||
for (p = *OFS; (*r = *p++) != 0; )
|
||||
r++;
|
||||
}
|
||||
}
|
||||
if (!adjbuf(&record, &recsize, 2+r-record, recsize, &r, "recbld 3"))
|
||||
FATAL("built giant record `%.30s...'", record);
|
||||
*r = '\0';
|
||||
dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, fldtab[0]) );
|
||||
|
||||
if (freeable(fldtab[0]))
|
||||
xfree(fldtab[0]->sval);
|
||||
fldtab[0]->tval = REC | STR | DONTFREE;
|
||||
fldtab[0]->sval = record;
|
||||
|
||||
dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, fldtab[0]) );
|
||||
dprintf( ("recbld = |%s|\n", record) );
|
||||
donerec = 1;
|
||||
}
|
||||
|
||||
int errorflag = 0;
|
||||
|
||||
void yyerror(char *s)
|
||||
{
|
||||
SYNTAX(s);
|
||||
}
|
||||
|
||||
void SYNTAX(char *fmt, ...)
|
||||
{
|
||||
extern char *cmdname, *curfname;
|
||||
static int been_here = 0;
|
||||
va_list varg;
|
||||
|
||||
if (been_here++ > 2)
|
||||
return;
|
||||
fprintf(stderr, "%s: ", cmdname);
|
||||
va_start(varg, fmt);
|
||||
vfprintf(stderr, fmt, varg);
|
||||
va_end(varg);
|
||||
fprintf(stderr, " at source line %d", lineno);
|
||||
if (curfname != NULL)
|
||||
fprintf(stderr, " in function %s", curfname);
|
||||
if (compile_time == 1 && cursource() != NULL)
|
||||
fprintf(stderr, " source file %s", cursource());
|
||||
fprintf(stderr, "\n");
|
||||
errorflag = 2;
|
||||
eprint();
|
||||
}
|
||||
|
||||
void fpecatch(int n)
|
||||
{
|
||||
FATAL("floating point exception %d", n);
|
||||
}
|
||||
|
||||
extern int bracecnt, brackcnt, parencnt;
|
||||
|
||||
void bracecheck(void)
|
||||
{
|
||||
int c;
|
||||
static int beenhere = 0;
|
||||
|
||||
if (beenhere++)
|
||||
return;
|
||||
while ((c = input()) != EOF && c != '\0')
|
||||
bclass(c);
|
||||
bcheck2(bracecnt, '{', '}');
|
||||
bcheck2(brackcnt, '[', ']');
|
||||
bcheck2(parencnt, '(', ')');
|
||||
}
|
||||
|
||||
void bcheck2(int n, int c1, int c2)
|
||||
{
|
||||
if (n == 1)
|
||||
fprintf(stderr, "\tmissing %c\n", c2);
|
||||
else if (n > 1)
|
||||
fprintf(stderr, "\t%d missing %c's\n", n, c2);
|
||||
else if (n == -1)
|
||||
fprintf(stderr, "\textra %c\n", c2);
|
||||
else if (n < -1)
|
||||
fprintf(stderr, "\t%d extra %c's\n", -n, c2);
|
||||
}
|
||||
|
||||
void FATAL(char *fmt, ...)
|
||||
{
|
||||
extern char *cmdname;
|
||||
va_list varg;
|
||||
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "%s: ", cmdname);
|
||||
va_start(varg, fmt);
|
||||
vfprintf(stderr, fmt, varg);
|
||||
va_end(varg);
|
||||
error();
|
||||
if (dbg > 1) /* core dump if serious debugging on */
|
||||
abort();
|
||||
exit(2);
|
||||
}
|
||||
|
||||
void WARNING(char *fmt, ...)
|
||||
{
|
||||
extern char *cmdname;
|
||||
va_list varg;
|
||||
|
||||
fflush(stdout);
|
||||
fprintf(stderr, "%s: ", cmdname);
|
||||
va_start(varg, fmt);
|
||||
vfprintf(stderr, fmt, varg);
|
||||
va_end(varg);
|
||||
error();
|
||||
}
|
||||
|
||||
void error()
|
||||
{
|
||||
extern Node *curnode;
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
if (compile_time != 2 && NR && *NR > 0) {
|
||||
fprintf(stderr, " input record number %d", (int) (*FNR));
|
||||
if (strcmp(*FILENAME, "-") != 0)
|
||||
fprintf(stderr, ", file %s", *FILENAME);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (compile_time != 2 && curnode)
|
||||
fprintf(stderr, " source line number %d", curnode->lineno);
|
||||
else if (compile_time != 2 && lineno)
|
||||
fprintf(stderr, " source line number %d", lineno);
|
||||
if (compile_time == 1 && cursource() != NULL)
|
||||
fprintf(stderr, " source file %s", cursource());
|
||||
fprintf(stderr, "\n");
|
||||
eprint();
|
||||
}
|
||||
|
||||
void eprint(void) /* try to print context around error */
|
||||
{
|
||||
char *p, *q;
|
||||
int c;
|
||||
static int been_here = 0;
|
||||
extern char ebuf[], *ep;
|
||||
|
||||
if (compile_time == 2 || compile_time == 0 || been_here++ > 0)
|
||||
return;
|
||||
p = ep - 1;
|
||||
if (p > ebuf && *p == '\n')
|
||||
p--;
|
||||
for ( ; p > ebuf && *p != '\n' && *p != '\0'; p--)
|
||||
;
|
||||
while (*p == '\n')
|
||||
p++;
|
||||
fprintf(stderr, " context is\n\t");
|
||||
for (q=ep-1; q>=p && *q!=' ' && *q!='\t' && *q!='\n'; q--)
|
||||
;
|
||||
for ( ; p < q; p++)
|
||||
if (*p)
|
||||
putc(*p, stderr);
|
||||
fprintf(stderr, " >>> ");
|
||||
for ( ; p < ep; p++)
|
||||
if (*p)
|
||||
putc(*p, stderr);
|
||||
fprintf(stderr, " <<< ");
|
||||
if (*ep)
|
||||
while ((c = input()) != '\n' && c != '\0' && c != EOF) {
|
||||
putc(c, stderr);
|
||||
bclass(c);
|
||||
}
|
||||
putc('\n', stderr);
|
||||
ep = ebuf;
|
||||
}
|
||||
|
||||
void bclass(int c)
|
||||
{
|
||||
switch (c) {
|
||||
case '{': bracecnt++; break;
|
||||
case '}': bracecnt--; break;
|
||||
case '[': brackcnt++; break;
|
||||
case ']': brackcnt--; break;
|
||||
case '(': parencnt++; break;
|
||||
case ')': parencnt--; break;
|
||||
}
|
||||
}
|
||||
|
||||
double errcheck(double x, char *s)
|
||||
{
|
||||
|
||||
if (errno == EDOM) {
|
||||
errno = 0;
|
||||
WARNING("%s argument out of domain", s);
|
||||
x = 1;
|
||||
} else if (errno == ERANGE) {
|
||||
errno = 0;
|
||||
WARNING("%s result out of range", s);
|
||||
x = 1;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
int isclvar(char *s) /* is s of form var=something ? */
|
||||
{
|
||||
char *os = s;
|
||||
|
||||
if (!isalpha((uschar) *s) && *s != '_')
|
||||
return 0;
|
||||
for ( ; *s; s++)
|
||||
if (!(isalnum((uschar) *s) || *s == '_'))
|
||||
break;
|
||||
return *s == '=' && s > os && *(s+1) != '=';
|
||||
}
|
||||
|
||||
/* strtod is supposed to be a proper test of what's a valid number */
|
||||
/* appears to be broken in gcc on linux: thinks 0x123 is a valid FP number */
|
||||
/* wrong: violates 4.10.1.4 of ansi C standard */
|
||||
|
||||
#include <math.h>
|
||||
int is_number(char *s)
|
||||
{
|
||||
double r;
|
||||
char *ep;
|
||||
errno = 0;
|
||||
r = strtod(s, &ep);
|
||||
if (ep == s || r == HUGE_VAL || errno == ERANGE)
|
||||
return 0;
|
||||
while (*ep == ' ' || *ep == '\t' || *ep == '\n')
|
||||
ep++;
|
||||
if (*ep == '\0')
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
This file contains a make shell script and a version
|
||||
of the file missing95.c for the Mac, courtesy of
|
||||
Dan Allen.
|
||||
|
||||
make shell script:
|
||||
|
||||
# MPW Shell script to build Awk using Apple's MRC compiler.
|
||||
# 22 Jan 1999 - Created by Dan Allen.
|
||||
# 25 Mar 1999 - Updated for newer Awk.
|
||||
#
|
||||
# Porting notes for the Mac:
|
||||
#
|
||||
# 1. main in main.c needs to have its prototype changed to:
|
||||
#
|
||||
# int main(int argc, char *argv[], char *environ[])
|
||||
#
|
||||
# 2. popen and pclose in missing95.c need to have as their body the
|
||||
# older style
|
||||
#
|
||||
# return NULL;
|
||||
#
|
||||
# as parallel pipes are not supported by MPW.
|
||||
#
|
||||
# 3. To make your Mac more responsive while long awk scripts run,
|
||||
# you may want to add some SpinCursor calls to support cooperative multitasking.
|
||||
#
|
||||
# All of these minor changes can be put under "#ifdef powerc" for portability's sake.
|
||||
#
|
||||
#
|
||||
|
||||
If {1} == "clean"
|
||||
Delete -i awk maketab maketab.c.o ytab.c.o b.c.o main.c.o parse.c.o proctab.c proctab.c.o tran.c.o lib.c.o run.c.o lex.c.o missing95.c.o
|
||||
Else
|
||||
MRC ytab.c -w off -opt speed
|
||||
MRC b.c -w off -opt speed
|
||||
MRC main.c -w off -opt speed
|
||||
MRC parse.c -w off -opt speed
|
||||
MRC maketab.c -w off -opt speed
|
||||
PPCLink -o maketab maketab.c.o "{PPCLibraries}InterfaceLib" "{PPCLibraries}MathLib" "{PPCLibraries}StdCLib" "{PPCLibraries}StdCRuntime.o" "{PPCLibraries}PPCCRuntime.o" "{PPCLibraries}PPCToolLibs.o" -t MPST -c 'MPS '
|
||||
maketab > proctab.c
|
||||
MRC proctab.c -w off -opt speed
|
||||
MRC tran.c -w off -opt speed
|
||||
MRC lib.c -w off -opt speed
|
||||
MRC run.c -w off -opt speed
|
||||
MRC lex.c -w off -opt speed
|
||||
MRC missing95.c -w off -opt speed
|
||||
PPCLink -o awk ytab.c.o b.c.o main.c.o parse.c.o proctab.c.o tran.c.o lib.c.o run.c.o lex.c.o missing95.c.o "{PPCLibraries}InterfaceLib" "{PPCLibraries}MathLib" "{PPCLibraries}StdCLib" "{PPCLibraries}StdCRuntime.o" "{PPCLibraries}PPCCRuntime.o" "{PPCLibraries}PPCToolLibs.o" -d
|
||||
SetFile awk -d . -m . -t MPST -c 'MPS '
|
||||
End
|
||||
|
||||
|
||||
missing95.c for the Mac:
|
||||
|
||||
/* popen and pclose are not available on the Mac. */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
FILE *popen(char *s, char *m) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int pclose(FILE *f) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
/****************************************************************
|
||||
Copyright (C) Lucent Technologies 1997
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name Lucent Technologies or any of
|
||||
its entities not be used in advertising or publicity pertaining
|
||||
to distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
||||
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
|
||||
SPECIAL, 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.
|
||||
****************************************************************/
|
||||
|
||||
/*
|
||||
* this program makes the table to link function names
|
||||
* and type indices that is used by execute() in run.c.
|
||||
* it finds the indices in ytab.h, produced by yacc.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "awk.h"
|
||||
#include "ytab.h"
|
||||
|
||||
struct xx
|
||||
{ int token;
|
||||
char *name;
|
||||
char *pname;
|
||||
} proc[] = {
|
||||
{ PROGRAM, "program", NULL },
|
||||
{ BOR, "boolop", " || " },
|
||||
{ AND, "boolop", " && " },
|
||||
{ NOT, "boolop", " !" },
|
||||
{ NE, "relop", " != " },
|
||||
{ EQ, "relop", " == " },
|
||||
{ LE, "relop", " <= " },
|
||||
{ LT, "relop", " < " },
|
||||
{ GE, "relop", " >= " },
|
||||
{ GT, "relop", " > " },
|
||||
{ ARRAY, "array", NULL },
|
||||
{ INDIRECT, "indirect", "$(" },
|
||||
{ SUBSTR, "substr", "substr" },
|
||||
{ SUB, "sub", "sub" },
|
||||
{ GSUB, "gsub", "gsub" },
|
||||
{ INDEX, "sindex", "sindex" },
|
||||
{ SPRINTF, "awksprintf", "sprintf " },
|
||||
{ ADD, "arith", " + " },
|
||||
{ MINUS, "arith", " - " },
|
||||
{ MULT, "arith", " * " },
|
||||
{ DIVIDE, "arith", " / " },
|
||||
{ MOD, "arith", " % " },
|
||||
{ UMINUS, "arith", " -" },
|
||||
{ POWER, "arith", " **" },
|
||||
{ PREINCR, "incrdecr", "++" },
|
||||
{ POSTINCR, "incrdecr", "++" },
|
||||
{ PREDECR, "incrdecr", "--" },
|
||||
{ POSTDECR, "incrdecr", "--" },
|
||||
{ CAT, "cat", " " },
|
||||
{ PASTAT, "pastat", NULL },
|
||||
{ PASTAT2, "dopa2", NULL },
|
||||
{ MATCH, "matchop", " ~ " },
|
||||
{ NOTMATCH, "matchop", " !~ " },
|
||||
{ MATCHFCN, "matchop", "matchop" },
|
||||
{ INTEST, "intest", "intest" },
|
||||
{ PRINTF, "awkprintf", "printf" },
|
||||
{ PRINT, "printstat", "print" },
|
||||
{ CLOSE, "closefile", "closefile" },
|
||||
{ DELETE, "awkdelete", "awkdelete" },
|
||||
{ SPLIT, "split", "split" },
|
||||
{ ASSIGN, "assign", " = " },
|
||||
{ ADDEQ, "assign", " += " },
|
||||
{ SUBEQ, "assign", " -= " },
|
||||
{ MULTEQ, "assign", " *= " },
|
||||
{ DIVEQ, "assign", " /= " },
|
||||
{ MODEQ, "assign", " %= " },
|
||||
{ POWEQ, "assign", " ^= " },
|
||||
{ CONDEXPR, "condexpr", " ?: " },
|
||||
{ IF, "ifstat", "if(" },
|
||||
{ WHILE, "whilestat", "while(" },
|
||||
{ FOR, "forstat", "for(" },
|
||||
{ DO, "dostat", "do" },
|
||||
{ IN, "instat", "instat" },
|
||||
{ NEXT, "jump", "next" },
|
||||
{ NEXTFILE, "jump", "nextfile" },
|
||||
{ EXIT, "jump", "exit" },
|
||||
{ BREAK, "jump", "break" },
|
||||
{ CONTINUE, "jump", "continue" },
|
||||
{ RETURN, "jump", "ret" },
|
||||
{ BLTIN, "bltin", "bltin" },
|
||||
{ CALL, "call", "call" },
|
||||
{ ARG, "arg", "arg" },
|
||||
{ VARNF, "getnf", "NF" },
|
||||
{ GETLINE, "getline", "getline" },
|
||||
{ 0, "", "" },
|
||||
};
|
||||
|
||||
#define SIZE (LASTTOKEN - FIRSTTOKEN + 1)
|
||||
char *table[SIZE];
|
||||
char *names[SIZE];
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct xx *p;
|
||||
int i, n, tok;
|
||||
char c;
|
||||
FILE *fp;
|
||||
char buf[200], name[200], def[200];
|
||||
|
||||
printf("#include <stdio.h>\n");
|
||||
printf("#include \"awk.h\"\n");
|
||||
printf("#include \"ytab.h\"\n\n");
|
||||
for (i = SIZE; --i >= 0; )
|
||||
names[i] = "";
|
||||
|
||||
if ((fp = fopen("ytab.h", "r")) == NULL) {
|
||||
fprintf(stderr, "maketab can't open ytab.h!\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("static char *printname[%d] = {\n", SIZE);
|
||||
i = 0;
|
||||
while (fgets(buf, sizeof buf, fp) != NULL) {
|
||||
n = sscanf(buf, "%1c %s %s %d", &c, def, name, &tok);
|
||||
if (c != '#' || (n != 4 && strcmp(def,"define") != 0)) /* not a valid #define */
|
||||
continue;
|
||||
if (tok < FIRSTTOKEN || tok > LASTTOKEN) {
|
||||
fprintf(stderr, "maketab funny token %d %s ignored\n", tok, buf);
|
||||
continue;
|
||||
}
|
||||
names[tok-FIRSTTOKEN] = (char *) malloc(strlen(name)+1);
|
||||
strcpy(names[tok-FIRSTTOKEN], name);
|
||||
printf("\t(char *) \"%s\",\t/* %d */\n", name, tok);
|
||||
i++;
|
||||
}
|
||||
printf("};\n\n");
|
||||
|
||||
for (p=proc; p->token!=0; p++)
|
||||
table[p->token-FIRSTTOKEN] = p->name;
|
||||
printf("\nCell *(*proctab[%d])(Node **, int) = {\n", SIZE);
|
||||
for (i=0; i<SIZE; i++)
|
||||
if (table[i]==0)
|
||||
printf("\tnullproc,\t/* %s */\n", names[i]);
|
||||
else
|
||||
printf("\t%s,\t/* %s */\n", table[i], names[i]);
|
||||
printf("};\n\n");
|
||||
|
||||
printf("char *tokname(int n)\n"); /* print a tokname() function */
|
||||
printf("{\n");
|
||||
printf(" static char buf[100];\n\n");
|
||||
printf(" if (n < FIRSTTOKEN || n > LASTTOKEN) {\n");
|
||||
printf(" sprintf(buf, \"token %%d\", n);\n");
|
||||
printf(" return buf;\n");
|
||||
printf(" }\n");
|
||||
printf(" return printname[n-FIRSTTOKEN];\n");
|
||||
printf("}\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
/****************************************************************
|
||||
Copyright (C) Lucent Technologies 1997
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name Lucent Technologies or any of
|
||||
its entities not be used in advertising or publicity pertaining
|
||||
to distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
||||
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
|
||||
SPECIAL, 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.
|
||||
****************************************************************/
|
||||
|
||||
#define DEBUG
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "awk.h"
|
||||
#include "ytab.h"
|
||||
|
||||
Node *nodealloc(int n)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = (Node *) malloc(sizeof(Node) + (n-1)*sizeof(Node *));
|
||||
if (x == NULL)
|
||||
FATAL("out of space in nodealloc");
|
||||
x->nnext = NULL;
|
||||
x->lineno = lineno;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *exptostat(Node *a)
|
||||
{
|
||||
a->ntype = NSTAT;
|
||||
return(a);
|
||||
}
|
||||
|
||||
Node *node1(int a, Node *b)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = nodealloc(1);
|
||||
x->nobj = a;
|
||||
x->narg[0]=b;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *node2(int a, Node *b, Node *c)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = nodealloc(2);
|
||||
x->nobj = a;
|
||||
x->narg[0] = b;
|
||||
x->narg[1] = c;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *node3(int a, Node *b, Node *c, Node *d)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = nodealloc(3);
|
||||
x->nobj = a;
|
||||
x->narg[0] = b;
|
||||
x->narg[1] = c;
|
||||
x->narg[2] = d;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *node4(int a, Node *b, Node *c, Node *d, Node *e)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = nodealloc(4);
|
||||
x->nobj = a;
|
||||
x->narg[0] = b;
|
||||
x->narg[1] = c;
|
||||
x->narg[2] = d;
|
||||
x->narg[3] = e;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *stat1(int a, Node *b)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = node1(a,b);
|
||||
x->ntype = NSTAT;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *stat2(int a, Node *b, Node *c)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = node2(a,b,c);
|
||||
x->ntype = NSTAT;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *stat3(int a, Node *b, Node *c, Node *d)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = node3(a,b,c,d);
|
||||
x->ntype = NSTAT;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *stat4(int a, Node *b, Node *c, Node *d, Node *e)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = node4(a,b,c,d,e);
|
||||
x->ntype = NSTAT;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *op1(int a, Node *b)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = node1(a,b);
|
||||
x->ntype = NEXPR;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *op2(int a, Node *b, Node *c)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = node2(a,b,c);
|
||||
x->ntype = NEXPR;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *op3(int a, Node *b, Node *c, Node *d)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = node3(a,b,c,d);
|
||||
x->ntype = NEXPR;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *op4(int a, Node *b, Node *c, Node *d, Node *e)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = node4(a,b,c,d,e);
|
||||
x->ntype = NEXPR;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *celltonode(Cell *a, int b)
|
||||
{
|
||||
Node *x;
|
||||
|
||||
a->ctype = OCELL;
|
||||
a->csub = b;
|
||||
x = node1(0, (Node *) a);
|
||||
x->ntype = NVALUE;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *rectonode(void) /* make $0 into a Node */
|
||||
{
|
||||
extern Cell *literal0;
|
||||
return op1(INDIRECT, celltonode(literal0, CUNK));
|
||||
}
|
||||
|
||||
Node *makearr(Node *p)
|
||||
{
|
||||
Cell *cp;
|
||||
|
||||
if (isvalue(p)) {
|
||||
cp = (Cell *) (p->narg[0]);
|
||||
if (isfcn(cp))
|
||||
SYNTAX( "%s is a function, not an array", cp->nval );
|
||||
else if (!isarr(cp)) {
|
||||
xfree(cp->sval);
|
||||
cp->sval = (char *) makesymtab(NSYMTAB);
|
||||
cp->tval = ARR;
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
#define PA2NUM 50 /* max number of pat,pat patterns allowed */
|
||||
int paircnt; /* number of them in use */
|
||||
int pairstack[PA2NUM]; /* state of each pat,pat */
|
||||
|
||||
Node *pa2stat(Node *a, Node *b, Node *c) /* pat, pat {...} */
|
||||
{
|
||||
Node *x;
|
||||
|
||||
x = node4(PASTAT2, a, b, c, itonp(paircnt));
|
||||
if (paircnt++ >= PA2NUM)
|
||||
SYNTAX( "limited to %d pat,pat statements", PA2NUM );
|
||||
x->ntype = NSTAT;
|
||||
return(x);
|
||||
}
|
||||
|
||||
Node *linkum(Node *a, Node *b)
|
||||
{
|
||||
Node *c;
|
||||
|
||||
if (errorflag) /* don't link things that are wrong */
|
||||
return a;
|
||||
if (a == NULL)
|
||||
return(b);
|
||||
else if (b == NULL)
|
||||
return(a);
|
||||
for (c = a; c->nnext != NULL; c = c->nnext)
|
||||
;
|
||||
c->nnext = b;
|
||||
return(a);
|
||||
}
|
||||
|
||||
void defn(Cell *v, Node *vl, Node *st) /* turn on FCN bit in definition, */
|
||||
{ /* body of function, arglist */
|
||||
Node *p;
|
||||
int n;
|
||||
|
||||
if (isarr(v)) {
|
||||
SYNTAX( "`%s' is an array name and a function name", v->nval );
|
||||
return;
|
||||
}
|
||||
if (isarg(v->nval) != -1) {
|
||||
SYNTAX( "`%s' is both function name and argument name", v->nval );
|
||||
return;
|
||||
}
|
||||
|
||||
v->tval = FCN;
|
||||
v->sval = (char *) st;
|
||||
n = 0; /* count arguments */
|
||||
for (p = vl; p; p = p->nnext)
|
||||
n++;
|
||||
v->fval = n;
|
||||
dprintf( ("defining func %s (%d args)\n", v->nval, n) );
|
||||
}
|
||||
|
||||
int isarg(char *s) /* is s in argument list for current function? */
|
||||
{ /* return -1 if not, otherwise arg # */
|
||||
extern Node *arglist;
|
||||
Node *p = arglist;
|
||||
int n;
|
||||
|
||||
for (n = 0; p != 0; p = p->nnext, n++)
|
||||
if (strcmp(((Cell *)(p->narg[0]))->nval, s) == 0)
|
||||
return n;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ptoi(void *p) /* convert pointer to integer */
|
||||
{
|
||||
return (int) (long) p; /* swearing that p fits, of course */
|
||||
}
|
||||
|
||||
Node *itonp(int i) /* and vice versa */
|
||||
{
|
||||
return (Node *) (long) i;
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include "awk.h"
|
||||
#include "ytab.h"
|
||||
|
||||
static char *printname[92] = {
|
||||
(char *) "FIRSTTOKEN", /* 57346 */
|
||||
(char *) "PROGRAM", /* 57347 */
|
||||
(char *) "PASTAT", /* 57348 */
|
||||
(char *) "PASTAT2", /* 57349 */
|
||||
(char *) "XBEGIN", /* 57350 */
|
||||
(char *) "XEND", /* 57351 */
|
||||
(char *) "NL", /* 57352 */
|
||||
(char *) "ARRAY", /* 57353 */
|
||||
(char *) "MATCH", /* 57354 */
|
||||
(char *) "NOTMATCH", /* 57355 */
|
||||
(char *) "MATCHOP", /* 57356 */
|
||||
(char *) "FINAL", /* 57357 */
|
||||
(char *) "DOT", /* 57358 */
|
||||
(char *) "ALL", /* 57359 */
|
||||
(char *) "CCL", /* 57360 */
|
||||
(char *) "NCCL", /* 57361 */
|
||||
(char *) "CHAR", /* 57362 */
|
||||
(char *) "OR", /* 57363 */
|
||||
(char *) "STAR", /* 57364 */
|
||||
(char *) "QUEST", /* 57365 */
|
||||
(char *) "PLUS", /* 57366 */
|
||||
(char *) "AND", /* 57367 */
|
||||
(char *) "BOR", /* 57368 */
|
||||
(char *) "APPEND", /* 57369 */
|
||||
(char *) "EQ", /* 57370 */
|
||||
(char *) "GE", /* 57371 */
|
||||
(char *) "GT", /* 57372 */
|
||||
(char *) "LE", /* 57373 */
|
||||
(char *) "LT", /* 57374 */
|
||||
(char *) "NE", /* 57375 */
|
||||
(char *) "IN", /* 57376 */
|
||||
(char *) "ARG", /* 57377 */
|
||||
(char *) "BLTIN", /* 57378 */
|
||||
(char *) "BREAK", /* 57379 */
|
||||
(char *) "CLOSE", /* 57380 */
|
||||
(char *) "CONTINUE", /* 57381 */
|
||||
(char *) "DELETE", /* 57382 */
|
||||
(char *) "DO", /* 57383 */
|
||||
(char *) "EXIT", /* 57384 */
|
||||
(char *) "FOR", /* 57385 */
|
||||
(char *) "FUNC", /* 57386 */
|
||||
(char *) "SUB", /* 57387 */
|
||||
(char *) "GSUB", /* 57388 */
|
||||
(char *) "IF", /* 57389 */
|
||||
(char *) "INDEX", /* 57390 */
|
||||
(char *) "LSUBSTR", /* 57391 */
|
||||
(char *) "MATCHFCN", /* 57392 */
|
||||
(char *) "NEXT", /* 57393 */
|
||||
(char *) "NEXTFILE", /* 57394 */
|
||||
(char *) "ADD", /* 57395 */
|
||||
(char *) "MINUS", /* 57396 */
|
||||
(char *) "MULT", /* 57397 */
|
||||
(char *) "DIVIDE", /* 57398 */
|
||||
(char *) "MOD", /* 57399 */
|
||||
(char *) "ASSIGN", /* 57400 */
|
||||
(char *) "ASGNOP", /* 57401 */
|
||||
(char *) "ADDEQ", /* 57402 */
|
||||
(char *) "SUBEQ", /* 57403 */
|
||||
(char *) "MULTEQ", /* 57404 */
|
||||
(char *) "DIVEQ", /* 57405 */
|
||||
(char *) "MODEQ", /* 57406 */
|
||||
(char *) "POWEQ", /* 57407 */
|
||||
(char *) "PRINT", /* 57408 */
|
||||
(char *) "PRINTF", /* 57409 */
|
||||
(char *) "SPRINTF", /* 57410 */
|
||||
(char *) "ELSE", /* 57411 */
|
||||
(char *) "INTEST", /* 57412 */
|
||||
(char *) "CONDEXPR", /* 57413 */
|
||||
(char *) "POSTINCR", /* 57414 */
|
||||
(char *) "PREINCR", /* 57415 */
|
||||
(char *) "POSTDECR", /* 57416 */
|
||||
(char *) "PREDECR", /* 57417 */
|
||||
(char *) "VAR", /* 57418 */
|
||||
(char *) "IVAR", /* 57419 */
|
||||
(char *) "VARNF", /* 57420 */
|
||||
(char *) "CALL", /* 57421 */
|
||||
(char *) "NUMBER", /* 57422 */
|
||||
(char *) "STRING", /* 57423 */
|
||||
(char *) "REGEXPR", /* 57424 */
|
||||
(char *) "GETLINE", /* 57425 */
|
||||
(char *) "RETURN", /* 57426 */
|
||||
(char *) "SPLIT", /* 57427 */
|
||||
(char *) "SUBSTR", /* 57428 */
|
||||
(char *) "WHILE", /* 57429 */
|
||||
(char *) "CAT", /* 57430 */
|
||||
(char *) "NOT", /* 57431 */
|
||||
(char *) "UMINUS", /* 57432 */
|
||||
(char *) "POWER", /* 57433 */
|
||||
(char *) "DECR", /* 57434 */
|
||||
(char *) "INCR", /* 57435 */
|
||||
(char *) "INDIRECT", /* 57436 */
|
||||
(char *) "LASTTOKEN", /* 57437 */
|
||||
};
|
||||
|
||||
|
||||
Cell *(*proctab[92])(Node **, int) = {
|
||||
nullproc, /* FIRSTTOKEN */
|
||||
program, /* PROGRAM */
|
||||
pastat, /* PASTAT */
|
||||
dopa2, /* PASTAT2 */
|
||||
nullproc, /* XBEGIN */
|
||||
nullproc, /* XEND */
|
||||
nullproc, /* NL */
|
||||
array, /* ARRAY */
|
||||
matchop, /* MATCH */
|
||||
matchop, /* NOTMATCH */
|
||||
nullproc, /* MATCHOP */
|
||||
nullproc, /* FINAL */
|
||||
nullproc, /* DOT */
|
||||
nullproc, /* ALL */
|
||||
nullproc, /* CCL */
|
||||
nullproc, /* NCCL */
|
||||
nullproc, /* CHAR */
|
||||
nullproc, /* OR */
|
||||
nullproc, /* STAR */
|
||||
nullproc, /* QUEST */
|
||||
nullproc, /* PLUS */
|
||||
boolop, /* AND */
|
||||
boolop, /* BOR */
|
||||
nullproc, /* APPEND */
|
||||
relop, /* EQ */
|
||||
relop, /* GE */
|
||||
relop, /* GT */
|
||||
relop, /* LE */
|
||||
relop, /* LT */
|
||||
relop, /* NE */
|
||||
instat, /* IN */
|
||||
arg, /* ARG */
|
||||
bltin, /* BLTIN */
|
||||
jump, /* BREAK */
|
||||
closefile, /* CLOSE */
|
||||
jump, /* CONTINUE */
|
||||
awkdelete, /* DELETE */
|
||||
dostat, /* DO */
|
||||
jump, /* EXIT */
|
||||
forstat, /* FOR */
|
||||
nullproc, /* FUNC */
|
||||
sub, /* SUB */
|
||||
gsub, /* GSUB */
|
||||
ifstat, /* IF */
|
||||
sindex, /* INDEX */
|
||||
nullproc, /* LSUBSTR */
|
||||
matchop, /* MATCHFCN */
|
||||
jump, /* NEXT */
|
||||
jump, /* NEXTFILE */
|
||||
arith, /* ADD */
|
||||
arith, /* MINUS */
|
||||
arith, /* MULT */
|
||||
arith, /* DIVIDE */
|
||||
arith, /* MOD */
|
||||
assign, /* ASSIGN */
|
||||
nullproc, /* ASGNOP */
|
||||
assign, /* ADDEQ */
|
||||
assign, /* SUBEQ */
|
||||
assign, /* MULTEQ */
|
||||
assign, /* DIVEQ */
|
||||
assign, /* MODEQ */
|
||||
assign, /* POWEQ */
|
||||
printstat, /* PRINT */
|
||||
awkprintf, /* PRINTF */
|
||||
awksprintf, /* SPRINTF */
|
||||
nullproc, /* ELSE */
|
||||
intest, /* INTEST */
|
||||
condexpr, /* CONDEXPR */
|
||||
incrdecr, /* POSTINCR */
|
||||
incrdecr, /* PREINCR */
|
||||
incrdecr, /* POSTDECR */
|
||||
incrdecr, /* PREDECR */
|
||||
nullproc, /* VAR */
|
||||
nullproc, /* IVAR */
|
||||
getnf, /* VARNF */
|
||||
call, /* CALL */
|
||||
nullproc, /* NUMBER */
|
||||
nullproc, /* STRING */
|
||||
nullproc, /* REGEXPR */
|
||||
getline, /* GETLINE */
|
||||
jump, /* RETURN */
|
||||
split, /* SPLIT */
|
||||
substr, /* SUBSTR */
|
||||
whilestat, /* WHILE */
|
||||
cat, /* CAT */
|
||||
boolop, /* NOT */
|
||||
arith, /* UMINUS */
|
||||
arith, /* POWER */
|
||||
nullproc, /* DECR */
|
||||
nullproc, /* INCR */
|
||||
indirect, /* INDIRECT */
|
||||
nullproc, /* LASTTOKEN */
|
||||
};
|
||||
|
||||
char *tokname(int n)
|
||||
{
|
||||
static char buf[100];
|
||||
|
||||
if (n < FIRSTTOKEN || n > LASTTOKEN) {
|
||||
sprintf(buf, "token %d", n);
|
||||
return buf;
|
||||
}
|
||||
return printname[n-FIRSTTOKEN];
|
||||
}
|
||||
@@ -1,194 +0,0 @@
|
||||
/****************************************************************
|
||||
Copyright (C) Lucent Technologies 1997
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and
|
||||
its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notice appear in all
|
||||
copies and that both that the copyright notice and this
|
||||
permission notice and warranty disclaimer appear in supporting
|
||||
documentation, and that the name Lucent Technologies or any of
|
||||
its entities not be used in advertising or publicity pertaining
|
||||
to distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
||||
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
|
||||
SPECIAL, 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.
|
||||
****************************************************************/
|
||||
|
||||
extern int yywrap(void);
|
||||
extern void setfname(Cell *);
|
||||
extern int constnode(Node *);
|
||||
extern char *strnode(Node *);
|
||||
extern Node *notnull(Node *);
|
||||
extern int yyparse(void);
|
||||
|
||||
extern int yylex(void);
|
||||
extern void startreg(void);
|
||||
extern int input(void);
|
||||
extern void unput(int);
|
||||
extern void unputstr(char *);
|
||||
extern int yylook(void);
|
||||
extern int yyback(int *, int);
|
||||
extern int yyinput(void);
|
||||
|
||||
extern fa *makedfa(char *, int);
|
||||
extern fa *mkdfa(char *, int);
|
||||
extern int makeinit(fa *, int);
|
||||
extern void penter(Node *);
|
||||
extern void freetr(Node *);
|
||||
extern int hexstr(char **);
|
||||
extern int quoted(char **);
|
||||
extern char *cclenter(char *);
|
||||
extern void overflo(char *);
|
||||
extern void cfoll(fa *, Node *);
|
||||
extern int first(Node *);
|
||||
extern void follow(Node *);
|
||||
extern int member(int, char *);
|
||||
extern int match(fa *, char *);
|
||||
extern int pmatch(fa *, char *);
|
||||
extern int nematch(fa *, char *);
|
||||
extern Node *reparse(char *);
|
||||
extern Node *regexp(void);
|
||||
extern Node *primary(void);
|
||||
extern Node *concat(Node *);
|
||||
extern Node *alt(Node *);
|
||||
extern Node *unary(Node *);
|
||||
extern int relex(void);
|
||||
extern int cgoto(fa *, int, int);
|
||||
extern void freefa(fa *);
|
||||
|
||||
extern int pgetc(void);
|
||||
extern char *cursource(void);
|
||||
|
||||
extern Node *nodealloc(int);
|
||||
extern Node *exptostat(Node *);
|
||||
extern Node *node1(int, Node *);
|
||||
extern Node *node2(int, Node *, Node *);
|
||||
extern Node *node3(int, Node *, Node *, Node *);
|
||||
extern Node *node4(int, Node *, Node *, Node *, Node *);
|
||||
extern Node *stat3(int, Node *, Node *, Node *);
|
||||
extern Node *op2(int, Node *, Node *);
|
||||
extern Node *op1(int, Node *);
|
||||
extern Node *stat1(int, Node *);
|
||||
extern Node *op3(int, Node *, Node *, Node *);
|
||||
extern Node *op4(int, Node *, Node *, Node *, Node *);
|
||||
extern Node *stat2(int, Node *, Node *);
|
||||
extern Node *stat4(int, Node *, Node *, Node *, Node *);
|
||||
extern Node *celltonode(Cell *, int);
|
||||
extern Node *rectonode(void);
|
||||
extern Node *makearr(Node *);
|
||||
extern Node *pa2stat(Node *, Node *, Node *);
|
||||
extern Node *linkum(Node *, Node *);
|
||||
extern void defn(Cell *, Node *, Node *);
|
||||
extern int isarg(char *);
|
||||
extern char *tokname(int);
|
||||
extern Cell *(*proctab[])(Node **, int);
|
||||
extern int ptoi(void *);
|
||||
extern Node *itonp(int);
|
||||
|
||||
extern void syminit(void);
|
||||
extern void arginit(int, char **);
|
||||
extern void envinit(char **);
|
||||
extern Array *makesymtab(int);
|
||||
extern void freesymtab(Cell *);
|
||||
extern void freeelem(Cell *, char *);
|
||||
extern Cell *setsymtab(char *, char *, double, unsigned int, Array *);
|
||||
extern int hash(char *, int);
|
||||
extern void rehash(Array *);
|
||||
extern Cell *lookup(char *, Array *);
|
||||
extern double setfval(Cell *, double);
|
||||
extern void funnyvar(Cell *, char *);
|
||||
extern char *setsval(Cell *, char *);
|
||||
extern double getfval(Cell *);
|
||||
extern char *getsval(Cell *);
|
||||
extern char *tostring(char *);
|
||||
extern char *qstring(char *, int);
|
||||
|
||||
extern void recinit(unsigned int);
|
||||
extern void initgetrec(void);
|
||||
extern void makefields(int, int);
|
||||
extern void growfldtab(int n);
|
||||
extern int getrec(char **, int *, int);
|
||||
extern void nextfile(void);
|
||||
extern int readrec(char **buf, int *bufsize, FILE *inf);
|
||||
extern char *getargv(int);
|
||||
extern void setclvar(char *);
|
||||
extern void fldbld(void);
|
||||
extern void cleanfld(int, int);
|
||||
extern void newfld(int);
|
||||
extern int refldbld(char *, char *);
|
||||
extern void recbld(void);
|
||||
extern Cell *fieldadr(int);
|
||||
extern void yyerror(char *);
|
||||
extern void fpecatch(int);
|
||||
extern void bracecheck(void);
|
||||
extern void bcheck2(int, int, int);
|
||||
extern void SYNTAX(char *, ...);
|
||||
extern void FATAL(char *, ...);
|
||||
extern void WARNING(char *, ...);
|
||||
extern void error(void);
|
||||
extern void eprint(void);
|
||||
extern void bclass(int);
|
||||
extern double errcheck(double, char *);
|
||||
extern int isclvar(char *);
|
||||
extern int is_number(char *);
|
||||
|
||||
extern int adjbuf(char **pb, int *sz, int min, int q, char **pbp, char *what);
|
||||
extern void run(Node *);
|
||||
extern Cell *execute(Node *);
|
||||
extern Cell *program(Node **, int);
|
||||
extern Cell *call(Node **, int);
|
||||
extern Cell *copycell(Cell *);
|
||||
extern Cell *arg(Node **, int);
|
||||
extern Cell *jump(Node **, int);
|
||||
extern Cell *getline(Node **, int);
|
||||
extern Cell *getnf(Node **, int);
|
||||
extern Cell *array(Node **, int);
|
||||
extern Cell *awkdelete(Node **, int);
|
||||
extern Cell *intest(Node **, int);
|
||||
extern Cell *matchop(Node **, int);
|
||||
extern Cell *boolop(Node **, int);
|
||||
extern Cell *relop(Node **, int);
|
||||
extern void tfree(Cell *);
|
||||
extern Cell *gettemp(void);
|
||||
extern Cell *field(Node **, int);
|
||||
extern Cell *indirect(Node **, int);
|
||||
extern Cell *substr(Node **, int);
|
||||
extern Cell *sindex(Node **, int);
|
||||
extern int format(char **, int *, char *, Node *);
|
||||
extern Cell *awksprintf(Node **, int);
|
||||
extern Cell *awkprintf(Node **, int);
|
||||
extern Cell *arith(Node **, int);
|
||||
extern double ipow(double, int);
|
||||
extern Cell *incrdecr(Node **, int);
|
||||
extern Cell *assign(Node **, int);
|
||||
extern Cell *cat(Node **, int);
|
||||
extern Cell *pastat(Node **, int);
|
||||
extern Cell *dopa2(Node **, int);
|
||||
extern Cell *split(Node **, int);
|
||||
extern Cell *condexpr(Node **, int);
|
||||
extern Cell *ifstat(Node **, int);
|
||||
extern Cell *whilestat(Node **, int);
|
||||
extern Cell *dostat(Node **, int);
|
||||
extern Cell *forstat(Node **, int);
|
||||
extern Cell *instat(Node **, int);
|
||||
extern Cell *bltin(Node **, int);
|
||||
extern Cell *printstat(Node **, int);
|
||||
extern Cell *nullproc(Node **, int);
|
||||
extern FILE *redirect(int, Node *);
|
||||
extern FILE *openfile(int, char *);
|
||||
extern char *filename(FILE *);
|
||||
extern Cell *closefile(Node **, int);
|
||||
extern void closeall(void);
|
||||
extern Cell *sub(Node **, int);
|
||||
extern Cell *gsub(Node **, int);
|
||||
|
||||
extern FILE *popen(const char *, const char *);
|
||||
extern int pclose(FILE *);
|
||||
@@ -1,71 +0,0 @@
|
||||
|
||||
KTUTIL(8) UNIX System Manager's Manual KTUTIL(8)
|
||||
|
||||
NNAAMMEE
|
||||
kkttuuttiill - manage Kerberos keytabs
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkttuuttiill [--kk _k_e_y_t_a_b | ----kkeeyyttaabb==_k_e_y_t_a_b] [--vv | ----vveerrbboossee] [----vveerrssiioonn] [--hh |
|
||||
----hheellpp] _c_o_m_m_a_n_d [_a_r_g_s]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kkttuuttiill is a program for managing keytabs. _c_o_m_m_a_n_d can be one of the fol-
|
||||
lowing:
|
||||
|
||||
add [--pp _p_r_i_n_c_i_p_a_l] [----pprriinncciippaall==_p_r_i_n_c_i_p_a_l] [--VV _k_v_n_o] [----kkvvnnoo==_k_v_n_o] [--ee
|
||||
_e_n_c_y_p_e] [----eennccttyyppee==_e_n_c_t_y_p_e] [--ww _p_a_s_s_w_o_r_d] [----ppaasssswwoorrdd==_p_a_s_s_w_o_r_d]
|
||||
[--rr] [----rraannddoomm] [--ss] [----nnoo--ssaalltt]
|
||||
Adds a key to the keytab. Options that are not specified will be
|
||||
prompted for.
|
||||
|
||||
change [--rr _r_e_a_l_m] [----rreeaallmm==_r_e_a_l_m] [----aa _h_o_s_t] [----aaddmmiinn--sseerrvveerr==_h_o_s_t] [----ss
|
||||
_p_o_r_t] [----sseerrvveerr--ppoorrtt==_p_o_r_t]
|
||||
Update one or several keys to new versions. By default, use the
|
||||
admin server for the realm of an keytab entry. Otherwise it will
|
||||
use the values specified by the options.
|
||||
|
||||
If no principals are given, all the ones in the keytab are updat-
|
||||
ed.
|
||||
|
||||
copy _k_e_y_t_a_b_-_s_r_c _k_e_y_t_a_b_-_d_e_s_t
|
||||
Copies all the entries from _k_e_y_t_a_b_-_s_r_c to _k_e_y_t_a_b_-_d_e_s_t.
|
||||
|
||||
get [--pp _a_d_m_i_n _p_r_i_n_c_i_p_a_l] [----pprriinncciippaall==_a_d_m_i_n _p_r_i_n_c_i_p_a_l] [--ee _e_n_c_t_y_p_e |
|
||||
----eennccttyyppeess==_e_n_c_t_y_p_e
|
||||
sseerrvveerr==_a_d_m_i_n _s_e_r_v_e_r] [--ss _s_e_r_v_e_r _p_o_r_t] [----sseerrvveerr--ppoorrtt==_s_e_r_v_e_r _p_o_r_t]
|
||||
_p_r_i_n_c_i_p_a_l ][--rr _r_e_a_l_m] [----rreeaallmm==_r_e_a_l_m] [--aa _a_d_m_i_n _s_e_r_v_e_r]
|
||||
[----aaddmmiinn-- Get a key for pprriinncciippaall and store it in a keytab.
|
||||
|
||||
list [----kkeeyyss] [----ttiimmeessttaammpp]
|
||||
List the keys stored in the keytab.
|
||||
|
||||
remove [--pp _p_r_i_n_c_i_p_a_l] [----pprriinncciippaall==_p_r_i_n_c_i_p_a_l] [--VV --kkvvnnoo] [----kkvvnnoo==_k_v_n_o]
|
||||
[--ee --eennccttyyppee] [----eennccttyyppee==_e_n_c_t_y_p_e]
|
||||
Removes the specified key or keys. Not specifying a _k_v_n_o removes
|
||||
keys with any version number. Not specifying a _e_n_c_t_y_p_e removes
|
||||
keys of any type.
|
||||
|
||||
purge [----aaggee==_a_g_e]
|
||||
Removes all old entries (for which there is a newer version) that
|
||||
are older than _a_g_e (default one week).
|
||||
|
||||
srvconvert
|
||||
|
||||
srv2keytab [--ss _s_r_v_t_a_b] [----ssrrvvttaabb==_s_r_v_t_a_b]
|
||||
Converts the version 4 srvtab in _s_r_v_t_a_b to a version 5 keytab and
|
||||
stores it in _k_e_y_t_a_b. Identical to:
|
||||
|
||||
ktutil copy krb4:_s_r_v_t_a_b _k_e_y_t_a_b
|
||||
|
||||
srvcreate
|
||||
|
||||
key2srvtab [--ss _s_r_v_t_a_b] [----ssrrvvttaabb==_s_r_v_t_a_b]
|
||||
Converts the version 5 keytab in _k_e_y_t_a_b to a version 4 srvtab and
|
||||
stores it in _s_r_v_t_a_b. Identical to:
|
||||
|
||||
ktutil copy _k_e_y_t_a_b krb4:_s_r_v_t_a_b
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kadmin(8)
|
||||
|
||||
HEIMDAL December 16, 2000 2
|
||||
@@ -1,650 +0,0 @@
|
||||
|
||||
FTP(1) UNIX Reference Manual FTP(1)
|
||||
|
||||
NNAAMMEE
|
||||
ffttpp - ARPANET file transfer program
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
ffttpp [--tt] [--vv] [--dd] [--ii] [--nn] [--gg] [--pp] [--ll] [_h_o_s_t]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
FFttpp is the user interface to the ARPANET standard File Transfer Protocol.
|
||||
The program allows a user to transfer files to and from a remote network
|
||||
site.
|
||||
|
||||
Modifications has been made so that it almost follows the ftpsec Internet
|
||||
draft.
|
||||
|
||||
Options may be specified at the command line, or to the command inter-
|
||||
preter.
|
||||
|
||||
--tt Enables packet tracing.
|
||||
|
||||
--vv Verbose option forces ffttpp to show all responses from the remote
|
||||
server, as well as report on data transfer statistics.
|
||||
|
||||
--nn Restrains ffttpp from attempting ``auto-login'' upon initial connec-
|
||||
tion. If auto-login is enabled, ffttpp will check the _._n_e_t_r_c (see be-
|
||||
low) file in the user's home directory for an entry describing an
|
||||
account on the remote machine. If no entry exists, ffttpp will prompt
|
||||
for the remote machine login name (default is the user identity on
|
||||
the local machine), and, if necessary, prompt for a password and an
|
||||
account with which to login.
|
||||
|
||||
--ii Turns off interactive prompting during multiple file transfers.
|
||||
|
||||
--pp Turn on passive mode.
|
||||
|
||||
--dd Enables debugging.
|
||||
|
||||
--gg Disables file name globbing.
|
||||
|
||||
--ll Disables command line editing.
|
||||
|
||||
The client host with which ffttpp is to communicate may be specified on the
|
||||
command line. If this is done, ffttpp will immediately attempt to establish
|
||||
a connection to an FTP server on that host; otherwise, ffttpp will enter its
|
||||
command interpreter and await instructions from the user. When ffttpp is
|
||||
awaiting commands from the user the prompt `ftp>' is provided to the us-
|
||||
er. The following commands are recognized by ffttpp:
|
||||
|
||||
!! [_c_o_m_m_a_n_d [_a_r_g_s]]
|
||||
Invoke an interactive shell on the local machine. If there
|
||||
are arguments, the first is taken to be a command to execute
|
||||
directly, with the rest of the arguments as its arguments.
|
||||
|
||||
$$ _m_a_c_r_o_-_n_a_m_e [_a_r_g_s]
|
||||
Execute the macro _m_a_c_r_o_-_n_a_m_e that was defined with the mmaaccddeeff
|
||||
command. Arguments are passed to the macro unglobbed.
|
||||
|
||||
aaccccoouunntt [_p_a_s_s_w_d]
|
||||
Supply a supplemental password required by a remote system
|
||||
for access to resources once a login has been successfully
|
||||
completed. If no argument is included, the user will be
|
||||
|
||||
|
||||
prompted for an account password in a non-echoing input mode.
|
||||
|
||||
aappppeenndd _l_o_c_a_l_-_f_i_l_e [_r_e_m_o_t_e_-_f_i_l_e]
|
||||
Append a local file to a file on the remote machine. If
|
||||
_r_e_m_o_t_e_-_f_i_l_e is left unspecified, the local file name is used
|
||||
in naming the remote file after being altered by any nnttrraannss
|
||||
or nnmmaapp setting. File transfer uses the current settings for
|
||||
ttyyppee, ffoorrmmaatt, mmooddee, and ssttrruuccttuurree.
|
||||
|
||||
aasscciiii Set the file transfer ttyyppee to network ASCII. This is the de-
|
||||
fault type.
|
||||
|
||||
bbeellll Arrange that a bell be sounded after each file transfer com-
|
||||
mand is completed.
|
||||
|
||||
bbiinnaarryy Set the file transfer ttyyppee to support binary image transfer.
|
||||
|
||||
bbyyee Terminate the FTP session with the remote server and exit
|
||||
ffttpp. An end of file will also terminate the session and exit.
|
||||
|
||||
ccaassee Toggle remote computer file name case mapping during mmggeett
|
||||
commands. When ccaassee is on (default is off), remote computer
|
||||
file names with all letters in upper case are written in the
|
||||
local directory with the letters mapped to lower case.
|
||||
|
||||
ccdd _r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y
|
||||
Change the working directory on the remote machine to _r_e_m_o_t_e_-
|
||||
_d_i_r_e_c_t_o_r_y.
|
||||
|
||||
ccdduupp Change the remote machine working directory to the parent of
|
||||
the current remote machine working directory.
|
||||
|
||||
cchhmmoodd _m_o_d_e _f_i_l_e_-_n_a_m_e
|
||||
Change the permission modes of the file _f_i_l_e_-_n_a_m_e on the re-
|
||||
mote sytem to _m_o_d_e.
|
||||
|
||||
cclloossee Terminate the FTP session with the remote server, and return
|
||||
to the command interpreter. Any defined macros are erased.
|
||||
|
||||
ccrr Toggle carriage return stripping during ascii type file re-
|
||||
trieval. Records are denoted by a carriage return/linefeed
|
||||
sequence during ascii type file transfer. When ccrr is on (the
|
||||
default), carriage returns are stripped from this sequence to
|
||||
conform with the UNIX single linefeed record delimiter.
|
||||
Records on non-UNIX remote systems may contain single line-
|
||||
feeds; when an ascii type transfer is made, these linefeeds
|
||||
may be distinguished from a record delimiter only when ccrr is
|
||||
off.
|
||||
|
||||
ddeelleettee _r_e_m_o_t_e_-_f_i_l_e
|
||||
Delete the file _r_e_m_o_t_e_-_f_i_l_e on the remote machine.
|
||||
|
||||
ddeebbuugg [_d_e_b_u_g_-_v_a_l_u_e]
|
||||
Toggle debugging mode. If an optional _d_e_b_u_g_-_v_a_l_u_e is speci-
|
||||
fied it is used to set the debugging level. When debugging
|
||||
is on, ffttpp prints each command sent to the remote machine,
|
||||
preceded by the string `-->'
|
||||
|
||||
ddiirr [_r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y] [_l_o_c_a_l_-_f_i_l_e]
|
||||
Print a listing of the directory contents in the directory,
|
||||
_r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y, and, optionally, placing the output in
|
||||
_l_o_c_a_l_-_f_i_l_e. If interactive prompting is on, ffttpp will prompt
|
||||
the user to verify that the last argument is indeed the tar-
|
||||
get local file for receiving ddiirr output. If no directory is
|
||||
specified, the current working directory on the remote ma-
|
||||
chine is used. If no local file is specified, or _l_o_c_a_l_-_f_i_l_e
|
||||
|
||||
is --, output comes to the terminal.
|
||||
|
||||
ddiissccoonnnneecctt A synonym for _c_l_o_s_e.
|
||||
|
||||
ffoorrmm _f_o_r_m_a_t
|
||||
Set the file transfer ffoorrmm to _f_o_r_m_a_t. The default format is
|
||||
``file''.
|
||||
|
||||
ggeett _r_e_m_o_t_e_-_f_i_l_e [_l_o_c_a_l_-_f_i_l_e]
|
||||
Retrieve the _r_e_m_o_t_e_-_f_i_l_e and store it on the local machine.
|
||||
If the local file name is not specified, it is given the same
|
||||
name it has on the remote machine, subject to alteration by
|
||||
the current ccaassee, nnttrraannss, and nnmmaapp settings. The current
|
||||
settings for ttyyppee, ffoorrmm, mmooddee, and ssttrruuccttuurree are used while
|
||||
transferring the file.
|
||||
|
||||
gglloobb Toggle filename expansion for mmddeelleettee, mmggeett and mmppuutt. If
|
||||
globbing is turned off with gglloobb, the file name arguments are
|
||||
taken literally and not expanded. Globbing for mmppuutt is done
|
||||
as in csh(1). For mmddeelleettee and mmggeett, each remote file name is
|
||||
expanded separately on the remote machine and the lists are
|
||||
not merged. Expansion of a directory name is likely to be
|
||||
different from expansion of the name of an ordinary file: the
|
||||
exact result depends on the foreign operating system and ftp
|
||||
server, and can be previewed by doing `mls remote-files -'.
|
||||
As a security measure, remotely globbed files that starts
|
||||
with `/' or contains `../', will not be automatically re-
|
||||
ceived. If you have interactive prompting turned off, these
|
||||
filenames will be ignored. Note: mmggeett and mmppuutt are not meant
|
||||
to transfer entire directory subtrees of files. That can be
|
||||
done by transferring a tar(1) archive of the subtree (in bi-
|
||||
nary mode).
|
||||
|
||||
hhaasshh Toggle hash-sign (``#'') printing for each data block trans-
|
||||
ferred. The size of a data block is 1024 bytes.
|
||||
|
||||
hheellpp [_c_o_m_m_a_n_d]
|
||||
Print an informative message about the meaning of _c_o_m_m_a_n_d. If
|
||||
no argument is given, ffttpp prints a list of the known com-
|
||||
mands.
|
||||
|
||||
iiddllee [_s_e_c_o_n_d_s]
|
||||
Set the inactivity timer on the remote server to _s_e_c_o_n_d_s sec-
|
||||
onds. If _s_e_c_o_n_d_s is omitted, the current inactivity timer is
|
||||
printed.
|
||||
|
||||
llccdd [_d_i_r_e_c_t_o_r_y]
|
||||
Change the working directory on the local machine. If no
|
||||
_d_i_r_e_c_t_o_r_y is specified, the user's home directory is used.
|
||||
|
||||
llss [_r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y] [_l_o_c_a_l_-_f_i_l_e]
|
||||
Print a listing of the contents of a directory on the remote
|
||||
machine. The listing includes any system-dependent informa-
|
||||
tion that the server chooses to include; for example, most
|
||||
UNIX systems will produce output from the command `ls -l'.
|
||||
(See also nnlliisstt.) If _r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y is left unspecified,
|
||||
the current working directory is used. If interactive
|
||||
prompting is on, ffttpp will prompt the user to verify that the
|
||||
last argument is indeed the target local file for receiving
|
||||
llss output. If no local file is specified, or if _l_o_c_a_l_-_f_i_l_e
|
||||
is `--', the output is sent to the terminal.
|
||||
|
||||
mmaaccddeeff _m_a_c_r_o_-_n_a_m_e
|
||||
Define a macro. Subsequent lines are stored as the macro
|
||||
_m_a_c_r_o_-_n_a_m_e; a null line (consecutive newline characters in a
|
||||
file or carriage returns from the terminal) terminates macro
|
||||
input mode. There is a limit of 16 macros and 4096 total
|
||||
characters in all defined macros. Macros remain defined un-
|
||||
til a cclloossee command is executed. The macro processor inter-
|
||||
prets `$' and `\' as special characters. A `$' followed by a
|
||||
number (or numbers) is replaced by the corresponding argument
|
||||
on the macro invocation command line. A `$' followed by an
|
||||
`i' signals that macro processor that the executing macro is
|
||||
to be looped. On the first pass `$i' is replaced by the
|
||||
first argument on the macro invocation command line, on the
|
||||
second pass it is replaced by the second argument, and so on.
|
||||
A `\' followed by any character is replaced by that charac-
|
||||
ter. Use the `\' to prevent special treatment of the `$'.
|
||||
|
||||
mmddeelleettee [_r_e_m_o_t_e_-_f_i_l_e_s]
|
||||
Delete the _r_e_m_o_t_e_-_f_i_l_e_s on the remote machine.
|
||||
|
||||
mmddiirr _r_e_m_o_t_e_-_f_i_l_e_s _l_o_c_a_l_-_f_i_l_e
|
||||
Like ddiirr, except multiple remote files may be specified. If
|
||||
interactive prompting is on, ffttpp will prompt the user to ver-
|
||||
ify that the last argument is indeed the target local file
|
||||
for receiving mmddiirr output.
|
||||
|
||||
mmggeett _r_e_m_o_t_e_-_f_i_l_e_s
|
||||
Expand the _r_e_m_o_t_e_-_f_i_l_e_s on the remote machine and do a ggeett
|
||||
for each file name thus produced. See gglloobb for details on
|
||||
the filename expansion. Resulting file names will then be
|
||||
processed according to ccaassee, nnttrraannss, and nnmmaapp settings.
|
||||
Files are transferred into the local working directory, which
|
||||
can be changed with `lcd directory'; new local directories
|
||||
can be created with `! mkdir directory'.
|
||||
|
||||
mmkkddiirr _d_i_r_e_c_t_o_r_y_-_n_a_m_e
|
||||
Make a directory on the remote machine.
|
||||
|
||||
mmllss _r_e_m_o_t_e_-_f_i_l_e_s _l_o_c_a_l_-_f_i_l_e
|
||||
Like nnlliisstt, except multiple remote files may be specified,
|
||||
and the _l_o_c_a_l_-_f_i_l_e must be specified. If interactive prompt-
|
||||
ing is on, ffttpp will prompt the user to verify that the last
|
||||
argument is indeed the target local file for receiving mmllss
|
||||
output.
|
||||
|
||||
mmooddee [_m_o_d_e_-_n_a_m_e]
|
||||
Set the file transfer mmooddee to _m_o_d_e_-_n_a_m_e. The default mode is
|
||||
``stream'' mode.
|
||||
|
||||
mmooddttiimmee _f_i_l_e_-_n_a_m_e
|
||||
Show the last modification time of the file on the remote ma-
|
||||
chine.
|
||||
|
||||
mmppuutt _l_o_c_a_l_-_f_i_l_e_s
|
||||
Expand wild cards in the list of local files given as argu-
|
||||
ments and do a ppuutt for each file in the resulting list. See
|
||||
gglloobb for details of filename expansion. Resulting file names
|
||||
will then be processed according to nnttrraannss and nnmmaapp settings.
|
||||
|
||||
nneewweerr _f_i_l_e_-_n_a_m_e
|
||||
Get the file only if the modification time of the remote file
|
||||
is more recent that the file on the current system. If the
|
||||
file does not exist on the current system, the remote file is
|
||||
considered nneewweerr. Otherwise, this command is identical to
|
||||
_g_e_t.
|
||||
|
||||
nnlliisstt [_r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y] [_l_o_c_a_l_-_f_i_l_e]
|
||||
Print a list of the files in a directory on the remote ma-
|
||||
chine. If _r_e_m_o_t_e_-_d_i_r_e_c_t_o_r_y is left unspecified, the current
|
||||
working directory is used. If interactive prompting is on,
|
||||
ffttpp will prompt the user to verify that the last argument is
|
||||
indeed the target local file for receiving nnlliisstt output. If
|
||||
no local file is specified, or if _l_o_c_a_l_-_f_i_l_e is --, the output
|
||||
is sent to the terminal.
|
||||
|
||||
nnmmaapp [_i_n_p_a_t_t_e_r_n _o_u_t_p_a_t_t_e_r_n]
|
||||
Set or unset the filename mapping mechanism. If no arguments
|
||||
are specified, the filename mapping mechanism is unset. If
|
||||
arguments are specified, remote filenames are mapped during
|
||||
mmppuutt commands and ppuutt commands issued without a specified re-
|
||||
mote target filename. If arguments are specified, local
|
||||
filenames are mapped during mmggeett commands and ggeett commands
|
||||
issued without a specified local target filename. This com-
|
||||
mand is useful when connecting to a non-UNIX remote computer
|
||||
with different file naming conventions or practices. The
|
||||
mapping follows the pattern set by _i_n_p_a_t_t_e_r_n and _o_u_t_p_a_t_t_e_r_n.
|
||||
[_I_n_p_a_t_t_e_r_n] is a template for incoming filenames (which may
|
||||
have already been processed according to the nnttrraannss and ccaassee
|
||||
settings). Variable templating is accomplished by including
|
||||
the sequences `$1', `$2', ..., `$9' in _i_n_p_a_t_t_e_r_n. Use `\' to
|
||||
prevent this special treatment of the `$' character. All
|
||||
other characters are treated literally, and are used to de-
|
||||
termine the nnmmaapp [_i_n_p_a_t_t_e_r_n] variable values. For example,
|
||||
given _i_n_p_a_t_t_e_r_n $1.$2 and the remote file name "mydata.data",
|
||||
$1 would have the value "mydata", and $2 would have the value
|
||||
"data". The _o_u_t_p_a_t_t_e_r_n determines the resulting mapped file-
|
||||
name. The sequences `$1', `$2', ...., `$9' are replaced by
|
||||
any value resulting from the _i_n_p_a_t_t_e_r_n template. The se-
|
||||
quence `$0' is replace by the original filename. Additional-
|
||||
ly, the sequence `[_s_e_q_1, _s_e_q_2]' is replaced by [_s_e_q_1] if _s_e_q_1
|
||||
is not a null string; otherwise it is replaced by _s_e_q_2. For
|
||||
example, the command
|
||||
|
||||
nmap $1.$2.$3 [$1,$2].[$2,file]
|
||||
|
||||
would yield the output filename "myfile.data" for input file-
|
||||
names "myfile.data" and "myfile.data.old", "myfile.file" for
|
||||
the input filename "myfile", and "myfile.myfile" for the in-
|
||||
put filename ".myfile". Spaces may be included in
|
||||
_o_u_t_p_a_t_t_e_r_n, as in the example: `nmap $1 sed "s/ *$//" > $1'
|
||||
. Use the `\' character to prevent special treatment of the
|
||||
`$','[','[', and `,' characters.
|
||||
|
||||
nnttrraannss [_i_n_c_h_a_r_s [_o_u_t_c_h_a_r_s]]
|
||||
Set or unset the filename character translation mechanism.
|
||||
If no arguments are specified, the filename character trans-
|
||||
lation mechanism is unset. If arguments are specified, char-
|
||||
acters in remote filenames are translated during mmppuutt com-
|
||||
mands and ppuutt commands issued without a specified remote tar-
|
||||
get filename. If arguments are specified, characters in lo-
|
||||
cal filenames are translated during mmggeett commands and ggeett
|
||||
commands issued without a specified local target filename.
|
||||
This command is useful when connecting to a non-UNIX remote
|
||||
computer with different file naming conventions or practices.
|
||||
Characters in a filename matching a character in _i_n_c_h_a_r_s are
|
||||
replaced with the corresponding character in _o_u_t_c_h_a_r_s. If the
|
||||
character's position in _i_n_c_h_a_r_s is longer than the length of
|
||||
_o_u_t_c_h_a_r_s, the character is deleted from the file name.
|
||||
|
||||
ooppeenn _h_o_s_t [_p_o_r_t]
|
||||
Establish a connection to the specified _h_o_s_t FTP server. An
|
||||
optional port number may be supplied, in which case, ffttpp will
|
||||
attempt to contact an FTP server at that port. If the aauuttoo--
|
||||
llooggiinn option is on (default), ffttpp will also attempt to auto-
|
||||
|
||||
matically log the user in to the FTP server (see below).
|
||||
|
||||
ppaassssiivvee Toggle passive mode. If passive mode is turned on (default
|
||||
is off), the ftp client will send a PASV command for all data
|
||||
connections instead of the usual PORT command. The PASV com-
|
||||
mand requests that the remote server open a port for the data
|
||||
connection and return the address of that port. The remote
|
||||
server listens on that port and the client connects to it.
|
||||
When using the more traditional PORT command, the client lis-
|
||||
tens on a port and sends that address to the remote server,
|
||||
who connects back to it. Passive mode is useful when using
|
||||
ffttpp through a gateway router or host that controls the direc-
|
||||
tionality of traffic. (Note that though ftp servers are re-
|
||||
quired to support the PASV command by RFC 1123, some do not.)
|
||||
|
||||
pprroommpptt Toggle interactive prompting. Interactive prompting occurs
|
||||
during multiple file transfers to allow the user to selec-
|
||||
tively retrieve or store files. If prompting is turned off
|
||||
(default is on), any mmggeett or mmppuutt will transfer all files,
|
||||
and any mmddeelleettee will delete all files.
|
||||
|
||||
pprrooxxyy _f_t_p_-_c_o_m_m_a_n_d
|
||||
Execute an ftp command on a secondary control connection.
|
||||
This command allows simultaneous connection to two remote ftp
|
||||
servers for transferring files between the two servers. The
|
||||
first pprrooxxyy command should be an ooppeenn, to establish the sec-
|
||||
ondary control connection. Enter the command "proxy ?" to
|
||||
see other ftp commands executable on the secondary connec-
|
||||
tion. The following commands behave differently when pref-
|
||||
aced by pprrooxxyy: ooppeenn will not define new macros during the au-
|
||||
to-login process, cclloossee will not erase existing macro defini-
|
||||
tions, ggeett and mmggeett transfer files from the host on the pri-
|
||||
mary control connection to the host on the secondary control
|
||||
connection, and ppuutt, mmppuutt, and aappppeenndd transfer files from the
|
||||
host on the secondary control connection to the host on the
|
||||
primary control connection. Third party file transfers de-
|
||||
pend upon support of the ftp protocol PASV command by the
|
||||
server on the secondary control connection.
|
||||
|
||||
ppuutt _l_o_c_a_l_-_f_i_l_e [_r_e_m_o_t_e_-_f_i_l_e]
|
||||
Store a local file on the remote machine. If _r_e_m_o_t_e_-_f_i_l_e is
|
||||
left unspecified, the local file name is used after process-
|
||||
ing according to any nnttrraannss or nnmmaapp settings in naming the
|
||||
remote file. File transfer uses the current settings for
|
||||
ttyyppee, ffoorrmmaatt, mmooddee, and ssttrruuccttuurree.
|
||||
|
||||
ppwwdd Print the name of the current working directory on the remote
|
||||
machine.
|
||||
|
||||
qquuiitt A synonym for bbyyee.
|
||||
|
||||
qquuoottee _a_r_g_1 _a_r_g_2 _._._.
|
||||
The arguments specified are sent, verbatim, to the remote FTP
|
||||
server.
|
||||
|
||||
rreeccvv _r_e_m_o_t_e_-_f_i_l_e [_l_o_c_a_l_-_f_i_l_e]
|
||||
A synonym for get.
|
||||
|
||||
rreeggeett _r_e_m_o_t_e_-_f_i_l_e [_l_o_c_a_l_-_f_i_l_e]
|
||||
Reget acts like get, except that if _l_o_c_a_l_-_f_i_l_e exists and is
|
||||
smaller than _r_e_m_o_t_e_-_f_i_l_e, _l_o_c_a_l_-_f_i_l_e is presumed to be a par-
|
||||
tially transferred copy of _r_e_m_o_t_e_-_f_i_l_e and the transfer is
|
||||
continued from the apparent point of failure. This command
|
||||
is useful when transferring very large files over networks
|
||||
|
||||
|
||||
that are prone to dropping connections.
|
||||
|
||||
rreemmootteehheellpp [_c_o_m_m_a_n_d_-_n_a_m_e]
|
||||
Request help from the remote FTP server. If a _c_o_m_m_a_n_d_-_n_a_m_e
|
||||
is specified it is supplied to the server as well.
|
||||
|
||||
rreemmootteessttaattuuss [_f_i_l_e_-_n_a_m_e]
|
||||
With no arguments, show status of remote machine. If _f_i_l_e_-
|
||||
_n_a_m_e is specified, show status of _f_i_l_e_-_n_a_m_e on remote ma-
|
||||
chine.
|
||||
|
||||
rreennaammee [_f_r_o_m] [_t_o]
|
||||
Rename the file _f_r_o_m on the remote machine, to the file _t_o.
|
||||
|
||||
rreesseett Clear reply queue. This command re-synchronizes command/re-
|
||||
ply sequencing with the remote ftp server. Resynchronization
|
||||
may be necessary following a violation of the ftp protocol by
|
||||
the remote server.
|
||||
|
||||
rreessttaarrtt _m_a_r_k_e_r
|
||||
Restart the immediately following ggeett or ppuutt at the indicated
|
||||
_m_a_r_k_e_r. On UNIX systems, marker is usually a byte offset into
|
||||
the file.
|
||||
|
||||
rrmmddiirr _d_i_r_e_c_t_o_r_y_-_n_a_m_e
|
||||
Delete a directory on the remote machine.
|
||||
|
||||
rruunniiqquuee Toggle storing of files on the local system with unique file-
|
||||
names. If a file already exists with a name equal to the
|
||||
target local filename for a ggeett or mmggeett command, a ".1" is
|
||||
appended to the name. If the resulting name matches another
|
||||
existing file, a ".2" is appended to the original name. If
|
||||
this process continues up to ".99", an error message is
|
||||
printed, and the transfer does not take place. The generated
|
||||
unique filename will be reported. Note that rruunniiqquuee will not
|
||||
affect local files generated from a shell command (see be-
|
||||
low). The default value is off.
|
||||
|
||||
sseenndd _l_o_c_a_l_-_f_i_l_e [_r_e_m_o_t_e_-_f_i_l_e]
|
||||
A synonym for put.
|
||||
|
||||
sseennddppoorrtt Toggle the use of PORT commands. By default, ffttpp will at-
|
||||
tempt to use a PORT command when establishing a connection
|
||||
for each data transfer. The use of PORT commands can prevent
|
||||
delays when performing multiple file transfers. If the PORT
|
||||
command fails, ffttpp will use the default data port. When the
|
||||
use of PORT commands is disabled, no attempt will be made to
|
||||
use PORT commands for each data transfer. This is useful for
|
||||
certain FTP implementations which do ignore PORT commands
|
||||
but, incorrectly, indicate they've been accepted.
|
||||
|
||||
ssiittee _a_r_g_1 _a_r_g_2 _._._.
|
||||
The arguments specified are sent, verbatim, to the remote FTP
|
||||
server as a SITE command.
|
||||
|
||||
ssiizzee _f_i_l_e_-_n_a_m_e
|
||||
Return size of _f_i_l_e_-_n_a_m_e on remote machine.
|
||||
|
||||
ssttaattuuss Show the current status of ffttpp.
|
||||
|
||||
ssttrruucctt [_s_t_r_u_c_t_-_n_a_m_e]
|
||||
Set the file transfer _s_t_r_u_c_t_u_r_e to _s_t_r_u_c_t_-_n_a_m_e. By default
|
||||
``stream'' structure is used.
|
||||
|
||||
ssuunniiqquuee Toggle storing of files on remote machine under unique file
|
||||
names. Remote ftp server must support ftp protocol STOU com-
|
||||
mand for successful completion. The remote server will re-
|
||||
port unique name. Default value is off.
|
||||
|
||||
ssyysstteemm Show the type of operating system running on the remote ma-
|
||||
chine.
|
||||
|
||||
tteenneexx Set the file transfer type to that needed to talk to TENEX
|
||||
machines.
|
||||
|
||||
ttrraaccee Toggle packet tracing.
|
||||
|
||||
ttyyppee [_t_y_p_e_-_n_a_m_e]
|
||||
Set the file transfer ttyyppee to _t_y_p_e_-_n_a_m_e. If no type is speci-
|
||||
fied, the current type is printed. The default type is net-
|
||||
work ASCII.
|
||||
|
||||
uummaasskk [_n_e_w_m_a_s_k]
|
||||
Set the default umask on the remote server to _n_e_w_m_a_s_k. If
|
||||
_n_e_w_m_a_s_k is omitted, the current umask is printed.
|
||||
|
||||
uusseerr _u_s_e_r_-_n_a_m_e [_p_a_s_s_w_o_r_d] [_a_c_c_o_u_n_t]
|
||||
Identify yourself to the remote FTP server. If the _p_a_s_s_w_o_r_d
|
||||
is not specified and the server requires it, ffttpp will prompt
|
||||
the user for it (after disabling local echo). If an _a_c_c_o_u_n_t
|
||||
field is not specified, and the FTP server requires it, the
|
||||
user will be prompted for it. If an _a_c_c_o_u_n_t field is speci-
|
||||
fied, an account command will be relayed to the remote server
|
||||
after the login sequence is completed if the remote server
|
||||
did not require it for logging in. Unless ffttpp is invoked
|
||||
with ``auto-login'' disabled, this process is done automati-
|
||||
cally on initial connection to the FTP server.
|
||||
|
||||
vveerrbboossee Toggle verbose mode. In verbose mode, all responses from the
|
||||
FTP server are displayed to the user. In addition, if ver-
|
||||
bose is on, when a file transfer completes, statistics re-
|
||||
garding the efficiency of the transfer are reported. By de-
|
||||
fault, verbose is on.
|
||||
|
||||
?? [_c_o_m_m_a_n_d]
|
||||
A synonym for help.
|
||||
|
||||
The following command can be used with ftpsec-aware servers.
|
||||
|
||||
pprroott _c_l_e_a_r | _s_a_f_e | _c_o_n_f_i_d_e_n_t_i_a_l | _p_r_i_v_a_t_e
|
||||
Set the data protection level to the requested level.
|
||||
|
||||
The following command can be used with ftp servers that has implemented
|
||||
the KAUTH site command.
|
||||
|
||||
kkaauutthh [_p_r_i_n_c_i_p_a_l]
|
||||
Obtain remote tickets.
|
||||
|
||||
Command arguments which have embedded spaces may be quoted with quote `"'
|
||||
marks.
|
||||
|
||||
AABBOORRTTIINNGG AA FFIILLEE TTRRAANNSSFFEERR
|
||||
To abort a file transfer, use the terminal interrupt key (usually Ctrl-
|
||||
C). Sending transfers will be immediately halted. Receiving transfers
|
||||
will be halted by sending a ftp protocol ABOR command to the remote serv-
|
||||
er, and discarding any further data received. The speed at which this is
|
||||
accomplished depends upon the remote server's support for ABOR process-
|
||||
ing. If the remote server does not support the ABOR command, an `ftp>'
|
||||
prompt will not appear until the remote server has completed sending the
|
||||
requested file.
|
||||
|
||||
|
||||
The terminal interrupt key sequence will be ignored when ffttpp has complet-
|
||||
ed any local processing and is awaiting a reply from the remote server.
|
||||
A long delay in this mode may result from the ABOR processing described
|
||||
above, or from unexpected behavior by the remote server, including viola-
|
||||
tions of the ftp protocol. If the delay results from unexpected remote
|
||||
server behavior, the local ffttpp program must be killed by hand.
|
||||
|
||||
FFIILLEE NNAAMMIINNGG CCOONNVVEENNTTIIOONNSS
|
||||
Files specified as arguments to ffttpp commands are processed according to
|
||||
the following rules.
|
||||
|
||||
1. If the file name `--' is specified, the _s_t_d_i_n (for reading) or _s_t_d_o_u_t
|
||||
(for writing) is used.
|
||||
|
||||
2. If the first character of the file name is `|', the remainder of the
|
||||
argument is interpreted as a shell command. FFttpp then forks a shell,
|
||||
using popen(3) with the argument supplied, and reads (writes) from
|
||||
the stdout (stdin). If the shell command includes spaces, the argu-
|
||||
ment must be quoted; e.g. ``" ls -lt"''. A particularly useful ex-
|
||||
ample of this mechanism is: ``dir more''.
|
||||
|
||||
3. Failing the above checks, if ``globbing'' is enabled, local file
|
||||
names are expanded according to the rules used in the csh(1); c.f.
|
||||
the gglloobb command. If the ffttpp command expects a single local file
|
||||
(.e.g. ppuutt), only the first filename generated by the "globbing"
|
||||
operation is used.
|
||||
|
||||
4. For mmggeett commands and ggeett commands with unspecified local file
|
||||
names, the local filename is the remote filename, which may be al-
|
||||
tered by a ccaassee, nnttrraannss, or nnmmaapp setting. The resulting filename
|
||||
may then be altered if rruunniiqquuee is on.
|
||||
|
||||
5. For mmppuutt commands and ppuutt commands with unspecified remote file
|
||||
names, the remote filename is the local filename, which may be al-
|
||||
tered by a nnttrraannss or nnmmaapp setting. The resulting filename may then
|
||||
be altered by the remote server if ssuunniiqquuee is on.
|
||||
|
||||
FFIILLEE TTRRAANNSSFFEERR PPAARRAAMMEETTEERRSS
|
||||
The FTP specification specifies many parameters which may affect a file
|
||||
transfer. The ttyyppee may be one of ``ascii'', ``image'' (binary),
|
||||
``ebcdic'', and ``local byte size'' (for PDP-10's and PDP-20's mostly).
|
||||
FFttpp supports the ascii and image types of file transfer, plus local byte
|
||||
size 8 for tteenneexx mode transfers.
|
||||
|
||||
FFttpp supports only the default values for the remaining file transfer pa-
|
||||
rameters: mmooddee, ffoorrmm, and ssttrruucctt.
|
||||
|
||||
TTHHEE ..nneettrrcc FFIILLEE
|
||||
The _._n_e_t_r_c file contains login and initialization information used by the
|
||||
auto-login process. It resides in the user's home directory. The fol-
|
||||
lowing tokens are recognized; they may be separated by spaces, tabs, or
|
||||
new-lines:
|
||||
|
||||
mmaacchhiinnee _n_a_m_e
|
||||
Identify a remote machine _n_a_m_e. The auto-login process searches
|
||||
the _._n_e_t_r_c file for a mmaacchhiinnee token that matches the remote ma-
|
||||
chine specified on the ffttpp command line or as an ooppeenn command
|
||||
argument. Once a match is made, the subsequent _._n_e_t_r_c tokens
|
||||
are processed, stopping when the end of file is reached or an-
|
||||
other mmaacchhiinnee or a ddeeffaauulltt token is encountered.
|
||||
|
||||
ddeeffaauulltt This is the same as mmaacchhiinnee _n_a_m_e except that ddeeffaauulltt matches
|
||||
any name. There can be only one ddeeffaauulltt token, and it must be
|
||||
after all mmaacchhiinnee tokens. This is normally used as:
|
||||
|
||||
|
||||
default login anonymous password user@site
|
||||
|
||||
thereby giving the user _a_u_t_o_m_a_t_i_c anonymous ftp login to ma-
|
||||
chines not specified in _._n_e_t_r_c. This can be overridden by using
|
||||
the --nn flag to disable auto-login.
|
||||
|
||||
llooggiinn _n_a_m_e
|
||||
Identify a user on the remote machine. If this token is pre-
|
||||
sent, the auto-login process will initiate a login using the
|
||||
specified _n_a_m_e.
|
||||
|
||||
ppaasssswwoorrdd _s_t_r_i_n_g
|
||||
Supply a password. If this token is present, the auto-login
|
||||
process will supply the specified string if the remote server
|
||||
requires a password as part of the login process. Note that if
|
||||
this token is present in the _._n_e_t_r_c file for any user other
|
||||
than _a_n_o_n_y_m_o_u_s, ffttpp will abort the auto-login process if the
|
||||
_._n_e_t_r_c is readable by anyone besides the user.
|
||||
|
||||
aaccccoouunntt _s_t_r_i_n_g
|
||||
Supply an additional account password. If this token is pre-
|
||||
sent, the auto-login process will supply the specified string
|
||||
if the remote server requires an additional account password,
|
||||
or the auto-login process will initiate an ACCT command if it
|
||||
does not.
|
||||
|
||||
mmaaccddeeff _n_a_m_e
|
||||
Define a macro. This token functions like the ffttpp mmaaccddeeff com-
|
||||
mand functions. A macro is defined with the specified name;
|
||||
its contents begin with the next _._n_e_t_r_c line and continue until
|
||||
a null line (consecutive new-line characters) is encountered.
|
||||
If a macro named iinniitt is defined, it is automatically executed
|
||||
as the last step in the auto-login process.
|
||||
|
||||
EENNVVIIRROONNMMEENNTT
|
||||
FFttpp utilizes the following environment variables.
|
||||
|
||||
HOME For default location of a _._n_e_t_r_c file, if one exists.
|
||||
|
||||
SHELL For default shell.
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
ftpd(8), _R_F_C_2_2_2_8
|
||||
|
||||
HHIISSTTOORRYY
|
||||
The ffttpp command appeared in 4.2BSD.
|
||||
|
||||
BBUUGGSS
|
||||
Correct execution of many commands depends upon proper behavior by the
|
||||
remote server.
|
||||
|
||||
An error in the treatment of carriage returns in the 4.2BSD ascii-mode
|
||||
transfer code has been corrected. This correction may result in incor-
|
||||
rect transfers of binary files to and from 4.2BSD servers using the ascii
|
||||
type. Avoid this problem by using the binary image type.
|
||||
|
||||
4.2 Berkeley Distribution April 27, 1996 10
|
||||
@@ -1,296 +0,0 @@
|
||||
|
||||
FTPD(8) UNIX System Manager's Manual FTPD(8)
|
||||
|
||||
NNAAMMEE
|
||||
ffttppdd - Internet File Transfer Protocol server
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
ffttppdd [--aa _a_u_t_h_m_o_d_e] [--ddiillvv] [--gg _u_m_a_s_k] [--pp _p_o_r_t] [--TT _m_a_x_t_i_m_e_o_u_t] [--tt
|
||||
_t_i_m_e_o_u_t] [--uu _d_e_f_a_u_l_t _u_m_a_s_k] [--BB | ----bbuuiillttiinn--llss] [----ggoooodd--cchhaarrss==_s_t_r_i_n_g]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
FFttppdd is the Internet File Transfer Protocol server process. The server
|
||||
uses the TCP protocol and listens at the port specified in the ``ftp''
|
||||
service specification; see services(5).
|
||||
|
||||
Available options:
|
||||
|
||||
--aa Select the level of authentication required. Kerberised login
|
||||
can not be turned off. The default is to only allow kerberised
|
||||
login. Other possibilities can be turned on by giving a string
|
||||
of comma separated flags as argument to --aa. Recognised flags are:
|
||||
|
||||
_p_l_a_i_n Allow logging in with plaintext password. The password can
|
||||
be a(n) OTP or an ordinary password.
|
||||
|
||||
_o_t_p Same as _p_l_a_i_n, but only OTP is allowed.
|
||||
|
||||
_f_t_p Allow anonymous login.
|
||||
|
||||
The following combination modes exists for backwards compatibili-
|
||||
ty:
|
||||
|
||||
_n_o_n_e Same as _p_l_a_i_n_,_f_t_p.
|
||||
|
||||
_s_a_f_e Same as _f_t_p.
|
||||
|
||||
_u_s_e_r Ignored.
|
||||
|
||||
--dd Debugging information is written to the syslog using LOG_FTP.
|
||||
|
||||
--gg Anonymous users will get a umask of _u_m_a_s_k.
|
||||
|
||||
--ii Open a socket and wait for a connection. This is mainly used for
|
||||
debugging when ftpd isn't started by inetd.
|
||||
|
||||
--ll Each successful and failed ftp(1) session is logged using syslog
|
||||
with a facility of LOG_FTP. If this option is specified twice,
|
||||
the retrieve (get), store (put), append, delete, make directory,
|
||||
remove directory and rename operations and their filename argu-
|
||||
ments are also logged.
|
||||
|
||||
--pp Use _p_o_r_t (a service name or number) instead of the default
|
||||
_f_t_p_/_t_c_p.
|
||||
|
||||
--TT A client may also request a different timeout period; the maximum
|
||||
period allowed may be set to _t_i_m_e_o_u_t seconds with the --TT option.
|
||||
The default limit is 2 hours.
|
||||
|
||||
--tt The inactivity timeout period is set to _t_i_m_e_o_u_t seconds (the de-
|
||||
fault is 15 minutes).
|
||||
|
||||
--uu Set the initial umask to something else than the default 027.
|
||||
|
||||
|
||||
|
||||
--vv Verbose mode.
|
||||
|
||||
--BB, ----bbuuiillttiinn--llss
|
||||
use built-in ls to list files
|
||||
|
||||
----ggoooodd--cchhaarrss==_s_t_r_i_n_g
|
||||
allowed anonymous upload filename chars
|
||||
|
||||
The file _/_e_t_c_/_n_o_l_o_g_i_n can be used to disable ftp access. If the file ex-
|
||||
ists, ffttppdd displays it and exits. If the file _/_e_t_c_/_f_t_p_w_e_l_c_o_m_e exists,
|
||||
ffttppdd prints it before issuing the ``ready'' message. If the file
|
||||
_/_e_t_c_/_m_o_t_d exists, ffttppdd prints it after a successful login.
|
||||
|
||||
The ftp server currently supports the following ftp requests. The case
|
||||
of the requests is ignored.
|
||||
|
||||
Request Description
|
||||
ABOR abort previous command
|
||||
ACCT specify account (ignored)
|
||||
ALLO allocate storage (vacuously)
|
||||
APPE append to a file
|
||||
CDUP change to parent of current working directory
|
||||
CWD change working directory
|
||||
DELE delete a file
|
||||
HELP give help information
|
||||
LIST give list files in a directory (``ls -lgA'')
|
||||
MKD make a directory
|
||||
MDTM show last modification time of file
|
||||
MODE specify data transfer _m_o_d_e
|
||||
NLST give name list of files in directory
|
||||
NOOP do nothing
|
||||
PASS specify password
|
||||
PASV prepare for server-to-server transfer
|
||||
PORT specify data connection port
|
||||
PWD print the current working directory
|
||||
QUIT terminate session
|
||||
REST restart incomplete transfer
|
||||
RETR retrieve a file
|
||||
RMD remove a directory
|
||||
RNFR specify rename-from file name
|
||||
RNTO specify rename-to file name
|
||||
SITE non-standard commands (see next section)
|
||||
SIZE return size of file
|
||||
STAT return status of server
|
||||
STOR store a file
|
||||
STOU store a file with a unique name
|
||||
STRU specify data transfer _s_t_r_u_c_t_u_r_e
|
||||
SYST show operating system type of server system
|
||||
TYPE specify data transfer _t_y_p_e
|
||||
USER specify user name
|
||||
XCUP change to parent of current working directory
|
||||
(deprecated)
|
||||
XCWD change working directory (deprecated)
|
||||
XMKD make a directory (deprecated)
|
||||
XPWD print the current working directory (deprecated)
|
||||
XRMD remove a directory (deprecated)
|
||||
|
||||
The following commands are specified by RFC2228.
|
||||
|
||||
AUTH authentication/security mechanism
|
||||
ADAT authentication/security data
|
||||
PROT data channel protection level
|
||||
PBSZ protection buffer size
|
||||
MIC integrity protected command
|
||||
|
||||
|
||||
CONF confidentiality protected command
|
||||
ENC privacy protected command
|
||||
CCC clear command channel
|
||||
|
||||
The following non-standard or UNIX specific commands are supported by the
|
||||
SITE request.
|
||||
|
||||
UMASK change umask, (e.g. SSIITTEE UUMMAASSKK 000022)
|
||||
IDLE set idle-timer, (e.g. SSIITTEE IIDDLLEE 6600)
|
||||
CHMOD change mode of a file (e.g. SSIITTEE CCHHMMOODD 775555 ffiilleennaammee)
|
||||
FIND quickly find a specific file with GNU locate(1).
|
||||
HELP give help information.
|
||||
|
||||
The following Kerberos related site commands are understood.
|
||||
|
||||
KAUTH obtain remote tickets.
|
||||
KLIST show remote tickets
|
||||
|
||||
The remaining ftp requests specified in Internet RFC 959 are recognized,
|
||||
but not implemented. MDTM and SIZE are not specified in RFC 959, but
|
||||
will appear in the next updated FTP RFC.
|
||||
|
||||
The ftp server will abort an active file transfer only when the ABOR com-
|
||||
mand is preceded by a Telnet "Interrupt Process" (IP) signal and a Telnet
|
||||
"Synch" signal in the command Telnet stream, as described in Internet RFC
|
||||
959. If a STAT command is received during a data transfer, preceded by a
|
||||
Telnet IP and Synch, transfer status will be returned.
|
||||
|
||||
FFttppdd interprets file names according to the ``globbing'' conventions used
|
||||
by csh(1). This allows users to utilize the metacharacters ``*?[]{}~''.
|
||||
|
||||
FFttppdd authenticates users according to these rules.
|
||||
|
||||
1. If Kerberos authentication is used, the user must pass valid
|
||||
tickets and the principal must be allowed to login as the re-
|
||||
mote user.
|
||||
|
||||
2. The login name must be in the password data base, and not have
|
||||
a null password (if kerberos is used the password field is not
|
||||
checked). In this case a password must be provided by the
|
||||
client before any file operations may be performed. If the
|
||||
user has an OTP key, the response from a successful USER com-
|
||||
mand will include an OTP challenge. The client may choose to
|
||||
respond with a PASS command giving either a standard password
|
||||
or an OTP one-time password. The server will automatically de-
|
||||
termine which type of password it has been given and attempt
|
||||
to authenticate accordingly. See otp(1) for more information
|
||||
on OTP authentication.
|
||||
|
||||
3. The login name must not appear in the file _/_e_t_c_/_f_t_p_u_s_e_r_s.
|
||||
|
||||
4. The user must have a standard shell returned by
|
||||
getusershell(3).
|
||||
|
||||
5. If the user name appears in the file _/_e_t_c_/_f_t_p_c_h_r_o_o_t the ses-
|
||||
sion's root will be changed to the user's login directory by
|
||||
chroot(2) as for an ``anonymous'' or ``ftp'' account (see next
|
||||
item). However, the user must still supply a password. This
|
||||
feature is intended as a compromise between a fully anonymous
|
||||
account and a fully privileged account. The account should
|
||||
also be set up as for an anonymous account.
|
||||
|
||||
6. If the user name is ``anonymous'' or ``ftp'', an anonymous ftp
|
||||
account must be present in the password file (user ``ftp'').
|
||||
In this case the user is allowed to log in by specifying any
|
||||
password (by convention an email address for the user should
|
||||
be used as the password).
|
||||
|
||||
In the last case, ffttppdd takes special measures to restrict the client's
|
||||
access privileges. The server performs a chroot(2) to the home directory
|
||||
of the ``ftp'' user. In order that system security is not breached, it
|
||||
is recommended that the ``ftp'' subtree be constructed with care, consid-
|
||||
er following these guidelines for anonymous ftp.
|
||||
|
||||
In general all files should be owned by ``root'', and have non-write per-
|
||||
missions (644 or 755 depending on the kind of file). No files should be
|
||||
owned or writable by ``ftp'' (possibly with exception for the
|
||||
_~_f_t_p_/_i_n_c_o_m_i_n_g, as specified below).
|
||||
|
||||
_~_f_t_p The ``ftp'' homedirectory should be owned by root.
|
||||
|
||||
_~_f_t_p_/_b_i_n The directory for external programs (such as ls(1)).
|
||||
These programs must either be statically linked, or you
|
||||
must setup an environment for dynamic linking when run-
|
||||
ning chrooted. These programs will be used if present:
|
||||
|
||||
ls Used when listing files.
|
||||
|
||||
compress
|
||||
When retrieving a filename that ends in _._Z,
|
||||
and that file isn't present, ffttppdd will try
|
||||
to find the filename without _._Z and com-
|
||||
press it on the fly.
|
||||
|
||||
gzip Same as compress, just with files ending in
|
||||
_._g_z.
|
||||
|
||||
gtar Enables retrieval of whole directories as
|
||||
files ending in _._t_a_r. Can also be combined
|
||||
with compression. You must use GNU Tar (or
|
||||
some other that supports the --zz and --ZZ
|
||||
flags).
|
||||
|
||||
locate Will enable ``fast find'' with the SSIITTEE
|
||||
FFIINNDD command. You must also create a
|
||||
_l_o_c_a_t_e_d_b file in _~_f_t_p_/_e_t_c.
|
||||
|
||||
_~_f_t_p_/_e_t_c If you put copies of the passwd(5) and group(5) files
|
||||
here, ls will be able to produce owner names rather than
|
||||
numbers. Remember to remove any passwords from these
|
||||
files.
|
||||
|
||||
The file _m_o_t_d, if present, will be printed after a suc-
|
||||
cessful login.
|
||||
|
||||
_~_f_t_p_/_d_e_v Put a copy of /dev/null(7) here.
|
||||
|
||||
_~_f_t_p_/_p_u_b Traditional place to put whatever you want to make pub-
|
||||
lic.
|
||||
|
||||
If you want guests to be able to upload files, create a _~_f_t_p_/_i_n_c_o_m_i_n_g di-
|
||||
rectory owned by ``root'', and group ``ftp'' with mode 730 (make sure
|
||||
``ftp'' is member of group ``ftp''). The following restrictions apply to
|
||||
anonymous users:
|
||||
|
||||
++oo Directories created will have mode 700.
|
||||
|
||||
++oo Uploaded files will be created with an umask of 777, if not changed
|
||||
with the --gg option.
|
||||
|
||||
++oo These command are not accessible: DDEELLEE, RRMMDD, RRNNTTOO, RRNNFFRR, SSIITTEE UUMMAASSKK,
|
||||
|
||||
and SSIITTEE CCHHMMOODD.
|
||||
|
||||
++oo Filenames must start with an alpha-numeric character, and consist of
|
||||
alpha-numeric characters or any of the following: + (plus), - (mi-
|
||||
nus), = (equal), _ (underscore), . (period), and , (comma).
|
||||
|
||||
FFIILLEESS
|
||||
/etc/ftpusers Access list for users.
|
||||
/etc/ftpchroot List of normal users who should be chroot'd.
|
||||
/etc/ftpwelcome Welcome notice.
|
||||
/etc/motd Welcome notice after login.
|
||||
/etc/nologin Displayed and access refused.
|
||||
~/.klogin Login access for Kerberos.
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
ftp(1), otp(1), getusershell(3), ftpusers(5), syslogd(8),
|
||||
|
||||
SSTTAANNDDAARRDDSS
|
||||
RRFFCC 995599 FTP PROTOCOL SPECIFICATION
|
||||
RRFFCC 11993388 OTP Specification
|
||||
RRFFCC 22222288 FTP Security Extensions.
|
||||
|
||||
BBUUGGSS
|
||||
The server must run as the super-user to create sockets with privileged
|
||||
port numbers. It maintains an effective user id of the logged in user,
|
||||
reverting to the super-user only when binding addresses to sockets. The
|
||||
possible security holes have been extensively scrutinized, but are possi-
|
||||
bly incomplete.
|
||||
|
||||
HHIISSTTOORRYY
|
||||
The ffttppdd command appeared in 4.2BSD.
|
||||
|
||||
4.2 Berkeley Distribution April 19, 1997 5
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
FTPUSERS(5) UNIX Programmer's Manual FTPUSERS(5)
|
||||
|
||||
NNAAMMEE
|
||||
_/_e_t_c_/_f_t_p_u_s_e_r_s - FTP access list file
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
_/_e_t_c_/_f_t_p_u_s_e_r_s contains a list of users that should be allowed or denied
|
||||
FTP access. Each line contains a user, optionally followed by ``allow''
|
||||
(anything but ``allow'' is ignored). The semi-user ``*'' matches any us-
|
||||
er. Users that has an explicit ``allow'', or that does not match any
|
||||
line, are allowed access. Anyone else is denied access.
|
||||
|
||||
Note that this is compatible with the old format, where this file con-
|
||||
tained a list of users that should be denied access.
|
||||
|
||||
EEXXAAMMPPLLEESS
|
||||
This will deny anyone but ``foo'' and ``bar'' to use FTP:
|
||||
|
||||
foo allow
|
||||
bar allow
|
||||
*
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
ftpd(8)
|
||||
|
||||
KTH-KRB May 7, 1997 1
|
||||
@@ -1,46 +0,0 @@
|
||||
|
||||
KF(1) UNIX Reference Manual KF(1)
|
||||
|
||||
NNAAMMEE
|
||||
kkff - securly forward tickets
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkff [--pp _p_o_r_t | ----ppoorrtt=_p_o_r_t] [--ll _l_o_g_i_n | ----llooggiinn=_l_o_g_i_n] [--cc _c_c_a_c_h_e |
|
||||
----ccccaacchhee=_c_c_a_c_h_e] [--FF | ----ffoorrwwaarrddaabbllee] [--GG | ----nnoo--ffoorrwwaarrddaabbllee] [--hh |
|
||||
----hheellpp] [----vveerrssiioonn] _h_o_s_t _._._.
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
The kkff program forwards tickets to a remove host through an authenticated
|
||||
and encrypted stream. Options supported are:
|
||||
|
||||
--pp _p_o_r_t, ----ppoorrtt=_p_o_r_t
|
||||
port to connect to
|
||||
|
||||
--ll _l_o_g_i_n, ----llooggiinn=_l_o_g_i_n
|
||||
remote login name
|
||||
|
||||
--cc _c_c_a_c_h_e, ----ccccaacchhee=_c_c_a_c_h_e
|
||||
remote cred cache
|
||||
|
||||
--FF, ----ffoorrwwaarrddaabbllee
|
||||
forward forwardable credentials
|
||||
|
||||
--GG, ----nnoo--ffoorrwwaarrddaabbllee
|
||||
do not forward forwardable credentials
|
||||
|
||||
--hh, ----hheellpp
|
||||
|
||||
----vveerrssiioonn
|
||||
|
||||
kkff is useful when you do not want to enter your password on a remote host
|
||||
but want to have your tickets one for example afs.
|
||||
|
||||
In order for kkff to work you will need to acquire your initial ticket with
|
||||
forwardable flag, ie kkiinniitt ----ffoorrwwaarrddaabbllee.
|
||||
|
||||
tteellnneett is able to forward ticket by itself.
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kinit(1), telnet(1), kfd(8)
|
||||
|
||||
Heimdal July 2, 2000 1
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
KFD(8) UNIX System Manager's Manual KFD(8)
|
||||
|
||||
NNAAMMEE
|
||||
kkffdd - receive forwarded tickets
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkffdd [--pp _p_o_r_t | ----ppoorrtt=_p_o_r_t] [--ii | ----iinneettdd] [--RR _r_e_g_p_a_g | ----rreeggppaagg=_r_e_g_p_a_g]
|
||||
[--hh | ----hheellpp] [----vveerrssiioonn]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
This is the daemon for kf(1). Supported options:
|
||||
|
||||
--pp _p_o_r_t, ----ppoorrtt=_p_o_r_t
|
||||
port to listen to
|
||||
|
||||
--ii, ----iinneettdd
|
||||
not started from inetd
|
||||
|
||||
--RR _r_e_g_p_a_g, ----rreeggppaagg==_r_e_g_p_a_g
|
||||
path to regpag binary
|
||||
|
||||
EEXXAAMMPPLLEESS
|
||||
Put the following in _/_e_t_c_/_i_n_e_t_d_._c_o_n_f:
|
||||
|
||||
kf stream tcp nowait root /usr/heimdal/libexec/kfd kfd
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kf(1)
|
||||
|
||||
Heimdal July 2, 2000 1
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
PFROM(1) UNIX Reference Manual PFROM(1)
|
||||
|
||||
NNAAMMEE
|
||||
ppffrroomm - fetch a list of the current mail via POP
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
ppffrroomm [--44 | ----kkrrbb44] [--55 | ----kkrrbb55] [--vv | ----vveerrbboossee] [--cc | ----ccoouunntt]
|
||||
[----hheeaaddeerr] [--pp _p_o_r_t_-_s_p_e_c | ----ppoorrtt==_p_o_r_t_-_s_p_e_c]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
ppffrroomm is a script that does push --from.
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
push(8)
|
||||
|
||||
HEIMDAL Mars 4, 2000 1
|
||||
@@ -1,77 +0,0 @@
|
||||
|
||||
PUSH(8) UNIX System Manager's Manual PUSH(8)
|
||||
|
||||
NNAAMMEE
|
||||
ppuusshh - fetch mail via POP
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
ppuusshh [--44 | ----kkrrbb44] [--55 | ----kkrrbb55] [--vv | ----vveerrbboossee] [--ff | ----ffoorrkk] [--ll |
|
||||
----lleeaavvee] [----ffrroomm] [--cc | ----ccoouunntt] [----hheeaaddeerrss=_h_e_a_d_e_r_s] [--pp _p_o_r_t_-_s_p_e_c |
|
||||
----ppoorrtt=_p_o_r_t_-_s_p_e_c] _p_o_-_b_o_x _f_i_l_e_n_a_m_e
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
ppuusshh retrieves mail from the post office box _p_o_-_b_o_x, and stores the mail
|
||||
in mbox format in _f_i_l_e_n_a_m_e. The _p_o_-_b_o_x can have any of the following for-
|
||||
mats:
|
||||
`hostname:username'
|
||||
`po:hostname:username'
|
||||
`username@hostname'
|
||||
`po:username@hostname'
|
||||
`hostname'
|
||||
`po:username'
|
||||
|
||||
If no username is specified, ppuusshh assumes that it's the same as on the
|
||||
local machine; _h_o_s_t_n_a_m_e defaults to the value of the MAILHOST environment
|
||||
variable.
|
||||
|
||||
Supported options:
|
||||
|
||||
--44, ----kkrrbb44
|
||||
use Kerberos 4 (if compiled with support for Kerberos 4)
|
||||
|
||||
--55, ----kkrrbb55
|
||||
use Kerberos 5 (if compiled with support for Kerberos 5)
|
||||
|
||||
--ff, ----ffoorrkk
|
||||
fork before starting to delete messages
|
||||
|
||||
--ll, ----lleeaavvee
|
||||
don't delete fetched mail
|
||||
|
||||
----ffrroomm behave like from.
|
||||
|
||||
--cc, ----ccoouunntt
|
||||
first print how many messages and bytes there are.
|
||||
|
||||
----hheeaaddeerrss=_h_e_a_d_e_r_s
|
||||
a list of comma-separated headers that should get printed.
|
||||
|
||||
--pp _p_o_r_t_-_s_p_e_c, ----ppoorrtt=_p_o_r_t_-_s_p_e_c
|
||||
use this port instead of the default `kpop' or `1109'.
|
||||
|
||||
The default is to first try Kerberos 5 authentication and then, if that
|
||||
fails, Kerberos 4.
|
||||
|
||||
EENNVVIIRROONNMMEENNTT
|
||||
MAILHOST
|
||||
points to the post office, if no other hostname is specified.
|
||||
|
||||
EEXXAAMMPPLLEESS
|
||||
$ push cornfield:roosta ~/.emacs-mail-crash-box
|
||||
|
||||
tries to fetch mail for the user _r_o_o_s_t_a from the post office at
|
||||
``cornfield'', and stores the mail in _~_/_._e_m_a_c_s_-_m_a_i_l_-_c_r_a_s_h_-_b_o_x (you are
|
||||
using Gnus, aren't you?)
|
||||
|
||||
$ push --from -5 havregryn
|
||||
|
||||
tries to fetch FFrroomm:: lines for current user at post office ``havregryn''
|
||||
using Kerberos 5.
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
movemail(8), popper(8), from(1), pfrom(1)
|
||||
|
||||
HHIISSTTOORRYY
|
||||
ppuusshh was written while waiting for mmoovveemmaaiill to finish getting the mail.
|
||||
|
||||
HEIMDAL May 31, 1998 2
|
||||
@@ -1,718 +0,0 @@
|
||||
|
||||
TELNET(1) UNIX Reference Manual TELNET(1)
|
||||
|
||||
NNAAMMEE
|
||||
tteellnneett - user interface to the TELNET protocol
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
tteellnneett [--7788EEFFKKLLaaccddffrrxx] [--SS _t_o_s] [--XX _a_u_t_h_t_y_p_e] [--ee _e_s_c_a_p_e_c_h_a_r] [--kk _r_e_a_l_m]
|
||||
[--ll _u_s_e_r] [--nn _t_r_a_c_e_f_i_l_e] [_h_o_s_t [port]]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
The tteellnneett command is used to communicate with another host using the
|
||||
TELNET protocol. If tteellnneett is invoked without the _h_o_s_t argument, it en-
|
||||
ters command mode, indicated by its prompt (tteellnneett>>). In this mode, it
|
||||
accepts and executes the commands listed below. If it is invoked with
|
||||
arguments, it performs an ooppeenn command with those arguments.
|
||||
|
||||
Options:
|
||||
|
||||
--88 Specifies an 8-bit data path. This causes an attempt to negoti-
|
||||
ate the TELNET BINARY option on both input and output.
|
||||
|
||||
--77 Do not try to negotiate TELNET BINARY option.
|
||||
|
||||
--EE Stops any character from being recognized as an escape character.
|
||||
|
||||
--FF If Kerberos V5 authentication is being used, the --FF option allows
|
||||
the local credentials to be forwarded to the remote system, in-
|
||||
cluding any credentials that have already been forwarded into the
|
||||
local environment.
|
||||
|
||||
--KK Specifies no automatic login to the remote system.
|
||||
|
||||
--LL Specifies an 8-bit data path on output. This causes the BINARY
|
||||
option to be negotiated on output.
|
||||
|
||||
--SS _t_o_s Sets the IP type-of-service (TOS) option for the telnet connec-
|
||||
tion to the value _t_o_s, which can be a numeric TOS value or, on
|
||||
systems that support it, a symbolic TOS name found in the
|
||||
/etc/iptos file.
|
||||
|
||||
--XX _a_t_y_p_e
|
||||
Disables the _a_t_y_p_e type of authentication.
|
||||
|
||||
--aa Attempt automatic login. Currently, this sends the user name via
|
||||
the USER variable of the ENVIRON option if supported by the re-
|
||||
mote system. The name used is that of the current user as re-
|
||||
turned by getlogin(2) if it agrees with the current user ID, oth-
|
||||
erwise it is the name associated with the user ID.
|
||||
|
||||
--cc Disables the reading of the user's _._t_e_l_n_e_t_r_c file. (See the
|
||||
ttooggggllee sskkiipprrcc command on this man page.)
|
||||
|
||||
--dd Sets the initial value of the ddeebbuugg toggle to TRUE
|
||||
|
||||
--ee _e_s_c_a_p_e _c_h_a_r
|
||||
Sets the initial tteellnneett tteellnneett escape character to _e_s_c_a_p_e _c_h_a_r.
|
||||
If _e_s_c_a_p_e _c_h_a_r is omitted, then there will be no escape charac-
|
||||
ter.
|
||||
|
||||
--ff If Kerberos V5 authentication is being used, the --ff option allows
|
||||
the local credentials to be forwarded to the remote system.
|
||||
|
||||
--kk _r_e_a_l_m
|
||||
If Kerberos authentication is being used, the --kk option requests
|
||||
that telnet obtain tickets for the remote host in realm realm in-
|
||||
stead of the remote host's realm, as determined by
|
||||
krb_realmofhost(3).
|
||||
|
||||
--ll _u_s_e_r
|
||||
When connecting to the remote system, if the remote system under-
|
||||
stands the ENVIRON option, then _u_s_e_r will be sent to the remote
|
||||
system as the value for the variable USER. This option implies
|
||||
the --aa option. This option may also be used with the ooppeenn com-
|
||||
mand.
|
||||
|
||||
--nn _t_r_a_c_e_f_i_l_e
|
||||
Opens _t_r_a_c_e_f_i_l_e for recording trace information. See the sseett
|
||||
ttrraacceeffiillee command below.
|
||||
|
||||
--rr Specifies a user interface similar to rlogin(1). In this mode,
|
||||
the escape character is set to the tilde (~) character, unless
|
||||
modified by the -e option.
|
||||
|
||||
--xx Turns on encryption of the data stream if possible. This is cur-
|
||||
rently the default and when it fails a warning is issued.
|
||||
|
||||
_h_o_s_t Indicates the official name, an alias, or the Internet address of
|
||||
a remote host.
|
||||
|
||||
_p_o_r_t Indicates a port number (address of an application). If a number
|
||||
is not specified, the default tteellnneett port is used.
|
||||
|
||||
When in rlogin mode, a line of the form ~. disconnects from the remote
|
||||
host; ~ is the telnet escape character. Similarly, the line ~^Z suspends
|
||||
the telnet session. The line ~^] escapes to the normal telnet escape
|
||||
prompt.
|
||||
|
||||
Once a connection has been opened, tteellnneett will attempt to enable the
|
||||
TELNET LINEMODE option. If this fails, then tteellnneett will revert to one of
|
||||
two input modes: either ``character at a time'' or ``old line by line''
|
||||
depending on what the remote system supports.
|
||||
|
||||
When LINEMODE is enabled, character processing is done on the local sys-
|
||||
tem, under the control of the remote system. When input editing or char-
|
||||
acter echoing is to be disabled, the remote system will relay that infor-
|
||||
mation. The remote system will also relay changes to any special charac-
|
||||
ters that happen on the remote system, so that they can take effect on
|
||||
the local system.
|
||||
|
||||
In ``character at a time'' mode, most text typed is immediately sent to
|
||||
the remote host for processing.
|
||||
|
||||
In ``old line by line'' mode, all text is echoed locally, and (normally)
|
||||
only completed lines are sent to the remote host. The ``local echo char-
|
||||
acter'' (initially ``^E'') may be used to turn off and on the local echo
|
||||
(this would mostly be used to enter passwords without the password being
|
||||
echoed).
|
||||
|
||||
If the LINEMODE option is enabled, or if the llooccaallcchhaarrss toggle is TRUE
|
||||
(the default for ``old line by line``; see below), the user's qquuiitt, iinnttrr,
|
||||
and fflluusshh characters are trapped locally, and sent as TELNET protocol se-
|
||||
quences to the remote side. If LINEMODE has ever been enabled, then the
|
||||
user's ssuusspp and eeooff are also sent as TELNET protocol sequences, and qquuiitt
|
||||
is sent as a TELNET ABORT instead of BREAK There are options (see ttooggggllee
|
||||
aauuttoofflluusshh and ttooggggllee aauuttoossyynncchh below) which cause this action to flush
|
||||
subsequent output to the terminal (until the remote host acknowledges the
|
||||
TELNET sequence) and flush previous terminal input (in the case of qquuiitt
|
||||
and iinnttrr).
|
||||
|
||||
|
||||
While connected to a remote host, tteellnneett command mode may be entered by
|
||||
typing the tteellnneett ``escape character'' (initially ``^]''). When in com-
|
||||
mand mode, the normal terminal editing conventions are available.
|
||||
|
||||
The following tteellnneett commands are available. Only enough of each command
|
||||
to uniquely identify it need be typed (this is also true for arguments to
|
||||
the mmooddee, sseett, ttooggggllee, uunnsseett, ssllcc, eennvviirroonn, and ddiissppllaayy commands).
|
||||
|
||||
aauutthh _a_r_g_u_m_e_n_t _._._.
|
||||
The auth command manipulates the information sent through the
|
||||
TELNET AUTHENTICATE option. Valid arguments for the auth com-
|
||||
mand are as follows:
|
||||
|
||||
ddiissaabbllee _t_y_p_e Disables the specified type of authentication.
|
||||
To obtain a list of available types, use the
|
||||
aauutthh ddiissaabbllee ?? command.
|
||||
|
||||
eennaabbllee _t_y_p_e Enables the specified type of authentication.
|
||||
To obtain a list of available types, use the
|
||||
aauutthh eennaabbllee ?? command.
|
||||
|
||||
ssttaattuuss Lists the current status of the various types of
|
||||
authentication.
|
||||
|
||||
cclloossee Close a TELNET session and return to command mode.
|
||||
|
||||
ddiissppllaayy _a_r_g_u_m_e_n_t _._._.
|
||||
Displays all, or some, of the sseett and ttooggggllee values (see be-
|
||||
low).
|
||||
|
||||
eennccrryypptt _a_r_g_u_m_e_n_t _._._.
|
||||
The encrypt command manipulates the information sent through
|
||||
the TELNET ENCRYPT option.
|
||||
|
||||
Note: Because of export controls, the TELNET ENCRYPT option
|
||||
is not supported outside of the United States and Canada.
|
||||
|
||||
Valid arguments for the encrypt command are as follows:
|
||||
|
||||
ddiissaabbllee _t_y_p_e [iinnppuutt | oouuttppuutt]
|
||||
Disables the specified type of encryption. If
|
||||
you omit the input and output, both input and
|
||||
output are disabled. To obtain a list of avail-
|
||||
able types, use the eennccrryypptt ddiissaabbllee ?? command.
|
||||
|
||||
eennaabbllee _t_y_p_e [iinnppuutt | oouuttppuutt]
|
||||
Enables the specified type of encryption. If
|
||||
you omit input and output, both input and output
|
||||
are enabled. To obtain a list of available
|
||||
types, use the eennccrryypptt eennaabbllee ?? command.
|
||||
|
||||
iinnppuutt This is the same as the eennccrryypptt ssttaarrtt iinnppuutt com-
|
||||
mand.
|
||||
|
||||
--iinnppuutt This is the same as the eennccrryypptt ssttoopp iinnppuutt com-
|
||||
mand.
|
||||
|
||||
oouuttppuutt This is the same as the eennccrryypptt ssttaarrtt oouuttppuutt
|
||||
command.
|
||||
|
||||
--oouuttppuutt This is the same as the eennccrryypptt ssttoopp oouuttppuutt com-
|
||||
mand.
|
||||
|
||||
ssttaarrtt [iinnppuutt | oouuttppuutt]
|
||||
Attempts to start encryption. If you omit iinnppuutt
|
||||
and oouuttppuutt, both input and output are enabled.
|
||||
To obtain a list of available types, use the
|
||||
eennccrryypptt eennaabbllee ?? command.
|
||||
|
||||
ssttaattuuss Lists the current status of encryption.
|
||||
|
||||
ssttoopp [iinnppuutt | oouuttppuutt]
|
||||
Stops encryption. If you omit input and output,
|
||||
encryption is on both input and output.
|
||||
|
||||
ttyyppee _t_y_p_e Sets the default type of encryption to be used
|
||||
with later eennccrryypptt ssttaarrtt or eennccrryypptt ssttoopp com-
|
||||
mands.
|
||||
|
||||
eennvviirroonn _a_r_g_u_m_e_n_t_s _._._.
|
||||
The eennvviirroonn command is used to manipulate the the variables
|
||||
that my be sent through the TELNET ENVIRON option. The ini-
|
||||
tial set of variables is taken from the users environment,
|
||||
with only the DISPLAY and PRINTER variables being exported by
|
||||
default. The USER variable is also exported if the --aa or --ll
|
||||
options are used.
|
||||
|
||||
Valid arguments for the eennvviirroonn command are:
|
||||
|
||||
ddeeffiinnee _v_a_r_i_a_b_l_e _v_a_l_u_e
|
||||
Define the variable _v_a_r_i_a_b_l_e to have a value of
|
||||
_v_a_l_u_e. Any variables defined by this command are
|
||||
automatically exported. The _v_a_l_u_e may be enclosed
|
||||
in single or double quotes so that tabs and spaces
|
||||
may be included.
|
||||
|
||||
uunnddeeffiinnee _v_a_r_i_a_b_l_e
|
||||
Remove _v_a_r_i_a_b_l_e from the list of environment vari-
|
||||
ables.
|
||||
|
||||
eexxppoorrtt _v_a_r_i_a_b_l_e
|
||||
Mark the variable _v_a_r_i_a_b_l_e to be exported to the
|
||||
remote side.
|
||||
|
||||
uunneexxppoorrtt _v_a_r_i_a_b_l_e
|
||||
Mark the variable _v_a_r_i_a_b_l_e to not be exported un-
|
||||
less explicitly asked for by the remote side.
|
||||
|
||||
lliisstt List the current set of environment variables.
|
||||
Those marked with a ** will be sent automatically,
|
||||
other variables will only be sent if explicitly
|
||||
requested.
|
||||
|
||||
?? Prints out help information for the eennvviirroonn com-
|
||||
mand.
|
||||
|
||||
llooggoouutt Sends the TELNET LOGOUT option to the remote side. This com-
|
||||
mand is similar to a cclloossee command; however, if the remote
|
||||
side does not support the LOGOUT option, nothing happens. If,
|
||||
however, the remote side does support the LOGOUT option, this
|
||||
command should cause the remote side to close the TELNET con-
|
||||
nection. If the remote side also supports the concept of sus-
|
||||
pending a user's session for later reattachment, the logout
|
||||
argument indicates that you should terminate the session imme-
|
||||
diately.
|
||||
|
||||
mmooddee _t_y_p_e _T_y_p_e is one of several options, depending on the state of the
|
||||
TELNET session. The remote host is asked for permission to go
|
||||
into the requested mode. If the remote host is capable of en-
|
||||
tering that mode, the requested mode will be entered.
|
||||
|
||||
cchhaarraacctteerr Disable the TELNET LINEMODE option, or, if the
|
||||
remote side does not understand the LINEMODE op-
|
||||
tion, then enter ``character at a time`` mode.
|
||||
|
||||
lliinnee Enable the TELNET LINEMODE option, or, if the
|
||||
remote side does not understand the LINEMODE op-
|
||||
tion, then attempt to enter ``old-line-by-line``
|
||||
mode.
|
||||
|
||||
iissiigg (--iissiigg) Attempt to enable (disable) the TRAPSIG mode of
|
||||
the LINEMODE option. This requires that the
|
||||
LINEMODE option be enabled.
|
||||
|
||||
eeddiitt (--eeddiitt) Attempt to enable (disable) the EDIT mode of the
|
||||
LINEMODE option. This requires that the
|
||||
LINEMODE option be enabled.
|
||||
|
||||
ssooffttttaabbss (--ssooffttttaabbss)
|
||||
Attempt to enable (disable) the SOFT_TAB mode of
|
||||
the LINEMODE option. This requires that the
|
||||
LINEMODE option be enabled.
|
||||
|
||||
lliitteecchhoo (--lliitteecchhoo)
|
||||
Attempt to enable (disable) the LIT_ECHO mode of
|
||||
the LINEMODE option. This requires that the
|
||||
LINEMODE option be enabled.
|
||||
|
||||
?? Prints out help information for the mmooddee com-
|
||||
mand.
|
||||
|
||||
ooppeenn _h_o_s_t [--ll _u_s_e_r] [[--]_p_o_r_t]
|
||||
Open a connection to the named host. If no port number is
|
||||
specified, tteellnneett will attempt to contact a TELNET server at
|
||||
the default port. The host specification may be either a host
|
||||
name (see hosts(5)) or an Internet address specified in the
|
||||
``dot notation'' (see inet(3)). The [--ll] option may be used
|
||||
to specify the user name to be passed to the remote system via
|
||||
the ENVIRON option. When connecting to a non-standard port,
|
||||
tteellnneett omits any automatic initiation of TELNET options. When
|
||||
the port number is preceded by a minus sign, the initial op-
|
||||
tion negotiation is done. After establishing a connection,
|
||||
the file _._t_e_l_n_e_t_r_c in the users home directory is opened.
|
||||
Lines beginning with a # are comment lines. Blank lines are
|
||||
ignored. Lines that begin without white space are the start
|
||||
of a machine entry. The first thing on the line is the name
|
||||
of the machine that is being connected to. The rest of the
|
||||
line, and successive lines that begin with white space are as-
|
||||
sumed to be tteellnneett commands and are processed as if they had
|
||||
been typed in manually to the tteellnneett command prompt.
|
||||
|
||||
qquuiitt Close any open TELNET session and exit tteellnneett. An end of file
|
||||
(in command mode) will also close a session and exit.
|
||||
|
||||
sseenndd _a_r_g_u_m_e_n_t_s
|
||||
Sends one or more special character sequences to the remote
|
||||
host. The following are the arguments which may be specified
|
||||
(more than one argument may be specified at a time):
|
||||
|
||||
aabboorrtt Sends the TELNET ABORT (Abort processes) sequence.
|
||||
|
||||
aaoo Sends the TELNET AO (Abort Output) sequence, which
|
||||
should cause the remote system to flush all output
|
||||
_f_r_o_m the remote system _t_o the user's terminal.
|
||||
|
||||
aayytt Sends the TELNET AYT (Are You There) sequence, to
|
||||
which the remote system may or may not choose to re-
|
||||
|
||||
spond.
|
||||
|
||||
bbrrkk Sends the TELNET BRK (Break) sequence, which may have
|
||||
significance to the remote system.
|
||||
|
||||
eecc Sends the TELNET EC (Erase Character) sequence, which
|
||||
should cause the remote system to erase the last char-
|
||||
acter entered.
|
||||
|
||||
eell Sends the TELNET EL (Erase Line) sequence, which
|
||||
should cause the remote system to erase the line cur-
|
||||
rently being entered.
|
||||
|
||||
eeooff Sends the TELNET EOF (End Of File) sequence.
|
||||
|
||||
eeoorr Sends the TELNET EOR (End of Record) sequence.
|
||||
|
||||
eessccaappee Sends the current tteellnneett escape character (initially
|
||||
``^'').
|
||||
|
||||
ggaa Sends the TELNET GA (Go Ahead) sequence, which likely
|
||||
has no significance to the remote system.
|
||||
|
||||
ggeettssttaattuuss
|
||||
If the remote side supports the TELNET STATUS command,
|
||||
ggeettssttaattuuss will send the subnegotiation to request that
|
||||
the server send its current option status.
|
||||
|
||||
iipp Sends the TELNET IP (Interrupt Process) sequence,
|
||||
which should cause the remote system to abort the cur-
|
||||
rently running process.
|
||||
|
||||
nnoopp Sends the TELNET NOP (No OPeration) sequence.
|
||||
|
||||
ssuusspp Sends the TELNET SUSP (SUSPend process) sequence.
|
||||
|
||||
ssyynncchh Sends the TELNET SYNCH sequence. This sequence causes
|
||||
the remote system to discard all previously typed (but
|
||||
not yet read) input. This sequence is sent as TCP ur-
|
||||
gent data (and may not work if the remote system is a
|
||||
4.2BSD system -- if it doesn't work, a lower case
|
||||
``r'' may be echoed on the terminal).
|
||||
|
||||
ddoo _c_m_d
|
||||
|
||||
ddoonntt _c_m_d
|
||||
|
||||
wwiillll _c_m_d
|
||||
|
||||
wwoonntt _c_m_d
|
||||
Sends the TELNET DO _c_m_d sequence. _C_m_d can be either a
|
||||
decimal number between 0 and 255, or a symbolic name
|
||||
for a specific TELNET command. _C_m_d can also be either
|
||||
hheellpp or ?? to print out help information, including a
|
||||
list of known symbolic names.
|
||||
|
||||
?? Prints out help information for the sseenndd command.
|
||||
|
||||
sseett _a_r_g_u_m_e_n_t _v_a_l_u_e
|
||||
|
||||
uunnsseett _a_r_g_u_m_e_n_t _v_a_l_u_e
|
||||
The sseett command will set any one of a number of tteellnneett vari-
|
||||
ables to a specific value or to TRUE. The special value ooffff
|
||||
turns off the function associated with the variable, this is
|
||||
equivalent to using the uunnsseett command. The uunnsseett command will
|
||||
disable or set to FALSE any of the specified functions. The
|
||||
values of variables may be interrogated with the ddiissppllaayy com-
|
||||
mand. The variables which may be set or unset, but not tog-
|
||||
gled, are listed here. In addition, any of the variables for
|
||||
the ttooggggllee command may be explicitly set or unset using the
|
||||
sseett and uunnsseett commands.
|
||||
|
||||
aayytt If TELNET is in localchars mode, or LINEMODE is en-
|
||||
abled, and the status character is typed, a TELNET AYT
|
||||
sequence (see sseenndd aayytt preceding) is sent to the re-
|
||||
mote host. The initial value for the "Are You There"
|
||||
character is the terminal's status character.
|
||||
|
||||
eecchhoo This is the value (initially ``^E'') which, when in
|
||||
``line by line'' mode, toggles between doing local
|
||||
echoing of entered characters (for normal processing),
|
||||
and suppressing echoing of entered characters (for en-
|
||||
tering, say, a password).
|
||||
|
||||
eeooff If tteellnneett is operating in LINEMODE or ``old line by
|
||||
line'' mode, entering this character as the first
|
||||
character on a line will cause this character to be
|
||||
sent to the remote system. The initial value of the
|
||||
eof character is taken to be the terminal's eeooff char-
|
||||
acter.
|
||||
|
||||
eerraassee If tteellnneett is in llooccaallcchhaarrss mode (see ttooggggllee llooccaallcchhaarrss
|
||||
below), aanndd if tteellnneett is operating in ``character at a
|
||||
time'' mode, then when this character is typed, a
|
||||
TELNET EC sequence (see sseenndd eecc above) is sent to the
|
||||
remote system. The initial value for the erase char-
|
||||
acter is taken to be the terminal's eerraassee character.
|
||||
|
||||
eessccaappee This is the tteellnneett escape character (initially ``^['')
|
||||
which causes entry into tteellnneett command mode (when con-
|
||||
nected to a remote system).
|
||||
|
||||
fflluusshhoouuttppuutt
|
||||
If tteellnneett is in llooccaallcchhaarrss mode (see ttooggggllee llooccaallcchhaarrss
|
||||
below) and the fflluusshhoouuttppuutt character is typed, a
|
||||
TELNET AO sequence (see sseenndd aaoo above) is sent to the
|
||||
remote host. The initial value for the flush charac-
|
||||
ter is taken to be the terminal's fflluusshh character.
|
||||
|
||||
ffoorrww11
|
||||
|
||||
ffoorrww22 If TELNET is operating in LINEMODE, these are the
|
||||
characters that, when typed, cause partial lines to be
|
||||
forwarded to the remote system. The initial value for
|
||||
the forwarding characters are taken from the termi-
|
||||
nal's eol and eol2 characters.
|
||||
|
||||
iinntteerrrruupptt
|
||||
If tteellnneett is in llooccaallcchhaarrss mode (see ttooggggllee llooccaallcchhaarrss
|
||||
below) and the iinntteerrrruupptt character is typed, a TELNET
|
||||
IP sequence (see sseenndd iipp above) is sent to the remote
|
||||
host. The initial value for the interrupt character
|
||||
is taken to be the terminal's iinnttrr character.
|
||||
|
||||
kkiillll If tteellnneett is in llooccaallcchhaarrss mode (see ttooggggllee llooccaallcchhaarrss
|
||||
below), aanndd if tteellnneett is operating in ``character at a
|
||||
time'' mode, then when this character is typed, a
|
||||
TELNET EL sequence (see sseenndd eell above) is sent to the
|
||||
remote system. The initial value for the kill charac-
|
||||
ter is taken to be the terminal's kkiillll character.
|
||||
|
||||
llnneexxtt If tteellnneett is operating in LINEMODE or ``old line by
|
||||
line`` mode, then this character is taken to be the
|
||||
terminal's llnneexxtt character. The initial value for the
|
||||
lnext character is taken to be the terminal's llnneexxtt
|
||||
character.
|
||||
|
||||
qquuiitt If tteellnneett is in llooccaallcchhaarrss mode (see ttooggggllee llooccaallcchhaarrss
|
||||
below) and the qquuiitt character is typed, a TELNET BRK
|
||||
sequence (see sseenndd bbrrkk above) is sent to the remote
|
||||
host. The initial value for the quit character is
|
||||
taken to be the terminal's qquuiitt character.
|
||||
|
||||
rreepprriinntt
|
||||
If tteellnneett is operating in LINEMODE or ``old line by
|
||||
line`` mode, then this character is taken to be the
|
||||
terminal's rreepprriinntt character. The initial value for
|
||||
the reprint character is taken to be the terminal's
|
||||
rreepprriinntt character.
|
||||
|
||||
rrllooggiinn This is the rlogin escape character. If set, the nor-
|
||||
mal TELNET escape character is ignored unless it is
|
||||
preceded by this character at the beginning of a line.
|
||||
This character, at the beginning of a line followed by
|
||||
a "." closes the connection; when followed by a ^Z it
|
||||
suspends the telnet command. The initial state is to
|
||||
disable the rlogin escape character.
|
||||
|
||||
ssttaarrtt If the TELNET TOGGLE-FLOW-CONTROL option has been en-
|
||||
abled, then this character is taken to be the termi-
|
||||
nal's ssttaarrtt character. The initial value for the kill
|
||||
character is taken to be the terminal's ssttaarrtt charac-
|
||||
ter.
|
||||
|
||||
ssttoopp If the TELNET TOGGLE-FLOW-CONTROL option has been en-
|
||||
abled, then this character is taken to be the termi-
|
||||
nal's ssttoopp character. The initial value for the kill
|
||||
character is taken to be the terminal's ssttoopp charac-
|
||||
ter.
|
||||
|
||||
ssuusspp If tteellnneett is in llooccaallcchhaarrss mode, or LINEMODE is en-
|
||||
abled, and the ssuussppeenndd character is typed, a TELNET
|
||||
SUSP sequence (see sseenndd ssuusspp above) is sent to the re-
|
||||
mote host. The initial value for the suspend charac-
|
||||
ter is taken to be the terminal's ssuussppeenndd character.
|
||||
|
||||
ttrraacceeffiillee
|
||||
This is the file to which the output, caused by
|
||||
nneettddaattaa or ooppttiioonn tracing being TRUE, will be written.
|
||||
If it is set to ``--'', then tracing information will
|
||||
be written to standard output (the default).
|
||||
|
||||
wwoorrddeerraassee
|
||||
If tteellnneett is operating in LINEMODE or ``old line by
|
||||
line`` mode, then this character is taken to be the
|
||||
terminal's wwoorrddeerraassee character. The initial value for
|
||||
the worderase character is taken to be the terminal's
|
||||
wwoorrddeerraassee character.
|
||||
|
||||
?? Displays the legal sseett (uunnsseett) commands.
|
||||
|
||||
ssllcc _s_t_a_t_e The ssllcc command (Set Local Characters) is used to set or
|
||||
change the state of the the special characters when the TELNET
|
||||
LINEMODE option has been enabled. Special characters are
|
||||
characters that get mapped to TELNET commands sequences (like
|
||||
iipp or qquuiitt) or line editing characters (like eerraassee and kkiillll).
|
||||
|
||||
|
||||
By default, the local special characters are exported.
|
||||
|
||||
cchheecckk Verify the current settings for the current spe-
|
||||
cial characters. The remote side is requested to
|
||||
send all the current special character settings,
|
||||
and if there are any discrepancies with the local
|
||||
side, the local side will switch to the remote
|
||||
value.
|
||||
|
||||
eexxppoorrtt Switch to the local defaults for the special char-
|
||||
acters. The local default characters are those of
|
||||
the local terminal at the time when tteellnneett was
|
||||
started.
|
||||
|
||||
iimmppoorrtt Switch to the remote defaults for the special
|
||||
characters. The remote default characters are
|
||||
those of the remote system at the time when the
|
||||
TELNET connection was established.
|
||||
|
||||
?? Prints out help information for the ssllcc command.
|
||||
|
||||
ssttaattuuss Show the current status of tteellnneett. This includes the peer one
|
||||
is connected to, as well as the current mode.
|
||||
|
||||
ttooggggllee _a_r_g_u_m_e_n_t_s _._._.
|
||||
Toggle (between TRUE and FALSE) various flags that control how
|
||||
tteellnneett responds to events. These flags may be set explicitly
|
||||
to TRUE or FALSE using the sseett and uunnsseett commands listed
|
||||
above. More than one argument may be specified. The state of
|
||||
these flags may be interrogated with the ddiissppllaayy command.
|
||||
Valid arguments are:
|
||||
|
||||
aauutthhddeebbuugg Turns on debugging information for the authenti-
|
||||
cation code.
|
||||
|
||||
aauuttoofflluusshh If aauuttoofflluusshh and llooccaallcchhaarrss are both TRUE, then
|
||||
when the aaoo, or qquuiitt characters are recognized
|
||||
(and transformed into TELNET sequences; see sseett
|
||||
above for details), tteellnneett refuses to display
|
||||
any data on the user's terminal until the remote
|
||||
system acknowledges (via a TELNET TIMING MARK
|
||||
option) that it has processed those TELNET se-
|
||||
quences. The initial value for this toggle is
|
||||
TRUE if the terminal user had not done an "stty
|
||||
noflsh", otherwise FALSE (see stty(1)).
|
||||
|
||||
aauuttooddeeccrryypptt When the TELNET ENCRYPT option is negotiated, by
|
||||
default the actual encryption (decryption) of
|
||||
the data stream does not start automatically.
|
||||
The autoencrypt (autodecrypt) command states
|
||||
that encryption of the output (input) stream
|
||||
should be enabled as soon as possible.
|
||||
|
||||
Note: Because of export controls, the TELNET
|
||||
ENCRYPT option is not supported outside the
|
||||
United States and Canada.
|
||||
|
||||
aauuttoollooggiinn If the remote side supports the TELNET
|
||||
AUTHENTICATION option TELNET attempts to use it
|
||||
to perform automatic authentication. If the
|
||||
AUTHENTICATION option is not supported, the us-
|
||||
er's login name are propagated through the
|
||||
TELNET ENVIRON option. This command is the same
|
||||
as specifying _a option on the ooppeenn command.
|
||||
|
||||
aauuttoossyynncchh If aauuttoossyynncchh and llooccaallcchhaarrss are both TRUE, then
|
||||
when either the iinnttrr or qquuiitt characters is typed
|
||||
(see sseett above for descriptions of the iinnttrr and
|
||||
qquuiitt characters), the resulting TELNET sequence
|
||||
sent is followed by the TELNET SYNCH sequence.
|
||||
This procedure sshhoouulldd cause the remote system to
|
||||
begin throwing away all previously typed input
|
||||
until both of the TELNET sequences have been
|
||||
read and acted upon. The initial value of this
|
||||
toggle is FALSE.
|
||||
|
||||
bbiinnaarryy Enable or disable the TELNET BINARY option on
|
||||
both input and output.
|
||||
|
||||
iinnbbiinnaarryy Enable or disable the TELNET BINARY option on
|
||||
input.
|
||||
|
||||
oouuttbbiinnaarryy Enable or disable the TELNET BINARY option on
|
||||
output.
|
||||
|
||||
ccrrllff If this is TRUE, then carriage returns will be
|
||||
sent as <CR><LF>. If this is FALSE, then car-
|
||||
riage returns will be send as <CR><NUL>. The
|
||||
initial value for this toggle is FALSE.
|
||||
|
||||
ccrrmmoodd Toggle carriage return mode. When this mode is
|
||||
enabled, most carriage return characters re-
|
||||
ceived from the remote host will be mapped into
|
||||
a carriage return followed by a line feed. This
|
||||
mode does not affect those characters typed by
|
||||
the user, only those received from the remote
|
||||
host. This mode is not very useful unless the
|
||||
remote host only sends carriage return, but nev-
|
||||
er line feed. The initial value for this toggle
|
||||
is FALSE.
|
||||
|
||||
ddeebbuugg Toggles socket level debugging (useful only to
|
||||
the ssuuppeerr uusseerr). The initial value for this tog-
|
||||
gle is FALSE.
|
||||
|
||||
eennccddeebbuugg Turns on debugging information for the encryp-
|
||||
tion code.
|
||||
|
||||
llooccaallcchhaarrss If this is TRUE, then the fflluusshh, iinntteerrrruupptt,
|
||||
qquuiitt, eerraassee, and kkiillll characters (see sseett above)
|
||||
are recognized locally, and transformed into
|
||||
(hopefully) appropriate TELNET control sequences
|
||||
(respectively aaoo, iipp, bbrrkk, eecc, and eell; see sseenndd
|
||||
above). The initial value for this toggle is
|
||||
TRUE in ``old line by line'' mode, and FALSE in
|
||||
``character at a time'' mode. When the LINEMODE
|
||||
option is enabled, the value of llooccaallcchhaarrss is
|
||||
ignored, and assumed to always be TRUE. If
|
||||
LINEMODE has ever been enabled, then qquuiitt is
|
||||
sent as aabboorrtt, and eeooff and ssuussppeenndd are sent as
|
||||
eeooff and ssuusspp, see sseenndd above).
|
||||
|
||||
nneettddaattaa Toggles the display of all network data (in hex-
|
||||
adecimal format). The initial value for this
|
||||
toggle is FALSE.
|
||||
|
||||
ooppttiioonnss Toggles the display of some internal tteellnneett pro-
|
||||
tocol processing (having to do with TELNET op-
|
||||
tions). The initial value for this toggle is
|
||||
FALSE.
|
||||
|
||||
pprreettttyydduummpp When the nneettddaattaa toggle is enabled, if
|
||||
pprreettttyydduummpp is enabled the output from the
|
||||
nneettddaattaa command will be formatted in a more user
|
||||
readable format. Spaces are put between each
|
||||
character in the output, and the beginning of
|
||||
any TELNET escape sequence is preceded by a '*'
|
||||
to aid in locating them.
|
||||
|
||||
sskkiipprrcc When the skiprc toggle is TRUE, TELNET skips the
|
||||
reading of the _._t_e_l_n_e_t_r_c file in the users home
|
||||
directory when connections are opened. The ini-
|
||||
tial value for this toggle is FALSE.
|
||||
|
||||
tteerrmmddaattaa Toggles the display of all terminal data (in
|
||||
hexadecimal format). The initial value for this
|
||||
toggle is FALSE.
|
||||
|
||||
vveerrbboossee__eennccrryypptt
|
||||
When the vveerrbboossee__eennccrryypptt toggle is TRUE, TELNET
|
||||
prints out a message each time encryption is en-
|
||||
abled or disabled. The initial value for this
|
||||
toggle is FALSE. Note: Because of export con-
|
||||
trols, data encryption is not supported outside
|
||||
of the United States and Canada.
|
||||
|
||||
?? Displays the legal ttooggggllee commands.
|
||||
|
||||
zz Suspend tteellnneett. This command only works when the user is using
|
||||
the csh(1).
|
||||
|
||||
!! [_c_o_m_m_a_n_d]
|
||||
Execute a single command in a subshell on the local system.
|
||||
If ccoommmmaanndd is omitted, then an interactive subshell is in-
|
||||
voked.
|
||||
|
||||
?? [_c_o_m_m_a_n_d]
|
||||
Get help. With no arguments, tteellnneett prints a help summary.
|
||||
If a command is specified, tteellnneett will print the help informa-
|
||||
tion for just that command.
|
||||
|
||||
EENNVVIIRROONNMMEENNTT
|
||||
TTeellnneett uses at least the HOME, SHELL, DISPLAY, and TERM environment vari-
|
||||
ables. Other environment variables may be propagated to the other side
|
||||
via the TELNET ENVIRON option.
|
||||
|
||||
FFIILLEESS
|
||||
~/.telnetrc user customized telnet startup values
|
||||
|
||||
HHIISSTTOORRYY
|
||||
The TTeellnneett command appeared in 4.2BSD.
|
||||
|
||||
NNOOTTEESS
|
||||
On some remote systems, echo has to be turned off manually when in ``old
|
||||
line by line'' mode.
|
||||
|
||||
In ``old line by line'' mode or LINEMODE the terminal's eeooff character is
|
||||
only recognized (and sent to the remote system) when it is the first
|
||||
character on a line.
|
||||
|
||||
4.2 Berkeley Distribution June 1, 1994 11
|
||||
@@ -1,297 +0,0 @@
|
||||
|
||||
TELNETD(8) UNIX System Manager's Manual TELNETD(8)
|
||||
|
||||
NNAAMMEE
|
||||
tteellnneettdd - DARPA TELNET protocol server
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
tteellnneettdd [--BBUUhhkkllnn] [--DD _d_e_b_u_g_m_o_d_e] [--SS _t_o_s] [--XX _a_u_t_h_t_y_p_e] [--aa _a_u_t_h_m_o_d_e]
|
||||
[--rr_l_o_w_p_t_y_-_h_i_g_h_p_t_y] [--uu _l_e_n] [--ddeebbuugg] [--LL _/_b_i_n_/_l_o_g_i_n] [_p_o_r_t]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
The tteellnneettdd command is a server which supports the DARPA standard TELNET
|
||||
virtual terminal protocol. TTeellnneettdd is normally invoked by the internet
|
||||
server (see inetd(8)) for requests to connect to the TELNET port as in-
|
||||
dicated by the _/_e_t_c_/_s_e_r_v_i_c_e_s file (see services(5)). The --ddeebbuugg option
|
||||
may be used to start up tteellnneettdd manually, instead of through inetd(8).
|
||||
If started up this way, _p_o_r_t may be specified to run tteellnneettdd on an alter-
|
||||
nate TCP port number.
|
||||
|
||||
The tteellnneettdd command accepts the following options:
|
||||
|
||||
--aa _a_u_t_h_m_o_d_e This option may be used for specifying what mode should be
|
||||
used for authentication. Note that this option is only use-
|
||||
ful if tteellnneettdd has been compiled with support for the
|
||||
AUTHENTICATION option. There are several valid values for
|
||||
_a_u_t_h_m_o_d_e:
|
||||
|
||||
debug Turns on authentication debugging code.
|
||||
|
||||
user Only allow connections when the remote user can pro-
|
||||
vide valid authentication information to identify the
|
||||
remote user, and is allowed access to the specified
|
||||
account without providing a password.
|
||||
|
||||
valid Only allow connections when the remote user can pro-
|
||||
vide valid authentication information to identify the
|
||||
remote user. The login(1) command will provide any
|
||||
additional user verification needed if the remote us-
|
||||
er is not allowed automatic access to the specified
|
||||
account.
|
||||
|
||||
other Only allow connections that supply some authentica-
|
||||
tion information. This option is currently not sup-
|
||||
ported by any of the existing authentication mecha-
|
||||
nisms, and is thus the same as specifying --aa vvaalliidd.
|
||||
|
||||
otp Only allow authenticated connections (as with --aa
|
||||
uusseerr) and also logins with one-time passwords (OTPs).
|
||||
This option will call login with an option so that
|
||||
only OTPs are accepted. The user can of course still
|
||||
type secret information at the prompt.
|
||||
|
||||
none This is the default state. Authentication informa-
|
||||
tion is not required. If no or insufficient authen-
|
||||
tication information is provided, then the login(1)
|
||||
program will provide the necessary user verification.
|
||||
|
||||
off This disables the authentication code. All user ver-
|
||||
ification will happen through the login(1) program.
|
||||
|
||||
--BB Ignored.
|
||||
|
||||
--DD _d_e_b_u_g_m_o_d_e
|
||||
This option may be used for debugging purposes. This allows
|
||||
tteellnneettdd to print out debugging information to the connec-
|
||||
tion, allowing the user to see what tteellnneettdd is doing. There
|
||||
are several possible values for _d_e_b_u_g_m_o_d_e:
|
||||
|
||||
ooppttiioonnss Prints information about the negotiation of TELNET
|
||||
options.
|
||||
|
||||
rreeppoorrtt Prints the ooppttiioonnss information, plus some addi-
|
||||
tional information about what processing is going
|
||||
on.
|
||||
|
||||
nneettddaattaa Displays the data stream received by tteellnneettdd.
|
||||
|
||||
ppttyyddaattaa Displays data written to the pty.
|
||||
|
||||
eexxeerrcciissee Has not been implemented yet.
|
||||
|
||||
--hh Disables the printing of host-specific information before
|
||||
login has been completed.
|
||||
|
||||
--kk
|
||||
|
||||
--ll Ignored.
|
||||
|
||||
--nn Disable TCP keep-alives. Normally tteellnneettdd enables the TCP
|
||||
keep-alive mechanism to probe connections that have been
|
||||
idle for some period of time to determine if the client is
|
||||
still there, so that idle connections from machines that
|
||||
have crashed or can no longer be reached may be cleaned up.
|
||||
|
||||
--rr _l_o_w_p_t_y_-_h_i_g_h_p_t_y
|
||||
This option is only enabled when tteellnneettdd is compiled for
|
||||
UNICOS. It specifies an inclusive range of pseudo-terminal
|
||||
devices to use. If the system has sysconf variable
|
||||
_SC_CRAY_NPTY configured, the default pty search range is 0
|
||||
to _SC_CRAY_NPTY; otherwise, the default range is 0 to 128.
|
||||
Either _l_o_w_p_t_y or _h_i_g_h_p_t_y may be omitted to allow changing
|
||||
either end of the search range. If _l_o_w_p_t_y is omitted, the -
|
||||
character is still required so that tteellnneettdd can differenti-
|
||||
ate _h_i_g_h_p_t_y from _l_o_w_p_t_y.
|
||||
|
||||
--SS _t_o_s
|
||||
|
||||
--uu _l_e_n This option is used to specify the size of the field in the
|
||||
utmp structure that holds the remote host name. If the re-
|
||||
solved host name is longer than _l_e_n, the dotted decimal val-
|
||||
ue will be used instead. This allows hosts with very long
|
||||
host names that overflow this field to still be uniquely
|
||||
identified. Specifying --uu00 indicates that only dotted deci-
|
||||
mal addresses should be put into the _u_t_m_p file.
|
||||
|
||||
--UU This option causes tteellnneettdd to refuse connections from ad-
|
||||
dresses that cannot be mapped back into a symbolic name via
|
||||
the gethostbyaddr(3) routine.
|
||||
|
||||
--XX _a_u_t_h_t_y_p_e This option is only valid if tteellnneettdd has been built with
|
||||
support for the authentication option. It disables the use
|
||||
of _a_u_t_h_t_y_p_e authentication, and can be used to temporarily
|
||||
disable a specific authentication type without having to re-
|
||||
compile tteellnneettdd.
|
||||
|
||||
--LL --ppaatthhnnaammee
|
||||
Specify pathname to an alternative login program.
|
||||
|
||||
TTeellnneettdd operates by allocating a pseudo-terminal device (see pty(4)) for
|
||||
a client, then creating a login process which has the slave side of the
|
||||
pseudo-terminal as stdin, stdout and stderr. TTeellnneettdd manipulates the mas-
|
||||
ter side of the pseudo-terminal, implementing the TELNET protocol and
|
||||
passing characters between the remote client and the login process.
|
||||
|
||||
When a TELNET session is started up, tteellnneettdd sends TELNET options to the
|
||||
client side indicating a willingness to do the following TELNET options,
|
||||
which are described in more detail below:
|
||||
|
||||
DO AUTHENTICATION
|
||||
WILL ENCRYPT
|
||||
DO TERMINAL TYPE
|
||||
DO TSPEED
|
||||
DO XDISPLOC
|
||||
DO NEW-ENVIRON
|
||||
DO ENVIRON
|
||||
WILL SUPPRESS GO AHEAD
|
||||
DO ECHO
|
||||
DO LINEMODE
|
||||
DO NAWS
|
||||
WILL STATUS
|
||||
DO LFLOW
|
||||
DO TIMING-MARK
|
||||
|
||||
The pseudo-terminal allocated to the client is configured to operate in
|
||||
``cooked'' mode, and with XTABS and CRMOD enabled (see tty(4)).
|
||||
|
||||
TTeellnneettdd has support for enabling locally the following TELNET options:
|
||||
|
||||
WILL ECHO When the LINEMODE option is enabled, a WILL ECHO or
|
||||
WONT ECHO will be sent to the client to indicate the
|
||||
current state of terminal echoing. When terminal echo
|
||||
is not desired, a WILL ECHO is sent to indicate that
|
||||
telnetd will take care of echoing any data that needs
|
||||
to be echoed to the terminal, and then nothing is
|
||||
echoed. When terminal echo is desired, a WONT ECHO is
|
||||
sent to indicate that telnetd will not be doing any
|
||||
terminal echoing, so the client should do any terminal
|
||||
echoing that is needed.
|
||||
|
||||
WILL BINARY Indicates that the client is willing to send a 8 bits
|
||||
of data, rather than the normal 7 bits of the Network
|
||||
Virtual Terminal.
|
||||
|
||||
WILL SGA Indicates that it will not be sending IAC GA, go
|
||||
ahead, commands.
|
||||
|
||||
WILL STATUS Indicates a willingness to send the client, upon re-
|
||||
quest, of the current status of all TELNET options.
|
||||
|
||||
WILL TIMING-MARK Whenever a DO TIMING-MARK command is received, it is
|
||||
always responded to with a WILL TIMING-MARK
|
||||
|
||||
WILL LOGOUT When a DO LOGOUT is received, a WILL LOGOUT is sent in
|
||||
response, and the TELNET session is shut down.
|
||||
|
||||
WILL ENCRYPT Only sent if tteellnneettdd is compiled with support for data
|
||||
encryption, and indicates a willingness to decrypt the
|
||||
data stream.
|
||||
|
||||
TTeellnneettdd has support for enabling remotely the following TELNET options:
|
||||
|
||||
DO BINARY Sent to indicate that telnetd is willing to receive an
|
||||
8 bit data stream.
|
||||
|
||||
DO LFLOW Requests that the client handle flow control charac-
|
||||
|
||||
|
||||
ters remotely.
|
||||
|
||||
DO ECHO This is not really supported, but is sent to identify
|
||||
a 4.2BSD telnet(1) client, which will improperly re-
|
||||
spond with WILL ECHO. If a WILL ECHO is received, a
|
||||
DONT ECHO will be sent in response.
|
||||
|
||||
DO TERMINAL-TYPE Indicates a desire to be able to request the name of
|
||||
the type of terminal that is attached to the client
|
||||
side of the connection.
|
||||
|
||||
DO SGA Indicates that it does not need to receive IAC GA, the
|
||||
go ahead command.
|
||||
|
||||
DO NAWS Requests that the client inform the server when the
|
||||
window (display) size changes.
|
||||
|
||||
DO TERMINAL-SPEED Indicates a desire to be able to request information
|
||||
about the speed of the serial line to which the client
|
||||
is attached.
|
||||
|
||||
DO XDISPLOC Indicates a desire to be able to request the name of
|
||||
the X windows display that is associated with the tel-
|
||||
net client.
|
||||
|
||||
DO NEW-ENVIRON Indicates a desire to be able to request environment
|
||||
variable information, as described in RFC 1572.
|
||||
|
||||
DO ENVIRON Indicates a desire to be able to request environment
|
||||
variable information, as described in RFC 1408.
|
||||
|
||||
DO LINEMODE Only sent if tteellnneettdd is compiled with support for
|
||||
linemode, and requests that the client do line by line
|
||||
processing.
|
||||
|
||||
DO TIMING-MARK Only sent if tteellnneettdd is compiled with support for both
|
||||
linemode and kludge linemode, and the client responded
|
||||
with WONT LINEMODE. If the client responds with WILL
|
||||
TM, the it is assumed that the client supports kludge
|
||||
linemode. Note that the [--kk] option can be used to
|
||||
disable this.
|
||||
|
||||
DO AUTHENTICATION Only sent if tteellnneettdd is compiled with support for au-
|
||||
thentication, and indicates a willingness to receive
|
||||
authentication information for automatic login.
|
||||
|
||||
DO ENCRYPT Only sent if tteellnneettdd is compiled with support for data
|
||||
encryption, and indicates a willingness to decrypt the
|
||||
data stream.
|
||||
|
||||
EENNVVIIRROONNMMEENNTT
|
||||
FFIILLEESS
|
||||
/etc/services
|
||||
/etc/inittab (UNICOS systems only)
|
||||
/etc/iptos (if supported)
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
telnet(1), login(1)
|
||||
|
||||
SSTTAANNDDAARRDDSS
|
||||
RRFFCC--885544 TELNET PROTOCOL SPECIFICATION
|
||||
RRFFCC--885555 TELNET OPTION SPECIFICATIONS
|
||||
RRFFCC--885566 TELNET BINARY TRANSMISSION
|
||||
RRFFCC--885577 TELNET ECHO OPTION
|
||||
|
||||
|
||||
RRFFCC--885588 TELNET SUPPRESS GO AHEAD OPTION
|
||||
RRFFCC--885599 TELNET STATUS OPTION
|
||||
RRFFCC--886600 TELNET TIMING MARK OPTION
|
||||
RRFFCC--886611 TELNET EXTENDED OPTIONS - LIST OPTION
|
||||
RRFFCC--888855 TELNET END OF RECORD OPTION
|
||||
RRFFCC--11007733 Telnet Window Size Option
|
||||
RRFFCC--11007799 Telnet Terminal Speed Option
|
||||
RRFFCC--11009911 Telnet Terminal-Type Option
|
||||
RRFFCC--11009966 Telnet X Display Location Option
|
||||
RRFFCC--11112233 Requirements for Internet Hosts -- Application and Support
|
||||
RRFFCC--11118844 Telnet Linemode Option
|
||||
RRFFCC--11337722 Telnet Remote Flow Control Option
|
||||
RRFFCC--11441166 Telnet Authentication Option
|
||||
RRFFCC--11441111 Telnet Authentication: Kerberos Version 4
|
||||
RRFFCC--11441122 Telnet Authentication: SPX
|
||||
RRFFCC--11557711 Telnet Environment Option Interoperability Issues
|
||||
RRFFCC--11557722 Telnet Environment Option
|
||||
|
||||
BBUUGGSS
|
||||
Some TELNET commands are only partially implemented.
|
||||
|
||||
Because of bugs in the original 4.2 BSD telnet(1), tteellnneettdd performs some
|
||||
dubious protocol exchanges to try to discover if the remote client is, in
|
||||
fact, a 4.2 BSD telnet(1).
|
||||
|
||||
Binary mode has no common interpretation except between similar operating
|
||||
systems (Unix in this case).
|
||||
|
||||
The terminal type name received from the remote client is converted to
|
||||
lower case.
|
||||
|
||||
TTeellnneettdd never sends TELNET IAC GA (go ahead) commands.
|
||||
|
||||
4.2 Berkeley Distribution June 1, 1994 5
|
||||
@@ -1,287 +0,0 @@
|
||||
@c $Id: programming.texi,v 1.2 2001/05/16 22:11:00 assar Exp $
|
||||
|
||||
@node Programming with Kerberos
|
||||
@chapter Programming with Kerberos
|
||||
|
||||
First you need to know how the Kerberos model works, go read the
|
||||
introduction text (@pxref{What is Kerberos?}).
|
||||
|
||||
@macro manpage{man, section}
|
||||
@cite{\man\(\section\)}
|
||||
@end macro
|
||||
|
||||
@menu
|
||||
* Kerberos 5 API Overview::
|
||||
* Walkthru a sample Kerberos 5 client::
|
||||
* Validating a password in a server application::
|
||||
@end menu
|
||||
|
||||
@node Kerberos 5 API Overview, Walkthru a sample Kerberos 5 client, Programming with Kerberos, Programming with Kerberos
|
||||
@section Kerberos 5 API Overview
|
||||
|
||||
Most functions are documenteded in manual pages. This overview only
|
||||
tries to point to where to look for a specific function.
|
||||
|
||||
@subsection Kerberos context
|
||||
|
||||
A kerberos context (@code{krb5_context}) holds all per thread state. All global variables that
|
||||
are context specific are stored in this struture, including default
|
||||
encryption types, credential-cache (ticket file), and default realms.
|
||||
|
||||
See the manual pages for @manpage{krb5_context,3} and
|
||||
@manpage{krb5_init_context,3}.
|
||||
|
||||
@subsection Kerberos authenication context
|
||||
|
||||
Kerberos authentication context (@code{krb5_auth_context}) holds all
|
||||
context related to an authenticated connection, in a similar way to the
|
||||
kerberos context that holds the context for the thread or process.
|
||||
|
||||
The @code{krb5_auth_context} is used by various functions that are
|
||||
directly related to authentication between the server/client. Example of
|
||||
data that this structure contains are various flags, addresses of client
|
||||
and server, port numbers, keyblocks (and subkeys), sequence numbers,
|
||||
replay cache, and checksum types.
|
||||
|
||||
See the manual page for @manpage{krb5_auth_context,3}.
|
||||
|
||||
@subsection Keytab managment
|
||||
|
||||
A keytab is a storage for locally stored keys. Heimdal includes keytab
|
||||
support for Kerberos 5 keytabs, Kerberos 4 srvtab, AFS-KeyFile's,
|
||||
and for storing keys in memory.
|
||||
|
||||
See also manual page for @manpage{krb5_keytab,3}
|
||||
|
||||
@node Walkthru a sample Kerberos 5 client, Validating a password in a server application, Kerberos 5 API Overview, Programming with Kerberos
|
||||
@section Walkthru a sample Kerberos 5 client
|
||||
|
||||
This example contains parts of a sample TCP Kerberos 5 clients, if you
|
||||
want a real working client, please look in @file{appl/test} directory in
|
||||
the Heimdal distribution.
|
||||
|
||||
All Kerberos error-codes that are returned from kerberos functions in
|
||||
this program are passed to @code{krb5_err}, that will print a
|
||||
descriptive text of the error code and exit. Graphical programs can
|
||||
convert error-code to a humal readable error-string with the
|
||||
@manpage{krb5_get_err_text,3} function.
|
||||
|
||||
Note that you should not use any Kerberos function before
|
||||
@code{krb5_init_context()} have completed successfully. That is the
|
||||
reson @code{err()} is used when @code{krb5_init_context()} fails.
|
||||
|
||||
First the client needs to call @code{krb5_init_context} to initialize
|
||||
the Kerberos 5 library. This is only needed once per thread
|
||||
in the program. If the function returns a non-zero value it indicates
|
||||
that either the Kerberos implemtation is failing or its disabled on
|
||||
this host.
|
||||
|
||||
@example
|
||||
#include <krb5.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
@{
|
||||
krb5_context context;
|
||||
|
||||
if (krb5_context(&context))
|
||||
errx (1, "krb5_context");
|
||||
@end example
|
||||
|
||||
Now the client wants to connect to the host at the other end. The
|
||||
preferred way of doing this is using @manpage{getaddrinfo,3} (for
|
||||
operating system that have this function implemented), since getaddrinfo
|
||||
is neutral to the address type and can use any protocol that is available.
|
||||
|
||||
@example
|
||||
struct addrinfo *ai, *a;
|
||||
struct addrinfo hints;
|
||||
int error;
|
||||
|
||||
memset (&hints, 0, sizeof(hints));
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
error = getaddrinfo (hostname, "pop3", &hints, &ai);
|
||||
if (error)
|
||||
errx (1, "%s: %s", hostname, gai_strerror(error));
|
||||
|
||||
for (a = ai; a != NULL; a = a->ai_next) @{
|
||||
int s;
|
||||
|
||||
s = socket (a->ai_family, a->ai_socktype, a->ai_protocol);
|
||||
if (s < 0)
|
||||
continue;
|
||||
if (connect (s, a->ai_addr, a->ai_addrlen) < 0) @{
|
||||
warn ("connect(%s)", hostname);
|
||||
close (s);
|
||||
continue;
|
||||
@}
|
||||
freeaddrinfo (ai);
|
||||
ai = NULL;
|
||||
@}
|
||||
if (ai) @{
|
||||
freeaddrinfo (ai);
|
||||
errx ("failed to contact %s", hostname);
|
||||
@}
|
||||
@end example
|
||||
|
||||
Before authenticating, an authentication context needs to be
|
||||
created. This context keeps all information for one (to be) authenticated
|
||||
connection (see @manpage{krb5_auth_context,3}).
|
||||
|
||||
@example
|
||||
status = krb5_auth_con_init (context, &auth_context);
|
||||
if (status)
|
||||
krb5_err (context, 1, status, "krb5_auth_con_init");
|
||||
@end example
|
||||
|
||||
For setting the address in the authentication there is a help function
|
||||
@code{krb5_auth_con_setaddrs_from_fd} that does everthing that is needed
|
||||
when given a connected file descriptor to the socket.
|
||||
|
||||
@example
|
||||
status = krb5_auth_con_setaddrs_from_fd (context,
|
||||
auth_context,
|
||||
&sock);
|
||||
if (status)
|
||||
krb5_err (context, 1, status,
|
||||
"krb5_auth_con_setaddrs_from_fd");
|
||||
@end example
|
||||
|
||||
The next step is to build a server principal for the service we want
|
||||
to connect to. (See also @manpage{krb5_sname_to_principal,3}.)
|
||||
|
||||
@example
|
||||
status = krb5_sname_to_principal (context,
|
||||
hostname,
|
||||
service,
|
||||
KRB5_NT_SRV_HST,
|
||||
&server);
|
||||
if (status)
|
||||
krb5_err (context, 1, status, "krb5_sname_to_principal");
|
||||
@end example
|
||||
|
||||
The client principal is not passed to @manpage{krb5_sendauth,3}
|
||||
function, this causes the @code{krb5_sendauth} function to try to figure it
|
||||
out itself.
|
||||
|
||||
The server program is using the function @manpage{krb5_recvauth,3} to
|
||||
receive the Kerberos 5 authenticator.
|
||||
|
||||
In this case, mutual authenication will be tried. That means that the server
|
||||
will authenticate to the client. Using mutual authenication
|
||||
is good since it enables the user to verify that they are talking to the
|
||||
right server (a server that knows the key).
|
||||
|
||||
If you are using a non-blocking socket you will need to do all work of
|
||||
@code{krb5_sendauth} yourself. Basically you need to send over the
|
||||
authenticator from @manpage{krb5_mk_req,3} and, in case of mutual
|
||||
authentication, verifying the result from the server with
|
||||
@manpage{krb5_rd_rep,3}.
|
||||
|
||||
@example
|
||||
status = krb5_sendauth (context,
|
||||
&auth_context,
|
||||
&sock,
|
||||
VERSION,
|
||||
NULL,
|
||||
server,
|
||||
AP_OPTS_MUTUAL_REQUIRED,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
if (status)
|
||||
krb5_err (context, 1, status, "krb5_sendauth");
|
||||
@end example
|
||||
|
||||
Once authentication has been performed, it is time to send some
|
||||
data. First we create a krb5_data structure, then we sign it with
|
||||
@manpage{krb5_mk_safe,3} using the @code{auth_context} that contains the
|
||||
session-key that was exchanged in the
|
||||
@manpage{krb5_sendauth,3}/@manpage{krb5_recvauth,3} authentication
|
||||
sequence.
|
||||
|
||||
@example
|
||||
data.data = "hej";
|
||||
data.length = 3;
|
||||
|
||||
krb5_data_zero (&packet);
|
||||
|
||||
status = krb5_mk_safe (context,
|
||||
auth_context,
|
||||
&data,
|
||||
&packet,
|
||||
NULL);
|
||||
if (status)
|
||||
krb5_err (context, 1, status, "krb5_mk_safe");
|
||||
@end example
|
||||
|
||||
And send it over the network.
|
||||
|
||||
@example
|
||||
len = packet.length;
|
||||
net_len = htonl(len);
|
||||
|
||||
if (krb5_net_write (context, &sock, &net_len, 4) != 4)
|
||||
err (1, "krb5_net_write");
|
||||
if (krb5_net_write (context, &sock, packet.data, len) != len)
|
||||
err (1, "krb5_net_write");
|
||||
@end example
|
||||
|
||||
To send encrypted (and signed) data @manpage{krb5_mk_priv,3} should be
|
||||
used instead. @manpage{krb5_mk_priv,3} works the same way as
|
||||
@manpage{krb5_mk_safe,3}, with the exception that it encrypts the data
|
||||
in addition to signing it.
|
||||
|
||||
@example
|
||||
data.data = "hemligt";
|
||||
data.length = 7;
|
||||
|
||||
krb5_data_free (&packet);
|
||||
|
||||
status = krb5_mk_priv (context,
|
||||
auth_context,
|
||||
&data,
|
||||
&packet,
|
||||
NULL);
|
||||
if (status)
|
||||
krb5_err (context, 1, status, "krb5_mk_priv");
|
||||
@end example
|
||||
|
||||
And send it over the network.
|
||||
|
||||
@example
|
||||
len = packet.length;
|
||||
net_len = htonl(len);
|
||||
|
||||
if (krb5_net_write (context, &sock, &net_len, 4) != 4)
|
||||
err (1, "krb5_net_write");
|
||||
if (krb5_net_write (context, &sock, packet.data, len) != len)
|
||||
err (1, "krb5_net_write");
|
||||
|
||||
@end example
|
||||
|
||||
The server is using @manpage{krb5_rd_safe,3} and
|
||||
@manpage{krb5_rd_priv,3} to verify the signature and decrypt the packet.
|
||||
|
||||
@node Validating a password in a server application, , Walkthru a sample Kerberos 5 client, Programming with Kerberos
|
||||
@section Validating a password in an application
|
||||
|
||||
See the manual page for @manpage{krb5_verify_user,3}.
|
||||
|
||||
@c @node Why you should use GSS-API for new applications, Walkthru a sample GSS-API client, Validating a password in a server application, Programming with Kerberos
|
||||
@c @section Why you should use GSS-API for new applications
|
||||
@c
|
||||
@c SSPI, bah, bah, microsoft, bah, bah, almost GSS-API.
|
||||
@c
|
||||
@c It would also be possible for other mechanisms then Kerberos, but that
|
||||
@c doesn't exist any other GSS-API implementations today.
|
||||
@c
|
||||
@c @node Walkthru a sample GSS-API client, , Why you should use GSS-API for new applications, Programming with Kerberos
|
||||
@c @section Walkthru a sample GSS-API client
|
||||
@c
|
||||
@c Write about how gssapi_clent.c works.
|
||||
@@ -1,725 +0,0 @@
|
||||
|
||||
|
||||
Kerberos Working Group M. Swift
|
||||
Internet Draft University of WA
|
||||
Document: draft-ietf-krb-wg-kerberos-referrals-00.txt J. Brezak
|
||||
Category: Standards Track Microsoft
|
||||
J. Trostle
|
||||
Cisco Systems
|
||||
K. Raeburn
|
||||
MIT
|
||||
February 2001
|
||||
|
||||
|
||||
Generating KDC Referrals to locate Kerberos realms
|
||||
|
||||
|
||||
Status of this Memo
|
||||
|
||||
This document is an Internet-Draft and is in full conformance with
|
||||
all provisions of Section 10 of RFC2026 [1].
|
||||
|
||||
Internet-Drafts are working documents of the Internet Engineering
|
||||
Task Force (IETF), its areas, and its working groups. Note that
|
||||
other groups may also distribute working documents as Internet-
|
||||
Drafts. Internet-Drafts are draft documents valid for a maximum of
|
||||
six months and may be updated, replaced, or obsoleted by other
|
||||
documents at any time. It is inappropriate to use Internet- Drafts
|
||||
as reference material or to cite them other than as "work in
|
||||
progress."
|
||||
|
||||
The list of current Internet-Drafts can be accessed at
|
||||
http://www.ietf.org/ietf/1id-abstracts.txt
|
||||
The list of Internet-Draft Shadow Directories can be accessed at
|
||||
http://www.ietf.org/shadow.html.
|
||||
|
||||
1. Abstract
|
||||
|
||||
The draft documents a new method for a Kerberos Key Distribution
|
||||
Center (KDC) to respond to client requests for kerberos tickets when
|
||||
the client does not have detailed configuration information on the
|
||||
realms of users or services. The KDC will handle requests for
|
||||
principals in other realms by returning either a referral error or a
|
||||
cross-realm TGT to another realm on the referral path. The clients
|
||||
will use this referral information to reach the realm of the target
|
||||
principal and then receive the ticket.
|
||||
|
||||
2. Conventions used in this document
|
||||
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
|
||||
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in
|
||||
this document are to be interpreted as described in RFC-2119 [2].
|
||||
|
||||
3. Introduction
|
||||
|
||||
|
||||
|
||||
|
||||
Swift Category - Standards Track 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KDC Referrals February 2001
|
||||
|
||||
|
||||
Current implementations of the Kerberos AS and TGS protocols, as
|
||||
defined in RFC 1510 [3], use principal names constructed from a
|
||||
known user or service name and realm. A service name is typically
|
||||
constructed from a name of the service and the DNS host name of the
|
||||
computer that is providing the service. Many existing deployments of
|
||||
Kerberos use a single Kerberos realm where all users and services
|
||||
would be using the same realm. However in an environment where there
|
||||
are multiple trusted Kerberos realms, the client needs to be able to
|
||||
determine what realm a particular user or service is in before
|
||||
making an AS or TGS request. Traditionally this requires client
|
||||
configuration to make this possible.
|
||||
|
||||
When having to deal with multiple trusted realms, users are forced
|
||||
to know what realm they are in before they can obtain a ticket
|
||||
granting ticket (TGT) with an AS request. However, in many cases the
|
||||
user would like to use a more familiar name that is not directly
|
||||
related to the realm of their Kerberos principal name. A good
|
||||
example of this is an RFC-822 style email name. This document
|
||||
describes a mechanism that would allow a user to specify a user
|
||||
principal name that is an alias for the user's Kerberos principal
|
||||
name. In practice this would be the name that the user specifies to
|
||||
obtain a TGT from a Kerberos KDC. The user principal name no longer
|
||||
has a direct relationship with the Kerberos principal or realm. Thus
|
||||
the administrator is able to move the user's principal to other
|
||||
realms without the user having to know that it happened.
|
||||
|
||||
Once a user has a TGT, they would like to be able to access services
|
||||
in any trusted Kerberos realm. To do this requires that the client
|
||||
be able to determine what realm the target service's host is in
|
||||
before making the TGS request. Current implementations of Kerberos
|
||||
typically have a table that maps DNS host names to corresponding
|
||||
Kerberos realms. In order for this to work on the client, each
|
||||
application canonicalizes the host name of the service by doing a
|
||||
DNS lookup followed by a reverse lookup using the returned IP
|
||||
address. The returned primary host name is then used in the
|
||||
construction of the principal name for the target service. In order
|
||||
for the correct realm to be added for the target host, the mapping
|
||||
table [domain_to_realm] is consulted for the realm corresponding to
|
||||
the DNS host name. The corresponding realm is then used to complete
|
||||
the target service principal name.
|
||||
|
||||
This traditional mechanism requires that each client have very
|
||||
detailed configuration information about the hosts that are
|
||||
providing services and their corresponding realms. Having client
|
||||
side configuration information can be very costly from an
|
||||
administration point of view - especially if there are many realms
|
||||
and computers in the environment.
|
||||
|
||||
Current implementations of Kerberos also have difficulty with
|
||||
services on hosts that can have multiple host names (multi-homed
|
||||
hosts). Traditionally, each host name would need to have a distinct
|
||||
principal and a corresponding key. An extreme example of this would
|
||||
be a Web server with multiple host names for each domain that it is
|
||||
|
||||
Swift Category - Standards Track 2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KDC Referrals February 2001
|
||||
|
||||
|
||||
supporting. Principal aliases allow multi-homed hosts to have a
|
||||
single Kerberos principal (with a single key) that can have
|
||||
identities for each distinct host name. This mechanism allows the
|
||||
Kerberos client to request a service ticket for the distinct
|
||||
hostname and allows the KDC to return a ticket for the single
|
||||
principal that the host is using. This canonical principal name
|
||||
allows the host to only have to manage a single key for all of the
|
||||
identities that it supports. In addition, the client only needs to
|
||||
know the realm of the canonical service name, not all of the
|
||||
identities.
|
||||
|
||||
This draft proposes a solution for these problems and simplifies
|
||||
administration by minimizing the configuration information needed on
|
||||
each computer using Kerberos. Specifically it describes a mechanism
|
||||
to allow the KDC to handle Canonicalization of names, provide for
|
||||
principal aliases for users and services and provide a mechanism for
|
||||
the KDC to determine the trusted realm authentication path by being
|
||||
able to generate referrals to other realms in order to locate
|
||||
principals.
|
||||
|
||||
To rectify these problems, this draft introduces three new kinds of
|
||||
KDC referrals:
|
||||
|
||||
1. AS ticket referrals, in which the client doesn't know which realm
|
||||
contains a user account.
|
||||
2. TGS ticket referrals, in which the client doesn't know which
|
||||
realm contains a server account.
|
||||
3. Cross realm shortcut referrals, in which the KDC chooses the next
|
||||
path on a referral chain
|
||||
|
||||
4. Realm Organization Model
|
||||
|
||||
This draft assumes that the world of principals is arranged on
|
||||
multiple levels: the realm, the enterprise, and the world. A KDC may
|
||||
issue tickets for any principal in its realm or cross-realm tickets
|
||||
for realms with which it has a direct trust relationship. The KDC
|
||||
also has access to a trusted name service that can resolve any name
|
||||
from within its enterprise into a realm. This trusted name service
|
||||
removes the need to use an untrusted DNS lookup for name resolution.
|
||||
|
||||
For example, consider the following configuration, where lines
|
||||
indicate trust relationships:
|
||||
|
||||
MS.COM
|
||||
/ \
|
||||
/ \
|
||||
OFFICE.MS.COM NT.MS.COM
|
||||
|
||||
In this configuration, all users in the MS.COM enterprise could have
|
||||
a principal name such as [email protected], with the same realm portion.
|
||||
In addition, servers at MS.COM should be able to have DNS host names
|
||||
from any DNS domain independent of what Kerberos realm their
|
||||
principal resides in.
|
||||
|
||||
Swift Category - Standards Track 3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KDC Referrals February 2001
|
||||
|
||||
|
||||
|
||||
5. Principal Names
|
||||
|
||||
5.1 Service Principal Names
|
||||
|
||||
The standard Kerberos model in RFC 1510 [3] gives each Kerberos
|
||||
principal a single name. However, if a service is reachable by
|
||||
several addresses, it is useful for a principal to have multiple
|
||||
names. Consider a service running on a multi-homed machine. Rather
|
||||
than requiring a separate principal and password for each name it
|
||||
exports, a single account with multiple names could be used.
|
||||
|
||||
Multiple names are also useful for services in that clients need not
|
||||
perform DNS lookups to resolve a host name into a full DNS address.
|
||||
Instead, the service may have a name for each of its supported host
|
||||
names, including its IP address. Nonetheless, it is still convenient
|
||||
for the service to not have to be aware of all these names. Thus a
|
||||
new name may be added to DNS for a service by updating DNS and the
|
||||
KDC database without having to notify the service. In addition, it
|
||||
implies that these aliases are globally unique: they do not include
|
||||
a specifier dictating what realm contains the principal. Thus, an
|
||||
alias for a server is of the form "class/instance/name" and may be
|
||||
transmitted as any name type.
|
||||
|
||||
5.2 Client Principal Names
|
||||
|
||||
Similarly, a client account may also have multiple principal names.
|
||||
More useful, though, is a globally unique name that allows
|
||||
unification of email and security principal names. For example, all
|
||||
users at MS may have a client principal name of the form
|
||||
"[email protected]" even though the principals are contained in multiple
|
||||
realms. This global name is again an alias for the true client
|
||||
principal name, which is indicates what realm contains the
|
||||
principal. Thus, accounts "alice" in the realm ntdev.MS.COM and
|
||||
"bob" in office.MS.COM may logon as "[email protected]" and "[email protected]".
|
||||
This requires a new client principal name type, as the AS-REQ
|
||||
message only contains a single realm field, and the realm portion of
|
||||
this name doesn't correspond to any Kerberos realm. Thus, the entire
|
||||
name "[email protected]" is transmitted in the client name field of the
|
||||
AS-REQ message, with a name type of KRB-NT-ENTERPRISE-PRINCIPAL.
|
||||
|
||||
KRB-NT-ENTERPRISE-PRINCIPAL 10
|
||||
|
||||
5.3 Name Canonicalization
|
||||
|
||||
In order to support name aliases, the Kerberos client must
|
||||
explicitly request the name-canonicalization KDC option (bit 15) in
|
||||
the ticket flags for the TGS-REQ. This flag indicates to the KDC
|
||||
that the client is prepared to receive a reply with a different
|
||||
client or server principal name than the request. Thus, the
|
||||
KDCOptions types is redefined as:
|
||||
|
||||
KDCOptions ::= BIT STRING {
|
||||
|
||||
Swift Category - Standards Track 4
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KDC Referrals February 2001
|
||||
|
||||
|
||||
reserved(0),
|
||||
forwardable(1),
|
||||
forwarded(2),
|
||||
proxiable(3),
|
||||
proxy(4),
|
||||
allow-postdate(5),
|
||||
postdated(6),
|
||||
unused7(7),
|
||||
renewable(8),
|
||||
unused9(9),
|
||||
unused10(10),
|
||||
unused11(11),
|
||||
name-canonicalize(15),
|
||||
renewable-ok(27),
|
||||
enc-tkt-in-skey(28),
|
||||
renew(30),
|
||||
validate(31)
|
||||
}
|
||||
|
||||
6. Client Referrals
|
||||
|
||||
The simplest form of ticket referral is for a user requesting a
|
||||
ticket using an AS-REQ. In this case, the client machine will send
|
||||
the AS request to a convenient trusted realm, either the realm of
|
||||
the client machine or the realm of the client name. In the case of
|
||||
the name [email protected], the client may optimistically choose to send
|
||||
the request to MS.COM.
|
||||
|
||||
The client will send the string "[email protected]" in the client
|
||||
principal name field using the KRB-NT-ENTERPRISE-PRINCIPAL name type
|
||||
with the crealm set to MS.COM. The KDC will try to lookup the name
|
||||
in its local account database. If the account is present in the
|
||||
crealm of the request, it MUST return a KDC reply structure with the
|
||||
appropriate ticket. If the account is not present in the crealm
|
||||
specified in the request and the name-canonicalize flag in the
|
||||
KDCoptions is set, the KDC will try to lookup the entire name,
|
||||
[email protected], using a name service. If this lookup is unsuccessful,
|
||||
it MUST return the error KDC_ERR_C_PRINCIPAL_UNKNOWN. If the lookup
|
||||
is successful, it MUST return an error KDC_ERR_WRONG_REALM (0x44)
|
||||
and in the error message the cname and crealm field MUST contain the
|
||||
client name and the true realm of the client. If the KDC contains
|
||||
the account locally, it MUST return a normal ticket. The client name
|
||||
and realm portions of the ticket and KDC reply message MUST be the
|
||||
client's true name in the realm, not the globally unique name.
|
||||
|
||||
If the client receives a KDC_ERR_WRONG_REALM error, it will issue a
|
||||
new AS request with the same client principal name used to generate
|
||||
the first referral to the realm specified by the crealm field of the
|
||||
kerberos error message from the first request. This request MUST
|
||||
produce a valid AS response with a ticket for the canonical user
|
||||
name. The ticket MUST also include the ticket extension containing
|
||||
the TE-REFERRAL-DATA with the referred-names set to the name from
|
||||
|
||||
|
||||
Swift Category - Standards Track 5
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KDC Referrals February 2001
|
||||
|
||||
|
||||
the AS request. Any other error or referral will terminate the
|
||||
request and result in a failed AS request.
|
||||
|
||||
7. Server Referrals
|
||||
|
||||
The server referral mechanism is a bit more complex than the client
|
||||
referral mechanism. The primary problem is that the KDC must return
|
||||
a referral ticket rather than an error message, so it will include
|
||||
in the TGS response information about what realm contains the
|
||||
service. This is done by returning information about the server name
|
||||
in the pre-auth data field of the KDC reply.
|
||||
|
||||
If the KDC resolves the server principal name into a principal in
|
||||
its realm, it may return a normal ticket. If the name-canonicalize
|
||||
flag in the KDCoptions is not set, then the KDC MUST only look up
|
||||
the name as a normal principal name. Otherwise, it MUST search all
|
||||
aliases as well. The server principal name in both the ticket and
|
||||
the KDC reply MUST be the true server principal name instead of one
|
||||
of the aliases. This frees the application server from needing to
|
||||
know about all its aliases.
|
||||
|
||||
If the name-canonicalize flag in the KDCoptions is set and the KDC
|
||||
doesn't find the principal locally, the KDC can return a cross-realm
|
||||
ticket granting ticket to the next hop on the trust path towards a
|
||||
realm that may be able to resolve the principal name.
|
||||
|
||||
If the KDC can determine the service principal's realm, it can
|
||||
return the server realm as ticket extension data. The ticket
|
||||
extension MUST be encrypted using the session key from the ticket,
|
||||
and the same etype as is used to protect the TGS reply body.
|
||||
|
||||
The data itself is an ASN.1 encoded structure containing the
|
||||
server's realm, and if known, canonical principal name and alias
|
||||
names. The first name in the sequence is the canonical principal
|
||||
name.
|
||||
|
||||
TE-REFERRAL-INFO 20
|
||||
|
||||
TE-REFERRAL-DATA ::= SEQUENCE {
|
||||
referred-server-realm[0] KERB-REALM
|
||||
referred-names[1] SEQUENCE OF
|
||||
PrincipalNames OPTIONAL
|
||||
}
|
||||
|
||||
|
||||
The client can use this information to request a chain of cross-
|
||||
realm ticket granting tickets until it reaches the realm of the
|
||||
server, and can then expect to receive a valid service ticket.
|
||||
|
||||
In order to facilitate cross-realm interoperability, a client SHOULD
|
||||
NOT send short names in TGS requests to the KDC. A short name is
|
||||
defined as a Kerberos name that includes a DNS name that is not
|
||||
fully qualified. The client MAY use forward DNS lookups to obtain
|
||||
|
||||
Swift Category - Standards Track 6
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KDC Referrals February 2001
|
||||
|
||||
|
||||
the long name that corresponds to the user entered short name (the
|
||||
short name will be a prefix of the corresponding long name).
|
||||
|
||||
The client may use the referred-names field to tell if it already
|
||||
has a ticket to the server in its ticket cache.
|
||||
|
||||
The client can use this information to request a chain of cross-
|
||||
realm ticket granting tickets until it reaches the realm of the
|
||||
server, and can then expect to receive a valid service ticket.
|
||||
However an implementation should limit the number of referrals that
|
||||
it processes to avoid infinite referral loops. A suggested limit is
|
||||
5 referrals before giving up.
|
||||
|
||||
8. Cross Realm Routing
|
||||
|
||||
The current Kerberos protocol requires the client to explicitly
|
||||
request a cross-realm TGT for each pair of realms on a referral
|
||||
chain. As a result, the client machines need to be aware of the
|
||||
trust hierarchy and of any short-cut trusts (those that aren't
|
||||
parent-child trusts). This requires more configurations on the
|
||||
client. Instead, the client should be able to request a TGT to the
|
||||
target realm from each realm on the route. The KDC will determine
|
||||
the best path for the client and return a cross-realm TGT. The
|
||||
client has to be aware that a request for a cross-realm TGT may
|
||||
return a TGT for a realm different from the one requested.
|
||||
|
||||
9. Security Considerations
|
||||
|
||||
The original Kerberos specification stated that the server principal
|
||||
name in the KDC reply was the same as the server name in the
|
||||
request. These protocol changes break that assumption, so the client
|
||||
may be vulnerable to a denial of service attack by an attacker that
|
||||
replays replies from previous requests. It can verify that the
|
||||
request was one of its own by checking the client-address field or
|
||||
authtime field, though, so the damage is limited and detectable.
|
||||
|
||||
For the AS exchange case, it is important that the logon mechanism
|
||||
not trust a name that has not been used to authenticate the user.
|
||||
For example, the name that the user enters as part of a logon
|
||||
exchange may not be the name that the user authenticates as, given
|
||||
that the KDC_ERR_WRONG_REALM error may have been returned. The
|
||||
relevant Kerberos naming information for logon (if any), is the
|
||||
client name and client realm in the service ticket targeted at the
|
||||
workstation that was obtained using the user's initial TGT.
|
||||
|
||||
How the client name and client realm is mapped into a local account
|
||||
for logon is a local matter, but the client logon mechanism MUST use
|
||||
additional information such as the client realm and/or authorization
|
||||
attributes from the service ticket presented to the workstation by
|
||||
the user, when mapping the logon credentials to a local account on
|
||||
the workstation.
|
||||
|
||||
10. Discussion
|
||||
|
||||
Swift Category - Standards Track 7
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KDC Referrals February 2001
|
||||
|
||||
|
||||
|
||||
This section contains issues and suggestions that need to be
|
||||
incorporated into this draft. From Ken Raeburn [[email protected]]:
|
||||
|
||||
1) No means to do name canonicalization if you're not
|
||||
authenticating. Is it okay to require credentials in order to do
|
||||
canonicalization? If so, how about this: Send a TGS_REQ for the
|
||||
service name you have. If you get back a TGS_REP for a service,
|
||||
great; pull out the name and throw out the credentials. If you
|
||||
get back a TGS_REP for a TGT service, ask again in the specified
|
||||
realm. If you get back a KRB_ERROR because policy prohibits you
|
||||
from authenticating to that service, we can add to the
|
||||
specification that the {realm,sname} in the KRB_ERROR must be the
|
||||
canonical name, and the checksum must be used. As long as the
|
||||
checksum is present, it's still a secure exchange with the KDC.
|
||||
|
||||
If we have to be able to do name canonicalization without any
|
||||
sort of credentials, either client-side (tickets) or server-side
|
||||
(tickets automatically acquired via service key), I think we just
|
||||
lose. But maybe GSSAPI should be changed if that's the case.
|
||||
|
||||
2) Can't refer to another realm and specify a different service name
|
||||
to give to that realm's KDC. The local KDC can tell you a
|
||||
different service name or a different realm name, but not both.
|
||||
This comes up in the "gnuftp.raeburn.org CNAME ftp.gnu.org" type
|
||||
of case I've mentioned.
|
||||
|
||||
Except ... the KDC-REP structure includes padata and ticket
|
||||
extensions fields that are extensible. We could add a required
|
||||
value to one of them -- perhaps only in the case where you return
|
||||
a TGT when not asked -- that contains signed information about
|
||||
the principal name to ask for in the other realm. (It would have
|
||||
to be required, otherwise a man-in-the-middle could make it go
|
||||
away.) Signing would be done using the session key for the TGS.
|
||||
|
||||
3) Secure canonicalization of service name in AS_REQ. If the
|
||||
response is an AS_REP, we need a way to tell that the altered
|
||||
server name wasn't a result of a MITM attack on the AS_REQ
|
||||
message. Again, the KDC-REP extensible fields could have a new
|
||||
required value added when name canonicalization happens,
|
||||
indicating what the original principal name (in the AS_REQ
|
||||
message) was, and signed using the same key as protects the
|
||||
AS_REP. If it doesn't match what the client requested, the
|
||||
messages were altered in transit.
|
||||
|
||||
4) Client name needs referral to another realm, and server name
|
||||
needs canonicalization of some sort. The above fixes wouldn't
|
||||
work for this case, and I'm not even sure which KDC should be
|
||||
doing the canonicalization anyways.
|
||||
|
||||
|
||||
The other-principal-name datum would probably look something like:
|
||||
|
||||
|
||||
Swift Category - Standards Track 8
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KDC Referrals February 2001
|
||||
|
||||
|
||||
PrincipalAndNonce ::= SEQUENCE {
|
||||
name[0] PrincipalName,
|
||||
nonce[1] INTEGER -- copied from KDC_REQ
|
||||
}
|
||||
SignedPrincipal ::= SEQUENCE {
|
||||
name-and-nonce[0] PrincipalAndNonce,
|
||||
cksum[1] Checksum
|
||||
}
|
||||
{PA,TE}-ORIGINAL-SERVER-PRINCIPAL ::= SignedPrincipal
|
||||
{PA,TE}-REMOTE-SERVER-PRINCIPAL ::= SignedPrincipal
|
||||
|
||||
with the checksum computed over the encoding of the 'name-and-nonce'
|
||||
field, and appropriate PA- or TE- numbers assigned. I don't have a
|
||||
strong opinion on whether it'd be a pa-data or ticket extension;
|
||||
conceptually it seems like an abuse of either, but, well, I think
|
||||
I'd rather abuse them than leave the facility both in and
|
||||
inadequate.
|
||||
|
||||
The nonce is needed because multiple exchanges may be made with the
|
||||
same key, and these extension fields aren't packed in with the other
|
||||
encrypted data in the same response, so a MITM could pick apart
|
||||
multiple messages and mix-and-match components. (In a TGS_REQ
|
||||
exchange, a subsession key would help, but it's not required.)
|
||||
|
||||
The extension field would be required to prevent a MITM from
|
||||
discarding the field from a response; a flag bit in a protected part
|
||||
of the message (probably in 'flags' in EncKDCRepPart) could also let
|
||||
us know of a cases where the information can be omitted, namely,
|
||||
when no name change is done. Perhaps the bit should be set to
|
||||
indicate that a name change *was* done, and clear if it wasn't,
|
||||
making the no-change case more directly compatible with RFC1510.
|
||||
|
||||
11. References
|
||||
|
||||
|
||||
1 Bradner, S., "The Internet Standards Process -- Revision 3", BCP
|
||||
9, RFC 2026, October 1996.
|
||||
|
||||
2 Bradner, S., "Key words for use in RFCs to Indicate Requirement
|
||||
Levels", BCP 14, RFC 2119, March 1997
|
||||
|
||||
3 Kohl, J., Neuman, C., "The Kerberos Network Authentication
|
||||
Service (V5)", RFC 1510, September 1993
|
||||
|
||||
|
||||
12. Author's Addresses
|
||||
|
||||
Michael Swift
|
||||
University of Washington
|
||||
Seattle, Washington
|
||||
Email: [email protected]
|
||||
|
||||
John Brezak
|
||||
|
||||
Swift Category - Standards Track 9
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KDC Referrals February 2001
|
||||
|
||||
|
||||
Microsoft
|
||||
One Microsoft Way
|
||||
Redmond, Washington
|
||||
Email: [email protected]
|
||||
|
||||
Jonathan Trostle
|
||||
Cisco Systems
|
||||
170 W. Tasman Dr.
|
||||
San Jose, CA 95134
|
||||
Email: [email protected]
|
||||
|
||||
Kenneth Raeburn
|
||||
Massachusetts Institute of Technology 77
|
||||
Massachusetts Avenue
|
||||
Cambridge, Massachusetts 02139
|
||||
Email: [email protected]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Swift Category - Standards Track 10
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
KDC Referrals February 2001
|
||||
|
||||
|
||||
Full Copyright Statement
|
||||
|
||||
Copyright (C) The Internet Society (1999). All Rights Reserved.
|
||||
|
||||
This document and translations of it may be copied and furnished to
|
||||
others, and derivative works that comment on or otherwise explain it
|
||||
or assist in its implementation may be prepared, copied, published
|
||||
and distributed, in whole or in part, without restriction of any
|
||||
kind, provided that the above copyright notice and this paragraph
|
||||
are included on all such copies and derivative works. However, this
|
||||
document itself may not be modified in any way, such as by removing
|
||||
the copyright notice or references to the Internet Society or other
|
||||
Internet organizations, except as needed for the purpose of
|
||||
developing Internet standards in which case the procedures for
|
||||
copyrights defined in the Internet Standards process must be
|
||||
followed, or as required to translate it into languages other than
|
||||
English.
|
||||
|
||||
The limited permissions granted above are perpetual and will not be
|
||||
revoked by the Internet Society or its successors or assigns.
|
||||
|
||||
This document and the information contained herein is provided on an
|
||||
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
||||
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
||||
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Swift Category - Standards Track 11
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
|
||||
KADMIN(8) UNIX System Manager's Manual KADMIN(8)
|
||||
|
||||
NNAAMMEE
|
||||
kkaaddmmiinn - Kerberos administration utility
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkaaddmmiinn [--pp _s_t_r_i_n_g | ----pprriinncciippaall==_s_t_r_i_n_g] [--KK _s_t_r_i_n_g | ----kkeeyyttaabb==_s_t_r_i_n_g] [--cc
|
||||
_f_i_l_e | ----ccoonnffiigg--ffiillee==_f_i_l_e] [--kk _f_i_l_e | ----kkeeyy--ffiillee==_f_i_l_e] [--rr _r_e_a_l_m |
|
||||
----rreeaallmm==_r_e_a_l_m] [--aa _h_o_s_t | ----aaddmmiinn--sseerrvveerr==_h_o_s_t] [--ss _p_o_r_t _n_u_m_b_e_r |
|
||||
----sseerrvveerr--ppoorrtt==_p_o_r_t _n_u_m_b_e_r] [--ll | ----llooccaall] [--hh | ----hheellpp] [--vv | ----vveerrssiioonn]
|
||||
[_c_o_m_m_a_n_d]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
The kkaaddmmiinn program is used to make modification to the Kerberos database,
|
||||
either remotely via the kadmind(8) daemon, or locally (with the --ll op-
|
||||
tion).
|
||||
|
||||
Supported options:
|
||||
|
||||
--pp _s_t_r_i_n_g, ----pprriinncciippaall==_s_t_r_i_n_g
|
||||
principal to authenticate as
|
||||
|
||||
--KK _s_t_r_i_n_g, ----kkeeyyttaabb==_s_t_r_i_n_g
|
||||
keytab for authentication pricipal
|
||||
|
||||
--cc _f_i_l_e, ----ccoonnffiigg--ffiillee==_f_i_l_e
|
||||
location of config file
|
||||
|
||||
--kk _f_i_l_e, ----kkeeyy--ffiillee==_f_i_l_e
|
||||
location of master key file
|
||||
|
||||
--rr _r_e_a_l_m, ----rreeaallmm==_r_e_a_l_m
|
||||
realm to use
|
||||
|
||||
--aa _h_o_s_t, ----aaddmmiinn--sseerrvveerr==_h_o_s_t
|
||||
server to contact
|
||||
|
||||
--ss _p_o_r_t _n_u_m_b_e_r, ----sseerrvveerr--ppoorrtt==_p_o_r_t _n_u_m_b_e_r
|
||||
port to use
|
||||
|
||||
--ll, ----llooccaall
|
||||
local admin mode
|
||||
|
||||
If no _c_o_m_m_a_n_d is given on the command line, kkaaddmmiinn will prompt for com-
|
||||
mands to process. Commands include:
|
||||
|
||||
aadddd [--rr | ----rraannddoomm--kkeeyy] [----rraannddoomm--ppaasssswwoorrdd] [--pp _s_t_r_i_n_g |
|
||||
----ppaasssswwoorrdd==_s_t_r_i_n_g] [----kkeeyy==_s_t_r_i_n_g] [----mmaaxx--ttiicckkeett--lliiffee==_l_i_f_e_t_i_m_e]
|
||||
[----mmaaxx--rreenneewwaabbllee--lliiffee==_l_i_f_e_t_i_m_e] [----aattttrriibbuutteess==_a_t_t_r_i_b_u_t_e_s]
|
||||
[----eexxppiirraattiioonn--ttiimmee==_t_i_m_e] [----ppww--eexxppiirraattiioonn--ttiimmee==_t_i_m_e] _p_r_i_n_c_i_p_a_l_._._.
|
||||
|
||||
creates a new principal
|
||||
|
||||
ppaasssswwdd [--rr | ----rraannddoomm--kkeeyy] [----rraannddoomm--ppaasssswwoorrdd] [--pp _s_t_r_i_n_g |
|
||||
----ppaasssswwoorrdd==_s_t_r_i_n_g] [----kkeeyy==_s_t_r_i_n_g] _p_r_i_n_c_i_p_a_l_._._.
|
||||
|
||||
changes the password of an existing principal
|
||||
|
||||
ddeelleettee _p_r_i_n_c_i_p_a_l_._._.
|
||||
|
||||
removes a principal
|
||||
|
||||
ddeell__eennccttyyppee _p_r_i_n_c_i_p_a_l _e_n_c_t_y_p_e_s_._._.
|
||||
|
||||
|
||||
removes some enctypes from a principal, this can be useful
|
||||
the service belonging to the principal is known to not handle
|
||||
certain enctypes
|
||||
|
||||
eexxtt__kkeeyyttaabb [--kk _s_t_r_i_n_g | ----kkeeyyttaabb==_s_t_r_i_n_g] _p_r_i_n_c_i_p_a_l_._._.
|
||||
|
||||
creates a keytab with the keys of the specified principals
|
||||
|
||||
ggeett [--ll | ----lloonngg] [--ss | ----sshhoorrtt] [--tt | ----tteerrssee] _e_x_p_r_e_s_s_i_o_n_._._.
|
||||
|
||||
lists the principals that match the expressions (which are
|
||||
shell glob like), long format gives more information, and
|
||||
terse just prints the names
|
||||
|
||||
rreennaammee _f_r_o_m _t_o
|
||||
|
||||
renames a principal
|
||||
|
||||
mmooddiiffyy [--aa _a_t_t_r_i_b_u_t_e_s | ----aattttrriibbuutteess==_a_t_t_r_i_b_u_t_e_s]
|
||||
[----mmaaxx--ttiicckkeett--lliiffee==_l_i_f_e_t_i_m_e] [----mmaaxx--rreenneewwaabbllee--lliiffee==_l_i_f_e_t_i_m_e]
|
||||
[----eexxppiirraattiioonn--ttiimmee==_t_i_m_e] [----ppww--eexxppiirraattiioonn--ttiimmee==_t_i_m_e]
|
||||
[----kkvvnnoo==_n_u_m_b_e_r] _p_r_i_n_c_i_p_a_l
|
||||
|
||||
modifies certain attributes of a principal
|
||||
|
||||
pprriivviilleeggeess
|
||||
|
||||
lists the operations you are allowd to perform
|
||||
|
||||
When running in local mode, the following commands can also be used.
|
||||
|
||||
dduummpp [--dd | ----ddeeccrryypptt] [_d_u_m_p_-_f_i_l_e]
|
||||
|
||||
writes the database in ``human readable'' form to the speci-
|
||||
fied file, or standard out
|
||||
|
||||
iinniitt [----rreeaallmm--mmaaxx--ttiicckkeett--lliiffee==_s_t_r_i_n_g]
|
||||
[----rreeaallmm--mmaaxx--rreenneewwaabbllee--lliiffee==_s_t_r_i_n_g] _r_e_a_l_m
|
||||
|
||||
initialises the Kerberos database with entries for a new
|
||||
realm, it's possible to have more than one realm served by
|
||||
one server
|
||||
|
||||
llooaadd _f_i_l_e
|
||||
|
||||
reads a previously dumped database, and re-creates that
|
||||
database from scratch
|
||||
|
||||
mmeerrggee _f_i_l_e
|
||||
|
||||
similar to lliisstt but just modifies the database with the en-
|
||||
tries in the dump file
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kadmind(8), kdc(8)
|
||||
|
||||
HEIMDAL September 10, 2000 2
|
||||
@@ -1,93 +0,0 @@
|
||||
|
||||
KADMIND(8) UNIX System Manager's Manual KADMIND(8)
|
||||
|
||||
NNAAMMEE
|
||||
kkaaddmmiinndd - server for administrative access to kerberos database
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkaaddmmiinndd [--cc _f_i_l_e | ----ccoonnffiigg--ffiillee==_f_i_l_e] [--kk _f_i_l_e | ----kkeeyy--ffiillee==_f_i_l_e]
|
||||
[----kkeeyyttaabb==_k_e_y_t_a_b] [--rr _r_e_a_l_m | ----rreeaallmm==_r_e_a_l_m] [--dd | ----ddeebbuugg] [--pp _p_o_r_t |
|
||||
----ppoorrttss==_p_o_r_t]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kkaaddmmiinndd listens for requests for changes to the Kerberos database and
|
||||
performs these, subject to permissions. When starting, if stdin is a
|
||||
socket it assumes that it has been started by inetd(8), otherwise it be-
|
||||
haves as a daemon, forking processes for each new connection. The ----ddeebbuugg
|
||||
option causes kkaaddmmiinndd to accept exactly one connection, which is useful
|
||||
for debugging.
|
||||
|
||||
If built with krb4 support, it implements both the Heimdal Kerberos 5 ad-
|
||||
ministrative protocol and the Kerberos 4 protocol. Password changes via
|
||||
the Kerberos 4 protocol are also performed by kkaaddmmiinndd, but the kpass-
|
||||
wdd(8) daemon is responsible for the Kerberos 5 password changing proto-
|
||||
col (used by kpasswd(1))
|
||||
|
||||
This daemon should only be run on ther master server, and not on any
|
||||
slaves.
|
||||
|
||||
Principals are always allowed to change their own password and list their
|
||||
own principals. Apart from that, doing any operation requires permission
|
||||
explicitly added in the ACL file _/_v_a_r_/_h_e_i_m_d_a_l_/_k_a_d_m_i_n_d_._a_c_l. The format of
|
||||
this file is:
|
||||
|
||||
_p_r_i_n_c_i_p_a_l _r_i_g_h_t_s [_p_r_i_n_c_i_p_a_l_-_p_a_t_t_e_r_n]
|
||||
|
||||
Where rights is any combination of:
|
||||
|
||||
++oo change-password | cpw
|
||||
|
||||
++oo list
|
||||
|
||||
++oo delete
|
||||
|
||||
++oo modify
|
||||
|
||||
++oo add
|
||||
|
||||
++oo get
|
||||
|
||||
++oo all
|
||||
|
||||
And the optional _p_r_i_n_c_i_p_a_l_-_p_a_t_t_e_r_n restricts the rights to principals
|
||||
that match the glob-style pattern.
|
||||
|
||||
Supported options:
|
||||
|
||||
--cc _f_i_l_e, ----ccoonnffiigg--ffiillee==_f_i_l_e
|
||||
location of config file
|
||||
|
||||
--kk _f_i_l_e, ----kkeeyy--ffiillee==_f_i_l_e
|
||||
location of master key file
|
||||
|
||||
----kkeeyyttaabb==_k_e_y_t_a_b
|
||||
|
||||
|
||||
what keytab to use
|
||||
|
||||
--rr _r_e_a_l_m, ----rreeaallmm==_r_e_a_l_m
|
||||
realm to use
|
||||
|
||||
--dd, ----ddeebbuugg
|
||||
enable debugging
|
||||
|
||||
--pp _p_o_r_t, ----ppoorrttss==_p_o_r_t
|
||||
ports to listen to. By default, if run as a daemon, it listen to
|
||||
ports 749, and 751 (if built with Kerberos 4 support), but you
|
||||
can add any number of ports with this option. The port string is
|
||||
a whitespace separated list of port specifications, with the spe-
|
||||
cial string ``+'' representing the default set of ports.
|
||||
|
||||
FFIILLEESS
|
||||
_/_v_a_r_/_h_e_i_m_d_a_l_/_k_a_d_m_i_n_d_._a_c_l
|
||||
|
||||
EEXXAAMMPPLLEESS
|
||||
This will cause kadmind to listen to port 4711 in addition to any com-
|
||||
piled in defaults:
|
||||
|
||||
# kadmind --ports="+ 4711" &
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kdc(8), kadmin(1), kpasswdd(8), kpasswd(1)
|
||||
|
||||
HEIMDAL June 7, 2000 2
|
||||
@@ -1,103 +0,0 @@
|
||||
|
||||
HPROP(8) UNIX System Manager's Manual HPROP(8)
|
||||
|
||||
NNAAMMEE
|
||||
hhpprroopp - propagate the KDC database
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
hhpprroopp [--mm _f_i_l_e | ----mmaasstteerr--kkeeyy==_f_i_l_e] [--dd _f_i_l_e | ----ddaattaabbaassee==_f_i_l_e]
|
||||
[----ssoouurrccee==_h_e_i_m_d_a_l_|_m_i_t_-_d_u_m_p_|_k_r_b_4_-_d_b_|_k_r_b_4_-_d_u_m_p] [--44 | ----vv44--ddbb] [--KK |
|
||||
----kkaa--ddbb] [--cc _c_e_l_l | ----cceellll==_c_e_l_l] [--SS | ----kkaassppeecciiaallss] [--rr _s_t_r_i_n_g |
|
||||
----vv44--rreeaallmm==_s_t_r_i_n_g] [--kk _k_e_y_t_a_b | ----kkeeyyttaabb==_k_e_y_t_a_b] [--RR _s_t_r_i_n_g |
|
||||
----vv55--rreeaallmm==_s_t_r_i_n_g] [--DD | ----ddeeccrryypptt] [--EE | ----eennccrryypptt] [--nn | ----ssttddoouutt] [--vv
|
||||
| ----vveerrbboossee] [----vveerrssiioonn] [--hh | ----hheellpp] _h_o_s_t[:_p_o_r_t] _._._.
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
hhpprroopp takes a principal database in a specified format and converts it
|
||||
into a stream of Heimdal database records. This stream can either be
|
||||
written to standard out, or (more commonly) be propagated to a hpropd(8)
|
||||
server running on a different machine.
|
||||
|
||||
If propagating, it connects to all _h_o_s_t_s specified on the command by
|
||||
opening a TCP connection to port 754 (service hprop) and sends the
|
||||
database in encrypted form.
|
||||
|
||||
Supported options:
|
||||
|
||||
--mm _f_i_l_e, ----mmaasstteerr--kkeeyy==_f_i_l_e
|
||||
Where to find the master key to encrypt or decrypt keys with.
|
||||
|
||||
--dd _f_i_l_e, ----ddaattaabbaassee==_f_i_l_e
|
||||
The database to be propagated.
|
||||
|
||||
----ssoouurrccee==_h_e_i_m_d_a_l_|_m_i_t_-_d_u_m_p_|_k_r_b_4_-_d_b_|_k_r_b_4_-_d_u_m_p
|
||||
Specifies the type of the source database. Alternatives include:
|
||||
|
||||
heimdal a Heimdal database
|
||||
|
||||
mit-dump a MIT Kerberos 5 dump file
|
||||
|
||||
krb4-db a Kerberos 4 database
|
||||
|
||||
krb4-dump a Kerberos 4 dump file
|
||||
|
||||
kaserver a Transarc kaserver database
|
||||
|
||||
--kk _k_e_y_t_a_b, ----kkeeyyttaabb==_k_e_y_t_a_b
|
||||
The keytab to use for fetching the key to be used for authenti-
|
||||
cating to the propagation daemon(s). The key _k_a_d_m_i_n_/_h_p_r_o_p is used
|
||||
from this keytab. The default is to fetch the key from the KDC
|
||||
database.
|
||||
|
||||
--RR _s_t_r_i_n_g, ----vv55--rreeaallmm==_s_t_r_i_n_g
|
||||
Local realm override.
|
||||
|
||||
--DD, ----ddeeccrryypptt
|
||||
The encryption keys in the database can either be in clear, or
|
||||
encrypted with a master key. This option thansmits the database
|
||||
with unencrypted keys.
|
||||
|
||||
--EE, ----eennccrryypptt
|
||||
This option thansmits the database with encrypted keys.
|
||||
|
||||
--nn, ----ssttddoouutt
|
||||
Dump the database on stdout, in a format that can be fed to
|
||||
hpropd.
|
||||
|
||||
The following options are only valid if hhpprroopp is compiled with support
|
||||
for Kerberos 4 (kaserver).
|
||||
|
||||
--rr _s_t_r_i_n_g, ----vv44--rreeaallmm==_s_t_r_i_n_g
|
||||
v4 realm to use
|
||||
|
||||
--cc _c_e_l_l, ----cceellll==_c_e_l_l
|
||||
The AFS cell name, used if reading a kaserver database.
|
||||
|
||||
--SS, ----kkaassppeecciiaallss
|
||||
Also dump the principals marked as special in the kaserver
|
||||
database.
|
||||
|
||||
--44, ----vv44--ddbb
|
||||
Deprecated, identical to `--source=krb4-db'.
|
||||
|
||||
--KK, ----kkaa--ddbb
|
||||
Deprecated, identical to `--source=kaserver'.
|
||||
|
||||
EEXXAAMMPPLLEESS
|
||||
The following will propagate a database to another machine (which should
|
||||
run hpropd(8):)
|
||||
|
||||
$ hprop slave-1 slave-2
|
||||
|
||||
Copy a Kerberos 4 database to a Kerberos 5 slave:
|
||||
|
||||
$ hprop --source=krb4-db -E krb5-slave
|
||||
|
||||
Convert a Kerberos 4 dump-file for use with a Heimdal KDC:
|
||||
|
||||
$ hprop -n --source=krb4-dump -d /var/kerberos/principal.dump -E | hpropd -n
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
hpropd(8)
|
||||
|
||||
HEIMDAL June 19, 2000 2
|
||||
@@ -1,43 +0,0 @@
|
||||
|
||||
HPROPD(8) UNIX System Manager's Manual HPROPD(8)
|
||||
|
||||
NNAAMMEE
|
||||
hhpprrooppdd - receive a propagated database
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
hhpprrooppdd [--dd _f_i_l_e | ----ddaattaabbaassee==_f_i_l_e] [--nn | ----ssttddiinn] [----pprriinntt] [--ii |
|
||||
----nnoo--iinneettdd] [--kk _k_e_y_t_a_b | ----kkeeyyttaabb==_k_e_y_t_a_b] [--44 | ----vv44dduummpp]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
hhpprrooppdd receives databases sent by hhpprroopp. and writes it as a local
|
||||
database.
|
||||
|
||||
By default, hhpprrooppdd expects to be started from iinneettdd if stdin is a socket
|
||||
and expects to receive the dumped database over stdin otherwise. If the
|
||||
database is sent over the network, it is authenticated and encrypted.
|
||||
Only connections from kadmin/hprop are accepted.
|
||||
|
||||
Options supported:
|
||||
|
||||
--dd _f_i_l_e, ----ddaattaabbaassee==_f_i_l_e
|
||||
database
|
||||
|
||||
--nn, ----ssttddiinn
|
||||
read from stdin
|
||||
|
||||
----pprriinntt
|
||||
print dump to stdout
|
||||
|
||||
--ii, ----nnoo--iinneettdd
|
||||
Not started from inetd
|
||||
|
||||
--kk _k_e_y_t_a_b, ----kkeeyyttaabb==_k_e_y_t_a_b
|
||||
keytab to use for authentication
|
||||
|
||||
--44, ----vv44dduummpp
|
||||
create v4 type DB
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
hprop(8)
|
||||
|
||||
HEIMDAL August 27, 1997 1
|
||||
@@ -1,118 +0,0 @@
|
||||
|
||||
KDC(8) UNIX System Manager's Manual KDC(8)
|
||||
|
||||
NNAAMMEE
|
||||
kkddcc - Kerberos 5 server
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkddcc [--cc _f_i_l_e | ----ccoonnffiigg--ffiillee==_f_i_l_e] [--pp | ----nnoo--rreeqquuiirree--pprreeaauutthh]
|
||||
[----mmaaxx--rreeqquueesstt==_s_i_z_e] [--HH | ----eennaabbllee--hhttttpp] [--rr _s_t_r_i_n_g | ----vv44--rreeaallmm==_s_t_r_i_n_g]
|
||||
[--KK | ----nnoo--kkaasseerrvveerr] [--rr _r_e_a_l_m] [----vv44--rreeaallmm==_r_e_a_l_m] [--PP _s_t_r_i_n_g |
|
||||
----ppoorrttss==_s_t_r_i_n_g] [----aaddddrreesssseess==_l_i_s_t _o_f _a_d_d_r_e_s_s_e_s]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kkddcc serves requests for tickets. When it starts, it first checks the
|
||||
flags passed, any options that are not specified with a command line flag
|
||||
is taken from a config file, or from a default compiled-in value.
|
||||
|
||||
Options supported:
|
||||
|
||||
--cc _f_i_l_e
|
||||
|
||||
----ccoonnffiigg--ffiillee==_f_i_l_e
|
||||
Specifies the location of the config file, the default is
|
||||
_/_v_a_r_/_h_e_i_m_d_a_l_/_k_d_c_._c_o_n_f. This is the only value that can't be spec-
|
||||
ified in the config file.
|
||||
|
||||
--pp
|
||||
|
||||
----nnoo--rreeqquuiirree--pprreeaauutthh
|
||||
Turn off the requirement for pre-autentication in the initial AS-
|
||||
REQ for all principals. The use of pre-authentication makes it
|
||||
more difficult to do offline password attacks. You might want to
|
||||
turn it off if you have clients that doesn't do pre-authentica-
|
||||
tion. Since the version 4 protocol doesn't support any pre-au-
|
||||
thentication, so serving version 4 clients is just about the same
|
||||
as not requiring pre-athentication. The default is to require
|
||||
pre-authentication. Adding the require-preauth per principal is a
|
||||
more flexible way of handling this.
|
||||
|
||||
----mmaaxx--rreeqquueesstt==_s_i_z_e
|
||||
Gives an upper limit on the size of the requests that the kdc is
|
||||
willing to handle.
|
||||
|
||||
--HH, ----eennaabbllee--hhttttpp
|
||||
Makes the kdc listen on port 80 and handle requests encapsulated
|
||||
in HTTP.
|
||||
|
||||
--KK, ----nnoo--kkaasseerrvveerr
|
||||
Disables kaserver emulation (in case it's compiled in).
|
||||
|
||||
--rr _r_e_a_l_m
|
||||
|
||||
----vv44--rreeaallmm==_r_e_a_l_m
|
||||
What realm this server should act as when dealing with version 4
|
||||
requests. The database can contain any number of realms, but
|
||||
since the version 4 protocol doesn't contain a realm for the
|
||||
server, it must be explicitly specified. The default is whatever
|
||||
is returned by kkrrbb__ggeett__llrreeaallmm(). This option is only availabe if
|
||||
the KDC has been compiled with version 4 support.
|
||||
|
||||
--PP _s_t_r_i_n_g, ----ppoorrttss==_s_t_r_i_n_g
|
||||
Specifies the set of ports the KDC should listen on. It is given
|
||||
as a white-space separated list of services or port numbers.
|
||||
|
||||
----aaddddrreesssseess==_l_i_s_t _o_f _a_d_d_r_e_s_s_e_s
|
||||
The list of addresses to listen for requests on. By default, the
|
||||
kdc will listen on all the locally configured addresses. If only
|
||||
a subset is desired, or the automatic detection fails, this op-
|
||||
tion might be used.
|
||||
|
||||
All activities , are logged to one or more destinations, see
|
||||
krb5.conf(5), and krb5_openlog(3). The entity used for logging is kkddcc.
|
||||
|
||||
CCOONNFFIIGGUURRAATTIIOONN FFIILLEE
|
||||
The configuration file has the same syntax as the _k_r_b_5_._c_o_n_f file (you can
|
||||
actually put the configuration in _/_e_t_c_/_k_r_b_5_._c_o_n_f, and then start the KDC
|
||||
with ----ccoonnffiigg--ffiillee==_/_e_t_c_/_k_r_b_5_._c_o_n_f). All options should be in a section
|
||||
called ``kdc''. All the command-line options can preferably be added in
|
||||
the configuration file. The only difference is the pre-authentication
|
||||
flag, that has to be specified as:
|
||||
|
||||
require-preauth = no
|
||||
|
||||
(in fact you can specify the option as ----rreeqquuiirree--pprreeaauutthh==nnoo).
|
||||
|
||||
And there are some configuration options which do not have command-line
|
||||
equivalents:
|
||||
|
||||
check-ticket-addresses = _b_o_o_l_e_a_n
|
||||
Check the addresses in the ticket when processing TGS re-
|
||||
quests. The default is FALSE.
|
||||
|
||||
allow-null-ticket-addresses = _b_o_o_l_e_a_n
|
||||
Permit tickets with no addresses. This option is only rele-
|
||||
vant when check-ticket-addresses is TRUE.
|
||||
|
||||
allow-anonymous = _b_o_o_l_e_a_n
|
||||
Permit anonymous tickets with no addresses.
|
||||
|
||||
encode_as_rep_as_tgs_rep = _b_o_o_l_e_a_n
|
||||
Encode AS-Rep as TGS-Rep to be bug-compatible with old DCE
|
||||
code. The Heimdal clients allow both.
|
||||
|
||||
kdc_warn_pwexpire = _t_i_m_e
|
||||
How long before password/principal expiration the KDC should
|
||||
start sending out warning messages.
|
||||
|
||||
An example of a config file:
|
||||
|
||||
[kdc]
|
||||
require-preauth = no
|
||||
v4-realm = FOO.SE
|
||||
key-file = /key-file
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kinit(1)
|
||||
|
||||
HEIMDAL July 27, 1997 2
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
KSTASH(8) UNIX System Manager's Manual KSTASH(8)
|
||||
|
||||
NNAAMMEE
|
||||
kkssttaasshh - store the KDC master password in a file
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkssttaasshh [--ee _s_t_r_i_n_g | ----eennccttyyppee==_s_t_r_i_n_g] [--kk _f_i_l_e | ----kkeeyy--ffiillee==_f_i_l_e]
|
||||
[----ccoonnvveerrtt--ffiillee] [----mmaasstteerr--kkeeyy--ffdd==_f_d] [--hh | ----hheellpp] [----vveerrssiioonn]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kkssttaasshh reads the Kerberos master key and stores it in a file that will be
|
||||
used by the KDC.
|
||||
|
||||
Supported options:
|
||||
|
||||
--ee _s_t_r_i_n_g, ----eennccttyyppee==_s_t_r_i_n_g
|
||||
the encryption type to use, defaults to DES3-CBC-SHA1
|
||||
|
||||
--kk _f_i_l_e, ----kkeeyy--ffiillee==_f_i_l_e
|
||||
the name of the master key file
|
||||
|
||||
----ccoonnvveerrtt--ffiillee
|
||||
don't ask for a new master key, just read an old master key file,
|
||||
and writes it back in the new keyfile format
|
||||
|
||||
----mmaasstteerr--kkeeyy--ffdd==_f_d
|
||||
filedescriptor to read passphrase from, if not specified the
|
||||
passphrase will be read from the terminal
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kdc(8)
|
||||
|
||||
HEIMDAL September 1, 2000 1
|
||||
@@ -1,42 +0,0 @@
|
||||
|
||||
STRING2KEY(8) UNIX System Manager's Manual STRING2KEY(8)
|
||||
|
||||
NNAAMMEE
|
||||
ssttrriinngg22kkeeyy - map a password into a key
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
ssttrriinngg22kkeeyy [--55 | ----vveerrssiioonn55] [--44 | ----vveerrssiioonn44] [--aa | ----aaffss] [--cc _c_e_l_l |
|
||||
----cceellll==_c_e_l_l] [--ww _p_a_s_s_w_o_r_d | ----ppaasssswwoorrdd==_p_a_s_s_w_o_r_d] [--pp _p_r_i_n_c_i_p_a_l |
|
||||
----pprriinncciippaall==_p_r_i_n_c_i_p_a_l] [--kk _s_t_r_i_n_g | ----kkeeyyttyyppee==_s_t_r_i_n_g] _p_a_s_s_w_o_r_d
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
ssttrriinngg22kkeeyy performs the string-to-key function. This is useful when you
|
||||
want to handle the raw key instead of the password. Supported options:
|
||||
|
||||
--55, ----vveerrssiioonn55
|
||||
Output Kerberos v5 string-to-key
|
||||
|
||||
--44, ----vveerrssiioonn44
|
||||
Output Kerberos v4 string-to-key
|
||||
|
||||
--aa, ----aaffss
|
||||
Output AFS string-to-key
|
||||
|
||||
--cc _c_e_l_l, ----cceellll==_c_e_l_l
|
||||
AFS cell to use
|
||||
|
||||
--ww _p_a_s_s_w_o_r_d, ----ppaasssswwoorrdd==_p_a_s_s_w_o_r_d
|
||||
Password to use
|
||||
|
||||
--pp _p_r_i_n_c_i_p_a_l, ----pprriinncciippaall==_p_r_i_n_c_i_p_a_l
|
||||
Kerberos v5 principal to use
|
||||
|
||||
--kk _s_t_r_i_n_g, ----kkeeyyttyyppee==_s_t_r_i_n_g
|
||||
Keytype
|
||||
|
||||
----vveerrssiioonn
|
||||
print version
|
||||
|
||||
----hheellpp
|
||||
|
||||
HEIMDAL March 4, 2000 1
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
KPASSWD(1) UNIX Reference Manual KPASSWD(1)
|
||||
|
||||
NNAAMMEE
|
||||
kkppaasssswwdd - Kerberos 5 password changing program
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkppaasssswwdd [_p_r_i_n_c_i_p_a_l]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kkppaasssswwdd is the client for changing passwords.
|
||||
|
||||
DDIIAAGGNNOOSSTTIICCSS
|
||||
If the password quality check fails or some other error occurs, an expla-
|
||||
nation is printed.
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kpasswdd(8)
|
||||
|
||||
HEIMDAL Aug 27, 1997 1
|
||||
@@ -1,54 +0,0 @@
|
||||
|
||||
KPASSWDD(8) UNIX System Manager's Manual KPASSWDD(8)
|
||||
|
||||
NNAAMMEE
|
||||
kkppaasssswwdddd - Kerberos 5 password changing server
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkppaasssswwdddd [----cchheecckk--lliibbrraarryy==_l_i_b_r_a_r_y] [----cchheecckk--ffuunnccttiioonn==_f_u_n_c_t_i_o_n] [--kk _k_s_p_e_c
|
||||
| ----kkeeyyttaabb==_k_s_p_e_c] [--rr _r_e_a_l_m | ----rreeaallmm==_r_e_a_l_m] [--pp _s_t_r_i_n_g | ----ppoorrtt==_s_t_r_i_n_g]
|
||||
[----vveerrssiioonn] [----hheellpp]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kkppaasssswwdddd serves request for password changes. It listens on UDP port 464
|
||||
(service kpasswd) and processes requests when they arrive. It changes the
|
||||
database directly and should thus only run on the master KDC.
|
||||
|
||||
Supported options:
|
||||
|
||||
----cchheecckk--lliibbrraarryy==_l_i_b_r_a_r_y
|
||||
If your system has support for dynamic loading of shared li-
|
||||
braries, you can use an external function to check password qual-
|
||||
ity. This option specifies which library to load.
|
||||
|
||||
----cchheecckk--ffuunnccttiioonn==_f_u_n_c_t_i_o_n
|
||||
This is the function to call in the loaded library. The function
|
||||
should look like this:
|
||||
|
||||
_c_o_n_s_t _c_h_a_r _* ppaasssswwdd__cchheecckk(_k_r_b_5___c_o_n_t_e_x_t _c_o_n_t_e_x_t, _k_r_b_5___p_r_i_n_c_i_p_a_l
|
||||
_p_r_i_n_c_i_p_a_l, _k_r_b_5___d_a_t_a _*_p_a_s_s_w_o_r_d)
|
||||
|
||||
_c_o_n_t_e_x_t is an initialized context; _p_r_i_n_c_i_p_a_l is the one who tries
|
||||
to change passwords, and _p_a_s_s_w_o_r_d is the new password. Note that
|
||||
the password (in _p_a_s_s_w_o_r_d_-_>_d_a_t_a) is not zero terminated.
|
||||
|
||||
--kk _k_s_p_e_c, ----kkeeyyttaabb==_k_s_p_e_c
|
||||
keytab to get authentication key from
|
||||
|
||||
--rr _r_e_a_l_m, ----rreeaallmm==_r_e_a_l_m
|
||||
default realm
|
||||
|
||||
--pp _s_t_r_i_n_g, ----ppoorrtt==_s_t_r_i_n_g
|
||||
port to listen on (default service kpasswd - 464).
|
||||
|
||||
DDIIAAGGNNOOSSTTIICCSS
|
||||
If an error occurs, the error message is returned to the user and/or
|
||||
logged to syslog.
|
||||
|
||||
BBUUGGSS
|
||||
The default password quality checks are too basic.
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kdc(8), kpasswd(1)
|
||||
|
||||
HEIMDAL April 19, 1999 1
|
||||
@@ -1,30 +0,0 @@
|
||||
|
||||
KDESTROY(1) UNIX Reference Manual KDESTROY(1)
|
||||
|
||||
NNAAMMEE
|
||||
kkddeessttrrooyy - destroy the current ticket file
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkddeessttrrooyy [--cc _c_a_c_h_e_f_i_l_e] [----ccaacchhee==_c_a_c_h_e_f_i_l_e] [----nnoo--uunnlloogg] [----nnoo--ddeelleettee--vv44]
|
||||
[----vveerrssiioonn] [----hheellpp]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kkddeessttrrooyy remove the current set of tickets.
|
||||
|
||||
Supported options:
|
||||
|
||||
--cc _c_a_c_h_e_f_i_l_e
|
||||
|
||||
--ccaacchhee==_c_a_c_h_e_f_i_l_e
|
||||
The cache file to remove.
|
||||
|
||||
----nnoo--uunnlloogg
|
||||
Do not remove AFS tokens.
|
||||
|
||||
----nnoo--ddeelleettee--vv44
|
||||
Do not remove v4 tickets.
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kinit(1), klist(1)
|
||||
|
||||
HEIMDAL August 27, 1997 1
|
||||
@@ -1,27 +0,0 @@
|
||||
|
||||
KGETCRED(1) UNIX Reference Manual KGETCRED(1)
|
||||
|
||||
NNAAMMEE
|
||||
kkggeettccrreedd - get a ticket for a particular service
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkggeettccrreedd [--ee _e_n_c_t_y_p_e | ----eennccttyyppee==_e_n_c_t_y_p_e] [----vveerrssiioonn] [----hheellpp] _s_e_r_v_i_c_e
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kkggeettccrreedd obtains a ticket for a service. Usually tickets for services
|
||||
are obtained automatically when needed but sometimes for some odd reason
|
||||
you want to obtain a particular ticket or of a special type.
|
||||
|
||||
Supported options:
|
||||
|
||||
--ee _e_n_c_t_y_p_e, ----eennccttyyppee==_e_n_c_t_y_p_e
|
||||
encryption type to use
|
||||
|
||||
----vveerrssiioonn
|
||||
|
||||
----hheellpp
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kinit(1), klist(1)
|
||||
|
||||
HEIMDAL May 14, 1999 1
|
||||
@@ -1,119 +0,0 @@
|
||||
|
||||
KINIT(1) UNIX Reference Manual KINIT(1)
|
||||
|
||||
NNAAMMEE
|
||||
kkiinniitt, kkaauutthh - acquire initial tickets
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkiinniitt [--44 | ----552244iinniitt] [----aaffsslloogg] [--cc _c_a_c_h_e_n_a_m_e | ----ccaacchhee==_c_a_c_h_e_n_a_m_e] [--ff
|
||||
| ----ffoorrwwaarrddaabbllee] [--tt _k_e_y_t_a_b_n_a_m_e | ----kkeeyyttaabb==_k_e_y_t_a_b_n_a_m_e] [--ll _t_i_m_e |
|
||||
----lliiffeettiimmee==_t_i_m_e] [--pp | ----pprrooxxiiaabbllee] [--RR | ----rreenneeww] [----rreenneewwaabbllee]
|
||||
[--rr _t_i_m_e | ----rreenneewwaabbllee--lliiffee==_t_i_m_e] [--SS _p_r_i_n_c_i_p_a_l |
|
||||
----sseerrvveerr==_p_r_i_n_c_i_p_a_l] [--ss _t_i_m_e | ----ssttaarrtt--ttiimmee==_t_i_m_e] [--kk |
|
||||
----uussee--kkeeyyttaabb] [--vv | ----vvaalliiddaattee] [--ee _e_n_c_t_y_p_e | ----eennccttyyppeess==_e_n_c_t_y_p_e]
|
||||
[----ffccaacchhee--vveerrssiioonn==_i_n_t_e_g_e_r] [----nnoo--aaddddrreesssseess] [----aannoonnyymmoouuss]
|
||||
[----vveerrssiioonn] [----hheellpp] [_p_r_i_n_c_i_p_a_l [_c_o_m_m_a_n_d]]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kkiinniitt is used to authenticate to the kerberos server as _p_r_i_n_c_i_p_a_l, or if
|
||||
none is given, a system generated default (typically your login name at
|
||||
the default realm), and acquire a ticket granting ticket that can later
|
||||
be used to obtain tickets for other services.
|
||||
|
||||
If you have compiled kinit with Kerberos 4 support and you have a Ker-
|
||||
beros 4 server, kkiinniitt will detect this and get you Kerberos 4 tickets.
|
||||
|
||||
Supported options:
|
||||
|
||||
--cc _c_a_c_h_e_n_a_m_e ----ccaacchhee==_c_a_c_h_e_n_a_m_e
|
||||
The credentials cache to put the acquired ticket in, if other
|
||||
than default.
|
||||
|
||||
--ff, ----ffoorrwwaarrddaabbllee
|
||||
Get ticket that can be forwarded to another host.
|
||||
|
||||
--tt _k_e_y_t_a_b_n_a_m_e, ----kkeeyyttaabb==_k_e_y_t_a_b_n_a_m_e
|
||||
Don't ask for a password, but instead get the key from the speci-
|
||||
fied keytab.
|
||||
|
||||
--ll _t_i_m_e, ----lliiffeettiimmee==_t_i_m_e
|
||||
Specifies the lifetime of the ticket. The argument can either be
|
||||
in seconds, or a more human readable string like `1h'.
|
||||
|
||||
--pp, ----pprrooxxiiaabbllee
|
||||
Request tickets with the proxiable flag set.
|
||||
|
||||
--RR, ----rreenneeww
|
||||
Try to renew ticket. The ticket must have the `renewable' flag
|
||||
set, and must not be expired.
|
||||
|
||||
----rreenneewwaabbllee
|
||||
The same as ----rreenneewwaabbllee--lliiffee, with an infinite time.
|
||||
|
||||
--rr _t_i_m_e, ----rreenneewwaabbllee--lliiffee==_t_i_m_e
|
||||
The max renewable ticket life.
|
||||
|
||||
--SS _p_r_i_n_c_i_p_a_l, ----sseerrvveerr==_p_r_i_n_c_i_p_a_l
|
||||
Get a ticket for a service other than krbtgt/LOCAL.REALM.
|
||||
|
||||
--ss _t_i_m_e, ----ssttaarrtt--ttiimmee==_t_i_m_e
|
||||
Obtain a ticket that starts to be valid _t_i_m_e (which can really be
|
||||
a generic time specification, like `1h') seconds into the future.
|
||||
|
||||
--kk, ----uussee--kkeeyyttaabb
|
||||
The same as ----kkeeyyttaabb, but with the default keytab name (normally
|
||||
|
||||
_F_I_L_E_:_/_e_t_c_/_k_r_b_5_._k_e_y_t_a_b).
|
||||
|
||||
--vv, ----vvaalliiddaattee
|
||||
Try to validate an invalid ticket.
|
||||
|
||||
--ee, ----eennccttyyppeess==_e_n_c_t_y_p_e_s
|
||||
Request tickets with this particular enctype.
|
||||
|
||||
----ffccaacchhee--vveerrssiioonn==_v_e_r_s_i_o_n
|
||||
Create a credentials cache of version vveerrssiioonn.
|
||||
|
||||
----nnoo--aaddddrreesssseess
|
||||
Request a ticket with no addresses.
|
||||
|
||||
----aannoonnyymmoouuss
|
||||
Request an anonymous ticket (which means that the ticket will be
|
||||
issued to an anonymous principal, typically ``anonymous@REALM).''
|
||||
|
||||
The following options are only available if kkiinniitt has been compiled with
|
||||
support for Kerberos 4. The kkaauutthh program is identical to kkiinniitt, but has
|
||||
these options enabled by default.
|
||||
|
||||
--44, ----552244iinniitt
|
||||
Try to convert the obtained Kerberos 5 krbtgt to a version 4 com-
|
||||
patible ticket. It will store this ticket in the default Kerberos
|
||||
4 ticket file.
|
||||
|
||||
----aaffsslloogg
|
||||
Gets AFS tickets, converts them to version 4 format, and stores
|
||||
them in the kernel. Only useful if you have AFS.
|
||||
|
||||
The _f_o_r_w_a_r_d_a_b_l_e, _p_r_o_x_i_a_b_l_e, _t_i_c_k_e_t___l_i_f_e, and _r_e_n_e_w_a_b_l_e___l_i_f_e options can
|
||||
be set to a default value from the appdefaults section in krb5.conf, see
|
||||
krb5_appdefault(3).
|
||||
|
||||
If a _c_o_m_m_a_n_d is given, kkiinniitt will setup new credentials caches, and AFS
|
||||
PAG, and then run the given command. When it finishes the credentials
|
||||
will be removed.
|
||||
|
||||
EENNVVIIRROONNMMEENNTT
|
||||
KRB5CCNAME
|
||||
Specifies the default cache file.
|
||||
|
||||
KRB5_CONFIG
|
||||
The directory where the _k_r_b_5_._c_o_n_f can be found, default is _/_e_t_c.
|
||||
|
||||
KRBTKFILE
|
||||
Specifies the Kerberos 4 ticket file to store version 4 tickets
|
||||
in.
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kdestroy(1), klist(1), krb5.conf(5), krb5_appdefault(3)
|
||||
|
||||
HEIMDAL May 29, 1998 2
|
||||
@@ -1,89 +0,0 @@
|
||||
|
||||
KLIST(1) UNIX Reference Manual KLIST(1)
|
||||
|
||||
NNAAMMEE
|
||||
kklliisstt - list Kerberos credentials
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kklliisstt [--cc _c_a_c_h_e | ----ccaacchhee==_c_a_c_h_e] [--ss | --tt | ----tteesstt] [--44 | ----vv44] [--TT |
|
||||
----ttookkeennss] [--55 | ----vv55] [--vv | ----vveerrbboossee] [--ff] [----vveerrssiioonn] [----hheellpp]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kklliisstt reads and displays the current tickets in the crential cache (also
|
||||
known as the ticket file).
|
||||
|
||||
Options supported:
|
||||
|
||||
--cc _c_a_c_h_e, ----ccaacchhee==_c_a_c_h_e
|
||||
credentials cache to list
|
||||
|
||||
--ss, --tt, ----tteesstt
|
||||
Test for there being an active and valid TGT for the local realm
|
||||
of the user in the credential cache.
|
||||
|
||||
--44, ----vv44
|
||||
display v4 tickets
|
||||
|
||||
--TT, ----ttookkeennss
|
||||
display AFS tokens
|
||||
|
||||
--55, ----vv55
|
||||
display v5 cred cache (this is the default)
|
||||
|
||||
--ff Include ticket flags in short form, each charcted stands for a
|
||||
specific flag, as follows:
|
||||
F forwardable
|
||||
f forwarded
|
||||
P proxiable
|
||||
p proxied
|
||||
D postdate-able
|
||||
d postdated
|
||||
R renewable
|
||||
I initial
|
||||
i invalid
|
||||
A pre-authenticated
|
||||
H hardware authenticated
|
||||
|
||||
This information is also output with the ----vveerrbboossee option, but in
|
||||
a more verbose way.
|
||||
|
||||
--vv, ----vveerrbboossee
|
||||
Verbose output. Include all possible information:
|
||||
|
||||
Server
|
||||
the princial the ticket is for
|
||||
|
||||
Ticket etype
|
||||
the encryption type use in the ticket, followed by
|
||||
the key version of the ticket, if it is available
|
||||
|
||||
Session key
|
||||
the encryption type of the session key, if it's dif-
|
||||
ferent from the encryption type of the ticket
|
||||
|
||||
Auth time
|
||||
|
||||
the time the authentication exchange took place
|
||||
|
||||
Start time
|
||||
the time that this tickets is valid from (only print-
|
||||
ed if it's different from the auth time)
|
||||
|
||||
End time
|
||||
when the ticket expires, if it has already expired
|
||||
this is also noted
|
||||
|
||||
Renew till
|
||||
the maximum possible end time of any ticket derived
|
||||
from this one
|
||||
|
||||
Ticket flags
|
||||
the flags set on the ticket
|
||||
|
||||
Addresses
|
||||
the set of addresses from which this ticket is valid
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
kinit(1), kdestroy(1)
|
||||
|
||||
HEIMDAL July 8, 2000 2
|
||||
@@ -1,95 +0,0 @@
|
||||
|
||||
KAFS(3) UNIX Programmer's Manual KAFS(3)
|
||||
|
||||
NNAAMMEE
|
||||
kk__hhaassaaffss, kk__ppiiooccttll, kk__uunnlloogg, kk__sseettppaagg, kk__aaffss__cceellll__ooff__ffiillee, kkrrbb__aaffsslloogg,
|
||||
kkrrbb__aaffsslloogg__uuiidd - AFS library
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
##iinncclluuddee <<kkaaffss..hh>>
|
||||
|
||||
_i_n_t
|
||||
kk__aaffss__cceellll__ooff__ffiillee(_c_o_n_s_t _c_h_a_r _*_p_a_t_h, _c_h_a_r _*_c_e_l_l, _i_n_t _l_e_n)
|
||||
|
||||
_i_n_t
|
||||
kk__hhaassaaffss()
|
||||
|
||||
_i_n_t
|
||||
kk__ppiiooccttll(_c_h_a_r _*_a___p_a_t_h, _i_n_t _o___o_p_c_o_d_e, _s_t_r_u_c_t _V_i_c_e_I_o_c_t_l _*_a___p_a_r_a_m_s_P,
|
||||
_i_n_t _a___f_o_l_l_o_w_S_y_m_l_i_n_k_s)
|
||||
|
||||
_i_n_t
|
||||
kk__sseettppaagg()
|
||||
|
||||
_i_n_t
|
||||
kk__uunnlloogg()
|
||||
|
||||
_i_n_t
|
||||
kkrrbb__aaffsslloogg(_c_h_a_r _*_c_e_l_l, _c_h_a_r _*_r_e_a_l_m)
|
||||
|
||||
_i_n_t
|
||||
kkrrbb__aaffsslloogg__uuiidd(_c_h_a_r _*_c_e_l_l, _c_h_a_r _*_r_e_a_l_m, _u_i_d___t _u_i_d)
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kk__hhaassaaffss() initializes some library internal structures, and tests for
|
||||
the presense of AFS in the kernel, none of the other functions should be
|
||||
called before kk__hhaassaaffss() is called, or if it fails.
|
||||
|
||||
kkrrbb__aaffsslloogg(), and kkrrbb__aaffsslloogg__uuiidd() obtains new tokens (and possibly tick-
|
||||
ets) for the specified _c_e_l_l and _r_e_a_l_m. If _c_e_l_l is NULL, the local cell is
|
||||
used. If _r_e_a_l_m is NULL, the function tries to guess what realm to use.
|
||||
Unless you have some good knowledge of what cell or realm to use, you
|
||||
should pass NULL. kkrrbb__aaffsslloogg() will use the real user-id for the ViceId
|
||||
field in the token, kkrrbb__aaffsslloogg__uuiidd() will use _u_i_d.
|
||||
|
||||
kk__aaffss__cceellll__ooff__ffiillee() will in _c_e_l_l return the cell of a specified file, no
|
||||
more than _l_e_n characters is put in _c_e_l_l.
|
||||
|
||||
kk__ppiiooccttll() does a ppiiooccttll() syscall with the specified arguments. This
|
||||
function is equivalent to llppiiooccttll().
|
||||
|
||||
kk__sseettppaagg() initializes a new PAG.
|
||||
|
||||
kk__uunnlloogg() removes destroys all tokens in the current PAG.
|
||||
|
||||
EENNVVIIRROONNMMEENNTT
|
||||
The following environment variable affect the mode of operation of kkaaffss:
|
||||
|
||||
AFS_SYSCALL Normally, kkaaffss will try to figure out the correct system
|
||||
call(s) that are used by AFS by itself. If it does not man-
|
||||
age to do that, or does it incorrectly, you can set this
|
||||
variable to the system call number or list of system call
|
||||
numbers that should be used.
|
||||
|
||||
RREETTUURRNN VVAALLUUEESS
|
||||
kk__hhaassaaffss() returns 1 if AFS is present in the kernel, 0 otherwise.
|
||||
kkrrbb__aaffsslloogg() and kkrrbb__aaffsslloogg__uuiidd() returns 0 on success, or a kerberos er-
|
||||
ror number on failure. kk__aaffss__cceellll__ooff__ffiillee(), kk__ppiiooccttll(), kk__sseettppaagg(), and
|
||||
kk__uunnlloogg() all return the value of the underlaying system call, 0 on suc-
|
||||
cess.
|
||||
|
||||
EEXXAAMMPPLLEESS
|
||||
The following code from llooggiinn will obtain a new PAG and tokens for the
|
||||
local cell and the cell of the users home directory.
|
||||
|
||||
if (k_hasafs()) {
|
||||
char cell[64];
|
||||
k_setpag();
|
||||
if(k_afs_cell_of_file(pwd->pw_dir, cell, sizeof(cell)) == 0)
|
||||
krb_afslog(cell, NULL);
|
||||
krb_afslog(NULL, NULL);
|
||||
}
|
||||
|
||||
EERRRROORRSS
|
||||
If any of these functions (appart from kk__hhaassaaffss()) is called without AFS
|
||||
beeing present in the kernel, the process will usually (depending on the
|
||||
operating system) receive a SIGSYS signal.
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
Transarc Corporation, "File Server/Cache Manager Interface", _A_F_S_-_3
|
||||
_P_r_o_g_r_a_m_m_e_r_'_s _R_e_f_e_r_e_n_c_e, 1991.
|
||||
|
||||
BBUUGGSS
|
||||
AFS_SYSCALL has no effect under AIX.
|
||||
|
||||
KTH-KRB May 7, 1997 2
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of KTH 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 KTH AND ITS 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 KTH OR ITS 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. */
|
||||
|
||||
#include "krb5_locl.h"
|
||||
|
||||
RCSID("$Id: derived-key-test.c,v 1.1 2001/03/12 07:44:52 assar Exp $");
|
||||
|
||||
enum { MAXSIZE = 24 };
|
||||
|
||||
static struct testcase {
|
||||
krb5_enctype enctype;
|
||||
unsigned char constant[MAXSIZE];
|
||||
size_t constant_len;
|
||||
unsigned char key[MAXSIZE];
|
||||
unsigned char res[MAXSIZE];
|
||||
} tests[] = {
|
||||
{ETYPE_DES3_CBC_SHA1, {0x00, 0x00, 0x00, 0x01, 0x55}, 5,
|
||||
{0xdc, 0xe0, 0x6b, 0x1f, 0x64, 0xc8, 0x57, 0xa1, 0x1c, 0x3d, 0xb5, 0x7c, 0x51, 0x89, 0x9b, 0x2c, 0xc1, 0x79, 0x10, 0x08, 0xce, 0x97, 0x3b, 0x92},
|
||||
{0x92, 0x51, 0x79, 0xd0, 0x45, 0x91, 0xa7, 0x9b, 0x5d, 0x31, 0x92, 0xc4, 0xa7, 0xe9, 0xc2, 0x89, 0xb0, 0x49, 0xc7, 0x1f, 0x6e, 0xe6, 0x04, 0xcd}},
|
||||
{ETYPE_DES3_CBC_SHA1, {0x00, 0x00, 0x00, 0x01, 0xaa}, 5,
|
||||
{0x5e, 0x13, 0xd3, 0x1c, 0x70, 0xef, 0x76, 0x57, 0x46, 0x57, 0x85, 0x31, 0xcb, 0x51, 0xc1, 0x5b, 0xf1, 0x1c, 0xa8, 0x2c, 0x97, 0xce, 0xe9, 0xf2},
|
||||
{0x9e, 0x58, 0xe5, 0xa1, 0x46, 0xd9, 0x94, 0x2a, 0x10, 0x1c, 0x46, 0x98, 0x45, 0xd6, 0x7a, 0x20, 0xe3, 0xc4, 0x25, 0x9e, 0xd9, 0x13, 0xf2, 0x07}},
|
||||
{ETYPE_DES3_CBC_SHA1, {0x00, 0x00, 0x00, 0x01, 0x55}, 5,
|
||||
{0x98, 0xe6, 0xfd, 0x8a, 0x04, 0xa4, 0xb6, 0x85, 0x9b, 0x75, 0xa1, 0x76, 0x54, 0x0b, 0x97, 0x52, 0xba, 0xd3, 0xec, 0xd6, 0x10, 0xa2, 0x52, 0xbc},
|
||||
{0x13, 0xfe, 0xf8, 0x0d, 0x76, 0x3e, 0x94, 0xec, 0x6d, 0x13, 0xfd, 0x2c, 0xa1, 0xd0, 0x85, 0x07, 0x02, 0x49, 0xda, 0xd3, 0x98, 0x08, 0xea, 0xbf}},
|
||||
{ETYPE_DES3_CBC_SHA1, {0x00, 0x00, 0x00, 0x01, 0xaa}, 5,
|
||||
{0x62, 0x2a, 0xec, 0x25, 0xa2, 0xfe, 0x2c, 0xad, 0x70, 0x94, 0x68, 0x0b, 0x7c, 0x64, 0x94, 0x02, 0x80, 0x08, 0x4c, 0x1a, 0x7c, 0xec, 0x92, 0xb5},
|
||||
{0xf8, 0xdf, 0xbf, 0x04, 0xb0, 0x97, 0xe6, 0xd9, 0xdc, 0x07, 0x02, 0x68, 0x6b, 0xcb, 0x34, 0x89, 0xd9, 0x1f, 0xd9, 0xa4, 0x51, 0x6b, 0x70, 0x3e}},
|
||||
{ETYPE_DES3_CBC_SHA1, {0x6b, 0x65, 0x72, 0x62, 0x65, 0x72, 0x6f, 0x73}, 8,
|
||||
{0xd3, 0xf8, 0x29, 0x8c, 0xcb, 0x16, 0x64, 0x38, 0xdc, 0xb9, 0xb9, 0x3e, 0xe5, 0xa7, 0x62, 0x92, 0x86, 0xa4, 0x91, 0xf8, 0x38, 0xf8, 0x02, 0xfb},
|
||||
{0x23, 0x70, 0xda, 0x57, 0x5d, 0x2a, 0x3d, 0xa8, 0x64, 0xce, 0xbf, 0xdc, 0x52, 0x04, 0xd5, 0x6d, 0xf7, 0x79, 0xa7, 0xdf, 0x43, 0xd9, 0xda, 0x43}},
|
||||
{ETYPE_DES3_CBC_SHA1, {0x63, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x65}, 7,
|
||||
{0xb5, 0x5e, 0x98, 0x34, 0x67, 0xe5, 0x51, 0xb3, 0xe5, 0xd0, 0xe5, 0xb6, 0xc8, 0x0d, 0x45, 0x76, 0x94, 0x23, 0xa8, 0x73, 0xdc, 0x62, 0xb3, 0x0e},
|
||||
{0x01, 0x26, 0x38, 0x8a, 0xad, 0xc8, 0x1a, 0x1f, 0x2a, 0x62, 0xbc, 0x45, 0xf8, 0xd5, 0xc1, 0x91, 0x51, 0xba, 0xcd, 0xd5, 0xcb, 0x79, 0x8a, 0x3e}},
|
||||
{ETYPE_DES3_CBC_SHA1, {0x00, 0x00, 0x00, 0x01, 0x55}, 5,
|
||||
{0xc1, 0x08, 0x16, 0x49, 0xad, 0xa7, 0x43, 0x62, 0xe6, 0xa1, 0x45, 0x9d, 0x01, 0xdf, 0xd3, 0x0d, 0x67, 0xc2, 0x23, 0x4c, 0x94, 0x07, 0x04, 0xda},
|
||||
{0x34, 0x80, 0x57, 0xec, 0x98, 0xfd, 0xc4, 0x80, 0x16, 0x16, 0x1c, 0x2a, 0x4c, 0x7a, 0x94, 0x3e, 0x92, 0xae, 0x49, 0x2c, 0x98, 0x91, 0x75, 0xf7}},
|
||||
{ETYPE_DES3_CBC_SHA1, {0x00, 0x00, 0x00, 0x01, 0xaa}, 5,
|
||||
{0x5d, 0x15, 0x4a, 0xf2, 0x38, 0xf4, 0x67, 0x13, 0x15, 0x57, 0x19, 0xd5, 0x5e, 0x2f, 0x1f, 0x79, 0x0d, 0xd6, 0x61, 0xf2, 0x79, 0xa7, 0x91, 0x7c},
|
||||
{0xa8, 0x80, 0x8a, 0xc2, 0x67, 0xda, 0xda, 0x3d, 0xcb, 0xe9, 0xa7, 0xc8, 0x46, 0x26, 0xfb, 0xc7, 0x61, 0xc2, 0x94, 0xb0, 0x13, 0x15, 0xe5, 0xc1}},
|
||||
{ETYPE_DES3_CBC_SHA1, {0x00, 0x00, 0x00, 0x01, 0x55}, 5,
|
||||
{0x79, 0x85, 0x62, 0xe0, 0x49, 0x85, 0x2f, 0x57, 0xdc, 0x8c, 0x34, 0x3b, 0xa1, 0x7f, 0x2c, 0xa1, 0xd9, 0x73, 0x94, 0xef, 0xc8, 0xad, 0xc4, 0x43},
|
||||
{0xc8, 0x13, 0xf8, 0x8a, 0x3b, 0xe3, 0xb3, 0x34, 0xf7, 0x54, 0x25, 0xce, 0x91, 0x75, 0xfb, 0xe3, 0xc8, 0x49, 0x3b, 0x89, 0xc8, 0x70, 0x3b, 0x49}},
|
||||
{ETYPE_DES3_CBC_SHA1, {0x00, 0x00, 0x00, 0x01, 0xaa}, 5,
|
||||
{0x26, 0xdc, 0xe3, 0x34, 0xb5, 0x45, 0x29, 0x2f, 0x2f, 0xea, 0xb9, 0xa8, 0x70, 0x1a, 0x89, 0xa4, 0xb9, 0x9e, 0xb9, 0x94, 0x2c, 0xec, 0xd0, 0x16},
|
||||
{0xf4, 0x8f, 0xfd, 0x6e, 0x83, 0xf8, 0x3e, 0x73, 0x54, 0xe6, 0x94, 0xfd, 0x25, 0x2c, 0xf8, 0x3b, 0xfe, 0x58, 0xf7, 0xd5, 0xba, 0x37, 0xec, 0x5d}},
|
||||
{0}
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct testcase *t;
|
||||
krb5_context context;
|
||||
krb5_error_code ret;
|
||||
int val = 0;
|
||||
|
||||
ret = krb5_init_context (&context);
|
||||
if (ret)
|
||||
errx (1, "krb5_init_context failed: %d", ret);
|
||||
|
||||
for (t = tests; t->enctype != 0; ++t) {
|
||||
krb5_keyblock key;
|
||||
krb5_keyblock *dkey;
|
||||
|
||||
key.keytype = KEYTYPE_DES3;
|
||||
key.keyvalue.length = MAXSIZE;
|
||||
key.keyvalue.data = t->key;
|
||||
|
||||
ret = krb5_derive_key(context, &key, t->enctype, t->constant,
|
||||
t->constant_len, &dkey);
|
||||
if (ret)
|
||||
krb5_err (context, 1, ret, "krb5_derive_key");
|
||||
if (memcmp (dkey->keyvalue.data, t->res, dkey->keyvalue.length) != 0) {
|
||||
const unsigned char *p = dkey->keyvalue.data;
|
||||
int i;
|
||||
|
||||
printf ("derive_key failed\n");
|
||||
printf ("should be: ");
|
||||
for (i = 0; i < dkey->keyvalue.length; ++i)
|
||||
printf ("%02x", t->res[i]);
|
||||
printf ("\nresult was: ");
|
||||
for (i = 0; i < dkey->keyvalue.length; ++i)
|
||||
printf ("%02x", p[i]);
|
||||
printf ("\n");
|
||||
val = 1;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#include "krb5_locl.h"
|
||||
|
||||
RCSID("$Id: error_string.c,v 1.1 2001/05/06 23:07:22 assar Exp $");
|
||||
|
||||
#undef __attribute__
|
||||
#define __attribute__(X)
|
||||
|
||||
void
|
||||
krb5_free_error_string(krb5_context context, char *str)
|
||||
{
|
||||
if (str != context->error_buf)
|
||||
free(str);
|
||||
}
|
||||
|
||||
void
|
||||
krb5_clear_error_string(krb5_context context)
|
||||
{
|
||||
if (context->error_string != NULL
|
||||
&& context->error_string != context->error_buf)
|
||||
free(context->error_string);
|
||||
context->error_string = NULL;
|
||||
}
|
||||
|
||||
krb5_error_code
|
||||
krb5_set_error_string(krb5_context context, const char *fmt, ...)
|
||||
__attribute__((format (printf, 2, 3)))
|
||||
{
|
||||
krb5_error_code ret;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
ret = krb5_vset_error_string (context, fmt, ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
krb5_error_code
|
||||
krb5_vset_error_string(krb5_context context, const char *fmt, va_list args)
|
||||
__attribute__ ((format (printf, 2, 0)))
|
||||
{
|
||||
krb5_clear_error_string(context);
|
||||
vasprintf(&context->error_string, fmt, args);
|
||||
if(context->error_string == NULL) {
|
||||
vsnprintf (context->error_buf, sizeof(context->error_buf), fmt, args);
|
||||
context->error_string = context->error_buf;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char*
|
||||
krb5_get_error_string(krb5_context context)
|
||||
{
|
||||
char *ret = context->error_string;
|
||||
context->error_string = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
krb5_boolean
|
||||
krb5_have_error_string(krb5_context context)
|
||||
{
|
||||
return context->error_string != NULL;
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of KTH 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 KTH AND ITS 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 KTH OR ITS 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. */
|
||||
|
||||
#include "krb5_locl.h"
|
||||
|
||||
RCSID("$Id: store-test.c,v 1.1 2001/05/11 16:06:25 joda Exp $");
|
||||
|
||||
static void
|
||||
print_data(unsigned char *data, size_t len)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < len; i++) {
|
||||
if(i > 0 && (i % 16) == 0)
|
||||
printf("\n ");
|
||||
printf("%02x ", data[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static int
|
||||
compare(const char *name, krb5_storage *sp, void *expected, size_t len)
|
||||
{
|
||||
int ret = 0;
|
||||
krb5_data data;
|
||||
krb5_storage_to_data(sp, &data);
|
||||
krb5_storage_free(sp);
|
||||
if(data.length != len || memcmp(data.data, expected, len) != 0) {
|
||||
printf("%s mismatch\n", name);
|
||||
printf(" Expected: ");
|
||||
print_data(expected, len);
|
||||
printf(" Actual: ");
|
||||
print_data(data.data, data.length);
|
||||
ret++;
|
||||
}
|
||||
krb5_data_free(&data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int nerr = 0;
|
||||
krb5_storage *sp;
|
||||
krb5_context context;
|
||||
krb5_principal principal;
|
||||
|
||||
|
||||
krb5_init_context(&context);
|
||||
|
||||
sp = krb5_storage_emem();
|
||||
krb5_store_int32(sp, 0x01020304);
|
||||
nerr += compare("Integer", sp, "\x1\x2\x3\x4", 4);
|
||||
|
||||
sp = krb5_storage_emem();
|
||||
krb5_storage_set_byteorder(sp, KRB5_STORAGE_BYTEORDER_LE);
|
||||
krb5_store_int32(sp, 0x01020304);
|
||||
nerr += compare("Integer (LE)", sp, "\x4\x3\x2\x1", 4);
|
||||
|
||||
sp = krb5_storage_emem();
|
||||
krb5_storage_set_byteorder(sp, KRB5_STORAGE_BYTEORDER_BE);
|
||||
krb5_store_int32(sp, 0x01020304);
|
||||
nerr += compare("Integer (BE)", sp, "\x1\x2\x3\x4", 4);
|
||||
|
||||
sp = krb5_storage_emem();
|
||||
krb5_storage_set_byteorder(sp, KRB5_STORAGE_BYTEORDER_HOST);
|
||||
krb5_store_int32(sp, 0x01020304);
|
||||
{
|
||||
int test = 1;
|
||||
void *data;
|
||||
if(*(char*)&test)
|
||||
data = "\x4\x3\x2\x1";
|
||||
else
|
||||
data = "\x1\x2\x3\x4";
|
||||
nerr += compare("Integer (host)", sp, data, 4);
|
||||
}
|
||||
|
||||
sp = krb5_storage_emem();
|
||||
krb5_make_principal(context, &principal, "TEST", "foobar", NULL);
|
||||
krb5_store_principal(sp, principal);
|
||||
nerr += compare("Principal", sp, "\x0\x0\x0\x1"
|
||||
"\x0\x0\x0\x1"
|
||||
"\x0\x0\x0\x4TEST"
|
||||
"\x0\x0\x0\x6""foobar", 26);
|
||||
|
||||
return nerr ? 1 : 0;
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001 Kungliga Tekniska Högskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include "roken.h"
|
||||
|
||||
RCSID("$Id: bswap.c,v 1.3 2001/05/18 15:32:11 joda Exp $");
|
||||
|
||||
#ifndef HAVE_BSWAP32
|
||||
|
||||
unsigned int
|
||||
bswap32 (unsigned int val)
|
||||
{
|
||||
return (val & 0xff) << 24 |
|
||||
(val & 0xff00) << 8 |
|
||||
(val & 0xff0000) >> 8 |
|
||||
(val & 0xff000000) >> 24;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_BSWAP16
|
||||
|
||||
unsigned short
|
||||
bswap16 (unsigned short val)
|
||||
{
|
||||
return (val & 0xff) << 8 |
|
||||
(val & 0xff00) >> 8;
|
||||
}
|
||||
#endif
|
||||
@@ -1,52 +0,0 @@
|
||||
|
||||
KRB5-CONFIG(1) UNIX Reference Manual KRB5-CONFIG(1)
|
||||
|
||||
NNAAMMEE
|
||||
kkrrbb55--ccoonnffiigg - give information on how to link code against Heimdal li-
|
||||
braries
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
kkrrbb55--ccoonnffiigg [----pprreeffiixx[=_d_i_r]] [----eexxeecc--pprreeffiixx[=_d_i_r]] [----lliibbss] [----ccffllaaggss]
|
||||
[_l_i_b_r_a_r_i_e_s]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
kkrrbb55--ccoonnffiigg tells the application programmer what special flags to use to
|
||||
compile and link programs against the libraries installed by Heimdal.
|
||||
|
||||
Options supported:
|
||||
|
||||
----pprreeffiixx[=_d_i_r]
|
||||
Print the prefix if no _d_i_r is specified, otherwise set prefix to
|
||||
_d_i_r.
|
||||
|
||||
----eexxeecc--pprreeffiixx[=_d_i_r]
|
||||
Print the exec-prefix if no _d_i_r is specified, otherwise set exec-
|
||||
prefix to _d_i_r.
|
||||
|
||||
----lliibbss Output the set of libraries that should be linked against.
|
||||
|
||||
----ccffllaaggss
|
||||
Output the set of flags to give to the C compiler when using the
|
||||
Heimdal libraries.
|
||||
|
||||
By default kkrrbb55--ccoonnffiigg will output the set of flags and libraries to be
|
||||
used by a normal program using the krb5 API. The user can also supply a
|
||||
library to be used, the supported ones are:
|
||||
|
||||
krb5 (the default)
|
||||
|
||||
gssapi use the krb5 gssapi mechanism
|
||||
|
||||
kadm-client
|
||||
use the client-side kadmin libraries
|
||||
|
||||
kadm-server
|
||||
use the server-side kadmin libraries
|
||||
|
||||
SSEEEE AALLSSOO
|
||||
cc(1)
|
||||
|
||||
HHIISSTTOORRYY
|
||||
kkrrbb55--ccoonnffiigg appeared in Heimdal 0.3d.
|
||||
|
||||
HEIMDAL November 30, 2000 1
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,70 +0,0 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SSL_COMP_add_compression_method - handle SSL/TLS integrated compression methods
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
SSL_COMP_add_compression_method() adds the compression method B<cm> with
|
||||
the identifier B<id> to the list of available compression methods. This
|
||||
list is globally maintained for all SSL operations within this application.
|
||||
It cannot be set for specific SSL_CTX or SSL objects.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
The TLS standard (or SSLv3) allows the integration of compression methods
|
||||
into the communication. The TLS RFC does however not specify compression
|
||||
methods or their corresponding identifiers, so there is currently no compatible
|
||||
way to integrate compression with unknown peers. It is therefore currently not
|
||||
recommended to integrate compression into applications. Applications for
|
||||
non-public use may agree on certain compression methods. Using different
|
||||
compression methods with the same identifier will lead to connection failure.
|
||||
|
||||
An OpenSSL client speaking a protocol that allows compression (SSLv3, TLSv1)
|
||||
will unconditionally send the list of all compression methods enabled with
|
||||
SSL_COMP_add_compression_method() to the server during the handshake.
|
||||
Unlike the mechanisms to set a cipher list, there is no method available to
|
||||
restrict the list of compression method on a per connection basis.
|
||||
|
||||
An OpenSSL server will match the identifiers listed by a client against
|
||||
its own compression methods and will unconditionally activate compression
|
||||
when a matching identifier is found. There is no way to restrict the list
|
||||
of compression methods supported on a per connection basis.
|
||||
|
||||
The OpenSSL library has the compression methods B<COMP_rle()> and (when
|
||||
especially enabled during compilation) B<COMP_zlib()> available.
|
||||
|
||||
=head1 WARNINGS
|
||||
|
||||
Once the identities of the compression methods for the TLS protocol have
|
||||
been standardized, the compression API will most likely be changed. Using
|
||||
it in the current state is not recommended.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
SSL_COMP_add_compression_method() may return the following values:
|
||||
|
||||
=over 4
|
||||
|
||||
=item 1
|
||||
|
||||
The operation succeeded.
|
||||
|
||||
=item 0
|
||||
|
||||
The operation failed. Check the error queue to find out the reason.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<ssl(3)|ssl(3)>
|
||||
|
||||
=cut
|
||||
@@ -1,34 +0,0 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SSL_CTX_ctrl, SSL_CTX_callback_ctrl, SSL_ctrl, SSL_callback_ctrl - internal handling functions for SSL_CTX and SSL objects
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
|
||||
long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, char *parg);
|
||||
long SSL_CTX_callback_ctrl(SSL_CTX *, int cmd, void (*fp)());
|
||||
|
||||
long SSL_ctrl(SSL *ssl, int cmd, long larg, char *parg);
|
||||
long SSL_callback_ctrl(SSL *, int cmd, void (*fp)());
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The SSL_*_ctrl() family of functions is used to manipulate settings of
|
||||
the SSL_CTX and SSL objects. Depending on the command B<cmd> the arguments
|
||||
B<larg>, B<parg>, or B<fp> are evaluated. These functions should never
|
||||
be called directly. All functionalities needed are made available via
|
||||
other functions or macros.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
The return values of the SSL*_ctrl() functions depend on the command
|
||||
supplied via the B<cmd> parameter.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<ssl(3)|ssl(3)>
|
||||
|
||||
=cut
|
||||
Loaded 100 of 507 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user