Mercurial > sci
view sciworkerd/main.c @ 32:081e1c258e64
misc: update copyright years
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 04 Aug 2022 14:59:33 +0200 |
parents | 2cb228f23f53 |
children | 95bc6b4ec753 |
line wrap: on
line source
/* * sciworkerd.c -- main sciworkerd(8) program file * * Copyright (c) 2021-2022 David Demelier <markand@malikania.fr> * * 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 <stdio.h> #include <stdlib.h> #include <unistd.h> #include "sciworkerd.h" static void env(void) { const char *env; if ((env = getenv("SCI_URL"))) snprintf(sciworkerd.url, sizeof (sciworkerd.url), "%s", optarg); if ((env = getenv("SCI_WORKER"))) snprintf(sciworkerd.name, sizeof (sciworkerd.name), "%s", optarg); } int main(int argc, char **argv) { int ch, val; env(); opterr = 0; while ((ch = getopt(argc, argv, "j:t:u:w:")) != -1) { switch (ch) { case 'j': if ((val = atoi(optarg)) > 0) sciworkerd.maxjobs = val; break; case 't': if ((val = atoi(optarg)) > 0) sciworkerd.timeout = val; break; case 'u': snprintf(sciworkerd.url, sizeof (sciworkerd.url), "%s", optarg); break; case 'w': snprintf(sciworkerd.name, sizeof (sciworkerd.name), "%s", optarg); break; default: break; } } sciworkerd_init(); sciworkerd_run(); sciworkerd_finish(); }