*BSD News Article 40704


Return to BSD News archive

Xref: sserve comp.unix.bsd:15891 comp.lang.c:90159 comp.unix.sys5.r3:2377
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!news.hawaii.edu!ames!olivea!hookup!news.mathworks.com!uhog.mit.edu!bloom-beacon.mit.edu!newsserver.pixel.kodak.com!elmgate!usenet
From: "W. James Colosky" <wjc@raster.kodak.com>
Newsgroups: comp.unix.bsd,comp.lang.c,comp.unix.sys5.r3
Subject: Re: how to completely get rid of bcopy, bzero, bcmp?
Date: 3 Jan 1995 15:08:08 GMT
Organization: Eastman Kodak Company - DPSC
Lines: 27
Message-ID: <3ebp8o$a4t@elmgate.raster.Kodak.Com>
References: <3bksus$fg4@spruce.cic.net> <mrg.788060915@fulcrum.com.au> <D190Do.16x@druid.com> <mrg.788659869@fulcrum.com.au> <3dtln1$rv8@spruce.cic.net> <3e1787$7f7@elmgate.raster.Kodak.Com>
NNTP-Posting-Host: lightning.raster.kodak.com


> Here's a small perl script I used.
> ------cut here-----
> #!/usr/local/bin/perl
> #                                       -*-perl-*-
> while (<>) {
>         s/bcopy/memcpy/g; 
>         s/bzero(.*),(.*)/memset$1, 0, $2/g; 
>         s/bcmp/memcmp/g; 
> }
> ------cut here-----

I want to appologize for the above script.  Simon J. Gerraty found an
error in it.  So I hope this fix is read before anyone executes it.
I read the man pages again and see as Simon said that memcpy reverses
args 1 and 2.  So here is the correct script.  My appologies.

------cut here-----
#!/usr/local/bin/perl
#                                       -*-perl-*-
while (<>) {
        s/bcopy\((.*),(.*),(.*)/memcpy($2, $1, $3/g
        s/bzero(.*),(.*)/memset$1, 0, $2/g; 
        s/bcmp/memcmp/g; 
}

------cut here-----