view th_args.h @ 100:ed4067c10a8a

Remove useless buffer usage from error reporting function.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 17 Nov 2009 23:09:10 +0200
parents 69aed051f84d
children 59992d930e70
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 */