summaryrefslogtreecommitdiffstats
path: root/contrib/tcsh/tw.init.c
diff options
context:
space:
mode:
authormp <mp@FreeBSD.org>2005-04-24 19:41:08 +0000
committermp <mp@FreeBSD.org>2005-04-24 19:41:08 +0000
commit94a109bd814074f290affa8f7698847719d55833 (patch)
tree6daeb0464a7bc8705c0246b7fd98e212b6beed09 /contrib/tcsh/tw.init.c
parentbbd1addf8f9452690ad13ce5b875ee4cc9633958 (diff)
downloadFreeBSD-src-94a109bd814074f290affa8f7698847719d55833.zip
FreeBSD-src-94a109bd814074f290affa8f7698847719d55833.tar.gz
Import of tcsh-6.14.00
Diffstat (limited to 'contrib/tcsh/tw.init.c')
-rw-r--r--contrib/tcsh/tw.init.c65
1 files changed, 27 insertions, 38 deletions
diff --git a/contrib/tcsh/tw.init.c b/contrib/tcsh/tw.init.c
index 66439d2..30dce51 100644
--- a/contrib/tcsh/tw.init.c
+++ b/contrib/tcsh/tw.init.c
@@ -1,4 +1,4 @@
-/* $Header: /src/pub/tcsh/tw.init.c,v 3.29 2002/06/25 19:02:12 christos Exp $ */
+/* $Header: /src/pub/tcsh/tw.init.c,v 3.34 2005/01/05 16:06:15 christos Exp $ */
/*
* tw.init.c: Handle lists of things to complete
*/
@@ -32,20 +32,13 @@
*/
#include "sh.h"
-RCSID("$Id: tw.init.c,v 3.29 2002/06/25 19:02:12 christos Exp $")
+RCSID("$Id: tw.init.c,v 3.34 2005/01/05 16:06:15 christos Exp $")
#include "tw.h"
#include "ed.h"
#include "tc.h"
#include "sh.proc.h"
-#if !defined(NSIG) && defined(SIGMAX)
-# define NSIG (SIGMAX+1)
-#endif /* !NSIG && SIGMAX */
-#if !defined(NSIG) && defined(_NSIG)
-# define NSIG _NSIG
-#endif /* !NSIG && _NSIG */
-
#define TW_INCR 128
typedef struct {
@@ -111,7 +104,7 @@ static sigmask_t tw_omask;
static Char *tw_str_add __P((stringlist_t *, int));
static void tw_str_free __P((stringlist_t *));
static Char *tw_dir_next __P((DIR *));
-static void tw_cmd_add __P((Char *name));
+static void tw_cmd_add __P((const Char *name));
static void tw_cmd_cmd __P((void));
static void tw_cmd_builtin __P((void));
static void tw_cmd_alias __P((void));
@@ -150,7 +143,7 @@ tw_str_add(sl, len)
(Char *) xmalloc((size_t) (sl->tbuff * sizeof(Char)));
/* Re-thread the new pointer list, if changed */
if (ptr != NULL && ptr != sl->buff) {
- int offs = (int) (sl->buff - ptr);
+ intptr_t offs = sl->buff - ptr;
for (i = 0; i < sl->nlist; i++)
sl->list[i] += offs;
}
@@ -188,7 +181,7 @@ static Char *
tw_dir_next(dfd)
DIR *dfd;
{
- register struct dirent *dirp;
+ struct dirent *dirp;
if (dfd == NULL)
return NULL;
@@ -206,7 +199,7 @@ tw_dir_next(dfd)
*/
static void
tw_cmd_add(name)
- Char *name;
+ const Char *name;
{
int len;
@@ -232,10 +225,10 @@ tw_cmd_free()
static void
tw_cmd_cmd()
{
- register DIR *dirp;
- register struct dirent *dp;
- register Char *dir = NULL, *name;
- register Char **pv;
+ DIR *dirp;
+ struct dirent *dp;
+ Char *dir = NULL, *name;
+ Char **pv;
struct varent *v = adrof(STRpath);
struct varent *recexec = adrof(STRrecognize_only_executables);
int len;
@@ -291,7 +284,7 @@ tw_cmd_cmd()
static void
tw_cmd_builtin()
{
- register struct biltins *bptr;
+ struct biltins *bptr;
for (bptr = bfunc; bptr < &bfunc[nbfunc]; bptr++)
if (bptr->bname)
@@ -310,8 +303,8 @@ tw_cmd_builtin()
static void
tw_cmd_alias()
{
- register struct varent *p;
- register struct varent *c;
+ struct varent *p;
+ struct varent *c;
p = &aliases;
for (;;) {
@@ -501,9 +494,9 @@ tw_shvar_next(dir, flags)
Char *dir;
int *flags;
{
- register struct varent *p;
- register struct varent *c;
- register Char *cp;
+ struct varent *p;
+ struct varent *c;
+ Char *cp;
USE(flags);
USE(dir);
@@ -602,8 +595,6 @@ tw_complete_start(dfd, pat)
DIR *dfd;
Char *pat;
{
- extern struct varent completions;
-
USE(pat);
SETDIR(dfd)
tw_vptr_start(&completions);
@@ -640,9 +631,9 @@ tw_logname_start(dfd, pat)
{
USE(pat);
SETDIR(dfd)
-#if !defined(_VMS_POSIX) && !defined(WINNT_NATIVE)
+#ifdef HAVE_GETPWENT
(void) setpwent(); /* Open passwd file */
-#endif /* !_VMS_POSIX && !WINNT_NATIVE */
+#endif
} /* end tw_logname_start */
@@ -666,12 +657,11 @@ tw_logname_next(dir, flags)
USE(flags);
USE(dir);
TW_HOLD();
-#if !defined(_VMS_POSIX) && !defined(WINNT_NATIVE)
- /* ISC does not declare getpwent()? */
- pw = (struct passwd *) getpwent();
-#else /* _VMS_POSIX || WINNT_NATIVE */
+#ifdef HAVE_GETPWENT
+ pw = getpwent();
+#else
pw = NULL;
-#endif /* !_VMS_POSIX && !WINNT_NATIVE */
+#endif
TW_RELS();
if (pw == NULL) {
@@ -694,9 +684,9 @@ tw_logname_end()
#ifdef YPBUGS
fix_yp_bugs();
#endif
-#if !defined(_VMS_POSIX) && !defined(WINNT_NATIVE)
+#ifdef HAVE_GETPWENT
(void) endpwent();
-#endif /* !_VMS_POSIX && !WINNT_NATIVE */
+#endif
} /* end tw_logname_end */
@@ -953,7 +943,7 @@ tw_bind_next(dir, flags)
Char *dir;
int *flags;
{
- char *ptr;
+ const char *ptr;
USE(flags);
if (tw_bind && tw_bind->name) {
for (ptr = tw_bind->name, dir = tw_retname;
@@ -993,7 +983,7 @@ tw_limit_next(dir, flags)
int *flags;
{
#ifndef HAVENOLIMIT
- char *ptr;
+ const char *ptr;
if (tw_limit && tw_limit->limname) {
for (ptr = tw_limit->limname, dir = tw_retname;
(*dir++ = (Char) *ptr++) != '\0';)
@@ -1031,8 +1021,7 @@ tw_sig_next(dir, flags)
Char *dir;
int *flags;
{
- char *ptr;
- extern int nsig;
+ const char *ptr;
USE(flags);
for (;tw_index < nsig; tw_index++) {
OpenPOWER on IntegriCloud