delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/18/05:26:07

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
Message-Id: <200202181025.LAA19208@cabs40.col.bsf.alcatel.fr>
Date: Mon, 18 Feb 2002 11:25:09 +0100 (MET)
From: Jorge Goncalvez <goncal11 AT col DOT bsf DOT alcatel DOT fr>
Reply-To: Jorge Goncalvez <goncal11 AT col DOT bsf DOT alcatel DOT fr>
Subject: Re:Sprintf issue
To: cygwin AT cygwin DOT com
MIME-Version: 1.0
X-Mailer: dtmail 1.3.0 @(#)CDE Version 1.4.2 SunOS 5.8 sun4u sparc

Hi, i tried to modified a C program running on linux and make it running on 
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);
}

and the original was:

 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);
}

but my second %s was with the following format XX:XX:XX:XX:XX:XX and i would 
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`

Could i do it in pure C?Thanks for your precious help.


--
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/

- Raw text -


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