view src/dmargs.h @ 1554:7ed25973dbcb

Add some missing includes.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 13 May 2018 05:28:51 +0300
parents 27949209238b
children ddec147d1f90
line wrap: on
line source

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

#include "dmlib.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Option flags
 */
#define OPT_NONE             (0)    // Simple option with no arguments
#define OPT_ARGREQ           (1)    // Option requires an argument
#define OPT_ARGMASK          (1)    // Mask for option argument flags

#define OPTH_BAILOUT         0x0001 // Bail out on errors
#define OPTH_ONLY_OPTS       0x0010 // Handle only options
#define OPTH_ONLY_OTHER      0x0020 // Handle only "non-options"
#define OPTH_ONLY_MASK       0x00f0 // Mask


/* Option argument structure
 */
typedef struct
{
    int id;
    char optShort;
    char *optLong;
    char *desc;
    int flags;
} DMOptArg;


BOOL dmArgsProcess(int argc, char *argv[],
     const DMOptArg optList[], int noptList,
     BOOL (*handleOptionCB)(int, char *, char *),
     BOOL (*handleFileCB)(char *), BOOL);

void dmArgsPrintHelp(FILE *,
     const DMOptArg optList[],
     const int noptList,
     const int flags);


#ifdef __cplusplus
}
#endif
#endif // DMARGS_H