Default-Dir-Option added
git-svn-id: file:///home/jan/tmp/wetterstation/trunk@101 dd492736-c11a-0410-ad51-8c26713eaf7f
This commit is contained in:
parent
ad92a712e8
commit
7c578fa79e
|
|
@ -1,6 +1,7 @@
|
|||
#fork yes
|
||||
fork no
|
||||
image_cfg_location image_file/
|
||||
image_cfg_location image_conf/
|
||||
dflt_image_location /home/jan/
|
||||
|
||||
#image_cfg testimage.conf
|
||||
image_cfg example.conf
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ typedef struct config_t {
|
|||
char *pg_user;
|
||||
char *pg_pass;
|
||||
char *image_cfg_location;
|
||||
char *dflt_image_location;
|
||||
image_cfg_list_ptr image_cfg;
|
||||
int fork;
|
||||
} config;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ static const config_keyword dflt_keywords[] = {
|
|||
{"fork", read_yn, &(global_opts.fork), ""},
|
||||
{"image_cfg", add_image_cfg, &(global_opts.image_cfg), ""},
|
||||
{"image_cfg_location", read_str, &(global_opts.image_cfg_location), DEFAULT_PG_HOST},
|
||||
{"dflt_image_location", read_str, &(global_opts.dflt_image_location), DEFAULT_PG_HOST},
|
||||
|
||||
{"pg_host", read_str, &(global_opts.pg_host), DEFAULT_PG_HOST},
|
||||
{"pg_user", read_str, &(global_opts.pg_user), DEFAULT_PG_USER},
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@
|
|||
#############################################
|
||||
|
||||
# Filename des erzeugten bildes
|
||||
filename /home/jan/Testbild.png
|
||||
filename Beispielbild.png
|
||||
|
||||
# Bild im Standart-Verzeichnis speichern
|
||||
use_dflt_img_dir yes
|
||||
|
||||
# Ueberschrift des erzeugten bildes
|
||||
headline Mein Wetterbild
|
||||
|
|
@ -27,6 +27,7 @@ typedef struct image_cfg {
|
|||
char *x_fmt;
|
||||
int zero_min;
|
||||
int bars;
|
||||
int dflt_dir;
|
||||
|
||||
img_color_ptr bg_color;
|
||||
img_color_ptr dia_bg_color;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ static int read_fmt_str(const char *, void *);
|
|||
static const config_keyword keywords[] = {
|
||||
/* keyword handler variable address default */
|
||||
{"filename", read_str, &(img_cfg.file_name), ""},
|
||||
{"use_dflt_img_dir", read_yn, &(img_cfg.dflt_dir), DEFAULT_LABEL_SUM},
|
||||
{"headline", read_str, &(img_cfg.headline), DEFAULT_HEADLINE},
|
||||
{"table_field", read_str, &(img_cfg.table_field), DEFAULT_TABLE_FIELD},
|
||||
{"manual_table", read_yn, &(img_cfg.manual_table), DEFAULT_MANUAL_TABLE},
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include "../definitions.h"
|
||||
|
|
@ -31,6 +32,8 @@
|
|||
#include "image_config.h"
|
||||
#include "image_draw.h"
|
||||
|
||||
#define BUFFSIZE 512
|
||||
|
||||
|
||||
/* Optionen des Bildes */
|
||||
image_cfg_t img_cfg;
|
||||
|
|
@ -43,6 +46,8 @@ static int check_file_interval();
|
|||
|
||||
/* Handelt ein Bild */
|
||||
void process_image_cfg(char *image_cfg_file){
|
||||
char *buff;
|
||||
int i;
|
||||
|
||||
get_image_cfg(image_cfg_file);
|
||||
|
||||
|
|
@ -60,6 +65,15 @@ void process_image_cfg(char *image_cfg_file){
|
|||
DEBUGOUT2("ManualTabelle = %d\n", img_cfg.manual_table);
|
||||
DEBUGOUT2("TabellenName = %s\n", img_cfg.table_name);
|
||||
DEBUGOUT1("\n");
|
||||
|
||||
if(img_cfg.dflt_dir){
|
||||
buff = malloc(sizeof(char)*BUFFSIZE);
|
||||
buff = strncpy(buff, global_opts.dflt_image_location, BUFFSIZE - 1);
|
||||
i = strlen(buff);
|
||||
buff = strncat(buff, img_cfg.file_name, BUFFSIZE - i - 1);
|
||||
img_cfg.file_name = strdup(buff);
|
||||
free(buff);
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
filename /home/jan/Testbild.png
|
||||
filename Testbild.png
|
||||
use_dflt_img_dir yes
|
||||
headline Temparatur - Innensensor
|
||||
manual_table no
|
||||
manual_table_name auss2_data
|
||||
|
|
|
|||
Loading…
Reference in New Issue