[interchange-cvs] interchange - racke modified 3 files
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Tue Feb 18 10:46:01 2003
User: racke
Date: 2003-02-18 15:45:45 GMT
Modified: . MANIFEST WHATSNEW
Added: code/UserTag find.tag
Log:
find usertag added - this is really a barebones version object to
extended later, but sufficient enough to get Ton's i18n efforts going
Revision Changes Path
2.90 +1 -0 interchange/MANIFEST
rev 2.90, prev_rev 2.89
Index: MANIFEST
===================================================================
RCS file: /anon_cvs/repository/interchange/MANIFEST,v
retrieving revision 2.89
retrieving revision 2.90
diff -u -r2.89 -r2.90
--- MANIFEST 13 Feb 2003 16:14:42 -0000 2.89
+++ MANIFEST 18 Feb 2003 15:45:44 -0000 2.90
@@ -185,6 +185,7 @@
code/UserTag/email_raw.tag
code/UserTag/env.tag
code/UserTag/fedex_query.tag
+code/UserTag/find.tag
code/UserTag/formel.tag
code/UserTag/fortune.tag
code/UserTag/forum.tag
2.107 +2 -0 interchange/WHATSNEW
rev 2.107, prev_rev 2.106
Index: WHATSNEW
===================================================================
RCS file: /anon_cvs/repository/interchange/WHATSNEW,v
retrieving revision 2.106
retrieving revision 2.107
diff -u -r2.106 -r2.107
--- WHATSNEW 17 Feb 2003 13:24:31 -0000 2.106
+++ WHATSNEW 18 Feb 2003 15:45:44 -0000 2.107
@@ -323,6 +323,8 @@
* Removed some code that caused table-organize to write the td.x attributes
twice.
+* find - New usertag in spirit of the Unix command with the same name.
+
Jobs
----
1.1 interchange/code/UserTag/find.tag
rev 1.1, prev_rev 1.0
Index: find.tag
===================================================================
UserTag find Order type
UserTag find addAttr
UserTag find hasEndTag
UserTag find Routine <<EOR
sub {
my ($type, $opt, $list) = @_;
my (@paths, @stack, @files, $file, $entry);
# take array reference or string as list for the paths to scour for files
if (ref($list)) {
@paths = @$list;
} else {
@paths = split(/[\s,\0]+/, $list);
}
if ($Global::NoAbsolute) {
# all paths need to be relative to the catalog directory
for $file (@paths) {
if (Vend::Util::file_name_is_absolute($file)
or $file =~ m#\.\./.*\.\.#) {
::logError("Can't read file '%s' with NoAbsolute set" , $file);
::logGlobal({ level => 'auth'}, "Can't read file '%s' with NoAbsolute set" , $file );
} else {
push (@stack, $file);
}
}
} else {
@stack = @paths;
}
# now build a list of all files matching the given criteria
while (@stack) {
$file = shift @stack;
if (-d $file) {
unless (opendir(DIR, $file)) {
::logError("Couldn't open directory %s: %s", $file, $!);
next;
}
while ($entry = readdir(DIR)) {
next if $entry =~ /^\.\.?$/;
push (@stack, "$file/$entry");
}
closedir(DIR);
push (@files, $file);
} elsif (-e $file) {
push (@files, $file);
} else {
::logError("No such file or directory: %s", $file);
}
}
wantarray ? @files : join(' ', @files);
}
EOR