summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/ui.c b/ui.c
index 2e028ff..62c3b3c 100644
--- a/ui.c
+++ b/ui.c
@@ -267,11 +267,10 @@ void uiTopic(const wchar_t *topic) {
 }
 
 void uiTopicStr(const char *topic) {
-	size_t len = strlen(topic);
-	wchar_t wcs[1 + len];
-	len = mbstowcs(wcs, topic, 1 + len);
-	if (len == (size_t)-1) err(EX_DATAERR, "mbstowcs");
+	wchar_t *wcs = ambstowcs(topic);
+	if (!wcs) err(EX_DATAERR, "ambstowcs");
 	uiTopic(wcs);
+	free(wcs);
 }
 
 void uiLog(const wchar_t *line) {
@@ -350,16 +349,10 @@ static void delete(void) {
 static void enter(void) {
 	if (line.end == line.buf) return;
 	*line.end = L'\0';
-
-	const wchar_t *src = line.buf;
-	size_t len = wcsrtombs(NULL, &src, 0, NULL);
-	if (len == (size_t)-1) err(EX_DATAERR, "wcsrtombs");
-
-	char buf[1 + len];
-	len = wcsrtombs(buf, &src, sizeof(buf), NULL);
-	if (len == (size_t)-1) err(EX_DATAERR, "wcsrtombs");
-
-	input(buf);
+	char *str = awcstombs(line.buf);
+	if (!str) err(EX_DATAERR, "awcstombs");
+	input(str);
+	free(str);
 	line.ptr = line.buf;
 	line.end = line.buf;
 }
client/server error messagesJune McEnroe 2019-10-27Add reload cmd to rc scriptJune McEnroe 2019-10-27Reload certificate on SIGUSR1June McEnroe 2019-10-27Drop clients on zero-length readsJune McEnroe 2019-10-27Explicitly tls_handshake new clientsJune McEnroe 2019-10-26Document rationaleJune McEnroe 2019-10-26Handle nick collisionJune McEnroe 2019-10-26Wait for AUTHENTICATE + from serverJune McEnroe 2019-10-26Respond to PING with same parameterJune McEnroe 2019-10-26Add undocumented flag to disable verificationJune McEnroe 2019-10-26Do not require RPL_ISUPPORT for stateReadyJune McEnroe 2019-10-26Implement graceful shutdownJune McEnroe 2019-10-26Require PASS before USERJune McEnroe 2019-10-26Track channel topicsJune McEnroe 2019-10-26Set AWAY when no clients are connectedJune McEnroe 2019-10-26Add flags to request TOPIC and NAMES on client connectJune McEnroe 2019-10-26OopsJune McEnroe 2019-10-26Disconnect client on unknown commandJune McEnroe 2019-10-26Allow reading sensitive information from filesJune McEnroe 2019-10-26Add rc scriptJune McEnroe 2019-10-25Add install and uninstall targetsJune McEnroe 2019-10-25Expand documentationJune McEnroe 2019-10-25Add AGPLv3 notice on client registrationJune McEnroe 2019-10-25Rename project pounceJune McEnroe