|
From: | Larry Hastings |
Subject: | Re: [Monotone-devel] "mtn cat" text/binary impedence mismatch |
Date: | Wed, 08 Nov 2006 08:46:00 -0800 |
User-agent: | Thunderbird 1.5.0.7 (Windows/20060909) |
So here's a patch that I think will fix the problem. Note that I haven't so much as compiled it, as I don't have a monotone build environment set up anywhere. But it sure looks okay, don't it? Cheers, larry -------------------- # # old_revision [a842d70f3a7546ec5c1af5d4c2eef7caddc9f511] # # patch "cmd_files.cc" # from [12243e3b47340b2aa81cd8e26f40559fad0ab51d] # to [70689ad71003c87e72aa02699e56744c99e5cb80] # # patch "platform.hh" # from [7224b228b7c8f0476b45ed5fb929aba4d6878fd5] # to [5959e7ef02930e75c3baa9b36b2b9869a148f837] # # patch "win32/make_io_binary.cc" # from [e1ab402f330f608d17714ec0d04878b99feebc97] # to [55fb0a7a07b64f97dfba944836537d231f2f73bb] # ============================================================ --- cmd_files.cc 12243e3b47340b2aa81cd8e26f40559fad0ab51d +++ cmd_files.cc 70689ad71003c87e72aa02699e56744c99e5cb80 @@ -218,7 +218,9 @@ CMD(cat, N_("informative"), file_data dat; L(FL("dumping file '%s'") % ident); app.db.get_file_version(ident, dat); + make_io_binary(true); cout.write(dat.inner()().data(), dat.inner()().size()); + make_io_binary(false); guard.commit(); } ============================================================ --- platform.hh 7224b228b7c8f0476b45ed5fb929aba4d6878fd5 +++ platform.hh 5959e7ef02930e75c3baa9b36b2b9869a148f837 @@ -34,7 +34,7 @@ int process_sleep(unsigned int seconds); int process_sleep(unsigned int seconds); // stop "\n"->"\r\n" from breaking automate on Windows -void make_io_binary(); +void make_io_binary(bool make_binary = true); #ifdef WIN32 std::string munge_argv_into_cmdline(const char* const argv[]); ============================================================ --- win32/make_io_binary.cc e1ab402f330f608d17714ec0d04878b99feebc97 +++ win32/make_io_binary.cc 55fb0a7a07b64f97dfba944836537d231f2f73bb @@ -6,9 +6,9 @@ #include "platform.hh" -void make_io_binary() +void make_io_binary(bool make_binary) { - _setmode(_fileno(stdin), _O_BINARY); - _setmode(_fileno(stdout), _O_BINARY); + _setmode(_fileno(stdin), make_binary ? _O_BINARY : _O_TEXT); + _setmode(_fileno(stdout), make_binary ? _O_BINARY : _O_TEXT); } |
[Prev in Thread] | Current Thread | [Next in Thread] |