3 * Copyright © 2001 Novell, Inc. All Rights Reserved.
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
11 * FILENAME : nwplglob.c
12 * DESCRIPTION : Perl globbing support for NetWare. Other platforms have usually lauched
13 * a separate executable for this in order to take advantage of their
14 * shell's capability for generating a list of files from a given
15 * wildcard file spec. On NetWare, we don't have that luxury.
16 * So we just hack the support into pipe open support (which we also had to hack).
18 * Date : January 2001.
33 /*============================================================================================
35 Function : fnDoPerlGlob
37 Description : Perl globbing support: Takes an array of wildcard descriptors
38 and produces from it a list of files that the wildcards expand into.
39 The list of files is written to the temporary file named by fileName.
41 Parameters : argv (IN) - Input argument vector.
42 fileName (IN) - Input file name for storing globed file names.
46 ==============================================================================================*/
48 void fnDoPerlGlob(char** argv, char* fileName)
50 FILE * redirOut = NULL;
57 redirOut = fopen((const char *)fileName, (const char *)"w");
69 dir = opendir((const char *)pattern);
73 /* find the last separator in pattern, NetWare has three: /\: */
74 while (fil = readdir(dir))
76 // The below displays the files separated by tab character.
77 // Also, it displays only the file names and not directories.
78 // If any other format is desired, it needs to be done here.
79 fprintf(redirOut, "%s\t", fil->d_name);