Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!unmvax!deimos.cis.ksu.edu!uxc!uxc.cso.uiuc.edu!m.cs.uiuc.edu!bradley!brian From: brian@bradley.UUCP Newsgroups: comp.unix.questions Subject: Re: To curse or not to curse Message-ID: <10800027@bradley> Date: 12 Jun 89 17:43:00 GMT References: <36@iisat.UUCP> Lines: 35 Nf-ID: #R:iisat.UUCP:36:bradley:10800027:000:1191 Nf-From: bradley.UUCP!brian Jun 12 12:43:00 1989 > /* Written 8:56 am Jun 9, 1989 by mhoffman@infocenter.UUCP */ > This works OK on every system I've worked on, but I understand that > some unfortunate souls must work without the benefits of structure > assignment. To make the code more portable for those systems > without, a #define statement could indicate this capability: > > . . . > > #ifdef STRUCTURE_ASST > t = o; /* copy structure in one swell foop */ > #else > t.c_iflag = o.c_iflag; /* copy element by element. . . */ > t.c_oflag = o.c_oflag; > t.c_cflag = o.c_cflag; > t.c_lflag = 0; /* inserting the desired changes */ > t.c_line = o.c_line; > *t.cc = *o.cc; > t.cc[VEOF] = 1; > #endif > . . . [rest of code] Wouldn't this work just as well: #ifdef STRUCTURE_ASST t = o; #else (void) memcpy((char *) &t, (char *) &o, sizeof(t)); #endif Brian Michael Wendt UUCP: {cepu,uiucdcs,noao}!bradley!brian Bradley University ARPA: cepu!bradley!brian@seas.ucla.edu (309) 677-2335 ICBM: 40 40' N 89 34' W "Down, down in the basement, we hear the sound of machines..."