+/* We only handle simple function definitions here. */
+static char *add_func(char *others, const char *line)
+{
+ const char *p, *end = strchr(line, '(') - 1;
+ while (isblank(*end)) {
+ end--;
+ if (end == line)
+ return others;
+ }
+
+ for (p = end; isalnum(*p) || *p == '_'; p--) {
+ if (p == line)
+ return others;
+ }
+
+ return talloc_asprintf_append(others, "printf(\"%%p\", %.*s);\n",
+ end - p + 1, p);
+}
+
+static bool looks_internal(const char *p)
+{
+ return (strncmp(p, "#", 1) != 0
+ && strncmp(p, "static", 6) != 0
+ && strncmp(p, "struct", 6) != 0
+ && strncmp(p, "union", 5) != 0);
+}
+
+static void strip_leading_whitespace(char **lines, unsigned prefix_len)
+{
+ unsigned int i;
+
+ for (i = 0; lines[i]; i++)
+ lines[i] += prefix_len;
+}
+