.\" Manpage for ulas.
.\" Contact lukas@krickl.dev to correct errors or typos.
-.TH man 8 "21 August 2023" "0.0.1" "ulas manual"
+.TH man 1 "21 August 2023" "0.0.1" "ulas manual"
.SH NAME
ulas
.SH SYNOPSIS
- ulas [-v] [--help] [--version]
+ ulas [-hvV]
.SH DESCRIPTION
ulas
- --help
+ -h
display this help and exit
- --version
+ -v
display version info and exit
-v, --verbose
verbose output
-
+
+.SH SYNTAX
+
+
+
.SH EXAMPLES
.SH SEE ALSO
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
-#define ULAS_COMMENT ';'
-
// Config variables
#define ULAS_CFG_FMT_GREEN "\x1B[32m"
#define ULAS_CFG_FMT_YELLOW "\x1B[33m"
#define ULAS_CFG_FMT_BLUE "\x1B[34m"
#define ULAS_CFG_FMT_RESET "\x1B[0m"
+// configurable tokens
+#define ULAS_TOK_COMMENT ';'
+#define ULAS_TOK_DIRECTIVE_BEGIN '#'
+
// format macros
#define ULAS_FMT(f, fmt) \
if (isatty(fileno(f)) && ulascfg.color) { \
#define ULAS_NAME "ulas"
#define ULAS_VER "0.0.1"
+// args without value
+#define ULAS_OPTS "hvV"
+
+// args with value
+#define ULAS_OPTS_ARG ""
+
+#define ULAS_HELP(a, desc) printf("\t%s\t%s\n", (a), desc);
+
void ulas_help(void) {
printf("%s\n", ULAS_NAME);
- printf("Usage %s [-h] [-V] [-v]\n\n", ULAS_NAME);
- printf("\t-h\tdisplay this help and exit\n");
- printf("\t-V\tdisplay version info and exit\n");
- printf("\t-v\tverbose output\n");
+ printf("Usage %s [-%s]\n\n", ULAS_NAME, ULAS_OPTS);
+ ULAS_HELP("-h", "display this help and exit");
+ ULAS_HELP("-V", "display version info and exit");
+ ULAS_HELP("-v", "verbose output");
}
void ulas_version(void) { printf("%s version %s\n", ULAS_NAME, ULAS_VER); }
void ulas_getopt(int argc, char **argv, struct ulas_config *cfg) {
int c = 0;
- while ((c = getopt(argc, argv, "hvV")) != -1) {
+ while ((c = getopt(argc, argv, ULAS_OPTS ULAS_OPTS_ARG)) != -1) {
switch (c) {
case 'h':
ulas_help();