2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-05 16:55:45 +00:00

Include the configuration file name when reporting parse errors.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5649 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2009-02-15 17:26:57 +00:00
parent 6a7286464d
commit 0efe346b80
9 changed files with 65 additions and 19 deletions

View File

@@ -1,7 +1,7 @@
/*
error.h - Part of libsensors, a Linux library for reading sensor data.
Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
Copyright (C) 2007, 2008 Jean Delvare <khali@linux-fr.org>
Copyright (C) 2007-2009 Jean Delvare <khali@linux-fr.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -44,11 +44,22 @@ extern "C" {
You may not modify the result! */
const char *sensors_strerror(int errnum);
/* This function is called when a parse error is detected. Give it a new
value, and your own function is called instead of the default (which
prints to stderr). This function may terminate the program, but it
usually outputs an error and returns. */
/* These functions are called when a parse error is detected. Give them new
values, and your own functions are called instead of the default (which
print to stderr). These functions may terminate the program, but they
usually output an error and return. The first function is the original
one, the second one was added later when support for multiple
configuration files was added.
The library code now only calls the second function. However, for
backwards compatibility, if an application provides a custom handling
function for the first function but not the second, then all parse
errors will be reported using the first function (that is, the filename
is never reported.)
Note that filename can be NULL (if filename isn't known) and lineno
can be 0 (if the error occurs before the actual parsing starts.) */
extern void (*sensors_parse_error) (const char *err, int lineno);
extern void (*sensors_parse_error_wfn) (const char *err,
const char *filename, int lineno);
/* This function is called when an immediately fatal error (like no
memory left) is detected. Give it a new value, and your own function