From 27a55f36d68b23b4e6b4c0f67dfbbbf89d9e61fa Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 20 Jan 2016 17:10:55 -0600 Subject: [PATCH] Move system/inifile to fsutils/inifile --- ChangeLog.txt | 2 ++ fsutils/Kconfig | 1 + {system => fsutils}/inifile/.gitignore | 0 {system => fsutils}/inifile/Kconfig | 10 +++---- fsutils/inifile/Make.defs | 38 ++++++++++++++++++++++++++ {system => fsutils}/inifile/Makefile | 2 +- {system => fsutils}/inifile/README.txt | 0 {system => fsutils}/inifile/inifile.c | 22 +++++++-------- graphics/Kconfig | 2 +- system/Kconfig | 1 - system/Make.defs | 4 --- system/Makefile | 7 ++--- 12 files changed, 62 insertions(+), 27 deletions(-) rename {system => fsutils}/inifile/.gitignore (100%) rename {system => fsutils}/inifile/Kconfig (78%) create mode 100644 fsutils/inifile/Make.defs rename {system => fsutils}/inifile/Makefile (98%) rename {system => fsutils}/inifile/README.txt (100%) rename {system => fsutils}/inifile/inifile.c (97%) diff --git a/ChangeLog.txt b/ChangeLog.txt index b68ce3075..0bcc74b77 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -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). diff --git a/fsutils/Kconfig b/fsutils/Kconfig index 35609b8ac..b6f57cc34 100644 --- a/fsutils/Kconfig +++ b/fsutils/Kconfig @@ -5,6 +5,7 @@ menu "File System Utilities" +source "$APPSDIR/fsutils/inifile/Kconfig" source "$APPSDIR/fsutils/mksmartfs/Kconfig" source "$APPSDIR/fsutils/passwd/Kconfig" diff --git a/system/inifile/.gitignore b/fsutils/inifile/.gitignore similarity index 100% rename from system/inifile/.gitignore rename to fsutils/inifile/.gitignore diff --git a/system/inifile/Kconfig b/fsutils/inifile/Kconfig similarity index 78% rename from system/inifile/Kconfig rename to fsutils/inifile/Kconfig index a0728389c..46d140313 100644 --- a/system/inifile/Kconfig +++ b/fsutils/inifile/Kconfig @@ -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 diff --git a/fsutils/inifile/Make.defs b/fsutils/inifile/Make.defs new file mode 100644 index 000000000..ad3626f1b --- /dev/null +++ b/fsutils/inifile/Make.defs @@ -0,0 +1,38 @@ +############################################################################ +# apps/fsutils/inifile/Make.defs +# +# Copyright (C) 2016 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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 diff --git a/system/inifile/Makefile b/fsutils/inifile/Makefile similarity index 98% rename from system/inifile/Makefile rename to fsutils/inifile/Makefile index 6e823b9bb..9bf948f6e 100644 --- a/system/inifile/Makefile +++ b/fsutils/inifile/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# apps/system/inifile/Makefile +# apps/fsutils/inifile/Makefile # # Copyright (C) 2014 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/system/inifile/README.txt b/fsutils/inifile/README.txt similarity index 100% rename from system/inifile/README.txt rename to fsutils/inifile/README.txt diff --git a/system/inifile/inifile.c b/fsutils/inifile/inifile.c similarity index 97% rename from system/inifile/inifile.c rename to fsutils/inifile/inifile.c index a7bb8c0b1..a5d203c6c 100644 --- a/system/inifile/inifile.c +++ b/fsutils/inifile/inifile.c @@ -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 @@ -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')) { diff --git a/graphics/Kconfig b/graphics/Kconfig index 8bfad9e8d..e8cdcaed5 100644 --- a/graphics/Kconfig +++ b/graphics/Kconfig @@ -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 diff --git a/system/Kconfig b/system/Kconfig index f44a6c49b..b31cfbc9f 100644 --- a/system/Kconfig +++ b/system/Kconfig @@ -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" diff --git a/system/Make.defs b/system/Make.defs index 9e49168bf..4f7e0326c 100644 --- a/system/Make.defs +++ b/system/Make.defs @@ -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 diff --git a/system/Makefile b/system/Makefile index 2125744f8..02b9d9166 100644 --- a/system/Makefile +++ b/system/Makefile @@ -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)