Ejemplo n.º 1
0
static inline int parse_config (const char *cfgstr, const char *arg)
{
  if(!cfgstr || !cfgstr[0])
    return(usage(1, "ERROR: need argument for option: ", arg));

  if(zbar_processor_parse_config(processor, cfgstr))
    return(usage(1, "ERROR: invalid configuration setting: ", cfgstr));

  return(0);
}
Ejemplo n.º 2
0
static inline int parse_config (const char *cfgstr, int i, int n, char *arg)
{
    if(i >= n || !*cfgstr) {
        fprintf(stderr, "ERROR: need argument for option: %s\n", arg);
        return(1);
    }
    
    if(zbar_processor_parse_config(proc, cfgstr)) {
        fprintf(stderr, "ERROR: invalid configuration setting: %s\n", cfgstr);
        return(1);
    }
    return(0);
}
Ejemplo n.º 3
0
static PyObject*
processor_parse_config (zbarProcessor *self,
                        PyObject *args,
                        PyObject *kwds)
{
    const char *cfg = NULL;
    static char *kwlist[] = { "config", NULL };
    if(!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &cfg))
        return(NULL);

    if(zbar_processor_parse_config(self->zproc, cfg)) {
        PyErr_Format(PyExc_ValueError, "invalid configuration setting: %s",
                     cfg);
        return(NULL);
    }
    Py_RETURN_NONE;
}