provisional MakeMaker patch for VMS
[p5sagit/p5-mst-13.2.git] / util.c
diff --git a/util.c b/util.c
index 09af1de..6e50628 100644 (file)
--- a/util.c
+++ b/util.c
@@ -948,6 +948,25 @@ Perl_form_nocontext(const char* pat, ...)
 }
 #endif /* PERL_IMPLICIT_CONTEXT */
 
+/*
+=for apidoc form
+
+Takes a sprintf-style format pattern and conventional
+(non-SV) arguments and returns the formatted string.
+
+    (char *) Perl_form(pTHX_ const char* pat, ...)
+
+can be used any place a string (char *) is required:
+
+    char * s = Perl_form("%d.%d",major,minor);
+
+Uses a single private buffer so if you want to format several strings you
+must explicitly copy the earlier strings away (and free the copies when you
+are done).
+
+=cut
+*/
+
 char *
 Perl_form(pTHX_ const char* pat, ...)
 {
@@ -3975,7 +3994,7 @@ S_socketpair_udp (int fd[2]) {
     struct sockaddr_in addresses[2];
     int i;
     Sock_size_t size = sizeof (struct sockaddr_in);
-    short port;
+    unsigned short port;
     int got;
 
     memset (&addresses, 0, sizeof (addresses));
@@ -4059,7 +4078,7 @@ S_socketpair_udp (int fd[2]) {
        (hence MSG_DONTWAIT). Or that what arrives was sent by us.  */
     {
         struct sockaddr_in readfrom;
-        short buffer[2];
+        unsigned short buffer[2];
 
         i = 1;
         do {
@@ -4076,7 +4095,7 @@ S_socketpair_udp (int fd[2]) {
             if (got != sizeof(port)
                 || size != sizeof (struct sockaddr_in)
                 /* Check other socket sent us its port.  */
-                || buffer[0] != addresses[!i].sin_port
+                || buffer[0] != (unsigned short) addresses[!i].sin_port
                 /* Check kernel says we got the datagram from that socket.  */
                 || readfrom.sin_family != addresses[!i].sin_family
                 || readfrom.sin_addr.s_addr != addresses[!i].sin_addr.s_addr
@@ -4116,7 +4135,11 @@ Perl_my_socketpair (int family, int type, int protocol, int fd[2]) {
     struct sockaddr_in connect_addr;
     Sock_size_t size;
 
-    if (protocol || family != AF_UNIX) {
+    if (protocol
+#ifdef AF_UNIX
+       || family != AF_UNIX
+#endif
+       ) {
         errno = EAFNOSUPPORT;
         return -1;
     }