fclose(f);
}
+static int get_setting(const char *name, int def)
+{
+ const char *value;
+
+ value = getenv(name);
+ if (!value || !*value) return def;
+ if (strcmp(value, "yes") == 0) return 1;
+ if (strcmp(value, "no") == 0) return 0;
+
+ fprintf(stderr, "warning: invalid $%s value: %s\n", name, value);
+ return 0;
+}
+
+int get_setting_use_network(void)
+{
+ /* set $USENETWORK to "yes" or "no" to indicate whether
+ * an internet connection is to be expected; defaults to "no"
+ */
+ return get_setting("USENETWORK", 0);
+}
void rm_rf_ppdir(int test_nr);
void start(int test_nr);
void getmem(uint32_t *total, uint32_t *free, uint32_t *cached);
+int get_setting_use_network(void);
extern int common_test_nr, errct, subtest;
}
}
-static int can_use_network(void)
-{
- const char *usenet;
-
- /* set $USENETWORK to "yes" or "no" to indicate whether
- * an internet connection is to be expected; defaults to "no"
- */
- usenet = getenv("USENETWORK");
- if (!usenet || !*usenet) return 0; /* default: disable network */
- if (strcmp(usenet, "yes") == 0) return 1; /* network enabled */
- if (strcmp(usenet, "no") == 0) return 0; /* network disabled */
-
- fprintf(stderr, "warning: invalid $USENETWORK value: %s\n", usenet);
- return 0;
-}
-
int main(void)
{
int use_network;
start(48);
- use_network = can_use_network();
+ use_network = get_setting_use_network();
test_getaddrinfo_all(use_network);
test_getnameinfo_all();