blob: e3317380507c417ccd195aee9610fcc91e44a8bc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/* SPDX-License-Identifier: BSD-3-Clause */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Suspend execution for an interval."
#define OPERANDS "time"
#include "../common/common.h"
int main(int argc, char *argv[]) {
long unsigned int seconds;
if (argc == 2) {
seconds = strtol(argv[1], NULL, 10);
if (!seconds) {
print_usage(argv[0], DESCRIPTION, OPERANDS, VERSION);
return 1;
}
sleep(seconds);
}
else if (argc == 1) {
print_usage(argv[0], DESCRIPTION, OPERANDS, VERSION);
return 1;
}
return errprint(argv[0], NULL, errno);
}
|