EXPORTED struct vparse_param *vparse_add_param(struct vparse_entry *entry, const char *name, const char *value) { struct vparse_param **paramp = &entry->params; while (*paramp) paramp = &((*paramp)->next); struct vparse_param *param = xzmalloc(sizeof(struct vparse_param)); param->name = xstrdupnull(name); param->value = xstrdupnull(value); *paramp = param; return param; }
EXPORTED struct vparse_entry *vparse_add_entry(struct vparse_card *card, const char *group, const char *name, const char *value) { struct vparse_entry **entryp = &card->properties; while (*entryp) entryp = &((*entryp)->next); struct vparse_entry *entry = xzmalloc(sizeof(struct vparse_entry)); entry->group = xstrdupnull(group); entry->name = xstrdupnull(name); entry->v.value = xstrdupnull(value); *entryp = entry; return entry; }
EXPORTED void vparse_replace_entry(struct vparse_card *card, const char *group, const char *name, const char *value) { struct vparse_entry *res = vparse_get_entry(card, group, name); if (!res) res = vparse_add_entry(card, group, name, NULL); free(res->v.value); res->v.value = xstrdupnull(value); }
char * read_capability(isieve_t *obj) { lexstate_t state; char *cap = NULL; obj->version = NEW_VERSION; while (yylex(&state,obj->pin)==STRING) { char *attr = state.str; char *val; val = NULL; if (yylex(&state,obj->pin)==' ') { if (yylex(&state,obj->pin)!=STRING) { parseerror("STRING"); } val = state.str; if (yylex(&state,obj->pin)!=EOL) { parseerror("EOL1"); } } if (strcasecmp(attr,"SASL")==0) { free(cap); cap = xstrdupnull(val); } else if (strcasecmp(attr,"SIEVE")==0) { } else if (strcasecmp(attr,"IMPLEMENTATION")==0) { } else if (strcasecmp(attr,"STARTTLS")==0) { /* TODO */ } else if (val && strncmp(val,"SASL=",5)==0) { obj->version = OLD_VERSION; free(cap); cap = xstrdup(val+5); free(val); return cap; } else { /* unknown capability */ } free(val); } if (yylex(&state,obj->pin)!=EOL) { parseerror("EOL2"); } return cap; }
EXPORTED int backupdb_open(struct db **backup_dbp, struct txn **tidp) { char *fname = xstrdupnull(config_getstring(IMAPOPT_BACKUP_DB_PATH)); int flags = CYRUSDB_CREATE; if (!fname) fname = strconcat(config_dir, FNAME_BACKUPDB, NULL); int r = cyrusdb_lockopen(config_backup_db, fname, flags, backup_dbp, tidp); free(fname); return r; }
EXPORTED struct vparse_card *vparse_new_card(const char *type) { struct vparse_card *card = xzmalloc(sizeof(struct vparse_card)); card->type = xstrdupnull(type); return card; }
char *address_get_localpart(const struct address *a) { return xstrdupnull(a->mailbox); }