Skip to content

Commit

Permalink
redfishpower: remove --hostsfile option
Browse files Browse the repository at this point in the history
Problem: The redfishpower --hostsfile option is oddly included in the
project as an option.  The suspicion is it was copy and paste from
another project.  The short option for the option is not configured,
but the long option is.  It is not documented in --help output, but is
oddly documented in the manpage.

Drop the option.
  • Loading branch information
chu11 committed Feb 6, 2024
1 parent 23ac44d commit a915e5b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 47 deletions.
6 changes: 0 additions & 6 deletions man/redfishpower.8.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ set simultaneously is limited by the file descriptor limit of the
.B select(2)
system call.
.TP
.I "-f, --hostsfile file"
Alternate option to
.I --hostname,
specify a file with all hosts. File shall have one host or hostrange
listed per line.
.TP
.I "-H, --header string"
Set extra HEADER to use.
.TP
Expand Down
41 changes: 0 additions & 41 deletions src/redfishpower/redfishpower.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ struct powermsg {
#define OPTIONS "h:H:S:O:F:C:P:G:D:v"
static struct option longopts[] = {
{"hostname", required_argument, 0, 'h' },
{"hostsfile", required_argument, 0, 'f' },
{"header", required_argument, 0, 'H' },
{"statpath", required_argument, 0, 'S' },
{"onpath", required_argument, 0, 'O' },
Expand Down Expand Up @@ -878,43 +877,6 @@ static void usage(void)
exit(1);
}

/* copied from xread.c */
static void _remove_trailing_whitespace(char *s)
{
char *p = s + strlen(s) - 1;

while (p >= s && isspace(*p))
*p-- = '\0';
}

static void readhostsfile(const char *file)
{
char buf[1024];
FILE *stream;

if (!hosts) {
if (!(hosts = hostlist_create(NULL)))
err_exit(true, "hostlist_create");
}

if (!(stream = fopen(file, "r")))
err_exit(true, "error opening file %s", file);

while (fgets(buf, 1024, stream)) {
_remove_trailing_whitespace(buf);
/* ignore empty lines */
if (strlen(buf) == 0)
continue;
/* ignore commented lines */
if (buf[0] == '#')
continue;
if (!hostlist_push(hosts, buf))
err_exit(true, "hostlist_push error on %s", optarg);
}

fclose(stream);
}

int main(int argc, char *argv[])
{
CURLM *mh;
Expand All @@ -935,9 +897,6 @@ int main(int argc, char *argv[])
err_exit(true, "hostlist_create error on %s", optarg);
}
break;
case 'f': /* --hostsfile */
readhostsfile(optarg);
break;
case 'H': /* --header */
header = xstrdup(optarg);
break;
Expand Down

0 comments on commit a915e5b

Please sign in to comment.