File: preproc.php

package info (click to toggle)
manpages-tr 1.0.2+cvs20040401-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 1,268 kB
  • ctags: 24
  • sloc: xml: 13,540; php: 74; makefile: 46; sh: 13
file content (34 lines) | stat: -rwxr-xr-x 616 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/php -q
<?php
if ($argc == "1"):
  echo "Usage:   preproc.php infile > outfile\n\n";
  exit();
endif;
$infilename = implode("", explode("\'",$argv[1]));

if ($infilename != "-"):
  $farray = file($infilename);
else:
  $farray = file("php://stdin");
endif;

$cnt = count($farray);
for ($i = 0; $i < $cnt; $i++):
  $temp = $farray[$i];
  $templen = strlen($temp);
  $inlinestr = "";
  $k = 0;
  
  while ($k < $templen):
    $chr = substr($temp, $k, 1);
    if ($chr=="\\"): 
      $inlinestr .= "\\" . $chr;
    else:
      $inlinestr .= $chr;
    endif;
    $k++;
  endwhile;
  echo $inlinestr;
endfor;

?>