Mercurial > hg > nginx-quic
comparison src/core/ngx_conf_file.c @ 64:34d647deb1da
nginx-0.0.1-2003-03-04-09:33:48 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 04 Mar 2003 06:33:48 +0000 |
parents | e8cdc2989cee |
children | 5a7d1aaa1618 |
comparison
equal
deleted
inserted
replaced
63:36d2c25cc9bb | 64:34d647deb1da |
---|---|
106 #if 0 | 106 #if 0 |
107 ngx_log_debug(cf->log, "command '%s'" _ cmd->name.data); | 107 ngx_log_debug(cf->log, "command '%s'" _ cmd->name.data); |
108 #endif | 108 #endif |
109 | 109 |
110 if (!(cmd->type & NGX_CONF_ANY) | 110 if (!(cmd->type & NGX_CONF_ANY) |
111 && !(cmd->type & argument_number[cf->args->nelts - 1])) | 111 && ((cmd->type & NGX_CONF_FLAG && cf->args->nelts != 2) |
112 || (!(cmd->type & NGX_CONF_FLAG) | |
113 && !(cmd->type | |
114 & argument_number[cf->args->nelts - 1]) | |
115 ) | |
116 ) | |
117 ) | |
112 { | 118 { |
113 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 119 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, |
114 "invalid number arguments in " | 120 "invalid number arguments in " |
115 "directive \"%s\" in %s:%d", | 121 "directive \"%s\" in %s:%d", |
116 name->data, | 122 name->data, |
141 } else if (rv == NGX_CONF_ERROR) { | 147 } else if (rv == NGX_CONF_ERROR) { |
142 return NGX_CONF_ERROR; | 148 return NGX_CONF_ERROR; |
143 | 149 |
144 } else { | 150 } else { |
145 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 151 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, |
146 "%s", rv); | 152 "%s %s in %s:%d", |
153 name->data, rv, | |
154 cf->conf_file->file.name.data, | |
155 cf->conf_file->line); | |
156 | |
147 return NGX_CONF_ERROR; | 157 return NGX_CONF_ERROR; |
148 } | 158 } |
149 } | 159 } |
150 | 160 |
151 cmd++; | 161 cmd++; |
381 } | 391 } |
382 } | 392 } |
383 } | 393 } |
384 | 394 |
385 | 395 |
396 char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf) | |
397 { | |
398 int flag; | |
399 ngx_str_t *value; | |
400 | |
401 value = (ngx_str_t *) cf->args->elts; | |
402 | |
403 if (ngx_strcasecmp(value[1].data, "on") == 0) { | |
404 flag = 1; | |
405 | |
406 } else if (ngx_strcasecmp(value[1].data, "off") == 0) { | |
407 flag = 0; | |
408 | |
409 } else { | |
410 return "must be \"on\" or \"off\""; | |
411 } | |
412 | |
413 *(int *) (conf + cmd->offset) = flag; | |
414 | |
415 return NGX_CONF_OK; | |
416 } | |
417 | |
418 | |
386 char *ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf) | 419 char *ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf) |
387 { | 420 { |
388 ngx_str_t *field, *value; | 421 ngx_str_t *field, *value; |
389 | 422 |
390 field = (ngx_str_t *) (conf + cmd->offset); | 423 field = (ngx_str_t *) (conf + cmd->offset); |
425 size = atoi(value[1].data); | 458 size = atoi(value[1].data); |
426 if (size < 0) { | 459 if (size < 0) { |
427 return "value must be greater or equal to zero"; | 460 return "value must be greater or equal to zero"; |
428 } | 461 } |
429 | 462 |
430 *(int *) (conf + cmd->offset) = size; | 463 *(int *) (conf + cmd->offset) = size * 1000; |
431 | 464 |
432 return NGX_CONF_OK; | 465 return NGX_CONF_OK; |
433 } | 466 } |
467 | |
468 char *ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, char *conf) | |
469 { | |
470 return "unsupported on this platform"; | |
471 } |