diff options
author | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-09-23 16:01:09 +0000 |
---|---|---|
committer | vda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-09-23 16:01:09 +0000 |
commit | 21e2f957472d29731c5b970bd91bdab3ce15f835 (patch) | |
tree | 0961ae48901bd3defbcc6bbd5cd57bd90a3f849e /libbb | |
parent | 44940cc81c7e6daad4636ed0f7d4ac4f1bb173de (diff) | |
download | busybox-w32-21e2f957472d29731c5b970bd91bdab3ce15f835.tar.gz busybox-w32-21e2f957472d29731c5b970bd91bdab3ce15f835.tar.bz2 busybox-w32-21e2f957472d29731c5b970bd91bdab3ce15f835.zip |
remove unneeded #includes, fix indentation
git-svn-id: svn://busybox.net/trunk/busybox@16206 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/xgetcwd.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/libbb/xgetcwd.c b/libbb/xgetcwd.c index f6cfb34a7..0ac450d3b 100644 --- a/libbb/xgetcwd.c +++ b/libbb/xgetcwd.c | |||
@@ -7,11 +7,6 @@ | |||
7 | * Special function for busybox written by Vladimir Oleynik <dzo@simtreas.ru> | 7 | * Special function for busybox written by Vladimir Oleynik <dzo@simtreas.ru> |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <stdlib.h> | ||
11 | #include <errno.h> | ||
12 | #include <unistd.h> | ||
13 | #include <limits.h> | ||
14 | #include <sys/param.h> | ||
15 | #include "libbb.h" | 10 | #include "libbb.h" |
16 | 11 | ||
17 | /* Amount to increase buffer size by in each try. */ | 12 | /* Amount to increase buffer size by in each try. */ |
@@ -23,27 +18,27 @@ | |||
23 | */ | 18 | */ |
24 | 19 | ||
25 | char * | 20 | char * |
26 | xgetcwd (char *cwd) | 21 | xgetcwd(char *cwd) |
27 | { | 22 | { |
28 | char *ret; | 23 | char *ret; |
29 | unsigned path_max; | 24 | unsigned path_max; |
30 | 25 | ||
31 | path_max = (unsigned) PATH_MAX; | 26 | path_max = (unsigned) PATH_MAX; |
32 | path_max += 2; /* The getcwd docs say to do this. */ | 27 | path_max += 2; /* The getcwd docs say to do this. */ |
33 | 28 | ||
34 | if(cwd==0) | 29 | if (cwd==0) |
35 | cwd = xmalloc (path_max); | 30 | cwd = xmalloc(path_max); |
36 | 31 | ||
37 | while ((ret = getcwd (cwd, path_max)) == NULL && errno == ERANGE) { | 32 | while ((ret = getcwd(cwd, path_max)) == NULL && errno == ERANGE) { |
38 | path_max += PATH_INCR; | 33 | path_max += PATH_INCR; |
39 | cwd = xrealloc (cwd, path_max); | 34 | cwd = xrealloc(cwd, path_max); |
40 | } | 35 | } |
41 | 36 | ||
42 | if (ret == NULL) { | 37 | if (ret == NULL) { |
43 | free (cwd); | 38 | free(cwd); |
44 | bb_perror_msg("getcwd()"); | 39 | bb_perror_msg("getcwd"); |
45 | return NULL; | 40 | return NULL; |
46 | } | 41 | } |
47 | 42 | ||
48 | return cwd; | 43 | return cwd; |
49 | } | 44 | } |