[news.software.b] Short message IDs for C News

chip@ateng.com (Chip Salzenberg) (11/21/89)

According to henry@utzoo.uucp (Henry Spencer):
>It's not a question of wanting the date in the message-id; it's a question
>of wanting a decentralized message-id-generation algorithm that doesn't
>need exclusive (i.e. with a locking protocol) access to a central file.

If you want a shorter version of the date, just apply the patch below.
It generates IDs like <aaaaaaaa.bbbbb@host>, where "a" is the time in hex
and "b" is the pid.

I'd prefer a message ID of <aaaaaabbb@host>, where "a" is the time in base
62 and "b" is the pid in base 62.  Unfortunately, that will require a new C
program, since dc's output format for bases higher than 16 loses compactness.
(Try it.)

Here's the patch.  Shar and enjoy.

*** anne.jones.P	Tue Jun 13 12:37:47 1989
--- anne.jones	Tue Nov 21 10:38:43 1989
***************
*** 101,104 ****
--- 101,106 ----
  	esac
  `"				# for defdate, defmsgid
+ # date in hex to make it shorter
+ gdat=`(echo 16o; getdate now; echo p) | dc`
  case "$ORGANIZATION" in
  "")	deforg="`sed 1q $NEWSCTL/organi[sz]ation`" ;;	# look in a file
***************
*** 118,120 ****
  deffrom="$FROM" deforg="$deforg" \
  defdate="` set $date; echo $1, $3 $2 \` echo $6 | sed 's/^..//' \` $4 $5`" \
! defmsgid="`set $date; echo \<$6$2$3.\`  echo $4 | tr -d : \`.$$@$host\>`" -
--- 120,122 ----
  deffrom="$FROM" deforg="$deforg" \
  defdate="` set $date; echo $1, $3 $2 \` echo $6 | sed 's/^..//' \` $4 $5`" \
! defmsgid="`echo \<$gdat.$$@$host\>`" -
-- 
You may redistribute this article only to those who may freely do likewise.
Chip Salzenberg at A T Engineering;  <chip@ateng.com> or <uunet!ateng!chip>
    "Did I ever tell you the Jim Gladding story about the binoculars?"