view th_args.h @ 322:b9c15c57dc8f

Clean up message functions, add new printMsgQ() helper function for messages that should not go into the log file. Add skeleton help function, accessible via F1 key. And other cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 11 Jun 2011 09:48:26 +0300
parents 59992d930e70
children
line wrap: on
line source

/*
 * Simple commandline argument processing function
 * Programmed and designed by Matti 'ccr' Hamalainen
 * (C) Copyright 2002-2008 Tecnic Software productions (TNSP)
 *
 * Please read file 'COPYING' for information on license and distribution.
 */
#ifndef _TH_ARGS
#define _TH_ARGS

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include "th_util.h"


/* Option flags
 */
#define OPT_NONE       (0)    /* Simple option with no arguments */
#define OPT_ARGREQ     (1)    /* Option's argument is required */
#define OPT_ARGOPT     (3)    /* Option's argument is optional */
#define OPT_ARGMASK    (3)    /* Mask for option argument flags */
#define OPT_REQUIRED   (4)    /* This option is required to be given */


typedef struct {
    int optID;
    char optShort;
    char *optLong;
    char *optDesc;
    int optFlags;
} optarg_t;


BOOL th_args_process(int argc, char *argv[],
     optarg_t argList[], int argListN,
     BOOL (*handleOpt)(int, char *, char *),
     BOOL (*handleFile)(char *), BOOL);

void th_args_help(FILE *, optarg_t optList[], int optListN, char *, char *);

#ifdef __cplusplus
}
#endif
#endif /* _TH_ARGS */