summaryrefslogtreecommitdiff
path: root/manual/examples/strdupa.c
diff options
context:
space:
mode:
Diffstat (limited to 'manual/examples/strdupa.c')
-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;
+}