wmail: white-space fixes.
This commit is contained in:
parent
b78df8ed42
commit
71c126d20e
|
@ -393,7 +393,8 @@ static bool ReadString( const char *from, unsigned int line, char **to )
|
||||||
case 'r': *to_c = '\r'; break;
|
case 'r': *to_c = '\r'; break;
|
||||||
case 't': *to_c = '\t'; break;
|
case 't': *to_c = '\t'; break;
|
||||||
case '"': *to_c = '"'; break;
|
case '"': *to_c = '"'; break;
|
||||||
default: {
|
default:
|
||||||
|
{
|
||||||
int value, i;
|
int value, i;
|
||||||
for( i = 0, value = 0; i < 3; ++i ) {
|
for( i = 0, value = 0; i < 3; ++i ) {
|
||||||
if( c+i == NULL || *(c+i) < '0' || *(c+i) > '9' )
|
if( c+i == NULL || *(c+i) < '0' || *(c+i) > '9' )
|
||||||
|
@ -401,7 +402,8 @@ static bool ReadString( const char *from, unsigned int line, char **to )
|
||||||
value = value * 10 + *(c+i) - '0';
|
value = value * 10 + *(c+i) - '0';
|
||||||
}
|
}
|
||||||
if( value == 0 )
|
if( value == 0 )
|
||||||
WARNING( "cfg-file(%i): '\\0' in string or unknown escape sequence found\n", line );
|
WARNING( "cfg-file(%i): '\\0' in string or unknown escape sequence found\n",
|
||||||
|
line );
|
||||||
else {
|
else {
|
||||||
*to_c = (char)value;
|
*to_c = (char)value;
|
||||||
c += i-1;
|
c += i-1;
|
||||||
|
@ -464,15 +466,18 @@ static bool ReadInt( const char *from, unsigned int line, int *to )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else for( ; *from != '\0' && !IsWhiteSpace( from ); ++from ) {
|
} else
|
||||||
|
for( ; *from != '\0' && !IsWhiteSpace( from ); ++from ) {
|
||||||
if( value > (INT_MAX - 9) / 10 ) {
|
if( value > (INT_MAX - 9) / 10 ) {
|
||||||
WARNING( "cfg-file(%i): decimal-number too large: \">%i\"\n", line, INT_MAX );
|
WARNING( "cfg-file(%i): decimal-number too large: \">%i\"\n",
|
||||||
|
line, INT_MAX );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if( *from >= '0' && *from <= '9' )
|
if( *from >= '0' && *from <= '9' )
|
||||||
value = value * 10 + *from - '0';
|
value = value * 10 + *from - '0';
|
||||||
else {
|
else {
|
||||||
WARNING( "cfg-file(%i): invalid decimal-digit: \"%c\"\n", line, *from );
|
WARNING( "cfg-file(%i): invalid decimal-digit: \"%c\"\n",
|
||||||
|
line, *from );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ int main( int argc, char **argv )
|
||||||
config.checksumFileName = MakePathName( usersHome, WMAIL_CHECKSUM_FILE );
|
config.checksumFileName = MakePathName( usersHome, WMAIL_CHECKSUM_FILE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( config.checksumFileName == NULL)
|
if( config.checksumFileName == NULL )
|
||||||
{
|
{
|
||||||
WARNING( "Cannot allocate checksum file-name.\n");
|
WARNING( "Cannot allocate checksum file-name.\n");
|
||||||
exit( EXIT_FAILURE );
|
exit( EXIT_FAILURE );
|
||||||
|
@ -493,13 +493,15 @@ static void DetermineState( void )
|
||||||
static void ReadChecksumFile( void )
|
static void ReadChecksumFile( void )
|
||||||
{
|
{
|
||||||
FILE *f = fopen( config.checksumFileName, "rb" );
|
FILE *f = fopen( config.checksumFileName, "rb" );
|
||||||
if( f != NULL ) while( !feof( f )) {
|
if( f != NULL )
|
||||||
|
while( !feof( f )) {
|
||||||
unsigned long checksum;
|
unsigned long checksum;
|
||||||
if( fread( &checksum, sizeof(long), 1, f ) != 1 )
|
if( fread( &checksum, sizeof(long), 1, f ) != 1 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MarkName( checksum );
|
MarkName( checksum );
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fclose( f );
|
fclose( f );
|
||||||
|
@ -549,7 +551,7 @@ static void ExitHandler( int sig )
|
||||||
|
|
||||||
static void TimedOut( void )
|
static void TimedOut( void )
|
||||||
{
|
{
|
||||||
if (caughtSig) {
|
if( caughtSig ) {
|
||||||
ClearAllNames();
|
ClearAllNames();
|
||||||
ResetConfigStrings();
|
ResetConfigStrings();
|
||||||
exit( EXIT_SUCCESS );
|
exit( EXIT_SUCCESS );
|
||||||
|
@ -567,7 +569,7 @@ static void CheckTimeOut( bool force )
|
||||||
|
|
||||||
unsigned long nowMs = now.tv_sec * 1000L + now.tv_usec / 1000L;
|
unsigned long nowMs = now.tv_sec * 1000L + now.tv_usec / 1000L;
|
||||||
|
|
||||||
if (!force && nowMs - lastTimeOut < 1000L / config.fps)
|
if( !force && nowMs - lastTimeOut < 1000L / config.fps )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lastTimeOut = nowMs;
|
lastTimeOut = nowMs;
|
||||||
|
@ -660,7 +662,7 @@ static void CheckMaildir( void )
|
||||||
char *fullName = MakePathName( config.mailBox, dirEnt->d_name );
|
char *fullName = MakePathName( config.mailBox, dirEnt->d_name );
|
||||||
struct stat fileStat;
|
struct stat fileStat;
|
||||||
|
|
||||||
if ( fullName == NULL )
|
if( fullName == NULL )
|
||||||
{
|
{
|
||||||
WARNING( "Cannot allocate file/path\n" );
|
WARNING( "Cannot allocate file/path\n" );
|
||||||
break;
|
break;
|
||||||
|
@ -708,7 +710,7 @@ static int TraverseDirectory( const char *name, bool isNewMail )
|
||||||
unsigned long checksum = 0;
|
unsigned long checksum = 0;
|
||||||
name_t *name;
|
name_t *name;
|
||||||
|
|
||||||
if ( fullName == NULL )
|
if( fullName == NULL )
|
||||||
{
|
{
|
||||||
WARNING( "Cannot allocate file/path\n" );
|
WARNING( "Cannot allocate file/path\n" );
|
||||||
break;
|
break;
|
||||||
|
@ -972,7 +974,7 @@ static char *ParseFromField( char *buf )
|
||||||
continue;
|
continue;
|
||||||
} // else do the default action
|
} // else do the default action
|
||||||
default:
|
default:
|
||||||
if( fullName[0] != '\0' || !isspace ( *c ))
|
if( fullName[0] != '\0' || !isspace( *c ))
|
||||||
fullName[ fullNameLen++ ] = *c;
|
fullName[ fullNameLen++ ] = *c;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -1050,12 +1052,12 @@ static char *ParseFromField( char *buf )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*comment) {
|
if( *comment ) {
|
||||||
//WARNING("Comment seen: %s\nIn: %s\nFullname: %s\nAddress: %s\n", comment, buf, fullName, addressName);
|
//WARNING("Comment seen: %s\nIn: %s\nFullname: %s\nAddress: %s\n", comment, buf, fullName, addressName);
|
||||||
// Comment seen: if there's an address, append to
|
// Comment seen: if there's an address, append to
|
||||||
// fullname. If no address, copy fullname to address
|
// fullname. If no address, copy fullname to address
|
||||||
// and comment to fullname.
|
// and comment to fullname.
|
||||||
if (*addressName) {
|
if( *addressName ) {
|
||||||
strcat(fullName, "(");
|
strcat(fullName, "(");
|
||||||
strcat(fullName, comment);
|
strcat(fullName, comment);
|
||||||
strcat(fullName, ")");
|
strcat(fullName, ")");
|
||||||
|
@ -1116,7 +1118,7 @@ static void InsertName( char *name, unsigned long checksum, flag_t flag )
|
||||||
name_t *item;
|
name_t *item;
|
||||||
|
|
||||||
TRACE( "insertName: %X, \"%s\"\n", checksum, name );
|
TRACE( "insertName: %X, \"%s\"\n", checksum, name );
|
||||||
if (( item = malloc( sizeof( name_t ))) == NULL )
|
if(( item = malloc( sizeof( name_t ))) == NULL )
|
||||||
{
|
{
|
||||||
free( name );
|
free( name );
|
||||||
return;
|
return;
|
||||||
|
@ -1359,7 +1361,7 @@ static void UpdateConfiguration( void )
|
||||||
|
|
||||||
PreparePixmaps( true );
|
PreparePixmaps( true );
|
||||||
|
|
||||||
DASetTimeout (1000 / config.fps);
|
DASetTimeout( 1000 / config.fps );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CleanupNames( void )
|
static void CleanupNames( void )
|
||||||
|
|
Loading…
Reference in a new issue