projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't put anything after the #else or #endif's, unless it's a comment
[unix-history]
/
usr
/
src
/
bin
/
csh
/
dir.c
diff --git
a/usr/src/bin/csh/dir.c
b/usr/src/bin/csh/dir.c
index
79d809f
..
14f61c4
100644
(file)
--- a/
usr/src/bin/csh/dir.c
+++ b/
usr/src/bin/csh/dir.c
@@
-6,21
+6,29
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)dir.c 5.
6
(Berkeley) %G%";
+static char sccsid[] = "@(#)dir.c 5.
9
(Berkeley) %G%";
#endif /* not lint */
#endif /* not lint */
-#include "sh.h"
-#include "sh.dir.h"
-/*
- * C Shell - directory management
- */
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "csh.h"
+#include "dir.h"
+#include "extern.h"
+
+/* Directory management. */
-static struct directory *dfind();
-static Char *dfollow();
-static void printdirs();
-static Char *dgoto();
-static void dnewcwd();
-static void dset();
+static struct directory
+ *dfind __P((Char *));
+static Char *dfollow __P((Char *));
+static void printdirs __P((void));
+static Char *dgoto __P((Char *));
+static void dnewcwd __P((struct directory *));
+static void dset __P((Char *));
struct directory dhead; /* "head" of loop */
int printd; /* force name to be printed */
struct directory dhead; /* "head" of loop */
int printd; /* force name to be printed */
@@
-48,13
+56,13
@@
dinit(hp)
tcp = short2str(hp);
(void) xprintf(emsg, tcp);
if (chdir(tcp) == -1)
tcp = short2str(hp);
(void) xprintf(emsg, tcp);
if (chdir(tcp) == -1)
- cp =
(Char *) 0
;
+ cp =
NULL
;
else
cp = hp;
}
else
else
cp = hp;
}
else
- cp =
(Char *) 0
;
- if (cp ==
(Char *) 0
) {
+ cp =
NULL
;
+ if (cp ==
NULL
) {
(void) xprintf(emsg, "/");
if (chdir("/") == -1)
/* I am not even try to print an error message! */
(void) xprintf(emsg, "/");
if (chdir("/") == -1)
/* I am not even try to print an error message! */
@@
-594,7
+602,7
@@
dcanon(cp, p)
Char tmpdir[MAXPATHLEN];
p1 = value(STRcwd);
Char tmpdir[MAXPATHLEN];
p1 = value(STRcwd);
- if (p1 ==
(Char *) 0
|| *p1 != '/')
+ if (p1 ==
NULL
|| *p1 != '/')
abort();
if (Strlen(p1) + Strlen(cp) + 1 >= MAXPATHLEN)
abort();
abort();
if (Strlen(p1) + Strlen(cp) + 1 >= MAXPATHLEN)
abort();
@@
-801,7
+809,7
@@
dcanon(cp, p)
(Strncmp(p1, cp, cc) != 0 || (cp[cc] != '/' && cp[cc] != '\0'))) {
static ino_t home_ino = -1;
static dev_t home_dev = -1;
(Strncmp(p1, cp, cc) != 0 || (cp[cc] != '/' && cp[cc] != '\0'))) {
static ino_t home_ino = -1;
static dev_t home_dev = -1;
- static Char *home_ptr =
(Char *) 0
;
+ static Char *home_ptr =
NULL
;
struct stat statbuf;
/*
struct stat statbuf;
/*
@@
-817,7
+825,7
@@
dcanon(cp, p)
* Start comparing dev & ino backwards
*/
p2 = Strcpy(link, cp);
* Start comparing dev & ino backwards
*/
p2 = Strcpy(link, cp);
- for (sp =
(Char *) 0
; *p2 && stat(short2str(p2), &statbuf) != -1;) {
+ for (sp =
NULL
; *p2 && stat(short2str(p2), &statbuf) != -1;) {
if (statbuf.st_dev == home_dev &&
statbuf.st_ino == home_ino) {
sp = (Char *) - 1;
if (statbuf.st_dev == home_dev &&
statbuf.st_ino == home_ino) {
sp = (Char *) - 1;
@@
-829,7
+837,7
@@
dcanon(cp, p)
/*
* See if we found it
*/
/*
* See if we found it
*/
- if (*p2 && sp == (Char *) -
1) {
+ if (*p2 && sp == (Char *) -1) {
/*
* Use STRhome to make '~' work
*/
/*
* Use STRhome to make '~' work
*/