diff options
| author | Eric Andersen <andersen@codepoet.org> | 2004-01-06 00:07:17 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2004-01-06 00:07:17 +0000 |
| commit | 9d65ab2beb0e418510a42f6802cf6daa1d7a2106 (patch) | |
| tree | 583114d16b4d9a228fc624249eefd32b809868b0 /modutils | |
| parent | 66e21fd1616daefa903aeeb4d42e9ca50e4032ab (diff) | |
| download | busybox-w32-9d65ab2beb0e418510a42f6802cf6daa1d7a2106.tar.gz busybox-w32-9d65ab2beb0e418510a42f6802cf6daa1d7a2106.tar.bz2 busybox-w32-9d65ab2beb0e418510a42f6802cf6daa1d7a2106.zip | |
Woody Suwalski writes:
accept more then 1 dependency per modules.dep line. Also white space cleanup...
I think that parsing still breaks sometimes, but is mostly functional now.
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/modprobe.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index e300c0d2b..1e4d24e0d 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
| @@ -197,7 +197,6 @@ static struct dep_t *build_dep ( void ) | |||
| 197 | current-> m_next = 0; | 197 | current-> m_next = 0; |
| 198 | 198 | ||
| 199 | //printf ( "%s:\n", mod ); | 199 | //printf ( "%s:\n", mod ); |
| 200 | |||
| 201 | p = col + 1; | 200 | p = col + 1; |
| 202 | } | 201 | } |
| 203 | else | 202 | else |
| @@ -206,15 +205,30 @@ static struct dep_t *build_dep ( void ) | |||
| 206 | else | 205 | else |
| 207 | p = buffer; | 206 | p = buffer; |
| 208 | 207 | ||
| 208 | while ( p && *p && isblank(*p)) | ||
| 209 | p++; | ||
| 210 | |||
| 209 | if ( p && *p ) { | 211 | if ( p && *p ) { |
| 210 | char *end = &buffer [l-1]; | 212 | char *end = &buffer [l-1]; |
| 211 | char *deps = strrchr ( end, '/' ); | 213 | char *deps; |
| 212 | char *dep; | 214 | char *dep; |
| 215 | char *next; | ||
| 213 | int ext = 0; | 216 | int ext = 0; |
| 214 | 217 | ||
| 215 | while ( isblank ( *end ) || ( *end == '\\' )) | 218 | while ( isblank ( *end ) || ( *end == '\\' )) |
| 216 | end--; | 219 | end--; |
| 217 | 220 | ||
| 221 | do | ||
| 222 | { | ||
| 223 | next = strchr (p, ' ' ); | ||
| 224 | if (next) | ||
| 225 | { | ||
| 226 | *next = 0; | ||
| 227 | next--; | ||
| 228 | } | ||
| 229 | else | ||
| 230 | next = end; | ||
| 231 | |||
| 218 | deps = strrchr ( p, '/' ); | 232 | deps = strrchr ( p, '/' ); |
| 219 | 233 | ||
| 220 | if ( !deps || ( deps < p )) { | 234 | if ( !deps || ( deps < p )) { |
| @@ -227,25 +241,25 @@ static struct dep_t *build_dep ( void ) | |||
| 227 | deps++; | 241 | deps++; |
| 228 | 242 | ||
| 229 | #if defined(CONFIG_FEATURE_2_6_MODULES) | 243 | #if defined(CONFIG_FEATURE_2_6_MODULES) |
| 230 | if ((k_version > 4) && ( *(end-2) == '.' ) && *(end-1) == 'k' && | 244 | if ((k_version > 4) && ( *(next-2) == '.' ) && *(next-1) == 'k' && |
| 231 | ( *end == 'o' )) | 245 | ( *next == 'o' )) |
| 232 | ext = 3; | 246 | ext = 3; |
| 233 | else | 247 | else |
| 234 | #endif | 248 | #endif |
| 235 | if (( *(end-1) == '.' ) && ( *end == 'o' )) | 249 | if (( *(next-1) == '.' ) && ( *next == 'o' )) |
| 236 | ext = 2; | 250 | ext = 2; |
| 237 | 251 | ||
| 238 | /* Cope with blank lines */ | 252 | /* Cope with blank lines */ |
| 239 | if ((end-deps-ext+1) <= 0) | 253 | if ((next-deps-ext+1) <= 0) |
| 240 | continue; | 254 | continue; |
| 241 | 255 | dep = bb_xstrndup ( deps, next - deps - ext + 1 ); | |
| 242 | dep = bb_xstrndup ( deps, end - deps - ext + 1 ); | ||
| 243 | 256 | ||
| 244 | current-> m_depcnt++; | 257 | current-> m_depcnt++; |
| 245 | current-> m_deparr = (char **) xrealloc ( current-> m_deparr, sizeof ( char *) * current-> m_depcnt ); | 258 | current-> m_deparr = (char **) xrealloc ( current-> m_deparr, sizeof ( char *) * current-> m_depcnt ); |
| 246 | current-> m_deparr [current-> m_depcnt - 1] = dep; | 259 | current-> m_deparr [current-> m_depcnt - 1] = dep; |
| 247 | 260 | ||
| 248 | //printf ( " %d) %s\n", current-> m_depcnt, current-> m_deparr [current-> m_depcnt -1] ); | 261 | //printf ( " %d) %s\n", current-> m_depcnt, current-> m_deparr [current-> m_depcnt -1] ); |
| 262 | } while (next < end); | ||
| 249 | } | 263 | } |
| 250 | 264 | ||
| 251 | if ( buffer [l-1] == '\\' ) | 265 | if ( buffer [l-1] == '\\' ) |
