Mercurial > hg > jslab
diff examples/util/Cat.java @ 0:bf79fb79ee13
Initial Mercurial check in.
author | samer |
---|---|
date | Tue, 17 Jan 2012 17:50:20 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/util/Cat.java Tue Jan 17 17:50:20 2012 +0000 @@ -0,0 +1,31 @@ +package eg.util; +import samer.core.*; +import java.io.*; + +public class Cat +{ + public static void main( String args[]) + { + // set up message window + new samer.core.shells.AppShell(); + + BufferedReader d = new BufferedReader(new InputStreamReader(System.in)); + + try { + String s; + for (;;) { + s=d.readLine(); + if (s==null) break; + Shell.print(s); + } + } catch (IOException e) { Shell.print("---- error ----");} + + String term="\n---------------------------\nclose window to exit"; + if (args.length==0) { Shell.print(term); } + else { + if (!args[0].equals("-q")) Shell.print(term); + else { Shell.exit(); } + } + } +} +