kopia lustrzana https://github.com/Hamlib/Hamlib
Added rig_set_debug_filename due to Python not being able to pass a FILE*
https://github.com/Hamlib/Hamlib/issues/1307pull/1330/head
rodzic
5745457d7f
commit
2c8f8a9c29
27
src/debug.c
27
src/debug.c
|
@ -36,6 +36,7 @@
|
|||
#include <stdio.h> /* Standard input/output definitions */
|
||||
#include <string.h> /* String function definitions */
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef ANDROID
|
||||
# include <android/log.h>
|
||||
|
@ -326,4 +327,30 @@ FILE *HAMLIB_API rig_set_debug_file(FILE *stream)
|
|||
return prev_stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Change the output stream to a filename
|
||||
*
|
||||
* \param filename The filename to direct debugging output.
|
||||
*
|
||||
* \sa `FILE`(3)
|
||||
*/
|
||||
FILE *HAMLIB_API rig_set_debug_filename(char *filename)
|
||||
{
|
||||
FILE *prev_stream = rig_debug_stream;
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: debug will stream to '%s'\n", __func__,
|
||||
filename);
|
||||
FILE *stream = fopen(filename, "w");
|
||||
|
||||
if (stream == NULL)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: error opening stream: %s\n", __func__,
|
||||
strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rig_debug_stream = stream;
|
||||
|
||||
return prev_stream;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
Ładowanie…
Reference in New Issue