summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Insulander <hin@cvs.openbsd.org>2003-08-12 14:48:19 +0000
committerHans Insulander <hin@cvs.openbsd.org>2003-08-12 14:48:19 +0000
commit37866bde71dfdb9c3d471885b448a06c19a9515c (patch)
tree15b5347e6fe8cb7c78749afa26bd3af29015b296
parent48012108bd6f2882c2f7f497a9cddbcb02107737 (diff)
These files are unused by us and have strcat/strcpy badness in them,
so they'll just go away.
-rw-r--r--usr.sbin/afs/src/lib/acl/Makefile.in83
-rw-r--r--usr.sbin/afs/src/lib/acl/acl.h51
-rw-r--r--usr.sbin/afs/src/lib/acl/acl_files.c611
-rw-r--r--usr.sbin/afs/src/lib/acl/acl_files.doc107
-rw-r--r--usr.sbin/afs/src/lib/editline/ChangeLog97
-rw-r--r--usr.sbin/afs/src/lib/editline/Makefile.in87
-rw-r--r--usr.sbin/afs/src/lib/editline/README45
-rw-r--r--usr.sbin/afs/src/lib/editline/complete.c243
-rw-r--r--usr.sbin/afs/src/lib/editline/edit_compat.c118
-rw-r--r--usr.sbin/afs/src/lib/editline/editline.3175
-rw-r--r--usr.sbin/afs/src/lib/editline/editline.c1376
-rw-r--r--usr.sbin/afs/src/lib/editline/editline.h64
-rw-r--r--usr.sbin/afs/src/lib/editline/sysunix.c92
-rw-r--r--usr.sbin/afs/src/lib/editline/testit.c38
-rw-r--r--usr.sbin/afs/src/lib/editline/unix.h22
15 files changed, 0 insertions, 3209 deletions
diff --git a/usr.sbin/afs/src/lib/acl/Makefile.in b/usr.sbin/afs/src/lib/acl/Makefile.in
deleted file mode 100644
index de30d3db6c7..00000000000
--- a/usr.sbin/afs/src/lib/acl/Makefile.in
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# $KTH: Makefile.in,v 1.7 2000/10/10 20:55:55 lha Exp $
-#
-
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-top_builddir = ../..
-VPATH = @srcdir@
-
-CC = @CC@
-AR = ar
-LN_S = @LN_S@
-RANLIB = @RANLIB@
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@
-
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-libdir = @libdir@
-
-INCLUDES = -I../../include \
- -I$(srcdir)/../../include \
- -I$(srcdir) \
- @INC_roken@ \
- -I.
-
-REALCFLAGS = $(INCLUDES) @KRB4_INC_FLAGS@ $(CFLAGS)
-LIBNAME = $(LIBPREFIX)acl
-LIBEXT = a
-LIBPREFIX = lib
-LIB = $(LIBNAME).$(LIBEXT)
-
-SOURCES = acl_files.c
-
-OBJECTS = acl_files.o
-
-all: $(LIB)
-
-Wall:
- make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
-
-.c.o:
- $(CC) -c $(DEFS) $(REALCFLAGS) $(PICFLAGS) $(CPPFLAGS) $<
-
-install: all
- $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
- $(INSTALL_DATA) -m 0555 $(LIB) $(DESTDIR)$(libdir)/$(LIB)
-
-uninstall:
- rm -f $(DESTDIR)$(libdir)/$(LIB)
-
-TAGS: $(SOURCES)
- etags $(SOURCES)
-
-check:
-
-clean:
- rm -f $(LIB) *.o *.a
-
-mostlyclean: clean
-
-distclean: clean
- rm -f Makefile *.tab.c *~ roken_rename.h
-
-realclean: distclean
- rm -f TAGS
-
-$(LIBNAME).a: $(OBJECTS)
- rm -f $@
- $(AR) cr $@ $(OBJECTS)
- -$(RANLIB) $@
-
-$(OBJECTS): ../../include/config.h
-
-Makefile: ../../config.status Makefile.in
- cd ../.. ; CONFIG_FILES=lib/acl/Makefile CONFIG_HEADERS= $(SHELL) config.status
-
-.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/usr.sbin/afs/src/lib/acl/acl.h b/usr.sbin/afs/src/lib/acl/acl.h
deleted file mode 100644
index 9895c1c5290..00000000000
--- a/usr.sbin/afs/src/lib/acl/acl.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1995, 1996, 1997, 1998, 1999 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.
- */
-
-/* $arla: acl.h,v 1.5 2000/10/03 00:28:33 lha Exp $ */
-
-#ifndef __ACL_H
-#define __ACL_H
-
-#include <atypes.h>
-#ifndef HAVE_KRB_PRINCIPAL
-#include <stds.h>
-#endif
-
-void acl_canonicalize_principal(char *principal, char *canon);
-int acl_initialize(char *acl_file, int perm);
-int acl_exact_match(char *acl, char *principal);
-int acl_check(char *acl, char *principal);
-int acl_add(char *acl, char *principal);
-int acl_delete(char *acl, char *principal);
-
-#endif /* __ACL_H */
diff --git a/usr.sbin/afs/src/lib/acl/acl_files.c b/usr.sbin/afs/src/lib/acl/acl_files.c
deleted file mode 100644
index ccc17d1822e..00000000000
--- a/usr.sbin/afs/src/lib/acl/acl_files.c
+++ /dev/null
@@ -1,611 +0,0 @@
-/*
- Copyright (C) 1989 by the Massachusetts Institute of Technology
-
- Export of this software from the United States of America is assumed
- to require a specific license from the United States Government.
- It is the responsibility of any person or organization contemplating
- export to obtain such a license before exporting.
-
-WITHIN THAT CONSTRAINT, 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 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.
-
- */
-
-#include "config.h"
-
-RCSID("$arla: acl_files.c,v 1.5 1999/09/09 23:46:01 assar Exp $");
-
-#ifdef KERBEROS
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#include <time.h>
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#include <errno.h>
-#include <ctype.h>
-
-#include <roken.h>
-
-#include <krb.h>
-#include <acl.h>
-
-/*
- * compat functions for different krb libraries
- *
- * this should either be moved somewhere else or compatability with
- * other kerberos implementations should just be given up.
- */
-
-#ifndef HAVE_KRB_PRINCIPAL
-
-int
-krb_parse_name (const char *fullname, krb_principal *principal)
-{
- return kname_parse (principal->name,
- principal->instance,
- principal->realm,
- fullname);
-}
-
-/* copied from unparse_name.c in krb4 */
-
-static void
-quote_string(char *quote, char *from, char *to)
-{
- while(*from){
- if(strchr(quote, *from))
- *to++ = '\\';
- *to++ = *from++;
- }
- *to = 0;
-}
-
-/* To be compatible with old functions, we quote differently in each
- part of the principal*/
-
-char *
-krb_unparse_name_r(krb_principal *pr, char *fullname)
-{
- quote_string("'@\\", pr->name, fullname);
- if(pr->instance[0]){
- strcat(fullname, ".");
- quote_string("@\\", pr->instance, fullname + strlen(fullname));
- }
- if(pr->realm[0]){
- strcat(fullname, "@");
- quote_string("\\", pr->realm, fullname + strlen(fullname));
- }
- return fullname;
-}
-
-char *
-krb_unparse_name_long_r(char *name, char *instance, char *realm,
- char *fullname)
-{
- krb_principal pr;
-
- memset(&pr, 0, sizeof(pr));
- strncpy (pr.name, name, sizeof(pr.name));
- pr.name[sizeof(pr.name) - 1] = '\0';
- if(instance) {
- strncpy (pr.instance, instance, sizeof(pr.instance));
- pr.instance[sizeof(pr.instance) - 1] = '\0';
- }
- if(realm) {
- strncpy (pr.realm, realm, sizeof(pr.realm));
- pr.realm[sizeof(pr.realm) - 1] = '\0';
- }
- return krb_unparse_name_r(&pr, fullname);
-}
-
-char *
-krb_unparse_name(krb_principal *pr)
-{
- static char principal[MAX_K_NAME_SZ];
- krb_unparse_name_r(pr, principal);
- return principal;
-}
-
-char *
-krb_unparse_name_long(char *name, char *instance, char *realm)
-{
- krb_principal pr;
-
- memset(&pr, 0, sizeof(pr));
- strncpy(pr.name, name, sizeof(pr.name));
- pr.name[sizeof(pr.name) - 1] = '\0';
- if(instance) {
- strncpy(pr.instance, instance, sizeof(pr.instance));
- pr.instance[sizeof(pr.instance) - 1] = '\0';
- }
- if(realm) {
- strncpy(pr.realm, realm, sizeof(pr.realm));
- pr.realm[sizeof(pr.realm) - 1] = '\0';
- }
- return krb_unparse_name(&pr);
-}
-
-#endif /* HAVE_KRB_PRINCIPAL */
-
-/*** Routines for manipulating access control list files ***/
-
-/* "aname.inst@realm" */
-#define MAX_PRINCIPAL_SIZE (ANAME_SZ + INST_SZ + REALM_SZ + 3)
-#define INST_SEP '.'
-#define REALM_SEP '@'
-
-#define LINESIZE 2048 /* Maximum line length in an acl file */
-
-#define NEW_FILE "%s.~NEWACL~" /* Format for name of altered acl file */
-#define WAIT_TIME 300 /* Maximum time allowed write acl file */
-
-#define CACHED_ACLS 8 /* How many acls to cache */
- /* Each acl costs 1 open file descriptor */
-#define ACL_LEN 16 /* Twice a reasonable acl length */
-
-#define COR(a,b) ((a!=NULL)?(a):(b))
-
-/*
- * Canonicalize a principal name.
- * If instance is missing, it becomes ""
- * If realm is missing, it becomes the local realm
- * Canonicalized form is put in canon, which must be big enough to
- * hold MAX_PRINCIPAL_SIZE characters
- *
- */
-
-void
-acl_canonicalize_principal(char *principal, char *canon)
-{
- krb_principal princ;
- int ret;
- ret = krb_parse_name(principal, &princ);
- if(ret) { /* ? */
- *canon = '\0';
- return;
- }
- if(princ.realm[0] == '\0')
- krb_get_lrealm(princ.realm, 1);
- krb_unparse_name_r(&princ, canon);
-}
-
-/* Get a lock to modify acl_file */
-/* Return new FILE pointer */
-/* or NULL if file cannot be modified */
-/* REQUIRES WRITE PERMISSION TO CONTAINING DIRECTORY */
-static
-FILE *acl_lock_file(char *acl_file)
-{
- struct stat s;
- char new[LINESIZE];
- int nfd;
- FILE *nf;
- int mode;
-
- if(stat(acl_file, &s) < 0) return(NULL);
- mode = s.st_mode;
- snprintf(new, sizeof(new), NEW_FILE, acl_file);
- for(;;) {
- /* Open the new file */
- if((nfd = open(new, O_WRONLY|O_CREAT|O_EXCL, mode)) < 0) {
- if(errno == EEXIST) {
- /* Maybe somebody got here already, maybe it's just old */
- if(stat(new, &s) < 0) return(NULL);
- if(time(0) - s.st_ctime > WAIT_TIME) {
- /* File is stale, kill it */
- unlink(new);
- continue;
- } else {
- /* Wait and try again */
- sleep(1);
- continue;
- }
- } else {
- /* Some other error, we lose */
- return(NULL);
- }
- }
-
- /* If we got to here, the lock file is ours and ok */
- /* Reopen it under stdio */
- if((nf = fdopen(nfd, "w")) == NULL) {
- /* Oops, clean up */
- unlink(new);
- }
- return(nf);
- }
-}
-
-/* Abort changes to acl_file written onto FILE *f */
-/* Returns 0 if successful, < 0 otherwise */
-/* Closes f */
-static int
-acl_abort(char *acl_file, FILE *f)
-{
- char new[LINESIZE];
- int ret;
- struct stat s;
-
- /* make sure we aren't nuking someone else's file */
- if(fstat(fileno(f), &s) < 0
- || s.st_nlink == 0) {
- fclose(f);
- return(-1);
- } else {
- snprintf(new, sizeof(new), NEW_FILE, acl_file);
- ret = unlink(new);
- fclose(f);
- return(ret);
- }
-}
-
-/* Commit changes to acl_file written onto FILE *f */
-/* Returns zero if successful */
-/* Returns > 0 if lock was broken */
-/* Returns < 0 if some other error occurs */
-/* Closes f */
-static int
-acl_commit(char *acl_file, FILE *f)
-{
- char new[LINESIZE];
- int ret;
- struct stat s;
-
- snprintf(new, sizeof(new), NEW_FILE, acl_file);
- if(fflush(f) < 0
- || fstat(fileno(f), &s) < 0
- || s.st_nlink == 0) {
- acl_abort(acl_file, f);
- return(-1);
- }
-
- ret = rename(new, acl_file);
- fclose(f);
- return(ret);
-}
-
-/* Initialize an acl_file */
-/* Creates the file with permissions perm if it does not exist */
-/* Erases it if it does */
-/* Returns return value of acl_commit */
-int
-acl_initialize(char *acl_file, int perm)
-{
- FILE *new;
- int fd;
-
- /* Check if the file exists already */
- if((new = acl_lock_file(acl_file)) != NULL) {
- return(acl_commit(acl_file, new));
- } else {
- /* File must be readable and writable by owner */
- if((fd = open(acl_file, O_CREAT|O_EXCL, perm|0600)) < 0) {
- return(-1);
- } else {
- close(fd);
- return(0);
- }
- }
-}
-
-/* Eliminate all whitespace character in buf */
-/* Modifies its argument */
-static void
- nuke_whitespace(char *buf)
-{
- char *pin, *pout;
-
- for(pin = pout = buf; *pin != '\0'; pin++)
- if(!isspace((unsigned char)*pin)) *pout++ = *pin;
- *pout = '\0'; /* Terminate the string */
-}
-
-/* Hash table stuff */
-
-struct hashtbl {
- int size; /* Max number of entries */
- int entries; /* Actual number of entries */
- char **tbl; /* Pointer to start of table */
-};
-
-/* Make an empty hash table of size s */
-static struct hashtbl *
-make_hash(int size)
-{
- struct hashtbl *h;
-
- if(size < 1) size = 1;
- h = (struct hashtbl *) malloc(sizeof(struct hashtbl));
- if (h == NULL)
- return NULL;
- h->size = size;
- h->entries = 0;
- h->tbl = (char **) calloc(size, sizeof(char *));
- if (h->tbl == NULL) {
- free (h);
- return NULL;
- }
- return(h);
-}
-
-/* Destroy a hash table */
-static void
-destroy_hash(struct hashtbl *h)
-{
- int i;
-
- for(i = 0; i < h->size; i++) {
- if(h->tbl[i] != NULL) free(h->tbl[i]);
- }
- free(h->tbl);
- free(h);
-}
-
-/* Compute hash value for a string */
-static unsigned int
-hashval(char *s)
-{
- unsigned hv;
-
- for(hv = 0; *s != '\0'; s++) {
- hv ^= ((hv << 3) ^ *s);
- }
- return(hv);
-}
-
-/* Add an element to a hash table */
-static void
-add_hash(struct hashtbl *h, char *el)
-{
- unsigned hv;
- char *s;
- char **old;
- int i;
-
- /* Make space if it isn't there already */
- if(h->entries + 1 > (h->size >> 1)) {
- old = h->tbl;
- h->tbl = (char **) calloc(h->size << 1, sizeof(char *));
- for(i = 0; i < h->size; i++) {
- if(old[i] != NULL) {
- hv = hashval(old[i]) % (h->size << 1);
- while(h->tbl[hv] != NULL) hv = (hv+1) % (h->size << 1);
- h->tbl[hv] = old[i];
- }
- }
- h->size = h->size << 1;
- free(old);
- }
-
- hv = hashval(el) % h->size;
- while(h->tbl[hv] != NULL && strcmp(h->tbl[hv], el)) hv = (hv+1) % h->size;
- s = strdup(el);
- if (s != NULL) {
- h->tbl[hv] = s;
- h->entries++;
- }
-}
-
-/* Returns nonzero if el is in h */
-static int
-check_hash(struct hashtbl *h, char *el)
-{
- unsigned hv;
-
- for(hv = hashval(el) % h->size;
- h->tbl[hv] != NULL;
- hv = (hv + 1) % h->size) {
- if(!strcmp(h->tbl[hv], el)) return(1);
- }
- return(0);
-}
-
-struct acl {
- char filename[LINESIZE]; /* Name of acl file */
- int fd; /* File descriptor for acl file */
- struct stat status; /* File status at last read */
- struct hashtbl *acl; /* Acl entries */
-};
-
-static struct acl acl_cache[CACHED_ACLS];
-
-static int acl_cache_count = 0;
-static int acl_cache_next = 0;
-
-/* Returns < 0 if unsuccessful in loading acl */
-/* Returns index into acl_cache otherwise */
-/* Note that if acl is already loaded, this is just a lookup */
-static int
-acl_load(char *name)
-{
- int i;
- FILE *f;
- struct stat s;
- char buf[MAX_PRINCIPAL_SIZE];
- char canon[MAX_PRINCIPAL_SIZE];
-
- /* See if it's there already */
- for(i = 0; i < acl_cache_count; i++) {
- if(!strcmp(acl_cache[i].filename, name)
- && acl_cache[i].fd >= 0) goto got_it;
- }
-
- /* It isn't, load it in */
- /* maybe there's still room */
- if(acl_cache_count < CACHED_ACLS) {
- i = acl_cache_count++;
- } else {
- /* No room, clean one out */
- i = acl_cache_next;
- acl_cache_next = (acl_cache_next + 1) % CACHED_ACLS;
- close(acl_cache[i].fd);
- if(acl_cache[i].acl) {
- destroy_hash(acl_cache[i].acl);
- acl_cache[i].acl = (struct hashtbl *) 0;
- }
- }
-
- /* Set up the acl */
- strncpy(acl_cache[i].filename, name, LINESIZE);
- acl_cache[i].filename[LINESIZE-1] = '\0';
- if((acl_cache[i].fd = open(name, O_RDONLY, 0)) < 0) return(-1);
- /* Force reload */
- acl_cache[i].acl = (struct hashtbl *) 0;
-
- got_it:
- /*
- * See if the stat matches
- *
- * Use stat(), not fstat(), as the file may have been re-created by
- * acl_add or acl_delete. If this happens, the old inode will have
- * no changes in the mod-time and the following test will fail.
- */
- if(stat(acl_cache[i].filename, &s) < 0) return(-1);
- if(acl_cache[i].acl == (struct hashtbl *) 0
- || s.st_nlink != acl_cache[i].status.st_nlink
- || s.st_mtime != acl_cache[i].status.st_mtime
- || s.st_ctime != acl_cache[i].status.st_ctime) {
- /* Gotta reload */
- if(acl_cache[i].fd >= 0) close(acl_cache[i].fd);
- if((acl_cache[i].fd = open(name, O_RDONLY, 0)) < 0) return(-1);
- if((f = fdopen(acl_cache[i].fd, "r")) == NULL) return(-1);
- if(acl_cache[i].acl) destroy_hash(acl_cache[i].acl);
- acl_cache[i].acl = make_hash(ACL_LEN);
- while(fgets(buf, sizeof(buf), f) != NULL) {
- nuke_whitespace(buf);
- acl_canonicalize_principal(buf, canon);
- add_hash(acl_cache[i].acl, canon);
- }
- fclose(f);
- acl_cache[i].status = s;
- }
- return(i);
-}
-
-/* Returns nonzero if it can be determined that acl contains principal */
-/* Principal is not canonicalized, and no wildcarding is done */
-int
-acl_exact_match(char *acl, char *principal)
-{
- int idx;
-
- return((idx = acl_load(acl)) >= 0
- && check_hash(acl_cache[idx].acl, principal));
-}
-
-/* Returns nonzero if it can be determined that acl contains principal */
-/* Recognizes wildcards in acl of the form
- name.*@realm, *.*@realm, and *.*@* */
-int
-acl_check(char *acl, char *principal)
-{
- char buf[MAX_PRINCIPAL_SIZE];
- char canon[MAX_PRINCIPAL_SIZE];
- char *realm;
-
- acl_canonicalize_principal(principal, canon);
-
- /* Is it there? */
- if(acl_exact_match(acl, canon)) return(1);
-
- /* Try the wildcards */
- realm = strchr(canon, REALM_SEP);
- *strchr(canon, INST_SEP) = '\0'; /* Chuck the instance */
-
- snprintf(buf, sizeof(buf), "%s.*%s", canon, realm);
- if(acl_exact_match(acl, buf)) return(1);
-
- snprintf(buf, sizeof(buf), "*.*%s", realm);
- if(acl_exact_match(acl, buf) || acl_exact_match(acl, "*.*@*")) return(1);
-
- return(0);
-}
-
-/* Adds principal to acl */
-/* Wildcards are interpreted literally */
-int
-acl_add(char *acl, char *principal)
-{
- int idx;
- int i;
- FILE *new;
- char canon[MAX_PRINCIPAL_SIZE];
-
- acl_canonicalize_principal(principal, canon);
-
- if((new = acl_lock_file(acl)) == NULL) return(-1);
- if((acl_exact_match(acl, canon))
- || (idx = acl_load(acl)) < 0) {
- acl_abort(acl, new);
- return(-1);
- }
- /* It isn't there yet, copy the file and put it in */
- for(i = 0; i < acl_cache[idx].acl->size; i++) {
- if(acl_cache[idx].acl->tbl[i] != NULL) {
- if(fputs(acl_cache[idx].acl->tbl[i], new) == EOF
- || putc('\n', new) != '\n') {
- acl_abort(acl, new);
- return(-1);
- }
- }
- }
- fputs(canon, new);
- putc('\n', new);
- return(acl_commit(acl, new));
-}
-
-/* Removes principal from acl */
-/* Wildcards are interpreted literally */
-int
-acl_delete(char *acl, char *principal)
-{
- int idx;
- int i;
- FILE *new;
- char canon[MAX_PRINCIPAL_SIZE];
-
- acl_canonicalize_principal(principal, canon);
-
- if((new = acl_lock_file(acl)) == NULL) return(-1);
- if((!acl_exact_match(acl, canon))
- || (idx = acl_load(acl)) < 0) {
- acl_abort(acl, new);
- return(-1);
- }
- /* It isn't there yet, copy the file and put it in */
- for(i = 0; i < acl_cache[idx].acl->size; i++) {
- if(acl_cache[idx].acl->tbl[i] != NULL
- && strcmp(acl_cache[idx].acl->tbl[i], canon)) {
- fputs(acl_cache[idx].acl->tbl[i], new);
- putc('\n', new);
- }
- }
- return(acl_commit(acl, new));
-}
-
-#endif /* KERBEROS */
diff --git a/usr.sbin/afs/src/lib/acl/acl_files.doc b/usr.sbin/afs/src/lib/acl/acl_files.doc
deleted file mode 100644
index 78c448a6d69..00000000000
--- a/usr.sbin/afs/src/lib/acl/acl_files.doc
+++ /dev/null
@@ -1,107 +0,0 @@
-PROTOTYPE ACL LIBRARY
-
-Introduction
-
-An access control list (ACL) is a list of principals, where each
-principal is is represented by a text string which cannot contain
-whitespace. The library allows application programs to refer to named
-access control lists to test membership and to atomically add and
-delete principals using a natural and intuitive interface. At
-present, the names of access control lists are required to be Unix
-filenames, and refer to human-readable Unix files; in the future, when
-a networked ACL server is implemented, the names may refer to a
-different namespace specific to the ACL service.
-
-
-Usage
-
-cc <files> -lacl -lkrb.
-
-
-
-Principal Names
-
-Principal names have the form
-
-<name>[.<instance>][@<realm>]
-
-e.g.
-
-asp
-asp.root
-asp@ATHENA.MIT.EDU
-asp.@ATHENA.MIT.EDU
-asp.root@ATHENA.MIT.EDU
-
-It is possible for principals to be underspecified. If instance is
-missing, it is assumed to be "". If realm is missing, it is assumed
-to be local_realm. The canonical form contains all of name, instance,
-and realm; the acl_add and acl_delete routines will always
-leave the file in that form. Note that the canonical form of
-asp@ATHENA.MIT.EDU is actually asp.@ATHENA.MIT.EDU.
-
-
-Routines
-
-acl_canonicalize_principal(principal, buf)
-char *principal;
-char *buf; /*RETVAL*/
-
-Store the canonical form of principal in buf. Buf must contain enough
-space to store a principal, given the limits on the sizes of name,
-instance, and realm specified in /usr/include/krb.h.
-
-acl_check(acl, principal)
-char *acl;
-char *principal;
-
-Returns nonzero if principal appears in acl. Returns 0 if principal
-does not appear in acl, or if an error occurs. Canonicalizes
-principal before checking, and allows the ACL to contain wildcards.
-
-acl_exact_match(acl, principal)
-char *acl;
-char *principal;
-
-Like acl_check, but does no canonicalization or wildcarding.
-
-acl_add(acl, principal)
-char *acl;
-char *principal;
-
-Atomically adds principal to acl. Returns 0 if successful, nonzero
-otherwise. It is considered a failure if principal is already in acl.
-This routine will canonicalize principal, but will treat wildcards
-literally.
-
-acl_delete(acl, principal)
-char *acl;
-char *principal;
-
-Atomically deletes principal from acl. Returns 0 if successful,
-nonzero otherwise. It is consider a failure if principal is not
-already in acl. This routine will canonicalize principal, but will
-treat wildcards literally.
-
-acl_initialize(acl, mode)
-char *acl;
-int mode;
-
-Initialize acl. If acl file does not exist, creates it with mode
-mode. If acl exists, removes all members. Returns 0 if successful,
-nonzero otherwise. WARNING: Mode argument is likely to change with
-the eventual introduction of an ACL service.
-
-
-Known problems
-
-In the presence of concurrency, there is a very small chance that
-acl_add or acl_delete could report success even though it would have
-had no effect. This is a necessary side effect of using lock files
-for concurrency control rather than flock(2), which is not supported
-by NFS.
-
-The current implementation caches ACLs in memory in a hash-table
-format for increased efficiency in checking membership; one effect of
-the caching scheme is that one file descriptor will be kept open for
-each ACL cached, up to a maximum of 8.
diff --git a/usr.sbin/afs/src/lib/editline/ChangeLog b/usr.sbin/afs/src/lib/editline/ChangeLog
deleted file mode 100644
index 8c8878736b6..00000000000
--- a/usr.sbin/afs/src/lib/editline/ChangeLog
+++ /dev/null
@@ -1,97 +0,0 @@
-2001-05-26 Mattias Amnefelt <mattiasa@e.kth.se>
-
- * Makefile.in: use correct makefile syntax
-
-2000-03-01 Assar Westerlund <assar@sics.se>
-
- * edit_compat.c (readline): be more liberal in what we accept from
- el_gets. if count == 0 -> interpret it as EOF. also copy the
- string first and then cut of the newline, it's cleaner
-
-1999-12-23 Assar Westerlund <assar@sics.se>
-
- * editline.c (TTYinfo): add fallback if we fail to find "le" in
- termcap.
-
-1999-08-06 Assar Westerlund <assar@sics.se>
-
- * editline.c (TTYinfo): copy backspace string to avoid referencing
- into a local variable.
-
-1999-08-04 Assar Westerlund <assar@sics.se>
-
- * Makefile.am: don't run testit in `make check'
-
-1999-04-11 Assar Westerlund <assar@sics.se>
-
- * Makefile.am: don't run testit as a check
-
-Sat Apr 10 23:01:18 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * complete.c (rl_complete_filename): return if there were no
- matches
-
-Thu Apr 8 15:08:25 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * Makefile.in: snprintf
-
- * roken_rename.h: add snprintf, asprintf
-
- * Makefile.am: build testit
-
- * complete.c: nuke NEW, DISPOSE, RENEW, and COPYFROMTO macros;
- (rl_complete): call rl_list_possib instead of doing the same
-
- * editline.h: nuke NEW, DISPOSE, RENEW, and COPYFROMTO macros
-
- * editline.c: nuke NEW, DISPOSE, RENEW, and COPYFROMTO macros
-
- * sysunix.c: add some whitespace
-
-Thu Mar 18 11:22:55 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * Makefile.am: include Makefile.am.common
-
-Tue Mar 16 17:10:34 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * editline.c: remove protos for read/write
-
-Sat Mar 13 22:23:22 1999 Assar Westerlund <assar@sics.se>
-
- * <roken.h>: add
-
-Sun Nov 22 10:40:28 1998 Assar Westerlund <assar@sics.se>
-
- * Makefile.in (WFLAGS): set
-
-Tue Sep 29 02:09:15 1998 Assar Westerlund <assar@sics.se>
-
- * Makefile.in (LIB_DEPS): add LIB_tgetent
-
-Thu Jul 2 15:10:08 1998 Johan Danielsson <joda@blubb.pdc.kth.se>
-
- * edit_compat.c: support for newer libedit
-
-Tue Jun 30 17:18:09 1998 Assar Westerlund <assar@sics.se>
-
- * Makefile.in (distclean): don't remove roken_rename.h
-
-Fri May 29 19:03:38 1998 Assar Westerlund <assar@sics.se>
-
- * Makefile.in (strdup.c): remove dependency
-
-Mon May 25 05:25:16 1998 Assar Westerlund <assar@sics.se>
-
- * Makefile.in (clean): try to remove shared library debris
-
-Sun Apr 19 09:53:46 1998 Assar Westerlund <assar@sics.se>
-
- * Makefile.in: add symlink magic for linux
-
-Sat Feb 7 07:24:30 1998 Assar Westerlund <assar@sics.se>
-
- * editline.h: add prototypes
-
-Tue Feb 3 10:24:22 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * editline.c: If read returns EINTR, try again.
diff --git a/usr.sbin/afs/src/lib/editline/Makefile.in b/usr.sbin/afs/src/lib/editline/Makefile.in
deleted file mode 100644
index dc4428dd027..00000000000
--- a/usr.sbin/afs/src/lib/editline/Makefile.in
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# $KTH: Makefile.in,v 1.8.2.1 2001/05/28 11:35:50 mattiasa Exp $
-#
-
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-top_builddir = ../..
-VPATH = @srcdir@
-
-CC = @CC@
-AR = ar
-RANLIB = @RANLIB@
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@
-
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-libdir = @libdir@
-
-#PICFLAGS = @PICFLAGS@
-
-LIBNAME = $(LIBPREFIX)editline
-#LIBEXT = @LIBEXT@
-LIBEXT = a
-#SHLIBEXT = @SHLIBEXT@
-#LIBPREFIX = @LIBPREFIX@
-LIBPREFIX = lib
-#LDSHARED = @LDSHARED@
-LIB = $(LIBNAME).$(LIBEXT)
-
-SOURCES = edit_compat.c editline.c complete.c sysunix.c
-
-OBJECTS = @editline_OBJS@
-
-all: $(LIB)
-
-Wall:
- make CFLAGS="-g -Wall -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
-
-.c.o:
- $(CC) -c $(CPPFLAGS) $(DEFS) @INC_roken@ -I../../include -I$(srcdir) $(CFLAGS) $(PICFLAGS) $<
-
-install: all
- $(MKINSTALLDIRS) $(DESTDIR)$(libdir); \
- $(INSTALL_DATA) $(LIB) $(DESTDIR)$(libdir)/$(LIB);
-
-uninstall:
- rm -f $(DESTDIR)$(libdir)/$(LIB)
-
-TAGS: $(SOURCES)
- etags $(SOURCES)
-
-check:
-
-clean:
- rm -f $(LIB) *.o *.a
-
-mostlyclean: clean
-
-distclean: clean
- rm -f Makefile *.tab.c *~
-
-realclean: distclean
- rm -f TAGS
-
-dist: $(DISTFILES)
- for file in $(DISTFILES); do \
- ln $$file ../`cat ../.fname`/lib \
- || cp -p $$file ../`cat ../.fname`/lib; \
- done
-
-$(LIBNAME).a: $(OBJECTS)
- rm -f $@
- $(AR) cr $@ $(OBJECTS)
- -$(RANLIB) $@
-
-
-#$(LIBNAME).$(SHLIBEXT): $(OBJECTS)
-# rm -f $@
-# $(LDSHARED) -o $@ $(OBJECTS)
-
-$(OBJECTS): ../../include/config.h
diff --git a/usr.sbin/afs/src/lib/editline/README b/usr.sbin/afs/src/lib/editline/README
deleted file mode 100644
index f5b0693a336..00000000000
--- a/usr.sbin/afs/src/lib/editline/README
+++ /dev/null
@@ -1,45 +0,0 @@
-$arla: 1.2 $
-
-This is a line-editing library. It can be linked into almost any
-program to provide command-line editing and recall.
-
-It is call-compatible with the FSF readline library, but it is a
-fraction of the size (and offers fewer features). It does not use
-standard I/O. It is distributed under a "C News-like" copyright.
-
-Configuration is done in the Makefile. Type "make testit" to get
-a small slow shell for testing.
-
-An earlier version was distributed with Byron's rc. Principal
-changes over that version include:
- Faster.
- Is eight-bit clean (thanks to brendan@cs.widener.edu)
- Written in K&R C, but ANSI compliant (gcc all warnings)
- Propagates EOF properly; rc trip test now passes
- Doesn't need or use or provide memmove.
- More robust
- Calling sequence changed to be compatible with readline.
- Test program, new manpage, better configuration
- More system-independant; includes Unix and OS-9 support.
-
-Enjoy,
- Rich $alz
- <rsalz@osf.org>
-
- Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
-
- This software is not subject to any license of the American Telephone
- and Telegraph Company or of the Regents of the University of California.
-
- Permission is granted to anyone to use this software for any purpose on
- any computer system, and to alter it and redistribute it freely, subject
- to the following restrictions:
- 1. The authors are not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
- 2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits must appear in the documentation.
- 3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits must appear in the documentation.
- 4. This notice may not be removed or altered.
diff --git a/usr.sbin/afs/src/lib/editline/complete.c b/usr.sbin/afs/src/lib/editline/complete.c
deleted file mode 100644
index 59d45ab241d..00000000000
--- a/usr.sbin/afs/src/lib/editline/complete.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
- *
- * This software is not subject to any license of the American Telephone
- * and Telegraph Company or of the Regents of the University of California.
- *
- * Permission is granted to anyone to use this software for any purpose on
- * any computer system, and to alter it and redistribute it freely, subject
- * to the following restrictions:
- * 1. The authors are not responsible for the consequences of use of this
- * software, no matter how awful, even if they arise from flaws in it.
- * 2. The origin of this software must not be misrepresented, either by
- * explicit claim or by omission. Since few users ever read sources,
- * credits must appear in the documentation.
- * 3. Altered versions must be plainly marked as such, and must not be
- * misrepresented as being the original software. Since few users
- * ever read sources, credits must appear in the documentation.
- * 4. This notice may not be removed or altered.
- */
-
-/*
-** History and file completion functions for editline library.
-*/
-#include <config.h>
-#include "editline.h"
-
-RCSID("$arla: complete.c,v 1.2 2000/03/01 21:40:39 assar Exp $");
-
-/*
-** strcmp-like sorting predicate for qsort.
-*/
-static int
-compare(const void *p1, const void *p2)
-{
- const char **v1;
- const char **v2;
-
- v1 = (const char **)p1;
- v2 = (const char **)p2;
- return strcmp(*v1, *v2);
-}
-
-/*
-** Fill in *avp with an array of names that match file, up to its length.
-** Ignore . and .. .
-*/
-static int
-FindMatches(char *dir, char *file, char ***avp)
-{
- char **av;
- char **new;
- char *p;
- DIR *dp;
- DIRENTRY *ep;
- size_t ac;
- size_t len;
-
- if ((dp = opendir(dir)) == NULL)
- return 0;
-
- av = NULL;
- ac = 0;
- len = strlen(file);
- while ((ep = readdir(dp)) != NULL) {
- p = ep->d_name;
- if (p[0] == '.' && (p[1] == '\0' || (p[1] == '.' && p[2] == '\0')))
- continue;
- if (len && strncmp(p, file, len) != 0)
- continue;
-
- if ((ac % MEM_INC) == 0) {
- if ((new = malloc(sizeof(char*) * (ac + MEM_INC))) == NULL)
- break;
- if (ac) {
- memcpy(new, av, ac * sizeof (char **));
- free(av);
- }
- *avp = av = new;
- }
-
- if ((av[ac] = strdup(p)) == NULL) {
- if (ac == 0)
- free(av);
- break;
- }
- ac++;
- }
-
- /* Clean up and return. */
- (void)closedir(dp);
- if (ac)
- qsort(av, ac, sizeof (char **), compare);
- return ac;
-}
-
-/*
-** Split a pathname into allocated directory and trailing filename parts.
-*/
-static int SplitPath(char *path, char **dirpart, char **filepart)
-{
- static char DOT[] = ".";
- char *dpart;
- char *fpart;
-
- if ((fpart = strrchr(path, '/')) == NULL) {
- if ((dpart = strdup(DOT)) == NULL)
- return -1;
- if ((fpart = strdup(path)) == NULL) {
- free(dpart);
- return -1;
- }
- }
- else {
- if ((dpart = strdup(path)) == NULL)
- return -1;
- dpart[fpart - path] = '\0';
- if ((fpart = strdup(++fpart)) == NULL) {
- free(dpart);
- return -1;
- }
- }
- *dirpart = dpart;
- *filepart = fpart;
- return 0;
-}
-
-/*
-** Attempt to complete the pathname, returning an allocated copy.
-** Fill in *unique if we completed it, or set it to 0 if ambiguous.
-*/
-
-static char *
-rl_complete_filename(char *pathname, int *unique)
-{
- char **av;
- char *new;
- char *p;
- size_t ac;
- size_t end;
- size_t i;
- size_t j;
- size_t len;
- char *s;
-
- ac = rl_list_possib(pathname, &av);
- if(ac == 0)
- return NULL;
-
- s = strrchr(pathname, '/');
- if(s == NULL)
- len = strlen(pathname);
- else
- len = strlen(s + 1);
-
- p = NULL;
- if (ac == 1) {
- /* Exactly one match -- finish it off. */
- *unique = 1;
- j = strlen(av[0]) - len + 2;
- if ((p = malloc(j + 1)) != NULL) {
- memcpy(p, av[0] + len, j);
- asprintf(&new, "%s%s", pathname, p);
- if(new != NULL) {
- rl_add_slash(new, p);
- free(new);
- }
- }
- }
- else {
- *unique = 0;
- if (len) {
- /* Find largest matching substring. */
- for (i = len, end = strlen(av[0]); i < end; i++)
- for (j = 1; j < ac; j++)
- if (av[0][i] != av[j][i])
- goto breakout;
- breakout:
- if (i > len) {
- j = i - len + 1;
- if ((p = malloc(j)) != NULL) {
- memcpy(p, av[0] + len, j);
- p[j - 1] = '\0';
- }
- }
- }
- }
-
- /* Clean up and return. */
- for (i = 0; i < ac; i++)
- free(av[i]);
- free(av);
- return p;
-}
-
-static rl_complete_func_t complete_func = rl_complete_filename;
-
-char *
-rl_complete(char *pathname, int *unique)
-{
- return (*complete_func)(pathname, unique);
-}
-
-rl_complete_func_t
-rl_set_complete_func(rl_complete_func_t func)
-{
- rl_complete_func_t old = complete_func;
- complete_func = func;
- return old;
-}
-
-
-/*
-** Return all possible completions.
-*/
-static int
-rl_list_possib_filename(char *pathname, char ***avp)
-{
- char *dir;
- char *file;
- int ac;
-
- if (SplitPath(pathname, &dir, &file) < 0)
- return 0;
- ac = FindMatches(dir, file, avp);
- free(dir);
- free(file);
- return ac;
-}
-
-static rl_list_possib_func_t list_possib_func = rl_list_possib_filename;
-
-int
-rl_list_possib(char *pathname, char ***avp)
-{
- return (*list_possib_func)(pathname, avp);
-}
-
-rl_list_possib_func_t
-rl_set_list_possib_func(rl_list_possib_func_t func)
-{
- rl_list_possib_func_t old = list_possib_func;
- list_possib_func = func;
- return old;
-}
diff --git a/usr.sbin/afs/src/lib/editline/edit_compat.c b/usr.sbin/afs/src/lib/editline/edit_compat.c
deleted file mode 100644
index 6f4c37bf213..00000000000
--- a/usr.sbin/afs/src/lib/editline/edit_compat.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 1995 - 2000 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 <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <histedit.h>
-
-RCSID("$arla: edit_compat.c,v 1.3 2000/03/01 21:40:39 assar Exp $");
-
-void
-rl_reset_terminal(char *p)
-{
-}
-
-void
-rl_initialize()
-{
-}
-
-static const char *pr;
-static const char* ret_prompt(EditLine *e)
-{
- return pr;
-}
-
-static History *h;
-
-#ifdef H_SETSIZE
-#define EL_INIT_FOUR 1
-#else
-#ifdef H_SETMAXSIZE
-/* backwards compatibility */
-#define H_SETSIZE H_SETMAXSIZE
-#endif
-#endif
-
-char *
-readline(const char* prompt)
-{
- static EditLine *e;
-#ifdef H_SETSIZE
- HistEvent ev;
-#endif
- int count;
- const char *str;
-
- if(e == NULL){
-#ifdef EL_INIT_FOUR
- e = el_init("", stdin, stdout, stderr);
-#else
- e = el_init("", stdin, stdout);
-#endif
- el_set(e, EL_PROMPT, ret_prompt);
- h = history_init();
-#ifdef H_SETSIZE
- history(h, &ev, H_SETSIZE, 25);
-#else
- history(h, H_EVENT, 25);
-#endif
- el_set(e, EL_HIST, history, h);
- el_set(e, EL_EDITOR, "emacs"); /* XXX? */
- }
- pr = prompt ? prompt : "";
- str = el_gets(e, &count);
- if (str && count > 0) {
- char *ret = strdup (str);
-
- if (ret == NULL)
- return NULL;
-
- if (ret[strlen(ret) - 1] == '\n')
- ret[strlen(ret) - 1] = '\0';
- return ret;
- }
- return NULL;
-}
-
-void
-add_history(char *p)
-{
-#ifdef H_SETSIZE
- HistEvent ev;
- history(h, &ev, H_ENTER, p);
-#else
- history(h, H_ENTER, p);
-#endif
-}
diff --git a/usr.sbin/afs/src/lib/editline/editline.3 b/usr.sbin/afs/src/lib/editline/editline.3
deleted file mode 100644
index cdbf7a786c3..00000000000
--- a/usr.sbin/afs/src/lib/editline/editline.3
+++ /dev/null
@@ -1,175 +0,0 @@
-.\" $arla: 1.2 $
-.TH EDITLINE 3
-.SH NAME
-editline \- command-line editing library with history
-.SH SYNOPSIS
-.nf
-.B "char *"
-.B "readline(prompt)"
-.B " char *prompt;"
-
-.B "void"
-.B "add_history(line)"
-.B " char *line;"
-.fi
-.SH DESCRIPTION
-.I Editline
-is a library that provides an line-editing interface with text recall.
-It is intended to be compatible with the
-.I readline
-library provided by the Free Software Foundation, but much smaller.
-The bulk of this manual page describes the user interface.
-.PP
-The
-.I readline
-routine returns a line of text with the trailing newline removed.
-The data is returned in a buffer allocated with
-.IR malloc (3),
-so the space should be released with
-.IR free (3)
-when the calling program is done with it.
-Before accepting input from the user, the specified
-.I prompt
-is displayed on the terminal.
-.PP
-The
-.I add_history
-routine makes a copy of the specified
-.I line
-and adds it to the internal history list.
-.SS "User Interface"
-A program that uses this library provides a simple emacs-like editing
-interface to its users.
-A line may be edited before it is sent to the calling program by typing either
-control characters or escape sequences.
-A control character, shown as a caret followed by a letter, is typed by
-holding down the ``control'' key while the letter is typed.
-For example, ``^A'' is a control-A.
-An escape sequence is entered by typing the ``escape'' key followed by one or
-more characters.
-The escape key is abbreviated as ``ESC.''
-Note that unlike control keys, case matters in escape sequences; ``ESC\ F''
-is not the same as ``ESC\ f''.
-.PP
-An editing command may be typed anywhere on the line, not just at the
-beginning.
-In addition, a return may also be typed anywhere on the line, not just at
-the end.
-.PP
-Most editing commands may be given a repeat count,
-.IR n ,
-where
-.I n
-is a number.
-To enter a repeat count, type the escape key, the number, and then
-the command to execute.
-For example, ``ESC\ 4\ ^f'' moves forward four characters.
-If a command may be given a repeat count then the text ``[n]'' is given at the
-end of its description.
-.PP
-The following control characters are accepted:
-.RS
-.nf
-.ta \w'ESC DEL 'u
-^A Move to the beginning of the line
-^B Move left (backwards) [n]
-^D Delete character [n]
-^E Move to end of line
-^F Move right (forwards) [n]
-^G Ring the bell
-^H Delete character before cursor (backspace key) [n]
-^I Complete filename (tab key); see below
-^J Done with line (return key)
-^K Kill to end of line (or column [n])
-^L Redisplay line
-^M Done with line (alternate return key)
-^N Get next line from history [n]
-^P Get previous line from history [n]
-^R Search backward (forward if [n]) through history for text;
-\& must start line if text begins with an uparrow
-^T Transpose characters
-^V Insert next character, even if it is an edit command
-^W Wipe to the mark
-^X^X Exchange current location and mark
-^Y Yank back last killed text
-^[ Start an escape sequence (escape key)
-^]c Move forward to next character ``c''
-^? Delete character before cursor (delete key) [n]
-.fi
-.RE
-.PP
-The following escape sequences are provided.
-.RS
-.nf
-.ta \w'ESC DEL 'u
-ESC\ ^H Delete previous word (backspace key) [n]
-ESC\ DEL Delete previous word (delete key) [n]
-ESC\ SP Set the mark (space key); see ^X^X and ^Y above
-ESC\ \. Get the last (or [n]'th) word from previous line
-ESC\ ? Show possible completions; see below
-ESC\ < Move to start of history
-ESC\ > Move to end of history
-ESC\ b Move backward a word [n]
-ESC\ d Delete word under cursor [n]
-ESC\ f Move forward a word [n]
-ESC\ l Make word lowercase [n]
-ESC\ u Make word uppercase [n]
-ESC\ y Yank back last killed text
-ESC\ v Show library version
-ESC\ w Make area up to mark yankable
-ESC\ nn Set repeat count to the number nn
-ESC\ C Read from environment variable ``_C_'', where C is
-\& an uppercase letter
-.fi
-.RE
-.PP
-The
-.I editline
-library has a small macro facility.
-If you type the escape key followed by an uppercase letter,
-.IR C ,
-then the contents of the environment variable
-.I _C_
-are read in as if you had typed them at the keyboard.
-For example, if the variable
-.I _L_
-contains the following:
-.RS
-^A^Kecho '^V^[[H^V^[[2J'^M
-.RE
-Then typing ``ESC L'' will move to the beginning of the line, kill the
-entire line, enter the echo command needed to clear the terminal (if your
-terminal is like a VT-100), and send the line back to the shell.
-.PP
-The
-.I editline
-library also does filename completion.
-Suppose the root directory has the following files in it:
-.RS
-.nf
-.ta \w'core 'u
-bin vmunix
-core vmunix.old
-.fi
-.RE
-If you type ``rm\ /v'' and then the tab key.
-.I Editline
-will then finish off as much of the name as possible by adding ``munix''.
-Because the name is not unique, it will then beep.
-If you type the escape key and a question mark, it will display the
-two choices.
-If you then type a period and a tab, the library will finish off the filename
-for you:
-.RS
-.nf
-.RI "rm /v[TAB]" munix .TAB old
-.fi
-.RE
-The tab key is shown by ``[TAB]'' and the automatically-entered text
-is shown in italics.
-.SH "BUGS AND LIMITATIONS"
-Cannot handle lines more than 80 columns.
-.SH AUTHORS
-Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy>
-and Rich $alz <rsalz@osf.org>.
-Original manual page by DaviD W. Sanderson <dws@ssec.wisc.edu>.
diff --git a/usr.sbin/afs/src/lib/editline/editline.c b/usr.sbin/afs/src/lib/editline/editline.c
deleted file mode 100644
index 33f31dd7a11..00000000000
--- a/usr.sbin/afs/src/lib/editline/editline.c
+++ /dev/null
@@ -1,1376 +0,0 @@
-/* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
- *
- * This software is not subject to any license of the American Telephone
- * and Telegraph Company or of the Regents of the University of California.
- *
- * Permission is granted to anyone to use this software for any purpose on
- * any computer system, and to alter it and redistribute it freely, subject
- * to the following restrictions:
- * 1. The authors are not responsible for the consequences of use of this
- * software, no matter how awful, even if they arise from flaws in it.
- * 2. The origin of this software must not be misrepresented, either by
- * explicit claim or by omission. Since few users ever read sources,
- * credits must appear in the documentation.
- * 3. Altered versions must be plainly marked as such, and must not be
- * misrepresented as being the original software. Since few users
- * ever read sources, credits must appear in the documentation.
- * 4. This notice may not be removed or altered.
- */
-
-/*
-** Main editing routines for editline library.
-*/
-#include <config.h>
-#include "editline.h"
-#include <ctype.h>
-#include <errno.h>
-
-RCSID("$arla: editline.c,v 1.3 2001/10/21 22:31:34 assar Exp $");
-
-/*
-** Manifest constants.
-*/
-#define SCREEN_WIDTH 80
-#define SCREEN_ROWS 24
-#define NO_ARG (-1)
-#define DEL 127
-#define CTL(x) ((x) & 0x1F)
-#define ISCTL(x) ((x) && (x) < ' ')
-#define UNCTL(x) ((x) + 64)
-#define META(x) ((x) | 0x80)
-#define ISMETA(x) ((x) & 0x80)
-#define UNMETA(x) ((x) & 0x7F)
-#if !defined(HIST_SIZE)
-#define HIST_SIZE 20
-#endif /* !defined(HIST_SIZE) */
-
-/*
-** Command status codes.
-*/
-typedef enum _el_STATUS {
- CSdone, CSeof, CSmove, CSdispatch, CSstay
-} el_STATUS;
-
-/*
-** The type of case-changing to perform.
-*/
-typedef enum _CASE {
- TOupper, TOlower
-} CASE;
-
-/*
-** Key to command mapping.
-*/
-typedef struct _KEYMAP {
- unsigned char Key;
- el_STATUS (*Function)();
-} KEYMAP;
-
-/*
-** Command history structure.
-*/
-typedef struct _HISTORY {
- int Size;
- int Pos;
- unsigned char *Lines[HIST_SIZE];
-} HISTORY;
-
-/*
-** Globals.
-*/
-int rl_eof;
-int rl_erase;
-int rl_intr;
-int rl_kill;
-
-static unsigned char NIL[] = "";
-static const unsigned char *Input = NIL;
-static unsigned char *Line;
-static const char *Prompt;
-static unsigned char *Yanked;
-static char *Screen;
-static char NEWLINE[]= CRLF;
-static HISTORY H;
-int rl_quit;
-static int Repeat;
-static int End;
-static int Mark;
-static int OldPoint;
-static int Point;
-static int PushBack;
-static int Pushed;
-static KEYMAP Map[33];
-static KEYMAP MetaMap[16];
-static size_t Length;
-static size_t ScreenCount;
-static size_t ScreenSize;
-static char *backspace;
-static int TTYwidth;
-static int TTYrows;
-
-/* Display print 8-bit chars as `M-x' or as the actual 8-bit char? */
-int rl_meta_chars = 1;
-
-/*
-** Declarations.
-*/
-static unsigned char *editinput(void);
-char *tgetstr(const char*, char**);
-int tgetent(char*, const char*);
-int tgetnum(const char*);
-
-/*
-** TTY input/output functions.
-*/
-
-static void
-TTYflush()
-{
- if (ScreenCount) {
- write(1, Screen, ScreenCount);
- ScreenCount = 0;
- }
-}
-
-static void
-TTYput(unsigned char c)
-{
- Screen[ScreenCount] = c;
- if (++ScreenCount >= ScreenSize - 1) {
- ScreenSize += SCREEN_INC;
- Screen = realloc(Screen, ScreenSize);
- }
-}
-
-static void
-TTYputs(const char *p)
-{
- while (*p)
- TTYput(*p++);
-}
-
-static void
-TTYshow(unsigned char c)
-{
- if (c == DEL) {
- TTYput('^');
- TTYput('?');
- }
- else if (ISCTL(c)) {
- TTYput('^');
- TTYput(UNCTL(c));
- }
- else if (rl_meta_chars && ISMETA(c)) {
- TTYput('M');
- TTYput('-');
- TTYput(UNMETA(c));
- }
- else
- TTYput(c);
-}
-
-static void
-TTYstring(unsigned char *p)
-{
- while (*p)
- TTYshow(*p++);
-}
-
-static int
-TTYget()
-{
- char c;
- int e;
-
- TTYflush();
- if (Pushed) {
- Pushed = 0;
- return PushBack;
- }
- if (*Input)
- return *Input++;
- do {
- e = read(0, &c, 1);
- } while(e < 0 && errno == EINTR);
- if(e == 1)
- return c;
- return EOF;
-}
-
-static void
-TTYback(void)
-{
- if (backspace)
- TTYputs(backspace);
- else
- TTYput('\b');
-}
-
-static void
-TTYbackn(int n)
-{
- while (--n >= 0)
- TTYback();
-}
-
-static void
-TTYinfo()
-{
- static int init;
- char *term;
- char buff[2048];
- char *bp;
- char *tmp;
-#if defined(TIOCGWINSZ)
- struct winsize W;
-#endif /* defined(TIOCGWINSZ) */
-
- if (init) {
-#if defined(TIOCGWINSZ)
- /* Perhaps we got resized. */
- if (ioctl(0, TIOCGWINSZ, &W) >= 0
- && W.ws_col > 0 && W.ws_row > 0) {
- TTYwidth = (int)W.ws_col;
- TTYrows = (int)W.ws_row;
- }
-#endif /* defined(TIOCGWINSZ) */
- return;
- }
- init++;
-
- TTYwidth = TTYrows = 0;
- bp = &buff[0];
- if ((term = getenv("TERM")) == NULL)
- term = "dumb";
- if (tgetent(buff, term) < 0) {
- TTYwidth = SCREEN_WIDTH;
- TTYrows = SCREEN_ROWS;
- return;
- }
- tmp = tgetstr("le", &bp);
- if (tmp != NULL)
- backspace = strdup(tmp);
- else
- backspace = "\b";
- TTYwidth = tgetnum("co");
- TTYrows = tgetnum("li");
-
-#if defined(TIOCGWINSZ)
- if (ioctl(0, TIOCGWINSZ, &W) >= 0) {
- TTYwidth = (int)W.ws_col;
- TTYrows = (int)W.ws_row;
- }
-#endif /* defined(TIOCGWINSZ) */
-
- if (TTYwidth <= 0 || TTYrows <= 0) {
- TTYwidth = SCREEN_WIDTH;
- TTYrows = SCREEN_ROWS;
- }
-}
-
-
-/*
-** Print an array of words in columns.
-*/
-static void
-columns(int ac, unsigned char **av)
-{
- unsigned char *p;
- int i;
- int j;
- int k;
- int len;
- int skip;
- int longest;
- int cols;
-
- /* Find longest name, determine column count from that. */
- for (longest = 0, i = 0; i < ac; i++)
- if ((j = strlen((char *)av[i])) > longest)
- longest = j;
- cols = TTYwidth / (longest + 3);
-
- TTYputs(NEWLINE);
- for (skip = ac / cols + 1, i = 0; i < skip; i++) {
- for (j = i; j < ac; j += skip) {
- for (p = av[j], len = strlen((char *)p), k = len; --k >= 0; p++)
- TTYput(*p);
- if (j + skip < ac)
- while (++len < longest + 3)
- TTYput(' ');
- }
- TTYputs(NEWLINE);
- }
-}
-
-static void
-reposition()
-{
- int i;
- unsigned char *p;
-
- TTYput('\r');
- TTYputs(Prompt);
- for (i = Point, p = Line; --i >= 0; p++)
- TTYshow(*p);
-}
-
-static void
-left(el_STATUS Change)
-{
- TTYback();
- if (Point) {
- if (ISCTL(Line[Point - 1]))
- TTYback();
- else if (rl_meta_chars && ISMETA(Line[Point - 1])) {
- TTYback();
- TTYback();
- }
- }
- if (Change == CSmove)
- Point--;
-}
-
-static void
-right(el_STATUS Change)
-{
- TTYshow(Line[Point]);
- if (Change == CSmove)
- Point++;
-}
-
-static el_STATUS
-ring_bell()
-{
- TTYput('\07');
- TTYflush();
- return CSstay;
-}
-
-static el_STATUS
-do_macro(unsigned char c)
-{
- unsigned char name[4];
-
- name[0] = '_';
- name[1] = c;
- name[2] = '_';
- name[3] = '\0';
-
- if ((Input = (unsigned char *)getenv((char *)name)) == NULL) {
- Input = NIL;
- return ring_bell();
- }
- return CSstay;
-}
-
-static el_STATUS
-do_forward(el_STATUS move)
-{
- int i;
- unsigned char *p;
-
- i = 0;
- do {
- p = &Line[Point];
- for ( ; Point < End && (*p == ' ' || !isalnum(*p)); Point++, p++)
- if (move == CSmove)
- right(CSstay);
-
- for (; Point < End && isalnum(*p); Point++, p++)
- if (move == CSmove)
- right(CSstay);
-
- if (Point == End)
- break;
- } while (++i < Repeat);
-
- return CSstay;
-}
-
-static el_STATUS
-do_case(CASE type)
-{
- int i;
- int end;
- int count;
- unsigned char *p;
-
- do_forward(CSstay);
- if (OldPoint != Point) {
- if ((count = Point - OldPoint) < 0)
- count = -count;
- Point = OldPoint;
- if ((end = Point + count) > End)
- end = End;
- for (i = Point, p = &Line[i]; i < end; i++, p++) {
- if (type == TOupper) {
- if (islower(*p))
- *p = toupper(*p);
- }
- else if (isupper(*p))
- *p = tolower(*p);
- right(CSmove);
- }
- }
- return CSstay;
-}
-
-static el_STATUS
-case_down_word()
-{
- return do_case(TOlower);
-}
-
-static el_STATUS
-case_up_word()
-{
- return do_case(TOupper);
-}
-
-static void
-ceol()
-{
- int extras;
- int i;
- unsigned char *p;
-
- for (extras = 0, i = Point, p = &Line[i]; i <= End; i++, p++) {
- TTYput(' ');
- if (ISCTL(*p)) {
- TTYput(' ');
- extras++;
- }
- else if (rl_meta_chars && ISMETA(*p)) {
- TTYput(' ');
- TTYput(' ');
- extras += 2;
- }
- }
-
- for (i += extras; i > Point; i--)
- TTYback();
-}
-
-static void
-clear_line()
-{
- Point = -strlen(Prompt);
- TTYput('\r');
- ceol();
- Point = 0;
- End = 0;
- Line[0] = '\0';
-}
-
-static el_STATUS
-insert_string(unsigned char *p)
-{
- size_t len;
- int i;
- unsigned char *new;
- unsigned char *q;
-
- len = strlen((char *)p);
- if (End + len >= Length) {
- if ((new = malloc(sizeof(unsigned char) * (Length + len + MEM_INC))) == NULL)
- return CSstay;
- if (Length) {
- memcpy(new, Line, Length);
- free(Line);
- }
- Line = new;
- Length += len + MEM_INC;
- }
-
- for (q = &Line[Point], i = End - Point; --i >= 0; )
- q[len + i] = q[i];
- memcpy(&Line[Point], p, len);
- End += len;
- Line[End] = '\0';
- TTYstring(&Line[Point]);
- Point += len;
-
- return Point == End ? CSstay : CSmove;
-}
-
-
-static unsigned char *
-next_hist()
-{
- return H.Pos >= H.Size - 1 ? NULL : H.Lines[++H.Pos];
-}
-
-static unsigned char *
-prev_hist()
-{
- return H.Pos == 0 ? NULL : H.Lines[--H.Pos];
-}
-
-static el_STATUS
-do_insert_hist(unsigned char *p)
-{
- if (p == NULL)
- return ring_bell();
- Point = 0;
- reposition();
- ceol();
- End = 0;
- return insert_string(p);
-}
-
-static el_STATUS
-do_hist(unsigned char *(*move)())
-{
- unsigned char *p;
- int i;
-
- i = 0;
- do {
- if ((p = (*move)()) == NULL)
- return ring_bell();
- } while (++i < Repeat);
- return do_insert_hist(p);
-}
-
-static el_STATUS
-h_next()
-{
- return do_hist(next_hist);
-}
-
-static el_STATUS
-h_prev()
-{
- return do_hist(prev_hist);
-}
-
-static el_STATUS
-h_first()
-{
- return do_insert_hist(H.Lines[H.Pos = 0]);
-}
-
-static el_STATUS
-h_last()
-{
- return do_insert_hist(H.Lines[H.Pos = H.Size - 1]);
-}
-
-/*
-** Return zero if pat appears as a substring in text.
-*/
-static int
-substrcmp(char *text, char *pat, int len)
-{
- unsigned char c;
-
- if ((c = *pat) == '\0')
- return *text == '\0';
- for ( ; *text; text++)
- if (*text == c && strncmp(text, pat, len) == 0)
- return 0;
- return 1;
-}
-
-static unsigned char *
-search_hist(unsigned char *search, unsigned char *(*move)())
-{
- static unsigned char *old_search;
- int len;
- int pos;
- int (*match)();
- char *pat;
-
- /* Save or get remembered search pattern. */
- if (search && *search) {
- if (old_search)
- free(old_search);
- old_search = (unsigned char *)strdup((char *)search);
- }
- else {
- if (old_search == NULL || *old_search == '\0')
- return NULL;
- search = old_search;
- }
-
- /* Set up pattern-finder. */
- if (*search == '^') {
- match = strncmp;
- pat = (char *)(search + 1);
- }
- else {
- match = substrcmp;
- pat = (char *)search;
- }
- len = strlen(pat);
-
- for (pos = H.Pos; (*move)() != NULL; )
- if ((*match)((char *)H.Lines[H.Pos], pat, len) == 0)
- return H.Lines[H.Pos];
- H.Pos = pos;
- return NULL;
-}
-
-static el_STATUS
-h_search()
-{
- static int Searching;
- const char *old_prompt;
- unsigned char *(*move)();
- unsigned char *p;
-
- if (Searching)
- return ring_bell();
- Searching = 1;
-
- clear_line();
- old_prompt = Prompt;
- Prompt = "Search: ";
- TTYputs(Prompt);
- move = Repeat == NO_ARG ? prev_hist : next_hist;
- p = search_hist(editinput(), move);
- clear_line();
- Prompt = old_prompt;
- TTYputs(Prompt);
-
- Searching = 0;
- return do_insert_hist(p);
-}
-
-static el_STATUS
-fd_char()
-{
- int i;
-
- i = 0;
- do {
- if (Point >= End)
- break;
- right(CSmove);
- } while (++i < Repeat);
- return CSstay;
-}
-
-static void
-save_yank(int begin, int i)
-{
- if (Yanked) {
- free(Yanked);
- Yanked = NULL;
- }
-
- if (i < 1)
- return;
-
- if ((Yanked = malloc(sizeof(unsigned char) * (i + 1))) != NULL) {
- memcpy(Yanked, &Line[begin], i);
- Yanked[i+1] = '\0';
- }
-}
-
-static el_STATUS
-delete_string(int count)
-{
- int i;
- unsigned char *p;
-
- if (count <= 0 || End == Point)
- return ring_bell();
-
- if (count == 1 && Point == End - 1) {
- /* Optimize common case of delete at end of line. */
- End--;
- p = &Line[Point];
- i = 1;
- TTYput(' ');
- if (ISCTL(*p)) {
- i = 2;
- TTYput(' ');
- }
- else if (rl_meta_chars && ISMETA(*p)) {
- i = 3;
- TTYput(' ');
- TTYput(' ');
- }
- TTYbackn(i);
- *p = '\0';
- return CSmove;
- }
- if (Point + count > End && (count = End - Point) <= 0)
- return CSstay;
-
- if (count > 1)
- save_yank(Point, count);
-
- for (p = &Line[Point], i = End - (Point + count) + 1; --i >= 0; p++)
- p[0] = p[count];
- ceol();
- End -= count;
- TTYstring(&Line[Point]);
- return CSmove;
-}
-
-static el_STATUS
-bk_char()
-{
- int i;
-
- i = 0;
- do {
- if (Point == 0)
- break;
- left(CSmove);
- } while (++i < Repeat);
-
- return CSstay;
-}
-
-static el_STATUS
-bk_del_char()
-{
- int i;
-
- i = 0;
- do {
- if (Point == 0)
- break;
- left(CSmove);
- } while (++i < Repeat);
-
- return delete_string(i);
-}
-
-static el_STATUS
-redisplay()
-{
- TTYputs(NEWLINE);
- TTYputs(Prompt);
- TTYstring(Line);
- return CSmove;
-}
-
-static el_STATUS
-kill_line()
-{
- int i;
-
- if (Repeat != NO_ARG) {
- if (Repeat < Point) {
- i = Point;
- Point = Repeat;
- reposition();
- delete_string(i - Point);
- }
- else if (Repeat > Point) {
- right(CSmove);
- delete_string(Repeat - Point - 1);
- }
- return CSmove;
- }
-
- save_yank(Point, End - Point);
- Line[Point] = '\0';
- ceol();
- End = Point;
- return CSstay;
-}
-
-static el_STATUS
-insert_char(int c)
-{
- el_STATUS s;
- unsigned char buff[2];
- unsigned char *p;
- unsigned char *q;
- int i;
-
- if (Repeat == NO_ARG || Repeat < 2) {
- buff[0] = c;
- buff[1] = '\0';
- return insert_string(buff);
- }
-
- if ((p = malloc(Repeat + 1)) == NULL)
- return CSstay;
- for (i = Repeat, q = p; --i >= 0; )
- *q++ = c;
- *q = '\0';
- Repeat = 0;
- s = insert_string(p);
- free(p);
- return s;
-}
-
-static el_STATUS
-meta()
-{
- unsigned int c;
- KEYMAP *kp;
-
- if ((c = TTYget()) == EOF)
- return CSeof;
- /* Also include VT-100 arrows. */
- if (c == '[' || c == 'O')
- switch (c = TTYget()) {
- default: return ring_bell();
- case EOF: return CSeof;
- case 'A': return h_prev();
- case 'B': return h_next();
- case 'C': return fd_char();
- case 'D': return bk_char();
- }
-
- if (isdigit(c)) {
- for (Repeat = c - '0'; (c = TTYget()) != EOF && isdigit(c); )
- Repeat = Repeat * 10 + c - '0';
- Pushed = 1;
- PushBack = c;
- return CSstay;
- }
-
- if (isupper(c))
- return do_macro(c);
- for (OldPoint = Point, kp = MetaMap; kp->Function; kp++)
- if (kp->Key == c)
- return (*kp->Function)();
-
- return ring_bell();
-}
-
-static el_STATUS
-emacs(unsigned int c)
-{
- el_STATUS s;
- KEYMAP *kp;
-
- if (ISMETA(c)) {
- Pushed = 1;
- PushBack = UNMETA(c);
- return meta();
- }
- for (kp = Map; kp->Function; kp++)
- if (kp->Key == c)
- break;
- s = kp->Function ? (*kp->Function)() : insert_char((int)c);
- if (!Pushed)
- /* No pushback means no repeat count; hacky, but true. */
- Repeat = NO_ARG;
- return s;
-}
-
-static el_STATUS
-TTYspecial(unsigned int c)
-{
- if (ISMETA(c))
- return CSdispatch;
-
- if (c == rl_erase || c == DEL)
- return bk_del_char();
- if (c == rl_kill) {
- if (Point != 0) {
- Point = 0;
- reposition();
- }
- Repeat = NO_ARG;
- return kill_line();
- }
- if (c == rl_intr || c == rl_quit) {
- Point = End = 0;
- Line[0] = '\0';
- return redisplay();
- }
- if (c == rl_eof && Point == 0 && End == 0)
- return CSeof;
-
- return CSdispatch;
-}
-
-static unsigned char *
-editinput()
-{
- unsigned int c;
-
- Repeat = NO_ARG;
- OldPoint = Point = Mark = End = 0;
- Line[0] = '\0';
-
- while ((c = TTYget()) != EOF)
- switch (TTYspecial(c)) {
- case CSdone:
- return Line;
- case CSeof:
- return NULL;
- case CSmove:
- reposition();
- break;
- case CSdispatch:
- switch (emacs(c)) {
- case CSdone:
- return Line;
- case CSeof:
- return NULL;
- case CSmove:
- reposition();
- break;
- case CSdispatch:
- case CSstay:
- break;
- }
- break;
- case CSstay:
- break;
- }
- return NULL;
-}
-
-static void
-hist_add(unsigned char *p)
-{
- int i;
-
- if ((p = (unsigned char *)strdup((char *)p)) == NULL)
- return;
- if (H.Size < HIST_SIZE)
- H.Lines[H.Size++] = p;
- else {
- free(H.Lines[0]);
- for (i = 0; i < HIST_SIZE - 1; i++)
- H.Lines[i] = H.Lines[i + 1];
- H.Lines[i] = p;
- }
- H.Pos = H.Size - 1;
-}
-
-/*
-** For compatibility with FSF readline.
-*/
-/* ARGSUSED0 */
-void
-rl_reset_terminal(char *p)
-{
-}
-
-void
-rl_initialize(void)
-{
-}
-
-char *
-readline(const char* prompt)
-{
- unsigned char *line;
-
- if (Line == NULL) {
- Length = MEM_INC;
- if ((Line = malloc(Length)) == NULL)
- return NULL;
- }
-
- TTYinfo();
- rl_ttyset(0);
- hist_add(NIL);
- ScreenSize = SCREEN_INC;
- Screen = malloc(ScreenSize);
- Prompt = prompt ? prompt : (char *)NIL;
- TTYputs(Prompt);
- if ((line = editinput()) != NULL) {
- line = (unsigned char *)strdup((char *)line);
- TTYputs(NEWLINE);
- TTYflush();
- }
- rl_ttyset(1);
- free(Screen);
- free(H.Lines[--H.Size]);
- return (char *)line;
-}
-
-void
-add_history(char *p)
-{
- if (p == NULL || *p == '\0')
- return;
-
-#if defined(UNIQUE_HISTORY)
- if (H.Pos && strcmp(p, H.Lines[H.Pos - 1]) == 0)
- return;
-#endif /* defined(UNIQUE_HISTORY) */
- hist_add((unsigned char *)p);
-}
-
-
-static el_STATUS
-beg_line()
-{
- if (Point) {
- Point = 0;
- return CSmove;
- }
- return CSstay;
-}
-
-static el_STATUS
-del_char()
-{
- return delete_string(Repeat == NO_ARG ? 1 : Repeat);
-}
-
-static el_STATUS
-end_line()
-{
- if (Point != End) {
- Point = End;
- return CSmove;
- }
- return CSstay;
-}
-
-/*
-** Move back to the beginning of the current word and return an
-** allocated copy of it.
-*/
-static unsigned char *
-find_word()
-{
- static char SEPS[] = "#;&|^$=`'{}()<>\n\t ";
- unsigned char *p;
- unsigned char *new;
- size_t len;
-
- for (p = &Line[Point]; p > Line && strchr(SEPS, (char)p[-1]) == NULL; p--)
- continue;
- len = Point - (p - Line) + 1;
- if ((new = malloc(len)) == NULL)
- return NULL;
- memcpy(new, p, len);
- new[len - 1] = '\0';
- return new;
-}
-
-static el_STATUS
-c_complete()
-{
- unsigned char *p;
- unsigned char *word;
- int unique;
- el_STATUS s;
-
- word = find_word();
- p = (unsigned char *)rl_complete((char *)word, &unique);
- if (word)
- free(word);
- if (p && *p) {
- s = insert_string(p);
- if (!unique)
- ring_bell();
- free(p);
- return s;
- }
- return ring_bell();
-}
-
-static el_STATUS
-c_possible()
-{
- unsigned char **av;
- unsigned char *word;
- int ac;
-
- word = find_word();
- ac = rl_list_possib((char *)word, (char ***)&av);
- if (word)
- free(word);
- if (ac) {
- columns(ac, av);
- while (--ac >= 0)
- free(av[ac]);
- free(av);
- return CSmove;
- }
- return ring_bell();
-}
-
-static el_STATUS
-accept_line()
-{
- Line[End] = '\0';
- return CSdone;
-}
-
-static el_STATUS
-transpose()
-{
- unsigned char c;
-
- if (Point) {
- if (Point == End)
- left(CSmove);
- c = Line[Point - 1];
- left(CSstay);
- Line[Point - 1] = Line[Point];
- TTYshow(Line[Point - 1]);
- Line[Point++] = c;
- TTYshow(c);
- }
- return CSstay;
-}
-
-static el_STATUS
-quote()
-{
- unsigned int c;
-
- return (c = TTYget()) == EOF ? CSeof : insert_char((int)c);
-}
-
-static el_STATUS
-wipe()
-{
- int i;
-
- if (Mark > End)
- return ring_bell();
-
- if (Point > Mark) {
- i = Point;
- Point = Mark;
- Mark = i;
- reposition();
- }
-
- return delete_string(Mark - Point);
-}
-
-static el_STATUS
-mk_set()
-{
- Mark = Point;
- return CSstay;
-}
-
-static el_STATUS
-exchange()
-{
- unsigned int c;
-
- if ((c = TTYget()) != CTL('X'))
- return c == EOF ? CSeof : ring_bell();
-
- if ((c = Mark) <= End) {
- Mark = Point;
- Point = c;
- return CSmove;
- }
- return CSstay;
-}
-
-static el_STATUS
-yank()
-{
- if (Yanked && *Yanked)
- return insert_string(Yanked);
- return CSstay;
-}
-
-static el_STATUS
-copy_region()
-{
- if (Mark > End)
- return ring_bell();
-
- if (Point > Mark)
- save_yank(Mark, Point - Mark);
- else
- save_yank(Point, Mark - Point);
-
- return CSstay;
-}
-
-static el_STATUS
-move_to_char()
-{
- unsigned int c;
- int i;
- unsigned char *p;
-
- if ((c = TTYget()) == EOF)
- return CSeof;
- for (i = Point + 1, p = &Line[i]; i < End; i++, p++)
- if (*p == c) {
- Point = i;
- return CSmove;
- }
- return CSstay;
-}
-
-static el_STATUS
-fd_word()
-{
- return do_forward(CSmove);
-}
-
-static el_STATUS
-fd_kill_word()
-{
- int i;
-
- do_forward(CSstay);
- if (OldPoint != Point) {
- i = Point - OldPoint;
- Point = OldPoint;
- return delete_string(i);
- }
- return CSstay;
-}
-
-static el_STATUS
-bk_word()
-{
- int i;
- unsigned char *p;
-
- i = 0;
- do {
- for (p = &Line[Point]; p > Line && !isalnum(p[-1]); p--)
- left(CSmove);
-
- for (; p > Line && p[-1] != ' ' && isalnum(p[-1]); p--)
- left(CSmove);
-
- if (Point == 0)
- break;
- } while (++i < Repeat);
-
- return CSstay;
-}
-
-static el_STATUS
-bk_kill_word()
-{
- bk_word();
- if (OldPoint != Point)
- return delete_string(OldPoint - Point);
- return CSstay;
-}
-
-static int
-argify(unsigned char *line, unsigned char ***avp)
-{
- unsigned char *c;
- unsigned char **p;
- unsigned char **new;
- int ac;
- int i;
-
- i = MEM_INC;
- if ((*avp = p = malloc(sizeof(unsigned char*) * i))== NULL)
- return 0;
-
- for (c = line; isspace(*c); c++)
- continue;
- if (*c == '\n' || *c == '\0')
- return 0;
-
- for (ac = 0, p[ac++] = c; *c && *c != '\n'; ) {
- if (isspace(*c)) {
- *c++ = '\0';
- if (*c && *c != '\n') {
- if (ac + 1 == i) {
- new = malloc(sizeof(unsigned char*) * (i + MEM_INC));
- if (new == NULL) {
- p[ac] = NULL;
- return ac;
- }
- memcpy(new, p, i * sizeof (char **));
- i += MEM_INC;
- free(p);
- *avp = p = new;
- }
- p[ac++] = c;
- }
- }
- else
- c++;
- }
- *c = '\0';
- p[ac] = NULL;
- return ac;
-}
-
-static el_STATUS
-last_argument()
-{
- unsigned char **av;
- unsigned char *p;
- el_STATUS s;
- int ac;
-
- if (H.Size == 1 || (p = H.Lines[H.Size - 2]) == NULL)
- return ring_bell();
-
- if ((p = (unsigned char *)strdup((char *)p)) == NULL)
- return CSstay;
- ac = argify(p, &av);
-
- if (Repeat != NO_ARG)
- s = Repeat < ac ? insert_string(av[Repeat]) : ring_bell();
- else
- s = ac ? insert_string(av[ac - 1]) : CSstay;
-
- if (ac)
- free(av);
- free(p);
- return s;
-}
-
-static KEYMAP Map[33] = {
- { CTL('@'), ring_bell },
- { CTL('A'), beg_line },
- { CTL('B'), bk_char },
- { CTL('D'), del_char },
- { CTL('E'), end_line },
- { CTL('F'), fd_char },
- { CTL('G'), ring_bell },
- { CTL('H'), bk_del_char },
- { CTL('I'), c_complete },
- { CTL('J'), accept_line },
- { CTL('K'), kill_line },
- { CTL('L'), redisplay },
- { CTL('M'), accept_line },
- { CTL('N'), h_next },
- { CTL('O'), ring_bell },
- { CTL('P'), h_prev },
- { CTL('Q'), ring_bell },
- { CTL('R'), h_search },
- { CTL('S'), ring_bell },
- { CTL('T'), transpose },
- { CTL('U'), ring_bell },
- { CTL('V'), quote },
- { CTL('W'), wipe },
- { CTL('X'), exchange },
- { CTL('Y'), yank },
- { CTL('Z'), ring_bell },
- { CTL('['), meta },
- { CTL(']'), move_to_char },
- { CTL('^'), ring_bell },
- { CTL('_'), ring_bell },
- { 0, NULL }
-};
-
-static KEYMAP MetaMap[16]= {
- { CTL('H'), bk_kill_word },
- { DEL, bk_kill_word },
- { ' ', mk_set },
- { '.', last_argument },
- { '<', h_first },
- { '>', h_last },
- { '?', c_possible },
- { 'b', bk_word },
- { 'd', fd_kill_word },
- { 'f', fd_word },
- { 'l', case_down_word },
- { 'u', case_up_word },
- { 'y', yank },
- { 'w', copy_region },
- { 0, NULL }
-};
diff --git a/usr.sbin/afs/src/lib/editline/editline.h b/usr.sbin/afs/src/lib/editline/editline.h
deleted file mode 100644
index 93c0fd4027d..00000000000
--- a/usr.sbin/afs/src/lib/editline/editline.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $arla: 1.2 $
-**
-** Internal header file for editline library.
-*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define CRLF "\r\n"
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-typedef struct dirent DIRENTRY;
-#else
-#include <sys/dir.h>
-typedef struct direct DIRENTRY;
-#endif
-
-#include <roken.h>
-
-#if !defined(S_ISDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif /* !defined(S_ISDIR) */
-
-typedef unsigned char CHAR;
-
-#define MEM_INC 64
-#define SCREEN_INC 256
-
-/*
-** Variables and routines internal to this package.
-*/
-extern int rl_eof;
-extern int rl_erase;
-extern int rl_intr;
-extern int rl_kill;
-extern int rl_quit;
-
-typedef char* (*rl_complete_func_t)(char*, int*);
-
-typedef int (*rl_list_possib_func_t)(char*, char***);
-
-void add_history (char*);
-char* readline (const char* prompt);
-void rl_add_slash (char*, char*);
-char* rl_complete (char*, int*);
-void rl_initialize (void);
-int rl_list_possib (char*, char***);
-void rl_reset_terminal (char*);
-void rl_ttyset (int);
-rl_complete_func_t rl_set_complete_func (rl_complete_func_t);
-rl_list_possib_func_t rl_set_list_possib_func (rl_list_possib_func_t);
-
diff --git a/usr.sbin/afs/src/lib/editline/sysunix.c b/usr.sbin/afs/src/lib/editline/sysunix.c
deleted file mode 100644
index 6dd520f7239..00000000000
--- a/usr.sbin/afs/src/lib/editline/sysunix.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
- *
- * This software is not subject to any license of the American Telephone
- * and Telegraph Company or of the Regents of the University of California.
- *
- * Permission is granted to anyone to use this software for any purpose on
- * any computer system, and to alter it and redistribute it freely, subject
- * to the following restrictions:
- * 1. The authors are not responsible for the consequences of use of this
- * software, no matter how awful, even if they arise from flaws in it.
- * 2. The origin of this software must not be misrepresented, either by
- * explicit claim or by omission. Since few users ever read sources,
- * credits must appear in the documentation.
- * 3. Altered versions must be plainly marked as such, and must not be
- * misrepresented as being the original software. Since few users
- * ever read sources, credits must appear in the documentation.
- * 4. This notice may not be removed or altered.
- */
-
-/*
-** Unix system-dependant routines for editline library.
-*/
-#include <config.h>
-#include "editline.h"
-
-#ifdef HAVE_TERMIOS_H
-#include <termios.h>
-#else
-#include <sgtty.h>
-#endif
-
-RCSID("$arla: sysunix.c,v 1.2 2000/03/01 21:40:41 assar Exp $");
-
-#ifdef HAVE_TERMIOS_H
-
-void
-rl_ttyset(int Reset)
-{
- static struct termios old;
- struct termios new;
-
- if (Reset == 0) {
- tcgetattr(0, &old);
- rl_erase = old.c_cc[VERASE];
- rl_kill = old.c_cc[VKILL];
- rl_eof = old.c_cc[VEOF];
- rl_intr = old.c_cc[VINTR];
- rl_quit = old.c_cc[VQUIT];
-
- new = old;
- new.c_cc[VINTR] = -1;
- new.c_cc[VQUIT] = -1;
- new.c_lflag &= ~(ECHO | ICANON);
- new.c_iflag &= ~(ISTRIP | INPCK);
- new.c_cc[VMIN] = 1;
- new.c_cc[VTIME] = 0;
- tcsetattr(0, TCSANOW, &new);
- }
- else
- tcsetattr(0, TCSANOW, &old);
-}
-
-#else /* !HAVE_TERMIOS_H */
-
-void
-rl_ttyset(int Reset)
-{
- static struct sgttyb old;
- struct sgttyb new;
-
- if (Reset == 0) {
- ioctl(0, TIOCGETP, &old);
- rl_erase = old.sg_erase;
- rl_kill = old.sg_kill;
- new = old;
- new.sg_flags &= ~(ECHO | ICANON);
- new.sg_flags &= ~(ISTRIP | INPCK);
- ioctl(0, TIOCSETP, &new);
- } else {
- ioctl(0, TIOCSETP, &old);
- }
-}
-#endif /* HAVE_TERMIOS_H */
-
-void
-rl_add_slash(char *path, char *p)
-{
- struct stat Sb;
-
- if (stat(path, &Sb) >= 0)
- strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");
-}
diff --git a/usr.sbin/afs/src/lib/editline/testit.c b/usr.sbin/afs/src/lib/editline/testit.c
deleted file mode 100644
index eb7def06b6f..00000000000
--- a/usr.sbin/afs/src/lib/editline/testit.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $arla: 1.2 $
-**
-** A "micro-shell" to test editline library.
-** If given any arguments, commands aren't executed.
-*/
-#if defined(HAVE_CONFIG_H)
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-
-#include "editline.h"
-
-int
-main(int ac, char **av)
-{
- char *p;
- int doit;
-
- doit = ac == 1;
- while ((p = readline("testit> ")) != NULL) {
- (void)printf("\t\t\t|%s|\n", p);
- if (doit)
- if (strncmp(p, "cd ", 3) == 0) {
- if (chdir(&p[3]) < 0)
- perror(&p[3]);
- } else if (system(p) != 0) {
- perror(p);
- }
- add_history(p);
- free(p);
- }
- exit(0);
- /* NOTREACHED */
-}
diff --git a/usr.sbin/afs/src/lib/editline/unix.h b/usr.sbin/afs/src/lib/editline/unix.h
deleted file mode 100644
index ece72cc9738..00000000000
--- a/usr.sbin/afs/src/lib/editline/unix.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* $arla: 1.2 $
-**
-** Editline system header file for Unix.
-*/
-
-#define CRLF "\r\n"
-#define FORWARD STATIC
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#if defined(USE_DIRENT)
-#include <dirent.h>
-typedef struct dirent DIRENTRY;
-#else
-#include <sys/dir.h>
-typedef struct direct DIRENTRY;
-#endif /* defined(USE_DIRENT) */
-
-#if !defined(S_ISDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif /* !defined(S_ISDIR) */