int main(int argc, char** argv)
{
    int c;
    int id, tableid;
    int owner;

    char *db_name = "midgard";
    char *db_user = "******";
    char *db_pass = "******";
    char *mgd_username = "";
    char *mgd_pass = "";

    char *objtype = NULL;

    midgard *mgd;

    while ((c = getopt (argc, argv, "?D:U:P:u:p:")) != -1) {
        switch (c) {
        case 'D':
            db_name = strdup(optarg);
            break;

        case 'U':
            db_user = strdup(optarg);
            break;

        case 'P':
            db_pass = strdup(optarg);
            break;

        case 'u':
            mgd_username = strdup(optarg);
            break;

        case 'p':
            mgd_pass = strdup(optarg);
            break;

        case '?':
            Usage(argv[0]);
            exit(1);

        default:
            printf("Unexpected option '%c'\n", c);
            Usage(argv[0]);
            exit(1);
        }
    }

    if ((argc - optind) == 2) {
        objtype = argv[optind];
        id = atol(argv[optind+1]);
    } else {
        Usage(argv[0]);
        exit(1);
    }

    mgd_init();
    printf("Connecting to mysql://%s:%s@localhost/%s\n", db_user, db_pass, db_name);
    mgd = mgd_connect(NULL,db_name,db_user,db_pass);
    if(!mgd) {
        printf("Error in DB connection\n");
        exit(1);
    }

    /* We select russian parser in order to dump content unchanged */
    mgd_select_parser(mgd, "russian");

    if (*mgd_username || *mgd_pass) {
        mgd_auth(mgd, mgd_username, mgd_pass, 0);
    }








    printf("User '%s' (%d) has %sownership of %s(%d)/%d\n",
           mgd_username, mgd_user(mgd),
           owner ? "" : "no ",
           objtype, tableid, id);

    mgd_close(mgd);
    mgd_done();

    return 0;
}
static void setup(void) { 
        mgd_init();
        mgdlib_init();
        mgd = mgd_connect("localhost", "midgard", "midgard", "midgard");
}