* Build fix... sorry, I could have sworn I compiled it before committing.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33443 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-10-05 14:18:32 +00:00
parent 81c431d23d
commit 32ebacf299
+11 -11
View File
@@ -57,7 +57,7 @@ DisplayErrorMessage(const char* messageString = NULL, status_t errorNumber = 0,
if (errorNumber != 0) { if (errorNumber != 0) {
snprintf(errorBuffer, sizeof(errorBuffer), "%s: %s (%lx)" snprintf(errorBuffer, sizeof(errorBuffer), "%s: %s (%lx)"
"has occured.", messageString, strerror(errorNumber), errorNumber); "has occured.", messageString, strerror(errorNumber), errorNumber);
messageString = ErrorBuffer; messageString = errorBuffer;
} }
fputs(titleString, stderr); fputs(titleString, stderr);
@@ -86,7 +86,7 @@ bool
IsStartOfMailMessage(char* lineString) IsStartOfMailMessage(char* lineString)
{ {
// It starts with "From " // It starts with "From "
if (memcmp("From ", LineString, 5) != 0) if (memcmp("From ", lineString, 5) != 0)
return false; return false;
char* string = lineString + 4; char* string = lineString + 4;
@@ -226,7 +226,6 @@ ProcessMessageFile(char* fileName)
// Extract a text message from the Mail file. // Extract a text message from the Mail file.
status_t status = B_ERROR;
BString messageText; BString messageText;
int lineNumber = 0; int lineNumber = 0;
@@ -239,8 +238,8 @@ ProcessMessageFile(char* fileName)
snprintf(errorString, sizeof(errorString), snprintf(errorString, sizeof(errorString),
"Error while reading from \"%s\"", fileName); "Error while reading from \"%s\"", fileName);
DisplayErrorMessage(errorString, errno); DisplayErrorMessage(errorString, errno);
status = errno; fclose(inputFile);
goto out; return errno;
} }
break; break;
// No error, just end of file. // No error, just end of file.
@@ -284,13 +283,14 @@ ProcessMessageFile(char* fileName)
messageText.Append("\n\n"); messageText.Append("\n\n");
// Write the message out. // Write the message out.
status_t status = B_OK;
if (puts(messageText.String()) < 0) { if (puts(messageText.String()) < 0) {
DisplayErrorMessage ("Error while writing the message", errno); DisplayErrorMessage ("Error while writing the message", errno);
status = errno; status = errno;
} else }
status = B_OK;
out:
fclose(inputFile); fclose(inputFile);
return status; return status;
} }
@@ -330,7 +330,7 @@ main(int argc, char** argv)
} }
// Append a trailing slash to the directory name, if it needs one. // Append a trailing slash to the directory name, if it needs one.
if (inputPathName[strlen(InputPathName) - 1] != '/') if (inputPathName[strlen(inputPathName) - 1] != '/')
strcat(inputPathName, "/"); strcat(inputPathName, "/");
int messagesDoneCount = 0; int messagesDoneCount = 0;
@@ -342,7 +342,7 @@ main(int argc, char** argv)
break; break;
strlcpy(tempString, inputPathName, sizeof(tempString)); strlcpy(tempString, inputPathName, sizeof(tempString));
strlcat(tempString, entry->d_name, , sizeof(tempString)); strlcat(tempString, entry->d_name, sizeof(tempString));
status = ProcessMessageFile(tempString); status = ProcessMessageFile(tempString);
if (status != B_OK) if (status != B_OK)
@@ -355,7 +355,7 @@ main(int argc, char** argv)
if (status != B_OK) { if (status != B_OK) {
DisplayErrorMessage("Stopping early because an error occured", status); DisplayErrorMessage("Stopping early because an error occured", status);
return ErrorCode; return status;
} }
fprintf(stderr, "Did %d messages successfully.\n", messagesDoneCount); fprintf(stderr, "Did %d messages successfully.\n", messagesDoneCount);