Source

clia / clia.h

Full commit
/*
    clia.h
    Copyright 2012 Sulaiman Mustafa <seininn@hush.com>
    License: GPLv3 (Contact me for a possible alternative license)
    Webpage: people.sigh.asia/~sulaiman/software/libraries/clia
*/

#ifndef CLIA_H
#define CLIA_H

int clia_add(char *long_option, char *short_option);
/*
    Adds options for the parser to look for.
    
    Parameters:
        
        long_option     the long option name
        short_option    the short one

    Returns:
        
        0 on success and 1 if out of memory.
*/


int clia_parse(int argc, char **argv);
/*
    Parses the comandline options.
    
    Parameters:
        
        argc            --self explanatory--
        argv            --self explanatory--
    
    Returns:
        
        0 on sucess or the index of the first undefined option found.

*/

int clia_get(char *long_option, char *resource); 
/*
    Gets information about the argument once parsed.
    
    Parameters:
        
        long_option     the registered long option name
        resource        what type information, which can be ether "index" or 
                        "count"
    Resources:
        
        The resources returned can be ether the index of the option itself, or 
        the number of normal arguments that come after it and before the next 
        option, i.e the option's arguments.
        
        Requesting the option index is done by passing "index", and requesting
        the option argument count is done by passing "count".
    
    Returns:
        
        the index of the option or 0 if not found.
*/


void clia_clear();
/*
    clear all data generated and release allocated memory.
*/


#endif