Mercurial > noffle
comparison src/database.c @ 300:994e9ab2c24f noffle
[svn] * src/database.c: Accept articles with no body, substituting a body of a
single empty line. Also cast a scanf parameter to remove warning.
author | bears |
---|---|
date | Thu, 13 Feb 2003 10:04:01 +0000 |
parents | baa6408d1bbc |
children | a04c52f87b6e |
comparison
equal
deleted
inserted
replaced
299:94ac4c72baf7 | 300:994e9ab2c24f |
---|---|
1 /* | 1 /* |
2 database.c | 2 database.c |
3 | 3 |
4 $Id: database.c 414 2003-01-06 18:16:18Z bears $ | 4 $Id: database.c 433 2003-02-13 10:04:01Z bears $ |
5 | 5 |
6 Uses GNU gdbm library. Using Berkeley db (included in libc6) was | 6 Uses GNU gdbm library. Using Berkeley db (included in libc6) was |
7 cumbersome. It is based on Berkeley db 1.85, which has severe bugs | 7 cumbersome. It is based on Berkeley db 1.85, which has severe bugs |
8 (e.g. it is not recommended to delete or overwrite entries with | 8 (e.g. it is not recommended to delete or overwrite entries with |
9 overflow pages). | 9 overflow pages). |
144 { | 144 { |
145 Log_err( "Entry in database '%s' is corrupt (status)", msgId ); | 145 Log_err( "Entry in database '%s' is corrupt (status)", msgId ); |
146 return FALSE; | 146 return FALSE; |
147 } | 147 } |
148 p = Utl_getLn( t, p ); | 148 p = Utl_getLn( t, p ); |
149 if ( ! p || sscanf( t, "%lu", &db.lastAccess ) != 1 ) | 149 if ( ! p || sscanf( t, "%lu", (unsigned long *)&db.lastAccess ) != 1 ) |
150 { | 150 { |
151 Log_err( "Entry in database '%s' is corrupt (lastAccess)", msgId ); | 151 Log_err( "Entry in database '%s' is corrupt (lastAccess)", msgId ); |
152 return FALSE; | 152 return FALSE; |
153 } | 153 } |
154 p = Utl_getHeaderLn( db.subj, p ); | 154 p = Utl_getHeaderLn( db.subj, p ); |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 if ( artTxt == NULL ) | 307 if ( artTxt == NULL ) |
308 { | 308 { |
309 Log_err( "Article %s malformed: missing body", msgId ); | 309 /* |
310 return FALSE; | 310 * This article has no body. Bereft of text it lies... |
311 * | |
312 * I'm not completely sure how surprising the rest of | |
313 * Noffle would find a body-less article, so substitute | |
314 * an empty line. | |
315 */ | |
316 Log_inf( "Article %s malformed: missing body", msgId ); | |
317 artTxt = "\n"; | |
311 } | 318 } |
312 | 319 |
313 /* Read body */ | 320 /* Read body */ |
314 while ( ( artTxt = Utl_getLn( line, artTxt ) ) != NULL ) | 321 while ( ( artTxt = Utl_getLn( line, artTxt ) ) != NULL ) |
315 if ( ! ( db.status & DB_NOT_DOWNLOADED ) ) | 322 if ( ! ( db.status & DB_NOT_DOWNLOADED ) ) |