cfdisk: fix slang usage
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
4ddd86d5d9
commit
f1512be8a5
14
configure.ac
14
configure.ac
|
@ -613,10 +613,12 @@ AS_IF([test "x$with_ncurses" != xno], [
|
||||||
NCURSES_LIBS=${NCURSESW_LIBS}
|
NCURSES_LIBS=${NCURSESW_LIBS}
|
||||||
NCURSES_CFLAGS=${NCURSESW_CFLAGS}
|
NCURSES_CFLAGS=${NCURSESW_CFLAGS}
|
||||||
AC_DEFINE([HAVE_LIBNCURSESW])
|
AC_DEFINE([HAVE_LIBNCURSESW])
|
||||||
|
CURSES_LIB_NAME="ncursesw"
|
||||||
], [
|
], [
|
||||||
PKG_CHECK_MODULES(NCURSES, [ncurses], [
|
PKG_CHECK_MODULES(NCURSES, [ncurses], [
|
||||||
have_ncurses=yes
|
have_ncurses=yes
|
||||||
AC_DEFINE([HAVE_LIBNCURSES])
|
AC_DEFINE([HAVE_LIBNCURSES])
|
||||||
|
CURSES_LIB_NAME="ncursesw"
|
||||||
], [:])
|
], [:])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -634,12 +636,14 @@ AS_IF([test "x$with_ncurses" != xno], [
|
||||||
AS_IF([test "x$have_ncurses" = xyes], [
|
AS_IF([test "x$have_ncurses" = xyes], [
|
||||||
AC_CHECK_HEADERS([ncursesw/ncurses.h])
|
AC_CHECK_HEADERS([ncursesw/ncurses.h])
|
||||||
NCURSES_LIBS="-lncursesw"
|
NCURSES_LIBS="-lncursesw"
|
||||||
|
CURSES_LIB_NAME="ncursesw"
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
AS_IF([test "x$have_ncurses" = xno], [
|
AS_IF([test "x$have_ncurses" = xno], [
|
||||||
UL_CHECK_LIB(ncurses, initscr)
|
UL_CHECK_LIB(ncurses, initscr)
|
||||||
AS_IF([test "x$have_ncurses" = xyes], [
|
AS_IF([test "x$have_ncurses" = xyes], [
|
||||||
NCURSES_LIBS="-lncurses"
|
NCURSES_LIBS="-lncurses"
|
||||||
|
CURSES_LIB_NAME="ncurses"
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
@ -669,13 +673,21 @@ AS_IF([test "x$with_slang" = xyes], [
|
||||||
#endif
|
#endif
|
||||||
])
|
])
|
||||||
AS_IF([test "x$have_slang" = xno], [
|
AS_IF([test "x$have_slang" = xno], [
|
||||||
AC_MSG_ERROR([slang selected but slcurses.h not found])
|
AC_MSG_ERROR([slang selected but slcurses.h not found])],
|
||||||
|
[CURSES_LIB_NAME=slang
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
AM_CONDITIONAL([HAVE_SLANG], [test "x$have_slang" = xyes])
|
AM_CONDITIONAL([HAVE_SLANG], [test "x$have_slang" = xyes])
|
||||||
|
|
||||||
AM_CONDITIONAL([BUILD_CFDISK], [test "x$have_slang" = xyes -o "x$have_ncurses" = xyes])
|
AM_CONDITIONAL([BUILD_CFDISK], [test "x$have_slang" = xyes -o "x$have_ncurses" = xyes])
|
||||||
|
|
||||||
|
AS_IF([test "x$have_slang" = xyes -o "x$have_ncurses" = xyes], [
|
||||||
|
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, [
|
||||||
|
AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1,
|
||||||
|
[Define if curses library has the use_default_colors command.])
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
dnl Try pkg-config for libtinfo
|
dnl Try pkg-config for libtinfo
|
||||||
PKG_CHECK_MODULES(TINFO, [tinfo], [have_tinfo=yes], [
|
PKG_CHECK_MODULES(TINFO, [tinfo], [have_tinfo=yes], [
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#ifdef HAVE_WIDECHAR
|
#ifdef HAVE_WIDECHAR
|
||||||
# include <wctype.h>
|
# include <wctype.h>
|
||||||
|
# include <wchar.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "c.h"
|
#include "c.h"
|
||||||
|
@ -486,7 +487,9 @@ static void ui_warnx(const char *fmt, ...)
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
if (ui_enabled)
|
if (ui_enabled)
|
||||||
ui_vprint_center(INFO_LINE, COLOR_PAIR(CFDISK_CL_WARNING), fmt, ap);
|
ui_vprint_center(INFO_LINE,
|
||||||
|
colors_wanted() ? COLOR_PAIR(CFDISK_CL_WARNING) : 0,
|
||||||
|
fmt, ap);
|
||||||
else
|
else
|
||||||
vfprintf(stderr, fmt, ap);
|
vfprintf(stderr, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
@ -501,7 +504,9 @@ static void ui_warn(const char *fmt, ...)
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
if (ui_enabled)
|
if (ui_enabled)
|
||||||
ui_vprint_center(INFO_LINE, COLOR_PAIR(CFDISK_CL_WARNING), fmt_m, ap);
|
ui_vprint_center(INFO_LINE,
|
||||||
|
colors_wanted() ? COLOR_PAIR(CFDISK_CL_WARNING) : 0,
|
||||||
|
fmt_m, ap);
|
||||||
else
|
else
|
||||||
vfprintf(stderr, fmt_m, ap);
|
vfprintf(stderr, fmt_m, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
@ -682,15 +687,18 @@ static int ui_init(struct cfdisk *cf __attribute__((__unused__)))
|
||||||
ui_enabled = 1;
|
ui_enabled = 1;
|
||||||
initscr();
|
initscr();
|
||||||
|
|
||||||
|
#ifdef HAVE_USE_DEFAULT_COLORS
|
||||||
if (colors_wanted() && has_colors()) {
|
if (colors_wanted() && has_colors()) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
start_color();
|
start_color();
|
||||||
use_default_colors();
|
use_default_colors();
|
||||||
|
|
||||||
for (i = 1; i < ARRAY_SIZE(color_pairs); i++) /* yeah, start from 1! */
|
for (i = 1; i < ARRAY_SIZE(color_pairs); i++) /* yeah, start from 1! */
|
||||||
init_pair(i, color_pairs[i][0], color_pairs[i][1]);
|
init_pair(i, color_pairs[i][0], color_pairs[i][1]);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
colors_init(UL_COLORMODE_NEVER);
|
||||||
|
#endif
|
||||||
|
|
||||||
cbreak();
|
cbreak();
|
||||||
noecho();
|
noecho();
|
||||||
|
@ -1018,7 +1026,7 @@ static void ui_draw_partition(struct cfdisk *cf, size_t i)
|
||||||
} else {
|
} else {
|
||||||
int at = 0;
|
int at = 0;
|
||||||
|
|
||||||
if (is_freespace(cf, i)) {
|
if (colors_wanted() && is_freespace(cf, i)) {
|
||||||
attron(COLOR_PAIR(CFDISK_CL_FREESPACE));
|
attron(COLOR_PAIR(CFDISK_CL_FREESPACE));
|
||||||
at = 1;
|
at = 1;
|
||||||
}
|
}
|
||||||
|
@ -1151,7 +1159,7 @@ static ssize_t ui_get_string(struct cfdisk *cf, const char *prompt,
|
||||||
clrtoeol();
|
clrtoeol();
|
||||||
|
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
mvaddstr(ln, cl, prompt);
|
mvaddstr(ln, cl, (char *) prompt);
|
||||||
cl += mbs_safe_width(prompt);
|
cl += mbs_safe_width(prompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1568,7 +1576,9 @@ static int main_menu_action(struct cfdisk *cf, int key)
|
||||||
ref = 1;
|
ref = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef KEY_DC
|
||||||
case KEY_DC:
|
case KEY_DC:
|
||||||
|
#endif
|
||||||
case 'd': /* Delete */
|
case 'd': /* Delete */
|
||||||
if (fdisk_delete_partition(cf->cxt, n) != 0)
|
if (fdisk_delete_partition(cf->cxt, n) != 0)
|
||||||
warn = _("Could not delete partition %zu.");
|
warn = _("Could not delete partition %zu.");
|
||||||
|
@ -1811,6 +1821,8 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
colors_init(colormode);
|
colors_init(colormode);
|
||||||
|
|
||||||
fdisk_init_debug(0);
|
fdisk_init_debug(0);
|
||||||
|
|
Loading…
Reference in New Issue