Xref: utzoo comp.bugs.4bsd:1663 comp.std.c:4176 Path: utzoo!utgpu!watserv1!watmath!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!well!jef From: jef@well.sf.ca.us (Jef Poskanzer) Newsgroups: comp.bugs.4bsd,comp.std.c Subject: Re: Bug in users command Message-ID: <22855@well.sf.ca.us> Date: 24 Jan 91 02:37:16 GMT References: <12360:Jan2320:15:5291@kramden.acf.nyu.edu> Reply-To: Jef Poskanzer Organization: Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal Lines: 19 In the referenced message, brnstnd@kramden.acf.nyu.edu (Dan Bernstein) wrote: }(The most }obvious implementation, of course, is to use char *'s, and add bytes }manually. Yeah, that's what I did when I wrote a users clone last year: #define MAXNAMES 1000 static char users[MAXNAMES][UT_NAMESIZE+1]; (void) strncpy( users[nusers], u.ut_name, UT_NAMESIZE ); users[nusers][UT_NAMESIZE] = '\0'; And yes, this will fail if more than 1000 users are logged in at the same time. Imagine how concerned I am. --- Jef Jef Poskanzer jef@well.sf.ca.us {apple, ucbvax, hplabs}!well!jef If ignorance is bliss, why aren't there more happy people?