2 |
7u83 |
1 |
# Crown Copyright (c) 1997
|
|
|
2 |
#
|
|
|
3 |
# This TenDRA(r) Computer Program is subject to Copyright
|
|
|
4 |
# owned by the United Kingdom Secretary of State for Defence
|
|
|
5 |
# acting through the Defence Evaluation and Research Agency
|
|
|
6 |
# (DERA). It is made available to Recipients with a
|
|
|
7 |
# royalty-free licence for its use, reproduction, transfer
|
|
|
8 |
# to other parties and amendment for any purpose not excluding
|
|
|
9 |
# product development provided that any such use et cetera
|
|
|
10 |
# shall be deemed to be acceptance of the following conditions:-
|
|
|
11 |
#
|
|
|
12 |
# (1) Its Recipients shall ensure that this Notice is
|
|
|
13 |
# reproduced upon any copies or amended versions of it;
|
|
|
14 |
#
|
|
|
15 |
# (2) Any amended version of it shall be clearly marked to
|
|
|
16 |
# show both the nature of and the organisation responsible
|
|
|
17 |
# for the relevant amendment or amendments;
|
|
|
18 |
#
|
|
|
19 |
# (3) Its onward transfer from a recipient to another
|
|
|
20 |
# party shall be deemed to be that party's acceptance of
|
|
|
21 |
# these conditions;
|
|
|
22 |
#
|
|
|
23 |
# (4) DERA gives no warranty or assurance as to its
|
|
|
24 |
# quality or suitability for any purpose and DERA accepts
|
|
|
25 |
# no liability whatsoever in relation to any use to which
|
|
|
26 |
# it may be put.
|
|
|
27 |
#
|
|
|
28 |
+USE "posix", "sys/types.h" ;
|
|
|
29 |
+USE "ansi", "time.h", "time_t" (!?) ;
|
|
|
30 |
|
|
|
31 |
/* This type is abstracted */
|
|
|
32 |
+IF %% __STRICT_POSIX %%
|
|
|
33 |
+TYPEDEF mode_t ~stat_mode_t ;
|
|
|
34 |
+ELSE
|
|
|
35 |
+TYPE ( arith ) ~stat_mode_t.1 ;
|
|
|
36 |
+MACRO mode_t __stat_mode2mode ( ~stat_mode_t ) ;
|
|
|
37 |
+MACRO ~stat_mode_t __mode2stat_mode ( mode_t ) ;
|
|
|
38 |
+IFNDEF ~building_libs
|
|
|
39 |
%%
|
|
|
40 |
#pragma accept conversion __stat_mode2mode
|
|
|
41 |
#pragma accept conversion __mode2stat_mode
|
|
|
42 |
%%
|
|
|
43 |
%%%
|
|
|
44 |
#include <sys/stat.h>
|
|
|
45 |
#define __stat_mode2mode( X ) ( mode_t ) ( X )
|
|
|
46 |
#define __mode2stat_mode( X ) ( __local_stat_mode_t ) ( X )
|
|
|
47 |
%%%
|
|
|
48 |
+ENDIF
|
|
|
49 |
+ENDIF
|
|
|
50 |
|
|
|
51 |
+FIELD struct stat | struct_stat {
|
|
|
52 |
dev_t st_dev ;
|
|
|
53 |
ino_t st_ino ;
|
|
|
54 |
~stat_mode_t st_mode ;
|
|
|
55 |
nlink_t st_nlink ;
|
|
|
56 |
uid_t st_uid ;
|
|
|
57 |
gid_t st_gid ;
|
|
|
58 |
off_t st_size ;
|
|
|
59 |
time_t st_atime ;
|
|
|
60 |
time_t st_mtime ;
|
|
|
61 |
time_t st_ctime ;
|
|
|
62 |
} ;
|
|
|
63 |
|
|
|
64 |
+CONST int S_IRWXU, S_IRUSR, S_IWUSR, S_IXUSR, S_IRWXG, S_IRGRP, S_IWGRP ;
|
|
|
65 |
+CONST int S_IXGRP, S_IRWXO, S_IROTH, S_IWOTH, S_IXOTH, S_ISUID, S_ISGID ;
|
|
|
66 |
|
|
|
67 |
+MACRO int S_ISBLK ( mode_t ) ;
|
|
|
68 |
+MACRO int S_ISCHR ( mode_t ) ;
|
|
|
69 |
+MACRO int S_ISDIR ( mode_t ) ;
|
|
|
70 |
+MACRO int S_ISFIFO ( mode_t ) ;
|
|
|
71 |
+MACRO int S_ISREG ( mode_t ) ;
|
|
|
72 |
|
|
|
73 |
+FUNC int fstat ( int, struct stat * ) ;
|
|
|
74 |
+FUNC int stat ( const char *, struct stat * ) ;
|
|
|
75 |
+FUNC int chmod ( const char *, mode_t ) ;
|
|
|
76 |
+FUNC int mkdir ( const char *, mode_t ) ;
|
|
|
77 |
+FUNC int mkfifo ( const char *, mode_t ) ;
|
|
|
78 |
+FUNC mode_t umask ( mode_t ) ;
|