[PATCH] mystring: Add dotdir

Herbert Xu <[email protected]>
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
Merge all occurrences of "." into dotdir.

Signed-off-by: Herbert Xu <[email protected]>
---
 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 <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.