/*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/*
* fbc_ask - User interaction
*/
#include <ctype.h> /* iscntrl(), toupper() */
#include <stdarg.h> /* va_end(), va_start(), vfprintf() */
#include <stdio.h> /* fflush(), fgets(), fprintf() */
#include "fbc.h" /* Common fbconf_xorg(1M) definitions */
#include "fbc_ask.h" /* User interaction */
#include "fbc_error.h" /* Error reporting */
/*
* fbc_ask_yes_no()
*
* and return TRUE iff the reply seems to be in the affirmative.
*/
int
const char *format, /* Prompt format string */
...) /* Variable argument list for prompt */
{
/*
* Flush any fbc_errormsg() messages that might explain why we're here
*/
/*
* Ask the question until an answer makes sense
*/
for (;;) {
/*
*/
/*
* Read the reply, and return the sense of the answer
*
* Ignore any but the first input character.
* Treat 'Y' or 'y' as affirmative.
* Treat 'N' or 'n' as negative.
* Treat Newline, Nul, or any other control character
* as negative.
* Treat EOF or any input error as negative.
* Loop again if the cat stepped on some other key.
*/
break;
}
break;
}
}
return (reply);
} /* fbc_ask_yes_no() */
/* End of fbc_ask.c */