{"thread":{"id":"196","subject":"[PATCH] Improve usage messages","startedAt":"2005-04-21T12:41:52Z","lastAt":"2005-04-21T23:02:28Z","messageCount":4,"participants":["Matthias Urlichs","Petr Baudis","David Greaves","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"1121","messageId":"20050421124152.A28137F87D@smurf.noris.de","threadId":"196","inReplyTo":null,"subject":"[PATCH] Improve usage messages","fromName":"Matthias Urlichs","fromEmail":"smurf@smurf.noris.de","sentAt":"2005-04-21T12:41:52Z","receivedAt":"2005-04-21T12:41:52Z","isPatch":true,"sender":{"key":"matthias@urlichs.de","avatar":"https://gravatar.com/avatar/2708905af227313eba6f2b2ae0f7d0259b5ac5d71baef58fe5a13c699ce0bbf0?d=mp&s=160"},"body":"This patch adds somewhat-improved usage messages to some of Linus' programs.\nSpecifically, they now handle -? / --help.\n\nSigned-Off-By: Matthias Urlichs <smurf@smurf.noris.de>\n\nIndex: check-files.c\n===================================================================\n--- 42a073eb6b5bb397a3e8768a032463a7fa02e6b9/check-files.c  (mode:100644 sha1:7d16691aa9d51b5b4670d5837b3527ee7c7da79c)\n+++ 265515f9c4f089b1b61e9d2312c4b3babe189618/check-files.c  (mode:100644 sha1:be904b13659a60eab31787b010a64f2274048a9f)\n@@ -40,6 +40,8 @@\n {\n \tint i;\n \n+\tif(argc == 2 && (!strcmp(argv[1],\"-?\") || !strcmp(argv[1],\"--help\")))\n+\t\tusage(\"check-files filename...\");\n \tread_cache();\n \tfor (i = 1; i < argc ; i++)\n \t\tcheck_file(argv[i]);\nIndex: diff-tree.c\n===================================================================\n--- 42a073eb6b5bb397a3e8768a032463a7fa02e6b9/diff-tree.c  (mode:100644 sha1:b0122e42631410fa579115f025efc3cab777cde6)\n+++ 265515f9c4f089b1b61e9d2312c4b3babe189618/diff-tree.c  (mode:100644 sha1:03fcc2fae2f0b06f3834f0b6e0d8762e70f49f51)\n@@ -193,6 +193,11 @@\n \t}\n }\n \n+static const char diff_tree_usage[] = \n+\t\"diff-tree [ -r (recurse) | -z (\\\\0-terminate) ]\"\n+\t\t\"\\n\\t<tree sha1> <tree sha1>\";\n+\n+\n int main(int argc, char **argv)\n {\n \tunsigned char old[20], new[20];\n@@ -209,11 +214,11 @@\n \t\t\tline_termination = '\\0';\n \t\t\tcontinue;\n \t\t}\n-\t\tusage(\"diff-tree [-r] [-z] <tree sha1> <tree sha1>\");\n+\t\tusage(diff_tree_usage);\n \t}\n \n \tif (argc != 3 || get_sha1_hex(argv[1], old) || get_sha1_hex(argv[2], new))\n-\t\tusage(\"diff-tree [-r] [-z] <tree sha1> <tree sha1>\");\n+\t\tusage(diff_tree_usage);\n \tcommit_to_tree(old);\n \tcommit_to_tree(new);\n \treturn diff_tree_sha1(old, new, \"\");\n--- 42a073eb6b5bb397a3e8768a032463a7fa02e6b9/init-db.c  (mode:100644 sha1:dad06351ca35d0d2f68cd9e719c49805386f96fa)\n+++ 265515f9c4f089b1b61e9d2312c4b3babe189618/init-db.c  (mode:100644 sha1:4afd436e719b347cdf6b4420c9d926e453f1f95b)\n@@ -26,6 +26,9 @@\n \tchar *sha1_dir, *path;\n \tint len, i;\n \n+\tif(argc != 1)\n+\t\tusage(\"init-db\");\n+\n \tsafe_create_dir(\".git\");\n \n \tsha1_dir = getenv(DB_ENVIRONMENT);\n--- 42a073eb6b5bb397a3e8768a032463a7fa02e6b9/write-tree.c  (mode:100644 sha1:827809dbddbff6dd8cf842641f6db5ad2f3ae07a)\n+++ 265515f9c4f089b1b61e9d2312c4b3babe189618/write-tree.c  (mode:100644 sha1:55fe1c75c3065c8d5bef34f4f2e7af7aa147ea9d)\n@@ -101,9 +101,13 @@\n int main(int argc, char **argv)\n {\n \tint i, unmerged;\n-\tint entries = read_cache();\n+\tint entries;\n \tunsigned char sha1[20];\n \n+\tif(argc != 1)\n+\t\tusage(\"write-tree\");\n+\n+\tentries = read_cache();\n \tif (entries <= 0)\n \t\tdie(\"write-tree: no cache contents to write\");\n \n"},{"id":"1141","messageId":"20050421162505.GE30991@pasky.ji.cz","threadId":"196","inReplyTo":"20050421124152.A28137F87D@smurf.noris.de","subject":"Re: [PATCH] Improve usage messages","fromName":"Petr Baudis","fromEmail":"pasky@ucw.cz","sentAt":"2005-04-21T16:25:05Z","receivedAt":"2005-04-21T16:25:05Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Apr 21, 2005 at 02:41:52PM CEST, I got a letter\nwhere Matthias Urlichs <smurf@smurf.noris.de> told me that...\n> This patch adds somewhat-improved usage messages to some of Linus' programs.\n> Specifically, they now handle -? / --help.\n\n-? is pretty non-standard. Any problem with going for -h?\n\n> Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>\n> \n> Index: check-files.c\n> ===================================================================\n> --- 42a073eb6b5bb397a3e8768a032463a7fa02e6b9/check-files.c  (mode:100644 sha1:7d16691aa9d51b5b4670d5837b3527ee7c7da79c)\n> +++ 265515f9c4f089b1b61e9d2312c4b3babe189618/check-files.c  (mode:100644 sha1:be904b13659a60eab31787b010a64f2274048a9f)\n> @@ -40,6 +40,8 @@\n>  {\n>  \tint i;\n>  \n> +\tif(argc == 2 && (!strcmp(argv[1],\"-?\") || !strcmp(argv[1],\"--help\")))\n\n(style-education-hat\n+\tif (argc == 2 && (!strcmp(argv[1], \"-?\") || !strcmp(argv[1], \"--help\")))\n)\n\n> +\t\tusage(\"check-files filename...\");\n\nLet's either do <filename>* or FILE..., this mixing doesn't look good.\n\n>  \tread_cache();\n>  \tfor (i = 1; i < argc ; i++)\n>  \t\tcheck_file(argv[i]);\n> Index: diff-tree.c\n> ===================================================================\n> --- 42a073eb6b5bb397a3e8768a032463a7fa02e6b9/diff-tree.c  (mode:100644 sha1:b0122e42631410fa579115f025efc3cab777cde6)\n> +++ 265515f9c4f089b1b61e9d2312c4b3babe189618/diff-tree.c  (mode:100644 sha1:03fcc2fae2f0b06f3834f0b6e0d8762e70f49f51)\n> @@ -193,6 +193,11 @@\n>  \t}\n>  }\n>  \n> +static const char diff_tree_usage[] = \n> +\t\"diff-tree [ -r (recurse) | -z (\\\\0-terminate) ]\"\n> +\t\t\"\\n\\t<tree sha1> <tree sha1>\";\n\nI'd say this is pretty confusnig. Just describe the parameters on\nfolowing lines in more detail, if you must.\n\n> +\n> +\n>  int main(int argc, char **argv)\n>  {\n>  \tunsigned char old[20], new[20];\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nC++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor\n"},{"id":"1146","messageId":"4267D84B.4090403@dgreaves.com","threadId":"196","inReplyTo":"20050421162505.GE30991@pasky.ji.cz","subject":"Re: [PATCH] Improve usage messages","fromName":"David Greaves","fromEmail":"david@dgreaves.com","sentAt":"2005-04-21T16:43:55Z","receivedAt":"2005-04-21T16:43:55Z","isPatch":true,"sender":{"key":"david@dgreaves.com","avatar":"https://gravatar.com/avatar/ca67bad50999edcdd137c9a65da2381557d175bea99ae956afdabc5785e42b79?d=mp&s=160"},"body":"Petr Baudis wrote:\n> Dear diary, on Thu, Apr 21, 2005 at 02:41:52PM CEST, I got a letter\n> where Matthias Urlichs <smurf@smurf.noris.de> told me that...\n> \n>>This patch adds somewhat-improved usage messages to some of Linus' programs.\n>>Specifically, they now handle -? / --help.\n\njust so you know, the intention of doing the README.reference was to get \nall the docs in one place and then go back to the c and update the \nusage() to be consistent.\n\nI started by doing\n   grep usage *.c\n:)\n\nI'm actually working on diff-cache as we speak...\n\nDavid\n"},{"id":"1215","messageId":"7vll7bd98b.fsf@assigned-by-dhcp.cox.net","threadId":"196","inReplyTo":"20050421124152.A28137F87D@smurf.noris.de","subject":"Re: [PATCH] Improve usage messages","fromName":"Junio C Hamano","fromEmail":"junio@siamese.dyndns.org","sentAt":"2005-04-21T23:02:28Z","receivedAt":"2005-04-21T23:02:28Z","isPatch":true,"sender":{"key":"junio@siamese.dyndns.org","avatar":null},"body":">>>>> \"MU\" == Matthias Urlichs <smurf@smurf.noris.de> writes:\n\nMU> Index: diff-tree.c\n\nMU> +static const char diff_tree_usage[] = \nMU> +\t\"diff-tree [ -r (recurse) | -z (\\\\0-terminate) ]\"\nMU> +\t\t\"\\n\\t<tree sha1> <tree sha1>\";\n\nI think we already have this, and Pasky's right to say the\n(recurse) and (\\0-terminate) should not be there.\n\n\n"}]}