shithub: util

Download patch

ref: 79f48ee47c9d08563e0adfee90911df3f51c4f94
parent: 49e9b65b92a429d692954747fee694727875f594
author: eli <eli@singularity>
date: Tue Dec 24 03:59:34 EST 2024

usage

--- a/anagrams.c
+++ b/anagrams.c
@@ -124,6 +124,9 @@
 
 	dict = calloc(1, sizeof(dlist));
 
+	if (argc < 2)
+		goto USAGE;
+
 	for(i = 1; i < argc; i++){
 		wordsfilename = argv[i];
 		if(argv[i][0] == '-'){
@@ -136,7 +139,8 @@
 			}
 		}else continue;
 
-		fprint(2, "usage:\n\t%s [-l[ength] minlen] [-c[ommonenglishwords] wordsfile\n", argv[0]);
+USAGE:
+		fprint(2, "usage: %s [-l[ength] minlen] [-c[ommonenglishwords] wordsfile\n", argv[0]);
 		exits("usage");
 	}