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

int main() {
    glob_t globbuf;

    globbuf.gl_offs = 2;
    glob("*.c", GLOB_DOOFFS, NULL, &globbuf); 
    glob("./*.c", GLOB_DOOFFS | GLOB_APPEND, NULL, &globbuf);
    printf("globbuf.gl_pathc = %d\n", globbuf.gl_pathc);
    printf("globbuf.gl_pathv = %p\n", globbuf.gl_pathv);
    printf("globbuf.gl_pathv[0] = %p\n", globbuf.gl_pathv[0]);
    printf("globbuf.gl_pathv[1] = %p\n", globbuf.gl_pathv[1]);
/*
    printf("globbuf.gl_pathv[0] = %s\n", globbuf.gl_pathv[0]);
    printf("globbuf.gl_pathv[1] = %s\n", globbuf.gl_pathv[1]);
*/
    printf("globbuf.gl_pathv[2] = %s\n", globbuf.gl_pathv[2]);
    printf("globbuf.gl_pathv[3] = %s\n", globbuf.gl_pathv[3]);
    printf("globbuf.gl_pathv[4] = %s\n", globbuf.gl_pathv[4]);
    printf("globbuf.gl_pathv[5] = %s\n", globbuf.gl_pathv[5]);
    printf("globbuf.gl_pathv[6] = %s\n", globbuf.gl_pathv[6]);
    printf("globbuf.gl_pathv[7] = %s\n", globbuf.gl_pathv[7]);
    globbuf.gl_pathv[0] = "ls";
    globbuf.gl_pathv[1] = "-F";
    execvp("ls", &globbuf.gl_pathv[0]);
    printf("This will not be reached\n");
    globfree(&globbuf);
}
