aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2024-04-25 00:22:01 -0600
committerJack Sangdahl <[email protected]>2024-04-25 00:22:01 -0600
commitd0c0f5247bd11a788b4f173ca6241b51a3adb458 (patch)
tree0ab375ca2626655d62beffd968dc115ed1f93e5f /st.c
parentf1ab5cd97013b1de4653684ce478cc656801a02d (diff)
downloadst-d0c0f5247bd11a788b4f173ca6241b51a3adb458.tar.gz
st-d0c0f5247bd11a788b4f173ca6241b51a3adb458.zip
tidy some code + scroll patch
Diffstat (limited to 'st.c')
-rw-r--r--st.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/st.c b/st.c
index 9c7ff35..d15846c 100644
--- a/st.c
+++ b/st.c
@@ -1,4 +1,5 @@
-/* See LICENSE for license details. */
+// Copyright 2024 @waffle87
+// SPDX-License-Identifier: MIT/X
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@@ -256,11 +257,13 @@ void *xrealloc(void *p, size_t len) {
return p;
}
-char *xstrdup(char *s) {
- if ((s = strdup(s)) == NULL)
+char *xstrdup(const char *s) {
+ char *p;
+
+ if ((p = strdup(s)) == NULL)
die("strdup: %s\n", strerror(errno));
- return s;
+ return p;
}
size_t utf8decode(const char *c, Rune *u, size_t clen) {
@@ -687,7 +690,7 @@ void stty(char **args) {
perror("Couldn't call stty");
}
-int ttynew(char *line, char *cmd, char *out, char **args) {
+int ttynew(const char *line, char *cmd, const char *out, char **args) {
int m, s;
if (out) {