2 * gen_uuid.c --- generate a DCE-compatible uuid
4 * Copyright (C) 1999, Andreas Dilger and Theodore Ts'o
7 * This file may be redistributed under the terms of the GNU Public
20 extern int getopt(int argc
, char * const argv
[], const char *optstring
);
24 #include "uuid/uuid.h"
25 #include "support/nls-enable.h"
27 #define DO_TYPE_TIME 1
28 #define DO_TYPE_RANDOM 2
30 static void usage(const char *progname
)
32 fprintf(stderr
, _("Usage: %s [-r] [-t]\n"), progname
);
37 main (int argc
, char *argv
[])
45 setlocale(LC_MESSAGES
, "");
46 setlocale(LC_CTYPE
, "");
47 bindtextdomain(NLS_CAT_NAME
, LOCALEDIR
);
48 textdomain(NLS_CAT_NAME
);
51 while ((c
= getopt (argc
, argv
, "tr")) != EOF
)
54 do_type
= DO_TYPE_TIME
;
57 do_type
= DO_TYPE_RANDOM
;
65 uuid_generate_time(uu
);
68 uuid_generate_random(uu
);
75 uuid_unparse(uu
, str
);