James Youngman | 1 Nov 2004 01:09
Picon
Gravatar

extending getdate.y by calling it differently?

Hello,

I'm looking at an idea of supporting absolute date range specification
in findutils which are analogous with the relative times supported by
tests like -atime.  

One way to make this work would be to have a rigidly-defined grammar
for how those timestamps are represented.  However, that feels a lot
like reinventing a wheel.  An alternative would be to make use of
getdate like this:

find / -modifiedafter   "tomorrow 11:32" 
find . -modifiedbetween "January 12 1985 and two hours ago" 

In the second example above I would hope to be able to parse two dates
separated by "and".  To make this possible the ideal thing would be if
get_date() had a variant which would return the number of characters
of the input string consumed, in a way perhaps similar to strtoul().  

Is this practical, or will it be very hard to get get_date() to do
anything other than consume all its input?

Regards,
James.
Bruno Haible | 1 Nov 2004 13:10

Re: Micropatch for config.rpath

James Youngman wrote:
> 2004-10-30  James Youngman <jay <at> gnu.org>
>
> 	* config.rpath: Modify comment to be consistent with the code.

Thanks, applied.

Bruno
Derek Robert Price | 1 Nov 2004 19:29
Favicon

Minor patch to silence gcc -Wall warnings from getdate.y


'nuff said.

ChangeLog:

    Silence warnings from `gcc -Wall'.
    * getdate.y: Include <stdio.h>.
    (get_date): Add parens to "ambiguous" bit-or.

Cheers,

Derek

--
                *8^)

Email: derek <at> ximbiot.com

Get CVS support at <http://ximbiot.com>!
Bruno Haible | 1 Nov 2004 20:22

Re: bug in dummy.c

Simon Josefsson wrote:
> It seems dummy.c doesn't work.  On Solaris 2.9 with GCC 3.3.2 and the
> /usr/ccs/bin/ld from
>
> ld: Software Generation Utilities - Solaris Link Editors: 5.9-1.373
>
> I get this error:
>
> ld: fatal: file ../gl/.libs/libgl.a: unknown file type
> ld: fatal: File processing errors. No output written to .libs/libgsasl.so.7.0.0

How did you create this libgl.a? On a Solaris 2.9 machine with GCC 3.3.1
I get this:

$ cat > dummy.c
typedef int dummy;
$ gcc -c dummy.c
$ ar cru empty.a dummy.o
$ nm empty.a 

empty.a[dummy.o]:

[Index]   Value      Size    Type  Bind  Other Shndx   Name

[2]     |         0|       0|SECT |LOCL |0    |2      |
[1]     |         0|       0|FILE |LOCL |0    |ABS    |dummy.c
$ cat > hello.c
#include <stdio.h>
int main () { printf("Halloechen Welt\n"); return 0; }
$ gcc hello.c empty.a
(Continue reading)

Paul Eggert | 1 Nov 2004 21:59
Favicon

Re: getpass.c and use of putc_unlocked

Simon Josefsson <jas <at> extundo.com> writes:

> I know it is a horrible solution, but it seem to fit nicely with the
> rest of the file...

How about the following (untested) solution instead?  It's slightly
less horrible.

2004-11-01  Paul Eggert  <eggert <at> cs.ucla.edu>

	* lib/getpass.c (fflush_unlocked, flockfile, funlockfile, funlockfile,
	fputs_unlocked, putc_unlocked): Don't define if already declared.
	* m4/getpass.m4 (gl_PREREQ_GETPASS): Check for declarations of the
	above functions.

--- m4/getpass.m4	2004-08-09 16:54:10 -0700
+++ /tmp/getpass.m4	2004-11-01 12:57:46 -0800
 <at>  <at>  -1,5 +1,5  <at>  <at> 
-# getpass.m4 serial 4
-dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
+# getpass.m4 serial 5
+dnl Copyright (C) 2002-2004 Free Software Foundation, Inc.
 dnl This file is free software, distributed under the terms of the GNU
 dnl General Public License.  As a special exception to the GNU General
 dnl Public License, this file may be distributed as part of a program
 <at>  <at>  -34,5 +34,6  <at>  <at>  AC_DEFUN([gl_FUNC_GETPASS_GNU],
 # Prerequisites of lib/getpass.c.
 AC_DEFUN([gl_PREREQ_GETPASS], [
   AC_CHECK_HEADERS_ONCE(stdio_ext.h)
+  AC_CHECK_DECLS_ONCE([fflush flockfile fputs_unlocked funlockfile putc_unlocked])
(Continue reading)

Paul Eggert | 1 Nov 2004 22:06
Favicon

Re: extending getdate.y by calling it differently?

It doesn't sound trivial to modify getdate.y to stop on parse or lex error.
How about if you break the string yourself, and call get_date on each piece?
Paul Eggert | 1 Nov 2004 22:07
Favicon

Re: Minor patch to silence gcc -Wall warnings from getdate.y

Derek Robert Price <derek <at> ximbiot.com> writes:

>     Silence warnings from `gcc -Wall'.

Sorry, but no patch was attached.

Also, what warnings are suppressed by the patch (compiler version,
warning wording, etc.)?
Derek Robert Price | 1 Nov 2004 22:29
Favicon

Re: Minor patch to silence gcc -Wall warnings from getdate.y

Paul Eggert wrote:

>Derek Robert Price <derek <at> ximbiot.com> writes:
>
>  
>
>>    Silence warnings from `gcc -Wall'.
>>    
>>
>
>Sorry, but no patch was attached.
>  
>

Whoops.  Attached now.

>Also, what warnings are suppressed by the patch (compiler version,
>warning wording, etc.)?
>  
>

getdate.y: In function `get_date':
getdate.y:1262: warning: implicit declaration of function `sprintf'
getdate.y:1311: warning: suggest parentheses around arithmetic in
operand of |
getdate.y:1311: warning: suggest parentheses around arithmetic in
operand of |

Thanks,

(Continue reading)

Simon Josefsson | 1 Nov 2004 22:46

Re: getpass.c and use of putc_unlocked

Paul Eggert <eggert <at> CS.UCLA.EDU> writes:

> Simon Josefsson <jas <at> extundo.com> writes:
>
>> I know it is a horrible solution, but it seem to fit nicely with the
>> rest of the file...
>
> How about the following (untested) solution instead?  It's slightly
> less horrible.

It needed a simple fix, but I have now tested the patch successfully.
I installed it.

Thanks.
Mark D. Baushke | 2 Nov 2004 01:42
X-Face

getdate.y problem - 'void unsetenv(); ' vs 'int unsetenv(); '


On NetBSD, and FreeBSD and Redhat 7.3 GNU/Linux,

The unsetenv() function is a void function:

% grep unsetenv /usr/include/*.h
/usr/include/stdlib.h:void       unsetenv __P((const char *));
% uname -a
NetBSD ran 1.6.2 NetBSD 1.6.2 (GENERIC) #0: Tue Feb 10 21:53:10 UTC 2004    
autobuild <at> tgm.netbsd.org:/autobuild/netbsd-1-6-PATCH002/i386/OBJ/autobuild/netbsd-1-6-PATCH002/src/sys/arch/i386/compile/GENERIC i386
%

So, getdate.y line 1360 has problems:
    ok &= (tz0 ? setenv ("TZ", tz0, 1) : unsetenv ("TZ")) == 0; 

I suggest it is desirable to change getdate.y

    ok &= (tz0 ? setenv ("TZ", tz0, 1) : unsetenv ("TZ"),0) == 0; 

	-- Mark

Example error output taken from ccvs top-of-tree that is using GNULIB
top-of-tree getdate.y :

mkdir obj.netbsd && cd  obj.netbsd
../configure && gmake check
...
source='../../lib/getdate.c' object='getdate.o' libtool=no \
DEPDIR=.deps depmode=gcc /bin/bash ../../depcomp \
gcc -DHAVE_CONFIG_H -I. -I../../lib -I..   -Ino/include  -g -O2 -c ../../lib/getdate.c
(Continue reading)


Gmane