migrated fs/path.c to cmn/path.c
This commit is contained in:
parent
b5b23cbc36
commit
23ee1f7f51
@ -24,7 +24,7 @@
|
|||||||
#include <qse/cmn/mem.h>
|
#include <qse/cmn/mem.h>
|
||||||
#include <qse/cmn/chr.h>
|
#include <qse/cmn/chr.h>
|
||||||
#include <qse/cmn/opt.h>
|
#include <qse/cmn/opt.h>
|
||||||
#include <qse/cmn/misc.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/xma.h>
|
#include <qse/cmn/xma.h>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include <qse/cmn/chr.h>
|
#include <qse/cmn/chr.h>
|
||||||
#include <qse/cmn/opt.h>
|
#include <qse/cmn/opt.h>
|
||||||
#include <qse/cmn/sio.h>
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/misc.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <qse/cmn/opt.h>
|
#include <qse/cmn/opt.h>
|
||||||
#include <qse/cmn/sio.h>
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/xma.h>
|
#include <qse/cmn/xma.h>
|
||||||
#include <qse/cmn/misc.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
|
|
||||||
|
@ -13,9 +13,9 @@ pkginclude_HEADERS = \
|
|||||||
main.h \
|
main.h \
|
||||||
map.h \
|
map.h \
|
||||||
mem.h \
|
mem.h \
|
||||||
misc.h \
|
|
||||||
oht.h \
|
oht.h \
|
||||||
opt.h \
|
opt.h \
|
||||||
|
path.h \
|
||||||
pio.h \
|
pio.h \
|
||||||
pma.h \
|
pma.h \
|
||||||
rbt.h \
|
rbt.h \
|
||||||
|
@ -52,7 +52,7 @@ CONFIG_CLEAN_VPATH_FILES =
|
|||||||
SOURCES =
|
SOURCES =
|
||||||
DIST_SOURCES =
|
DIST_SOURCES =
|
||||||
am__pkginclude_HEADERS_DIST = alg.h chr.h dll.h env.h fio.h fma.h \
|
am__pkginclude_HEADERS_DIST = alg.h chr.h dll.h env.h fio.h fma.h \
|
||||||
gdl.h htb.h lda.h main.h map.h mem.h misc.h oht.h opt.h pio.h \
|
gdl.h htb.h lda.h main.h map.h mem.h oht.h opt.h path.h pio.h \
|
||||||
pma.h rbt.h rex.h sio.h sll.h stdio.h str.h time.h tio.h tre.h \
|
pma.h rbt.h rex.h sio.h sll.h stdio.h str.h time.h tio.h tre.h \
|
||||||
xma.h Mmgr.hpp StdMmgr.hpp Mmged.hpp
|
xma.h Mmgr.hpp StdMmgr.hpp Mmged.hpp
|
||||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||||
@ -224,7 +224,7 @@ top_build_prefix = @top_build_prefix@
|
|||||||
top_builddir = @top_builddir@
|
top_builddir = @top_builddir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
pkginclude_HEADERS = alg.h chr.h dll.h env.h fio.h fma.h gdl.h htb.h \
|
pkginclude_HEADERS = alg.h chr.h dll.h env.h fio.h fma.h gdl.h htb.h \
|
||||||
lda.h main.h map.h mem.h misc.h oht.h opt.h pio.h pma.h rbt.h \
|
lda.h main.h map.h mem.h oht.h opt.h path.h pio.h pma.h rbt.h \
|
||||||
rex.h sio.h sll.h stdio.h str.h time.h tio.h tre.h xma.h \
|
rex.h sio.h sll.h stdio.h str.h time.h tio.h tre.h xma.h \
|
||||||
$(am__append_1)
|
$(am__append_1)
|
||||||
all: all-am
|
all: all-am
|
||||||
|
@ -18,8 +18,12 @@
|
|||||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _QSE_CMN_MISC_H_
|
#ifndef _QSE_CMN_PATH_H_
|
||||||
#define _QSE_CMN_MISC_H_
|
#define _QSE_CMN_PATH_H_
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
* This file provides functions for simple path name manipulation.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <qse/types.h>
|
#include <qse/types.h>
|
||||||
#include <qse/macros.h>
|
#include <qse/macros.h>
|
||||||
@ -42,6 +46,24 @@ const qse_wchar_t* qse_wcsbasename (
|
|||||||
const qse_wchar_t* path
|
const qse_wchar_t* path
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The qse_canonpath() function deletes unnecessary path segments
|
||||||
|
* from a path name 'path' and stores it to a memory buffer pointed
|
||||||
|
* to by 'canon'. It null-terminates the canonical path in 'canon' and
|
||||||
|
* returns the number of characters excluding the terminating null.
|
||||||
|
* The caller must ensure that it is large enough before calling this
|
||||||
|
* because this function does not check the size of the memory buffer.
|
||||||
|
* Since the canonical path cannot be larger than the original path,
|
||||||
|
* you can simply ensure this by providing a memory buffer as long as
|
||||||
|
* the number of characters and a terminating null in the original path.
|
||||||
|
*
|
||||||
|
* @return the number of characters in the resulting canonical path.
|
||||||
|
*/
|
||||||
|
qse_size_t qse_canonpath (
|
||||||
|
const qse_char_t* path,
|
||||||
|
qse_char_t* canon
|
||||||
|
);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -111,6 +111,26 @@ int qse_sed_compstd (
|
|||||||
qse_size_t* count /**< number of input scripts opened */
|
qse_size_t* count /**< number of input scripts opened */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_sed_compstdfile() function compiles a sed script from
|
||||||
|
* a single file @a infile.
|
||||||
|
* @return 0 on success, -1 on failure
|
||||||
|
*/
|
||||||
|
int qse_sed_compstdfile (
|
||||||
|
qse_sed_t* sed,
|
||||||
|
const qse_char_t* infile
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_sed_compstdmem() function compiles a sed script stored
|
||||||
|
* in a null-terminated string pointed to by @a str.
|
||||||
|
* @return 0 on success, -1 on failure
|
||||||
|
*/
|
||||||
|
int qse_sed_compstdmem (
|
||||||
|
qse_sed_t* sed,
|
||||||
|
const qse_char_t* str
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_sed_execstd() function executes a compiled script
|
* The qse_sed_execstd() function executes a compiled script
|
||||||
* over input streams @a in and an output stream @a out.
|
* over input streams @a in and an output stream @a out.
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include <qse/cmn/fio.h>
|
#include <qse/cmn/fio.h>
|
||||||
#include <qse/cmn/pio.h>
|
#include <qse/cmn/pio.h>
|
||||||
#include <qse/cmn/sio.h>
|
#include <qse/cmn/sio.h>
|
||||||
#include <qse/cmn/misc.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include "awk.h"
|
#include "awk.h"
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include <qse/cmn/pio.h>
|
#include <qse/cmn/pio.h>
|
||||||
#include <qse/cmn/str.h>
|
#include <qse/cmn/str.h>
|
||||||
#include <qse/cmn/time.h>
|
#include <qse/cmn/time.h>
|
||||||
#include <qse/cmn/misc.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h> /* TODO: remove dependency on qse_vsprintf */
|
#include <qse/cmn/stdio.h> /* TODO: remove dependency on qse_vsprintf */
|
||||||
#include "../cmn/mem.h"
|
#include "../cmn/mem.h"
|
||||||
|
|
||||||
|
@ -25,11 +25,12 @@ libqsecmn_la_SOURCES = \
|
|||||||
main.c \
|
main.c \
|
||||||
mem.c \
|
mem.c \
|
||||||
mem.h \
|
mem.h \
|
||||||
misc.c \
|
|
||||||
oht.c \
|
oht.c \
|
||||||
opt.c \
|
opt.c \
|
||||||
pma.c \
|
path-basename.c \
|
||||||
|
path-canon.c \
|
||||||
pio.c \
|
pio.c \
|
||||||
|
pma.c \
|
||||||
rbt.c \
|
rbt.c \
|
||||||
rex.c \
|
rex.c \
|
||||||
sio.c \
|
sio.c \
|
||||||
|
@ -75,17 +75,17 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
|
|||||||
libqsecmn_la_DEPENDENCIES =
|
libqsecmn_la_DEPENDENCIES =
|
||||||
am_libqsecmn_la_OBJECTS = alg-search.lo alg-sort.lo assert.lo chr.lo \
|
am_libqsecmn_la_OBJECTS = alg-search.lo alg-sort.lo assert.lo chr.lo \
|
||||||
chr-cnv.lo dll.lo env.lo gdl.lo htb.lo lda.lo fio.lo fma.lo \
|
chr-cnv.lo dll.lo env.lo gdl.lo htb.lo lda.lo fio.lo fma.lo \
|
||||||
main.lo mem.lo misc.lo oht.lo opt.lo pma.lo pio.lo rbt.lo \
|
main.lo mem.lo oht.lo opt.lo path-basename.lo path-canon.lo \
|
||||||
rex.lo sio.lo sll.lo str-beg.lo str-cat.lo str-chr.lo \
|
pio.lo pma.lo rbt.lo rex.lo sio.lo sll.lo str-beg.lo \
|
||||||
str-cnv.lo str-cmp.lo str-cpy.lo str-del.lo str-dup.lo \
|
str-cat.lo str-chr.lo str-cnv.lo str-cmp.lo str-cpy.lo \
|
||||||
str-dynm.lo str-dynw.lo str-end.lo str-excl.lo str-fcpy.lo \
|
str-del.lo str-dup.lo str-dynm.lo str-dynw.lo str-end.lo \
|
||||||
str-fnmat.lo str-incl.lo str-len.lo str-pac.lo str-pbrk.lo \
|
str-excl.lo str-fcpy.lo str-fnmat.lo str-incl.lo str-len.lo \
|
||||||
str-put.lo str-rev.lo str-rot.lo str-set.lo str-spl.lo \
|
str-pac.lo str-pbrk.lo str-put.lo str-rev.lo str-rot.lo \
|
||||||
str-spn.lo str-str.lo str-subst.lo str-tok.lo str-trm.lo \
|
str-set.lo str-spl.lo str-spn.lo str-str.lo str-subst.lo \
|
||||||
str-word.lo time.lo tio.lo tio-get.lo tio-put.lo tre.lo \
|
str-tok.lo str-trm.lo str-word.lo time.lo tio.lo tio-get.lo \
|
||||||
tre-ast.lo tre-compile.lo tre-match-backtrack.lo \
|
tio-put.lo tre.lo tre-ast.lo tre-compile.lo \
|
||||||
tre-match-parallel.lo tre-parse.lo tre-stack.lo stdio.lo \
|
tre-match-backtrack.lo tre-match-parallel.lo tre-parse.lo \
|
||||||
xma.lo
|
tre-stack.lo stdio.lo xma.lo
|
||||||
libqsecmn_la_OBJECTS = $(am_libqsecmn_la_OBJECTS)
|
libqsecmn_la_OBJECTS = $(am_libqsecmn_la_OBJECTS)
|
||||||
libqsecmn_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
libqsecmn_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
@ -291,11 +291,12 @@ libqsecmn_la_SOURCES = \
|
|||||||
main.c \
|
main.c \
|
||||||
mem.c \
|
mem.c \
|
||||||
mem.h \
|
mem.h \
|
||||||
misc.c \
|
|
||||||
oht.c \
|
oht.c \
|
||||||
opt.c \
|
opt.c \
|
||||||
pma.c \
|
path-basename.c \
|
||||||
|
path-canon.c \
|
||||||
pio.c \
|
pio.c \
|
||||||
|
pma.c \
|
||||||
rbt.c \
|
rbt.c \
|
||||||
rex.c \
|
rex.c \
|
||||||
sio.c \
|
sio.c \
|
||||||
@ -448,9 +449,10 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lda.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lda.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Plo@am__quote@
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oht.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oht.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opt.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opt.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path-basename.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path-canon.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pma.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pma.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rbt.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rbt.Plo@am__quote@
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qse/cmn/misc.h>
|
#include <qse/cmn/path.h>
|
||||||
|
|
||||||
|
|
||||||
const qse_mchar_t* qse_mbsbasename (const qse_mchar_t* path)
|
const qse_mchar_t* qse_mbsbasename (const qse_mchar_t* path)
|
@ -18,7 +18,7 @@
|
|||||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qse/fs/path.h>
|
#include <qse/cmn/path.h>
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
# define ISSEP(c) ((c) == QSE_T('/') || (c) == QSE_T('\\'))
|
# define ISSEP(c) ((c) == QSE_T('/') || (c) == QSE_T('\\'))
|
||||||
@ -59,18 +59,23 @@ qse_size_t qse_canonpath (const qse_char_t* path, qse_char_t* canon)
|
|||||||
has_root = 1;
|
has_root = 1;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
/* handle UNC path */
|
/* handle UNC path for Windows */
|
||||||
if (ISSEP(*ptr))
|
if (ISSEP(*ptr))
|
||||||
{
|
{
|
||||||
*dst++ = *ptr++;
|
*dst++ = *ptr++;
|
||||||
|
|
||||||
/* if it starts with \\, process host name */
|
if (ISSEPNIL(*ptr))
|
||||||
while (!ISSEPNIL(*ptr)) *dst++ = *ptr++;
|
{
|
||||||
|
/* if there is another separator after \\,
|
||||||
/* \ following the host name. note that
|
* it's not an UNC path. */
|
||||||
* \\\ is treated as if the host name is empty. */
|
dst--;
|
||||||
|
}
|
||||||
if (ISSEP(*ptr)) *dst++ = *ptr++;
|
else
|
||||||
|
{
|
||||||
|
/* if it starts with \\, process host name */
|
||||||
|
do { *dst++ = *ptr++; } while (!ISSEPNIL(*ptr));
|
||||||
|
if (ISSEP(*ptr)) *dst++ = *ptr++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -183,8 +188,13 @@ qse_size_t qse_canonpath (const qse_char_t* path, qse_char_t* canon)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
normal:
|
normal:
|
||||||
while (seg <= ptr) *dst++ = *seg++;
|
while (seg < ptr) *dst++ = *seg++;
|
||||||
if (ISSEP(*ptr)) ptr++;
|
if (ISSEP(*ptr))
|
||||||
|
{
|
||||||
|
/* this segment ended with a separator */
|
||||||
|
*dst++ = *seg++; /* copy the separator */
|
||||||
|
ptr++; /* move forward the pointer */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (1);
|
while (1);
|
@ -7,8 +7,7 @@ AM_CPPFLAGS = \
|
|||||||
|
|
||||||
lib_LTLIBRARIES = libqsefs.la
|
lib_LTLIBRARIES = libqsefs.la
|
||||||
libqsefs_la_SOURCES = \
|
libqsefs_la_SOURCES = \
|
||||||
dir.c \
|
dir.c
|
||||||
path.c
|
|
||||||
|
|
||||||
libqsefs_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn -L$(libdir)
|
libqsefs_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn -L$(libdir)
|
||||||
libqsefs_la_LIBADD = -lqsecmn
|
libqsefs_la_LIBADD = -lqsecmn
|
||||||
|
@ -72,7 +72,7 @@ am__base_list = \
|
|||||||
am__installdirs = "$(DESTDIR)$(libdir)"
|
am__installdirs = "$(DESTDIR)$(libdir)"
|
||||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||||
libqsefs_la_DEPENDENCIES =
|
libqsefs_la_DEPENDENCIES =
|
||||||
am_libqsefs_la_OBJECTS = dir.lo path.lo
|
am_libqsefs_la_OBJECTS = dir.lo
|
||||||
libqsefs_la_OBJECTS = $(am_libqsefs_la_OBJECTS)
|
libqsefs_la_OBJECTS = $(am_libqsefs_la_OBJECTS)
|
||||||
libqsefs_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
libqsefs_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
@ -244,8 +244,7 @@ AM_CPPFLAGS = \
|
|||||||
|
|
||||||
lib_LTLIBRARIES = libqsefs.la
|
lib_LTLIBRARIES = libqsefs.la
|
||||||
libqsefs_la_SOURCES = \
|
libqsefs_la_SOURCES = \
|
||||||
dir.c \
|
dir.c
|
||||||
path.c
|
|
||||||
|
|
||||||
libqsefs_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn -L$(libdir)
|
libqsefs_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn -L$(libdir)
|
||||||
libqsefs_la_LIBADD = -lqsecmn
|
libqsefs_la_LIBADD = -lqsecmn
|
||||||
@ -324,7 +323,6 @@ distclean-compile:
|
|||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path.Plo@am__quote@
|
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||||
|
@ -756,6 +756,29 @@ int qse_sed_execstd (
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int qse_sed_compstdfile (qse_sed_t* sed, const qse_char_t* file)
|
||||||
|
{
|
||||||
|
qse_sed_iostd_t in[2];
|
||||||
|
|
||||||
|
in[0].type = QSE_SED_IOSTD_FILE;
|
||||||
|
in[0].u.file = file;
|
||||||
|
in[1].type = QSE_SED_IOSTD_NULL;
|
||||||
|
|
||||||
|
return qse_sed_compstd (sed, in, QSE_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
int qse_sed_compstdmem (qse_sed_t* sed, const qse_char_t* script)
|
||||||
|
{
|
||||||
|
qse_sed_iostd_t in[2];
|
||||||
|
|
||||||
|
in[0].type = QSE_SED_IOSTD_MEM;
|
||||||
|
in[0].u.mem.ptr = script;
|
||||||
|
in[0].u.mem.len = qse_strlen(script);
|
||||||
|
in[1].type = QSE_SED_IOSTD_NULL;
|
||||||
|
|
||||||
|
return qse_sed_compstd (sed, in, QSE_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
int qse_sed_execstdfile (
|
int qse_sed_execstdfile (
|
||||||
qse_sed_t* sed, const qse_char_t* infile, const qse_char_t* outfile)
|
qse_sed_t* sed, const qse_char_t* infile, const qse_char_t* outfile)
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ AM_CPPFLAGS = \
|
|||||||
-I$(includedir)
|
-I$(includedir)
|
||||||
|
|
||||||
|
|
||||||
bin_PROGRAMS = xma fma pma chr str sll dll lda oht htb rbt fio pio sio time main main2 rex01 env tre01
|
bin_PROGRAMS = xma fma pma chr str sll dll lda oht htb rbt fio pio sio time main main2 rex01 env path01 tre01
|
||||||
|
|
||||||
LDFLAGS = -L../../lib/cmn
|
LDFLAGS = -L../../lib/cmn
|
||||||
LDADD = -lqsecmn
|
LDADD = -lqsecmn
|
||||||
@ -30,6 +30,7 @@ main_SOURCES = main.c
|
|||||||
main2_SOURCES = main2.c
|
main2_SOURCES = main2.c
|
||||||
rex01_SOURCES = rex01.c
|
rex01_SOURCES = rex01.c
|
||||||
env_SOURCES = env.c
|
env_SOURCES = env.c
|
||||||
|
path01_SOURCES = path01.c
|
||||||
tre01_SOURCES = tre01.c
|
tre01_SOURCES = tre01.c
|
||||||
|
|
||||||
if ENABLE_CXX
|
if ENABLE_CXX
|
||||||
|
@ -38,7 +38,8 @@ bin_PROGRAMS = xma$(EXEEXT) fma$(EXEEXT) pma$(EXEEXT) chr$(EXEEXT) \
|
|||||||
str$(EXEEXT) sll$(EXEEXT) dll$(EXEEXT) lda$(EXEEXT) \
|
str$(EXEEXT) sll$(EXEEXT) dll$(EXEEXT) lda$(EXEEXT) \
|
||||||
oht$(EXEEXT) htb$(EXEEXT) rbt$(EXEEXT) fio$(EXEEXT) \
|
oht$(EXEEXT) htb$(EXEEXT) rbt$(EXEEXT) fio$(EXEEXT) \
|
||||||
pio$(EXEEXT) sio$(EXEEXT) time$(EXEEXT) main$(EXEEXT) \
|
pio$(EXEEXT) sio$(EXEEXT) time$(EXEEXT) main$(EXEEXT) \
|
||||||
main2$(EXEEXT) rex01$(EXEEXT) env$(EXEEXT) tre01$(EXEEXT)
|
main2$(EXEEXT) rex01$(EXEEXT) env$(EXEEXT) path01$(EXEEXT) \
|
||||||
|
tre01$(EXEEXT)
|
||||||
subdir = samples/cmn
|
subdir = samples/cmn
|
||||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
@ -95,6 +96,10 @@ am_oht_OBJECTS = oht.$(OBJEXT)
|
|||||||
oht_OBJECTS = $(am_oht_OBJECTS)
|
oht_OBJECTS = $(am_oht_OBJECTS)
|
||||||
oht_LDADD = $(LDADD)
|
oht_LDADD = $(LDADD)
|
||||||
oht_DEPENDENCIES =
|
oht_DEPENDENCIES =
|
||||||
|
am_path01_OBJECTS = path01.$(OBJEXT)
|
||||||
|
path01_OBJECTS = $(am_path01_OBJECTS)
|
||||||
|
path01_LDADD = $(LDADD)
|
||||||
|
path01_DEPENDENCIES =
|
||||||
am_pio_OBJECTS = pio.$(OBJEXT)
|
am_pio_OBJECTS = pio.$(OBJEXT)
|
||||||
pio_OBJECTS = $(am_pio_OBJECTS)
|
pio_OBJECTS = $(am_pio_OBJECTS)
|
||||||
pio_LDADD = $(LDADD)
|
pio_LDADD = $(LDADD)
|
||||||
@ -150,15 +155,16 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
|||||||
$(LDFLAGS) -o $@
|
$(LDFLAGS) -o $@
|
||||||
SOURCES = $(chr_SOURCES) $(dll_SOURCES) $(env_SOURCES) $(fio_SOURCES) \
|
SOURCES = $(chr_SOURCES) $(dll_SOURCES) $(env_SOURCES) $(fio_SOURCES) \
|
||||||
$(fma_SOURCES) $(htb_SOURCES) $(lda_SOURCES) $(main_SOURCES) \
|
$(fma_SOURCES) $(htb_SOURCES) $(lda_SOURCES) $(main_SOURCES) \
|
||||||
$(main2_SOURCES) $(oht_SOURCES) $(pio_SOURCES) $(pma_SOURCES) \
|
$(main2_SOURCES) $(oht_SOURCES) $(path01_SOURCES) \
|
||||||
$(rbt_SOURCES) $(rex01_SOURCES) $(sio_SOURCES) $(sll_SOURCES) \
|
$(pio_SOURCES) $(pma_SOURCES) $(rbt_SOURCES) $(rex01_SOURCES) \
|
||||||
$(str_SOURCES) $(time_SOURCES) $(tre01_SOURCES) $(xma_SOURCES)
|
$(sio_SOURCES) $(sll_SOURCES) $(str_SOURCES) $(time_SOURCES) \
|
||||||
|
$(tre01_SOURCES) $(xma_SOURCES)
|
||||||
DIST_SOURCES = $(chr_SOURCES) $(dll_SOURCES) $(env_SOURCES) \
|
DIST_SOURCES = $(chr_SOURCES) $(dll_SOURCES) $(env_SOURCES) \
|
||||||
$(fio_SOURCES) $(fma_SOURCES) $(htb_SOURCES) $(lda_SOURCES) \
|
$(fio_SOURCES) $(fma_SOURCES) $(htb_SOURCES) $(lda_SOURCES) \
|
||||||
$(main_SOURCES) $(main2_SOURCES) $(oht_SOURCES) $(pio_SOURCES) \
|
$(main_SOURCES) $(main2_SOURCES) $(oht_SOURCES) \
|
||||||
$(pma_SOURCES) $(rbt_SOURCES) $(rex01_SOURCES) $(sio_SOURCES) \
|
$(path01_SOURCES) $(pio_SOURCES) $(pma_SOURCES) $(rbt_SOURCES) \
|
||||||
$(sll_SOURCES) $(str_SOURCES) $(time_SOURCES) $(tre01_SOURCES) \
|
$(rex01_SOURCES) $(sio_SOURCES) $(sll_SOURCES) $(str_SOURCES) \
|
||||||
$(xma_SOURCES)
|
$(time_SOURCES) $(tre01_SOURCES) $(xma_SOURCES)
|
||||||
ETAGS = etags
|
ETAGS = etags
|
||||||
CTAGS = ctags
|
CTAGS = ctags
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
@ -329,6 +335,7 @@ main_SOURCES = main.c
|
|||||||
main2_SOURCES = main2.c
|
main2_SOURCES = main2.c
|
||||||
rex01_SOURCES = rex01.c
|
rex01_SOURCES = rex01.c
|
||||||
env_SOURCES = env.c
|
env_SOURCES = env.c
|
||||||
|
path01_SOURCES = path01.c
|
||||||
tre01_SOURCES = tre01.c
|
tre01_SOURCES = tre01.c
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
@ -437,6 +444,9 @@ main2$(EXEEXT): $(main2_OBJECTS) $(main2_DEPENDENCIES)
|
|||||||
oht$(EXEEXT): $(oht_OBJECTS) $(oht_DEPENDENCIES)
|
oht$(EXEEXT): $(oht_OBJECTS) $(oht_DEPENDENCIES)
|
||||||
@rm -f oht$(EXEEXT)
|
@rm -f oht$(EXEEXT)
|
||||||
$(LINK) $(oht_OBJECTS) $(oht_LDADD) $(LIBS)
|
$(LINK) $(oht_OBJECTS) $(oht_LDADD) $(LIBS)
|
||||||
|
path01$(EXEEXT): $(path01_OBJECTS) $(path01_DEPENDENCIES)
|
||||||
|
@rm -f path01$(EXEEXT)
|
||||||
|
$(LINK) $(path01_OBJECTS) $(path01_LDADD) $(LIBS)
|
||||||
pio$(EXEEXT): $(pio_OBJECTS) $(pio_DEPENDENCIES)
|
pio$(EXEEXT): $(pio_OBJECTS) $(pio_DEPENDENCIES)
|
||||||
@rm -f pio$(EXEEXT)
|
@rm -f pio$(EXEEXT)
|
||||||
$(LINK) $(pio_OBJECTS) $(pio_LDADD) $(LIBS)
|
$(LINK) $(pio_OBJECTS) $(pio_LDADD) $(LIBS)
|
||||||
@ -484,6 +494,7 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main2.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main2.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oht.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oht.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path01.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pma.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pma.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rbt.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rbt.Po@am__quote@
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#include <qse/fs/dir.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/str.h>
|
#include <qse/cmn/str.h>
|
@ -1,7 +1,7 @@
|
|||||||
#include <qse/cmn/rex.h>
|
#include <qse/cmn/rex.h>
|
||||||
#include <qse/cmn/str.h>
|
#include <qse/cmn/str.h>
|
||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/misc.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
static int rex_main (int argc, qse_char_t* argv[])
|
static int rex_main (int argc, qse_char_t* argv[])
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <qse/cmn/main.h>
|
#include <qse/cmn/main.h>
|
||||||
#include <qse/cmn/tre.h>
|
#include <qse/cmn/tre.h>
|
||||||
#include <qse/cmn/mem.h>
|
#include <qse/cmn/mem.h>
|
||||||
#include <qse/cmn/misc.h>
|
#include <qse/cmn/path.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
|
|
||||||
static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
static int test_main (int argc, qse_char_t* argv[], qse_char_t* envp[])
|
||||||
|
@ -6,12 +6,10 @@ AM_CPPFLAGS = \
|
|||||||
-I$(includedir)
|
-I$(includedir)
|
||||||
|
|
||||||
bin_PROGRAMS = \
|
bin_PROGRAMS = \
|
||||||
dir01 \
|
dir01
|
||||||
path01
|
|
||||||
|
|
||||||
LDFLAGS += -L../../lib/cmn -L../../lib/fs
|
LDFLAGS += -L../../lib/cmn -L../../lib/fs
|
||||||
LDADD = -lqsefs -lqsecmn
|
LDADD = -lqsefs -lqsecmn
|
||||||
|
|
||||||
dir01_SOURCES = dir01.c
|
dir01_SOURCES = dir01.c
|
||||||
path01_SOURCES = path01.c
|
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ PRE_UNINSTALL = :
|
|||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
build_triplet = @build@
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
bin_PROGRAMS = dir01$(EXEEXT) path01$(EXEEXT)
|
bin_PROGRAMS = dir01$(EXEEXT)
|
||||||
subdir = samples/fs
|
subdir = samples/fs
|
||||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
@ -55,10 +55,6 @@ am_dir01_OBJECTS = dir01.$(OBJEXT)
|
|||||||
dir01_OBJECTS = $(am_dir01_OBJECTS)
|
dir01_OBJECTS = $(am_dir01_OBJECTS)
|
||||||
dir01_LDADD = $(LDADD)
|
dir01_LDADD = $(LDADD)
|
||||||
dir01_DEPENDENCIES =
|
dir01_DEPENDENCIES =
|
||||||
am_path01_OBJECTS = path01.$(OBJEXT)
|
|
||||||
path01_OBJECTS = $(am_path01_OBJECTS)
|
|
||||||
path01_LDADD = $(LDADD)
|
|
||||||
path01_DEPENDENCIES =
|
|
||||||
DEFAULT_INCLUDES =
|
DEFAULT_INCLUDES =
|
||||||
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
|
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
|
||||||
am__depfiles_maybe = depfiles
|
am__depfiles_maybe = depfiles
|
||||||
@ -72,8 +68,8 @@ CCLD = $(CC)
|
|||||||
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||||
$(LDFLAGS) -o $@
|
$(LDFLAGS) -o $@
|
||||||
SOURCES = $(dir01_SOURCES) $(path01_SOURCES)
|
SOURCES = $(dir01_SOURCES)
|
||||||
DIST_SOURCES = $(dir01_SOURCES) $(path01_SOURCES)
|
DIST_SOURCES = $(dir01_SOURCES)
|
||||||
ETAGS = etags
|
ETAGS = etags
|
||||||
CTAGS = ctags
|
CTAGS = ctags
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
@ -226,7 +222,6 @@ AM_CPPFLAGS = \
|
|||||||
|
|
||||||
LDADD = -lqsefs -lqsecmn
|
LDADD = -lqsefs -lqsecmn
|
||||||
dir01_SOURCES = dir01.c
|
dir01_SOURCES = dir01.c
|
||||||
path01_SOURCES = path01.c
|
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
@ -307,9 +302,6 @@ clean-binPROGRAMS:
|
|||||||
dir01$(EXEEXT): $(dir01_OBJECTS) $(dir01_DEPENDENCIES)
|
dir01$(EXEEXT): $(dir01_OBJECTS) $(dir01_DEPENDENCIES)
|
||||||
@rm -f dir01$(EXEEXT)
|
@rm -f dir01$(EXEEXT)
|
||||||
$(LINK) $(dir01_OBJECTS) $(dir01_LDADD) $(LIBS)
|
$(LINK) $(dir01_OBJECTS) $(dir01_LDADD) $(LIBS)
|
||||||
path01$(EXEEXT): $(path01_OBJECTS) $(path01_DEPENDENCIES)
|
|
||||||
@rm -f path01$(EXEEXT)
|
|
||||||
$(LINK) $(path01_OBJECTS) $(path01_LDADD) $(LIBS)
|
|
||||||
|
|
||||||
mostlyclean-compile:
|
mostlyclean-compile:
|
||||||
-rm -f *.$(OBJEXT)
|
-rm -f *.$(OBJEXT)
|
||||||
@ -318,7 +310,6 @@ distclean-compile:
|
|||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir01.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir01.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path01.Po@am__quote@
|
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||||
|
@ -42,7 +42,7 @@ int sed_main (int argc, qse_char_t* argv[])
|
|||||||
goto oops;
|
goto oops;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qse_sed_compstd (sed, argv[1]) <= -1)
|
if (qse_sed_compstdmem (sed, argv[1]) <= -1)
|
||||||
{
|
{
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"), qse_sed_geterrmsg(sed));
|
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"), qse_sed_geterrmsg(sed));
|
||||||
goto oops;
|
goto oops;
|
||||||
|
Loading…
Reference in New Issue
Block a user