[Monetdb-developers] [Monetdb-checkins] MonetDB5/src/tools monetdb.mx, , 1.19, 1.20

Sjoerd Mullender sjoerd at acm.org
Fri Aug 31 19:19:37 CEST 2007


On 2007-08-31 19:14, Fabian wrote:
> Update of /cvsroot/monetdb/MonetDB5/src/tools
> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4192
> 
> Modified Files:
> 	monetdb.mx 
> Log Message:
> reduce overkill
> 
> 
> Index: monetdb.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB5/src/tools/monetdb.mx,v
> retrieving revision 1.19
> retrieving revision 1.20
> diff -u -d -r1.19 -r1.20
> --- monetdb.mx	31 Aug 2007 17:09:13 -0000	1.19
> +++ monetdb.mx	31 Aug 2007 17:14:21 -0000	1.20
> @@ -610,7 +610,6 @@
>  		}
>  
>  		if (stats != NULL) {
> -			char path[8096];
>  			err e;
>  
>  			if (stats->state == SABdbRunning) {
> @@ -627,11 +626,12 @@
>  			}
>  
>  			if (force == 0) {
> +				char answ;
>  				printf("you are about to remove database %s\n", dbname);
>  				printf("ALL data in this database will get lost, "
>  						"are you sure? [y/N] ");
> -				scanf("%c", path);
> -				if (path[0] == 'y' || path[0] == 'Y') {
> +				scanf("%c", &answ);
> +				if (answ == 'y' || answ == 'Y') {
>  					/* do it! */
>  				} else {
>  					printf("battle control terminated\n");
> 
>

Even better would be to use getchar().  scanf is still considerable
overkill for reading a character.  But also remember to read the rest of
the line (also when using scanf).

-- 
Sjoerd Mullender




More information about the developers-list mailing list