Mercurial > noffle
diff src/database.c @ 61:adf0af5152f7 noffle
[svn] Renamed some variables and function names, because they caused compiler
warnings because of shadowing global variables from system include files
(index, stat, serv).
author | enz |
---|---|
date | Fri, 12 May 2000 18:19:38 +0100 |
parents | 125d79c9e586 |
children | be450ac830b2 |
line wrap: on
line diff
--- a/src/database.c Fri May 12 17:52:58 2000 +0100 +++ b/src/database.c Fri May 12 18:19:38 2000 +0100 @@ -1,7 +1,7 @@ /* database.c - $Id: database.c 60 2000-05-09 22:28:38Z uh1763 $ + $Id: database.c 67 2000-05-12 17:19:38Z enz $ Uses GNU gdbm library. Using Berkeley db (included in libc6) was cumbersome. It is based on Berkeley db 1.85, which has severe bugs @@ -41,7 +41,7 @@ Str msgId; /* Status of loaded article */ - int stat; /* Flags */ + int status; /* Flags */ time_t lastAccess; /* Overview of loaded article */ @@ -135,7 +135,7 @@ Utl_cpyStr( db.msgId, msgId ); p = Utl_getLn( t, (char *)dptr ); - if ( ! p || sscanf( t, "%x", &db.stat ) != 1 ) + if ( ! p || sscanf( t, "%x", &db.status ) != 1 ) { Log_err( "Entry in database '%s' is corrupt (status)", msgId ); return FALSE; @@ -183,7 +183,7 @@ if ( strcmp( db.msgId, "" ) == 0 ) return FALSE; s = new_DynStr( 5000 ); - snprintf( t, MAXCHAR, "%x", db.stat ); + snprintf( t, MAXCHAR, "%x", db.status ); DynStr_appLn( s, t ); snprintf( t, MAXCHAR, "%lu", db.lastAccess ); DynStr_appLn( s, t ); @@ -226,7 +226,7 @@ if ( Db_contains( msgId ) ) Log_err( "Preparing article twice: %s", msgId ); - db.stat = DB_NOT_DOWNLOADED; + db.status = DB_NOT_DOWNLOADED; db.lastAccess = time( NULL ); Utl_cpyStr( db.msgId, msgId ); @@ -257,13 +257,13 @@ Log_err( "Cannot find info about '%s' in database", msgId ); return FALSE; } - if ( ! ( db.stat & DB_NOT_DOWNLOADED ) ) + if ( ! ( db.status & DB_NOT_DOWNLOADED ) ) { Log_err( "Trying to store already retrieved article '%s'", msgId ); return FALSE; } - db.stat &= ~DB_NOT_DOWNLOADED; - db.stat &= ~DB_RETRIEVING_FAILED; + db.status &= ~DB_NOT_DOWNLOADED; + db.status &= ~DB_RETRIEVING_FAILED; db.lastAccess = time( NULL ); DynStr_clear( db.txt ); @@ -285,7 +285,7 @@ if ( strcmp( field, "x-noffle-status" ) == 0 ) { if ( strstr( value, "NOT_DOWNLOADED" ) != 0 ) - db.stat |= DB_NOT_DOWNLOADED; + db.status |= DB_NOT_DOWNLOADED; } else if ( strcmp( field, "message-id" ) != 0 && strcmp( field, "xref" ) != 0 @@ -302,18 +302,18 @@ /* Read body */ while ( ( artTxt = Utl_getLn( line, artTxt ) ) ) - if ( ! ( db.stat & DB_NOT_DOWNLOADED ) ) + if ( ! ( db.status & DB_NOT_DOWNLOADED ) ) DynStr_appLn( db.txt, line ); return saveArt(); } void -Db_setStat( const char *msgId, int stat ) +Db_setStatus( const char *msgId, int status ) { if ( loadArt( msgId ) ) { - db.stat = stat; + db.status = status; saveArt(); } } @@ -410,7 +410,7 @@ static DynStr *s = NULL; Str date, t; - int stat; + int status; const char *p; if ( s == NULL ) @@ -422,15 +422,15 @@ return NULL; strftime( date, MAXCHAR, "%Y-%m-%d %H:%M:%S", localtime( &db.lastAccess ) ); - stat = db.stat; + status = db.status; snprintf( t, MAXCHAR, "Message-ID: %s\n" "X-NOFFLE-Status:%s%s%s\n" "X-NOFFLE-LastAccess: %s\n", msgId, - stat & DB_INTERESTING ? " INTERESTING" : "", - stat & DB_NOT_DOWNLOADED ? " NOT_DOWNLOADED" : "", - stat & DB_RETRIEVING_FAILED ? " RETRIEVING_FAILED" : "", + status & DB_INTERESTING ? " INTERESTING" : "", + status & DB_NOT_DOWNLOADED ? " NOT_DOWNLOADED" : "", + status & DB_RETRIEVING_FAILED ? " RETRIEVING_FAILED" : "", date ); DynStr_app( s, t ); appendLongHeader( s, "Subject:", db.subj ); @@ -466,11 +466,11 @@ } int -Db_stat( const char *msgId ) +Db_status( const char *msgId ) { if ( ! loadArt( msgId ) ) return 0; - return db.stat; + return db.status; } time_t