static int choose_country(void) { if (country) free(country); country = NULL; #if defined (WITH_FTP_MANUAL) assert(protocol != NULL); if (strcasecmp(protocol,"ftp") == 0) return 0; #endif debconf_get(debconf, DEBCONF_BASE "country"); if (! strlen(debconf->value)) { /* Not set yet. Seed with a default value. */ if ((debconf_get(debconf, "debian-installer/country") == 0) && (debconf->value != NULL) ) { country = strdup (debconf->value); debconf_set(debconf, DEBCONF_BASE "country", country); } } else { country = debconf->value; } /* Ensure 'country' is set to something. */ if (country == NULL || *country == 0) { country = "GB"; } char *countries; countries = add_protocol("countries"); if (has_mirror(country)) { const char *default_country = MANUAL_ENTRY; /* TODO: duplicates much of mirrors_in and has_mirror, since * those don't let us get the country at the moment */ if (strcmp(country, MANUAL_ENTRY) != 0 && strcmp(country, MANUAL_ENTRY_OLD) != 0) { int i = 0; struct mirror_t *mirrors = mirror_list(); for (i = 0; mirrors[i].country != NULL; i++) { if (strcmp(mirrors[i].country, country) == 0 || mirrors[i].wildcard) { default_country = mirrors[i].country; break; } } } debconf_set(debconf, countries, default_country); debconf_fget(debconf, DEBCONF_BASE "country", "seen"); debconf_fset(debconf, countries, "seen", debconf->value); } debconf_input(debconf, base_on_cd ? "medium" : "high", countries); free (countries); return 0; }
void IsolateObj::static_int_field_put(int offset, int value) { Task::Raw this_task = task(); GUARANTEE(!this_task.is_null(), "Task is null"); ObjArray::Raw mirror_list = this_task().mirror_list(); GUARANTEE(!mirror_list.is_null(), "Null Mirror list"); TaskMirror::Raw tm = mirror_list().obj_at(Universe::isolate_class()->class_id()); GUARANTEE(!tm.is_null(), "null task mirror"); tm().int_field_put(offset, value); }
/* Returns the root of the mirror, given the hostname. */ static char *mirror_root(char *mirror) { int i; struct mirror_t *mirrors = mirror_list(); for (i = 0; mirrors[i].site != NULL; i++) if (strcmp(mirrors[i].site, mirror) == 0) return mirrors[i].root; return NULL; }
jint IsolateObj::static_int_field(int offset) const { Task::Raw this_task = task(); GUARANTEE(!this_task.is_null(), "Task is null"); ObjArray::Raw mirror_list = this_task().mirror_list(); GUARANTEE(!mirror_list.is_null(), "Null Mirror list"); TaskMirror::Raw tm = mirror_list().obj_at(Universe::isolate_class()->class_id()); GUARANTEE(!tm.is_null(), "null task mirror"); return tm().int_field(offset); }