예제 #1
0
char *
zt_progname(char *name, int opts)
{
    if (name && *name != '\0') {
        memset(_progname, '\0', PATH_MAX);
        if (opts == STRIP_DIR) {
            zt_cstr_basename(_progname, PATH_MAX, name, NULL);
        } else {
            memcpy(_progname, name, MIN(PATH_MAX, strlen(name)));
        }
    }
    return _progname;
}
예제 #2
0
파일: zt_assert.c 프로젝트: hnkien/libzt
void
_zt_log_assertion(const char *s, const char *file, unsigned int line,
                  const char *func)
{
    char bname[PATH_MAX];

    if (!s) {
        s = "no assertion given";
    }

    (void)zt_cstr_basename(bname, PATH_MAX, file, NULL);

    if (func) {
        zt_log_printf(zt_log_err, "Assertion Failed: \"%s\": %s[%d:%s]", s, bname, line, func);
    } else {
        zt_log_printf(zt_log_err, "Assertion Failed: \"%s\": %s[%d]", s, bname, line);
    }
}
예제 #3
0
파일: zt_assert.c 프로젝트: hnkien/libzt
int
_zt_log_abort(const char *s, const char *file, unsigned int line,
              const char *func)
{
    char bname[PATH_MAX];

    if (!s) {
        s = "no message given";
    }

    (void)zt_cstr_basename(bname, PATH_MAX, file, NULL);

    if (func) {
        zt_log_printf(zt_log_crit, "Exiting: \"%s\": %s[%d:%s]", s, bname, line, func);
    } else {
        zt_log_printf(zt_log_crit, "Exiting: \"%s\": %s[%d]", s, bname, line);
    }

    return 0;
}