diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-04-12 07:35:12 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-04-12 07:35:12 +0000 |
commit | cb44816ba32a3bbf598aab6d7cb1eabfd6619f5f (patch) | |
tree | 4459d66dd948b019c4a96730eea224f79520ad8c /libbb/opendir.c | |
parent | d0ea52ee041ca4d8d00cc5212d54328689b1a3c4 (diff) | |
download | busybox-w32-cb44816ba32a3bbf598aab6d7cb1eabfd6619f5f.tar.gz busybox-w32-cb44816ba32a3bbf598aab6d7cb1eabfd6619f5f.tar.bz2 busybox-w32-cb44816ba32a3bbf598aab6d7cb1eabfd6619f5f.zip |
- add and use bb_opendir(), bb_xopendir().
text data bss dec hex filename
889445 9392 1035784 1934621 1d851d busybox.gcc-4.2.orig
889297 9392 1035784 1934473 1d8489 busybox.gcc-4.2
889009 9820 1037860 1936689 1d8d31 busybox.gcc-4.1.orig
888817 9820 1037860 1936497 1d8c71 busybox.gcc-4.1
Diffstat (limited to 'libbb/opendir.c')
-rw-r--r-- | libbb/opendir.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libbb/opendir.c b/libbb/opendir.c new file mode 100644 index 000000000..e284db0db --- /dev/null +++ b/libbb/opendir.c | |||
@@ -0,0 +1,37 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * wrapper for opendir() | ||
4 | * | ||
5 | * Copyright (C) 2006 Bernhard Fischer <busybox@busybox.net> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | ||
8 | */ | ||
9 | |||
10 | #include <sys/types.h> | ||
11 | #include <dirent.h> | ||
12 | #include "libbb.h" | ||
13 | |||
14 | #ifdef L_bb_opendir | ||
15 | DIR *bb_opendir(const char *path) | ||
16 | { | ||
17 | DIR *dp; | ||
18 | |||
19 | if ((dp = opendir(path)) == NULL) { | ||
20 | bb_perror_msg("unable to open `%s'", path); | ||
21 | return NULL; | ||
22 | } | ||
23 | return dp; | ||
24 | } | ||
25 | #endif | ||
26 | |||
27 | #ifdef L_bb_xopendir | ||
28 | DIR *bb_xopendir(const char *path) | ||
29 | { | ||
30 | DIR *dp; | ||
31 | |||
32 | if ((dp = opendir(path)) == NULL) { | ||
33 | bb_perror_msg_and_die("unable to open `%s'", path); | ||
34 | } | ||
35 | return dp; | ||
36 | } | ||
37 | #endif | ||