1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <gsf@research.att.com> *
18 * David Korn <dgk@research.att.com> *
19 * Phong Vo <kpv@research.att.com> *
21 ***********************************************************************/
27 * generate mode features
32 #include "FEATURE/param"
34 #include <modecanon.h>
46 printf("#define S_ITYPE(m) ((m)&S_IFMT)\n");
48 printf("#define S_ITYPE(m) ((m)&~S_IPERM)\n");
52 if (!S_ISBLK(X_IFBLK
)) idtype
= 0;
55 printf("#define S_ISBLK(m) (S_ITYPE(m)==S_IFBLK)\n");
57 printf("#define S_ISBLK(m) 0\n");
61 if (!S_ISCHR(X_IFCHR
)) idtype
= 0;
64 printf("#define S_ISCHR(m) (S_ITYPE(m)==S_IFCHR)\n");
66 printf("#define S_ISCHR(m) 0\n");
70 if (!S_ISCTG(X_IFCTG
)) idtype
= 0;
73 printf("#define S_ISCTG(m) (S_ITYPE(m)==S_IFCTG)\n");
77 if (!S_ISDIR(X_IFDIR
)) idtype
= 0;
80 printf("#define S_ISDIR(m) (S_ITYPE(m)==S_IFDIR)\n");
82 printf("#define S_ISDIR(m) 0\n");
86 if (!S_ISFIFO(X_IFIFO
)) idtype
= 0;
89 printf("#define S_ISFIFO(m) (S_ITYPE(m)==S_IFIFO)\n");
91 printf("#define S_ISFIFO(m) 0\n");
95 if (!S_ISLNK(X_IFLNK
)) idtype
= 0;
98 printf("#define S_ISLNK(m) (S_ITYPE(m)==S_IFLNK)\n");
100 printf("#define S_ISLNK(m) 0\n");
104 if (!S_ISREG(X_IFREG
)) idtype
= 0;
107 printf("#define S_ISREG(m) (S_ITYPE(m)==S_IFREG)\n");
109 printf("#define S_ISREG(m) 0\n");
113 if (!S_ISSOCK(X_IFSOCK
)) idtype
= 0;
116 printf("#define S_ISSOCK(m) (S_ITYPE(m)==S_IFSOCK)\n");
121 printf("#define S_IPERM (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)\n");
124 printf("#define S_ISUID 0%04o\n", X_ISUID
);
126 if (S_ISUID
!= X_ISUID
) idperm
= 0;
129 printf("#define S_ISGID 0%04o\n", X_ISGID
);
131 if (S_ISGID
!= X_ISGID
) idperm
= 0;
134 printf("#define S_ISVTX 0%04o\n", X_ISVTX
);
136 if (S_ISVTX
!= X_ISVTX
) idperm
= 0;
139 printf("#define S_IRUSR 0%04o\n", X_IRUSR
);
141 if (S_IRUSR
!= X_IRUSR
) idperm
= 0;
144 printf("#define S_IWUSR 0%04o\n", X_IWUSR
);
146 if (S_IWUSR
!= X_IWUSR
) idperm
= 0;
149 printf("#define S_IXUSR 0%04o\n", X_IXUSR
);
151 if (S_IXUSR
!= X_IXUSR
) idperm
= 0;
154 printf("#define S_IRGRP 0%04o\n", X_IRGRP
);
156 if (S_IRGRP
!= X_IRGRP
) idperm
= 0;
159 printf("#define S_IWGRP 0%04o\n", X_IWGRP
);
161 if (S_IWGRP
!= X_IWGRP
) idperm
= 0;
164 printf("#define S_IXGRP 0%04o\n", X_IXGRP
);
166 if (S_IXGRP
!= X_IXGRP
) idperm
= 0;
169 printf("#define S_IROTH 0%04o\n", X_IROTH
);
171 if (S_IROTH
!= X_IROTH
) idperm
= 0;
174 printf("#define S_IWOTH 0%04o\n", X_IWOTH
);
176 if (S_IWOTH
!= X_IWOTH
) idperm
= 0;
179 printf("#define S_IXOTH 0%04o\n", X_IXOTH
);
181 if (S_IXOTH
!= X_IXOTH
) idperm
= 0;
184 printf("#define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)\n");
187 printf("#define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)\n");
190 printf("#define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)\n");
193 if (idperm
) printf("#define _S_IDPERM 1\n");
194 if (idtype
) printf("#define _S_IDTYPE 1\n");
208 if (sizeof(char*) > 4) n
= 8192;
209 else if (sizeof(char*) < 4) n
= 512;
215 printf("#define BUFFERSIZE %u\n", n
);