Path: utzoo!utgpu!water!watmath!clyde!rutgers!umn-d-ub!umn-cs!randy From: randy@umn-cs.cs.umn.edu (Randy Orrison) Newsgroups: comp.lang.c Subject: Portable Pathname Parsing (was: Is NULL == 0 always true?) Keywords: NULL Message-ID: <3474@umn-cs.cs.umn.edu> Date: 10 Jan 88 14:18:53 GMT References: <134@soleil.UUCP> <7013@brl-smoke.ARPA> Reply-To: randy@umn-cs.UUCP (Randy Orrison) Organization: I none noticed that Lines: 30 Posted: Sun Jan 10 08:18:53 1988 In article <7013@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: | |> if (ptr = strchr (str,'\')) { | |This is, has been, and will continue to be a correct way to test |for a null pointer. However, '\' is nonportable. A couple things: -- '\' is not nonportable, it's illegal (no?) since it's an escaped single quote, preceeded by a single quote, but not followed by one (should be "strchr (str,'\\')" or "strchr (str,'\'')" whichever he meant. -- Assuming that what was really meant was '/' for parsing Unix pathnames, this would be called nonportable, and there's the reason for this message. Since ANSI C is intended to maximize portablility of programs, and since programs that deal with files in anything but the current directory must specify pathnames (if such are available), does dpANS include any provision for portable handling of paths? I'm thinking of standardized library routines that would build paths for you, in whatever the native syntax is. Has this been considered? Or, is this too much an operating system thing and not a C language thing? -randy -- Randy Orrison, University of Minnesota School of Mathematics | UUCP: {ihnp4, seismo!rutgers, sun}!umn-cs!randy | (hello?) ARPA: randy@ux.acss.umn.edu BITNET: randy@umnacca | (Applications currently being taken: short text, for last line of .sig)