Index

lognestmonster / 64e29ab

A general-purpose single-header C logging library and parser for event-based logs. (Incomplete)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
19206 Feb 2020 21:31728148fBegin parser executable sourceJosh Stockin1560G

Blob @ lognestmonster / src / parser / main.c

text/plain1698 bytesdownload raw
1/* lognestmonster Copyright (c) 2020 Joshua 'joshuas3' Stockin
2 * <https://joshstock.in>
3 * <https://github.com/JoshuaS3/lognestmonster>
4 *
5 * This software is licensed and distributed under the terms of the MIT License.
6 * See the MIT License in the LICENSE file of this project's root folder.
7 *
8 * This comment block and its contents, including this disclaimer, MUST be
9 * preserved in all copies or distributions of this software's source.
10 */
11
12// parser/main.c
13// Entry point for the CLI parser program. Parses input arguments and handles
14// component initialization and configuration.
15
16
17#include <stdlib.h>
18#include <stdio.h>
19#include <string.h>
20#include <curses.h>
21
22
23int main(int argc, char * argv[]) {
24 for (int iter = 1; iter < argc; iter++) {
25 char * arg = argv[iter];
26 if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0 || strcmp(arg, "-?") == 0) {
27 printf("usage: lognestmonster [--help | -h | -?] [--version | -v]\n");
28 exit(0);
29 } else if (strcmp(arg, "--version") == 0 || strcmp(arg, "-v") == 0) {
30 printf("lognestmonster Copyright (c) 2020 Joshua 'joshuas3' Stockin\n");
31 printf("<https://joshstock.in> <https://github.com/JoshuaS3/lognestmonster>\n");
32 printf("This software's source is licensed and distributed under the terms of the MIT License.\n");
33 exit(0);
34 } else {
35 printf("lognestmonster (parser/main): unknown argument \"%s\", exiting...\n", arg);
36 exit(1);
37 }
38 }
39
40 initscr();
41 noecho();
42
43 attron(A_BOLD | A_STANDOUT);
44 mvaddstr(10, 0, "lognestmonster Copyright (c) 2020 Joshua 'joshuas3' Stockin");
45 attroff(A_BOLD | A_STANDOUT);
46 refresh();
47
48 while (1) {
49 char ch = getch();
50 if (ch == 'q' || ch == 'Q') break;
51 }
52
53 endwin();
54
55 return 0;
56}
57