comparison src/util.c @ 186:7d1f26e7c728 noffle

[svn] Remove case sensitivity in date parse.
author bears
date Sun, 05 Aug 2001 09:27:17 +0100
parents fed1334d766b
children 24d4cd032da5
comparison
equal deleted inserted replaced
185:fed1334d766b 186:7d1f26e7c728
1 /* 1 /*
2 util.c 2 util.c
3 3
4 $Id: util.c 300 2001-08-05 08:24:22Z bears $ 4 $Id: util.c 301 2001-08-05 08:27:17Z bears $
5 */ 5 */
6 6
7 #if HAVE_CONFIG_H 7 #if HAVE_CONFIG_H
8 #include <config.h> 8 #include <config.h>
9 #endif 9 #endif
355 { 355 {
356 if ( strlen( s ) < 4 ) 356 if ( strlen( s ) < 4 )
357 return (time_t) -1; 357 return (time_t) -1;
358 358
359 for ( wday = 0; DOTW[ wday ] != NULL; wday++ ) 359 for ( wday = 0; DOTW[ wday ] != NULL; wday++ )
360 if ( strncmp( DOTW[ wday ], s, 3 ) == 0 ) 360 if ( strncasecmp( DOTW[ wday ], s, 3 ) == 0 )
361 break; 361 break;
362 362
363 if( DOTW[ wday ] == NULL || s[3] != ',' ) 363 if( DOTW[ wday ] == NULL || s[3] != ',' )
364 return (time_t) -1; 364 return (time_t) -1;
365 365
375 /* Look for month name */ 375 /* Look for month name */
376 s = nextNonWhiteSpace( s ); 376 s = nextNonWhiteSpace( s );
377 if ( strlen( s ) < 4 ) 377 if ( strlen( s ) < 4 )
378 return (time_t) -1; 378 return (time_t) -1;
379 for ( tm.tm_mon = 0; MON[ tm.tm_mon ] != NULL; tm.tm_mon++ ) 379 for ( tm.tm_mon = 0; MON[ tm.tm_mon ] != NULL; tm.tm_mon++ )
380 if ( strncmp( MON[ tm.tm_mon ], s, 3 ) == 0 ) 380 if ( strncasecmp( MON[ tm.tm_mon ], s, 3 ) == 0 )
381 break; 381 break;
382 382
383 if ( MON[ tm.tm_mon ] == NULL ) 383 if ( MON[ tm.tm_mon ] == NULL )
384 return (time_t) -1; 384 return (time_t) -1;
385 s += 3; 385 s += 3;
416 416
417 /* GMT/UT or timezone offset */ 417 /* GMT/UT or timezone offset */
418 tzoffset = 0; 418 tzoffset = 0;
419 while ( isspace( *s ) ) 419 while ( isspace( *s ) )
420 s++; 420 s++;
421 if ( strncmp( s, "GMT", 3) == 0 ) 421 if ( strncasecmp( s, "GMT", 3) == 0 )
422 s += 3; 422 s += 3;
423 else if ( strncmp( s, "UT", 2 ) == 0 ) 423 else if ( strncasecmp( s, "UT", 2 ) == 0 )
424 s += 2; 424 s += 2;
425 else 425 else
426 { 426 {
427 offset = (int) strtol( s, &p, 10 ); 427 offset = (int) strtol( s, &p, 10 );
428 s = p; 428 s = p;