mirror of
https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git
synced 2024-12-14 12:25:51 +08:00
d9c56d3ca0
badblocks.c, chattr.c, dumpe2fs.c, e2label.c, findsuper.c, fsck.c, get_device_by_label.c, lsattr.c, mke2fs.c, mklost+found.c, nls-enable.h, partinfo.c, tune2fs.c, uuidgen.c: Add Internationalization support as suggested by Marco d'Itri <md@linux.it>.
66 lines
1.0 KiB
C
66 lines
1.0 KiB
C
/*
|
|
* gen_uuid.c --- generate a DCE-compatible uuid
|
|
*
|
|
* Copyright (C) 1999, Andreas Dilger and Theodore Ts'o
|
|
*
|
|
* %Begin-Header%
|
|
* This file may be redistributed under the terms of the GNU Public
|
|
* License.
|
|
* %End-Header%
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#ifdef HAVE_GETOPT_H
|
|
#include <getopt.h>
|
|
#endif
|
|
#include "uuid/uuid.h"
|
|
#include "nls-enable.h"
|
|
|
|
#define DO_TYPE_TIME 1
|
|
#define DO_TYPE_RANDOM 2
|
|
|
|
void usage(const char *progname)
|
|
{
|
|
fprintf(stderr, _("Usage: %s [-r] [-t]\n"), progname);
|
|
exit(1);
|
|
}
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
int c;
|
|
int do_type = 0;
|
|
char str[37];
|
|
uuid_t uu;
|
|
|
|
while ((c = getopt (argc, argv, "tr")) != EOF)
|
|
switch (c) {
|
|
case 't':
|
|
do_type = DO_TYPE_TIME;
|
|
break;
|
|
case 'r':
|
|
do_type = DO_TYPE_RANDOM;
|
|
break;
|
|
default:
|
|
usage(argv[0]);
|
|
}
|
|
|
|
switch (do_type) {
|
|
case DO_TYPE_TIME:
|
|
uuid_generate_time(uu);
|
|
break;
|
|
case DO_TYPE_RANDOM:
|
|
uuid_generate_random(uu);
|
|
break;
|
|
default:
|
|
uuid_generate(uu);
|
|
break;
|
|
}
|
|
|
|
uuid_unparse(uu, str);
|
|
|
|
printf("%s\n", str);
|
|
|
|
return 0;
|
|
}
|