Commit d69db32e authored by Ben Laughton's avatar Ben Laughton
Browse files

Initial import of Wild library into CVS.

Detail:                         
  This is Julian Smith's wildcard matching library, required by his Trace
  library.                      
  The build system for the main library has been restructured not to use
  Makatic, but the tests still do.
                                
Admin:                          
  all, clean, and export phases tested.
  Tested using the ATM driver, which uses DebugLib, which uses Trace, which
  uses Wild; appears to work as previous binary-only version did.
Dir <Obey$Dir>
WimpSlot 2048k
amu THROWBACK=-throwback all
Dir <Obey$Dir>
WimpSlot 2048k
amu_machine clean
Dir <Obey$Dir>
WimpSlot 2048k
amu THROWBACK=-throwback debug
Dir <Obey$Dir>
amu PHASE=hdrs export
amu PHASE=libs export
c/** gitlab-language=c linguist-language=c linguist-detectable=true
**/c/** gitlab-language=c linguist-language=c linguist-detectable=true
h/** gitlab-language=c linguist-language=c linguist-detectable=true
**/h/** gitlab-language=c linguist-language=c linguist-detectable=true
This diff is collapsed.
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
15 Apr 1996
Added Wild_ScanPath3 - copes with multiple space-separated specs, and
multiple excludes.
08 Jul 1996
Now copes with search strings like '...*' (Adds '@.' for searching, and
removes when calling function).
14 Aug 1996
Added Replace
Altered Replace to remove any instances of '..'
15 Aug 1996
Added Wild_PathMatches2, Wild_PathMatches3, Wild_PathMatches4.
Wild_PathMatches4 uses PlainArgv_StrTok.
Changed rest of Wild to use PlainArgv_StrTok instead of Utils - Utils
version uses DeskLib.
09 Sep 1996
*<n> now includes the trailing '.'. Removed removal of '..'.
22 Sep 1997
Now calls Desk_Filing_ScanDir2(), with flag to ignore errors when
reading dir contents. Allows read-protected directories to be ignored.
10 Nov 1997
Only checks whether path is a directory if path!=''.
Desk_File_IsDirectory( "") raises error about default filing ssytem
needing a filename or something.
18 Dec 1997
Adding support for removing a suffix from a filename.
#/<digit> treats '/' as a separator as well as '.'.
File added
/*
* Copyright Julian Smith.
*
* This file is part of Wild.
*
* Wild 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.
*
* Wild 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 Wild. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __Wild_Replace_h
#define __Wild_Replace_h
#ifndef __Desk_DeskMem_h
#include "Desk/DeskMem.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
void Wild_Replace_Replace( Desk_deskmem_buffer* buffer, const char* replace, const char* filename);
void Wild_Replace_ReplaceCat( Desk_deskmem_buffer* buffer, const char* replace, const char* filename);
const char* Wild_Replace_HelpString( void);
// Returns a string containing help on the replace syntax.
#ifdef __cplusplus
}
#endif
#endif
/*
* Copyright Julian Smith.
*
* This file is part of Wild.
*
* Wild 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.
*
* Wild 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 Wild. If not, see <http://www.gnu.org/licenses/>.
*/
/*
Copyright 1995 Julian Smith
*/
#ifndef __Wild_Wild_h
#define __Wild_Wild_h
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __Desk_Core_h
#include "Desk.Core.h"
#endif
typedef enum {
wild_match_NO,
wild_match_SUB,
wild_match_YES
}
wild_match;
/*
This is the result of a wild comparison
wild_match_SUB means that there was no match, but the string could be
the start of a perfect match.
Eg Wild_PathMatches( "abcd", "a*.*") will return wild_match_SUB.
*/
typedef void (*wild_wildfn)( const char *path, void *reference);
/*
Called by Wild_ScanPath.
*/
typedef void (*wild_wildfn2)( const char* canonpath, const char* path, void *reference);
/*
Called by Wild_ScanPath2.
*/
void Wild_ScanPath( const char *path, wild_wildfn fn, void *reference);
/*
Calls 'fn' for every path which matches 'path'. See Wild_PathMatches for
details of matching.
*/
void Wild_ScanPath2( const char *path, wild_wildfn2 fn, void *reference);
/*
As Wild_ScanPath, except that multiple paths are expanded (eg
'system:modules.*').
Note that this expects a different function type - a wild_wildfn2. This
function should expect two strings, one a canonicalised version of the
other.
For example, if '<Run$Path> = "ADFS::4.$.Lib1,ADFS::4.$.Lib2", and 'Lib1
contains 'abc' and 'Lib2' contains ayz', then the result of calling
Wild_ScanPath23( "Run:a*", fn, NULL, keep) is to pass 'fn' the following
pairs of strings:
Iteration path canonpath
------------------------------------------------------------
1 Run:abc ADFS::4.$.Lib1.abc
2 Run:ayz ADFS::4.$.Lib2.ayz"
3
...
*/
void Wild_ScanPath3( const char *paths, char* excludes, wild_wildfn2 fn, void *reference);
/*
As Wild_ScanPath2, but accepts space-separated list of paths, and
space-separated list of wild-carded filenames to exclude.
The strings pointed to by 'paths' and 'excludes' are used with strtok,
but are restored afterwards.
*/
void Wild_ScanPath4( const char *pathsandexcludes, wild_wildfn2 fn, void *reference);
/*
'pathsandexcludes' should be "foo.* *.bar...* -x {excludes}". Splits up
string, and calls Wild_ScanPath3.
*/
wild_match Wild_StringMatches( const char *s, const char *wild);
/*
Compares 'path' with the wild-carded string 'wild'.
'*' matches any number (including 0) of characters. '#' matches any
single character (ecxept '.').
*/
wild_match Wild_PathMatches( const char *path, const char *wild);
/*
Compares 'path' with the wild-carded string 'wild'. '*' and '#' are
matched as in Wild_StringMatches, '...' matches any number of
directories.
*/
wild_match Wild_PathMatches2( const char *path, const char *wilds);
/*
Compares 'path' with all of the space-separated wild-carded strings in
'wilds'. '*' and '#' are matched as in Wild_StringMatches, '...' matches
any number of directories.
Returns the best match from all the different wild strings.
*/
wild_match Wild_PathMatches3( const char *path, const char *wilds, const char* excludes);
/*
Compares with all strings in 'wilds' and 'excludes'.
*/
wild_match Wild_PathMatches4( const char* path, const char* wilds_and_excludes);
/*
wilds_and_excludes is '{wilds} [ -x {excludes}]'.
*/
extern Desk_bool wild__casesensitive;
/*
Use Wild_CaseSensitive and Wild_CaseInsensitive to set this.
The Wild library will initially be case insensitive.
*/
#define Wild_CaseSensitive() (wild__casesensitive = TRUE)
/*
Makes all subsequent Wild_ calls case-sensitive.
*/
#define Wild_CaseInsensitive() (wild__casesensitive = FALSE)
/*
Makes all subsequent Wild_ calls case-insensitive (the default).
*/
#ifdef __cplusplus
}
#endif
#endif
# File: Makefile
# Purpose: Makefile for Wild
# Author: Ben Laughton
#
# History:
#
# 2000-04-10: BAL
# Created.
# ------------------------------------------------------------------------------
# Paths
#
EXP_DIR = <Lib$Dir>.Wild
LIBDIR = <Lib$Dir>
# ------------------------------------------------------------------------------
# Generic options
#
MKDIR = mkdir -p
AS = objasm
CC = $(MemCheckCC) cc
C++ = c++
CMHG = cmhg
CP = copy
LD = link
RM = remove
WIPE = -wipe
CD = dir
CHMOD = access
TOUCH = create
DATA2AOF = datatoaof
MODSQZ = modsqz
LB = libfile
# ------------------------------------------------------------------------------
# Flags
#
AFLAGS = -depend !Depend $(THROWBACK) $(EXTRA_A_FLAGS) -stamp -quit
CCFLAGS = -depend !Depend $(THROWBACK) $(INCLUDES) $(DFLAGS) -c -Wsp -ffah
LDFLAGS = -aof
CPFLAGS = ~cfr~v
WFLAGS = ~c~vr
LBFLAGS = -c
CHMODFLAGS = RW/r
DFLAGS = $(EXTRA_C_FLAGS)
INCLUDES = -IC:,TCPIPLibs:
# ------------------------------------------------------------------------------
# Program specific options
#
COMPONENT = Wild
TARGET = l.Wild$(LIBSUFFIX)
EXPORTS = $(EXP_C_H).$(COMPONENT)
OBJS =\
$(EXT).IsMultiple\
$(EXT).PathMatch2\
$(EXT).PathMatch4\
$(EXT).Replace\
$(EXT).Wild\
$(EXT).Wild2\
$(EXT).Wild3\
$(EXT).Wild4
# ------------------------------------------------------------------------------
# Rule patterns
#
.SUFFIXES: .o .z .od .odz .i .h .s .c
.c.i:; $(CC) $(CCFLAGS) -C -E $< >> $@
.c.o:; $(CC) $(CCFLAGS) -o $@ $<
.c.od:; $(CC) $(CCFLAGS) -fn -g -o $@ $<
.c.z:; $(CC) $(CCFLAGS) -DDesk__MODULE_CLIENT -zM -o $@ $<
.c.odz:; $(CC) $(CCFLAGS) -DDesk__MODULE_CLIENT -zM -fn -g -o $@ $<
.s.i:; @echo $@
.s.o:; $(AS) $(AFLAGS) -pd "Desk_AS_EMBED_FNNAMES SETA 0" $< $@
.s.z:; $(AS) $(AFLAGS) -pd "Desk_AS_EMBED_FNNAMES SETA 0" $< $@
.s.od:; $(AS) $(AFLAGS) -pd "Desk_AS_EMBED_FNNAMES SETA 1" $< $@
.s.odz:; $(AS) $(AFLAGS) -pd "Desk_AS_EMBED_FNNAMES SETA 1" $< $@
# ------------------------------------------------------------------------------
# Local build rules
#
all: $(TARGET)
debug: $(TARGET)
preprocess: $(TARGET)
$(TARGET): $(OBJS) $(LIBS) $(EXT).local_dirs
$(MKDIR) l
$(LB) $(LBFLAGS) -o $@ $(OBJS)
# ------------------------------------------------------------------------------
# Common build rules
$(EXT).local_dirs:
@$(MKDIR) $(EXT)
@$(TOUCH) $@
$(EXP_DIR).dirs:
@$(MKDIR) $(EXP_DIR).h
@$(MKDIR) $(EXP_DIR).o
@$(TOUCH) $@
# ------------------------------------------------------------------------------
# RISC OS ROM build rules
#
export: export_$(PHASE)
export_hdrs: $(EXP_DIR).dirs
@$(CP) Export.h $(EXP_DIR).* $(CPFLAGS)
export_libs: $(TARGET) $(EXP_DIR).dirs
@$(CP) $(TARGET) $(EXP_DIR).o.* $(CPFLAGS)
clean:
$(WIPE) $(EXT) $(WFLAGS)
# ------------------------------------------------------------------------------
# Dynamic dependencies:
# File: Makefile
# Purpose: Makefile for Wild
# Author: Ben Laughton
#
# History:
#
# 2000-04-10: BAL
# Created.
# ------------------------------------------------------------------------------
# Generic options
#
MKDIR = cdir
CP = copy
RM = remove
WIPE = -wipe
STRIPDEPND = stripdepnd
# ------------------------------------------------------------------------------
# Flags
#
CPFLAGS = ~cfr~v
WFLAGS = ~c~vr
# ------------------------------------------------------------------------------
# Program specific options
#
COMPONENT = Wild
# C debugging and DebugLib do not map 1<->1 since DebugLib is used for other
# stuff as well.
C_DEBUG_ON = -DDesk_DEBUG
C_DEBUG_OFF = -DNDEBUG
# ------------------------------------------------------------------------------
# Build rules
#
# Local
all:
@amu -f MainMake $(MFLAGS) EXTRA_C_FLAGS=$(C_DEBUG_OFF) LIBSUFFIX= EXT=o
@amu -f MainMake $(MFLAGS) EXTRA_C_FLAGS=$(C_DEBUG_OFF) LIBSUFFIX=_M EXT=z
@echo $(COMPONENT): build complete
debug:
@amu -f MainMake $(MFLAGS) EXTRA_C_FLAGS=$(C_DEBUG_ON) LIBSUFFIX=_D EXT=od
@amu -f MainMake $(MFLAGS) EXTRA_C_FLAGS=$(C_DEBUG_ON) LIBSUFFIX=_M_D EXT=odz
@echo $(COMPONENT): debug build complete
preprocess:
@amu -f MainMake $(MFLAGS) EXTRA_C_FLAGS=$(C_DEBUG_OFF) EXT=i
@echo $(COMPONENT): preprocessing complete
export: export_$(PHASE)
export_hdrs:
@amu -f MainMake $(MFLAGS) TARGET=AvoidAMUBug EXT=AvoidAMUBug
@echo $(COMPONENT): export complete (hdrs)
export_libs:
@amu -f MainMake $(MFLAGS) EXTRA_C_FLAGS=$(C_DEBUG_OFF) LIBSUFFIX= EXT=o
@amu -f MainMake $(MFLAGS) EXTRA_C_FLAGS=$(C_DEBUG_OFF) LIBSUFFIX=_M EXT=z
@echo $(COMPONENT): export complete (libs)
clean:
@amu -f MainMake $(MFLAGS) EXT=o
@amu -f MainMake $(MFLAGS) EXT=z
@amu -f MainMake $(MFLAGS) EXT=od
@amu -f MainMake $(MFLAGS) EXT=odz
@amu -f MainMake $(MFLAGS) EXT=i
@$(WIPE) l $(WFLAGS)
@$(STRIPDEPND) MainMake
@echo $(COMPONENT): cleaned
# Dynamic dependencies:
|
| Copyright Julian Smith.
|
| This file is part of Wild.
|
| Wild 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.
|
| Wild 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 Wild. If not, see <http://www.gnu.org/licenses/>.
|
Prefix <Obey$Dir>
Makatic.Medium @ CCExtra=-DDeskLib_DEBUG LibSuffix=_D
|
| Copyright Julian Smith.
|
| This file is part of Wild.
|
| Wild 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.
|
| Wild 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 Wild. If not, see <http://www.gnu.org/licenses/>.
|
Wimpslot 32k
Run <Obey$Dir>.!RunImage
|
| Copyright Julian Smith.
|
| This file is part of Wild.
|
| Wild 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.
|
| Wild 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 Wild. If not, see <http://www.gnu.org/licenses/>.
|
Prefix <Obey$Dir>
Makatic.Medium @
\ No newline at end of file
|
| Copyright Julian Smith.
|
| This file is part of Wild.
|
| Wild 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.
|
| Wild 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 Wild. If not, see <http://www.gnu.org/licenses/>.
|
Wimpslot 32k
Run <Obey$Dir>.!RunImage
Librarys = \
C:Wild.o.WildLib$(LibSuffix) \
C:Utils.o.UtilsLib \
DeskLib:o.Debug.stderr \
DeskLib:o.DeskLib \
C:o.Stubs \
Target = !RunImage
ASMFlags = $(ASMExtra) -Stamp -NoCache -CloseExec -Quit -throwback
CCFlags = $(CCExtra) -fahi -depend !Depend -throwback -I,C:
CPPFlags = $(CPPExtra) -depend !Depend -throwback -I,C:
LinkFlags = $(LinkExtra)
ASM = objasm $(ASMFlags)
CC = cc -c $(CCFlags)
CPP = c++ -c $(CPPFlags)
LINK = Link -aif -c++ $(LinkFlags)
# Don't alter anything below this...
VPATH = @.^
.SUFFIXES: .o .s .c .c++
$(Target): $(ObjectFiles) $(Librarys)
$(LINK) -o $@ $(ObjectFiles) $(Librarys)
.s.o:
$(ASM) -from $< -to $@
.c.o:
$(CC) -o $@ $<
.c++.o:
$(CPP) -o $@ $<
# Dynamic dependencies:
/*
* Copyright Julian Smith.
*
* This file is part of Wild.
*
* Wild 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.
*
* Wild 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 Wild. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "DeskLib:Filing.h"
#include "DeskLib:File.h"
#include "DeskLib:Debug.h"
#include "Wild.Wild.h"
static void FileFn( const char* canonpath, const char* path, void *reference)
{
UNUSED( path);
UNUSED( reference);
printf( "FileFn. %s\n", canonpath);
}
static os_error* FoundFileFn( const char* dirname, filing_fulldirentry* filedata, void* reference)
{
UNUSED( dirname);
UNUSED( filedata);
UNUSED( reference);
return NULL;
}
int main( void)
{
#ifdef DeskLib_DEBUG
debug_level = 5;
#endif
printf( "started\n");
printf( "%i\n", File_IsDirectory( "ADFS::Anne.$.!Scrap.ScrapDirs.ScrapDir.ABCD.*"));
Filing_ScanDir(
"ADFS::Anne.$.!Scrap.ScrapDirs.ScrapDir.ABCD.*",
NULL,
FoundFileFn,
NULL,
NULL
);
printf( "finished\n");
Wild_ScanPath4( "ADFS::Anne.$.!Scrap.ScrapDirs.ScrapDir.ABCD.*", FileFn, (void*) 0x12345);
printf( "finished\n");
return 0;
}
/*
* Copyright Julian Smith.
*
* This file is part of Wild.
*
* Wild 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.
*
* Wild 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 Wild. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include "Desk/Debug.h"
#include "Desk/Error.h"
#include "Desk/DeskMem.h"
#include "Desk/KernelSWIs.h"
#include "IsMultiple.h"
#ifdef __riscos
char* PathIsMultiplePath( const char *path)
{
int pathlen;
char* colon;
Desk_Debug3_Printf( Desk_error_PLACE "path='%s'\n", path);
colon = strchr( path, ':');
if ( !colon) return NULL;
if ( colon[1]==':' || colon[1]=='$') return NULL;
if ( colon==path) return NULL;
pathlen = colon-path;
{
char *varvalue;
/*int varvaluelen;*/
char *varname = Desk_DeskMem_Malloc( 1+pathlen + 5);
strncpy( varname, path, pathlen);
strcpy( &varname[ pathlen], "$Path");
Desk_Debug3_Printf( "varname='%s'\n", varname);
varvalue = Desk_OS_ReadVarVal_AutoAlloc( varname);
Desk_DeskMem_Free( varname);
if ( varvalue==NULL) return NULL; /* Doesn't exist */
Desk_Debug3_Printf( "varvalue='%s'\n", varvalue);
return varvalue;
}
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment