1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Added the strtok_test program.

git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14759 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2004-10-25 19:50:33 +00:00
parent 267bdc4be6
commit 0ed8ef67ed
4 changed files with 61 additions and 9 deletions

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.68k,v 1.2 2004-09-10 07:41:13 obarthel Exp $
# $Id: GNUmakefile.68k,v 1.3 2004-10-25 19:50:33 obarthel Exp $
#
# :ts=8
#
@ -46,10 +46,12 @@ LIBS = -lm -lc -lgcc
##############################################################################
all: test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test translate_test
all: test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test \
translate_test strtok_test
clean:
$(DELETE) #?.o #?.map test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test translate_test
$(DELETE) #?.o #?.map test fgets_test iotest sscanf_test printf_test sprintf_test \
stack_size_test translate_test strtok_test
##############################################################################
@ -61,6 +63,10 @@ fgets_test : fgets_test.o
@echo "Linking $@"
$(CC) $(CFLAGS) -o $@ fgets_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map
strtok_test : strtok_test.o
@echo "Linking $@"
$(CC) $(CFLAGS) -o $@ strtok_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map
iotest : iotest.o
@echo "Linking $@"
$(CC) $(CFLAGS) -o $@ iotest.o $(LIBS) -Wl,--cref,-M,-Map=$@.map

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.os4,v 1.1 2004-09-29 14:37:10 obarthel Exp $
# $Id: GNUmakefile.os4,v 1.2 2004-10-25 19:50:33 obarthel Exp $
#
# :ts=8
#
@ -38,10 +38,12 @@ LIBS = -lm -lc
##############################################################################
all: test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test translate_test
all: test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test \
translate_test strtok_test
clean:
$(DELETE) *.o *.map test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test translate_test
$(DELETE) *.o *.map test fgets_test iotest sscanf_test printf_test sprintf_test \
stack_size_test translate_test strtok_test
##############################################################################
@ -53,6 +55,10 @@ fgets_test : fgets_test.o
@echo "Linking $@"
$(CC) $(CFLAGS) -o $@ fgets_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map
strtok_test : strtok_test.o
@echo "Linking $@"
$(CC) $(CFLAGS) -o $@ strtok_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map
iotest : iotest.o
@echo "Linking $@"
$(CC) $(CFLAGS) -o $@ iotest.o $(LIBS) -Wl,--cref,-M,-Map=$@.map

View File

@ -1,5 +1,5 @@
#
# $Id: smakefile,v 1.2 2004-09-10 07:41:13 obarthel Exp $
# $Id: smakefile,v 1.3 2004-10-25 19:50:33 obarthel Exp $
#
# :ts=8
#
@ -63,10 +63,10 @@ AFLAGS = \
##############################################################################
all: setup test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test translate_test cleanup
all: setup test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test translate_test strtok_test cleanup
clean:
-delete \#?.o \#?.map test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test translate_test
-delete \#?.o \#?.map test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test translate_test strtok_test
##############################################################################
@ -90,6 +90,11 @@ fgets_test: fgets_test.o
@slink $(LIB)startup.o fgets_test.o to $@ lib $(LIB)c.lib addsym \
map $@.map,fhx fwidth 32 pwidth 32 swidth 32
strtok_test: strtok_test.o
@echo "Linking $@"
@slink $(LIB)startup.o strtok_test.o to $@ lib $(LIB)c.lib addsym \
map $@.map,fhx fwidth 32 pwidth 32 swidth 32
iotest: iotest.o
@echo "Linking $@"
@slink $(LIB)startup.o iotest.o to $@ lib $(LIB)c.lib addsym \

View File

@ -0,0 +1,35 @@
/*
* $Id: strtok_test.c,v 1.1 2004-10-25 19:50:33 obarthel Exp $
*
* :ts=4
*/
/****************************************************************************/
#include <string.h>
#include <stdio.h>
/****************************************************************************/
int
main(int argc,char ** argv)
{
char test[256];
char * one;
char * two;
char * three;
strcpy(test," one two three");
strtok(test," ");
one = strtok(NULL," ");
two = strtok(NULL," ");
three = strtok(NULL," ");
printf("one = %p '%s'\n",one,one);
printf("two = %p '%s'\n",two,two);
printf("three = %p '%s'\n",three,three);
return(0);
}