Article View: comp.bugs.4bsd
Article #240Re: Bug in users command
From: Jef Poskanzer
Date: Thu, 24 Jan 1991 02:37
Date: Thu, 24 Jan 1991 02:37
19 lines
1187 bytes
1187 bytes
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?
Technical Details
Message-ID:
<22855@well.sf.ca.us>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!well!jefReferences:
<12360:Jan2320:15:5291@kramden.acf.nyu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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 <jef@well.sf.ca.us> Organization: Paratheo-Anametamystikhood Of Eris Esoteric, Ada Lovelace Cabal Lines: 19