1 import metux
.espresso9
.NativeFS
;
2 import metux
.espresso9
.File
;
3 import metux
.espresso9
.Stat
;
4 import java
.lang
.Runtime
;
8 public static void catfile(File f1
, String prefix
)
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
);
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))
29 for (int l
=0; l
<data
.length
; l
++)
30 System
.err
.print((char)data
[l
]);
37 System
.err
.println("File::stat() call failed\n");
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] ");