Thread (6 messages) flat view 6 messages, 3 authors, 2016-06-15

Re: [PATCH] bash-completion: fix getting strategy list

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:45:11

Johannes Sixt schrieb:
Nguyen Thai Ngoc Duy schrieb:
quoted
+	if (argc == 2 && !strcmp(argv[1], "--show-strategies")) {
+		for (i = 0; i < ARRAY_SIZE(all_strategy); i++)
+			printf("%s\n", all_strategy[i].name);
+		return 0;
Improved error checking, but quick and dirty:

+	if (!strcmp(argv[1], "--show-strategies")) {
Oops, not really improved. This still needs to check for argc >= 2.
+		for (i = 0; i < ARRAY_SIZE(all_strategy); i++)
+			printf("%s\n", all_strategy[i].name);
+		return argc == 2 ? 0 :
+			 error("--show-strategies does not take "
+				"any arguments");
-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help