Esempio n. 1
0
const char *wrt_ifname(const char *name)
{
	static char bridge[128];
	char *type;
	char *device;

	do {
		type = uci_get("network.%s.type", name);
		if (type && strcmp(type, "bridge") == 0) {
			snprintf(bridge, sizeof(bridge), "br-%s", name);
			return bridge;
		}

		device = uci_get("network.%s.ifname", name);
		if (!device || !device[0]) {
			fprintf(stderr, "wrt_ifname: could not map %s\n", name);
			return name;
		}

		name = device;
	} while (name[0] == '@');

	fprintf(stderr, "wrt_ifname: mapped to %s\n", name);

	return name;
}
Esempio n. 2
0
void
assignGlobalStartupValues ()
{
  global.uploadkb = 0;		/* how big an upload do we allow (0 for none)   */
  global.shell = SUBSHELL_CMD;	/* The shell we use                             */
  global.silent = FALSE;	/* We do print errors if we find them           */
  global.uploaddir = TEMPDIR;	/* where to upload to                           */
  global.uploadhandler = NULL;	/* the upload handler                           */
  global.debug = FALSE;		/* Not in debug mode.                           */
  global.acceptall = FALSE;	/* don't allow POST data for GET method         */
  global.uploadlist = NULL;	/* we don't have any uploaded files             */
  global.var_prefix = "FORM_";
  global.get_prefix = "GET_";
  global.post_prefix = "POST_";
  global.cookie_prefix = "COOKIE_";
  global.nul_prefix = "";
  // translationKV_map gets filled only if a <%~ translation %> tag is found; and unknowable until preprocessing

  uci_init();

  global.webroot=uci_get("gargoyle", "global", "web_root");
  global.fallback_lang=uci_get("gargoyle", "global", "fallback_lang");
  global.active_lang=uci_get("gargoyle", "global", "language");
}