Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: KRISTOF DOT DOFFING AT lhsystems DOT com Message-ID: <4FBF09C6D88BD011A5B74000611400100669ADEB@XNT-FRABASE-2> To: cygwin AT cygwin DOT com Subject: AW: Re[2]: Sprintf issue Date: Mon, 18 Feb 2002 15:22:27 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g1IER8s28599 Hello Jorge. To answer the second part of your question: char buffer[1024]; strcpy(buffer,print_hw_addr (lease -> hardware_addr.htype, lease -> hardware_addr.hlen, lease -> hardware_addr.haddr)); char * pos = buffer; while (*pos != '\0') { if (*pos == ':') *pos = '-'; pos++; } // and so on.... Using sed in this case is like shooting with cruise missiles on talibans.... Kristof Doffing Lufthansa Systems Airline Services GmbH, FRA AS/N FAC, Hugo-Eckener-Ring A.8.02 60549 Frankfurt/Main Tel.: +49 69 / 696 92630 Fax : +49 69 / 696 92062 -----Ursprüngliche Nachricht----- Von: Pavel Tsekov [mailto:ptsekov AT syntrex DOT com] Gesendet am: Montag, 18. Februar 2002 15:09 An: Jorge Goncalvez Cc: cygwin AT cygwin DOT com Betreff: Re[2]: Sprintf issue Hello Jorge, Please, can you check the return value of the system () call ? Also are you trying to run the compiled program from the cygwin shell or from the windows command prompt ? Output of cygcheck -r -s -v would be vuseful too. This is a problem which was brought to the mailing list some time ago though solution was not found then. Monday, February 18, 2002, 11:25:09 AM, you wrote: JG> Hi, i tried to modified a C program running on linux and make it running on JG> windows with gcc for cygwin: JG> like this: JG> sprintf(arpbuf, "arp -s %s `echo %s | sed -e s/:/-/g`" JG> piaddr (lease -> ip_addr), JG> print_hw_addr (lease -> hardware_addr.htype, JG> lease -> hardware_addr.hlen, JG> lease -> hardware_addr.haddr)); JG> note(arpbuf); JG> system(arpbuf); JG> } JG> and the original was: JG> sprintf(arpbuf, "arp -s %s %s ", JG> piaddr (lease -> ip_addr), JG> print_hw_addr (lease -> hardware_addr.htype, JG> lease -> hardware_addr.hlen, JG> lease -> hardware_addr.haddr)); JG> note(arpbuf); JG> system(arpbuf); JG> } JG> but my second %s was with the following format XX:XX:XX:XX:XX:XX and i would JG> replace it by XX-XX-XX-XX-XX-XX. JG> I tried sed but it didn't work.Why? it seem not to be interpreted I have : JG> arp -s 192.40.54.42 `echo 00:80:9f:2e:3f:5e | sed -e s/:/-/g` JG> 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/ -- 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/