From owner-freebsd-hackers@FreeBSD.ORG Sat Mar 31 18:53:40 2007 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2FD6816A401 for ; Sat, 31 Mar 2007 18:53:40 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 856BE13C483 for ; Sat, 31 Mar 2007 18:53:39 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (dialup85.ach.sch.gr [81.186.70.85]) (authenticated bits=128) by igloo.linux.gr (8.13.8/8.13.8/Debian-3) with ESMTP id l2VIgBWe016118 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 31 Mar 2007 21:42:25 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.13.8/8.13.8) with ESMTP id l2VH7s2K003122; Sat, 31 Mar 2007 20:08:39 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.13.8/8.13.8/Submit) id l2VH7dEQ003121; Sat, 31 Mar 2007 20:07:39 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Sat, 31 Mar 2007 20:07:39 +0300 From: Giorgos Keramidas To: Yar Tikhiy Message-ID: <20070331170738.GB2687@kobe.laptop> References: <20070326135106.GG60831@comp.chem.msu.su> <460B76A0.5030200@aueb.gr> <20070330172133.GD98431@comp.chem.msu.su> <20070331110221.GI98431@comp.chem.msu.su> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070331110221.GI98431@comp.chem.msu.su> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.68, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.52, BAYES_00 -2.60, DNS_FROM_RFC_ABUSE 0.20) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: hackers@freebsd.org Subject: Re: sed -i X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Mar 2007 18:53:40 -0000 On 2007-03-31 15:02, Yar Tikhiy wrote: >On Fri, Mar 30, 2007 at 09:21:33PM +0400, Yar Tikhiy wrote: >[...] >> If we've started to delete the pattern space, we should print the >> text in place of it because `c' is for `change'. BSD and GNU seds >> have this bug, but Solaris sed doesn't have it. >[...] > > By the way, I found myself w/o a Solaris account, but I was able > to build Solaris sed in FreeBSD quickly from the OpenSolaris sources. > All it took was downloading the following files: > > http://cvs.opensolaris.org/source/raw/onnv/onnv-gate/usr/src/ucbcmd/sed/sed.h > http://cvs.opensolaris.org/source/raw/onnv/onnv-gate/usr/src/ucbcmd/sed/sed0.c > http://cvs.opensolaris.org/source/raw/onnv/onnv-gate/usr/src/ucbcmd/sed/sed1.c > http://cvs.opensolaris.org/source/raw/onnv/onnv-gate/usr/src/ucbhead/regexp.h > > and issuing this command: > > cc -I. -o sed sed*.c > > Voila! (Their regexp.h offers definitions of its functions, not > just their prototypes, which made my task very easy.) > > Perhaps other basic tools from Solaris could be built in this way > for the purpose of testing, too, in case one needs them but has no > Solaris account at hand. Nice. With very minor modifications, it may be possible to build more of the OpenSolaris tools on FreeBSD. For instance, the only change I had to make to build the Solaris version of cat(1) on FreeBSD was: %%% --- cat.c.orig Sat Mar 31 20:03:26 2007 +++ cat.c Sat Mar 31 20:02:07 2007 @@ -43,7 +43,9 @@ #include #include +#ifdef __FreeBSD_version #include +#endif #include #include #include %%% The Solaris version of cat(1) calls textdomain() and gettext() explicitly, so I also had to use libintl.so from the Ports to compile it successfully: $ cc -I/usr/local/include cat.c -L/usr/local/lib -lintl But it does work, AFAICT. I haven't tried localized message support yet, but this will take a bit more effort :-)