Ejemplo n.º 1
0
Archivo: ui.c Proyecto: bcl/parted
int
command_line_get_unit (const char* prompt, PedUnit* unit)
{
        StrList*       opts = NULL;
        PedUnit        walk;
        char*          unit_name;
        const char*    default_unit_name;

        for (walk = PED_UNIT_FIRST; walk <= PED_UNIT_LAST; walk++)
                opts = str_list_append (opts, ped_unit_get_name (walk));

        default_unit_name = ped_unit_get_name (ped_unit_get_default ());
        unit_name = command_line_get_word (prompt, default_unit_name, opts, 1);
        str_list_destroy (opts);

        if (unit_name) {
                *unit = ped_unit_get_by_name (unit_name);
                free (unit_name);
                return 1;
        } else
                return 0;
}
Ejemplo n.º 2
0
PyObject *py_ped_unit_get_default(PyObject *s, PyObject *args) {
    return PyLong_FromLong(ped_unit_get_default());
}