diff options
author | Andrej Shadura <andrewsh@debian.org> | 2020-11-27 12:21:46 +0100 |
---|---|---|
committer | Andrej Shadura <andrewsh@debian.org> | 2020-11-27 12:21:46 +0100 |
commit | 2948077f55958203ddf8aae1d844d86e97e5beba (patch) | |
tree | c2f71d37e811ef37f78f27cb59c00d991655026e /examples/hello_strlcpy/hello.c | |
parent | b2cb3f0763ea0f96008b0c5a289a7d2cdc7f80c3 (diff) |
New upstream version 0.35.0
Diffstat (limited to 'examples/hello_strlcpy/hello.c')
-rw-r--r-- | examples/hello_strlcpy/hello.c | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/examples/hello_strlcpy/hello.c b/examples/hello_strlcpy/hello.c deleted file mode 100644 index 1ec6315..0000000 --- a/examples/hello_strlcpy/hello.c +++ /dev/null @@ -1,30 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#ifndef HAVE_FUNC3_STRLCPY_STRING_H -size_t strlcpy(char *dst, const char *src, size_t siz); -#endif - -#ifndef HAVE_FUNC3_GETLINE_STDIO_H -ssize_t getline(char** lineptr, size_t* n, FILE* stream); -#endif - -int main (int argc, char ** argv) -{ - char *buf = NULL; - size_t size = 0; - ssize_t len = 0; - char small_buf [10]; - - while (len = getline (&buf, &size, stdin), len != -1){ - len = strlen (buf); - if (len > 0 && buf [len-1] == '\n') - buf [len-1] = 0; - - strlcpy (small_buf, buf, sizeof (small_buf)); - puts (small_buf); - } - - return 0; -} |