X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=general.c;h=fdadf1d5740e40bbf53e929b26bea98da7059832;hb=495aee441b75276e38c75694ccb455bb6463fdb9;hp=26c7d3db63305c055e5f56053ff26617545a5b3c;hpb=30d188c2932d6ef609d894fefeb7e7b03ccff463;p=platform%2Fupstream%2Fbash.git diff --git a/general.c b/general.c index 26c7d3d..fdadf1d 100644 --- a/general.c +++ b/general.c @@ -363,6 +363,16 @@ sh_validfd (fd) return (fcntl (fd, F_GETFD, 0) >= 0); } +int +fd_ispipe (fd) + int fd; +{ + errno = 0; + if (lseek ((fd), 0L, SEEK_CUR) < 0) + return (errno == ESPIPE); + return 0; +} + /* There is a bug in the NeXT 2.1 rlogind that causes opens of /dev/tty to fail. */ @@ -549,6 +559,22 @@ file_iswdir (fn) return (file_isdir (fn) && sh_eaccess (fn, W_OK) == 0); } +/* Return 1 if STRING is "." or "..", optionally followed by a directory + separator */ +int +dot_or_dotdot (string) + const char *string; +{ + if (string == 0 || *string == '\0' || *string != '.') + return (0); + + /* string[0] == '.' */ + if (PATHSEP(string[1]) || (string[1] == '.' && PATHSEP(string[2]))) + return (1); + + return (0); +} + /* Return 1 if STRING contains an absolute pathname, else 0. Used by `cd' to decide whether or not to look up a directory name in $CDPATH. */ int