diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-03-13 21:49:32 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-03-13 21:49:32 -0400 |
commit | ec8fd0cc399c7e81cafa4de9f1e50a81715c0105 (patch) | |
tree | 62e103403c0f12d530362b2876af4ba0c83b92f6 |
migrate to gitlab
-rw-r--r-- | sleep.c | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -0,0 +1,44 @@ +/* + * UNG's Not GNU + * + * Copyright (c) 2011, Jakob Kaivo <jakob@kaivo.net> + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +const char *sleep_desc = "suspend execution for an interval"; +const char *sleep_inv = "sleep time"; + +int +main (int argc, char **argv) +{ + char *end; + long seconds; + + if (argc != 2) { + return 1; + } + + seconds = strtol(argv[1], &end, 10); + if (end != NULL && strlen(end) > 0) { + return 1; + } + + sleep(seconds); + return 0; +} |