Logiweb(TM)

7.16.6 fileType

Prev Up Next Page 277 of 800 Search internet


A fileType request queries the type of a file. A fileType request is encoded as an lgcio request containing the following bytes:

First comes one byte which identifies the lgcio request as a fileType request. The value of that byte happens to be 10.

Then comes the path name p of the file whose type has to be inspected. The path can be given as a vector tree. The path is not allowed to contain null characters.

Finally comes a terminating null character.

To ease forging a fileType request, the base page defines the following construct:

eager define fileType ( p ) as lgcio ( FileType :: p :: EOS ) end define

The value of FileType is a singleton string whose sole byte is 10. The value of EOS (End Of String) is a singleton string whose sole byte is a null byte.

The reply to a fileType request is an lgcio reply which contains one byte. Hence, the reply has form

<< << r ,, i >> ,, p >>

where r and i are the reference and index, respectively, of the lgcio construct and p is a one element list containing one one-byte string. The byte has one of the following five values:

0
The file does not exist
2
The file is regular
3
The file is a directory
4
The file is a symbolic link
1
The file is something else

The base page defines the following constants to help writing programs which interpret the reply:

eager define FileTypeNonexistent as bt2vector ( 0 ) end define

eager define FileTypeOther as bt2vector ( 1 ) end define

eager define FileTypeRegular as bt2vector ( 2 ) end define

eager define FileTypeDirectory as bt2vector ( 3 ) end define

eager define FileTypeLink as bt2vector ( 4 ) end define

Prev Up Next Page 277 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05