migrated fs/path.c to cmn/path.c
This commit is contained in:
@ -24,7 +24,7 @@
|
||||
#include <qse/cmn/fio.h>
|
||||
#include <qse/cmn/pio.h>
|
||||
#include <qse/cmn/sio.h>
|
||||
#include <qse/cmn/misc.h>
|
||||
#include <qse/cmn/path.h>
|
||||
#include <qse/cmn/stdio.h>
|
||||
#include "awk.h"
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include <qse/cmn/pio.h>
|
||||
#include <qse/cmn/str.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 "../cmn/mem.h"
|
||||
|
||||
|
@ -25,11 +25,12 @@ libqsecmn_la_SOURCES = \
|
||||
main.c \
|
||||
mem.c \
|
||||
mem.h \
|
||||
misc.c \
|
||||
oht.c \
|
||||
opt.c \
|
||||
pma.c \
|
||||
path-basename.c \
|
||||
path-canon.c \
|
||||
pio.c \
|
||||
pma.c \
|
||||
rbt.c \
|
||||
rex.c \
|
||||
sio.c \
|
||||
|
@ -75,17 +75,17 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libqsecmn_la_DEPENDENCIES =
|
||||
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 \
|
||||
main.lo mem.lo misc.lo oht.lo opt.lo pma.lo pio.lo rbt.lo \
|
||||
rex.lo sio.lo sll.lo str-beg.lo str-cat.lo str-chr.lo \
|
||||
str-cnv.lo str-cmp.lo str-cpy.lo str-del.lo str-dup.lo \
|
||||
str-dynm.lo str-dynw.lo str-end.lo str-excl.lo str-fcpy.lo \
|
||||
str-fnmat.lo str-incl.lo str-len.lo str-pac.lo str-pbrk.lo \
|
||||
str-put.lo str-rev.lo str-rot.lo str-set.lo str-spl.lo \
|
||||
str-spn.lo str-str.lo str-subst.lo str-tok.lo str-trm.lo \
|
||||
str-word.lo time.lo tio.lo tio-get.lo tio-put.lo tre.lo \
|
||||
tre-ast.lo tre-compile.lo tre-match-backtrack.lo \
|
||||
tre-match-parallel.lo tre-parse.lo tre-stack.lo stdio.lo \
|
||||
xma.lo
|
||||
main.lo mem.lo oht.lo opt.lo path-basename.lo path-canon.lo \
|
||||
pio.lo pma.lo rbt.lo rex.lo sio.lo sll.lo str-beg.lo \
|
||||
str-cat.lo str-chr.lo str-cnv.lo str-cmp.lo str-cpy.lo \
|
||||
str-del.lo str-dup.lo str-dynm.lo str-dynw.lo str-end.lo \
|
||||
str-excl.lo str-fcpy.lo str-fnmat.lo str-incl.lo str-len.lo \
|
||||
str-pac.lo str-pbrk.lo str-put.lo str-rev.lo str-rot.lo \
|
||||
str-set.lo str-spl.lo str-spn.lo str-str.lo str-subst.lo \
|
||||
str-tok.lo str-trm.lo str-word.lo time.lo tio.lo tio-get.lo \
|
||||
tio-put.lo tre.lo tre-ast.lo tre-compile.lo \
|
||||
tre-match-backtrack.lo tre-match-parallel.lo tre-parse.lo \
|
||||
tre-stack.lo stdio.lo xma.lo
|
||||
libqsecmn_la_OBJECTS = $(am_libqsecmn_la_OBJECTS)
|
||||
libqsecmn_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
@ -291,11 +291,12 @@ libqsecmn_la_SOURCES = \
|
||||
main.c \
|
||||
mem.c \
|
||||
mem.h \
|
||||
misc.c \
|
||||
oht.c \
|
||||
opt.c \
|
||||
pma.c \
|
||||
path-basename.c \
|
||||
path-canon.c \
|
||||
pio.c \
|
||||
pma.c \
|
||||
rbt.c \
|
||||
rex.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)/main.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)/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)/pma.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/>.
|
||||
*/
|
||||
|
||||
#include <qse/cmn/misc.h>
|
||||
#include <qse/cmn/path.h>
|
||||
|
||||
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include <qse/fs/path.h>
|
||||
#include <qse/cmn/path.h>
|
||||
|
||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||
# 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;
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* handle UNC path */
|
||||
/* handle UNC path for Windows */
|
||||
if (ISSEP(*ptr))
|
||||
{
|
||||
*dst++ = *ptr++;
|
||||
|
||||
/* if it starts with \\, process host name */
|
||||
while (!ISSEPNIL(*ptr)) *dst++ = *ptr++;
|
||||
|
||||
/* \ following the host name. note that
|
||||
* \\\ is treated as if the host name is empty. */
|
||||
|
||||
if (ISSEP(*ptr)) *dst++ = *ptr++;
|
||||
if (ISSEPNIL(*ptr))
|
||||
{
|
||||
/* if there is another separator after \\,
|
||||
* it's not an UNC path. */
|
||||
dst--;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if it starts with \\, process host name */
|
||||
do { *dst++ = *ptr++; } while (!ISSEPNIL(*ptr));
|
||||
if (ISSEP(*ptr)) *dst++ = *ptr++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -183,8 +188,13 @@ qse_size_t qse_canonpath (const qse_char_t* path, qse_char_t* canon)
|
||||
else
|
||||
{
|
||||
normal:
|
||||
while (seg <= ptr) *dst++ = *seg++;
|
||||
if (ISSEP(*ptr)) ptr++;
|
||||
while (seg < ptr) *dst++ = *seg++;
|
||||
if (ISSEP(*ptr))
|
||||
{
|
||||
/* this segment ended with a separator */
|
||||
*dst++ = *seg++; /* copy the separator */
|
||||
ptr++; /* move forward the pointer */
|
||||
}
|
||||
}
|
||||
}
|
||||
while (1);
|
@ -7,8 +7,7 @@ AM_CPPFLAGS = \
|
||||
|
||||
lib_LTLIBRARIES = libqsefs.la
|
||||
libqsefs_la_SOURCES = \
|
||||
dir.c \
|
||||
path.c
|
||||
dir.c
|
||||
|
||||
libqsefs_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn -L$(libdir)
|
||||
libqsefs_la_LIBADD = -lqsecmn
|
||||
|
@ -72,7 +72,7 @@ am__base_list = \
|
||||
am__installdirs = "$(DESTDIR)$(libdir)"
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
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_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
@ -244,8 +244,7 @@ AM_CPPFLAGS = \
|
||||
|
||||
lib_LTLIBRARIES = libqsefs.la
|
||||
libqsefs_la_SOURCES = \
|
||||
dir.c \
|
||||
path.c
|
||||
dir.c
|
||||
|
||||
libqsefs_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn -L$(libdir)
|
||||
libqsefs_la_LIBADD = -lqsecmn
|
||||
@ -324,7 +323,6 @@ distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
|
@ -756,6 +756,29 @@ int qse_sed_execstd (
|
||||
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 (
|
||||
qse_sed_t* sed, const qse_char_t* infile, const qse_char_t* outfile)
|
||||
{
|
||||
|
Reference in New Issue
Block a user