diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-08-03 15:41:12 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-08-03 15:41:12 +0000 |
commit | 5e2a5391f9142bca773aab4c829615895b69a6b7 (patch) | |
tree | e4a2769349867c441cf2983d83097bb66701a733 /coreutils/sort.c | |
parent | e883e03918a0e26e390ea23996abdb8fc1925f88 (diff) | |
download | busybox-w32-5e2a5391f9142bca773aab4c829615895b69a6b7.tar.gz busybox-w32-5e2a5391f9142bca773aab4c829615895b69a6b7.tar.bz2 busybox-w32-5e2a5391f9142bca773aab4c829615895b69a6b7.zip |
Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes... General cleanup pass. What I've
been doing for the last couple days.
And it conflicts! I've removed httpd.c from this checkin due to somebody else
touching that file. It builds for me. I have to catch a bus. (Now you know
why I'm looking forward to Mercurial.)
git-svn-id: svn://busybox.net/trunk/busybox@15767 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils/sort.c')
-rw-r--r-- | coreutils/sort.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/coreutils/sort.c b/coreutils/sort.c index 3354385a4..195e13d13 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -12,13 +12,6 @@ | |||
12 | * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html | 12 | * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <ctype.h> | ||
16 | #include <math.h> | ||
17 | #include <stdio.h> | ||
18 | #include <stdlib.h> | ||
19 | #include <string.h> | ||
20 | #include <time.h> | ||
21 | #include <unistd.h> | ||
22 | #include "busybox.h" | 15 | #include "busybox.h" |
23 | 16 | ||
24 | static int global_flags; | 17 | static int global_flags; |
@@ -104,7 +97,7 @@ static char *get_key(char *str, struct sort_key *key, int flags) | |||
104 | } | 97 | } |
105 | /* Make the copy */ | 98 | /* Make the copy */ |
106 | if(end<start) end=start; | 99 | if(end<start) end=start; |
107 | str=bb_xstrndup(str+start,end-start); | 100 | str=xstrndup(str+start,end-start); |
108 | /* Handle -d */ | 101 | /* Handle -d */ |
109 | if(flags&FLAG_d) { | 102 | if(flags&FLAG_d) { |
110 | for(start=end=0;str[end];end++) | 103 | for(start=end=0;str[end];end++) |
@@ -222,7 +215,6 @@ static int compare_keys(const void *xarg, const void *yarg) | |||
222 | /* Perform fallback sort if necessary */ | 215 | /* Perform fallback sort if necessary */ |
223 | if(!retval && !(global_flags&FLAG_s)) | 216 | if(!retval && !(global_flags&FLAG_s)) |
224 | retval=strcmp(*(char **)xarg, *(char **)yarg); | 217 | retval=strcmp(*(char **)xarg, *(char **)yarg); |
225 | //dprintf(2,"reverse=%d\n",flags&FLAG_r); | ||
226 | return ((flags&FLAG_r)?-1:1)*retval; | 218 | return ((flags&FLAG_r)?-1:1)*retval; |
227 | } | 219 | } |
228 | 220 | ||
@@ -242,7 +234,7 @@ int sort_main(int argc, char **argv) | |||
242 | #ifdef CONFIG_FEATURE_SORT_BIG | 234 | #ifdef CONFIG_FEATURE_SORT_BIG |
243 | case 'o': | 235 | case 'o': |
244 | if(outfile) bb_error_msg_and_die("Too many -o."); | 236 | if(outfile) bb_error_msg_and_die("Too many -o."); |
245 | outfile=bb_xfopen(optarg,"w"); | 237 | outfile=xfopen(optarg,"w"); |
246 | break; | 238 | break; |
247 | case 't': | 239 | case 't': |
248 | if(key_separator || optarg[1]) | 240 | if(key_separator || optarg[1]) |
@@ -289,7 +281,7 @@ int sort_main(int argc, char **argv) | |||
289 | /* Open input files and read data */ | 281 | /* Open input files and read data */ |
290 | for(i=argv[optind] ? optind : optind-1;argv[i];i++) { | 282 | for(i=argv[optind] ? optind : optind-1;argv[i];i++) { |
291 | if(i<optind || (*argv[i]=='-' && !argv[i][1])) fp=stdin; | 283 | if(i<optind || (*argv[i]=='-' && !argv[i][1])) fp=stdin; |
292 | else fp=bb_xfopen(argv[i],"r"); | 284 | else fp=xfopen(argv[i],"r"); |
293 | for(;;) { | 285 | for(;;) { |
294 | line=GET_LINE(fp); | 286 | line=GET_LINE(fp); |
295 | if(!line) break; | 287 | if(!line) break; |