diff options
author | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
---|---|---|
committer | Manuel Novoa III <mjn3@codepoet.org> | 2003-03-19 09:13:01 +0000 |
commit | cad5364599eb5062d59e0c397ed638ddd61a8d5d (patch) | |
tree | a318d0f03aa076c74b576ea45dc543a5669e8e91 /modutils/modprobe.c | |
parent | e01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff) | |
download | busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2 busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip |
Major coreutils update.
Diffstat (limited to 'modutils/modprobe.c')
-rw-r--r-- | modutils/modprobe.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index 99650ff03..154e66224 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
@@ -73,7 +73,7 @@ int parse_tag_value ( char *buffer, char **ptag, char **pvalue ) | |||
73 | *ptag = tag; | 73 | *ptag = tag; |
74 | *pvalue = value; | 74 | *pvalue = value; |
75 | 75 | ||
76 | return xstrlen( tag ) && xstrlen( value ); | 76 | return bb_strlen( tag ) && bb_strlen( value ); |
77 | } | 77 | } |
78 | 78 | ||
79 | /* Jump through hoops to simulate how fgets() grabs just one line at a | 79 | /* Jump through hoops to simulate how fgets() grabs just one line at a |
@@ -119,7 +119,7 @@ static struct dep_t *build_dep ( void ) | |||
119 | return 0; | 119 | return 0; |
120 | 120 | ||
121 | // check for buffer overflow in following code | 121 | // check for buffer overflow in following code |
122 | if ( xstrlen ( un.release ) > ( sizeof( buffer ) - 64 )) { | 122 | if ( bb_strlen ( un.release ) > ( sizeof( buffer ) - 64 )) { |
123 | return 0; | 123 | return 0; |
124 | } | 124 | } |
125 | 125 | ||
@@ -131,7 +131,7 @@ static struct dep_t *build_dep ( void ) | |||
131 | return 0; | 131 | return 0; |
132 | 132 | ||
133 | while ( reads ( fd, buffer, sizeof( buffer ))) { | 133 | while ( reads ( fd, buffer, sizeof( buffer ))) { |
134 | int l = xstrlen ( buffer ); | 134 | int l = bb_strlen ( buffer ); |
135 | char *p = 0; | 135 | char *p = 0; |
136 | 136 | ||
137 | while ( isspace ( buffer [l-1] )) { | 137 | while ( isspace ( buffer [l-1] )) { |
@@ -163,7 +163,7 @@ static struct dep_t *build_dep ( void ) | |||
163 | if (( *(col-2) == '.' ) && ( *(col-1) == 'o' )) | 163 | if (( *(col-2) == '.' ) && ( *(col-1) == 'o' )) |
164 | ext = 2; | 164 | ext = 2; |
165 | 165 | ||
166 | mod = xstrndup ( mods, col - mods - ext ); | 166 | mod = bb_xstrndup ( mods, col - mods - ext ); |
167 | 167 | ||
168 | if ( !current ) { | 168 | if ( !current ) { |
169 | first = current = (struct dep_t *) xmalloc ( sizeof ( struct dep_t )); | 169 | first = current = (struct dep_t *) xmalloc ( sizeof ( struct dep_t )); |
@@ -216,7 +216,7 @@ static struct dep_t *build_dep ( void ) | |||
216 | if ((end-deps-ext+1) <= 0) | 216 | if ((end-deps-ext+1) <= 0) |
217 | continue; | 217 | continue; |
218 | 218 | ||
219 | dep = xstrndup ( deps, end - deps - ext + 1 ); | 219 | dep = bb_xstrndup ( deps, end - deps - ext + 1 ); |
220 | 220 | ||
221 | current-> m_depcnt++; | 221 | current-> m_depcnt++; |
222 | current-> m_deparr = (char **) xrealloc ( current-> m_deparr, sizeof ( char *) * current-> m_depcnt ); | 222 | current-> m_deparr = (char **) xrealloc ( current-> m_deparr, sizeof ( char *) * current-> m_depcnt ); |
@@ -247,7 +247,7 @@ static struct dep_t *build_dep ( void ) | |||
247 | if ( p ) | 247 | if ( p ) |
248 | *p = 0; | 248 | *p = 0; |
249 | 249 | ||
250 | l = xstrlen ( buffer ); | 250 | l = bb_strlen ( buffer ); |
251 | 251 | ||
252 | while ( l && isspace ( buffer [l-1] )) { | 252 | while ( l && isspace ( buffer [l-1] )) { |
253 | buffer [l-1] = 0; | 253 | buffer [l-1] = 0; |
@@ -273,7 +273,7 @@ static struct dep_t *build_dep ( void ) | |||
273 | current-> m_next = (struct dep_t *) xmalloc ( sizeof ( struct dep_t )); | 273 | current-> m_next = (struct dep_t *) xmalloc ( sizeof ( struct dep_t )); |
274 | current = current-> m_next; | 274 | current = current-> m_next; |
275 | } | 275 | } |
276 | current-> m_module = xstrdup ( alias ); | 276 | current-> m_module = bb_xstrdup ( alias ); |
277 | current-> m_isalias = 1; | 277 | current-> m_isalias = 1; |
278 | 278 | ||
279 | if (( strcmp ( alias, "off" ) == 0 ) || ( strcmp ( alias, "null" ) == 0 )) { | 279 | if (( strcmp ( alias, "off" ) == 0 ) || ( strcmp ( alias, "null" ) == 0 )) { |
@@ -283,7 +283,7 @@ static struct dep_t *build_dep ( void ) | |||
283 | else { | 283 | else { |
284 | current-> m_depcnt = 1; | 284 | current-> m_depcnt = 1; |
285 | current-> m_deparr = xmalloc ( 1 * sizeof( char * )); | 285 | current-> m_deparr = xmalloc ( 1 * sizeof( char * )); |
286 | current-> m_deparr[0] = xstrdup ( mod ); | 286 | current-> m_deparr[0] = bb_xstrdup ( mod ); |
287 | } | 287 | } |
288 | current-> m_next = 0; | 288 | current-> m_next = 0; |
289 | } | 289 | } |
@@ -299,7 +299,7 @@ static struct dep_t *build_dep ( void ) | |||
299 | break; | 299 | break; |
300 | } | 300 | } |
301 | if ( dt ) { | 301 | if ( dt ) { |
302 | dt-> m_options = xrealloc ( dt-> m_options, xstrlen( opt ) + 1 ); | 302 | dt-> m_options = xrealloc ( dt-> m_options, bb_strlen( opt ) + 1 ); |
303 | strcpy ( dt-> m_options, opt ); | 303 | strcpy ( dt-> m_options, opt ); |
304 | 304 | ||
305 | // fprintf ( stderr, "OPTION: '%s' -> '%s'\n", dt-> m_module, dt-> m_options ); | 305 | // fprintf ( stderr, "OPTION: '%s' -> '%s'\n", dt-> m_module, dt-> m_options ); |
@@ -346,7 +346,7 @@ static void check_dep ( char *mod, struct mod_list_t **head, struct mod_list_t * | |||
346 | int lm; | 346 | int lm; |
347 | 347 | ||
348 | // remove .o extension | 348 | // remove .o extension |
349 | lm = xstrlen ( mod ); | 349 | lm = bb_strlen ( mod ); |
350 | if (( mod [lm-2] == '.' ) && ( mod [lm-1] == 'o' )) | 350 | if (( mod [lm-2] == '.' ) && ( mod [lm-1] == 'o' )) |
351 | mod [lm-2] = 0; | 351 | mod [lm-2] = 0; |
352 | 352 | ||
@@ -441,7 +441,7 @@ static int mod_insert ( char *mod, int argc, char **argv ) | |||
441 | 441 | ||
442 | // append module args | 442 | // append module args |
443 | for ( i = 0; i < argc; i++ ) | 443 | for ( i = 0; i < argc; i++ ) |
444 | l += ( xstrlen ( argv [i] ) + 1 ); | 444 | l += ( bb_strlen ( argv [i] ) + 1 ); |
445 | 445 | ||
446 | head-> m_options = xrealloc ( head-> m_options, l + 1 ); | 446 | head-> m_options = xrealloc ( head-> m_options, l + 1 ); |
447 | head-> m_options [0] = 0; | 447 | head-> m_options [0] = 0; |
@@ -494,7 +494,7 @@ extern int modprobe_main(int argc, char** argv) | |||
494 | break; | 494 | break; |
495 | case 'C': // no config used | 495 | case 'C': // no config used |
496 | case 't': // no pattern matching | 496 | case 't': // no pattern matching |
497 | error_msg_and_die("-t and -C not supported"); | 497 | bb_error_msg_and_die("-t and -C not supported"); |
498 | 498 | ||
499 | case 'a': // ignore | 499 | case 'a': // ignore |
500 | case 'd': // ignore | 500 | case 'd': // ignore |
@@ -519,7 +519,7 @@ extern int modprobe_main(int argc, char** argv) | |||
519 | break; | 519 | break; |
520 | case 'V': | 520 | case 'V': |
521 | default: | 521 | default: |
522 | show_usage(); | 522 | bb_show_usage(); |
523 | break; | 523 | break; |
524 | } | 524 | } |
525 | } | 525 | } |
@@ -527,21 +527,21 @@ extern int modprobe_main(int argc, char** argv) | |||
527 | depend = build_dep ( ); | 527 | depend = build_dep ( ); |
528 | 528 | ||
529 | if ( !depend ) | 529 | if ( !depend ) |
530 | error_msg_and_die ( "could not parse modules.dep\n" ); | 530 | bb_error_msg_and_die ( "could not parse modules.dep\n" ); |
531 | 531 | ||
532 | if (remove_opt) { | 532 | if (remove_opt) { |
533 | do { | 533 | do { |
534 | mod_remove ( optind < argc ? xstrdup ( argv [optind] ) : NULL ); | 534 | mod_remove ( optind < argc ? bb_xstrdup ( argv [optind] ) : NULL ); |
535 | } while ( ++optind < argc ); | 535 | } while ( ++optind < argc ); |
536 | 536 | ||
537 | return EXIT_SUCCESS; | 537 | return EXIT_SUCCESS; |
538 | } | 538 | } |
539 | 539 | ||
540 | if (optind >= argc) | 540 | if (optind >= argc) |
541 | error_msg_and_die ( "No module or pattern provided\n" ); | 541 | bb_error_msg_and_die ( "No module or pattern provided\n" ); |
542 | 542 | ||
543 | if ( mod_insert ( xstrdup ( argv [optind] ), argc - optind - 1, argv + optind + 1 )) | 543 | if ( mod_insert ( bb_xstrdup ( argv [optind] ), argc - optind - 1, argv + optind + 1 )) |
544 | error_msg_and_die ( "failed to load module %s", argv [optind] ); | 544 | bb_error_msg_and_die ( "failed to load module %s", argv [optind] ); |
545 | 545 | ||
546 | return EXIT_SUCCESS; | 546 | return EXIT_SUCCESS; |
547 | } | 547 | } |