diff options
Diffstat (limited to 'examples/hello_strlcpy3/hello.c')
-rw-r--r-- | examples/hello_strlcpy3/hello.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/hello_strlcpy3/hello.c b/examples/hello_strlcpy3/hello.c index 2993cc5..b662024 100644 --- a/examples/hello_strlcpy3/hello.c +++ b/examples/hello_strlcpy3/hello.c @@ -4,6 +4,7 @@ #include <mkc_strlcpy.h> #include <mkc_strlcat.h> #include <mkc_getline.h> +#include <mkc_progname.h> static const char message [] = "Theo de Raadt said: \"The strlcpy() and strlcat() functions provide a consistent, unambiguous API to help the programmer write more bullet-proof code.\""; @@ -15,6 +16,8 @@ int main (int argc, char ** argv) char small_buf [15]; char said [19]; + setprogname (argv [0]); + while (len = getline (&buf, &size, stdin), len != -1){ len = strlen (buf); if (len > 0 && buf [len-1] == '\n') @@ -28,5 +31,8 @@ int main (int argc, char ** argv) strlcpy (said, message, sizeof (said)); puts (said); + printf ("short progname=%s\n", getprogname ()); + printf ("full progname=%s\n", argv [0]); + return 0; } |