* Now reads the irs.conf from /boot/common/settings/network/irs.conf instead of
/etc/irs.conf. Untested. * There are more config files, but I'm not even sure what they are used for. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42643 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
03e3327d33
commit
efa3bc3eca
@ -26,7 +26,7 @@ static const char rcsid[] = "$Id: gen.c,v 1.7 2005/04/27 04:56:23 sra Exp $";
|
|||||||
* The dispatcher is implemented as an accessor class; it is an
|
* The dispatcher is implemented as an accessor class; it is an
|
||||||
* accessor class that calls other accessor classes, as controlled by a
|
* accessor class that calls other accessor classes, as controlled by a
|
||||||
* configuration file.
|
* configuration file.
|
||||||
*
|
*
|
||||||
* A big difference between this accessor class and others is that the
|
* A big difference between this accessor class and others is that the
|
||||||
* map class initializers are NULL, and the map classes are already
|
* map class initializers are NULL, and the map classes are already
|
||||||
* filled in with method functions that will do the right thing.
|
* filled in with method functions that will do the right thing.
|
||||||
@ -44,10 +44,12 @@ static const char rcsid[] = "$Id: gen.c,v 1.7 2005/04/27 04:56:23 sra Exp $";
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/nameser.h>
|
#include <arpa/nameser.h>
|
||||||
#include <resolv.h>
|
#include <resolv.h>
|
||||||
|
|
||||||
|
#include <FindDirectory.h>
|
||||||
|
|
||||||
#include <isc/memcluster.h>
|
#include <isc/memcluster.h>
|
||||||
#include <irs.h>
|
#include <irs.h>
|
||||||
|
|
||||||
@ -121,7 +123,7 @@ struct irs_acc *
|
|||||||
irs_gen_acc(const char *options, const char *conf_file) {
|
irs_gen_acc(const char *options, const char *conf_file) {
|
||||||
struct irs_acc *acc;
|
struct irs_acc *acc;
|
||||||
struct gen_p *irs;
|
struct gen_p *irs;
|
||||||
|
|
||||||
if (!(acc = memget(sizeof *acc))) {
|
if (!(acc = memget(sizeof *acc))) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -218,7 +220,7 @@ static void
|
|||||||
gen_close(struct irs_acc *this) {
|
gen_close(struct irs_acc *this) {
|
||||||
struct gen_p *irs = (struct gen_p *)this->private;
|
struct gen_p *irs = (struct gen_p *)this->private;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/* Search rules. */
|
/* Search rules. */
|
||||||
for (n = 0; n < irs_nmap; n++)
|
for (n = 0; n < irs_nmap; n++)
|
||||||
while (irs->map_rules[n] != NULL)
|
while (irs->map_rules[n] != NULL)
|
||||||
@ -382,10 +384,17 @@ default_map_rules(struct gen_p *irs) {
|
|||||||
static void
|
static void
|
||||||
init_map_rules(struct gen_p *irs, const char *conf_file) {
|
init_map_rules(struct gen_p *irs, const char *conf_file) {
|
||||||
char line[1024], pattern[40], mapname[20], accname[20], options[100];
|
char line[1024], pattern[40], mapname[20], accname[20], options[100];
|
||||||
|
char path[PATH_MAX];
|
||||||
FILE *conf;
|
FILE *conf;
|
||||||
|
|
||||||
if (conf_file == NULL)
|
if (conf_file == NULL) {
|
||||||
conf_file = _PATH_IRS_CONF ;
|
if (find_directory(B_COMMON_SETTINGS_DIRECTORY, -1, false, path,
|
||||||
|
sizeof(path)) == B_OK) {
|
||||||
|
strlcat(path, "/network/irs.conf", sizeof(path));
|
||||||
|
conf_file = path;
|
||||||
|
} else
|
||||||
|
conf_file = _PATH_IRS_CONF;
|
||||||
|
}
|
||||||
|
|
||||||
/* A conf file of "" means compiled in defaults. Irpd wants this */
|
/* A conf file of "" means compiled in defaults. Irpd wants this */
|
||||||
if (conf_file[0] == '\0' || (conf = fopen(conf_file, "r")) == NULL) {
|
if (conf_file[0] == '\0' || (conf = fopen(conf_file, "r")) == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user