/[anubis]/anubis/src/message.c
ViewVC logotype

Diff of /anubis/src/message.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by gray, Sun Jun 29 09:43:38 2003 UTC revision 1.10 by gray, Fri Jul 18 14:36:36 2003 UTC
# Line 139  message_modify_body(MESSAGE *msg, RC_REG Line 139  message_modify_body(MESSAGE *msg, RC_REG
139          }                }      
140  }  }
141    
142    static char *
143    expand_ampersand(char *value, char *old_value)
144    {
145            char *p;
146    
147            p = strchr(value, '&');
148            if (!p) {
149                    free(old_value);
150                    p = strdup(value);
151            } else {
152                    struct obstack stk;
153                    int old_length = strlen(old_value);
154                    
155                    obstack_init(&stk);
156                    for (; p; p = strchr(value, '&')) {
157                            int length = p - value;
158    
159                            obstack_grow(&stk, value, length);
160                            if (p > value && p[-1] == '\\')
161                                    obstack_1grow(&stk, *p);
162                            else
163                                    obstack_grow(&stk, old_value, old_length);
164                            value = p + 1;
165                    }
166                    if (value && value[0])
167                            obstack_grow(&stk, value, strlen(value));
168                    p = strdup(obstack_finish(&stk));
169                    obstack_free(&stk, NULL);
170            }
171            return p;
172    }
173    
174  void  void
175  message_modify_headers(MESSAGE *msg, RC_REGEX *regex, char *key2, char *value)  message_modify_headers(MESSAGE *msg, RC_REGEX *regex, char *key2, char *value)
176  {  {
# Line 160  message_modify_headers(MESSAGE *msg, RC_ Line 192  message_modify_headers(MESSAGE *msg, RC_
192                                          asc->key = strdup(key2);                                          asc->key = strdup(key2);
193                          }                          }
194                          if (value) {                          if (value) {
195                                  free(asc->value);                                  asc->value = expand_ampersand(value,
196                                  asc->value = strdup(value);                                                                asc->value);
197                          }                          }
198                  }                  }
199                  if (rc)                  if (rc)

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26