diff options
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/sort.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/coreutils/sort.c b/coreutils/sort.c index f2bc5335f..07d903388 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -160,17 +160,18 @@ static char *get_key(char *str, struct sort_key *key, int flags) | |||
160 | if (!j) start = end; | 160 | if (!j) start = end; |
161 | } | 161 | } |
162 | /* Strip leading whitespace if necessary */ | 162 | /* Strip leading whitespace if necessary */ |
163 | //XXX: skip_whitespace() | ||
164 | if (flags & FLAG_b) | 163 | if (flags & FLAG_b) |
164 | /* not using skip_whitespace() for speed */ | ||
165 | while (isspace(str[start])) start++; | 165 | while (isspace(str[start])) start++; |
166 | /* Strip trailing whitespace if necessary */ | 166 | /* Strip trailing whitespace if necessary */ |
167 | if (flags & FLAG_bb) | 167 | if (flags & FLAG_bb) |
168 | while (end > start && isspace(str[end-1])) end--; | 168 | while (end > start && isspace(str[end-1])) end--; |
169 | /* Handle offsets on start and end */ | 169 | /* -kSTART,N.ENDCHAR: honor ENDCHAR (1-based) */ |
170 | if (key->range[3]) { | 170 | if (key->range[3]) { |
171 | end += key->range[3] - 1; | 171 | end = key->range[3]; |
172 | if (end > len) end = len; | 172 | if (end > len) end = len; |
173 | } | 173 | } |
174 | /* -kN.STARTCHAR[,...]: honor STARTCHAR (1-based) */ | ||
174 | if (key->range[1]) { | 175 | if (key->range[1]) { |
175 | start += key->range[1] - 1; | 176 | start += key->range[1] - 1; |
176 | if (start > len) start = len; | 177 | if (start > len) start = len; |