mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Added the "setlocale.c" test program.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15089 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.68k,v 1.10 2006-01-02 13:11:39 obarthel Exp $
|
||||
# $Id: GNUmakefile.68k,v 1.11 2006-04-05 06:35:42 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -48,16 +48,21 @@ LIBS = -lm -lc -lgcc
|
||||
|
||||
all: test fgets_test iotest sscanf_test printf_test sprintf_test \
|
||||
stack_size_test translate_test strtok_test uname simple \
|
||||
fstat_stdout_test simple_sprintf date_test sscanf_64 factorial
|
||||
fstat_stdout_test simple_sprintf date_test sscanf_64 factorial \
|
||||
setlocale
|
||||
|
||||
clean:
|
||||
$(DELETE) #?.o #?.map test fgets_test iotest sscanf_test printf_test \
|
||||
sprintf_test stack_size_test translate_test strtok_test uname \
|
||||
simple fstat_stdout_test simple_sprintf date_test sscanf_64 \
|
||||
factorial
|
||||
factorial setlocale
|
||||
|
||||
##############################################################################
|
||||
|
||||
setlocale : setlocale.o
|
||||
@echo "Linking $@"
|
||||
$(CC) $(CFLAGS) -o $@ setlocale.o $(LIBS) -Wl,--cref,-M,-Map=$@.map
|
||||
|
||||
test : test.o
|
||||
@echo "Linking $@"
|
||||
$(CC) $(CFLAGS) -o $@ test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.os4,v 1.11 2006-01-02 13:11:39 obarthel Exp $
|
||||
# $Id: GNUmakefile.os4,v 1.12 2006-04-05 06:35:42 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -41,16 +41,20 @@ LIBS = -lm -lc -ldebug -lgcc
|
||||
all: test fgets_test iotest sscanf_test printf_test sprintf_test \
|
||||
stack_size_test translate_test strtok_test uname simple \
|
||||
fstat_stdout_test simple_sprintf date_test sscanf_64 \
|
||||
factorial
|
||||
factorial setlocale
|
||||
|
||||
clean:
|
||||
$(DELETE) *.o *.map test fgets_test iotest sscanf_test printf_test \
|
||||
sprintf_test stack_size_test translate_test strtok_test \
|
||||
uname simple fstat_stdout_test simple_sprintf date_test \
|
||||
sscanf_64 factorial
|
||||
sscanf_64 factorial setlocale
|
||||
|
||||
##############################################################################
|
||||
|
||||
setlocale : setlocale.o
|
||||
@echo "Linking $@"
|
||||
$(CC) $(CFLAGS) -o $@ setlocale.o $(LIBS) -Wl,--cref,-M,-Map=$@.map
|
||||
|
||||
test : test.o
|
||||
@echo "Linking $@"
|
||||
$(CC) $(CFLAGS) -o $@ test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
This is a collection of programs I'm using to test the library. These
|
||||
are functional tests: the library is supposed to do something, and produce
|
||||
a particular result. For example, "printf_test" exercises a bunch of
|
||||
output formatting rules. Currently, there is only an smakefile for SAS/C
|
||||
to build these programs with.
|
||||
output formatting rules.
|
||||
|
||||
29
test_programs/setlocale.c
Executable file
29
test_programs/setlocale.c
Executable file
@ -0,0 +1,29 @@
|
||||
#include <stdio.h>
|
||||
#include <locale.h>
|
||||
|
||||
/* uncomment to fix corruption
|
||||
#include <dos.h>
|
||||
BOOL __open_locale = FALSE;
|
||||
*/
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char *loc;
|
||||
time_t t;
|
||||
struct tm *m;
|
||||
char buf[200];
|
||||
int len;
|
||||
|
||||
loc = setlocale(LC_ALL, "");
|
||||
printf("loc=%p (%s)\n", loc, loc);
|
||||
|
||||
time(&t);
|
||||
m = gmtime(&t);
|
||||
|
||||
len = strftime(buf, sizeof(buf), "%a %b", m);
|
||||
|
||||
printf("len=%d buf=%s\n", len, buf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user