Bash-4.2 distribution sources and documentation
[platform/upstream/bash.git] / general.c
index 26c7d3d..fdadf1d 100644 (file)
--- 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