{
char *header;
char email[MAX_EMAIL_LEN];
- int i, x, len;
if( (header = (char *)malloc(EDITW_COLS)) == NULL )
return;
else
snprintf(header, EDITW_COLS, "%s", database[item][NAME]);
- len = strlen(header);
- x = (EDITW_COLS - len) / 2;
- mvwaddstr(editw, 0, x, header);
- for(i = x; i < x + len; i++)
- mvwaddch(editw, 1, i, '^');
+ mvwaddstr(editw, 0, (EDITW_COLS - strlen(header)) / 2,
+ header);
+
free(header);
}
char emails[MAX_EMAILS][MAX_EMAIL_LEN];
split_emailstr(item, emails);
getyx(editw, y, x);
- mvwaddstr(editw, y+1, TAB_START_X, "E-mail addresses:");
+ mvwaddstr(editw, y+1, FIELDS_START_X,
+ "E-mail addresses:");
for(k = 0; k < MAX_EMAILS; k++) {
getyx(editw, y, x);
- mvwprintw(editw, y+1, TAB_START_X,
+ mvwprintw(editw, y+1, FIELDS_START_X,
"%c -", '2' + k);
mvwprintw(editw, y +1, TAB_COLON_POS,
": %s", emails[k]);
if(j > 1) {
getyx(editw, y, x); y++;
} else
- y = TAB_START_Y;
+ y = FIELDS_START_Y;
- mvwprintw(editw, y, TAB_START_X, "%d - %s",
+ mvwprintw(editw, y, FIELDS_START_X, "%d - %s",
j,
abook_fields[i].name);
mvwaddch(editw, y, TAB_COLON_POS, ':');
int n = c - '1' + 1;
char *str;
- if(n < 1 || n > MAX_TAB_LINES)
+ if(n < 1 || n > MAX_TAB_FIELDS)
return 0;
edit_undo(item, BACKUP_ITEM);