f690123c15ce847b78eb68ba842a94c88a8e5529Michael Graff/*
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Copyright (C) 1999-2001, 2003, 2004, 2007, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
f690123c15ce847b78eb68ba842a94c88a8e5529Michael Graff */
f690123c15ce847b78eb68ba842a94c88a8e5529Michael Graff
70e5a7403f0e0a3bd292b8287c5fed5772c15270Automatic Updater/* $Id: serial_test.c,v 1.15 2007/06/19 23:46:59 tbox Exp $ */
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence#include <config.h>
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews#include <stdio.h>
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence
3759f10fc543747668b1ca4b4671f35b0dea8445Francis Dupont#include <isc/print.h>
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews#include <isc/serial.h>
21f1794606dce19928cf455029e173321f166380Mark Andrews#include <isc/stdlib.h>
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews
f9efe0ad50a42af83a01b562c7f186a1f741e097Mark Andrewsint
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrewsmain() {
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews isc_uint32_t a, b;
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews char buf[1024];
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews char *s, *e;
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews
91cd0f93ad34d23e8b09dca337120f64fbe8f0a1Andreas Gustafsson while (fgets(buf, sizeof(buf), stdin) != NULL) {
91cd0f93ad34d23e8b09dca337120f64fbe8f0a1Andreas Gustafsson buf[sizeof(buf) - 1] = '\0';
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews s = buf;
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews a = strtoul(s, &e, 0);
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews if (s == e)
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews continue;
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews s = e;
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews b = strtoul(s, &e, 0);
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews if (s == e)
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews continue;
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews fprintf(stdout, "%u %u gt:%d lt:%d ge:%d le:%d eq:%d ne:%d\n",
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews a, b,
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews isc_serial_gt(a,b), isc_serial_lt(a,b),
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews isc_serial_ge(a,b), isc_serial_le(a,b),
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews isc_serial_eq(a,b), isc_serial_ne(a,b));
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews }
095c311c79ba8853e814aa4a6f41df94103df069Mark Andrews return (0);
60650dd537ca5e2eda953914bf5715d5e8f8b872Mark Andrews}