From 436c80aa9fe73824b6438934897c4f810e52f6e7 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 25 Oct 2014 11:04:57 -0700 Subject: If opening argv[1] + ".txt" fails, try opening argv[1] without suffix Previously, running "showrgb /usr/share/X11/rgb.txt" would give the confusing error message: showrgb: unable to open rgb database "/usr/share/X11/rgb.txt" since it was really looking for rgb.txt.txt. Now it just works, allowing users to use filename completion. Signed-off-by: Alan Coopersmith --- showrgb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/showrgb.c b/showrgb.c index 4796c5a..8f3fb81 100644 --- a/showrgb.c +++ b/showrgb.c @@ -135,7 +135,7 @@ dumprgb (const char *filename) strcat(path, ".txt"); #endif - if (!(rgb = fopen(path, "r"))) { + if (!(rgb = fopen(path, "r")) && !(rgb = fopen(filename, "r"))) { fprintf (stderr, "%s: unable to open rgb database \"%s\"\n", ProgramName, filename); free(path); -- cgit v1.2.3