404

[ Avaa Bypassed ]




Upload:

Command:

botdev@3.147.78.134: ~ $
/*
 * Copyright (C) 2002-2005 Roman Zippel <zippel@linux-m68k.org>
 * Copyright (C) 2002-2005 Sam Ravnborg <sam@ravnborg.org>
 *
 * Released under the terms of the GNU GPL v2.0.
 */

#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "lkc.h"

/* file already present in list? If not add it */
struct file *file_lookup(const char *name)
{
	struct file *file;
	const char *file_name = sym_expand_string_value(name);

	for (file = file_list; file; file = file->next) {
		if (!strcmp(name, file->name)) {
			free((void *)file_name);
			return file;
		}
	}

	file = xmalloc(sizeof(*file));
	memset(file, 0, sizeof(*file));
	file->name = file_name;
	file->next = file_list;
	file_list = file;
	return file;
}

/* write a dependency file as used by kbuild to track dependencies */
int file_write_dep(const char *name)
{
	struct symbol *sym, *env_sym;
	struct expr *e;
	struct file *file;
	FILE *out;

	if (!name)
		name = ".kconfig.d";
	out = fopen("..config.tmp", "w");
	if (!out)
		return 1;
	fprintf(out, "deps_config := \\\n");
	for (file = file_list; file; file = file->next) {
		if (file->next)
			fprintf(out, "\t%s \\\n", file->name);
		else
			fprintf(out, "\t%s\n", file->name);
	}
	fprintf(out, "\n%s: \\\n"
		     "\t$(deps_config)\n\n", conf_get_autoconfig_name());

	expr_list_for_each_sym(sym_env_list, e, sym) {
		struct property *prop;
		const char *value;

		prop = sym_get_env_prop(sym);
		env_sym = prop_get_symbol(prop);
		if (!env_sym)
			continue;
		value = getenv(env_sym->name);
		if (!value)
			value = "";
		fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value);
		fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name());
		fprintf(out, "endif\n");
	}

	fprintf(out, "\n$(deps_config): ;\n");
	fclose(out);
	rename("..config.tmp", name);
	return 0;
}


/* Allocate initial growable string */
struct gstr str_new(void)
{
	struct gstr gs;
	gs.s = xmalloc(sizeof(char) * 64);
	gs.len = 64;
	gs.max_width = 0;
	strcpy(gs.s, "\0");
	return gs;
}

/* Free storage for growable string */
void str_free(struct gstr *gs)
{
	if (gs->s)
		free(gs->s);
	gs->s = NULL;
	gs->len = 0;
}

/* Append to growable string */
void str_append(struct gstr *gs, const char *s)
{
	size_t l;
	if (s) {
		l = strlen(gs->s) + strlen(s) + 1;
		if (l > gs->len) {
			gs->s   = realloc(gs->s, l);
			gs->len = l;
		}
		strcat(gs->s, s);
	}
}

/* Append printf formatted string to growable string */
void str_printf(struct gstr *gs, const char *fmt, ...)
{
	va_list ap;
	char s[10000]; /* big enough... */
	va_start(ap, fmt);
	vsnprintf(s, sizeof(s), fmt, ap);
	str_append(gs, s);
	va_end(ap);
}

/* Retrieve value of growable string */
const char *str_get(struct gstr *gs)
{
	return gs->s;
}

void *xmalloc(size_t size)
{
	void *p = malloc(size);
	if (p)
		return p;
	fprintf(stderr, "Out of memory.\n");
	exit(1);
}

void *xcalloc(size_t nmemb, size_t size)
{
	void *p = calloc(nmemb, size);
	if (p)
		return p;
	fprintf(stderr, "Out of memory.\n");
	exit(1);
}

Filemanager

Name Type Size Permission Actions
lxdialog Folder 0755
.conf.cmd File 110 B 0644
.conf.o.cmd File 5.42 KB 0644
.zconf.tab.o.cmd File 6.17 KB 0644
Makefile File 10.69 KB 0644
POTFILES.in File 361 B 0644
check.sh File 249 B 0755
conf File 120.25 KB 0755
conf.c File 15.75 KB 0644
conf.o File 25.48 KB 0644
confdata.c File 25.65 KB 0644
expr.c File 27.25 KB 0644
expr.h File 7.07 KB 0644
gconf.c File 38.17 KB 0644
gconf.glade File 25.04 KB 0644
images.c File 6.41 KB 0644
kconf_id.c File 1.89 KB 0644
kxgettext.c File 4.1 KB 0644
list.h File 3.66 KB 0644
lkc.h File 4.48 KB 0644
lkc_proto.h File 2.14 KB 0644
mconf.c File 27.74 KB 0644
menu.c File 17.53 KB 0644
merge_config.sh File 4.2 KB 0755
nconf.c File 38.54 KB 0644
nconf.gui.c File 14.77 KB 0644
nconf.h File 1.87 KB 0644
qconf.cc File 44.17 KB 0644
qconf.h File 7.37 KB 0644
streamline_config.pl File 16.17 KB 0755
symbol.c File 30.35 KB 0644
util.c File 2.91 KB 0644
zconf.l File 6.9 KB 0644
zconf.lex.c File 58.46 KB 0644
zconf.lex.c_shipped File 58.46 KB 0644
zconf.tab.c File 70.17 KB 0644
zconf.tab.c_shipped File 70.17 KB 0644
zconf.tab.o File 162.52 KB 0644
zconf.y File 16.01 KB 0644