[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/support cmdline.c,1.10,1.11
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/support cmdline.c,1.10,1.11 |
Date: |
Mon, 16 Dec 2002 06:58:53 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv9732/support
Modified Files:
cmdline.c
Log Message:
Sort the results of a wildcard match.
Index: cmdline.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/cmdline.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** cmdline.c 16 Dec 2002 11:49:24 -0000 1.10
--- cmdline.c 16 Dec 2002 11:58:50 -0000 1.11
***************
*** 407,411 ****
ILDirEnt *entry;
int first;
! int sawMatch;
const char *name;
char *full;
--- 407,411 ----
ILDirEnt *entry;
int first;
! int firstArg;
const char *name;
char *full;
***************
*** 501,505 ****
/* Scan the directory for regular expression matches */
! sawMatch = 0;
dir = ILOpenDir(directory);
while(dir && (entry = ILReadDir(dir)) != 0)
--- 501,505 ----
/* Scan the directory for regular expression matches */
! firstArg = *argc;
dir = ILOpenDir(directory);
while(dir && (entry = ILReadDir(dir)) != 0)
***************
*** 509,513 ****
{
/* We have found a match against the regular expression
*/
- sawMatch = 1;
full = (char *)ILMalloc(strlen(directory) +
strlen(name) + 1);
if(!full)
--- 509,512 ----
***************
*** 529,536 ****
/* If we didn't find any matches, then add the wildcard specification
as an argument. The program will probably report "File not found",
! which is what we want it to do. */
! if(!sawMatch)
{
AddNewArg(argc, argv, maxArgc, value);
}
--- 528,552 ----
/* If we didn't find any matches, then add the wildcard specification
as an argument. The program will probably report "File not found",
! which is what we want it to do. Otherwise, sort the results */
! if(firstArg >= *argc)
{
AddNewArg(argc, argv, maxArgc, value);
+ }
+ else
+ {
+ int index1, index2;
+ char *temp;
+ for(index1 = firstArg; index1 < (*argc - 1); ++index1)
+ {
+ for(index2 = index1 + 1; index2 < *argc; ++index2)
+ {
+ if(ILStrICmp((*argv)[index1], (*argv)[index2])
> 0)
+ {
+ temp = (*argv)[index1];
+ (*argv)[index1] = (*argv)[index2];
+ (*argv)[index2] = temp;
+ }
+ }
+ }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/support cmdline.c,1.10,1.11,
Rhys Weatherley <address@hidden> <=