Skip to content

Commit

Permalink
Merge pull request #123 from chu11/redfishpower_hostsfile
Browse files Browse the repository at this point in the history
redfishpower: remove --hostsfile option
  • Loading branch information
mergify[bot] committed Feb 6, 2024
2 parents 7ae1f5d + dabcb86 commit c265416
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 c265416

Please sign in to comment.