The standard functions are better known and not harder to implement.
// Validity checks
if (buffer[0])
return 4;
- if (!streq((char*)&buffer[1], "CD001\001EL TORITO SPECIFICATION"))
+ if (strcmp((char*)&buffer[1], "CD001\001EL TORITO SPECIFICATION") != 0)
return 5;
// ok, now we calculate the Boot catalog address
struct cbfs_file *file;
for (file = cbfs_getfirst(); file; file = cbfs_getnext(file)) {
dprintf(3, "Found CBFS file %s\n", file->filename);
- if (streq(fname, file->filename))
+ if (strcmp(fname, file->filename) == 0)
return file;
}
return NULL;
struct cbfs_file *file;
for (file = cbfs_getfirst(); file; file = cbfs_getnext(file)) {
dprintf(3, "Found CBFS file %s\n", file->filename);
- if (memeq(prefix, file->filename, len)) {
+ if (memcmp(prefix, file->filename, len) == 0) {
if (n <= 0)
return file->filename;
n--;
// Compare two areas of memory.
int
-memeq(const void *s1, const void *s2, size_t n)
+memcmp(const void *s1, const void *s2, size_t n)
{
while (n) {
if (*(u8*)s1 != *(u8*)s2)
- return 0;
+ return *(u8*)s1 < *(u8*)s2 ? -1 : 1;
s1++;
s2++;
n--;
}
- return 1;
+ return 0;
}
// Compare two strings.
int
-streq(const char *s1, const char *s2)
+strcmp(const char *s1, const char *s2)
{
for (;;) {
if (*s1 != *s2)
- return 0;
+ return *s1 < *s2 ? -1 : 1;
if (! *s1)
- return 1;
+ return 0;
s1++;
s2++;
}
inline u32 stack_hop(u32 eax, u32 edx, u32 ecx, void *func);
u8 checksum_far(u16 buf_seg, void *buf_far, u32 len);
u8 checksum(void *buf, u32 len);
-int memeq(const void *s1, const void *s2, size_t n);
+int memcmp(const void *s1, const void *s2, size_t n);
size_t strlen(const char *s);
-int streq(const char *s1, const char *s2);
+int strcmp(const char *s1, const char *s2);
void *memset(void *s, int c, size_t n);
void *memcpy(void *d1, const void *s1, size_t len);
inline void memcpy_far(u16 d_seg, void *d_far