Another question is: How to read the attributes of a Linux file or Linux directory from BlackBox?
Is there a call available via the Lin library? Where can I find a description or an explanation about the Lin library?
- Helmut
			
			
									
						
										
						How to read Linux File attributes?
- Ivan Denisov
- Posts: 366
- Joined: Tue Sep 17, 2013 12:21 am
- Location: Krasnoyarsk, Russia
Re: How to read Linux File attributes?
I got some copypaste from HostFiles. Information about libc library you can find in the Internet documentation for Linux.
			
			
									
						
										
						Code: Select all
MODULE DemoRun;
	IMPORT  Log, Libc := LinLibc, HostFiles, Strings;
	
	TYPE
		ShortName = ARRAY 260 * 4 OF SHORTCHAR;
	
	PROCEDURE Stat*;
	CONST
		read = 8;
		write = 7;
		execute = 6;
		file = 15;
		
		VAR s: ShortName; ok1, res: INTEGER; buf: Libc.stat_t;
	BEGIN
		Strings.StringToUtf8('/home/dia/blackbox/test', s, ok1);
		res := Libc.__xstat(Libc._STAT_VER_LINUX, s, buf); (* macro expansion of "stat" *)
		Log.String("is directory "); Log.Bool(~ (file IN buf.st_mode)); Log.Ln;
		Log.String("all bits "); Log.Set(buf.st_mode); Log.Ln;
		
	END Stat;
END DemoRun.
 
                                