Ejemplo n.º 1
0
int
zconfig_save (zconfig_t *self, const char *filename)
{
    assert (self);

    int rc = 0;
    if (streq (filename, "-"))
        //  "-" means write to stdout
        rc = zconfig_execute (self, s_config_save, stdout);
    else {
        FILE *file;
        file = fopen (filename, "w");
        if (file) {
            rc = zconfig_execute (self, s_config_save, file);
            fflush (file);
            fclose (file);

            //  If we saved back to original file, restat it so that
            //  the file does not appear as "changed"
            if (self->file && streq (filename, zconfig_filename (self)))
                zfile_restat (self->file);
        }
        else
            rc = -1;          //  File not writeable
    }
    return rc;
}
Ejemplo n.º 2
0
int
zconfig_save (zconfig_t *self, char *filename)
{
    assert (self);

    int rc = 0;
    if (streq (filename, "-")) {
        //  "-" means write to stdout
        rc = zconfig_execute (self, s_config_save, stdout);
    }
    else {
        FILE *file;
        file = fopen (filename, "w");
        if (file)
            rc = zconfig_execute (self, s_config_save, file);
        else
            rc = -1;          //  File not writeable
    }
    return rc;
}
Ejemplo n.º 3
0
void
zconfig_fprint (zconfig_t *self, FILE *file)
{
    zconfig_execute (self, s_config_save, file);
}
Ejemplo n.º 4
0
///
//  Execute a callback for each config item in the tree; returns zero if
//  successful, else -1.                                                
int QmlZconfig::execute (zconfig_fct handler, void *arg) {
    return zconfig_execute (self, handler, arg);
};
Ejemplo n.º 5
0
JNIEXPORT jint JNICALL
Java_zconfig__1_1execute (JNIEnv *env, jclass c, jlong self, jlong handler, jlong arg)
{
    jint execute_ = (jint) zconfig_execute ((zconfig_t *) self, (zconfig_fct *) handler, (void *) arg);
    return execute_;
}
Ejemplo n.º 6
0
void
zconfig_dump (zconfig_t *self)
{
    zconfig_execute (self, s_config_save, stderr);
}