int test_init(const struct test *start, const struct test *stop, int argc,
char *const argv[])
{
+ int c;
+
progname = argv[0];
/* An empty testsuite is not likely intended */
return -EINVAL;
}
- for (;;) {
- int c, idx = 0;
- c = getopt_long(argc, argv, options_short, options, &idx);
- if (c == -1)
- break;
+ while ((c = getopt_long(argc, argv, options_short, options, NULL)) != -1) {
switch (c) {
case 'l':
test_list(start, stop);
static int do_depmod(int argc, char *argv[])
{
FILE *out = NULL;
- int err = 0, all = 0, maybe_all = 0, n_config_paths = 0;
+ int c, err = 0, all = 0, maybe_all = 0, n_config_paths = 0;
_cleanup_free_ char *root_arg = NULL;
_cleanup_free_ char *out_root = NULL;
_cleanup_free_ const char **config_paths = NULL;
memset(&cfg, 0, sizeof(cfg));
memset(&depmod, 0, sizeof(depmod));
- for (;;) {
- int c, idx = 0;
- c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx);
- if (c == -1)
- break;
+ while ((c = getopt_long(argc, argv, cmdopts_s, cmdopts, NULL)) != -1) {
switch (c) {
case 'a':
all = 1;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <shared/util.h>
#include <shared/missing.h>
static int handle_kmod_commands(int argc, char *argv[])
{
const char *cmd;
- int err = 0;
+ int err = 0, c;
size_t i;
- for (;;) {
- int c;
-
- c = getopt_long(argc, argv, options_s, options, NULL);
- if (c == -1)
- break;
-
+ while ((c = getopt_long(argc, argv, options_s, options, NULL)) != -1) {
switch (c) {
case 'h':
kmod_help(argc, argv);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <sys/stat.h>
#include <sys/utsname.h>
const char *root = NULL;
const char *null_config = NULL;
bool arg_is_modname = false;
- int i, err;
+ int i, err, c;
- for (;;) {
- int c, idx = 0;
- c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx);
- if (c == -1)
- break;
+ while ((c = getopt_long(argc, argv, cmdopts_s, cmdopts, NULL)) != -1) {
switch (c) {
case 'a':
field = "author";
int do_show_config = 0;
int do_show_modversions = 0;
int do_show_exports = 0;
- int err;
+ int err, c;
struct stat stat_buf;
bool use_syslog = false;
return EXIT_FAILURE;
}
- for (;;) {
- int c, idx = 0;
- c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx);
- if (c == -1)
- break;
+ while ((c = getopt_long(argc, argv, cmdopts_s, cmdopts, NULL)) != -1) {
switch (c) {
case 'a':
log_priority = LOG_WARNING;
FILE *in = NULL, *out = NULL;
const struct static_nodes_format *format = &static_nodes_format_human;
int r, ret = EXIT_SUCCESS;
+ int c, valid;
- for (;;) {
- int c, idx = 0, valid;
- size_t i;
-
- c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx);
- if (c == -1) {
- break;
- }
+ while ((c = getopt_long(argc, argv, cmdopts_s, cmdopts, NULL)) != -1) {
switch (c) {
case 'o':
output = optarg;
case 'f':
valid = 0;
- for (i = 0; i < ARRAY_SIZE(static_nodes_formats); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(static_nodes_formats); i++) {
if (streq(static_nodes_formats[i]->name, optarg)) {
format = static_nodes_formats[i];
valid = 1;