[PATCH] mystring: Add dotdir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Merge all occurrences of "." into dotdir.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
---
 src/cd.c       | 2 +-
 src/expand.c   | 2 +-
 src/mystring.c | 1 +
 src/mystring.h | 1 +
 src/var.c      | 2 +-
 5 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/cd.c b/src/cd.c
index 1ef1dc5..bcd1484 100644
--- a/src/cd.c
+++ b/src/cd.c
@@ -126,7 +126,7 @@ dotdot:
 		}
 	}
 	if (!*dest)
-		dest = ".";
+		dest = dotdir;
 	path = bltinlookup("CDPATH");
 	while (p = path, (len = padvance_magic(&path, dest, 0)) >= 0) {
 		c = *p;
diff --git a/src/expand.c b/src/expand.c
index d8b354c..e7e8ce0 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -1358,7 +1358,7 @@ expmeta(char *name, unsigned name_len, unsigned expdir_len)
 	cp = expdir;
 	expdir_len = enddir - cp;
 	if (!expdir_len)
-		cp = ".";
+		cp = dotdir;
 	if ((dirp = opendir(cp)) == NULL)
 		return;
 	if (*endname == 0) {
diff --git a/src/mystring.c b/src/mystring.c
index 978bbb5..7bf61e3 100644
--- a/src/mystring.c
+++ b/src/mystring.c
@@ -68,6 +68,7 @@ const char cqchars[] = {
 };
 const char illnum[] = "Illegal number: %s";
 const char homestr[] = "HOME";
+const char dotdir[] = ".";
 
 /*
  * equal - #defined in mystring.h
diff --git a/src/mystring.h b/src/mystring.h
index d178990..0857c32 100644
--- a/src/mystring.h
+++ b/src/mystring.h
@@ -57,6 +57,7 @@ extern const char cqchars[];
 #define qchars (cqchars + 1)
 extern const char illnum[];
 extern const char homestr[];
+extern const char dotdir[];
 
 #if 0
 void scopyn(const char *, char *, int);
diff --git a/src/var.c b/src/var.c
index bb5420a..e2102c3 100644
--- a/src/var.c
+++ b/src/var.c
@@ -143,7 +143,7 @@ INIT {
 
 	p = lookupvar("PWD");
 	if (p)
-		if (*p != '/' || stat64(p, &st1) || stat64(".", &st2) ||
+		if (*p != '/' || stat64(p, &st1) || stat64(dotdir, &st2) ||
 		    st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino)
 			p = 0;
 	setpwd(p, 0);
-- 
2.39.2

-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux