IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 29, 2006, 10:39:56 AM (20 years ago)
Author:
magnier
Message:

added comma-separated filenames

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/config/pmConfig.c

    r7709 r7754  
    33 *  @author PAP, IfA
    44 *
    5  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-06-28 00:49:13 $
     5 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-06-29 20:39:56 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    824824    input->n = 0;
    825825
    826     // load the list of filenames the supplied file (may be a glob: "file*.fits")
     826    // load the list of filenames the supplied file
     827    // maybe a comma-separated list of words
     828    // each word may be a glob: "file*.fits"
    827829    if ((Narg = psArgumentGet (config->argc, config->argv, file))) {
     830
     831        // select the word after 'file' and split by comma
     832        psArgumentRemove (Narg, &config->argc, config->argv);
     833        psArray *words = psStringSplitArray (config->argv[Narg], ",", true);
     834        psArgumentRemove (Narg, &config->argc, config->argv);
     835
     836        // parse the word as a glob
    828837        glob_t globList;
    829         psArgumentRemove (Narg, &config->argc, config->argv);
    830         globList.gl_offs = 0;
    831         glob (config->argv[Narg], 0, NULL, &globList);
    832 
    833         if (globList.gl_pathc == 0) {
    834             psError(PS_ERR_IO, true, "No match for %s", config->argv[Narg]);
    835             return input;
    836         }
    837 
    838         for (int i = 0; i < globList.gl_pathc; i++) {
    839             char *filename = psStringCopy (globList.gl_pathv[i]);
    840             psArrayAdd (input, 16, filename);
    841             psFree (filename);
    842         }
    843         psArgumentRemove (Narg, &config->argc, config->argv);
     838        for (int i = 0; i < words->n; i++) {
     839            globList.gl_offs = 0;
     840            glob (words->data[i], 0, NULL, &globList);
     841
     842            if (globList.gl_pathc == 0) {
     843                psError(PS_ERR_IO, true, "No match for %s", words->data[i]);
     844                return input;
     845            }
     846
     847            for (int j = 0; j < globList.gl_pathc; j++) {
     848                char *filename = psStringCopy (globList.gl_pathv[j]);
     849                psArrayAdd (input, 16, filename);
     850                psFree (filename);
     851            }
     852        }
     853        psFree (words);
    844854    }
    845855
Note: See TracChangeset for help on using the changeset viewer.