X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fmisc.c;h=6f67887fab6d0f83829974d3eaa4b75353b399f7;hb=59146768ef4a2c045239628b7179ea477563d63f;hp=ecf3fd86b0668b330b5f3714d6e838239b5275ea;hpb=b3b15f7cbc61e003f62eff1549a4263a69682302;p=chaz%2Ftar diff --git a/src/misc.c b/src/misc.c index ecf3fd8..6f67887 100644 --- a/src/misc.c +++ b/src/misc.c @@ -50,6 +50,9 @@ assign_string (char **string, const char *value) *string = value ? xstrdup (value) : 0; } +#if 0 +/* This function is currently unused; perhaps it should be removed? */ + /* Allocate a copy of the string quoted as in C, and returns that. If the string does not have to be quoted, it returns a null pointer. The allocated copy should normally be freed with free() after the @@ -62,7 +65,7 @@ assign_string (char **string, const char *value) when reading directory files. This means that we can't use quotearg, as quotearg is locale-dependent and is meant for human consumption. */ -char * +static char * quote_copy_string (const char *string) { const char *source = string; @@ -103,6 +106,7 @@ quote_copy_string (const char *string) } return 0; } +#endif /* Takes a quoted C string (like those produced by quote_copy_string) and turns it back into the un-quoted original. This is done in @@ -708,16 +712,17 @@ chdir_arg (char const *dir) return wd_count++; } +/* Index of current directory. */ +int chdir_current; + /* Change to directory I. If I is 0, change to the initial working directory; otherwise, I must be a value returned by chdir_arg. */ void chdir_do (int i) { - static int previous; - - if (previous != i) + if (chdir_current != i) { - struct wd *prev = &wd[previous]; + struct wd *prev = &wd[chdir_current]; struct wd *curr = &wd[i]; if (prev->err < 0) @@ -762,7 +767,7 @@ chdir_do (int i) chdir_fatal (curr->name); } - previous = i; + chdir_current = i; } }