Output messages and progress to stderr

This commit is contained in:
Vladimir Panteleev 2010-06-16 00:57:05 +03:00
parent 5d1e2e20e5
commit be2da029c6
1 changed files with 3 additions and 1 deletions

View File

@ -9,7 +9,7 @@ int main(string[] args)
{
if (args.length != 2)
{
writefln("Usage: %s Article_name", args[0]);
fwritefln(stderr, "Usage: %s Article_name", args[0]);
return 1;
}
@ -20,12 +20,14 @@ int main(string[] args)
if (spawnvp(P_WAIT, "curl", ["curl", "-d", "\"\"", "http://en.wikipedia.org/w/index.php?title=Special:Export&pages=" ~ name, "-o", "history.xml"]))
throw new Exception("curl error");
fwritefln(stderr, "Loading history...");
auto xml = new XmlDocument(new File("history.xml"));
string data;
foreach (child; xml[0]["page"])
if (child.tag=="revision")
{
fwritefln(stderr, "Revision %s", child["id"].text);
string summary = child["comment"] ? child["comment"].text : null;
string text = child["text"].text;
data ~=