]> granicus.if.org Git - strace/blob - tests/sleep.c
Update copyright headers
[strace] / tests / sleep.c
1 /*
2  * A simple nanosleep based sleep(1) replacement.
3  *
4  * Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org>
5  * All rights reserved.
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9
10 #include "tests.h"
11 #include <stdlib.h>
12 #include <time.h>
13
14 int
15 main(int ac, char **av)
16 {
17         if (ac < 2)
18                 error_msg_and_fail("missing operand");
19
20         if (ac > 2)
21                 error_msg_and_fail("extra operand");
22
23         struct timespec ts = { atoi(av[1]), 0 };
24
25         if (nanosleep(&ts, NULL))
26                 perror_msg_and_fail("nanosleep");
27
28         return 0;
29 }