*BSD News Article 40271


Return to BSD News archive

Xref: sserve comp.unix.bsd:15826 comp.lang.c:89547 comp.unix.sys5.r3:2366 comp.unix.programmer:22602
Newsgroups: comp.unix.bsd,comp.lang.c,comp.unix.sys5.r3,comp.unix.programmer
Path: sserve!newshost.anu.edu.au!munnari.oz.au!bruce.cs.monash.edu.au!harbinger.cc.monash.edu.au!msunews!agate!howland.reston.ans.net!swiss.ans.net!fonorola!infoshare!whome!telly!druid!darcy
From: darcy@druid.com (D'Arcy J.M. Cain)
Subject: Re: how to completely get rid of bcopy, bzero, bcmp?
Followup-To: comp.lang.c,comp.unix.programmer
X-Newsreader: TIN [UNIX 1.3 941028BETA PL0]
Lines: 22
Organization: Planix, Inc., Toronto, Ontario, Canada
Message-ID: <D1nzB6.224@druid.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>
Date: Sat, 31 Dec 1994 07:25:54 GMT

W. James Colosky (wjc@raster.kodak.com) wrote:
: Here's a small perl script I used.
: ------cut here-----
: #!/usr/local/bin/perl
: #                                       -*-perl-*-
: while (<>) {
:         s/bcopy/memcpy/g; 

I hope you don't use it in real production code.  If you do you will
get the first two arguments backwards.  I don't know perl but here
is a sed argument that will do what you want:

    s/bcopy[ 	]*(\([^,]*\),*\([^,]*\), *\([^)]*\))/memcpy(\2, \1, \3)/g

[the first square brackets surround a space and a tab]

Note that it deals with the style where the open paren is separated by
white space from the function name.

I have removed comp.unix.bsd and comp.unix.sys5.r3 from the followups
and added comp.unix.programmer as it seems to make more sense.

-- 
D'Arcy J.M. Cain (darcy@druid.com)  |   Democracy is three wolves and a
Planix, Inc., Toronto, Canada       |   sheep voting on what's for dinner.
+1 416 424 2871  (DoD#0082) (eNTP)  |
      -- Info on Planix can be found at http://www.planix.com --