/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#include <stdio.h>
#include <ssdef.h>
#include <rmsdef.h>
#include <descrip.h>
#include <string.h>

int lib$find_file();
int lib$find_file_end();

main()
{
   int context = 0;
   int status;
   char *s;
   char find[]="*.c";
   $DESCRIPTOR(finddesc,find);
   char result[255];
   $DESCRIPTOR(resultdesc,result);
   do {
      status = lib$find_file(&finddesc,&resultdesc,&context,0,0,0,0);
      if (status == RMS$_NORMAL) {
         s = strchr(result,' ');
         *s = '\0';
         printf("%s\n",result);
      };
   } while (status == RMS$_NORMAL);
   lib$find_file_end(&context);
   return SS$_NORMAL;
}
