version 1.2, 2014/06/27 18:50:39 |
version 1.3, 2014/07/03 01:45:38 |
|
|
* intersects with itself. Matter of taste. |
* intersects with itself. Matter of taste. |
*/ |
*/ |
char *augmentation_string = " .o+=*BOX@%&#/^SE"; |
char *augmentation_string = " .o+=*BOX@%&#/^SE"; |
char *retval, *p; |
char *retval, *p, title[FLDSIZE_X]; |
u_char field[FLDSIZE_X][FLDSIZE_Y]; |
u_char field[FLDSIZE_X][FLDSIZE_Y]; |
size_t i; |
size_t i, tlen; |
u_int b; |
u_int b; |
int x, y; |
int x, y, r; |
size_t len = strlen(augmentation_string) - 1; |
size_t len = strlen(augmentation_string) - 1; |
|
|
if ((retval = calloc((FLDSIZE_X + 3), (FLDSIZE_Y + 2))) == NULL) |
if ((retval = calloc((FLDSIZE_X + 3), (FLDSIZE_Y + 2))) == NULL) |
|
|
field[FLDSIZE_X / 2][FLDSIZE_Y / 2] = len - 1; |
field[FLDSIZE_X / 2][FLDSIZE_Y / 2] = len - 1; |
field[x][y] = len; |
field[x][y] = len; |
|
|
/* fill in retval */ |
/* assemble title */ |
snprintf(retval, FLDSIZE_X, "+--[%4s %4u]", |
r = snprintf(title, sizeof(title), "[%s %u]", |
sshkey_type(k), sshkey_size(k)); |
sshkey_type(k), sshkey_size(k)); |
p = strchr(retval, '\0'); |
/* If [type size] won't fit, then try [type]; fits "[ED25519-CERT]" */ |
|
if (r < 0 || r > (int)sizeof(title)) |
|
snprintf(title, sizeof(title), "[%s]", sshkey_type(k)); |
|
tlen = strlen(title); |
|
|
/* output upper border */ |
/* output upper border */ |
|
p = retval; |
|
*p++ = '+'; |
|
for (i = 0; i < (FLDSIZE_X - tlen) / 2; i++) |
|
*p++ = '-'; |
|
memcpy(p, title, tlen); |
|
p += tlen; |
for (i = p - retval - 1; i < FLDSIZE_X; i++) |
for (i = p - retval - 1; i < FLDSIZE_X; i++) |
*p++ = '-'; |
*p++ = '-'; |
*p++ = '+'; |
*p++ = '+'; |