Mercurial > noffle
comparison src/database.c @ 271:3477050e8d10 noffle
[svn] * src/client.c,src/fetch.c,src/lock.c.src/protocol.c,src/util.h,src/util.c:
Define our own SignalHandler type rather than use the rather
Linux-specific (and potentially glibc version specific) sig_t.
* src/client.c,src/database.h,src/database.c,src/over.h,src/over.c,
src/pseudo.c,src/server.c: Ensure format string specifiers and passed
data types match. As part of this, change some uses of size_t as a
general data type to an appropriate base C type. Database status changes
from int to unsigned.
| author | bears |
|---|---|
| date | Sun, 10 Nov 2002 11:32:17 +0000 |
| parents | 087e7039b569 |
| children | 0880d6edaaa5 |
comparison
equal
deleted
inserted
replaced
| 270:d6fedc09b052 | 271:3477050e8d10 |
|---|---|
| 1 /* | 1 /* |
| 2 database.c | 2 database.c |
| 3 | 3 |
| 4 $Id: database.c 389 2002-06-26 13:28:35Z bears $ | 4 $Id: database.c 403 2002-11-10 11:32:17Z 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). |
| 42 | 42 |
| 43 /* Msg Id of presently loaded article, empty if none loaded */ | 43 /* Msg Id of presently loaded article, empty if none loaded */ |
| 44 Str msgId; | 44 Str msgId; |
| 45 | 45 |
| 46 /* Status of loaded article */ | 46 /* Status of loaded article */ |
| 47 int status; /* Flags */ | 47 unsigned status; /* Flags */ |
| 48 time_t lastAccess; | 48 time_t lastAccess; |
| 49 | 49 |
| 50 /* Overview of loaded article */ | 50 /* Overview of loaded article */ |
| 51 Str subj; | 51 Str subj; |
| 52 Str from; | 52 Str from; |
| 315 | 315 |
| 316 return saveArt(); | 316 return saveArt(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 void | 319 void |
| 320 Db_setStatus( const char *msgId, int status ) | 320 Db_setStatus( const char *msgId, unsigned status ) |
| 321 { | 321 { |
| 322 if ( loadArt( msgId ) ) | 322 if ( loadArt( msgId ) ) |
| 323 { | 323 { |
| 324 db.status = status; | 324 db.status = status; |
| 325 saveArt(); | 325 saveArt(); |
| 416 Db_header( const char *msgId ) | 416 Db_header( const char *msgId ) |
| 417 { | 417 { |
| 418 static DynStr *s = NULL; | 418 static DynStr *s = NULL; |
| 419 | 419 |
| 420 Str date, t; | 420 Str date, t; |
| 421 int status; | 421 unsigned status; |
| 422 const char *p; | 422 const char *p; |
| 423 | 423 |
| 424 if ( s == NULL ) | 424 if ( s == NULL ) |
| 425 s = new_DynStr( 5000 ); | 425 s = new_DynStr( 5000 ); |
| 426 else | 426 else |
| 471 if ( ! p ) | 471 if ( ! p ) |
| 472 return ""; | 472 return ""; |
| 473 return ( p + 2 ); | 473 return ( p + 2 ); |
| 474 } | 474 } |
| 475 | 475 |
| 476 int | 476 unsigned |
| 477 Db_status( const char *msgId ) | 477 Db_status( const char *msgId ) |
| 478 { | 478 { |
| 479 if ( ! loadArt( msgId ) ) | 479 if ( ! loadArt( msgId ) ) |
| 480 return 0; | 480 return 0; |
| 481 return db.status; | 481 return db.status; |
