From owner-freebsd-questions@FreeBSD.ORG Fri May 22 00:08:33 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D3C11065675 for ; Fri, 22 May 2009 00:08:33 +0000 (UTC) (envelope-from fkeymo@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.30]) by mx1.freebsd.org (Postfix) with ESMTP id F001C8FC1A for ; Fri, 22 May 2009 00:08:32 +0000 (UTC) (envelope-from fkeymo@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so870122ywe.13 for ; Thu, 21 May 2009 17:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=CdsB9tXBQdpd9fhwm9awxKSGhZIpDrhV/F1lwm+B4o8=; b=Yrsr3RzSevaYdW66lpf2kcjjKm5WVtcnWbt68zDqESdbspW7ejlOxnvnBMzGJQ/I2H JFeDab0oEoInNGUM/HbG10n91lEYQCNxuY4DOvF71/YyjFteRGy+UaGXotgri9OF4SDY pk5zB9KKzwf5ewyYMF3l7PVFiabTvwJvP1+B4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=lfqQ0FhOiUBH56kYwVBYjMfN+hQ4E6kDMRsZBJjFZobpVMd8w3kXmFS/CtNtP3GR0g bXGuPuvukgBZ040ge5qh0j8wX2FUFZbZPnVuBcWcIijODekgX9ztXmvvb/pCwPF435Xv WrFNzdWs5x8iYEUhdmlOcPg4G78C+qxPQxV4M= MIME-Version: 1.0 Received: by 10.100.107.17 with SMTP id f17mr6223894anc.82.1242950911750; Thu, 21 May 2009 17:08:31 -0700 (PDT) In-Reply-To: <20090520192011.GA97805@slackbox.xs4all.nl> References: <20090520000137.3d46fcb2.freebsd@edvax.de> <4A135119.8010007@telenix.org> <20090520192011.GA97805@slackbox.xs4all.nl> Date: Thu, 21 May 2009 21:08:31 -0300 Message-ID: From: francis keyes To: Roland Smith Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Polytropon , Chuck Robey , freebsd-questions@freebsd.org Subject: Re: compiling FreeBSD date on Linux X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 May 2009 00:08:33 -0000 I patched date.c and tried to compile but I get a few errors, as you suspected: In file included from date.c:59: vary.h:35: warning: =91struct tm=92 declared inside parameter list vary.h:35: warning: its scope is only this definition or declaration, which is probably not what you want date.c: In function =91main=92: date.c:85: error: storage size of =91lt=92 isn=92t known date.c:163: error: invalid type argument of =91unary *=92 (have =91int=92) date.c:172: warning: incompatible implicit declaration of built-in function =91strftime=92 date.c: In function =91setthetime=92: date.c:190: warning: assignment makes pointer from integer without a cast date.c:191: warning: assignment makes pointer from integer without a cast date.c:211: warning: assignment makes pointer from integer without a cast date.c:217: error: dereferencing pointer to incomplete type date.c:218: error: dereferencing pointer to incomplete type date.c:221: error: dereferencing pointer to incomplete type date.c:227: error: dereferencing pointer to incomplete type date.c:232: error: dereferencing pointer to incomplete type date.c:234: error: dereferencing pointer to incomplete type date.c:235: error: dereferencing pointer to incomplete type date.c:236: error: dereferencing pointer to incomplete type date.c:238: error: dereferencing pointer to incomplete type date.c:242: error: dereferencing pointer to incomplete type date.c:243: error: dereferencing pointer to incomplete type date.c:245: error: dereferencing pointer to incomplete type date.c:248: error: dereferencing pointer to incomplete type date.c:249: error: dereferencing pointer to incomplete type date.c:253: error: dereferencing pointer to incomplete type date.c:254: error: dereferencing pointer to incomplete type date.c:258: error: dereferencing pointer to incomplete type date.c:259: error: dereferencing pointer to incomplete type date.c:268: error: dereferencing pointer to incomplete type On Wed, May 20, 2009 at 4:20 PM, Roland Smith wrote: > On Wed, May 20, 2009 at 02:45:59PM -0300, francis keyes wrote: > > Hmm... the date program looks pretty simple but I don't understand the > > Makfile: > > > > # @(#)Makefile 8.1 (Berkeley) 5/31/93 > > # $FreeBSD: src/bin/date/Makefile,v 1.11.30.1 2009/04/15 03:14:26 > kensmith > > Exp $ > > > > PROG=3D date > > SRCS=3D date.c netdate.c vary.c > > DPADD=3D ${LIBUTIL} > > LDADD=3D -lutil > > > > .include > > > > > > Would it be possible to compile this without a makefile? > > Sure. A command like "gcc -o date date.c netdate.c vary.c" works, > provided you patch date.c to remove the dependency on libutil (logwtmp > function). This will stop date from logging to wtmp(5). > > ----- patch for date.c ----- > --- date.c.orig 2009-05-04 22:09:01.000000000 +0200 > +++ date.c 2009-05-20 21:05:32.000000000 +0200 > @@ -48,7 +48,7 @@ > #include > #include > #include > -#include > +/*#include */ > #include > #include > #include > @@ -274,12 +274,12 @@ > if (!jflag) { > /* set the time */ > if (nflag || netsettime(tval)) { > - logwtmp("|", "date", ""); > + /*logwtmp("|", "date", "");*/ > tv.tv_sec =3D tval; > tv.tv_usec =3D 0; > if (settimeofday(&tv, (struct timezone *)NULL)) > err(1, "settimeofday (timeval)"); > - logwtmp("{", "date", ""); > + /*logwtmp("{", "date", "");*/ > } > > if ((p =3D getlogin()) =3D=3D NULL) > ----- patch for date.c ----- > > With this patch, the executable only depends on libc. > > Note that I have only confirmed that it compiles _on FreeBSD_. There > might be additional differences between FreeBSD libc and the GNU libc > that is used on Linux that make further tinkering with the source > necessary. > > Roland > -- > R.F.Smith http://www.xs4all.nl/~rsmith/= > [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] > pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725) >