Rozdiely pre libcfg+/src/parse.c medzi verziami 1.16 a 1.17
| verzia 1.16, 2002/05/11 14:54:58 |
verzia 1.17, 2002/05/30 22:29:45 |
|
|
| |
|
| /* $Id$ */ |
/* $Id$ */ |
| |
|
| |
/* Includes {{{ */ |
| #include "config.h" |
#include "config.h" |
| |
|
| #include <stdio.h> |
#include <stdio.h> |
|
|
| #include "cfg+.h" |
#include "cfg+.h" |
| #include "cmdline.h" |
#include "cmdline.h" |
| #include "cfgfile.h" |
#include "cfgfile.h" |
| |
/* }}} */ |
| |
|
| /* Processing context options. */ |
/* Processing context options. */ |
| |
|
| int |
int |
| cfg_parse(con) |
cfg_parse(con) |
| const CFG_CONTEXT con; |
const CFG_CONTEXT con; |
| { |
{ /* {{{ */ |
| register int ret; |
register int ret; |
| |
|
| while ((ret = cfg_get_next_opt(con)) > 0) |
while ((ret = cfg_get_next_opt(con)) > 0) |
| ; |
; |
| |
|
| return ret; |
return ret; |
| } |
} /* }}} */ |
| |
|
| int |
int |
| cfg_get_next_opt(con) |
cfg_get_next_opt(con) |
| const CFG_CONTEXT con; |
const CFG_CONTEXT con; |
| { |
{ /* {{{ */ |
| return con->type == CFG_CMDLINE |
return con->type == CFG_CMDLINE |
| ? cfg_cmdline_get_next_opt(con) |
? cfg_cmdline_get_next_opt(con) |
| : cfg_cfgfile_get_next_opt(con); |
: cfg_cfgfile_get_next_opt(con); |
| } |
} /* }}} */ |
| |
|
| char * |
char * |
| cfg_get_cur_opt(con) |
cfg_get_cur_opt(con) |
| const CFG_CONTEXT con; |
const CFG_CONTEXT con; |
| { |
{ /* {{{ */ |
| return con->cur_opt; |
return con->cur_opt; |
| } |
} /* }}} */ |
| |
|
| char * |
char * |
| cfg_get_cur_arg(con) |
cfg_get_cur_arg(con) |
| const CFG_CONTEXT con; |
const CFG_CONTEXT con; |
| { |
{ /* {{{ */ |
| return con->cur_arg; |
return con->cur_arg; |
| } |
} /* }}} */ |
| |
|
| int |
int |
| cfg_get_cur_idx(con) |
cfg_get_cur_idx(con) |
| const CFG_CONTEXT con; |
const CFG_CONTEXT con; |
| { |
{ /* {{{ */ |
| return con->type == CFG_CMDLINE |
return con->type == CFG_CMDLINE |
| ? con->cur_idx |
? con->cur_idx |
| : (con->flags & CFG_FILE_LINE_POS_USAGE |
: (con->flags & CFG_FILE_LINE_POS_USAGE |
| ? con->cur_idx |
? con->cur_idx |
| : (con->fhandle != NULL ? (int) ftell(con->fhandle) : 0)); |
: (con->fhandle != NULL ? (int) ftell(con->fhandle) : 0)); |
| } |
} /* }}} */ |
| |
|
| |
/* Modeline for ViM {{{ |
| |
* vim:set ts=4: |
| |
* vim600:fdm=marker fdl=0 fdc=0: |
| |
* }}} */ |
| |
|
Platon Group <platon@platon.sk> http://platon.sk/
|
|