From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- pkg/system/files.x | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 pkg/system/files.x (limited to 'pkg/system/files.x') diff --git a/pkg/system/files.x b/pkg/system/files.x new file mode 100644 index 00000000..9bd94f91 --- /dev/null +++ b/pkg/system/files.x @@ -0,0 +1,32 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +# FILES -- Expand a file name template into a list of file names on the +# standard output. + +procedure t_files() + +int list +pointer sp, template, fname + +bool clgetb() +int fntopnb(), fntgfnb(), clgeti(), btoi() + +begin + call smark (sp) + call salloc (fname, SZ_FNAME, TY_CHAR) + call salloc (template, SZ_LINE, TY_CHAR) + + if (clgeti ("$nargs") > 0) + call clgstr ("template", Memc[template], SZ_LINE) + else + call strcpy ("*", Memc[template], SZ_LINE) + + list = fntopnb (Memc[template], btoi(clgetb("sort"))) + while (fntgfnb (list, Memc[fname], SZ_FNAME) != EOF) { + call printf ("%s\n") + call pargstr (Memc[fname]) + } + + call fntclsb (list) + call sfree (sp) +end -- cgit