* [PATCH] xfsdump: allow multi-digit dialog prompts
@ 2011-07-27 16:41 Bill Kendall
2011-08-02 9:55 ` Christoph Hellwig
2011-08-09 20:55 ` Alex Elder
0 siblings, 2 replies; 3+ messages in thread
From: Bill Kendall @ 2011-07-27 16:41 UTC (permalink / raw)
To: xfs
xfsdump issues a multiple-choice dialog in various circumstances
(e.g., media change request). An assert incorrectly limits this to
at most 8 choices even though the code can handle up to 9. Remove
the assert and change the code to handle multi-digit responses.
Signed-off-by: Bill Kendall <wkendall@sgi.com>
---
common/dlog.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/common/dlog.c b/common/dlog.c
index 6a243ef..c81edc6 100644
--- a/common/dlog.c
+++ b/common/dlog.c
@@ -19,6 +19,7 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
@@ -186,7 +187,6 @@ dlog_multi_query( char *querystr[ ],
/* sanity
*/
ASSERT( dlog_allowed_flag );
- ASSERT( choicecnt < 9 );
/* display query description strings
*/
@@ -245,24 +245,21 @@ dlog_multi_query( char *querystr[ ],
prepromptstr,
choicecnt );
if ( ok ) {
+ long int val;
+ char *end = buf;
+
if ( ! strlen( buf )) {
return defaultix;
}
- if ( strlen( buf ) != 1 ) {
- prepromptstr = _(
- "please enter a single "
- "digit response (1 to %d)");
- continue;
- }
- if ( buf[ 0 ] < '1'
- ||
- buf[ 0 ] >= '1' + ( u_char_t )choicecnt ) {
+
+ val = strtol( buf, &end, 10 );
+ if ( *end != '\0' || val < 1 || val > choicecnt ) {
prepromptstr = _(
- "please enter a single digit "
+ "please enter a value "
"between 1 and %d inclusive ");
continue;
}
- return ( size_t )( buf[ 0 ] - '1' );
+ return val - 1; // return value is a 0-based index
} else {
return exceptionix;
}
--
1.7.0.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfsdump: allow multi-digit dialog prompts
2011-07-27 16:41 [PATCH] xfsdump: allow multi-digit dialog prompts Bill Kendall
@ 2011-08-02 9:55 ` Christoph Hellwig
2011-08-09 20:55 ` Alex Elder
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2011-08-02 9:55 UTC (permalink / raw)
To: Bill Kendall; +Cc: xfs
On Wed, Jul 27, 2011 at 11:41:53AM -0500, Bill Kendall wrote:
> xfsdump issues a multiple-choice dialog in various circumstances
> (e.g., media change request). An assert incorrectly limits this to
> at most 8 choices even though the code can handle up to 9. Remove
> the assert and change the code to handle multi-digit responses.
>
> Signed-off-by: Bill Kendall <wkendall@sgi.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfsdump: allow multi-digit dialog prompts
2011-07-27 16:41 [PATCH] xfsdump: allow multi-digit dialog prompts Bill Kendall
2011-08-02 9:55 ` Christoph Hellwig
@ 2011-08-09 20:55 ` Alex Elder
1 sibling, 0 replies; 3+ messages in thread
From: Alex Elder @ 2011-08-09 20:55 UTC (permalink / raw)
To: Bill Kendall; +Cc: xfs
On Wed, 2011-07-27 at 11:41 -0500, Bill Kendall wrote:
> xfsdump issues a multiple-choice dialog in various circumstances
> (e.g., media change request). An assert incorrectly limits this to
> at most 8 choices even though the code can handle up to 9. Remove
> the assert and change the code to handle multi-digit responses.
>
> Signed-off-by: Bill Kendall <wkendall@sgi.com>
Sorry I didn't get to this sooner.
I had a few minor quibbles, but I'm not going to even bother
mentioning them. Your change looks good. I'll commit this
for you.
Reviewed-by: Alex Elder <aelder@sgi.com>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-09 20:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-27 16:41 [PATCH] xfsdump: allow multi-digit dialog prompts Bill Kendall
2011-08-02 9:55 ` Christoph Hellwig
2011-08-09 20:55 ` Alex Elder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox