all repos — nimisewi_c @ c0337d768bca432915509e3799c072703c89ace2

simple random toki pona phrase generator

main.c (view raw)

 1/* Copyright (c) 2021, la-ninpre
 2 * 
 3 * Permission to use, copy, modify, and/or distribute this software for any
 4 * purpose with or without fee is hereby granted, provided that the above
 5 * copyright notice and this permission notice appear in all copies.
 6 * 
 7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14 *
15 * **********************************************************************
16 *
17 * this file contains main code for nimisewi as commandline utility
18 * that throws it's phrases to stdout.
19 *
20 * should be obvious :)
21 */
22
23#include <err.h>
24#include <stdio.h>
25#include <stdlib.h>
26#include <unistd.h>
27
28#include "nimisewi.h"
29#include "nimitoki.h"
30
31int
32main(void)
33{
34#ifdef __OpenBSD__
35    if (pledge("stdio", NULL) == -1) {
36        err(EXIT_FAILURE, "pledge");
37    }
38#endif
39    char *ns;
40    ns = nimi_sewi();
41
42    printf("%s\n", ns);
43
44    weka_e_nimi_sewi(ns);
45
46    return EXIT_SUCCESS;
47}
48