Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!sdd.hp.com!hplabs!hpfcso!hpfcmgw!chan From: chan@hpfcmgw.HP.COM (Chan Benson) Newsgroups: comp.sys.hp Subject: Re: usleep [Re: BSD and HPUX, The Questions Continue...] Message-ID: <17780026@hpfcmgw.HP.COM> Date: 21 May 91 16:01:10 GMT References: <1991May2.202710.5152@odin.diku.dk> Organization: HP Fort Collins, CO Lines: 42 >>>Anyway, use of BSD functions doesn't imply "sloppy programming style", >>>just "BSD programming style". We're trying to minimize the pain required >>>for importing BSD and Sun applications. The only things we want to force >>>-lBSD for is when conflicting functions are used, such as setpgrp() and >>>signal(). >> >>I don't understand. I just wasted many tens of hours trying to port a >>large package (the PP X.400 system) to HP/UX, which broke signal() >>because I was trying to use -lBSD in order to get the b*() functions. >>I finally had to take out -lBSD and use macros for the b* stuff. >>Admittedly the package was not totally BSD-ish, in that it had a compile >>option for SYS5, which only addressed part of the BSD-SYS5 issues. >> >>Why would you want to force -lBSD when it breaks SYS5 code? > >You wouldn't. If HP had had any brains, they would have kept the utility >funtions (bzero, etc) separate from functions which break existing code. Yes, that's what the original poster said: With the new setup, you only link in libBSD to get Berkeley things that conflict with System V. All the other stuff (like the b* routines) are available without -lBSD. > They also haven't bothered to include usleep(), so BSD programs which want that > routine can't be compiled without a bit of work either. Sure they can, they just can't be linked. (Sorry, I'm just trying to live up to my snide reputation.) Here's a version of usleep I use: #include usleep (usecs) long usecs; { struct timeval timeout; timeout.tv_sec = 0; /* should be usecs / 1000000 */ timeout.tv_usec = usecs; /* should be usecs % 1000000 */ select(0, 0, 0, 0, &timeout); } -- Chan Benson HP Fort Collins