/* Returns kernel version encoded as major*65536 + minor*256 + patch,
* so, for example, to check if the kernel is greater than 2.2.11:
* if (get_kernel_revision() <= 2*65536+2*256+11) { <stuff> }
/* Returns kernel version encoded as major*65536 + minor*256 + patch,
* so, for example, to check if the kernel is greater than 2.2.11:
* if (get_kernel_revision() <= 2*65536+2*256+11) { <stuff> }
sscanf(name.version, "%d.%d.%d", &major, &minor, &patch);
return major * 65536 + minor * 256 + patch;
}
sscanf(name.version, "%d.%d.%d", &major, &minor, &patch);
return major * 65536 + minor * 256 + patch;
}
/*
* Copy one file to another, while possibly preserving its modes, times, and
* modes. Returns TRUE if successful, or FALSE on a failure with an error
/*
* Copy one file to another, while possibly preserving its modes, times, and
* modes. Returns TRUE if successful, or FALSE on a failure with an error
#define TYPEINDEX(mode) (((mode) >> 12) & 0x0f)
#define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)])
#define TYPEINDEX(mode) (((mode) >> 12) & 0x0f)
#define TYPECHAR(mode) ("0pcCd?bB-?l?s???" [TYPEINDEX(mode)])
/*
* Return the standard ls-like time string from a time_t
* This is static and so is overwritten on each call.
/*
* Return the standard ls-like time string from a time_t
* This is static and so is overwritten on each call.
/*
* Walk down all the directories under the specified
* location, and do something (something specified
/*
* Walk down all the directories under the specified
* location, and do something (something specified
/*
* Attempt to create the directories along the specified path, except for
* the final component. The mode is given for the final directory only,
/*
* Attempt to create the directories along the specified path, except for
* the final component. The mode is given for the final directory only,
/* This parses entries in /etc/passwd and /etc/group. This is desirable
* for BusyBox, since we want to avoid using the glibc NSS stuff, which
* increases target size and is often not needed or wanted for embedded
/* This parses entries in /etc/passwd and /etc/group. This is desirable
* for BusyBox, since we want to avoid using the glibc NSS stuff, which
* increases target size and is often not needed or wanted for embedded
-uid_t my_getid(const char *filename, char *name, uid_t id, gid_t *gid)
+unsigned long my_getid(const char *filename, char *name, unsigned long id, unsigned long *gid)
{
FILE *file;
char *rname, *start, *end, buf[128];
{
FILE *file;
char *rname, *start, *end, buf[128];
{
return my_getid("/etc/passwd", name, -1, NULL);
}
/* returns a gid given a group name */
{
return my_getid("/etc/passwd", name, -1, NULL);
}
/* returns a gid given a group name */
{
return my_getid("/etc/group", name, -1, NULL);
}
/* gets a username given a uid */
{
return my_getid("/etc/group", name, -1, NULL);
}
/* gets a username given a uid */
{
my_getid("/etc/passwd", name, uid, NULL);
}
/* gets a groupname given a gid */
{
my_getid("/etc/passwd", name, uid, NULL);
}
/* gets a groupname given a gid */
{
my_getid("/etc/group", group, gid, NULL);
}
/* gets a gid given a user name */
{
my_getid("/etc/group", group, gid, NULL);
}
/* gets a gid given a user name */
my_getid("/etc/passwd", name, -1, &gid);
return gid;
}
my_getid("/etc/passwd", name, -1, &gid);
return gid;
}
/* Do a case insensitive strstr() */
char *stristr(char *haystack, const char *needle)
{
/* Do a case insensitive strstr() */
char *stristr(char *haystack, const char *needle)
{
/*
* 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
/*
* 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
/* try to open up the specified device */
extern int device_open(char *device, int mode)
{
/* try to open up the specified device */
extern int device_open(char *device, int mode)
{
len = vsprintf(buf, format, ap);
return write(d, buf, len);
}
len = vsprintf(buf, format, ap);
return write(d, buf, len);
}
const unsigned int CSTRING_BUFFER_LENGTH = 128;
/* recursive parser that returns cstrings of arbitrary length
const unsigned int CSTRING_BUFFER_LENGTH = 128;
/* recursive parser that returns cstrings of arbitrary length