home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / amiga / programm / 15789 < prev    next >
Encoding:
Text File  |  1992-11-13  |  1.3 KB  |  45 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!rama!hadig
  3. From: hadig@rama.informatik.rwth-aachen.de (Thomas Hadig)
  4. Subject: Bug in SAS/C 6.0 library : strstr ()
  5. Message-ID: <hadig.721653082@rama>
  6. Summary: Bug in strstr (SAS/C 6.0) : strstr can't handle empty strings
  7. Keywords: strstr, SAS/C 6.0
  8. Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
  9. Nntp-Posting-Host: rama
  10. Organization: Rechnerbetrieb Informatik  /  RWTH Aachen
  11. Date: 13 Nov 92 11:11:22 GMT
  12. Lines: 31
  13.  
  14. Hi,
  15.  
  16. i have found a bug in the SAS/C Amiga 6.0 library function strstr :
  17.  
  18. char * strstr (char *s1, char *s2);
  19.  
  20. strstr searches the substring s2 in the string s1 and returns the
  21. starting address of the substring s2 in s1 or NULL if not found.
  22.  
  23. BUG :
  24.  
  25. If you call strstr with an empty string s1, strstr will continue the
  26. search instead of returning NULL.
  27.  
  28. Example :
  29.  
  30. char s1[]="\0test";
  31. printf ("%d\n",strstr(s1,"test")-s1);
  32.  
  33. Output will be 1.
  34.  
  35. (Has been reported to EMITS)
  36.  
  37. Bye,
  38. Thomas
  39.  
  40. ----------------------------------------------------------------------------
  41. Thomas Hadig, Otto-Petersen-Haus Zi.1009, Ruetscher Str.155, D-51 Aachen
  42.        hadig@rog.rwth-aachen.de
  43.        hadig@pool.informatik.rwth-aachen.de
  44. ----------------------------------------------------------------------------
  45.