From b4420923cb149a5a8164bb06794e12b88203d97c Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 8 Sep 2012 13:56:21 +0000 Subject: Shenzhou board is first to use ONLY Kconfig for configuration git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5114 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/lib/Kconfig | 23 +++++++++++++++++++++++ nuttx/lib/stdio/lib_fgets.c | 29 ++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 5 deletions(-) (limited to 'nuttx/lib') diff --git a/nuttx/lib/Kconfig b/nuttx/lib/Kconfig index a5b62e588..69a55d09c 100644 --- a/nuttx/lib/Kconfig +++ b/nuttx/lib/Kconfig @@ -51,6 +51,29 @@ config LIBC_FLOATINGPOINT By default, floating point support in printf, sscanf, etc. is disabled. +choice + prompt "Newline Options" + default EOL_IS_EITHER_CRLF + ---help--- + This selection determines the line terminating character that is used. + Some environments may return CR as end-of-line, others LF, and others + both. If not specified, the default is either CR or LF (but not both) + as the line terminating charactor. + +config EOL_IS_CR + bool "EOL is CR" + +config EOL_IS_LF + bool "EOL is LF" + +config EOL_IS_BOTH_CRLF + bool "EOL is CR and LF" + +config EOL_IS_EITHER_CRLF + bool "EOL is CR or LF" + +endchoice + config LIBC_STRERROR bool "Enable strerror" default n diff --git a/nuttx/lib/stdio/lib_fgets.c b/nuttx/lib/stdio/lib_fgets.c index e84e031f9..a4f9089ed 100644 --- a/nuttx/lib/stdio/lib_fgets.c +++ b/nuttx/lib/stdio/lib_fgets.c @@ -50,13 +50,32 @@ * Definitions ****************************************************************************/ /* Some environments may return CR as end-of-line, others LF, and others - * both. The logic here assumes either but not both. + * both. If not specified, the logic here assumes either (but not both) as + * the default. */ -#undef CONFIG_EOL_IS_CR -#undef CONFIG_EOL_IS_LF -#undef CONFIG_EOL_IS_BOTH_CRLF -#define CONFIG_EOL_IS_EITHER_CRLF 1 +#if defined(CONFIG_EOL_IS_CR) +# undef CONFIG_EOL_IS_LF +# undef CONFIG_EOL_IS_BOTH_CRLF +# undef CONFIG_EOL_IS_EITHER_CRLF +#elif defined(CONFIG_EOL_IS_LF) +# undef CONFIG_EOL_IS_CR +# undef CONFIG_EOL_IS_BOTH_CRLF +# undef CONFIG_EOL_IS_EITHER_CRLF +#elif defined(CONFIG_EOL_IS_BOTH_CRLF) +# undef CONFIG_EOL_IS_CR +# undef CONFIG_EOL_IS_LF +# undef CONFIG_EOL_IS_EITHER_CRLF +#elif defined(CONFIG_EOL_IS_EITHER_CRLF) +# undef CONFIG_EOL_IS_CR +# undef CONFIG_EOL_IS_LF +# undef CONFIG_EOL_IS_BOTH_CRLF +#else +# undef CONFIG_EOL_IS_CR +# undef CONFIG_EOL_IS_LF +# undef CONFIG_EOL_IS_BOTH_CRLF +# define CONFIG_EOL_IS_EITHER_CRLF 1 +#endif /**************************************************************************** * Private Type Declarations -- cgit v1.2.3