Move system/inifile to fsutils/inifile

This commit is contained in:
Gregory Nutt 2016-01-20 17:10:55 -06:00
parent 07cf99130c
commit 27a55f36d6
12 changed files with 62 additions and 27 deletions

View File

@ -1518,4 +1518,6 @@
be presented after the NSH greeting (2015-01-20).
* apps/nshlib: All sessions may be protected with logins using
the encrypted password in /etc/passwd (2016-01-20).
* apps/fsutils/inifile: Move system/inifile to fsutils/inifile
where it seems to fit in better (2016-01-20).

View File

@ -5,6 +5,7 @@
menu "File System Utilities"
source "$APPSDIR/fsutils/inifile/Kconfig"
source "$APPSDIR/fsutils/mksmartfs/Kconfig"
source "$APPSDIR/fsutils/passwd/Kconfig"

View File

@ -3,21 +3,21 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig SYSTEM_INIFILE
menuconfig FSUTILS_INIFILE
bool "INI File Parser"
default n
---help---
Enable support for a simple INI file parser.
if SYSTEM_INIFILE
if FSUTILS_INIFILE
config SYSTEM_INIFILE_MAXLINE
config FSUTILS_INIFILE_MAXLINE
int "Max line length"
default 256
---help---
The largest line that the parser can expect to see in an INI file.
config SYSTEM_INIFILE_DEBUGLEVEL
config FSUTILS_INIFILE_DEBUGLEVEL
int "Debug level"
default 0
range 0 2
@ -25,4 +25,4 @@ config SYSTEM_INIFILE_DEBUGLEVEL
0=Debug off; 1=Print errors on console; 2=Print debug information
on the console.
endif # SYSTEM_INIFILE
endif # FSUTILS_INIFILE

38
fsutils/inifile/Make.defs Normal file
View File

@ -0,0 +1,38 @@
############################################################################
# apps/fsutils/inifile/Make.defs
#
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
ifeq ($(CONFIG_FSUTILS_INIFILE),y)
CONFIGURED_APPS += fsutils/inifile
endif

View File

@ -1,5 +1,5 @@
############################################################################
# apps/system/inifile/Makefile
# apps/fsutils/inifile/Makefile
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/system/inifile/inifile.c
* apps/fsutils/inifile/inifile.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -52,36 +52,36 @@
/* The maximum size of a line in the INI file */
#ifndef CONFIG_SYSTEM_INIFILE_MAXLINE
# define CONFIG_SYSTEM_INIFILE_MAXLINE 256
#ifndef CONFIG_FSUTILS_INIFILE_MAXLINE
# define CONFIG_FSUTILS_INIFILE_MAXLINE 256
#endif
#ifndef CONFIG_SYSTEM_INIFILE_DEBUGLEVEL
# define CONFIG_SYSTEM_INIFILE_DEBUGLEVEL 0
#ifndef CONFIG_FSUTILS_INIFILE_DEBUGLEVEL
# define CONFIG_FSUTILS_INIFILE_DEBUGLEVEL 0
#endif
#ifdef CONFIG_CPP_HAVE_VARARGS
# if CONFIG_SYSTEM_INIFILE_DEBUGLEVEL > 0
# if CONFIG_FSUTILS_INIFILE_DEBUGLEVEL > 0
# define inidbg(format, ...) \
printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
# else
# define inidbg(x...)
# endif
# if CONFIG_SYSTEM_INIFILE_DEBUGLEVEL > 1
# if CONFIG_FSUTILS_INIFILE_DEBUGLEVEL > 1
# define inivdbg(format, ...) \
printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
# else
# define inivdbg(x...)
# endif
#else
# if CONFIG_SYSTEM_INIFILE_DEBUGLEVEL > 0
# if CONFIG_FSUTILS_INIFILE_DEBUGLEVEL > 0
# define inidbg printf
# else
# define inidbg (void)
# endif
# if CONFIG_SYSTEM_INIFILE_DEBUGLEVEL > 1
# if CONFIG_FSUTILS_INIFILE_DEBUGLEVEL > 1
# define inivdbg printf
# else
# define inivdbg (void)
@ -106,7 +106,7 @@ struct inifile_state_s
{
FILE *instream;
int nextch;
char line[CONFIG_SYSTEM_INIFILE_MAXLINE+1];
char line[CONFIG_FSUTILS_INIFILE_MAXLINE+1];
};
/****************************************************************************
@ -182,7 +182,7 @@ static int inifile_read_line(FAR struct inifile_state_s *priv)
*/
nbytes = 0;
while ((nbytes < CONFIG_SYSTEM_INIFILE_MAXLINE) &&
while ((nbytes < CONFIG_FSUTILS_INIFILE_MAXLINE) &&
(priv->nextch != EOF) &&
(priv->nextch != '\n'))
{

View File

@ -22,7 +22,7 @@ endif # TIFF
config GRAPHICS_TRAVELER
bool "Traveler game"
default n
select SYSTEM_INIFILE
select FSUTILS_INIFILE
---help---
Enable or disable the graphic Traveler game

View File

@ -12,7 +12,6 @@ source "$APPSDIR/system/install/Kconfig"
source "$APPSDIR/system/flash_eraseall/Kconfig"
source "$APPSDIR/system/hex2bin/Kconfig"
source "$APPSDIR/system/i2c/Kconfig"
source "$APPSDIR/system/inifile/Kconfig"
source "$APPSDIR/system/hexed/Kconfig"
source "$APPSDIR/system/netdb/Kconfig"
source "$APPSDIR/system/nxplayer/Kconfig"

View File

@ -62,10 +62,6 @@ ifeq ($(CONFIG_SYSTEM_I2CTOOL),y)
CONFIGURED_APPS += system/i2c
endif
ifeq ($(CONFIG_SYSTEM_INIFILE),y)
CONFIGURED_APPS += system/inifile
endif
ifeq ($(CONFIG_SYSTEM_INSTALL),y)
CONFIGURED_APPS += system/install
endif

View File

@ -37,10 +37,9 @@
# Sub-directories containing system tasks/libraries
SUBDIRS = cdcacm cle composite cu flash_eraseall free i2c hex2bin inifile
SUBDIRS += install hexed lm75 mdio netdb nxplayer ramtest ramtron readline
SUBDIRS += sdcard stackmonitor sudoku symtab usbmonitor usbmsc vi zmodem
SUBDIRS += zoneinfo
SUBDIRS = cdcacm cle composite cu flash_eraseall free i2c hex2bin install
SUBDIRS += hexed lm75 mdio netdb nxplayer ramtest ramtron readline sdcard
SUBDIRS += stackmonitor sudoku symtab usbmonitor usbmsc vi zmodem zoneinfo
# Create the list of installed runtime modules (INSTALLED_DIRS)