about summary refs log tree commit diff
path: root/Src/glob.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-01 09:39:44 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-01 09:39:44 +0000
commita1eca6d8eb801d7b2bf68384957e0bff5bfde226 (patch)
tree7b90dfc0c7f6d1a235f3bc53c90759217c0b9a04 /Src/glob.c
parent00464365490f4c6f77ba5e16d7992cb6bbefc693 (diff)
downloadzsh-a1eca6d8eb801d7b2bf68384957e0bff5bfde226.tar.gz
zsh-a1eca6d8eb801d7b2bf68384957e0bff5bfde226.tar.xz
zsh-a1eca6d8eb801d7b2bf68384957e0bff5bfde226.zip
zsh-users/2713
Diffstat (limited to 'Src/glob.c')
-rw-r--r--Src/glob.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Src/glob.c b/Src/glob.c
index d8cfc6a6a..f55d8ea69 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -139,6 +139,7 @@ struct globdata {
     int gd_qualct, gd_qualorct;
     int gd_range, gd_amc, gd_units;
     int gd_gf_nullglob, gd_gf_markdirs, gd_gf_noglobdots, gd_gf_listtypes;
+    int gd_gf_numsort;
     int gd_gf_follow, gd_gf_sorts, gd_gf_nsorts, gd_gf_sortlist[11];
 
     char *gd_glob_pre, *gd_glob_suf;
@@ -165,6 +166,7 @@ static struct globdata curglobdata;
 #define gf_markdirs   (curglobdata.gd_gf_markdirs)
 #define gf_noglobdots (curglobdata.gd_gf_noglobdots)
 #define gf_listtypes  (curglobdata.gd_gf_listtypes)
+#define gf_numsort    (curglobdata.gd_gf_numsort)
 #define gf_follow     (curglobdata.gd_gf_follow)
 #define gf_sorts      (curglobdata.gd_gf_sorts)
 #define gf_nsorts     (curglobdata.gd_gf_nsorts)
@@ -899,6 +901,7 @@ glob(LinkList list, LinkNode np)
     gf_markdirs = isset(MARKDIRS);
     gf_listtypes = gf_follow = 0;
     gf_noglobdots = unset(GLOBDOTS);
+    gf_numsort = isset(NUMERICGLOBSORT);
     gf_sorts = gf_nsorts = 0;
 
     /* Check for qualifiers */
@@ -1176,6 +1179,10 @@ glob(LinkList list, LinkNode np)
 			/* Glob dots: match leading dots implicitly */
 			gf_noglobdots = sense & 1;
 			break;
+		    case 'n':
+			/* Numeric glob sort */
+			gf_numsort = !(sense & 1);
+			break;
 		    case 'a':
 			/* Access time in given range */
 			g_amc = 0;
@@ -1413,7 +1420,7 @@ notstrcmp(char **a, char **b)
 #ifndef HAVE_STRCOLL
     cmp = (int)STOUC(*c) - (int)STOUC(*d);
 #endif
-    if (isset(NUMERICGLOBSORT) && (idigit(*c) || idigit(*d))) {
+    if (gf_numsort && (idigit(*c) || idigit(*d))) {
 	for (; c > *b && idigit(c[-1]); c--, d--);
 	if (idigit(*c) && idigit(*d)) {
 	    while (*c == '0')