Re: Problem Compiling Stevens' Socket Source Code
I have uploaded to http://dfeustel.home.mindspring.com/unp-config.h a version of config.h that allows successful compilation of ~98% of the Stevens source files. Let me know of how to fix errors and I will update the file. Dave Feustel -- Lose, v., experience a loss, get rid of, "lose the weight" Loose, adj., not tight, let go, free, "loose clothing"
Re: Problem Compiling Stevens' Socket Source Code
On Mon, Apr 24, 2006 at 08:33:39PM -0401, Ray Lai wrote: > On Tue, Apr 25, 2006 at 12:10:14AM +0200, Tobias Ulmer wrote: > > Here's a patch that removes all(?) warnings/errors from the > > intro chapter if you followed the instructions in the readme... > > > > > > diff -ru unpv13e.orig/intro/byteorder.c unpv13e/intro/byteorder.c > > --- unpv13e.orig/intro/byteorder.c Thu Nov 14 04:33:33 2002 > > +++ unpv13e/intro/byteorder.c Tue Apr 18 04:39:40 2006 > > @@ -18,7 +18,7 @@ > > else > > printf("unknown\n"); > > } else > > - printf("sizeof(short) = %d\n", sizeof(short)); > > + printf("sizeof(short) = %zd\n", sizeof(short)); > > Use %zu for sizeof(), since it returns size_t, an unsigned type. > > -Ray- > > My mistake, thanks Ray :) Tobias
Re: Problem Compiling Stevens' Socket Source Code
On Tue, Apr 25, 2006 at 12:10:14AM +0200, Tobias Ulmer wrote: > Here's a patch that removes all(?) warnings/errors from the > intro chapter if you followed the instructions in the readme... > > > diff -ru unpv13e.orig/intro/byteorder.c unpv13e/intro/byteorder.c > --- unpv13e.orig/intro/byteorder.cThu Nov 14 04:33:33 2002 > +++ unpv13e/intro/byteorder.c Tue Apr 18 04:39:40 2006 > @@ -18,7 +18,7 @@ > else > printf("unknown\n"); > } else > - printf("sizeof(short) = %d\n", sizeof(short)); > + printf("sizeof(short) = %zd\n", sizeof(short)); Use %zu for sizeof(), since it returns size_t, an unsigned type. -Ray-
Re: Problem Compiling Stevens' Socket Source Code
On 4/24/06, Dave Feustel <[EMAIL PROTECTED]> wrote: > and I need to learn how to use sendto and recvfrom to control > and monitor the I/O bits. It looks to me like the configure script > doesn't generate a proper config.h for OpenBSD. I don't know whether > config doesn't know about OpenBSD file layout or something is > broken in configure. I'm suddenly learning a lot about autoconf, > but I still don't see the problem. i'd really recommend you just stop dicking around with configure and write the code. #include and go from there.
Re: Problem Compiling Stevens' Socket Source Code
On Monday 24 April 2006 17:10, Tobias Ulmer wrote: > Here's a patch that removes all(?) warnings/errors from the > intro chapter if you followed the instructions in the readme... Tobias, Thanks for the intro chapter patches. I had started directly with chapter 7 since I had purchased a hardware digital I/O module that communicates over ethernet via UDP datagrams (Ether 24 IO - http://elexol.com/Downloads/EtherIO24DS1.pdf available in the US from saelig.com for $99 + shipping ) and I need to learn how to use sendto and recvfrom to control and monitor the I/O bits. It looks to me like the configure script doesn't generate a proper config.h for OpenBSD. I don't know whether config doesn't know about OpenBSD file layout or something is broken in configure. I'm suddenly learning a lot about autoconf, but I still don't see the problem. I currently am tweaking config.h by hand trying to get rid of the compile errors caused by the bad data put in that file by configure. Dave Feustel -- Lose, v., experience a loss, get rid of, "lose the weight" Loose, adj., not tight, let go, free, "loose clothing"
Re: Problem Compiling Stevens' Socket Source Code
On Sun, Apr 23, 2006 at 09:28:19PM +0200, Otto Moerbeek wrote: > On Sun, 23 Apr 2006, Nick Guenther wrote: > > > On 4/23/06, Dave Feustel <[EMAIL PROTECTED]> wrote: > > > I have downloaded the source code accompanying > > > Stevens' book _Advanced Network Programming > > > - The Socket Programming API, vol 1, 3rd ed. > > > After uncompressing the tar ball, cd'ing to the source code > > > directory , running ./configure and attempting to gmake the source > > > in lib, I get a number of errors which seem to stem from failure > > > of the ./configure command to find many of the OpenBSD include files > > > related to sockets. This failure shows up in the file config.h, where > > > defines created during the configure process specify that OpenBSD > > > is missing many include files and socket-related structures. This results > > > in compile errors when socket structures are redefined during compilation. > > > I started to fix individual errors until I figured out that there was a > > > more > > > general problem in ./configure. I have looked at the shell script in > > > ./configure > > > but so far I have not figured out where the configure goes wrong. Is > > > there a > > > simple way to run or fix ./configure so that the config.h generated by > > > configure reflects the actual content of openbsd include files and > > > subsequent > > > compiles of Stevens' source work? > > > > Well, socket(2) shows that OpenBSD certainly has the full socket API > > (afterall, they were invented on BSD). My guess is that the book was > > designed for linux and no thought was given to users of other OSes. > > This shows that you don't know Stevens' books. Stevens books are among > the books to read if you want to learn how to write good POSIX > programs. Most of them were written before Linux became popular. > > For fun I tried to compile some of the programs mentioned, and the > programs I tested compiled fine, be it with some warnings about > usage of non-safe string functions. > > -Otto > > > So, to fix it, you should just have to redirect the socket includes to > > the proper place (i.e: > > #include > > #include > > ) > > > > Also: Hi Dave! > > > > -Nick > > Here's a patch that removes all(?) warnings/errors from the intro chapter if you followed the instructions in the readme... diff -ru unpv13e.orig/intro/byteorder.c unpv13e/intro/byteorder.c --- unpv13e.orig/intro/byteorder.c Thu Nov 14 04:33:33 2002 +++ unpv13e/intro/byteorder.c Tue Apr 18 04:39:40 2006 @@ -18,7 +18,7 @@ else printf("unknown\n"); } else - printf("sizeof(short) = %d\n", sizeof(short)); + printf("sizeof(short) = %zd\n", sizeof(short)); exit(0); } diff -ru unpv13e.orig/lib/error.c unpv13e/lib/error.c --- unpv13e.orig/lib/error.cSat Sep 20 04:51:29 2003 +++ unpv13e/lib/error.c Tue Apr 18 04:25:36 2006 @@ -96,7 +96,7 @@ n = strlen(buf); if (errnoflag) snprintf(buf + n, MAXLINE - n, ": %s", strerror(errno_save)); - strcat(buf, "\n"); + strlcat(buf, "\n", MAXLINE + 1); if (daemon_proc) { syslog(level, buf); diff -ru unpv13e.orig/lib/sock_ntop.c unpv13e/lib/sock_ntop.c --- unpv13e.orig/lib/sock_ntop.cMon Jul 28 06:26:32 2003 +++ unpv13e/lib/sock_ntop.c Tue Apr 18 04:36:21 2006 @@ -19,7 +19,7 @@ return(NULL); if (ntohs(sin->sin_port) != 0) { snprintf(portstr, sizeof(portstr), ":%d", ntohs(sin->sin_port)); - strcat(str, portstr); + strlcat(str, portstr, 128); } return(str); } @@ -34,7 +34,7 @@ return(NULL); if (ntohs(sin6->sin6_port) != 0) { snprintf(portstr, sizeof(portstr), "]:%d", ntohs(sin6->sin6_port)); - strcat(str, portstr); + strlcat(str, portstr, 128); return(str); } return (str + 1); @@ -48,7 +48,7 @@ /* OK to have no pathname bound to the socket: happens on every connect() unless client calls bind() first. */ if (unp->sun_path[0] == 0) - strcpy(str, "(no pathname bound)"); + strlcpy(str, "(no pathname bound)", 128); else snprintf(str, sizeof(str), "%s", unp->sun_path); return(str); diff -ru unpv13e.orig/lib/sock_ntop_host.c unpv13e/lib/sock_ntop_host.c --- unpv13e.orig/lib/sock_ntop_host.c Tue May 13 20:47:49 2003 +++ unpv13e/lib/sock_ntop_host.cTue Apr 18 11:58:31 2006 @@ -35,7 +35,7 @@ /* OK to have no pathname bound to the socket: happens on every connect() unless client calls bind() first. */
Re: Problem Compiling Stevens' Socket Source Code
On Sun, 23 Apr 2006 15:07:29 -0400 "Nick Guenther" <[EMAIL PROTECTED]> wrote: > My guess is that the book was designed for linux and no thought was > given to users of other OSes. Gah! Do you not even recognize the name Stevens? He used BSD/OS, he was not a big linux fan. And the book mentioned doesn't exist, its unix network programming. As the source download page says: "chances are this source will provide you a good starting point for something that works on your machine.". Its assumed that if you can read the book, you can also find headers. Adam
Re: Problem Compiling Stevens' Socket Source Code
On Sun, 23 Apr 2006, Nick Guenther wrote: > On 4/23/06, Dave Feustel <[EMAIL PROTECTED]> wrote: > > I have downloaded the source code accompanying > > Stevens' book _Advanced Network Programming > > - The Socket Programming API, vol 1, 3rd ed. > > After uncompressing the tar ball, cd'ing to the source code > > directory , running ./configure and attempting to gmake the source > > in lib, I get a number of errors which seem to stem from failure > > of the ./configure command to find many of the OpenBSD include files > > related to sockets. This failure shows up in the file config.h, where > > defines created during the configure process specify that OpenBSD > > is missing many include files and socket-related structures. This results > > in compile errors when socket structures are redefined during compilation. > > I started to fix individual errors until I figured out that there was a more > > general problem in ./configure. I have looked at the shell script in > > ./configure > > but so far I have not figured out where the configure goes wrong. Is there a > > simple way to run or fix ./configure so that the config.h generated by > > configure reflects the actual content of openbsd include files and > > subsequent > > compiles of Stevens' source work? > > Well, socket(2) shows that OpenBSD certainly has the full socket API > (afterall, they were invented on BSD). My guess is that the book was > designed for linux and no thought was given to users of other OSes. This shows that you don't know Stevens' books. Stevens books are among the books to read if you want to learn how to write good POSIX programs. Most of them were written before Linux became popular. For fun I tried to compile some of the programs mentioned, and the programs I tested compiled fine, be it with some warnings about usage of non-safe string functions. -Otto > So, to fix it, you should just have to redirect the socket includes to > the proper place (i.e: > #include > #include > ) > > Also: Hi Dave! > > -Nick
Re: Problem Compiling Stevens' Socket Source Code
On 4/23/06, Dave Feustel <[EMAIL PROTECTED]> wrote: > I have downloaded the source code accompanying > Stevens' book _Advanced Network Programming > - The Socket Programming API, vol 1, 3rd ed. > After uncompressing the tar ball, cd'ing to the source code > directory , running ./configure and attempting to gmake the source > in lib, I get a number of errors which seem to stem from failure > of the ./configure command to find many of the OpenBSD include files > related to sockets. This failure shows up in the file config.h, where > defines created during the configure process specify that OpenBSD > is missing many include files and socket-related structures. This results > in compile errors when socket structures are redefined during compilation. > I started to fix individual errors until I figured out that there was a more > general problem in ./configure. I have looked at the shell script in > ./configure > but so far I have not figured out where the configure goes wrong. Is there a > simple way to run or fix ./configure so that the config.h generated by > configure reflects the actual content of openbsd include files and subsequent > compiles of Stevens' source work? Well, socket(2) shows that OpenBSD certainly has the full socket API (afterall, they were invented on BSD). My guess is that the book was designed for linux and no thought was given to users of other OSes. So, to fix it, you should just have to redirect the socket includes to the proper place (i.e: #include #include ) Also: Hi Dave! -Nick
re Problem Compiling Stevens' Socket Source Code
I wrote previously: > I have downloaded the source code accompanying > Stevens' book _Advanced Network Programming > - The Socket Programming API, vol 1, 3rd ed. I forgot to mention that the souce code tar ball is available at http://www.unpbook.com/src.html. Thanks, Dave Feustel -- Lose, v., experience a loss, get rid of, "lose the weight" Loose, adj., not tight, let go, free, "loose clothing"
Problem Compiling Stevens' Socket Source Code
I have downloaded the source code accompanying Stevens' book _Advanced Network Programming - The Socket Programming API, vol 1, 3rd ed. After uncompressing the tar ball, cd'ing to the source code directory , running ./configure and attempting to gmake the source in lib, I get a number of errors which seem to stem from failure of the ./configure command to find many of the OpenBSD include files related to sockets. This failure shows up in the file config.h, where defines created during the configure process specify that OpenBSD is missing many include files and socket-related structures. This results in compile errors when socket structures are redefined during compilation. I started to fix individual errors until I figured out that there was a more general problem in ./configure. I have looked at the shell script in ./configure but so far I have not figured out where the configure goes wrong. Is there a simple way to run or fix ./configure so that the config.h generated by configure reflects the actual content of openbsd include files and subsequent compiles of Stevens' source work? Thanks, Dave Feustel -- Lose, v., experience a loss, get rid of, "lose the weight" Loose, adj., not tight, let go, free, "loose clothing"