2012-06-20 15:48, Carnë Draug skrev:
> On 20 June 2012 12:57, Paul Dreik <sl...@pauldreik.se> wrote:
>> I had commit rights earlier, but I have changed sourceforge account
>> since I got married and changed my name. The earlier username was
>> paulsundvall and it is now pauldreik. Can you please add me?
> Done. I have removed paulsundvall and added pauldreik to the list of
> members. Same permissions as before.
>
> Carnë
Thank you, but I could not commit. It wont accept my credentials, even
if I see that you added me on my sourceforge account page. svn uses the
same name/password as the login page, right?
I used the --username=xxx flag both during checkout and commit. I use
/usr/bin/svn in ubuntu 12.04.

I took the freedom to update the documentation strings and bump the
version to 1.0.8 at the same time.

I attach a patch for those interested, while waiting for commit access
to start working.

Paul Dreik
Index: DESCRIPTION
===================================================================
--- DESCRIPTION	(revision 10644)
+++ DESCRIPTION	(arbetskopia)
@@ -1,6 +1,6 @@
 Name: sockets
-Version: 1.0.7
-Date: 2011-03-03
+Version: 1.0.8
+Date: 2012-06-20
 Author: John Swensen <jpswen...@comcast.net>
 Maintainer: Tom Holroyd <t...@kurage.nimh.nih.gov>
 Title: Sockets
Index: src/sockets.cc
===================================================================
--- src/sockets.cc	(revision 10644)
+++ src/sockets.cc	(arbetskopia)
@@ -30,17 +30,16 @@
 // System includes
 #include <sys/types.h>
 #ifndef __WIN32__
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#ifdef __CYGWIN__
-#include <unistd.h>
-#endif
+#  include <sys/socket.h>
+#  include <netinet/in.h>
+#  include <arpa/inet.h>
+#  include <netdb.h>
+#  include <unistd.h>
 #else
-typedef unsigned int socklen_t;
-#include <winsock2.h>
+   typedef unsigned int socklen_t;
+#  include <winsock2.h>
 #endif
+
 #include <errno.h>
 
 template <class T>
@@ -326,7 +325,7 @@
 // Function to create a socket
 DEFUN_DLD(socket,args,nargout,
 	  "s=socket(domain,type,protocol)\n"
-	  "Creates a socket. Domain is an integer, where the value AF_INET\n"
+	  "Creates a socket s. Domain is an integer, where the value AF_INET\n"
 	  "can be used to create an IPv4 socket.\n"
 	  "type is an integer describing the socket. When using IP, specifying "
 	  "SOCK_STREAM gives a TCP socket.\n"
@@ -334,7 +333,7 @@
 	  "\n"
 	  "If no input arguments are given, default values AF_INET and \n"
 	  "SOCK_STREAM are used.\n"
-	  "See the local socket() reference for more details\n")
+	  "See the local socket() reference for more details.\n")
 {
   int domain    = AF_INET;
   int type      = SOCK_STREAM;
@@ -393,14 +392,14 @@
 // PKG_ADD: autoload ("connect", "sockets.oct");
 // function to create an outgoing connection
 DEFUN_DLD(connect,args,nargout, \
-	  "status=connect(sock,serverinfo)\n"
-	  "Connects the socket given in sock following the information\n"
-	  "given in the struct serverinfo\n"
+	  "status=connect(s,serverinfo)\n"
+	  "Connects the socket s following the information\n"
+	  "in the struct serverinfo.\n"
 	  "serverinfo shall contain the following fields:\n"
 	  " addr - a string with the host name to connect to\n"
 	  " port - the port number to connect to (an integer)\n"
 	  "\n"
-	  "On successful connect, zero is returned in status.\n"
+	  "On successful connect, the returned status is zero.\n"
 	  "\n"
 	  "See the connect() man pages for further details.\n")
 {
@@ -408,9 +407,9 @@
   struct sockaddr_in serverInfo;
   struct hostent*    hostInfo;
 
-  if ( args.length() < 2 )
+  if ( args.length() != 2 )
   {
-    error("connect: you must specify 2 paramters");
+    error("connect: you must specify 2 parameters.");
     return octave_value(-1);
   }
 
@@ -430,7 +429,7 @@
     }
   else
     {
-      error ("connect: invalid input: no 'addr' field");
+      error ("connect: invalid input: no 'addr' field in serverinfo.");
       return octave_value (-1);
     }
 
@@ -442,7 +441,7 @@
     }
   else
     {
-      error ("connect: invalid input: no 'port' field");
+      error ("connect: invalid input: no 'port' field in serverinfo.");
       return octave_value (-1);
     }
 #endif
@@ -462,7 +461,7 @@
   }
   else
   {
-    error("connect: expecting a octave_socket or integer");
+    error("connect: expecting an octave_socket or integer");
     return octave_value(-1);
   }
 
@@ -496,8 +495,10 @@
 // PKG_ADD: autoload ("disconnect", "sockets.oct");
 // function to disconnect asocket
 DEFUN_DLD(disconnect,args,nargout, \
-	  "disconnect(octave_socket)\n"
-	  "Since we can't call fclose on the fd directly, use this to disconnect")
+	  "disconnect(s)\n"
+	  "Disconnects the socket s.\n"
+	  "Since we can't call fclose on the file descriptor directly,\n"
+	  "use this function to disconnect the socket.")
 {
   // Determine the socket on which to operate
   octave_socket* s = NULL;
@@ -513,7 +514,7 @@
   }
   else
   {
-    error("connect: expecting a octave_socket or integer");
+    error("connect: expecting an octave_socket or integer");
     return octave_value(-1);
   }
 
@@ -526,8 +527,13 @@
 // PKG_ADD: autoload ("gethostbyname", "sockets.oct");
 // function to get a host number from a host name
 DEFUN_DLD(gethostbyname,args,nargout, \
-	  "gethostbyname(string)\n"
-	  "See the gethostbyname() man pages")
+	  "addr=gethostbyname(hostname)\n"
+	  "Returns an IP adress addr for a host name.\n"
+	  "Example:\n"
+	  "addr=gethostbyname('localhost')\n"
+	  "addr = 127.0.0.1\n"
+	  "\n"
+	  "See the gethostbyname() man pages for details.")
 {
   int nargin = args.length ();
   struct hostent*    hostInfo = NULL;
@@ -559,16 +565,17 @@
 // PKG_ADD: autoload ("send", "sockets.oct");
 // function to send data over a socket
 DEFUN_DLD(send,args,nargout, \
-	  "send(octave_socket,octave_value,flags)\n"
-	  "See the send() man pages.  This will only allow the\n"
-	  "user to send uint8 arrays or strings\n")
+	  "send(s,data,flags)\n"
+	  "Sends data on socket s. data should be an uint8 array or\n"
+	  "a string.\n"
+	  "See the send() man pages for further details.\n")
 {
   int retval = 0;
   int flags = 0;
 
   if ( args.length() < 2 )
   {
-    error( "send: you must specify 2 parameters");
+    error( "send: you must specify two or more parameters");
     return octave_value(-1);
   }
 
@@ -590,7 +597,7 @@
   }
   else
   {
-    error("connect: expecting a octave_socket or integer");
+    error("connect: expecting an octave_socket or integer");
     return octave_value(-1);
   }
 
@@ -622,8 +629,8 @@
 // PKG_ADD: autoload ("recv", "sockets.oct");
 // function to receive data over a socket
 DEFUN_DLD(recv,args,nargout, \
-	  "[data,count]=recv(sock,len,flags)\n"
-	  "Requests reading len bytes from the socket given in sock.\n"
+	  "[data,count]=recv(s,len,flags)\n"
+	  "Requests reading len bytes from the socket s.\n"
 	  "The integer flags parameter can be used to modify the behaviour\n"
 	  "of recv.\n"
 	  "\n"
@@ -631,7 +638,7 @@
 	  "bytes read is returned in count\n"
 	  "\n"
 	  "You can get non-blocking operation by using the flag MSG_DONTWAIT\n"
-	  "which makes the recv() call return immediately. If there is no\n"
+	  "which makes the recv() call return immediately. If there are no\n"
 	  "data, -1 is returned.\n"
 	  "See the recv() man pages for further details.\n")
 {
@@ -661,7 +668,7 @@
   }
   else
   {
-    error("recv: expecting a octave_socket or integer");
+    error("recv: expecting an octave_socket or integer");
     return octave_value(-1);
   }
 
@@ -708,12 +715,12 @@
 // PKG_ADD: autoload ("bind", "sockets.oct");
 // function to bind a socket
 DEFUN_DLD(bind,args,nargout, \
-	  "bind(octave_socket,int)\n"
-	  "See the bind() man pages.  This will bind a socket to a" \
-	  " specific port\n")
+	  "bind(s,portnumber)\n"
+	  "binds the sockets to port portnumber.\n"
+	  "See the bind() man pages for further details.\n")
 {
   int retval = 0;
-  if ( args.length() < 2 )
+  if ( args.length() != 2 )
   {
     error( "bind: you must specify 2 parameters" );
     return octave_value(-1);
@@ -733,7 +740,7 @@
   }
   else
   {
-    error("connect: expecting a octave_socket or integer");
+    error("connect: expecting an octave_socket or integer");
     return octave_value(-1);
   }
 
@@ -753,11 +760,15 @@
 // PKG_ADD: autoload ("listen", "sockets.oct");
 // function to listen on a socket
 DEFUN_DLD(listen,args,nargout, \
-	  "listen(octave_socket,int)\n"
-	  "See the listen() man pages\n")
+	  "r=listen(s,backlog)\n"
+	  "Listens on socket s for connections. backlog specifies\n"
+	  "how large the queue of incoming connections is allowed to\n"
+	  "grow.\n"
+	  "On success, zero is returned.\n"
+	  "See the listen() man pages for details.\n")
 {
   int retval = 0;
-  if ( args.length() < 2 )
+  if ( args.length() != 2 )
   {
     error( "listen: you must specify 2 parameters" );
     return octave_value(-1);
@@ -777,7 +788,7 @@
   }
   else
   {
-    error("connect: expecting a octave_socket or integer");
+    error("connect: expecting an octave_socket or integer");
     return octave_value(-1);
   }
 
@@ -793,8 +804,11 @@
 // PKG_ADD: autoload ("accept", "sockets.oct");
 // function to accept on a listening socket
 DEFUN_DLD(accept,args,nargout, \
-	  "accept(octave_socket)\n"
-	  "See the accept() man pages\n")
+	  "[client,info]=accept(s)\n"
+	  "Accepts an incoming connection on the socket s.\n"
+	  "The newly created socket is returned in client, and\n"
+	  "associated information in a struct info.\n"
+	  "See the accept() man pages for details.\n")
 {
   int retval = 0;
   struct sockaddr_in clientInfo;
@@ -820,7 +834,7 @@
   }
   else
   {
-    error("accept: expecting a octave_socket or integer");
+    error("accept: expecting an octave_socket or integer");
     return octave_value(-1);
   }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 10644)
+++ ChangeLog	(arbetskopia)
@@ -1,3 +1,5 @@
+20120620 Paul Dreik
+	now compiles with gcc 4.7
 20070514 tomh
 Added to sourceforge
 
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to