1/* $Copyright: 2 * 3 * Copyright 1998-2000 by the Massachusetts Institute of Technology. 4 * 5 * All rights reserved. 6 * 7 * Permission to use, copy, modify, and distribute this software and its 8 * documentation for any purpose and without fee is hereby granted, 9 * provided that the above copyright notice appear in all copies and that 10 * both that copyright notice and this permission notice appear in 11 * supporting documentation, and that the name of M.I.T. not be used in 12 * advertising or publicity pertaining to distribution of the software 13 * without specific, written prior permission. Furthermore if you modify 14 * this software you must label your software as modified software and not 15 * distribute it in such a fashion that it might be confused with the 16 * original MIT software. M.I.T. makes no representations about the 17 * suitability of this software for any purpose. It is provided "as is" 18 * without express or implied warranty. 19 * 20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 21 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 22 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 23 * 24 * Individual source code files are copyright MIT, Cygnus Support, 25 * OpenVision, Oracle, Sun Soft, FundsXpress, and others. 26 * 27 * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, 28 * and Zephyr are trademarks of the Massachusetts Institute of Technology 29 * (MIT). No commercial use of these trademarks may be made without prior 30 * written permission of MIT. 31 * 32 * "Commercial use" means use of a name in a product or other for-profit 33 * manner. It does NOT prevent a commercial firm from referring to the MIT 34 * trademarks in order to convey information (although in doing so, 35 * recognition of their trademark status should be given). 36 * $ 37 */ 38 39/* $Header: /Volumes/backup/dsmigrate/Dumps/../CVS/passwordserver_sasl/cyrus_sasl/mac/CommonKClient/mac_kclient3/Headers/KerberosSupport/Utilities.h,v 1.4 2005/01/10 19:10:48 snsimon Exp $ */ 40 41/* 42 * Utilities.h - Public header file for the Utilities library 43 */ 44 45#ifndef __UTILITIES__ 46#define __UTILITIES__ 47 48#include <time.h> 49#include <KerberosSupport/pwd.h> 50 51#include <ConditionalMacros.h> 52#include <MacTypes.h> 53 54#if PRAGMA_ONCE 55#pragma once 56#endif 57 58#ifdef __cplusplus 59extern "C" { 60#endif 61 62#if PRAGMA_IMPORT 63#pragma import on 64#endif 65 66#if PRAGMA_STRUCT_ALIGN 67 #pragma options align=mac68k 68#elif PRAGMA_STRUCT_PACKPUSH 69 #pragma pack(push, 2) 70#elif PRAGMA_STRUCT_PACK 71 #pragma pack(2) 72#endif 73 74/************************/ 75/* Structures and Types */ 76/************************/ 77 78/* common types for POSIX structures */ 79typedef unsigned char u_char; 80typedef unsigned short u_short; 81typedef unsigned int u_int; 82typedef unsigned long u_long; 83 84typedef unsigned char uchar_t; 85typedef unsigned short ushort_t; 86/*typedef UInt32 uint_t;*/ /* We don't define uint_t because OpenTransport.h does. */ 87typedef unsigned long ulong_t; 88 89typedef char *caddr_t; 90typedef SInt32 daddr_t; 91typedef SInt16 cnt_t; 92 93typedef ulong_t paddr_t; 94typedef uchar_t use_t; 95typedef SInt16 sysid_t; 96typedef SInt16 index_t; 97 98 99/**********/ 100/* Macros */ 101/**********/ 102 103/* macros for BSD memory utilities */ 104#define bzero(dest, nbytes) memset(dest, 0, nbytes) 105#define bcopy(src, dest, nbytes) memcpy(dest, src, nbytes) 106#define bcmp(ptr1, ptr2, nbytes) memcmp(ptr1, ptr2, nbytes) 107#define index(s, c) strchr(s, c) 108#define rindex(s, c) strrchr(s, c) 109 110 111/***********************/ 112/* Function Prototypes */ 113/***********************/ 114 115/* String Utilities */ 116int strcasecmp(const char *s1, const char *s2); 117int strncasecmp(const char *s1, const char *s2, register int n); 118char *strtoken (const char *s, const char *delim, int index); 119char *strdup (const char *s); 120void swab(register char *from, register char *to, register int n); 121 122/* Time Utilities */ 123int gettimeofday (struct timeval *tp, struct timezone *); 124int settimeofday (struct timeval *tp, struct timezone *); 125void get_gmt_offset(void); 126void mac_time_to_unix_time (time_t *time); 127void unix_time_to_mac_time (time_t *time); 128void msl_time_to_unix_time (time_t *time); 129void unix_time_to_msl_time (time_t *time); 130 131/* Mac OS X Runtime utilities */ 132Boolean RunningUnderClassic (void); 133Boolean RunningUnderMacOSX (void); 134 135 136#if PRAGMA_STRUCT_ALIGN 137 #pragma options align=reset 138#elif PRAGMA_STRUCT_PACKPUSH 139 #pragma pack(pop) 140#elif PRAGMA_STRUCT_PACK 141 #pragma pack() 142#endif 143 144#ifdef PRAGMA_IMPORT_OFF 145#pragma import off 146#elif PRAGMA_IMPORT 147#pragma import reset 148#endif 149 150#ifdef __cplusplus 151} 152#endif 153 154#endif /* __UTILTIES__ */