SANEI  1.2.1.189-7ab850
sanei_config.h
Go to the documentation of this file.
1 /* sane - Scanner Access Now Easy.
2  Copyright (C) 1997 Jeffrey S. Freedman
3  This file is part of the SANE package.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License as
7  published by the Free Software Foundation; either version 2 of the
8  License, or (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <https://www.gnu.org/licenses/>.
17 
18  As a special exception, the authors of SANE give permission for
19  additional uses of the libraries contained in this release of SANE.
20 
21  The exception is that, if you link a SANE library with other files
22  to produce an executable, this does not by itself cause the
23  resulting executable to be covered by the GNU General Public
24  License. Your use of that executable is in no way restricted on
25  account of linking the SANE library code into it.
26 
27  This exception does not, however, invalidate any other reasons why
28  the executable file might be covered by the GNU General Public
29  License.
30 
31  If you submit changes to SANE to the maintainers to be included in
32  a subsequent release, you agree by submitting the changes that
33  those changes may be distributed with this exception intact.
34 
35  If you write modifications of your own for SANE, it is your choice
36  whether to permit this exception to apply to your modifications.
37  If you do not wish that, delete this exception notice.
38 */
39 
47 #ifndef sanei_config_h
48 #define sanei_config_h 1
49 
50 #include <stdio.h>
51 #include <sane/sane.h>
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
69 extern FILE *sanei_config_open (const char *name);
70 
82 extern char *sanei_config_read (char *str, int n, FILE *stream);
83 
91 extern const char *sanei_config_skip_whitespace (const char *str);
92 
93 
107 extern const char *sanei_config_get_string (const char *str,
108  char **string_const);
109 
127 extern void sanei_config_attach_matching_devices (const char *name,
128  SANE_Status (*attach)
129  (const char *dev));
130 
136 typedef struct
137 {
139  SANE_Int count;
140 
142  SANE_Option_Descriptor **descriptors;
143 
145  void **values;
146 
147 } SANEI_Config;
148 
164 extern SANE_Status sanei_configure_attach (
165  const char *config_file,
166  SANEI_Config *config,
167  SANE_Status (*config_attach)(SANEI_Config *config, const char *devname,
168  void *data),
169  void *data
170 );
171 
177 extern const char *sanei_config_get_paths (void);
178 
179 #ifdef __cplusplus
180 } // extern "C"
181 #endif
182 
183 #endif /* sanei_config_h */
SANE_Status sanei_configure_attach(const char *config_file, SANEI_Config *config, SANE_Status(*config_attach)(SANEI_Config *config, const char *devname, void *data), void *data)
Parse configuration file, reading configuration options and trying to attach devices found in file.
const char * sanei_config_get_string(const char *str, char **string_const)
Scan a string constant from a line of text and return a malloced copy of it.
void sanei_config_attach_matching_devices(const char *name, SANE_Status(*attach)(const char *dev))
Expand device name patterns into a list of devices.
char * sanei_config_read(char *str, int n, FILE *stream)
Read a line from configuration file.
FILE * sanei_config_open(const char *name)
Search configuration file name along directory list and return file pointer if such a file exists.
const char * sanei_config_skip_whitespace(const char *str)
Remove all whitespace from the beginning of a string.
const char * sanei_config_get_paths(void)
Return the list of config directories, extracted from the SANE_CONFIG_DIR environment variable and th...
this structure holds the description of configuration options.
Definition: sanei_config.h:137
void ** values
values for the configuration options
Definition: sanei_config.h:145
SANE_Int count
number of options
Definition: sanei_config.h:139
SANE_Option_Descriptor ** descriptors
NULL terminated list of configuration option.
Definition: sanei_config.h:142