summaryrefslogtreecommitdiff
path: root/ncurses/base/lib_initscr.c
diff options
context:
space:
mode:
Diffstat (limited to 'ncurses/base/lib_initscr.c')
-rw-r--r--ncurses/base/lib_initscr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ncurses/base/lib_initscr.c b/ncurses/base/lib_initscr.c
index 6b9149135501..782e0659cac1 100644
--- a/ncurses/base/lib_initscr.c
+++ b/ncurses/base/lib_initscr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright 2019,2020 Thomas E. Dickey *
+ * Copyright 2019-2024,2025 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -46,7 +46,7 @@
#include <sys/termio.h> /* needed for ISC */
#endif
-MODULE_ID("$Id: lib_initscr.c,v 1.48 2020/09/07 14:26:48 tom Exp $")
+MODULE_ID("$Id: lib_initscr.c,v 1.52 2025/03/09 00:49:14 tom Exp $")
NCURSES_EXPORT(WINDOW *)
initscr(void)
@@ -70,7 +70,8 @@ initscr(void)
(void) VALID_TERM_ENV(env, "unknown");
if ((name = strdup(env)) == NULL) {
- fprintf(stderr, "Error opening allocating $TERM.\n");
+ fprintf(stderr, "ncurses: cannot allocate %d bytes of"
+ "memory for $TERM; exiting\n", (int) strlen(env));
ExitProgram(EXIT_FAILURE);
}
#ifdef __CYGWIN__
@@ -90,8 +91,9 @@ initscr(void)
}
}
#endif
- if (newterm(name, stdout, stdin) == 0) {
- fprintf(stderr, "Error opening terminal: %s.\n", name);
+ if (newterm(name, stdout, stdin) == NULL) {
+ fprintf(stderr, "ncurses: cannot initialize terminal type"
+ " ($TERM=\"%s\"); exiting\n", name);
ExitProgram(EXIT_FAILURE);
}