From 983562e47537eef4c9d7706d036245a1896dd5f2 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Sun, 6 Nov 2011 19:43:44 -0600 Subject: examples/network/git2.c: add newline to usage message --- examples/network/git2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/network/git2.c') diff --git a/examples/network/git2.c b/examples/network/git2.c index 0468c8ace..a4bff4a2a 100644 --- a/examples/network/git2.c +++ b/examples/network/git2.c @@ -44,7 +44,7 @@ int main(int argc, char **argv) int i, error; if (argc < 2) { - fprintf(stderr, "usage: %s [repo]", argv[0]); + fprintf(stderr, "usage: %s [repo]\n", argv[0]); } for (i = 0; commands[i].name != NULL; ++i) { -- cgit v1.2.1 From 349532d0b1fd4eb94b398616602674ff516f6d76 Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Sun, 6 Nov 2011 19:44:29 -0600 Subject: examples/network/git2.c: exit with proper status, and avoid segfault This function should exit after printing usage information if too few arguments were specified. Additionally, it should exit with a failure status if the first argument supplied is not one in the internal command list. --- examples/network/git2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'examples/network/git2.c') diff --git a/examples/network/git2.c b/examples/network/git2.c index a4bff4a2a..def56e83b 100644 --- a/examples/network/git2.c +++ b/examples/network/git2.c @@ -45,6 +45,7 @@ int main(int argc, char **argv) if (argc < 2) { fprintf(stderr, "usage: %s [repo]\n", argv[0]); + exit(EXIT_FAILURE); } for (i = 0; commands[i].name != NULL; ++i) { @@ -53,5 +54,5 @@ int main(int argc, char **argv) } fprintf(stderr, "Command not found: %s\n", argv[1]); - + return 1; } -- cgit v1.2.1