summaryrefslogtreecommitdiff
path: root/src/windows/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/windows/mod.rs')
-rw-r--r--src/windows/mod.rs224
1 files changed, 160 insertions, 64 deletions
diff --git a/src/windows/mod.rs b/src/windows/mod.rs
index be28b70f56..819b82c404 100644
--- a/src/windows/mod.rs
+++ b/src/windows/mod.rs
@@ -42,7 +42,9 @@ pub type ino_t = u16;
pub enum timezone {}
impl ::Copy for timezone {}
impl ::Clone for timezone {
- fn clone(&self) -> timezone { *self }
+ fn clone(&self) -> timezone {
+ *self
+ }
}
pub type time64_t = i64;
@@ -195,22 +197,26 @@ pub const SIG_ERR: ::c_int = -1;
#[cfg(all(target_env = "msvc", feature = "rustc-dep-of-std"))] // " if "
#[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))]
#[link(name = "libcmt", cfg(target_feature = "crt-static"))]
-extern {}
+extern "C" {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
impl ::Copy for FILE {}
impl ::Clone for FILE {
- fn clone(&self) -> FILE { *self }
+ fn clone(&self) -> FILE {
+ *self
+ }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct
impl ::Copy for fpos_t {}
impl ::Clone for fpos_t {
- fn clone(&self) -> fpos_t { *self }
+ fn clone(&self) -> fpos_t {
+ *self
+ }
}
-extern {
+extern "C" {
pub fn isalnum(c: c_int) -> c_int;
pub fn isalpha(c: c_int) -> c_int;
pub fn iscntrl(c: c_int) -> c_int;
@@ -225,28 +231,44 @@ extern {
pub fn tolower(c: c_int) -> c_int;
pub fn toupper(c: c_int) -> c_int;
pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
- pub fn freopen(filename: *const c_char, mode: *const c_char,
- file: *mut FILE) -> *mut FILE;
+ pub fn freopen(
+ filename: *const c_char,
+ mode: *const c_char,
+ file: *mut FILE,
+ ) -> *mut FILE;
pub fn fflush(file: *mut FILE) -> c_int;
pub fn fclose(file: *mut FILE) -> c_int;
pub fn remove(filename: *const c_char) -> c_int;
pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
pub fn tmpfile() -> *mut FILE;
- pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int,
- size: size_t) -> c_int;
+ pub fn setvbuf(
+ stream: *mut FILE,
+ buffer: *mut c_char,
+ mode: c_int,
+ size: size_t,
+ ) -> c_int;
pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
pub fn getchar() -> c_int;
pub fn putchar(c: c_int) -> c_int;
pub fn fgetc(stream: *mut FILE) -> c_int;
- pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
+ pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
+ -> *mut c_char;
pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
pub fn puts(s: *const c_char) -> c_int;
pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
- pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t,
- stream: *mut FILE) -> size_t;
- pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t,
- stream: *mut FILE) -> size_t;
+ pub fn fread(
+ ptr: *mut c_void,
+ size: size_t,
+ nobj: size_t,
+ stream: *mut FILE,
+ ) -> size_t;
+ pub fn fwrite(
+ ptr: *const c_void,
+ size: size_t,
+ nobj: size_t,
+ stream: *mut FILE,
+ ) -> size_t;
pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
pub fn ftell(stream: *mut FILE) -> c_long;
pub fn rewind(stream: *mut FILE);
@@ -257,10 +279,16 @@ extern {
pub fn perror(s: *const c_char);
pub fn atoi(s: *const c_char) -> c_int;
pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
- pub fn strtol(s: *const c_char, endp: *mut *mut c_char,
- base: c_int) -> c_long;
- pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
- base: c_int) -> c_ulong;
+ pub fn strtol(
+ s: *const c_char,
+ endp: *mut *mut c_char,
+ base: c_int,
+ ) -> c_long;
+ pub fn strtoul(
+ s: *const c_char,
+ endp: *mut *mut c_char,
+ base: c_int,
+ ) -> c_ulong;
pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
pub fn malloc(size: size_t) -> *mut c_void;
pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
@@ -268,16 +296,22 @@ extern {
pub fn abort() -> !;
pub fn exit(status: c_int) -> !;
pub fn _exit(status: c_int) -> !;
- pub fn atexit(cb: extern fn()) -> c_int;
+ pub fn atexit(cb: extern "C" fn()) -> c_int;
pub fn system(s: *const c_char) -> c_int;
pub fn getenv(s: *const c_char) -> *mut c_char;
pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
- pub fn strncpy(dst: *mut c_char, src: *const c_char,
- n: size_t) -> *mut c_char;
+ pub fn strncpy(
+ dst: *mut c_char,
+ src: *const c_char,
+ n: size_t,
+ ) -> *mut c_char;
pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
- pub fn strncat(s: *mut c_char, ct: *const c_char,
- n: size_t) -> *mut c_char;
+ pub fn strncat(
+ s: *mut c_char,
+ ct: *const c_char,
+ n: size_t,
+ ) -> *mut c_char;
pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
@@ -294,15 +328,24 @@ extern {
pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
pub fn wcslen(buf: *const wchar_t) -> size_t;
- pub fn wcstombs(dest: *mut c_char, src: *const wchar_t,
- n: size_t) -> ::size_t;
+ pub fn wcstombs(
+ dest: *mut c_char,
+ src: *const wchar_t,
+ n: size_t,
+ ) -> ::size_t;
pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
- pub fn memcpy(dest: *mut c_void, src: *const c_void,
- n: size_t) -> *mut c_void;
- pub fn memmove(dest: *mut c_void, src: *const c_void,
- n: size_t) -> *mut c_void;
+ pub fn memcpy(
+ dest: *mut c_void,
+ src: *const c_void,
+ n: size_t,
+ ) -> *mut c_void;
+ pub fn memmove(
+ dest: *mut c_void,
+ src: *const c_void,
+ n: size_t,
+ ) -> *mut c_void;
pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
pub fn abs(i: c_int) -> c_int;
@@ -355,15 +398,24 @@ extern {
#[link_name = "_dup2"]
pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
#[link_name = "_execv"]
- pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::intptr_t;
+ pub fn execv(
+ prog: *const c_char,
+ argv: *const *const c_char,
+ ) -> ::intptr_t;
#[link_name = "_execve"]
- pub fn execve(prog: *const c_char, argv: *const *const c_char,
- envp: *const *const c_char) -> ::c_int;
+ pub fn execve(
+ prog: *const c_char,
+ argv: *const *const c_char,
+ envp: *const *const c_char,
+ ) -> ::c_int;
#[link_name = "_execvp"]
pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
#[link_name = "_execvpe"]
- pub fn execvpe(c: *const c_char, argv: *const *const c_char,
- envp: *const *const c_char) -> ::c_int;
+ pub fn execvpe(
+ c: *const c_char,
+ argv: *const *const c_char,
+ envp: *const *const c_char,
+ ) -> ::c_int;
#[link_name = "_getcwd"]
pub fn getcwd(buf: *mut c_char, size: ::c_int) -> *mut c_char;
#[link_name = "_getpid"]
@@ -373,9 +425,11 @@ extern {
#[link_name = "_lseek"]
pub fn lseek(fd: ::c_int, offset: c_long, origin: ::c_int) -> c_long;
#[link_name = "_pipe"]
- pub fn pipe(fds: *mut ::c_int,
- psize: ::c_uint,
- textmode: ::c_int) -> ::c_int;
+ pub fn pipe(
+ fds: *mut ::c_int,
+ psize: ::c_uint,
+ textmode: ::c_int,
+ ) -> ::c_int;
#[link_name = "_read"]
pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::c_uint) -> ::c_int;
#[link_name = "_rmdir"]
@@ -383,7 +437,11 @@ extern {
#[link_name = "_unlink"]
pub fn unlink(c: *const c_char) -> ::c_int;
#[link_name = "_write"]
- pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::c_uint) -> ::c_int;
+ pub fn write(
+ fd: ::c_int,
+ buf: *const ::c_void,
+ count: ::c_uint,
+ ) -> ::c_int;
#[link_name = "_commit"]
pub fn commit(fd: ::c_int) -> ::c_int;
#[link_name = "_get_osfhandle"]
@@ -392,36 +450,74 @@ extern {
pub fn open_osfhandle(osfhandle: ::intptr_t, flags: ::c_int) -> ::c_int;
pub fn setlocale(category: ::c_int, locale: *const c_char) -> *mut c_char;
#[link_name = "_wsetlocale"]
- pub fn wsetlocale(category: ::c_int,
- locale: *const wchar_t) -> *mut wchar_t;
+ pub fn wsetlocale(
+ category: ::c_int,
+ locale: *const wchar_t,
+ ) -> *mut wchar_t;
}
extern "system" {
pub fn listen(s: SOCKET, backlog: ::c_int) -> ::c_int;
- pub fn accept(s: SOCKET, addr: *mut ::sockaddr,
- addrlen: *mut ::c_int) -> SOCKET;
- pub fn bind(s: SOCKET, name: *const ::sockaddr,
- namelen: ::c_int) -> ::c_int;
- pub fn connect(s: SOCKET, name: *const ::sockaddr,
- namelen: ::c_int) -> ::c_int;
- pub fn getpeername(s: SOCKET, name: *mut ::sockaddr,
- nameln: *mut ::c_int) -> ::c_int;
- pub fn getsockname(s: SOCKET, name: *mut ::sockaddr,
- nameln: *mut ::c_int) -> ::c_int;
- pub fn getsockopt(s: SOCKET, level: ::c_int, optname: ::c_int,
- optval: *mut ::c_char,
- optlen: *mut ::c_int) -> ::c_int;
- pub fn recvfrom(s: SOCKET, buf: *mut ::c_char, len: ::c_int,
- flags: ::c_int, from: *mut ::sockaddr,
- fromlen: *mut ::c_int) -> ::c_int;
- pub fn sendto(s: SOCKET, buf: *const ::c_char, len: ::c_int,
- flags: ::c_int, to: *const ::sockaddr,
- tolen: ::c_int) -> ::c_int;
- pub fn setsockopt(s: SOCKET, level: ::c_int, optname: ::c_int,
- optval: *const ::c_char,
- optlen: ::c_int) -> ::c_int;
- pub fn socket(af: ::c_int, socket_type: ::c_int,
- protocol: ::c_int) -> SOCKET;
+ pub fn accept(
+ s: SOCKET,
+ addr: *mut ::sockaddr,
+ addrlen: *mut ::c_int,
+ ) -> SOCKET;
+ pub fn bind(
+ s: SOCKET,
+ name: *const ::sockaddr,
+ namelen: ::c_int,
+ ) -> ::c_int;
+ pub fn connect(
+ s: SOCKET,
+ name: *const ::sockaddr,
+ namelen: ::c_int,
+ ) -> ::c_int;
+ pub fn getpeername(
+ s: SOCKET,
+ name: *mut ::sockaddr,
+ nameln: *mut ::c_int,
+ ) -> ::c_int;
+ pub fn getsockname(
+ s: SOCKET,
+ name: *mut ::sockaddr,
+ nameln: *mut ::c_int,
+ ) -> ::c_int;
+ pub fn getsockopt(
+ s: SOCKET,
+ level: ::c_int,
+ optname: ::c_int,
+ optval: *mut ::c_char,
+ optlen: *mut ::c_int,
+ ) -> ::c_int;
+ pub fn recvfrom(
+ s: SOCKET,
+ buf: *mut ::c_char,
+ len: ::c_int,
+ flags: ::c_int,
+ from: *mut ::sockaddr,
+ fromlen: *mut ::c_int,
+ ) -> ::c_int;
+ pub fn sendto(
+ s: SOCKET,
+ buf: *const ::c_char,
+ len: ::c_int,
+ flags: ::c_int,
+ to: *const ::sockaddr,
+ tolen: ::c_int,
+ ) -> ::c_int;
+ pub fn setsockopt(
+ s: SOCKET,
+ level: ::c_int,
+ optname: ::c_int,
+ optval: *const ::c_char,
+ optlen: ::c_int,
+ ) -> ::c_int;
+ pub fn socket(
+ af: ::c_int,
+ socket_type: ::c_int,
+ protocol: ::c_int,
+ ) -> SOCKET;
}
cfg_if! {