sync code with last fixes and improvements from OpenBSD
This commit is contained in:
parent
691f97cc10
commit
371ae113c6
175 changed files with 2932 additions and 1512 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: cmd-display-menu.c,v 1.39 2023/03/15 19:23:22 nicm Exp $ */
|
||||
/* $OpenBSD: cmd-display-menu.c,v 1.40 2023/08/07 10:52:00 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -316,6 +316,7 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item)
|
|||
else
|
||||
title = xstrdup("");
|
||||
menu = menu_create(title);
|
||||
free(title);
|
||||
|
||||
for (i = 0; i != count; /* nothing */) {
|
||||
name = args_string(args, i++);
|
||||
|
@ -326,7 +327,6 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item)
|
|||
|
||||
if (count - i < 2) {
|
||||
cmdq_error(item, "not enough arguments");
|
||||
free(title);
|
||||
menu_free(menu);
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
@ -338,7 +338,6 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item)
|
|||
|
||||
menu_add_item(menu, &menu_item, item, tc, target);
|
||||
}
|
||||
free(title);
|
||||
if (menu == NULL) {
|
||||
cmdq_error(item, "invalid menu arguments");
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: format-draw.c,v 1.26 2022/02/22 11:07:25 nicm Exp $ */
|
||||
/* $OpenBSD: format-draw.c,v 1.27 2023/08/07 10:04:29 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
@ -1083,7 +1083,7 @@ format_trim_left(const char *expanded, u_int limit)
|
|||
struct utf8_data ud;
|
||||
enum utf8_state more;
|
||||
|
||||
out = copy = xcalloc(1, strlen(expanded) + 1);
|
||||
out = copy = xcalloc(2, strlen(expanded) + 1);
|
||||
while (*cp != '\0') {
|
||||
if (width >= limit)
|
||||
break;
|
||||
|
@ -1150,7 +1150,7 @@ format_trim_right(const char *expanded, u_int limit)
|
|||
return (xstrdup(expanded));
|
||||
skip = total_width - limit;
|
||||
|
||||
out = copy = xcalloc(1, strlen(expanded) + 1);
|
||||
out = copy = xcalloc(2, strlen(expanded) + 1);
|
||||
while (*cp != '\0') {
|
||||
if (*cp == '#') {
|
||||
end = format_leading_hashes(cp, &n, &leading_width);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue