add some constants to grovel
							parent
							
								
									7784465edc
								
							
						
					
					
						commit
						2da79d04fd
					
				| 
						 | 
					@ -32,9 +32,12 @@
 | 
				
			||||||
#if defined(UNIX)
 | 
					#if defined(UNIX)
 | 
				
			||||||
	#include <sys/types.h>
 | 
						#include <sys/types.h>
 | 
				
			||||||
	#include <sys/stat.h>
 | 
						#include <sys/stat.h>
 | 
				
			||||||
 | 
						#include <sys/socket.h>
 | 
				
			||||||
 | 
						#include <sys/errno.h>
 | 
				
			||||||
 | 
						#include <fcntl.h>
 | 
				
			||||||
 | 
						#include <unistd.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
#define BL printf(" ");
 | 
					#define BL printf(" ");
 | 
				
			||||||
#define QUOT printf("\"");
 | 
					#define QUOT printf("\"");
 | 
				
			||||||
#define NL printf("\n");
 | 
					#define NL printf("\n");
 | 
				
			||||||
| 
						 | 
					@ -50,6 +53,7 @@
 | 
				
			||||||
#define header2(os,struct) printf("vvv %s %s vvv", (os), (struct)); NL
 | 
					#define header2(os,struct) printf("vvv %s %s vvv", (os), (struct)); NL
 | 
				
			||||||
#define footer2(os,struct) printf("^^^ %s %s ^^^", (os), (struct)); NL
 | 
					#define footer2(os,struct) printf("^^^ %s %s ^^^", (os), (struct)); NL
 | 
				
			||||||
#define struct(n) printf("C-STRUCT: %s\n", (n));
 | 
					#define struct(n) printf("C-STRUCT: %s\n", (n));
 | 
				
			||||||
 | 
					#define constant(n) printf("#define "); printf(#n); printf(" %d (HEX: %04x)", (n), (n)); NL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void openbsd_types()
 | 
					void openbsd_types()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -79,9 +83,9 @@ void openbsd_stat()
 | 
				
			||||||
	grovel2(gid_t, "st_gid");
 | 
						grovel2(gid_t, "st_gid");
 | 
				
			||||||
	grovel2(dev_t, "st_rdev");
 | 
						grovel2(dev_t, "st_rdev");
 | 
				
			||||||
	grovel2(int32_t, "st_lspare0");
 | 
						grovel2(int32_t, "st_lspare0");
 | 
				
			||||||
	grovel2(struct timespec, "st_atimespec");
 | 
						grovel2(struct timespec, "st_atim");
 | 
				
			||||||
	grovel2(struct timespec, "st_mtimespec");
 | 
						grovel2(struct timespec, "st_mtim");
 | 
				
			||||||
	grovel2(struct timespec, "st_ctimespec");
 | 
						grovel2(struct timespec, "st_ctim");
 | 
				
			||||||
	grovel2(off_t, "st_size");
 | 
						grovel2(off_t, "st_size");
 | 
				
			||||||
	grovel2(int64_t, "st_blocks");
 | 
						grovel2(int64_t, "st_blocks");
 | 
				
			||||||
	grovel2(u_int32_t, "st_blksize");
 | 
						grovel2(u_int32_t, "st_blksize");
 | 
				
			||||||
| 
						 | 
					@ -109,6 +113,28 @@ void unix_types()
 | 
				
			||||||
	grovel(time_t);
 | 
						grovel(time_t);
 | 
				
			||||||
	grovel(uid_t);
 | 
						grovel(uid_t);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void unix_constants()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						constant(O_RDONLY);
 | 
				
			||||||
 | 
						constant(O_WRONLY);
 | 
				
			||||||
 | 
						constant(O_RDWR);
 | 
				
			||||||
 | 
						constant(O_APPEND);
 | 
				
			||||||
 | 
						constant(O_CREAT);
 | 
				
			||||||
 | 
						constant(O_TRUNC);
 | 
				
			||||||
 | 
						constant(O_EXCL);
 | 
				
			||||||
 | 
						constant(FD_SETSIZE);
 | 
				
			||||||
 | 
						constant(SOL_SOCKET);
 | 
				
			||||||
 | 
						constant(SO_REUSEADDR);
 | 
				
			||||||
 | 
						constant(SO_OOBINLINE);
 | 
				
			||||||
 | 
						constant(SO_SNDTIMEO);
 | 
				
			||||||
 | 
						constant(SO_RCVTIMEO);
 | 
				
			||||||
 | 
						constant(F_SETFL);
 | 
				
			||||||
 | 
						constant(O_NONBLOCK);
 | 
				
			||||||
 | 
						constant(EINTR);
 | 
				
			||||||
 | 
						constant(EAGAIN);
 | 
				
			||||||
 | 
						constant(EINPROGRESS);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
int main() {
 | 
					int main() {
 | 
				
			||||||
	//grovel(char);
 | 
						//grovel(char);
 | 
				
			||||||
| 
						 | 
					@ -121,6 +147,7 @@ int main() {
 | 
				
			||||||
	//grovel(void*);
 | 
						//grovel(void*);
 | 
				
			||||||
	//grovel(char*);
 | 
						//grovel(char*);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef FREEBSD
 | 
					#ifdef FREEBSD
 | 
				
			||||||
	grovel(blkcnt_t);
 | 
						grovel(blkcnt_t);
 | 
				
			||||||
	grovel(blksize_t);
 | 
						grovel(blksize_t);
 | 
				
			||||||
| 
						 | 
					@ -134,8 +161,10 @@ int main() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef UNIX
 | 
					#ifdef UNIX
 | 
				
			||||||
	unix_types();
 | 
						unix_types();
 | 
				
			||||||
 | 
						unix_constants();
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	grovel(long);
 | 
						grovel(long);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue