projects
/
mymail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cc6ebaf
)
Removes the \n at the end of field values.
author
Francois Fleuret
<francois@fleuret.org>
Sat, 8 Jun 2013 21:27:12 +0000
(23:27 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Sat, 8 Jun 2013 21:27:12 +0000
(23:27 +0200)
mymail.c
patch
|
blob
|
history
diff --git
a/mymail.c
b/mymail.c
index
347f2a4
..
fd3b4f5
100644
(file)
--- a/
mymail.c
+++ b/
mymail.c
@@
-506,6
+506,12
@@
int search_in_db(const char *db_filename,
while(nb_extracted_mails < global_nb_mails_max &&
fgets(raw_db_line, BUFFER_SIZE, db_file)) {
while(nb_extracted_mails < global_nb_mails_max &&
fgets(raw_db_line, BUFFER_SIZE, db_file)) {
+
+ /* Removes the CR */
+ char *s = raw_db_line;
+ while(*s && *s != '\n') { s++; }
+ *s = '\0';
+
db_value = parse_token(db_key_string, TOKEN_BUFFER_SIZE, ' ', raw_db_line);
if(strcmp("mail", db_key_string) == 0) {
db_value = parse_token(db_key_string, TOKEN_BUFFER_SIZE, ' ', raw_db_line);
if(strcmp("mail", db_key_string) == 0) {
@@
-521,7
+527,7
@@
int search_in_db(const char *db_filename,
for(n = 0; n < nb_search_conditions; n++) { hits[n] = 0; }
db_value = parse_token(position_in_file_string, TOKEN_BUFFER_SIZE, ' ', db_value);
for(n = 0; n < nb_search_conditions; n++) { hits[n] = 0; }
db_value = parse_token(position_in_file_string, TOKEN_BUFFER_SIZE, ' ', db_value);
-
db_value = parse_token(current_mail_filename, PATH_MAX+1, '\n', db_value
);
+
strncpy(current_mail_filename, db_value, PATH_MAX + 1
);
current_position_in_mail = atol(position_in_file_string);
}
current_position_in_mail = atol(position_in_file_string);
}