| 2 * It contains source for the internal Zephyr routines. |
2 * It contains source for the internal Zephyr routines. |
| 3 * |
3 * |
| 4 * Created by: Robert French |
4 * Created by: Robert French |
| 5 * |
5 * |
| 6 * $Source$ |
6 * $Source$ |
| 7 * $Author: faceprint $ |
7 * $Author: thekingant $ |
| 8 * |
8 * |
| 9 * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of |
9 * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of |
| 10 * Technology. |
10 * Technology. |
| 11 * For copying and distribution information, see the file |
11 * For copying and distribution information, see the file |
| 12 * "mit-copyright.h". |
12 * "mit-copyright.h". |
| 18 #include <sys/socket.h> |
18 #include <sys/socket.h> |
| 19 #include <utmp.h> |
19 #include <utmp.h> |
| 20 |
20 |
| 21 #ifndef lint |
21 #ifndef lint |
| 22 static const char rcsid_Zinternal_c[] = |
22 static const char rcsid_Zinternal_c[] = |
| 23 "$Id: Zinternal.c 5500 2003-04-15 04:18:00Z faceprint $"; |
23 "$Id: Zinternal.c 8088 2003-11-11 07:08:13Z thekingant $"; |
| 24 static const char copyright[] = |
24 static const char copyright[] = |
| 25 "Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology."; |
25 "Copyright (c) 1987,1988,1991 by the Massachusetts Institute of Technology."; |
| 26 #endif |
26 #endif |
| 27 |
27 |
| 28 extern char *inet_ntoa (); |
28 extern char *inet_ntoa (); |
| 592 if (!notice->z_sender) |
592 if (!notice->z_sender) |
| 593 notice->z_sender = ZGetSender(); |
593 notice->z_sender = ZGetSender(); |
| 594 |
594 |
| 595 if (notice->z_port == 0) { |
595 if (notice->z_port == 0) { |
| 596 if (ZGetFD() < 0) { |
596 if (ZGetFD() < 0) { |
| 597 retval = ZOpenPort((u_short *)0); |
597 retval = ZOpenPort((unsigned short *)0); |
| 598 if (retval != ZERR_NONE) |
598 if (retval != ZERR_NONE) |
| 599 return (retval); |
599 return (retval); |
| 600 } |
600 } |
| 601 retval = getsockname(ZGetFD(), (struct sockaddr *) &name, &namelen); |
601 retval = getsockname(ZGetFD(), (struct sockaddr *) &name, &namelen); |
| 602 if (retval != 0) |
602 if (retval != 0) |
| 605 } |
605 } |
| 606 |
606 |
| 607 notice->z_multinotice = ""; |
607 notice->z_multinotice = ""; |
| 608 |
608 |
| 609 (void) gettimeofday(¬ice->z_uid.tv, (struct timezone *)0); |
609 (void) gettimeofday(¬ice->z_uid.tv, (struct timezone *)0); |
| 610 notice->z_uid.tv.tv_sec = htonl((u_long) notice->z_uid.tv.tv_sec); |
610 notice->z_uid.tv.tv_sec = htonl((unsigned long) notice->z_uid.tv.tv_sec); |
| 611 notice->z_uid.tv.tv_usec = htonl((u_long) notice->z_uid.tv.tv_usec); |
611 notice->z_uid.tv.tv_usec = htonl((unsigned long) notice->z_uid.tv.tv_usec); |
| 612 |
612 |
| 613 (void) memcpy(¬ice->z_uid.zuid_addr, &__My_addr, sizeof(__My_addr)); |
613 (void) memcpy(¬ice->z_uid.zuid_addr, &__My_addr, sizeof(__My_addr)); |
| 614 |
614 |
| 615 notice->z_multiuid = notice->z_uid; |
615 notice->z_multiuid = notice->z_uid; |
| 616 |
616 |
| 875 partnotice.z_multinotice = multi; |
875 partnotice.z_multinotice = multi; |
| 876 if (offset > 0) { |
876 if (offset > 0) { |
| 877 (void) gettimeofday(&partnotice.z_uid.tv, |
877 (void) gettimeofday(&partnotice.z_uid.tv, |
| 878 (struct timezone *)0); |
878 (struct timezone *)0); |
| 879 partnotice.z_uid.tv.tv_sec = |
879 partnotice.z_uid.tv.tv_sec = |
| 880 htonl((u_long) partnotice.z_uid.tv.tv_sec); |
880 htonl((unsigned long) partnotice.z_uid.tv.tv_sec); |
| 881 partnotice.z_uid.tv.tv_usec = |
881 partnotice.z_uid.tv.tv_usec = |
| 882 htonl((u_long) partnotice.z_uid.tv.tv_usec); |
882 htonl((unsigned long) partnotice.z_uid.tv.tv_usec); |
| 883 (void) memcpy((char *)&partnotice.z_uid.zuid_addr, &__My_addr, |
883 (void) memcpy((char *)&partnotice.z_uid.zuid_addr, &__My_addr, |
| 884 sizeof(__My_addr)); |
884 sizeof(__My_addr)); |
| 885 } |
885 } |
| 886 message_len = min(notice->z_message_len-offset, fragsize); |
886 message_len = min(notice->z_message_len-offset, fragsize); |
| 887 partnotice.z_message = notice->z_message+offset; |
887 partnotice.z_message = notice->z_message+offset; |