mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-07-31 02:43:06 +03:00
Initialize pseudo random number generator with current time or optional command line parameter
This commit is contained in:
committed by
Daniel Veillard
parent
90e8b9066d
commit
3fcf11ead6
@ -514,6 +514,7 @@ static void usage(const char *name) {
|
|||||||
printf("\t--maxdepth val : increase the maximum depth (default %d)\n", xsltMaxDepth);
|
printf("\t--maxdepth val : increase the maximum depth (default %d)\n", xsltMaxDepth);
|
||||||
printf("\t--maxvars val : increase the maximum variables (default %d)\n", xsltMaxVars);
|
printf("\t--maxvars val : increase the maximum variables (default %d)\n", xsltMaxVars);
|
||||||
printf("\t--maxparserdepth val : increase the maximum parser depth\n");
|
printf("\t--maxparserdepth val : increase the maximum parser depth\n");
|
||||||
|
printf("\t--seed-rand val : initialize pseudo random number generator with specific seed\n");
|
||||||
#ifdef LIBXML_HTML_ENABLED
|
#ifdef LIBXML_HTML_ENABLED
|
||||||
printf("\t--html: the input document is(are) an HTML file(s)\n");
|
printf("\t--html: the input document is(are) an HTML file(s)\n");
|
||||||
#endif
|
#endif
|
||||||
@ -556,6 +557,7 @@ main(int argc, char **argv)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
srand(time(NULL));
|
||||||
xmlInitMemory();
|
xmlInitMemory();
|
||||||
|
|
||||||
LIBXML_TEST_VERSION
|
LIBXML_TEST_VERSION
|
||||||
@ -750,6 +752,15 @@ main(int argc, char **argv)
|
|||||||
if (value > 0)
|
if (value > 0)
|
||||||
xmlParserMaxDepth = value;
|
xmlParserMaxDepth = value;
|
||||||
}
|
}
|
||||||
|
} else if ((!strcmp(argv[i], "-seed-rand")) ||
|
||||||
|
(!strcmp(argv[i], "--seed-rand"))) {
|
||||||
|
int value;
|
||||||
|
|
||||||
|
i++;
|
||||||
|
if (sscanf(argv[i], "%d", &value) == 1) {
|
||||||
|
if (value > 0)
|
||||||
|
srand(value);
|
||||||
|
}
|
||||||
} else if ((!strcmp(argv[i],"-dumpextensions"))||
|
} else if ((!strcmp(argv[i],"-dumpextensions"))||
|
||||||
(!strcmp(argv[i],"--dumpextensions"))) {
|
(!strcmp(argv[i],"--dumpextensions"))) {
|
||||||
dumpextensions++;
|
dumpextensions++;
|
||||||
@ -786,6 +797,10 @@ main(int argc, char **argv)
|
|||||||
(!strcmp(argv[i], "--maxparserdepth"))) {
|
(!strcmp(argv[i], "--maxparserdepth"))) {
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
} else if ((!strcmp(argv[i], "-seed-rand")) ||
|
||||||
|
(!strcmp(argv[i], "--seed-rand"))) {
|
||||||
|
i++;
|
||||||
|
continue;
|
||||||
} else if ((!strcmp(argv[i], "-o")) ||
|
} else if ((!strcmp(argv[i], "-o")) ||
|
||||||
(!strcmp(argv[i], "-output")) ||
|
(!strcmp(argv[i], "-output")) ||
|
||||||
(!strcmp(argv[i], "--output"))) {
|
(!strcmp(argv[i], "--output"))) {
|
||||||
|
Reference in New Issue
Block a user