FindGrepsUsingSearchPath < Codev < TWiki

perhaps this (or if modifications are required, some variation) can be incorporated into the CairoRelease twiki will then work on macs "out-of-the-box" to the same degree as other unix platforms.

Index: TWiki.cfg
===================================================================
--- TWiki.cfg (revision 1735)
+++ TWiki.cfg (working copy)
@@ -205,14 +205,28 @@
 $storeTopicImpl = "RcsWrap"; 
 #$storeTopicImpl = "RcsLite";
 
+sub findProgramUsingSearchPath
+{
+ my ($prog,$paths) = @_;
+
+ foreach my $path ( @{$paths} )
+ {
+ my $fullPath = "$path/$prog";
+ return $fullPath if -X $fullPath;
+ }
+
+ return "";
+}
+my $programSearchPath = [ qw( /bin /usr/bin /usr/local/bin ) ];
+
 # NOTE: You might want to avoid c: at start of cygwin unix command for
 # Windows, seems to cause a problem with pipe used in search
 # Unix ls command : (deprecated since 01 Nov 2003)
 $lsCmd = "/bin/ls";
 # Unix egrep command :
-$egrepCmd = "/bin/egrep";
+$egrepCmd = findProgramUsingSearchPath( egrep => $programSearchPath );
 # Unix fgrep command :
-$fgrepCmd = "/bin/fgrep";
+$fgrepCmd = findProgramUsingSearchPath( fgrep => $programSearchPath );
 
 #display Time in the following timezones (this only effects the display of times, all internal storage is still in GMT)
 # gmtime / servertime

-- WillNorris - 27 Aug 2004

I'd rather not take this last minute change into Cairo for two reasons:

  1. Extra runtime processing that can be avoided (-X is expensive)
  2. MartinGregory's UpgradeTWiki script probably needs to be changed

-- PeterThoeny - 28 Aug 2004

ok, thanks for the quick reply.

-- WillNorris - 28 Aug 2004

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdiff find-greps-on-path.diff r1 manage 1.2 K 2004年08月27日 - 06:44 UnknownUser searches a path for grep programs so that twiki can work out-of-the-box on macs
Edit | Attach | (削除) Watch (削除ここまで) | Print version | History : r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2005年06月27日 - WillNorris
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

AltStyle によって変換されたページ (->オリジナル) /