Xref: utzoo comp.bugs.4bsd:1302 comp.bugs.sys5:1011 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.bugs.4bsd,comp.bugs.sys5 Subject: Bug in "comm" utility Keywords: UNIX "comm" bug fix Message-ID: <10396@smoke.BRL.MIL> Date: 13 Jun 89 15:53:14 GMT Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 23 As you can see in the excerpt below, the UNIX "comm" utility makes a non-portable assumption about pointer arithmetic in its compare() function. Here is the quick fix I devised for the UNIX System V Release 2.0 source; other versions of "comm" appear to be similar. static char sccsid[] = "@(#)comm.c 1.2"; ... main(argc,argv) char **argv; { int l; char xlb1[LB+1],xlb2[LB+1]; /* DAG: allow for -- in compare() */ #define lb1 (&xlb1[1]) #define lb2 (&xlb2[1]) ... compare(a,b) char *a,*b; { register char *ra,*rb; ra = --a; rb = --b; ...