strcmp(1): returns -1, specifies sysexits imports

This commit is contained in:
Emma Tebibyte 2024-07-13 17:04:38 -06:00
parent 35a20dca79
commit 26b0c93f4d
Signed by: emma
GPG Key ID: 06FA419A1698C270

View File

@ -18,7 +18,7 @@
*/ */
#include <stdio.h> /* fprintf(3), stderr */ #include <stdio.h> /* fprintf(3), stderr */
#include <sysexits.h> #include <sysexits.h> /* EX_OK, EX_USAGE */
static char *program_name = "strcmp"; static char *program_name = "strcmp";
@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
if (*argv[i-1] > *argv[i]) { if (*argv[i-1] > *argv[i]) {
return 1; return 1;
} else if (*argv[i-1] < *argv[i]++) { } else if (*argv[i-1] < *argv[i]++) {
return 255; return -1; /* actually 255 */
} }
} }
} }