mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
windows portability fix (review by mgraff)
This commit is contained in:
parent
9edd523c22
commit
2a3574f8d4
2 changed files with 33 additions and 9 deletions
|
|
@ -14,7 +14,7 @@
|
|||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dnssec-revoke.c,v 1.5 2009/07/19 04:18:04 each Exp $ */
|
||||
/* $Id: dnssec-revoke.c,v 1.6 2009/07/19 05:26:05 each Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
|
|
@ -133,6 +133,7 @@ main(int argc, char **argv) {
|
|||
#endif
|
||||
|
||||
dir = strdup(argv[isc_commandline_index]);
|
||||
filename = dir;
|
||||
|
||||
/* Figure out the directory name from the key name */
|
||||
slash = strrchr(dir, '/');
|
||||
|
|
@ -142,16 +143,15 @@ main(int argc, char **argv) {
|
|||
(slash == NULL && backslash != NULL))
|
||||
slash = backslash;
|
||||
#endif
|
||||
if (slash != NULL)
|
||||
if (slash != NULL) {
|
||||
*slash++ = '\0';
|
||||
else {
|
||||
filename = slash;
|
||||
} else {
|
||||
free(dir);
|
||||
dir = strdup(".");
|
||||
}
|
||||
}
|
||||
|
||||
filename = argv[isc_commandline_index];
|
||||
|
||||
if (ectx == NULL)
|
||||
setup_entropy(mctx, NULL, &ectx);
|
||||
result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: dnssec-settime.c,v 1.3 2009/07/19 05:06:48 each Exp $ */
|
||||
/* $Id: dnssec-settime.c,v 1.4 2009/07/19 05:26:05 each Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
|
|
@ -179,9 +179,33 @@ main(int argc, char **argv) {
|
|||
if (argc > isc_commandline_index + 1)
|
||||
fatal("Extraneous arguments");
|
||||
|
||||
if (directory == NULL)
|
||||
directory = dirname(argv[isc_commandline_index]);
|
||||
filename = basename(argv[isc_commandline_index]);
|
||||
if (directory == NULL) {
|
||||
char *slash;
|
||||
#ifdef _WIN32
|
||||
char *backslash;
|
||||
#endif
|
||||
|
||||
directory = strdup(argv[isc_commandline_index]);
|
||||
filename = directory;
|
||||
|
||||
/* Figure out the directory name from the key name */
|
||||
slash = strrchr(directory, '/');
|
||||
#ifdef _WIN32
|
||||
backslash = strrchr(directory, '\\');
|
||||
if ((slash != NULL && backslash != NULL && backslash > slash) ||
|
||||
(slash == NULL && backslash != NULL))
|
||||
slash = backslash;
|
||||
#endif
|
||||
if (slash != NULL) {
|
||||
*slash++ = '\0';
|
||||
filename = slash;
|
||||
} else {
|
||||
free(directory);
|
||||
directory = strdup(".");
|
||||
}
|
||||
}
|
||||
|
||||
filename = argv[isc_commandline_index];
|
||||
|
||||
if (ectx == NULL)
|
||||
setup_entropy(mctx, NULL, &ectx);
|
||||
|
|
|
|||
Loading…
Reference in a new issue