diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-26 12:19:35 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-05-26 12:19:35 +0000 |
commit | 423465cd5e673ce3561d420e6655e34dfe2a4ebd (patch) | |
tree | 5ff76bd5d855b5168d7aea686941105287ec25e3 | |
parent | 55e547eb6fad0d3ced00a62f04160016d90baabe (diff) | |
download | busybox-w32-423465cd5e673ce3561d420e6655e34dfe2a4ebd.tar.gz busybox-w32-423465cd5e673ce3561d420e6655e34dfe2a4ebd.tar.bz2 busybox-w32-423465cd5e673ce3561d420e6655e34dfe2a4ebd.zip |
- switch to FILE base writer and remove now unneeded stuff. -50b
-rw-r--r-- | modutils/depmod.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/modutils/depmod.c b/modutils/depmod.c index 9131dc1ab..903b073f8 100644 --- a/modutils/depmod.c +++ b/modutils/depmod.c | |||
@@ -37,11 +37,10 @@ static int fileAction(const char *fname, struct stat ATTRIBUTE_UNUSED *sb, | |||
37 | 37 | ||
38 | memset(buf1, 0, sizeof(buf1)); | 38 | memset(buf1, 0, sizeof(buf1)); |
39 | memset(depends, 0, sizeof(depends)); | 39 | memset(depends, 0, sizeof(depends)); |
40 | sprintf(buf1, "\n%s:", fname); | ||
41 | 40 | ||
42 | if (last_char_is(fname, 'o') == NULL) /* not a module */ | 41 | if (last_char_is(fname, 'o') == NULL) /* not a module */ |
43 | goto done; | 42 | goto done; |
44 | write((int)data, buf1, strlen(buf1)); | 43 | fprintf((FILE*)data, "\n%s:", fname); |
45 | //bb_info_msg("[%d] fname='%s'", (int)data, fname); | 44 | //bb_info_msg("[%d] fname='%s'", (int)data, fname); |
46 | do { | 45 | do { |
47 | /* search for a 'd' */ | 46 | /* search for a 'd' */ |
@@ -69,11 +68,8 @@ static int fileAction(const char *fname, struct stat ATTRIBUTE_UNUSED *sb, | |||
69 | _lst = _lst->link; | 68 | _lst = _lst->link; |
70 | } | 69 | } |
71 | if (_lst && _lst->data) { | 70 | if (_lst && _lst->data) { |
72 | const char separator = ' '; | ||
73 | //bb_info_msg("[%s] -> '%s'", deps, _lst->data); | 71 | //bb_info_msg("[%s] -> '%s'", deps, _lst->data); |
74 | write((int)data, &separator, 1); | 72 | fprintf((FILE*)data, " %s", _lst->data); |
75 | write((int)data, _lst->data, strlen(_lst->data)); | ||
76 | |||
77 | deps += len; | 73 | deps += len; |
78 | } | 74 | } |
79 | } | 75 | } |
@@ -89,9 +85,8 @@ int depmod_main(int ATTRIBUTE_UNUSED argc, char **argv) | |||
89 | { | 85 | { |
90 | int retval = EXIT_SUCCESS; | 86 | int retval = EXIT_SUCCESS; |
91 | // static const char moddir_base[] ALIGN1 = "/lib/modules/%s"; | 87 | // static const char moddir_base[] ALIGN1 = "/lib/modules/%s"; |
88 | FILE *filedes = xfopen("/tmp/modules.dep", "w"); | ||
92 | 89 | ||
93 | int fd = xopen3("/tmp/modules.dep", O_CREAT|O_WRONLY|O_TRUNC, | ||
94 | S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH); | ||
95 | argv++; | 90 | argv++; |
96 | do { | 91 | do { |
97 | if (!recursive_action(*argv, | 92 | if (!recursive_action(*argv, |
@@ -104,13 +99,13 @@ int depmod_main(int ATTRIBUTE_UNUSED argc, char **argv) | |||
104 | ACTION_RECURSE, /* flags */ | 99 | ACTION_RECURSE, /* flags */ |
105 | fileAction, /* file action */ | 100 | fileAction, /* file action */ |
106 | NULL, /* dir action */ | 101 | NULL, /* dir action */ |
107 | (void*)fd, /* user data */ | 102 | (void*)filedes, /* user data */ |
108 | 0)) { /* depth */ | 103 | 0)) { /* depth */ |
109 | retval = EXIT_FAILURE; | 104 | retval = EXIT_FAILURE; |
110 | } | 105 | } |
111 | } while (*++argv); | 106 | } while (*++argv); |
112 | 107 | ||
113 | if (ENABLE_FEATURE_CLEAN_UP) | 108 | if (ENABLE_FEATURE_CLEAN_UP) |
114 | close(fd); | 109 | fclose(filedes); |
115 | return retval; | 110 | return retval; |
116 | } | 111 | } |