1 /*
2  * SNOOPY LOGGER
3  *
4  * File: snoopy/datasource/snoopy_version.c
5  *
6  * Copyright (c) 2014-2015 Bostjan Skufca <bostjan@a2o.si>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  */
22 
23 
24 
25 /*
26  * Includes order: from local to global
27  */
28 #include "snoopy_version.h"
29 
30 #include "snoopy.h"
31 
32 #include <stdio.h>
33 #include <sys/types.h>
34 #include <unistd.h>
35 
36 
37 
38 /*
39  * SNOOPY DATA SOURCE: snoopy_version
40  *
41  * Description:
42  *     Dummy data source that returns Snoopy version.
43  *
44  * Params:
45  *     result: pointer to string, to write result into
46  *     arg:    (ignored)
47  *
48  * Return:
49  *     number of characters in the returned string, or SNOOPY_DATASOURCE_FAILURE
50  */
snoopy_datasource_snoopy_version(char * const result,char const * const arg)51 int snoopy_datasource_snoopy_version (char * const result, char const * const arg)
52 {
53     return snprintf(result, SNOOPY_DATASOURCE_MESSAGE_MAX_SIZE, "%s", SNOOPY_VERSION);
54 }
55