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: ‘struct tm’ 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 ‘main’: date.c:85: error: storage size of ‘lt’ isn’t known date.c:163: error: invalid type argument of ‘unary *’ (have ‘int’) date.c:172: warning: incompatible implicit declaration of built-in function ‘strftime’ date.c: In function ‘setthetime’: 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 <rsm...@xs4all.nl> 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= date > > SRCS= date.c netdate.c vary.c > > DPADD= ${LIBUTIL} > > LDADD= -lutil > > > > .include <bsd.prog.mk> > > > > > > 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 <ctype.h> > #include <err.h> > #include <locale.h> > -#include <libutil.h> > +/*#include <libutil.h>*/ > #include <stdio.h> > #include <stdlib.h> > #include <string.h> > @@ -274,12 +274,12 @@ > if (!jflag) { > /* set the time */ > if (nflag || netsettime(tval)) { > - logwtmp("|", "date", ""); > + /*logwtmp("|", "date", "");*/ > tv.tv_sec = tval; > tv.tv_usec = 0; > if (settimeofday(&tv, (struct timezone *)NULL)) > err(1, "settimeofday (timeval)"); > - logwtmp("{", "date", ""); > + /*logwtmp("{", "date", "");*/ > } > > if ((p = getlogin()) == 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/<http://www.xs4all.nl/%7Ersmith/> > [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] > pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725) > _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"