Skip to content

Commit 9fb13d0

Browse files
committed
Merge branch 'master' of https://github.com/Hackerpilot/dfmt
2 parents fcd2b50 + 4a47048 commit 9fb13d0

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/dfmt/main.d

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,8 @@ else
113113
// On Windows, set stdout to binary mode (needed for correct EOL writing)
114114
// See Phobos' stdio.File.rawWrite
115115
{
116-
import std.stdio : _fileno, _O_BINARY, _setmode;
117-
118-
immutable fd = _fileno(output.getFP());
116+
import std.stdio : _O_BINARY;
117+
immutable fd = output.fileno;
119118
_setmode(fd, _O_BINARY);
120119
version (CRuntime_DigitalMars)
121120
{
@@ -212,6 +211,19 @@ else
212211
}
213212
}
214213

214+
private version (Windows)
215+
{
216+
version(CRuntime_DigitalMars)
217+
{
218+
extern(C) int setmode(int, int) nothrow @nogc;
219+
alias _setmode = setmode;
220+
}
221+
else version(CRuntime_Microsoft)
222+
{
223+
extern(C) int _setmode(int, int) nothrow @nogc;
224+
}
225+
}
226+
215227
private string optionsToString(E)() if (is(E == enum))
216228
{
217229
import std.traits : EnumMembers;
@@ -236,7 +248,7 @@ https://github.com/Hackerpilot/dfmt
236248
Options:
237249
--help, -h Print this help message
238250
--inplace, -i Edit files in place
239-
--config_dir, -c Path to directory to load .editconfig file from.
251+
--config_dir, -c Path to directory to load .editorconfig file from.
240252
--version Print the version number and then exit
241253
242254
Formatting Options:

0 commit comments

Comments
 (0)