X-Git-Url: https://git.llucax.com/software/dgc/dgcbench.git/blobdiff_plain/254a2ba31ffdfd67235959c657551e029df4fab5..f430308cdc808f9a511e4d0518fa75bffa223dd4:/micro/split.d 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");