/*
+ * Copyright (C) 2005-2009 Atsushi Konno All rights reserved.
* Copyright (C) 2005 QSDN,Inc. All rights reserved.
- * Copyright (C) 2005 Atsushi Konno All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @param userAgent UserAgent is appointed here,
* @return The style which corresponds is returned.
*/
-device_table*
-chxj_specified_device(request_rec* r, const char* user_agent)
+device_table *
+chxj_specified_device(request_rec *r, const char *user_agent)
{
ap_regmatch_t match[10];
- device_table* returnType = &UNKNOWN_DEVICE;
- device_table_list* dtl;
- device_table* dt;
- mod_chxj_config* conf;
- char* device_id;
+ device_table *returnType = &UNKNOWN_DEVICE;
+ device_table_list *dtl;
+ device_table *dt;
+ mod_chxj_config *conf;
+ char *device_id;
if (! user_agent)
return returnType;
DBG(r, "start chxj_specified_device()");
- conf = ap_get_module_config(r->per_dir_config, &chxj_module);
+ conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
+ if (! conf->devices) {
+ DBG(r, "device_data.xml load failure");
+ return returnType;
+ }
for (dtl = conf->devices; dtl; dtl = dtl->next) {
if (! dtl->pattern) {
continue;
}
- DBG1(r, "pattern is [%s]", dtl->pattern);
+ /* DBG(r, "pattern is [%s]", dtl->pattern); */
if (! dtl->regexp) {
DBG(r,"compile failed.");
return returnType;
}
- if (ap_regexec(dtl->regexp, user_agent, dtl->regexp->re_nsub + 1, match, 0) == 0) {
+ if (ap_regexec((const ap_regex_t *)dtl->regexp, user_agent, (apr_size_t)dtl->regexp->re_nsub + 1, match, 0) == 0) {
device_id = ap_pregsub(r->pool, "$1", user_agent, dtl->regexp->re_nsub + 1, match);
- DBG1(r, "device_id:[%s]", device_id);
+ DBG(r, "device_id:[%s]", device_id);
for (dt = dtl->table; dt; dt = dt->next) {
if (strcasecmp(device_id, dt->device_id) == 0) {
- DBG1(r, "device_name:[%s]", dt->device_name);
+ DBG(r, "device_name:[%s]", dt->device_name);
returnType = dt;
break;
}