X-Git-Url: https://git.llucax.com/software/dgc/dgcbench.git/blobdiff_plain/5b0d31198806563101200a3b5d435b1ddd6c2dbd..688f2efa838b0dbc5b9dd592a9cea0ba2058e9f5:/micro/split.d?ds=sidebyside diff --git a/micro/split.d b/micro/split.d index b042323..319082b 100644 --- a/micro/split.d +++ b/micro/split.d @@ -8,9 +8,12 @@ import tango.text.Util: delimit; import tango.util.Convert: to; int main(char[][] args) { - auto txt = cast(byte[]) File.get("bible.txt"); - auto n = (args.length > 1) ? to!(uint)(args[1]) : 1; - if (n < 1) n = 1; + if (args.length < 2) + return 1; + auto txt = cast(byte[]) File.get(args[1]); + auto n = (args.length > 2) ? to!(uint)(args[2]) : 1; + if (n < 1) + n = 1; while (--n) txt ~= txt; auto words = delimit!(byte)(txt, cast(byte[]) " \t\n\r");