Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!visix!news From: amanda@visix.com (Amanda Walker) Newsgroups: news.software.b Subject: Re: C News milestone Message-ID: Date: 11 Dec 90 04:07:50 GMT References: <4_377B@xds13.ferranti.com> <1990Nov27.230750.3478@looking.on.ca> <1990Dec7.114243.12454@warwick.ac.uk> Sender: news@visix.com Reply-To: amanda@visix.com (Amanda Walker) Organization: Visix Software Inc., Reston, VA Lines: 44 Here's what I use to generate C News message IDs: -------- #include #include char charset[] = "abcdefghijklmnopqrstuvwxyz012345"; /* 32 "digits" */ main() { unsigned long t; unsigned short p; time(&t); p = getpid(); printf("%c%c%c%c%c%c%c%c%c%c", charset[(t >> 25) & 31], charset[(t >> 20) & 31], charset[(t >> 15) & 31], charset[(t >> 10) & 31], charset[(t >> 5) & 31], charset[t & 31], charset[(p >> 10) & 31], charset[(p >> 5) & 31], charset[p & 31], charset[((t >> 30) & 3) + ((p >> 13) & 4)]); /* extra bits */ } -------- It assumes that the time is 32 bits, and that the PID is 16, but changing it to cope with other sizes is trivial. It's not quite a minimum number of characters, but 10 characters seems close enough for Usenet, and they're nice well-behaved alphanumeric strings. Amanda Walker Visix Software Inc. -- "I have never seen anything fill up a vacuum so fast and still suck." --Rob Pike commenting on the X Window System