Bruno Haible <[EMAIL PROTECTED]> writes: > - You can bury the 'memcmp' module. It's not needed by ANSI C systems, > and gnulib assumes ANSI C for ca. 2 years already.
I think we're assuming freestanding C89 or better, right? memcmp is required for hosted C89, but not for freestanding. It's no big deal, but since the code already uses strncmp, I think the objection about brain cycles being wasted has less force than usual. For many people at least, I expect it'll take more brain cycles to read code that uses both strncmp and memcmp than to read code that uses only strncmp. That being said, I do have a bit of trouble reading the code, though. It doesn't seem to match the comment: e.g., it strips a leading "lt-" even when there's no "/.libs/". How about if we change this: const char *slash; const char *base; slash = strrchr (argv0, '/'); base = (slash != NULL ? slash + 1 : argv0); if (base - argv0 >= 7 && strncmp (base - 7, "/.libs/", 7) == 0) argv0 = base; if (strncmp (base, "lt-", 3) == 0) argv0 = base + 3; program_name = argv0; to this: char const *slash = strrchr (argv0, '/'); if (slash && 6 <= slash - argv0 && strncmp (slash - 6, "/.libs", 6) == 0) argv0 = slash + (strncmp (slash, "/lt-", 4) == 0 ? 4 : 1); program_name = argv0; ?