Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uwvax!natasha.cs.wisc.EDU!zvr From: zvr@natasha.cs.wisc.EDU (Alexios Zavras) Newsgroups: comp.unix.ultrix Subject: Re: looking for usleep() implementation for ULTRIX Message-ID: <8904@spool.cs.wisc.edu> Date: 19 Oct 89 17:53:10 GMT References: <8896@spool.cs.wisc.edu> <5508@shlump.nac.dec.com> <5499@shlump.nac.dec.com> Sender: news@spool.cs.wisc.edu Reply-To: zvr@natasha.cs.wisc.EDU (Alexios Zavras) Organization: University of Wisconsin - Computer Sciences Department Lines: 38 In article <8896@spool.cs.wisc.edu>, I wrote: > #define macro(x) do { stmt1(x); stmt2(x); ... } while (0); and later... > #define usleep(usec) > do \ > { \ > struct timeval usl_delay; \ > usl_delay.tv_sec = (int) (usec) / 1000000; \ > usl_delay.tv_usec = (int) (usec) % 1000000; \ > (void) select(0,(fd_set *)0,(fd_set *)0,(fd_set *)0, &usl_delay);\ > } while (0); Sorry, I must have been asleep! :-) You naturally have to omit the final `;' in both cases, i.e.: #define macro(x) do { stmt1(x); stmt2(x); ... } while (0) Then you can easily write if (...) macro(...); else ... without any problems... Sorry about that, -- zvr -- +-----------------------+ Alexios Zavras | Life is once, forever | zvr@cs.wisc.edu +-----------------H C-B-+ zavras@cs.wisc.edu Live from: Wisconsin: land of Orson Welles, Frank Lloyd Wright, Harry Houdini and Spencer Tracy (of Joe McCarthy, too, but we try to forget that)