]> iEval git - linux-seccomp.git/blame - libseccomp/tests/miniseq.c
Add a simple test of essential functionality
[linux-seccomp.git] / libseccomp / tests / miniseq.c
CommitLineData
8befd5cc
MG
1/**
2 * Seccomp Library test support program
3 *
4 * Copyright (c) 2015 Mathias Krause <minipli@googlemail.com>
5 */
6
7/*
8 * This library is free software; you can redistribute it and/or modify it
9 * under the terms of version 2.1 of the GNU Lesser General Public License as
10 * published by the Free Software Foundation.
11 *
12 * This library is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library; if not, see <http://www.gnu.org/licenses>.
19 */
20
21#include <inttypes.h>
22#include <stdlib.h>
23#include <stdint.h>
24#include <stdio.h>
25#include <errno.h>
26
27static int get_number(char *str, uint64_t *res)
28{
29 char *end = str;
30
31 errno = 0;
32 *res = strtoull(str, &end, 0);
33 if (errno || *end != '\0') {
34 fprintf(stderr, "error: failed to convert '%s'\n", str);
35 return -1;
36 }
37
38 return 0;
39}
40
41int main(int argc, char *argv[])
42{
43 uint64_t first, last, cur;
44
45 if (argc != 3) {
46 fprintf(stderr, "usage: %s FIRST LAST\n", argv[0]);
47 return 1;
48 }
49
50 if (get_number(argv[1], &first) || get_number(argv[2], &last))
51 return 1;
52
53 for (cur = first; cur <= last; cur++)
54 printf("%" PRIu64 "\n", cur);
55
56 return 0;
57}
This page took 0.028087 seconds and 4 git commands to generate.