Subject: Re: date feature request
To: George Georgalis <george@galis.org>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: netbsd-users
Date: 11/14/2006 18:12:15
On Tue, 14 Nov 2006 14:31:44 -0500, "George Georgalis" <george@galis.org>
wrote:

> >
> >See /usr/src/gnu/dist/xcvs/lib/getdate.y -- code that I wrote in 1979,
> >though seriously rewritten since then.
> 
> :) yep that seems to have all the important parts in it (actual
> /usr/src/gnu/dist/cvs/lib/getdate.y) but not sure how to use it.
> what is a .y file? is this something that can be included from
> date(1)? is it odd for a lib to have interactive mode? can I use
> it from a shell?
> 
A .y file is input to yacc; you run yacc on it and get a .c file as
output.  That particular file is a subroutine that any C program can call.

If you look at the end, you'll see a sample C main program enclosed in 
#if/#endif.  That itself is close but not quite what you want; it can show
you how to write something you can call fro a script.


		--Steven M. Bellovin, http://www.cs.columbia.edu/~smb