]> granicus.if.org Git - php/commitdiff
NetWare specific dirname fixes.
authorAnantha Kesari H Y <hyanantha@php.net>
Sat, 16 Jul 2005 11:18:35 +0000 (11:18 +0000)
committerAnantha Kesari H Y <hyanantha@php.net>
Sat, 16 Jul 2005 11:18:35 +0000 (11:18 +0000)
--Kamesh

ext/standard/string.c

index 713e521b94e093f06b7ee2793b1bd292d1ed4566..2cdfd018c95894164af27dfa780f4480cbde1318 100644 (file)
@@ -1175,6 +1175,22 @@ PHPAPI size_t php_dirname(char *path, size_t len)
                        return len;
                }
        }
+#elif defined(NETWARE)
+       /*
+        * Find the first occurence of : from the left 
+        * move the path pointer to the position just after :
+        * increment the len_adjust to the length of path till colon character(inclusive)
+        * If there is no character beyond : simple return len
+        */
+       char *colonpos = NULL;
+       colonpos = strchr(path, ':');
+       if(colonpos != NULL) {
+               len_adjust = ((colonpos - path) + 1);
+               path += len_adjust;
+               if(len_adjust == len) {
+                       return len;
+               }
+       }
 #endif
 
        if (len == 0) {
@@ -1199,9 +1215,21 @@ PHPAPI size_t php_dirname(char *path, size_t len)
        }
        if (end < path) {
                /* No slash found, therefore return '.' */
+#ifdef NETWARE
+               if(len_adjust == 0) {
+                       path[0] = '.';
+                       path[1] = '\0';
+                       return 1; //only one character
+               } 
+               else {
+                       path[0] = '\0';
+                       return len_adjust;
+               }
+#else
                path[0] = '.';
                path[1] = '\0';
                return 1 + len_adjust;
+#endif
        }
 
        /* Strip slashes which came before the file name */