From 2c0464405f411d4ba91bae622fe11a586e8cebaf Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Wed, 1 Sep 2010 06:42:58 +0000 Subject: =?UTF-8?q?2010-09-01=09Ralf=20Cors=C3=A9pius=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * POSIX/Makefile.am: Add htonl. * POSIX/htonl.c: New. --- testsuites/libtests/ChangeLog | 5 +++++ testsuites/libtests/POSIX/Makefile.am | 3 +++ testsuites/libtests/POSIX/htonl.c | 24 ++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 testsuites/libtests/POSIX/htonl.c (limited to 'testsuites') diff --git a/testsuites/libtests/ChangeLog b/testsuites/libtests/ChangeLog index fba80aeeba..894a5ef54d 100644 --- a/testsuites/libtests/ChangeLog +++ b/testsuites/libtests/ChangeLog @@ -1,3 +1,8 @@ +2010-09-01 Ralf Corsépius + + * POSIX/Makefile.am: Add htonl. + * POSIX/htonl.c: New. + 2010-08-25 Sebastian Huber * malloctest/init.c: Update for heap API changes. diff --git a/testsuites/libtests/POSIX/Makefile.am b/testsuites/libtests/POSIX/Makefile.am index b4aae1b999..cbb043b2d1 100644 --- a/testsuites/libtests/POSIX/Makefile.am +++ b/testsuites/libtests/POSIX/Makefile.am @@ -52,6 +52,9 @@ getuid_SOURCES = getuid.c # check_PROGRAMS += issetugid # issetugid_SOURCES = issetugid.c +check_PROGRAMS += htonl +htonl_SOURCES = htonl.c + check_PROGRAMS += lseek lseek_SOURCES = lseek.c diff --git a/testsuites/libtests/POSIX/htonl.c b/testsuites/libtests/POSIX/htonl.c new file mode 100644 index 0000000000..71aa969db7 --- /dev/null +++ b/testsuites/libtests/POSIX/htonl.c @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2010 by + * Ralf Corsépius, Ulm, Germany. All rights reserved. + * + * Permission to use, copy, modify, and distribute this software + * is freely granted, provided that this notice is preserved. + */ + +#include + +int +main (void) +{ + uint32_t u32; + uint16_t u16; + + u32 = htonl(0x12345678); + u16 = htons(0x1234); + + u32 = ntohl(0x12345678); + u16 = ntohs(0x1234); + + return 0; +} -- cgit v1.2.3