1 /* $Id: xxx_client_mac_lib.c,v 1.3 2003/02/13 19:55:59 rjs3 Exp $
2 * Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
16 * 3. The name "Carnegie Mellon University" must not be used to
17 * endorse or promote products derived from this software without
18 * prior written permission. For permission or any other legal
19 * details, please contact
20 * Office of Technology Transfer
21 * Carnegie Mellon University
23 * Pittsburgh, PA 15213-3890
24 * (412) 268-4387, fax: (412) 268-7395
25 * tech-transfer@andrew.cmu.edu
27 * 4. Redistributions of any form whatsoever must retain the following
29 * "This product includes software developed by Computing Services
30 * at Carnegie Mellon University (http://www.cmu.edu/computing/)."
32 * CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
33 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
34 * AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
35 * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
36 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
37 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
38 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
41 * routines used by the sasl test programs and not provided
42 * by a mac. see also xxx_mac_lib.c for routines needed by
43 * the sasl library and not supplied by the system runtime
52 #include <netinet/in.h>
54 char *__progname="mac";
56 struct hostent *gethostbyname(const char *hnam)
58 static struct hostent result;
62 if(sscanf(hnam,"%d.%d.%d.%d",bytes,bytes+1,bytes+2,bytes+3)!=4)
68 memcpy(result.h_addr,&ip,4);
75 static void xxy_chomp(char *s,const char stop_here)
78 while((ch= (*s++))!=0)
85 char* getpass(const char *prompt)
87 const int max_buf=200;
88 char *buf=malloc(max_buf);
91 memset(buf,0,max_buf); /* not likely to be a performance issue eheh */
93 fgets(buf,max_buf-1,stdin);
98 #ifdef TARGET_API_MAC_CARBON
99 char *strdup(const char *str)
104 const int len=strlen(str);
105 char *result=malloc(len+1);