Commit 205de4d1 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

removed unused function get_fnames()

parent 776dbec3
......@@ -198,115 +198,6 @@ static int _readline_(FILE *fp, char *line, int len)
return (1);
}
#define MAX_LINE 4096
static int get_fnames(const char *argument, char *fnames[], int max_fnames)
{
int num_fnames = 0;
int nfiles = 0;
const char *pch;
char line[MAX_LINE];
size_t len = strlen(argument);
char *colpos = strchr(argument, ':');
size_t i = colpos ? (size_t)(colpos - argument) : 0;
if ( i < len )
{
pch = &argument[i+1];
len -= (i+1);
if ( len && ( memcmp(argument, "filelist:", i) == 0 ||
memcmp(argument, "flist:", i) == 0 ) )
{
for ( i = 0; i < len; ++i ) if ( pch[i] == ',' ) nfiles++;
if ( nfiles == 0 )
{
FILE *fp;
fp = fopen(pch, "r");
if ( fp == NULL ) Error("Open failed on %s", pch);
if ( CDI_Debug )
Message("Reading file names from %s", pch);
rewind(fp);
nfiles = 0;
while ( _readline_(fp, line, MAX_LINE) )
{
if ( line[0] == '#' || line[0] == '\0' ||
line[0] == ' ' ) continue;
if ( nfiles >= max_fnames )
{
Warning("Too many input files (limit: %d)", max_fnames);
break;
}
fnames[nfiles] = strdupx(line);
nfiles++;
}
fclose(fp);
if ( nfiles == 0 ) Error("No input file found in %s", pch);
}
else
{
char xline[65536];
strcpy(xline, pch);
for ( i = 0; i < len; i++ ) if ( xline[i] == ',' ) xline[i] = 0;
nfiles++;
if ( nfiles >= max_fnames )
{
Warning("Too many input files (limit: %d)", max_fnames);
nfiles = max_fnames;
}
i = 0;
for ( int j = 0; j < nfiles; j++ )
{
fnames[j] = strdupx(&xline[i]);
i += strlen(&xline[i]) + 1;
}
}
}
else if ( len && memcmp(argument, "ls:", i) == 0 )
{
char command[4096];
FILE *pfp;
strcpy(command, "ls ");
strcat(command, pch);
pfp = popen(command, "r");
if ( pfp == NULL ) SysError("popen %s failed", command);
nfiles = 0;
while ( _readline_(pfp, line, MAX_LINE) )
{
if ( nfiles >= max_fnames )
{
Warning("Too many input files (limit: %d)", max_fnames);
break;
}
fnames[nfiles++] = strdupx(line);
}
pclose(pfp);
/*
for ( j = 0; j < nfiles; j++ )
fnames[j] = fnames[j];
*/
}
}
num_fnames = nfiles;
return (num_fnames);
}
/*
@Function streamInqFiletype
@Title Get the filetype
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment