summaryrefslogtreecommitdiffstats
path: root/utils/mirror_vfd
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-09-15 22:13:18 (GMT)
committerGitHub <noreply@github.com>2023-09-15 22:13:18 (GMT)
commit44a00ef876ad3e1922847e93feac57c479217fbe (patch)
tree5e9fc677913a06a71eba1342633f92e93bd07a6c /utils/mirror_vfd
parent59a90368cdb696205bdf15040d1a48b4f69af97f (diff)
downloadhdf5-44a00ef876ad3e1922847e93feac57c479217fbe.zip
hdf5-44a00ef876ad3e1922847e93feac57c479217fbe.tar.gz
hdf5-44a00ef876ad3e1922847e93feac57c479217fbe.tar.bz2
Strip HD prefix from string/char C API calls (#3540)
* Strip HD prefix from string/char C API calls * HD(f)(put|get)(s|c) * HDstr* * HDv*printf * HD(s)(print|scan)f * HDperror But NOT: * HDstrcase* * HDvasprintf * HDstrtok_r * HDstrndup As those are not C99 and have portability work-around implementations. They will be handled later. * Fix th5_system.c screwup
Diffstat (limited to 'utils/mirror_vfd')
-rw-r--r--utils/mirror_vfd/mirror_remote.c4
-rw-r--r--utils/mirror_vfd/mirror_server.c16
-rw-r--r--utils/mirror_vfd/mirror_server_stop.c20
-rw-r--r--utils/mirror_vfd/mirror_writer.c4
4 files changed, 22 insertions, 22 deletions
diff --git a/utils/mirror_vfd/mirror_remote.c b/utils/mirror_vfd/mirror_remote.c
index 4f87c17..a511527 100644
--- a/utils/mirror_vfd/mirror_remote.c
+++ b/utils/mirror_vfd/mirror_remote.c
@@ -60,7 +60,7 @@ mirror_log(struct mirror_log_info *info, unsigned int level, const char *format,
if (format != NULL) {
va_list args;
va_start(args, format);
- HDvfprintf(stream, format, args);
+ vfprintf(stream, format, args);
va_end(args);
}
@@ -158,7 +158,7 @@ mirror_log_init(char *path, const char *prefix, unsigned int verbosity)
info->prefix[0] = '\0';
if (prefix && *prefix) {
- HDstrncpy(info->prefix, prefix, MIRROR_LOG_PREFIX_MAX);
+ strncpy(info->prefix, prefix, MIRROR_LOG_PREFIX_MAX);
}
if (path && *path) {
diff --git a/utils/mirror_vfd/mirror_server.c b/utils/mirror_vfd/mirror_server.c
index 3bf075a..597e307 100644
--- a/utils/mirror_vfd/mirror_server.c
+++ b/utils/mirror_vfd/mirror_server.c
@@ -187,22 +187,22 @@ parse_args(int argc, char **argv, struct op_args *args_out)
/* Loop over arguments after program name */
for (int i = 1; i < argc; i++) {
- if (!HDstrncmp(argv[i], "-h", 3) || !HDstrncmp(argv[i], "--help", 7)) {
+ if (!strncmp(argv[i], "-h", 3) || !strncmp(argv[i], "--help", 7)) {
mirror_log(NULL, V_INFO, "found help argument");
args_out->help = 1;
return 0;
} /* end if help */
- else if (!HDstrncmp(argv[i], "--port=", 7)) {
+ else if (!strncmp(argv[i], "--port=", 7)) {
mirror_log(NULL, V_INFO, "parsing 'main_port' (%s)", argv[i] + 7);
args_out->main_port = atoi(argv[i] + 7);
} /* end if port */
- else if (!HDstrncmp(argv[i], "--verbosity=", 12)) {
+ else if (!strncmp(argv[i], "--verbosity=", 12)) {
mirror_log(NULL, V_INFO, "parsing 'verbosity' (%s)", argv[i] + 12);
args_out->verbosity = (unsigned int)atoi(argv[i] + 12);
} /* end if verbosity */
- else if (!HDstrncmp(argv[i], "--logpath=", 10)) {
+ else if (!strncmp(argv[i], "--logpath=", 10)) {
mirror_log(NULL, V_INFO, "parsing 'logpath' (%s)", argv[i] + 10);
- HDstrncpy(args_out->log_path, argv[i] + 10, PATH_MAX);
+ strncpy(args_out->log_path, argv[i] + 10, PATH_MAX);
} /* end if logpath */
else {
mirror_log(NULL, V_ERR, "unrecognized argument: %s", argv[i]);
@@ -257,7 +257,7 @@ prepare_listening_socket(struct server_run *run)
mirror_log(run->loginfo, V_INFO, "bind()");
ret = bind(ret_value, (struct sockaddr *)&server_addr, sizeof(server_addr));
if (ret < 0) {
- mirror_log(run->loginfo, V_ERR, "bind() %s", HDstrerror(errno));
+ mirror_log(run->loginfo, V_ERR, "bind() %s", strerror(errno));
goto error;
}
@@ -517,7 +517,7 @@ handle_requests(struct server_run *run)
/* Respond to handshake message.
*/
- if (!HDstrncmp("SHUTDOWN", mybuf, 8)) {
+ if (!strncmp("SHUTDOWN", mybuf, 8)) {
/* Stop operation if told to stop */
mirror_log(run->loginfo, V_INFO, "received SHUTDOWN!", ret);
@@ -533,7 +533,7 @@ handle_requests(struct server_run *run)
connfd = -1;
goto done;
} /* end if explicit "SHUTDOWN" directive */
- if (!HDstrncmp("CONFIRM", mybuf, 7)) {
+ if (!strncmp("CONFIRM", mybuf, 7)) {
/* Confirm operation */
if ((ret = HDwrite(connfd, "ALIVE", 6)) < 0) {
mirror_log(run->loginfo, V_ERR, "write:%d", ret);
diff --git a/utils/mirror_vfd/mirror_server_stop.c b/utils/mirror_vfd/mirror_server_stop.c
index 52dea08..6b2b1b1 100644
--- a/utils/mirror_vfd/mirror_server_stop.c
+++ b/utils/mirror_vfd/mirror_server_stop.c
@@ -89,16 +89,16 @@ parse_args(int argc, char **argv, struct mshs_opts *opts)
opts->magic = MSHS_OPTS_MAGIC;
opts->help = 0;
opts->portno = MSHS_DEFAULT_PORTNO;
- HDstrncpy(opts->ip, MSHS_DEFAULT_IP, MSHS_IP_STR_SIZE);
+ strncpy(opts->ip, MSHS_DEFAULT_IP, MSHS_IP_STR_SIZE);
for (i = 1; i < argc; i++) { /* start with first possible option argument */
- if (!HDstrncmp(argv[i], "-h", 3) || !HDstrncmp(argv[i], "--help", 7)) {
+ if (!strncmp(argv[i], "-h", 3) || !strncmp(argv[i], "--help", 7)) {
opts->help = 1;
}
- else if (!HDstrncmp(argv[i], "--ip=", 5)) {
- HDstrncpy(opts->ip, argv[i] + 5, MSHS_IP_STR_SIZE);
+ else if (!strncmp(argv[i], "--ip=", 5)) {
+ strncpy(opts->ip, argv[i] + 5, MSHS_IP_STR_SIZE);
}
- else if (!HDstrncmp(argv[i], "--port=", 7)) {
+ else if (!strncmp(argv[i], "--port=", 7)) {
opts->portno = atoi(argv[i] + 7);
}
else {
@@ -110,8 +110,8 @@ parse_args(int argc, char **argv, struct mshs_opts *opts)
} /* end for each argument from command line */
/* auto-replace 'localhost' with numeric IP */
- if (!HDstrncmp(opts->ip, "localhost", 10)) { /* include null terminator */
- HDstrncpy(opts->ip, "127.0.0.1", MSHS_IP_STR_SIZE);
+ if (!strncmp(opts->ip, "localhost", 10)) { /* include null terminator */
+ strncpy(opts->ip, "127.0.0.1", MSHS_IP_STR_SIZE);
}
return 0;
@@ -149,12 +149,12 @@ send_shutdown(struct mshs_opts *opts)
memset(target_addr.sin_zero, 0, sizeof(target_addr.sin_zero));
if (connect(live_socket, (struct sockaddr *)&target_addr, (socklen_t)sizeof(target_addr)) < 0) {
- printf("ERROR connect() (%d)\n%s\n", errno, HDstrerror(errno));
+ printf("ERROR connect() (%d)\n%s\n", errno, strerror(errno));
return -1;
}
if (HDwrite(live_socket, "SHUTDOWN", 9) == -1) {
- printf("ERROR write() (%d)\n%s\n", errno, HDstrerror(errno));
+ printf("ERROR write() (%d)\n%s\n", errno, strerror(errno));
return -1;
}
@@ -163,7 +163,7 @@ send_shutdown(struct mshs_opts *opts)
printf("ERROR read() can't receive data\n");
return -1;
}
- if (HDstrncmp("CLOSING", mybuf, 8)) {
+ if (strncmp("CLOSING", mybuf, 8)) {
printf("ERROR read() didn't receive data from server\n");
return -1;
}
diff --git a/utils/mirror_vfd/mirror_writer.c b/utils/mirror_vfd/mirror_writer.c
index 2acc166..28f7e1f 100644
--- a/utils/mirror_vfd/mirror_writer.c
+++ b/utils/mirror_vfd/mirror_writer.c
@@ -382,7 +382,7 @@ reply_error(struct mirror_session *session, const char *msg)
mirror_log(session->loginfo, V_ALL, "reply_error(%s)", msg);
reply->status = H5FD_MIRROR_STATUS_ERROR;
- HDsnprintf(reply->message, H5FD_MIRROR_STATUS_MESSAGE_MAX - 1, "%s", msg);
+ snprintf(reply->message, H5FD_MIRROR_STATUS_MESSAGE_MAX - 1, "%s", msg);
return _xmit_reply(session);
} /* end reply_error() */
@@ -838,7 +838,7 @@ receive_communique(struct mirror_session *session, struct sock_comm *comm)
} /* end if hexdump transmissions received */
/* old-fashioned manual kill (for debugging) */
- if (!HDstrncmp("GOODBYE", comm->raw, 7)) {
+ if (!strncmp("GOODBYE", comm->raw, 7)) {
mirror_log(session->loginfo, V_INFO, "received GOODBYE");
comm->recd_die = 1;
goto done;