syslog(LOG_INFO, "alsactl " SND_UTIL_VERSION_STR " daemon started");
}
+ snd_lib_error_set_handler(error_handler);
+
if (!strcmp(cmd, "init")) {
res = init(initfile, cardname);
snd_config_update_free_global();
void error_(const char *fcn, long line, const char *fmt, ...);
void cerror_(const char *fcn, long line, int cond, const char *fmt, ...);
void dbg_(const char *fcn, long line, const char *fmt, ...);
+void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...);
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
#define info(...) do { info_(__func__, __LINE__, __VA_ARGS__); } while (0)
}
va_end(ap);
}
+
+void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...)
+{
+ char buf[2048];
+ va_list arg;
+
+ va_start(arg, fmt);
+ vsnprintf(buf, sizeof(buf), fmt, arg);
+ va_end(arg);
+ if (use_syslog)
+ syslog(LOG_ERR, "alsa-lib %s:%i:(%s) %s%s%s\n", file, line, function,
+ buf, err ? ": " : "", err ? snd_strerror(err) : "");
+ else
+ fprintf(stderr, "alsa-lib %s:%i:(%s) %s%s%s\n", file, line, function,
+ buf, err ? ": " : "", err ? snd_strerror(err) : "");
+}