diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-10-25 11:04:57 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-10-25 11:04:57 -0700 |
commit | 436c80aa9fe73824b6438934897c4f810e52f6e7 (patch) | |
tree | 0f43920cda193fcb28519e57799f126f7fb53692 | |
parent | 3f1a7aac4b4c91e0d7b3c355b4148245ab8eb24d (diff) |
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 <alan.coopersmith@oracle.com>
-rw-r--r-- | showrgb.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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); |