*BSD News Article 40893


Return to BSD News archive

Xref: sserve comp.unix.bsd:15905 comp.lang.c:90361 comp.unix.sys5.r3:2382
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yarrina.connect.com.au!fulcrum.com.au!fulcrum.com.au!mrg
From: mrg@fulcrum.com.au (matthew green)
Newsgroups: comp.unix.bsd,comp.lang.c,comp.unix.sys5.r3
Subject: Re: how to completely get rid of bcopy, bzero, bcmp?
Date: 15 Jan 95 23:54:58 GMT
Organization: The Fulcrum Consulting Group
Lines: 26
Distribution: inet
Message-ID: <mrg.790214098@fulcrum.com.au>
References: <3bksus$fg4@spruce.cic.net> <3dtln1$rv8@spruce.cic.net> <3e1787$7f7@elmgate.raster.Kodak.Com> <3ebp8o$a4t@elmgate.raster.kodak.com> <id.X38G1.148@nmti.com>
NNTP-Posting-Host: wyvern.fulcrum.com.au
X-Newsreader: NN version 6.5.0 (NOV)

peter@nmti.com (Peter da Silva) writes:

   Ideally you should use M4, if you have it. M4 was designed for just this
   sort of task:
   
   m4 -D'bcopy=memcpy($2,$1,$3)' \
      -D'bzero=memset($1,0,$2)' \
      -D'bcmp=memcmp($1,$2,$3)' file.bsd > file.posix

except that you can't blindly replace bcopy() with memcpy().  nor does
this handle m4 reserved words very well.

but if you solve those problems, m4 is probably the `best' solution,
as it becomes a painful experience to try to match parens correctly
in other languages (such as perl).

that said, i still prefer the solution i posted at the start of this
thread.

.mrg.

-- 
matthew green      consultant    /\    the fulcrum consulting group
mrg@fulcrum.com.au                     12/10-16 queen st
voice: +61 3 621 2100                  melbourne vic 3000
  fax: +61 3 621 2724                  australia                 /\