summaryrefslogtreecommitdiff
path: root/manual/examples
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-08-15 01:23:29 +0000
committerUlrich Drepper <drepper@redhat.com>1996-08-15 01:23:29 +0000
commit706074a5bb120f78f4fd8bc40c6814f14e17e530 (patch)
treec5da6add27af818bf38e5d9e4f9b3c2dedc718ff /manual/examples
parent046e3001f9370904c1efd764cfe49c472818ddfb (diff)
update from main archive 960814cvs/libc-960815
Diffstat (limited to 'manual/examples')
-rw-r--r--manual/examples/strdupa.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/manual/examples/strdupa.c b/manual/examples/strdupa.c
new file mode 100644
index 0000000000..7d6ef39947
--- /dev/null
+++ b/manual/examples/strdupa.c
@@ -0,0 +1,19 @@
+#include <paths.h>
+#include <string.h>
+#include <stdio.h>
+
+const char path[] = _PATH_STDPATH;
+
+int
+main (void)
+{
+ char *wr_path = strdupa (path);
+ char *cp = strtok (wr_path, ":");
+
+ while (cp != NULL)
+ {
+ puts (cp);
+ cp = strtok (NULL, ":");
+ }
+ return 0;
+}