* dump_setup.cc (dump_file): Read requested content from setup.rc
file created by newer setup.exe.
This commit is contained in:
parent
6259826eb4
commit
96f1582977
@ -1,3 +1,8 @@
|
|||||||
|
2010-07-05 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* dump_setup.cc (dump_file): Read requested content from setup.rc
|
||||||
|
file created by newer setup.exe.
|
||||||
|
|
||||||
2010-06-29 Corinna Vinschen <corinna@vinschen.de>
|
2010-06-29 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* utils.sgml (locale): Change stray local cygdrive prefix to Cygwin's
|
* utils.sgml (locale): Change stray local cygdrive prefix to Cygwin's
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* dump_setup.cc
|
/* dump_setup.cc
|
||||||
|
|
||||||
Copyright 2001 Red Hat, Inc.
|
Copyright 2001, 2002, 2003, 2004, 2005, 2008, 2010 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
@ -141,21 +141,34 @@ parse_filename (const char *in_fn, fileparse& f)
|
|||||||
static bool
|
static bool
|
||||||
dump_file (const char *msg, const char *fn)
|
dump_file (const char *msg, const char *fn)
|
||||||
{
|
{
|
||||||
char *path = cygpath ("/etc/setup/", fn, NULL);
|
|
||||||
FILE *fp = fopen (path, "rt");
|
|
||||||
bool printed;
|
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
if (!fp)
|
bool printed = false;
|
||||||
printed = false;
|
bool found = false;
|
||||||
else if (!fgets (buf, 4096, fp))
|
size_t len = strlen (fn);
|
||||||
printed = false;
|
char *path = cygpath ("/etc/setup/setup.rc", NULL);
|
||||||
{
|
FILE *fp = fopen (path, "rt");
|
||||||
char *p = strchr (buf, '\0');
|
|
||||||
printf ("%s%s%s", msg, buf, (p == buf) || p[-1] != '\n' ? "\n" : "");
|
|
||||||
printed = true;
|
|
||||||
}
|
|
||||||
if (fp)
|
if (fp)
|
||||||
|
{
|
||||||
|
while (fgets (buf, 4096, fp))
|
||||||
|
{
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
char *bufp = buf;
|
||||||
|
|
||||||
|
if (*bufp == '\t')
|
||||||
|
++bufp;
|
||||||
|
char *p = strchr (bufp, '\0');
|
||||||
|
printf ("%s%s%s", msg, bufp,
|
||||||
|
(p == bufp) || p[-1] != '\n' ? "\n" : "");
|
||||||
|
printed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!strncmp (buf, fn, len) && buf[len] == '\n')
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
}
|
||||||
return printed;
|
return printed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user