2 * Taken from perf which in turn take it from GIT
7 static void report(const char *prefix
, const char *err
, va_list params
)
10 vsnprintf(msg
, sizeof(msg
), err
, params
);
11 fprintf(stderr
, " %s%s\n", prefix
, msg
);
14 static NORETURN
void die_builtin(const char *err
, va_list params
)
16 report(" Fatal: ", err
, params
);
20 static void error_builtin(const char *err
, va_list params
)
22 report(" Error: ", err
, params
);
25 static void warn_builtin(const char *warn
, va_list params
)
27 report(" Warning: ", warn
, params
);
30 static void info_builtin(const char *info
, va_list params
)
32 report(" Info: ", info
, params
);
35 void die(const char *err
, ...)
39 va_start(params
, err
);
40 die_builtin(err
, params
);
44 int pr_error(const char *err
, ...)
48 va_start(params
, err
);
49 error_builtin(err
, params
);
54 void pr_warning(const char *warn
, ...)
58 va_start(params
, warn
);
59 warn_builtin(warn
, params
);
63 void pr_info(const char *info
, ...)
67 va_start(params
, info
);
68 info_builtin(info
, params
);
72 void die_perror(const char *s
)
79 * strlcat - Append a length-limited, %NUL-terminated string to another
80 * @dest: The string to be appended to
81 * @src: The string to append to it
82 * @count: The size of the destination buffer.
84 size_t strlcat(char *dest
, const char *src
, size_t count
)
86 size_t dsize
= strlen(dest
);
87 size_t len
= strlen(src
);
88 size_t res
= dsize
+ len
;
90 DIE_IF(dsize
>= count
);
97 memcpy(dest
, src
, len
);