[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug #37811] Mismatch of messages given by `find --help' and its rea
From: |
Bernhard Voelker |
Subject: |
Re: [bug #37811] Mismatch of messages given by `find --help' and its real execution result. |
Date: |
Tue, 27 Nov 2012 00:01:42 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2 |
On 11/25/2012 03:17 PM, Pengyu CHEN wrote:
> Follow-up Comment #2, bug #37811 (project findutils):
>
> Oh.. It's my fault to submit a bug without checking for some infomation first.
> Sorry to all.
> Well, still I believe it's better to use some alternative error message than
> saying `unknow argument'.
What about the following?
Have a nice day,
Berny
>From 3e3d398295ff78516fa9251e8a1857004caaf0ed Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <address@hidden>
Date: Mon, 26 Nov 2012 23:42:12 +0100
Subject: [PATCH] find: improve diagnostic for not built-in arguments of -type
* find/parser.c (insert_type): Instead of running into the
default case, output a more helpful diagnostic for arguments
not built into the program.
---
find/parser.c | 32 ++++++++++++++++++++++++--------
1 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/find/parser.c b/find/parser.c
index aa01253..1cead6c 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -2863,30 +2863,46 @@ insert_type (char **argv, int *arg_ptr,
type_cell = S_IFREG;
rate = 0.95f;
break;
-#ifdef S_IFLNK
case 'l': /* symbolic link */
+#ifdef S_IFLNK
type_cell = S_IFLNK;
rate = 0.1f;
- break;
+#else
+ error (EXIT_FAILURE, 0,
+ _("Argument to -type not built-in: %c (symbolic link)"),
+ (*typeletter));
#endif
-#ifdef S_IFIFO
+ break;
case 'p': /* pipe */
+#ifdef S_IFIFO
type_cell = S_IFIFO;
rate = 0.01f;
- break;
+#else
+ error (EXIT_FAILURE, 0,
+ _("Argument to -type not built-in: %c (pipe)"),
+ (*typeletter));
#endif
-#ifdef S_IFSOCK
+ break;
case 's': /* socket */
+#ifdef S_IFSOCK
type_cell = S_IFSOCK;
rate = 0.01f;
- break;
+#else
+ error (EXIT_FAILURE, 0,
+ _("Argument to -type not built-in: %c (socket)"),
+ (*typeletter));
#endif
-#ifdef S_IFDOOR
+ break;
case 'D': /* Solaris door */
+#ifdef S_IFDOOR
type_cell = S_IFDOOR;
rate = 0.01f;
- break;
+#else
+ error (EXIT_FAILURE, 0,
+ _("Argument to -type not built-in: %c (Solaris door)"),
+ (*typeletter));
#endif
+ break;
default: /* None of the above ... nuke 'em. */
error (EXIT_FAILURE, 0,
_("Unknown argument to -type: %c"), (*typeletter));
--
1.7.7