comparison zotnet/mts/mts.c @ 16:07f8972434be

fix for Yosemita Clang
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 12 Nov 2014 02:46:27 +0900
parents 441a2190cfae
children
comparison
equal deleted inserted replaced
15:1891194b739c 16:07f8972434be
24 #else 24 #else
25 #include <sys/utsname.h> 25 #include <sys/utsname.h>
26 #endif /* SYS5 */ 26 #endif /* SYS5 */
27 #endif /* NETWORK */ 27 #endif /* NETWORK */
28 #include <pwd.h> 28 #include <pwd.h>
29 #include <netdb.h>
30 #include <unistd.h>
31
29 32
30 33
31 #define NOTOK (-1) 34 #define NOTOK (-1)
32 #define OK 0 35 #define OK 0
33 36
251 /* I'd like to use m_getfld() here, but not all programs loading mts.o may be 254 /* I'd like to use m_getfld() here, but not all programs loading mts.o may be
252 MH-style programs... */ 255 MH-style programs... */
253 256
254 /* ARGSUSED */ 257 /* ARGSUSED */
255 258
259 void
256 mts_init (name) 260 mts_init (name)
257 char *name; 261 char *name;
258 { 262 {
259 register char *bp, 263 register char *bp,
260 *cp; 264 *cp;
390 #if defined(BSD42) || defined(SOCKETS) 394 #if defined(BSD42) || defined(SOCKETS)
391 (void) gethostname (buffer, sizeof buffer); 395 (void) gethostname (buffer, sizeof buffer);
392 #ifndef BIND 396 #ifndef BIND
393 sethostent (1); 397 sethostent (1);
394 #endif 398 #endif
395 if (hp = mh_gethostbyname (buffer)) 399 if ((hp = mh_gethostbyname (buffer)))
396 (void) strcpy (buffer, hp -> h_name); 400 (void) strcpy (buffer, hp -> h_name);
397 #endif /* BSD42 or SOCKETS */ 401 #endif /* BSD42 or SOCKETS */
398 #else /* not NETWORK */ 402 #else /* not NETWORK */
399 #ifndef SYS5 403 #ifndef SYS5
400 (void) strcpy (buffer, SystemName ()); 404 (void) strcpy (buffer, SystemName ());
518 strcpy (username, cp); 522 strcpy (username, cp);
519 else if ((pw = getpwuid (getuid ())) == NULL 523 else if ((pw = getpwuid (getuid ())) == NULL
520 || pw -> pw_name == NULL 524 || pw -> pw_name == NULL
521 || *pw -> pw_name == '\0') { 525 || *pw -> pw_name == '\0') {
522 #else /* __CYGWIN32__ */ 526 #else /* __CYGWIN32__ */
523 if ((pw = getpwuid (getuid ())) == NULL 527 if (((pw = getpwuid (getuid ())) == NULL)
524 || pw -> pw_name == NULL 528 || pw -> pw_name == NULL
525 || *pw -> pw_name == '\0') { 529 || *pw -> pw_name == '\0') {
526 #endif /* __CYGWIN32__ */ 530 #endif /* __CYGWIN32__ */
527 #else /* KPOP */ 531 #else /* KPOP */
528 uid = getuid (); 532 uid = getuid ();