Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!snorkelwacker.mit.edu!hsdndev!cfa203!todd From: todd@cfa.harvard.edu (Todd Karakashian) Newsgroups: comp.lang.c Subject: Re: result of strstr(cs,ct) when ct is a null string Message-ID: <1991May20.202314.432@cfa203.harvard.edu> Date: 20 May 91 20:23:14 GMT References: <1991May20.163227.7166@cfa.harvard.edu> Organization: Harvard-Smithsonian Center for Astrophysics, Cambridge, MA, USA Lines: 34 From article <1991May20.163227.7166@cfa.harvard.edu>, by todd@cfa.harvard.edu (Todd Karakashian): > > Is the result of strstr(cs,ct) defined when ct is a null string > (i.e., when *ct == '\0')? > > SunOS 4.1.1 strstr() returns cs in this situation. I checked the man > page, K&R 2, and the ANSI standard but couldn't find any illuminating > information (like, for example, saying it was undefined). > > I am thinking perhaps that strstr() ought to return NULL in this case, or > maybe a pointer to the null termination of cs, but I am curious what > other people think. > > Thanks... > > Todd > Well! Having now perused the ANSI standard more carefully, I find in 4.11.5.7: "if s2 points to a string of zero length, the function returns s1." Whoops - very sorry to bother you. In the words of Emily Latella: "Never mind." -- ######################################################################## ## Todd Karakashian todd@cfa.harvard.edu (I-net)## ## Smithsonian Astrophysical Observatory ...harvard!cfa!todd (uucp) ## ## 60 Garden Street, MS 70 todd@cfa (BITNET) ##