1/*	$NetBSD$	*/
2
3/*
4 * Copyright (C) 2004, 2007  Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 1999-2001, 2003  Internet Software Consortium.
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20/* Id: serial_test.c,v 1.15 2007/06/19 23:46:59 tbox Exp  */
21
22#include <config.h>
23
24#include <stdio.h>
25
26#include <isc/serial.h>
27#include <isc/stdlib.h>
28
29int
30main() {
31	isc_uint32_t a, b;
32	char buf[1024];
33	char *s, *e;
34
35	while (fgets(buf, sizeof(buf), stdin) != NULL) {
36		buf[sizeof(buf) - 1] = '\0';
37		s = buf;
38		a = strtoul(s, &e, 0);
39		if (s == e)
40			continue;
41		s = e;
42		b = strtoul(s, &e, 0);
43		if (s == e)
44			continue;
45		fprintf(stdout, "%u %u gt:%d lt:%d ge:%d le:%d eq:%d ne:%d\n",
46			a, b,
47			isc_serial_gt(a,b), isc_serial_lt(a,b),
48			isc_serial_ge(a,b), isc_serial_le(a,b),
49			isc_serial_eq(a,b), isc_serial_ne(a,b));
50	}
51	return (0);
52}
53