added qse_wcsatombsdup()

This commit is contained in:
hyung-hwan 2011-12-02 16:05:16 +00:00
parent f922c5858d
commit c2264998f2
15 changed files with 855 additions and 77 deletions

View File

@ -1,2 +1,2 @@
SUBDIRS = awk cut sed stx
SUBDIRS = awk cut fs sed stx
DIST_SUBDIRS = $(SUBDIRS)

View File

@ -230,7 +230,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = awk cut sed stx
SUBDIRS = awk cut fs sed stx
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive

13
qse/cmd/fs/Makefile.am Normal file
View File

@ -0,0 +1,13 @@
AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
bin_PROGRAMS = qsefs
qsefs_SOURCES = fs.c
qsefs_LDFLAGS = -L../../lib/cmn -L$(libdir)
qsefs_LDADD = -lqsecmn

547
qse/cmd/fs/Makefile.in Normal file
View File

@ -0,0 +1,547 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = qsefs$(EXEEXT)
subdir = cmd/fs
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_qsefs_OBJECTS = fs.$(OBJEXT)
qsefs_OBJECTS = $(am_qsefs_OBJECTS)
qsefs_DEPENDENCIES =
qsefs_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(qsefs_LDFLAGS) \
$(LDFLAGS) -o $@
DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(qsefs_SOURCES)
DIST_SOURCES = $(qsefs_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_MODE = @BUILD_MODE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHAR_MODE = @CHAR_MODE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_CXX = @HAVE_CXX@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
QSE_PROJECT_AUTHOR = @QSE_PROJECT_AUTHOR@
QSE_PROJECT_URL = @QSE_PROJECT_URL@
QSE_SIZEOF_CHAR = @QSE_SIZEOF_CHAR@
QSE_SIZEOF_DOUBLE = @QSE_SIZEOF_DOUBLE@
QSE_SIZEOF_FLOAT = @QSE_SIZEOF_FLOAT@
QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TRUE = @TRUE@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
qsefs_SOURCES = fs.c
qsefs_LDFLAGS = -L../../lib/cmn -L$(libdir)
qsefs_LDADD = -lqsecmn
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cmd/fs/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign cmd/fs/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
qsefs$(EXEEXT): $(qsefs_OBJECTS) $(qsefs_DEPENDENCIES)
@rm -f qsefs$(EXEEXT)
$(qsefs_LINK) $(qsefs_OBJECTS) $(qsefs_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-binPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

71
qse/cmd/fs/fs.c Normal file
View File

@ -0,0 +1,71 @@
/**
* $Id$
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
QSE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
QSE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#include <qse/cmn/fs.h>
#include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#if defined(_WIN32)
# include <windows.h>
# include <tchar.h>
# include <process.h>
#elif defined(__OS2__)
# define INCL_DOSPROCESS
# define INCL_DOSEXCEPTIONS
# define INCL_ERRORS
# include <os2.h>
# include <signal.h>
#elif defined(__DOS__)
# include <dos.h>
# include <signal.h>
#else
# include <unistd.h>
# include <errno.h>
# include <signal.h>
#endif
int fs_main (int argc, qse_char_t* argv[])
{
qse_fs_t* fs;
fs = qse_fs_open (QSE_NULL, 0);
if (fs == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open fs\n"));
return -1;
}
if (qse_fs_move (fs, argv[1], argv[2]) <= -1)
{
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot move %s to %s - %s\n"), argv[1], argv[2], qse_fs_geterrmsg(fs));
qse_fs_close (fs);
return -1;
}
qse_fs_close (fs);
return 0;
}
int qse_main (int argc, qse_achar_t* argv[])
{
return qse_runmain (argc, argv, fs_main);
}

3
qse/configure vendored
View File

@ -17623,7 +17623,7 @@ QSE_PROJECT_AUTHOR="${PACKAGE_BUGREPORT}"
QSE_PROJECT_URL="${PACKAGE_URL}"
ac_config_files="$ac_config_files Makefile README include/Makefile include/qse/Makefile include/qse/cmn/Makefile include/qse/awk/Makefile include/qse/cut/Makefile include/qse/sed/Makefile include/qse/stx/Makefile include/qse/net/Makefile lib/Makefile lib/cmn/Makefile lib/awk/Makefile lib/cut/Makefile lib/sed/Makefile lib/stx/Makefile lib/net/Makefile cmd/Makefile cmd/awk/Makefile cmd/cut/Makefile cmd/sed/Makefile cmd/stx/Makefile samples/Makefile samples/cmn/Makefile samples/awk/Makefile samples/cut/Makefile samples/sed/Makefile samples/net/Makefile regress/Makefile regress/awk/Makefile regress/awk/regress.sh regress/sed/Makefile regress/sed/regress.sh doc/Makefile doc/page/Makefile doc/image/Makefile doc/Doxyfile"
ac_config_files="$ac_config_files Makefile README include/Makefile include/qse/Makefile include/qse/cmn/Makefile include/qse/awk/Makefile include/qse/cut/Makefile include/qse/sed/Makefile include/qse/stx/Makefile include/qse/net/Makefile lib/Makefile lib/cmn/Makefile lib/awk/Makefile lib/cut/Makefile lib/sed/Makefile lib/stx/Makefile lib/net/Makefile cmd/Makefile cmd/awk/Makefile cmd/cut/Makefile cmd/fs/Makefile cmd/sed/Makefile cmd/stx/Makefile samples/Makefile samples/cmn/Makefile samples/awk/Makefile samples/cut/Makefile samples/sed/Makefile samples/net/Makefile regress/Makefile regress/awk/Makefile regress/awk/regress.sh regress/sed/Makefile regress/sed/regress.sh doc/Makefile doc/page/Makefile doc/image/Makefile doc/Doxyfile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -18734,6 +18734,7 @@ do
"cmd/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/Makefile" ;;
"cmd/awk/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/awk/Makefile" ;;
"cmd/cut/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/cut/Makefile" ;;
"cmd/fs/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/fs/Makefile" ;;
"cmd/sed/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/sed/Makefile" ;;
"cmd/stx/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/stx/Makefile" ;;
"samples/Makefile") CONFIG_FILES="$CONFIG_FILES samples/Makefile" ;;

View File

@ -288,6 +288,7 @@ AC_CONFIG_FILES([
cmd/Makefile
cmd/awk/Makefile
cmd/cut/Makefile
cmd/fs/Makefile
cmd/sed/Makefile
cmd/stx/Makefile
samples/Makefile

View File

@ -33,9 +33,12 @@ enum qse_fs_errnum_t
QSE_FS_ENOMEM,
QSE_FS_EINVAL,
QSE_FS_EACCES,
QSE_FS_EPERM,
QSE_FS_ENOENT,
QSE_FS_ENODIR,
QSE_FS_EISDIR,
QSE_FS_EEXIST,
QSE_FS_EXDEV,
QSE_FS_ESYSTEM
};
typedef enum qse_fs_errnum_t qse_fs_errnum_t;

View File

@ -2387,24 +2387,30 @@ qse_size_t qse_wcsntombsn (
);
/**
* The qse_mbstowcs_strict() function performs the same as the qse_mbstowcs()
* The qse_mbstowcsrigid() function performs the same as the qse_mbstowcs()
* function except that it returns an error if it can't fully convert the
* input string and/or the buffer is not large enough.
* @return 0 on success, -1 on failure.
*
* @return 0 on success,
* -1 on failure for truncation,
* -2 on failure for invalid/incomplete input seqence.
*/
int qse_mbstowcs_strict (
int qse_mbstowcsrigid (
const qse_mchar_t* mbs,
qse_wchar_t* wcs,
qse_size_t wcslen
);
/**
* The qse_wcstombs_strict() function performs the same as the qse_wcstombs()
* The qse_wcstombsrigid() function performs the same as the qse_wcstombs()
* function except that it returns an error if it can't fully convert the
* input string and/or the buffer is not large enough.
* @return 0 on success, -1 on failure.
*
* @return 0 on success,
* -1 on failure for truncation,
* -2 on failure for erroneous input seqence.
*/
int qse_wcstombs_strict (
int qse_wcstombsrigid (
const qse_wchar_t* wcs,
qse_mchar_t* mbs,
qse_size_t mbslen
@ -2413,12 +2419,18 @@ int qse_wcstombs_strict (
qse_wchar_t* qse_mbstowcsdup (
const qse_mchar_t* mbs,
qse_mmgr_t* mmgr
qse_mmgr_t* mmgr
);
qse_mchar_t* qse_wcstombsdup (
const qse_wchar_t* wcs,
qse_mmgr_t* mmgr
qse_mmgr_t* mmgr
);
qse_mchar_t* qse_wcsatombsdup (
const qse_wchar_t* wcs[],
qse_mmgr_t* mmgr
);
QSE_DEFINE_COMMON_FUNCTIONS (mbs)

View File

@ -252,8 +252,8 @@ int qse_fio_init (
const qse_mchar_t* path_mb = path;
#else
qse_mchar_t path_mb[CCHMAXPATH];
if (qse_wcstombs_strict (path,
path_mb, QSE_COUNTOF(path_mb)) == -1) return -1;
if (qse_wcstombsrigid (path,
path_mb, QSE_COUNTOF(path_mb)) <= -1) return -1;
#endif
zero.ulLo = 0;
@ -342,8 +342,8 @@ int qse_fio_init (
const qse_mchar_t* path_mb = path;
#else
qse_mchar_t path_mb[_MAX_PATH];
if (qse_wcstombs_strict (path,
path_mb, QSE_COUNTOF(path_mb)) == -1) return -1;
if (qse_wcstombsrigid (path,
path_mb, QSE_COUNTOF(path_mb)) <= -1) return -1;
#endif
if (flags & QSE_FIO_APPEND)
@ -395,8 +395,8 @@ int qse_fio_init (
const qse_mchar_t* path_mb = path;
#else
qse_mchar_t path_mb[PATH_MAX + 1];
if (qse_wcstombs_strict (path,
path_mb, QSE_COUNTOF(path_mb)) == -1) return -1;
if (qse_wcstombsrigid (path,
path_mb, QSE_COUNTOF(path_mb)) <= -1) return -1;
#endif
/*
* rwa -> RDWR | APPEND

View File

@ -34,10 +34,13 @@ const qse_char_t* qse_fs_geterrmsg (qse_fs_t* fs)
QSE_T("insufficient memory"),
QSE_T("invalid parameter or data"),
QSE_T("permission denied"),
QSE_T("access denied"),
QSE_T("operation not permitted"),
QSE_T("no such entry"),
QSE_T("no working fsectory set"),
QSE_T("already exists"),
QSE_T("no working directory set"),
QSE_T("operation not permitted on directory"),
QSE_T("entry already exists"),
QSE_T("cross-device operation not allowed"),
QSE_T("system error")
};
@ -78,20 +81,28 @@ qse_fs_errnum_t qse_fs_syserrtoerrnum (qse_fs_t* fs, qse_fs_syserr_t e)
case EINVAL:
return QSE_FS_EINVAL;
case ENOMEM:
return QSE_FS_ENOMEM;
case EACCES:
case EPERM:
return QSE_FS_EACCES;
case EPERM:
return QSE_FS_EPERM;
case ENOENT:
case ENOTDIR:
return QSE_FS_ENOENT;
case ENOMEM:
return QSE_FS_ENOMEM;
case EISDIR:
return QSE_FS_EISDIR;
case EEXIST:
return QSE_FS_EEXIST;
case EXDEV:
return QSE_FS_EXDEV;
default:
return QSE_FS_ESYSTEM;
}

View File

@ -20,6 +20,7 @@
#include "fs.h"
#include <qse/cmn/str.h>
#include <qse/cmn/path.h>
#include "mem.h"
@ -29,6 +30,33 @@ QSE_FS_MOVE_UPDATE
QSE_FS_MOVE_BACKUP_SIMPLE
QSE_FS_MOVE_BACKUP_NUMBERED
*/
enum fop_flag_t
{
FOP_OLD_STAT = (1 << 0),
FOP_NEW_STAT = (1 << 1),
FOP_CROSS_DEV = (1 << 2)
};
struct fop_t
{
int flags;
qse_lstat_t old_stat;
qse_lstat_t new_stat;
#if defined(_WIN32)
qse_wchar_t* old_path;
qse_wchar_t* new_path;
qse_wchar_t* new_path2;
#else
qse_mchar_t* old_path;
qse_mchar_t* new_path;
qse_mchar_t* new_path2;
#endif
};
typedef struct fop_t fop_t;
int qse_fs_move (
qse_fs_t* fs, const qse_char_t* oldpath, const qse_char_t* newpath)
@ -64,31 +92,22 @@ int qse_fs_move (
# error NOT IMPLEMENTED
#else
const qse_mchar_t* mbsoldpath;
const qse_mchar_t* mbsnewpath;
fop_t fop;
#if 0
struct file_stat_t
{
int oldst_ok;
int newst_ok;
qse_lstat_t oldst;
qse_lstat_t newst;
};
#endif
QSE_MEMSET (&fop, 0, QSE_SIZEOF(fop));
#if defined(QSE_CHAR_IS_MCHAR)
mbsoldpath = oldpath;
mbsnewpath = newpath;
fop.old_path = oldpath;
fop.new_path = newpath;
#else
mbsoldpath = qse_wcstombsdup (oldpath, fs->mmgr);
mbsnewpath = qse_wcstombsdup (newpath, fs->mmgr);
if (mbsoldpath == QSE_NULL || mbsnewpath == QSE_NULL)
fop.old_path = qse_wcstombsdup (oldpath, fs->mmgr);
fop.new_path = qse_wcstombsdup (newpath, fs->mmgr);
if (fop.old_path == QSE_NULL || fop.old_path == QSE_NULL)
{
fs->errnum = QSE_FS_ENOMEM;
goto oops;
}
#endif
/* TOOD: implement confirmatio
if (overwrite_callback is set)
@ -101,63 +120,130 @@ int qse_fs_move (
}
*/
#if 0
if (opt)
/* use lstat because we need to move the symbolic link
* itself if the file is a symbolic link */
if (QSE_LSTAT (fop.old_path, &fop.old_stat) == -1)
{
/* use lstat because we need to move the symbolic link
* itself if the file is a symbolic link */
if (QSE_LSTAT (mboldpath, &oldst) == -1)
{
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
goto oops;
}
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
goto oops;
}
else fop.flags |= FOP_OLD_STAT;
if (QSE_LSTAT (mbnewpath, &newst) == -1)
if (QSE_LSTAT (fop.new_path, &fop.new_stat) == -1)
{
if (errno == ENOENT)
{
/* entry doesn't exist */
}
}
#endif
else fop.flags |= FOP_NEW_STAT;
/* TODO: make it better to be able to move non-empty diretories
improve it to be able to move by copy/delete across volume */
if (QSE_RENAME (mbsoldpath, mbsnewpath) == -1)
if (fop.flags & FOP_NEW_STAT)
{
if (errno == EXDEV)
/* destination file exits */
if (fop.old_stat.st_dev != fop.new_stat.st_dev)
{
/* TODO: move it by copy and delete intead of returnign error... */
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
goto oops;
/* cross-device */
fop.flags |= FOP_CROSS_DEV;
}
else
{
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
goto oops;
if (fop.old_stat.st_ino == fop.new_stat.st_ino)
{
/* both source and destination are the same.
* this operation is not allowed */
fs->errnum = QSE_FS_EPERM;
goto oops;
}
/* TODO: destination should point to an actual file or directory for this check to work */
/* TOOD: ask to overwrite the source */
if (S_ISDIR(fop.new_stat.st_mode))
{
/* the destination is a directory. move the source file
* into the destination directory */
const qse_wchar_t* arr[4];
arr[0] = newpath;
arr[1] = QSE_T("/");
arr[2] = qse_basename(oldpath);
arr[3] = QSE_NULL;
#if defined(QSE_CHAR_IS_MCHAR)
fop.new_path2 = qse_stradup (arr, fs->mmgr);
#else
fop.new_path2 = qse_wcsatombsdup (arr, fs->mmgr);
#endif
if (fop.new_path2 == QSE_NULL)
{
fs->errnum = QSE_FS_ENOMEM;
goto oops;
}
qse_printf (QSE_T("new_path2 => [%S]\n"), fop.new_path2);
}
else
{
/* the destination file is not directory, unlink first
* TODO: but is this necessary? RENAME will do it */
QSE_UNLINK (fop.new_path);
}
}
}
if (!(fop.flags & FOP_CROSS_DEV))
{
/* TODO: make it better to be able to move non-empty diretories
improve it to be able to move by copy/delete across volume */
if (QSE_RENAME (fop.old_path, fop.new_path) == -1)
{
if (errno != EXDEV)
{
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
goto oops;
}
fop.flags |= FOP_CROSS_DEV;
}
else goto done;
}
QSE_ASSERT (fop.flags & FOP_CROSS_DEV);
if (!S_ISDIR(fop.old_stat.st_mode))
{
/* copy a single file */
qse_printf (QSE_T("TODO: cross-device copy....\n"));
}
#if 0
if (!recursive)
{
fs->errnum = QSE_FS_E....;
goto oops;
}
copy recursively...
#endif
done:
#if defined(QSE_CHAR_IS_MCHAR)
/* nothing to free */
if (fop.new_path2) QSE_MMGR_FREE (fs->mmgr, fop.new_path2);
#else
QSE_MMGR_FREE (fs->mmgr, mbsoldpath);
QSE_MMGR_FREE (fs->mmgr, mbsnewpath);
if (fop.new_path2) QSE_MMGR_FREE (fs->mmgr, fop.new_path2);
QSE_MMGR_FREE (fs->mmgr, fop.old_path);
QSE_MMGR_FREE (fs->mmgr, fop.new_path);
#endif
return 0;
oops:
#if defined(QSE_CHAR_IS_MCHAR)
/* nothing to free */
if (fop.new_path2) QSE_MMGR_FREE (fs->mmgr, fop.new_path2);
#else
if (mbsoldpath) QSE_MMGR_FREE (fs->mmgr, mbsoldpath);
if (mbsnewpath) QSE_MMGR_FREE (fs->mmgr, mbsnewpath);
if (fop.new_path2) QSE_MMGR_FREE (fs->mmgr, fop.new_path2);
if (fop.old_path) QSE_MMGR_FREE (fs->mmgr, fop.old_path);
if (fop.new_path) QSE_MMGR_FREE (fs->mmgr, fop.new_path);
#endif
return -1;
#endif
#endif
}

View File

@ -363,9 +363,10 @@ qse_size_t qse_wcsntombsn (
return p - wcs;
}
int qse_mbstowcs_strict (
int qse_mbstowcsrigid (
const qse_mchar_t* mbs, qse_wchar_t* wcs, qse_size_t wcslen)
{
/* no truncation is allowed in this function for any reasons */
qse_size_t n;
qse_size_t wn = wcslen;
@ -380,15 +381,16 @@ int qse_mbstowcs_strict (
if (mbs[n] != QSE_MT('\0'))
{
/* incomplete sequence or invalid sequence */
return -1;
return -2;
}
return 0;
}
int qse_wcstombs_strict (
int qse_wcstombsrigid (
const qse_wchar_t* wcs, qse_mchar_t* mbs, qse_size_t mbslen)
{
/* no truncation is allowed in this function for any reasons */
qse_size_t n;
qse_size_t mn = mbslen;
@ -405,14 +407,13 @@ int qse_wcstombs_strict (
/* if qse_wcstombs() processed all wide characters,
* the character at position 'n' should be a null character
* as 'n' is the number of wide characters processed. */
return -1;
return -2;
}
return 0;
}
qse_wchar_t* qse_mbstowcsdup (
const qse_mchar_t* mbs, qse_mmgr_t* mmgr)
qse_wchar_t* qse_mbstowcsdup (const qse_mchar_t* mbs, qse_mmgr_t* mmgr)
{
qse_size_t n, req;
qse_wchar_t* wcs;
@ -429,8 +430,7 @@ qse_wchar_t* qse_mbstowcsdup (
return wcs;
}
qse_mchar_t* qse_wcstombsdup (
const qse_wchar_t* wcs, qse_mmgr_t* mmgr)
qse_mchar_t* qse_wcstombsdup (const qse_wchar_t* wcs, qse_mmgr_t* mmgr)
{
qse_size_t n, req;
qse_mchar_t* mbs;
@ -447,6 +447,38 @@ qse_mchar_t* qse_wcstombsdup (
return mbs;
}
qse_mchar_t* qse_wcsatombsdup (const qse_wchar_t* wcs[], qse_mmgr_t* mmgr)
{
qse_mchar_t* buf, * ptr;
qse_size_t i;
qse_size_t capa = 0;
qse_size_t wl, ml;
QSE_ASSERT (mmgr != QSE_NULL);
for (i = 0; wcs[i]; i++)
{
wl = qse_wcstombslen(wcs[i], &ml);
if (wcs[i][wl] != QSE_WT('\0')) return QSE_NULL;
capa += ml;
}
buf = (qse_mchar_t*) QSE_MMGR_ALLOC (mmgr, (capa+1)*QSE_SIZEOF(*buf));
if (buf == QSE_NULL) return QSE_NULL;
ptr = buf;
for (i = 0; wcs[i]; i++)
{
ml = capa + 1;
wl = qse_wcstombs (wcs[i], ptr, &ml);
ptr += ml;
capa -= ml;
}
return buf;
}
/* case conversion */
qse_size_t qse_mbslwr (qse_mchar_t* str)

View File

@ -292,6 +292,7 @@
#if defined(SYS_rename)
# define QSE_RENAME(oldpath,newpath) syscall(SYS_rename,oldpath,newpath)
#else
int rename(const char *oldpath, const char *newpath); /* not to include stdio.h */
# define QSE_RENAME(oldpath,newpath) rename(oldpath,newpath)
#endif

View File

@ -415,7 +415,7 @@ static int test9 (void)
qse_printf (QSE_T("[%s] => "), x[i]);
#endif
if (qse_wcstombs_strict (x[i], buf, QSE_COUNTOF(buf)) == -1)
if (qse_wcstombsrigid (x[i], buf, QSE_COUNTOF(buf)) == -1)
{
qse_printf (QSE_T("ERROR\n"));
}