isolate and show busybox`s changes

This commit is contained in:
"Vladimir N. Oleynik" 2006-02-16 14:28:17 +00:00
parent 5c1cd5fdd3
commit cb9b114d35

View File

@ -279,7 +279,10 @@ int conf_write(const char *name)
char dirname[128], tmpname[128], newname[128]; char dirname[128], tmpname[128], newname[128];
int type, l; int type, l;
const char *str; const char *str;
/* busybox`s code */
const char *opt_name; const char *opt_name;
int use_flg;
dirname[0] = 0; dirname[0] = 0;
if (name && name[0]) { if (name && name[0]) {
@ -316,6 +319,8 @@ int conf_write(const char *name)
fprintf(out, "#\n" fprintf(out, "#\n"
"# Automatically generated make config: don't edit\n" "# Automatically generated make config: don't edit\n"
"#\n"); "#\n");
/* busybox`s code */
if (out_h) { if (out_h) {
fprintf(out_h, "#ifndef BB_CONFIG_H\n#define BB_CONFIG_H\n"); fprintf(out_h, "#ifndef BB_CONFIG_H\n#define BB_CONFIG_H\n");
fprintf(out_h, "/*\n" fprintf(out_h, "/*\n"
@ -331,6 +336,7 @@ int conf_write(const char *name)
getenv("EXTRA_VERSION")); getenv("EXTRA_VERSION"));
fprintf(out_h, "\n"); fprintf(out_h, "\n");
} }
/* end busybox`s code */
if (!sym_change_count) if (!sym_change_count)
sym_clear_all_valid(); sym_clear_all_valid();
@ -369,39 +375,37 @@ int conf_write(const char *name)
if (modules_sym->curr.tri == no) if (modules_sym->curr.tri == no)
type = S_BOOLEAN; type = S_BOOLEAN;
} }
/* busybox`s code */
opt_name = strchr(sym->name, '_'); opt_name = strchr(sym->name, '_');
if(opt_name == NULL) if(opt_name == NULL)
opt_name = sym->name; opt_name = sym->name;
else else
opt_name++; opt_name++;
use_flg = 1;
/* end busybox`s code */
switch (type) { switch (type) {
case S_BOOLEAN: case S_BOOLEAN:
case S_TRISTATE: case S_TRISTATE:
switch (sym_get_tristate_value(sym)) { switch (sym_get_tristate_value(sym)) {
case no: case no:
fprintf(out, "# %s is not set\n", sym->name); fprintf(out, "# %s is not set\n", sym->name);
if (out_h) { if (out_h)
fprintf(out_h, "#undef %s\n", sym->name); fprintf(out_h, "#undef %s\n", sym->name);
fprintf(out_h, "#define ENABLE_%s 0\n", opt_name); use_flg = 0; /* busybox`s code */
fprintf(out_h, "#define USE_%s(...)\n", opt_name);
fprintf(out_h, "#define UNUSE_%s(...) __VA_ARGS__\n", opt_name);
}
break; break;
case mod: case mod:
#if 0 #if 0 /* busybox`s code */
fprintf(out, "%s=m\n", sym->name); fprintf(out, "%s=m\n", sym->name);
if (out_h) if (out_h)
fprintf(out_h, "#define %s_MODULE 1\n", sym->name); fprintf(out_h, "#define %s_MODULE 1\n", sym->name);
#endif #endif /* busybox`s code */
break; break;
case yes: case yes:
fprintf(out, "%s=y\n", sym->name); fprintf(out, "%s=y\n", sym->name);
if (out_h) { if (out_h)
fprintf(out_h, "#define %s 1\n", sym->name); fprintf(out_h, "#define %s 1\n", sym->name);
fprintf(out_h, "#define ENABLE_%s 1\n", opt_name);
fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", opt_name);
fprintf(out_h, "#define UNUSE_%s(...)\n", opt_name);
}
break; break;
} }
break; break;
@ -427,47 +431,42 @@ int conf_write(const char *name)
} }
} while (*str); } while (*str);
fputs("\"\n", out); fputs("\"\n", out);
if (out_h) { if (out_h)
fputs("\"\n", out_h); fputs("\"\n", out_h);
fprintf(out_h, "#define ENABLE_%s 1\n", opt_name);
fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", opt_name);
fprintf(out_h, "#define UNUSE_%s(...)\n", opt_name);
}
break; break;
case S_HEX: case S_HEX:
str = sym_get_string_value(sym); str = sym_get_string_value(sym);
if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
fprintf(out, "%s=%s\n", sym->name, *str ? str : "0"); fprintf(out, "%s=%s\n", sym->name, *str ? str : "0");
if (out_h) { if (out_h)
fprintf(out_h, "#define %s 0x%s\n", sym->name, str); fprintf(out_h, "#define %s 0x%s\n", sym->name, str);
fprintf(out_h, "#define ENABLE_%s 1\n", opt_name);
fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", opt_name);
fprintf(out_h, "#define UNUSE_%s(...)\n", opt_name);
}
break; break;
} }
case S_INT: case S_INT:
str = sym_get_string_value(sym); str = sym_get_string_value(sym);
fprintf(out, "%s=%s\n", sym->name, *str ? str : "0"); fprintf(out, "%s=%s\n", sym->name, *str ? str : "0");
if (out_h) { if (out_h)
fprintf(out_h, "#define %s %s\n", sym->name, str); fprintf(out_h, "#define %s %s\n", sym->name, str);
fprintf(out_h, "#define ENABLE_%s 1\n", opt_name);
fprintf(out_h, "#define USE_%s(...) __VA_ARGS__\n", opt_name);
fprintf(out_h, "#define UNUSE_%s(...)\n", opt_name);
}
break; break;
} }
if (out_h) /* busybox`s code */
fprintf(out_h, "\n"); if (out_h) {
fprintf(out_h, "#define ENABLE_%s %d\n", opt_name, use_flg);
fprintf(out_h, "#define USE_%s(...)%s\n", opt_name,
(use_flg ? " __VA_ARGS__" : ""));
fprintf(out_h, "#define UNUSE_%s(...)%s\n\n", opt_name,
(use_flg ? "" : " __VA_ARGS__"));
}
/* end busybox`s code */
} }
next: next:
menu = next_menu(menu); menu = next_menu(menu);
} }
fclose(out); fclose(out);
if (out_h) { if (out_h) {
fprintf(out_h, "#endif /* BB_CONFIG_H */\n"); fprintf(out_h, "#endif /* BB_CONFIG_H */\n"); /* busybox`s code */
fclose(out_h); fclose(out_h);
rename(".tmpconfig.h", "include/bb_config.h"); rename(".tmpconfig.h", "include/bb_config.h"); /* busybox`s config name */
file_write_dep(NULL); file_write_dep(NULL);
} }
if (!name || basename != conf_def_filename) { if (!name || basename != conf_def_filename) {