summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xssn.at>2010-06-03 22:22:34 +0200
committerFlorian Pritz <bluewind@xssn.at>2010-06-03 22:25:52 +0200
commita1be74d9559285198d8a6e25a8976088daefa090 (patch)
treefc9239025245c8ff6d1592858219f68e783aae55
parent01ff424562320e8160c9da8df3eb1cc595ac82c6 (diff)
use perl for generating the line numbers
less forking is better Signed-off-by: Florian Pritz <bluewind@xssn.at>
-rw-r--r--system/application/models/file_mod.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/system/application/models/file_mod.php b/system/application/models/file_mod.php
index efb30005a..66817a7a6 100644
--- a/system/application/models/file_mod.php
+++ b/system/application/models/file_mod.php
@@ -176,7 +176,7 @@ class File_mod extends Model {
echo $this->load->view('file/html_header', $data, true);
// only rewrite if it's fast
// count(file($file)); isn't
- echo shell_exec('/usr/bin/seq 1 $(/usr/bin/wc -l '.escapeshellarg($file).' | /bin/cut -d\ -f1) | sed -r \'s/^(.*)$/<a href="#n\1" class="no" name="n\1" id="n\1">\1<\/a>/g\'');
+ echo passthru('/usr/bin/perl -ne \'print "<a href=\"#n$.\" class=\"no\" id=\"n$.\" name=\"n$.\">$.</a>\n"\' '.escapeshellarg($file));
echo '</pre></td><td class="code"><pre>'."\n";
echo shell_exec(FCPATH.'scripts/syntax-highlighting.sh '.escapeshellarg($filedata['filename']).'.'.escapeshellarg($mode).' < '.escapeshellarg($file));
echo $this->load->view('file/html_footer', $data, true);