Fixed segfault with 'cut -f 1 -d:' and added 'cut -s' suport.
[oweals/busybox.git] / utility.c
index c0dd98f74920644ea1207e1f61ab66fc17be3bd9..061ba64236ef15d54593ba7594f032e0ad543ab3 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"
 
@@ -131,6 +131,15 @@ extern int get_kernel_revision(void)
 }
 #endif                                                 /* BB_INIT */
 
+
+
+#if defined BB_FREE || defined BB_INIT || defined BB_UNAME || defined BB_UPTIME
+#include <sys/syscall.h>
+_syscall1(int, sysinfo, struct sysinfo *, info);
+#endif                                                 /* BB_INIT */
+
+
+
 #if defined (BB_CP_MV) || defined (BB_DU)
 
 #define HASH_SIZE      311             /* Should be prime */
@@ -1056,7 +1065,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 +1165,7 @@ extern int check_wildcard_match(const char *text, const char *pattern)
 
        return TRUE;
 }
-#endif                                                 /* BB_FIND */
+#endif                            /* BB_FIND || BB_INSMOD */
 
 
 
@@ -1189,6 +1198,9 @@ extern struct mntent *findMountPoint(const char *name, const char *table)
                return 0;
 
        while ((mountEntry = getmntent(mountTable)) != 0) {
+               if (strcmp(mountEntry->mnt_fsname, "none") == 0) {
+                       continue;
+               }
                if (strcmp(name, mountEntry->mnt_dir) == 0
                        || strcmp(name, mountEntry->mnt_fsname) == 0)   /* String match. */
                        break;
@@ -1573,7 +1585,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* 
  */