/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
/* This is an example of the function regerror(int,const regex_t,char, size_t). 
   If an error has occured, the function will return the size of the buffer 
   needed to store the error message into "errbuf".  "errbuf" contains the error   message.
*/
#include <regex.h>

int main() {
    regex_t preg;        
    int errcode, cflags;
    char errbuf[100], *pattern;
    size_t errbuf_size, retval;
    pattern = "abcd"; 
    cflags = REG_ICASE; 
    errbuf_size = 100;

    errcode = regcomp(&preg, pattern, cflags);
    if(errcode !=0) {
	retval = regerror(errcode, &preg, errbuf, errbuf_size);
    	printf("error = %s\n", errbuf);
    }
    else
	printf("Success\n");
}

