I have a simple C++ program:
#include <iostream>
int main()
{
std::cout << "Hello\n";
return 0;
}
I was playing with "scratchbox" - cross compilation platform that I use in order to compile applications for ARM platform. I run it on my Nokia N900 phone.
While investigating some performance problems I noticed several calls to strcmp() in the beginning. I used "ltrace" to trace the library calls and when I run it on a target (my cell phone) a see series of calls to strcmp() which is now making me curious - what is the purpose of these calls?
20:06 user@MaemoBox:~$ ltrace test
__libc_start_main(61732, 1, 0xbed66634, 345616, 345612 <unfinished ...>
__errno_location() = 0x4001d3b0
strrchr("test", '/') = NULL
getuid() = 29999
bsearch("test", 0x00055966, 146, 1, 0x0000ed38 <unfinished ...>
strcmp("test", "mv") = 7
strcmp("test", "sort") = 1
strcmp("test", "tr") = -13
strcmp("test", "sysctl") = 1
strcmp("test", "test") = 0
<... bsearch resumed> ) = 0x000559e2