/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
#include <stdio.h>
#include <libgen.h>

int main()
{
  char *comp_form, *rst;
  char *txt1 = "Test", *txt2 = "ing", *txt3 = "abTestingcdefg";

/*
  regcmp() compiles a regular expression consisting of txt1 and txt2
  and gets the compiled form comp_form.
*/
  if( !(comp_form = regcmp(txt1, txt2, NULL))) {
    printf ("Error with regcmp(%s)\n", txt1);
    exit(1);
  }
  printf("\nThe expression consists of  \"%s\" and \"%s\", it's compiled form is \" %s\".\n\n", txt1, txt2, comp_form); 


/*
  regex() executes a compiled pattern comp_form against the subject
  string txt3 and gets the result rst.
*/
  rst = regex(comp_form, txt3);
  printf("Executing \"%s\" against \"%s\" gets \"%s\".\n\n", comp_form, txt3, rst);
  printf("__loc1 == %p\n", __loc1);
  printf("__loc1 == %s\n", __loc1);
}
