www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2004/12/31/10:16:02

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
From: <ams AT ludd DOT ltu DOT se>
Message-Id: <200412311504.iBVF42Dv002032@speedy.ludd.ltu.se>
Subject: Horror C in strtok.txh
To: DJGPP-WORKERS <djgpp-workers AT delorie DOT com>
Date: Fri, 31 Dec 2004 16:04:02 +0100 (CET)
X-Mailer: ELM [version 2.4ME+ PL78 (25)]
MIME-Version: 1.0
X-ltu-MailScanner-Information: Please contact the ISP for more information
X-ltu-MailScanner: Found to be clean
X-MailScanner-From: ams AT ludd DOT ltu DOT se
Reply-To: djgpp-workers AT delorie DOT com

Hello.

I almost committed this without checking here first because it's so
obvious. I hope you don't disagree.

RCS file: /cvs/djgpp/djgpp/src/libc/ansi/string/strtok.txh,v
retrieving revision 1.3
diff -p -u -r1.3 strtok.txh
--- djgpp/src/libc/ansi/string/strtok.txh       29 Jan 2003 12:31:53 -0000      
1.3
+++ djgpp/src/libc/ansi/string/strtok.txh       31 Dec 2004 14:53:39 -0000
@@ -27,14 +27,19 @@ A pointer to the token, or @code{NULL} i
 @subheading Example
 
 @example
-main()
+#include <stdio.h>
+#include <string.h>
+
+int main(void)
 @{
-  char *buf = "Hello there, stranger";
+  char buf[] = "Hello there, stranger";
   char *tok;
   for (tok = strtok(buf, " ,");
        tok;
        tok=strtok(0, " ,"))
     printf("tok = `%s'\n", tok);
+
+  return 0;
 @}
 
 tok = `Hello'


Right,

						MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019