Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redfishpower: remove --hostsfile option #123

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading