diff options
author | kamil <kamil@NetBSD.org> | 2020-11-10 08:49:08 +0000 |
---|---|---|
committer | kamil <kamil@NetBSD.org> | 2020-11-10 08:49:08 +0000 |
commit | 679426dc52b7c5ef9223f9ec7065855f81102c78 (patch) | |
tree | 830c7f343b515a38c4e7237814dfb43cc31a2882 /warp/intrp.c | |
parent | cd6a6786a83c6ffc71841f4c49e6192f2296b2a1 (diff) | |
download | bsdgames-darwin-679426dc52b7c5ef9223f9ec7065855f81102c78.tar.gz bsdgames-darwin-679426dc52b7c5ef9223f9ec7065855f81102c78.tar.zst bsdgames-darwin-679426dc52b7c5ef9223f9ec7065855f81102c78.zip |
Integrate Warp Kit into the NetBSD build
Fix the build and make it install and run with minimal required changes.
Diffstat (limited to 'warp/intrp.c')
-rw-r--r-- | warp/intrp.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/warp/intrp.c b/warp/intrp.c index d2aa729c..0379d1be 100644 --- a/warp/intrp.c +++ b/warp/intrp.c @@ -257,6 +257,21 @@ getout: } #endif +static char *mygets(char *str, size_t n) +{ + char *ret; + size_t last; + + if ((ret = fgets(str, n, stdin)) != NULL) { + last = strlen(str) - 1; + + if (str[last] == '\n') + str[last] = '\0'; + } + + return ret; +} + /* interpret interpolations */ char * @@ -367,7 +382,7 @@ char *stoppers; pattern = dointerp(scrbuf,(sizeof scrbuf),pattern+1,"\""); fputs(scrbuf,stdout); resetty(); - gets(scrbuf); + mygets(scrbuf, sizeof(scrbuf)); crmode(); raw(); noecho(); |