← Commit list

6dd6a6c42

Walter Lozano
Walter Lozano
2022-01-23
SUCCESS Duration: 156s

Subject

Add support for long options to cmp

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

editors/cmp.c+18 -0
@@ -54,6 +54,7 @@ int cmp_main(int argc UNUSED_PARAM, char **argv)
int retval = 0;
int max_count = -1;
+#if !ENABLE_LONG_OPTS
opt = getopt32(argv, "^"
OPT_STR
"\0" "-1"
@@ -62,6 +63,23 @@ int cmp_main(int argc UNUSED_PARAM, char **argv)
":l--s:s--l",
&max_count
);
+#else
+ static const char cmp_longopts[] ALIGN1 =
+ "bytes\0" Required_argument "n"
+ "quiet\0" No_argument "s"
+ "silent\0" No_argument "s"
+ "verbose\0" No_argument "l"
+ ;
+ opt = getopt32long(argv, "^"
+ OPT_STR
+ "\0" "-1"
+ IF_DESKTOP(":?4")
+ IF_NOT_DESKTOP(":?2")
+ ":l--s:s--l",
+ cmp_longopts,
+ &max_count
+ );
+#endif
argv += optind;
filename1 = *argv;