Mercurial > hg > fapweb
diff msitegen.inc.php @ 1006:cb23b23a2d8b
Improve commandline parsing, fix some potential bug situations.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 05 Apr 2015 15:35:55 +0300 |
parents | 668fd0ea4e08 |
children | 438457153ced |
line wrap: on
line diff
--- a/msitegen.inc.php Sun Mar 29 15:55:54 2015 +0300 +++ b/msitegen.inc.php Sun Apr 05 15:35:55 2015 +0300 @@ -955,21 +955,27 @@ } -function stCArg($index) +function stCArg($index, $clip = FALSE) { global $argc, $argv; if ($index < $argc) - return $argv[$index]; + { + $str = $argv[$index]; + return ($clip !== FALSE) ? substr($str, 0, $clip) : $str; + } else return FALSE; } -function stCArgLC($index) +function stCArgLC($index, $clip = FALSE) { global $argc, $argv; if ($index < $argc) - return strtolower($argv[$index]); + { + $str = strtolower($argv[$index]); + return ($clip !== FALSE) ? substr($str, 0, $clip) : $str; + } else return FALSE; }