Added old (obsolete ?) stuff from svn
[gpm-metux.git] / testme.java
blob1813aed6d5e3065581bbb04a8500333409c3d85f
1 import metux.espresso9.NativeFS;
2 import metux.espresso9.File;
3 import metux.espresso9.Stat;
4 import java.lang.Runtime;
6 public class testme
8 public static void catfile(File f1, String prefix)
10 byte[] data;
11 while (((data = f1.read(1024))!=null) && (data.length>0))
13 System.err.print(prefix);
14 for (int l=0; l<data.length; l++)
15 System.err.print((char)data[l]);
19 public static void main(String par[])
21 long fd = NativeFS.open("/etc/passwd", NativeFS.omode_ReadOnly);
22 byte[] data;
23 long pos = 0;
24 File f1 = new File("/etc/passwd", File.ReadOnly);
25 File f2 = new File("/tmp/furunkel-001", File.ReadWrite+File.AutoCreate);
26 while (((data = f1.read(1024))!=null) && (data.length>0))
28 f2.write(data);
29 for (int l=0; l<data.length; l++)
30 System.err.print((char)data[l]);
31 pos += data.length;
34 Stat st = f1.stat();
35 if (st == null)
37 System.err.println("File::stat() call failed\n");
39 else
41 System.err.println("File::stat() name="+st.name+" uid="+st.uid+" gid="+st.gid);
44 File f3 = new File("/etc", File.ReadOnly);
45 while ((st = f3.scan())!=null)
47 System.err.println("DIRENT: name="+st.name+" uid="+st.uid+" gid="+st.gid);
48 if (st.name.equals("passwd"))
50 System.err.println(" ---> PASSWD");
51 File f4 = f3.lookup(st.name);
52 catfile(f4, "[passwd] ");
55 f3.reset();