projects
/
mymail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
376f399
)
Cosmetics + now alias replaces the full search request, not just the key.
author
Francois Fleuret
<francois@fleuret.org>
Thu, 2 May 2013 12:12:00 +0000
(14:12 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Thu, 2 May 2013 12:12:00 +0000
(14:12 +0200)
mymail.c
patch
|
blob
|
history
diff --git
a/mymail.c
b/mymail.c
index
ff0bd45
..
80864d2
100644
(file)
--- a/
mymail.c
+++ b/
mymail.c
@@
-57,12
+57,19
@@
#define LEADING_FROM_LINE_REGEXP_STRING "^From .*\\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) \\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\) [ 0123][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]\n$"
#define LEADING_FROM_LINE_REGEXP_STRING "^From .*\\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\) \\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\) [ 0123][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]\n$"
+/********************************************************************/
+
+struct alias_node {
+ char *alias, *value;
+ struct alias_node *next;
+};
+
/* Global variables! */
int global_quiet;
int global_use_leading_time;
/* Global variables! */
int global_quiet;
int global_use_leading_time;
-
regex_t global_leading_from_line_regexp;
regex_t global_leading_from_line_regexp;
+struct alias_node *global_alias_list;
/********************************************************************/
/********************************************************************/
@@
-102,15
+109,6
@@
struct search_condition {
/********************************************************************/
/********************************************************************/
-struct alias_node {
- char *alias, *value;
- struct alias_node *next;
-};
-
-struct alias_node *global_alias_list;
-
-/********************************************************************/
-
struct parsable_field {
int id;
int cflags;
struct parsable_field {
int id;
int cflags;
@@
-829,6
+827,13
@@
void init_condition(struct search_condition *condition, const char *full_string,
const char *string;
struct alias_node *a;
const char *string;
struct alias_node *a;
+ for(a = global_alias_list; a; a = a->next) {
+ if(strcmp(full_string, a->alias) == 0) {
+ full_string = a->value;
+ break;
+ }
+ }
+
string = parse_token(full_search_field, TOKEN_BUFFER_SIZE, ' ', full_string);
search_field = full_search_field;
string = parse_token(full_search_field, TOKEN_BUFFER_SIZE, ' ', full_string);
search_field = full_search_field;
@@
-839,13
+844,6
@@
void init_condition(struct search_condition *condition, const char *full_string,
condition->negation = 0;
}
condition->negation = 0;
}
- for(a = global_alias_list; a; a = a->next) {
- if(strcmp(search_field, a->alias) == 0) {
- search_field = a->value;
- break;
- }
- }
-
condition->db_key = -1;
/* Time condition */
condition->db_key = -1;
/* Time condition */
@@
-946,6
+944,7
@@
void read_rc_file(const char *rc_filename) {
if(*s && *s != '#') {
s = parse_token(command, TOKEN_BUFFER_SIZE, ' ', s);
if(*s && *s != '#') {
s = parse_token(command, TOKEN_BUFFER_SIZE, ' ', s);
+
if(strcmp(command, "alias") == 0) {
struct alias_node *a = safe_malloc(sizeof(struct alias_node));
a->next = global_alias_list;
if(strcmp(command, "alias") == 0) {
struct alias_node *a = safe_malloc(sizeof(struct alias_node));
a->next = global_alias_list;