Update internal.h to conditionally include asm/string.h
[oweals/busybox.git] / utility.c
index 07e540e221a12a96d37dc24e126cb6458671daab..b9c7a76cd30c4ab65c4b040a9bf375b33cdbd195 100644 (file)
--- a/utility.c
+++ b/utility.c
@@ -33,8 +33,8 @@
  || defined (BB_INSMOD)
 /* same conditions as recursiveAction */
 #define bb_need_name_too_long
-#define bb_need_memory_exhausted
 #endif
+#define bb_need_memory_exhausted
 #define BB_DECLARE_EXTERN
 #include "messages.c"
 
@@ -806,7 +806,7 @@ unsigned long my_getid(const char *filename, char *name, unsigned long id, unsig
 
        file = fopen(filename, "r");
        if (file == NULL) {
-               /* Do not complain.  It is ok for /etc/password and
+               /* Do not complain.  It is ok for /etc/passwd and
                 * friends to be missing... */
                return (-1);
        }
@@ -1056,7 +1056,7 @@ extern int replace_match(char *haystack, char *needle, char *newNeedle,
 #endif                                                 /* ! BB_REGEXP && (BB_GREP || BB_SED) */
 
 
-#if defined BB_FIND
+#if defined BB_FIND || defined BB_INSMOD
 /*
  * Routine to see if a text string is matched by a wildcard pattern.
  * Returns TRUE if the text is matched, or FALSE if it is not matched
@@ -1156,7 +1156,7 @@ extern int check_wildcard_match(const char *text, const char *pattern)
 
        return TRUE;
 }
-#endif                                                 /* BB_FIND */
+#endif                            /* BB_FIND || BB_INSMOD */
 
 
 
@@ -1573,7 +1573,7 @@ extern int find_real_root_device_name(char* name)
 }
 #endif
 
-const unsigned int CSTRING_BUFFER_LENGTH = 128;
+const unsigned int CSTRING_BUFFER_LENGTH = 1024;
 /* recursive parser that returns cstrings of arbitrary length
  * from a FILE* 
  */
@@ -1583,12 +1583,12 @@ cstring_alloc(FILE* f, int depth)
     char *cstring;
     char buffer[CSTRING_BUFFER_LENGTH];
     int         target = CSTRING_BUFFER_LENGTH * depth;
-    int  i, len;
-    int  size;
+    int  c, i, len, size;
 
     /* fill buffer */
     i = 0;
-    while ((buffer[i] = fgetc(f)) != EOF) {
+       while ((c = fgetc(f)) != EOF) {
+               buffer[i] = (char) c;
                if (buffer[i++] == 0x0a) { break; }
                if (i == CSTRING_BUFFER_LENGTH) { break; }
     }