- switch(ch) {
- case 'a':
- newprompt("Enter new email address: ", buf, 50);
- striplt(buf);
- if (!IsEmptyStr(buf)) {
- // FIXME validate the email address (format, our own domain, addr does not belong to another user)
- ++num_recs;
- if (num_recs == 1) {
- recs = malloc(sizeof(char *));
- }
- else {
- recs = realloc(recs, (sizeof(char *)) * num_recs);
- }
- recs[num_recs-1] = strdup(buf);
- }
- modified = 1;
- break;
- case 'd':
- i = intprompt("Delete which address", 1, 1, num_recs) - 1;
- free(recs[i]);
- --num_recs;
- for (j=i; j<num_recs; ++j) {
- recs[j] = recs[j+1];
+ switch (ch) {
+ case 'a':
+ newprompt("Enter new email address: ", buf, 50);
+ string_trim(buf);
+ if (!IsEmptyStr(buf)) {
+ // FIXME validate the email address (format, our own domain, addr does not belong to another user)
+ ++num_recs;
+ if (num_recs == 1) {
+ recs = malloc(sizeof(char *));