delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/18/08:50:44

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Subject: Re: Re:Sprintf issue
From: David Means <dmeans AT the-means DOT net>
To: cygwin AT cygwin DOT com
In-Reply-To: <200202181025.LAA19208@cabs40.col.bsf.alcatel.fr>
References: <200202181025 DOT LAA19208 AT cabs40 DOT col DOT bsf DOT alcatel DOT fr>
X-Mailer: Evolution/1.0.2
Date: 18 Feb 2002 08:49:08 -0500
Message-Id: <1014040149.1038.47.camel@milo>
Mime-Version: 1.0

--=-M5rHgZ18Suh2GnPrh8ed
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

This sounds more like a sed problem than an sprintf problem.

First, can you get the sed command to work at the cygwin prompt?  If
not, it's quite possible that the environment from which your running
the program does not have sed in its' path.

You should also try this:=20

`echo "yada" | sed 's/:/-/g'`

The best solution would be to convert the ':' chars to '-' chars in your
C program.

David




On Mon, 2002-02-18 at 05:25, Jorge Goncalvez wrote:
> Hi, i tried to modified a C program running on linux and make it running =
on=20
> windows with gcc for cygwin:
> like this:
>  sprintf(arpbuf, "arp -s %s `echo %s | sed -e s/:/-/g`"
>          piaddr (lease -> ip_addr),
>          print_hw_addr (lease -> hardware_addr.htype,
>                         lease -> hardware_addr.hlen,
>                         lease -> hardware_addr.haddr));
>  note(arpbuf);
>  system(arpbuf);
> }
>=20
> and the original was:
>=20
>  sprintf(arpbuf, "arp -s %s  %s ",
>          piaddr (lease -> ip_addr),
>          print_hw_addr (lease -> hardware_addr.htype,
>                         lease -> hardware_addr.hlen,
>                         lease -> hardware_addr.haddr));
>  note(arpbuf);
>  system(arpbuf);
> }
>=20
> but my second %s was with the following format XX:XX:XX:XX:XX:XX and i wo=
uld=20
> replace it by XX-XX-XX-XX-XX-XX.
> I tried sed but it didn't work.Why? it seem not to be interpreted I have =
:
> arp -s 192.40.54.42 `echo 00:80:9f:2e:3f:5e | sed -e s/:/-/g`
>=20
> Could i do it in pure C?Thanks for your precious help.
>=20
>=20
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting:         http://cygwin.com/bugs.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/
--=20

No trees were killed in the sending of this message. However,
a large number of electrons were terribly inconvenienced.

--=-M5rHgZ18Suh2GnPrh8ed
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEABECAAYFAjxxBlQACgkQUd0KwqAz4aoW8gCcCM2QpJsJXuXwPdzWg4ctkMTV
8HMAnjvXIlKk9xmBQAF3UhcECCnJ83R0
=f+ck
-----END PGP SIGNATURE-----

--=-M5rHgZ18Suh2GnPrh8ed--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019