diff options
author | Jack Sangdahl <[email protected]> | 2024-04-25 00:22:01 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2024-04-25 00:22:01 -0600 |
commit | d0c0f5247bd11a788b4f173ca6241b51a3adb458 (patch) | |
tree | 0ab375ca2626655d62beffd968dc115ed1f93e5f /st.c | |
parent | f1ab5cd97013b1de4653684ce478cc656801a02d (diff) | |
download | st-d0c0f5247bd11a788b4f173ca6241b51a3adb458.tar.gz st-d0c0f5247bd11a788b4f173ca6241b51a3adb458.zip |
tidy some code + scroll patch
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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) { |