/* --- Copyright University of Sussex 1999. All rights reserved. ----------
 * File:            C.unix/extern/lib/print_types.cc
 * Purpose:         Print out size-equivalent types for types in
 *                  $popsrc/unixdefs.ph (run by mklibpop -t)
 * Author:          John Gibson, Jan 20 1999
 */

#include <sys/types.h>
#include <sys/time.h>

char *print_type(char *typename, int size)
  { char *type;
	if (size == sizeof(char)) type = "char";
	else if (size == sizeof(short)) type = "short";
	else if (size == sizeof(int) && size != sizeof(long)) type = "int";
	else if (size == sizeof(long) && size != sizeof(int)) type = "long";
	else type = "int or long";

	printf("%s = %s\n", typename, type);
  }

main()
  { fd_set fds;

	printf("\nSize-equivalent types for types in $popsrc/unixdefs.ph:\n");
	print_type("off_t", sizeof(off_t));
/*    print_type("blkcnt_t", sizeof(blkcnt_t)); */
	print_type("dev_t", sizeof(dev_t));
	print_type("ino_t", sizeof(ino_t));
	print_type("mode_t", sizeof(mode_t));
	print_type("nlink_t", sizeof(nlink_t));
	print_type("time_t", sizeof(time_t));
	print_type("uid_t", sizeof(uid_t));
	print_type("gid_t", sizeof(gid_t));

	printf("\nIn $popsrc/unix_select.ph:\n");
	print_type("fd_mask", sizeof(fds.fds_bits[0]));
	printf("FD_SETSIZE = %d\n", FD_SETSIZE);
  }
