1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vlib: remove unused os2 module (#11053)

This commit is contained in:
Daniel Däschle 2021-08-04 16:56:08 +02:00 committed by GitHub
parent f9c279d11d
commit 310b51c883
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 49 deletions

View File

@ -1,2 +0,0 @@
// this keeps vfmt happy
module os2

View File

@ -1,36 +0,0 @@
module os2
#include <fcntl.h>
struct File {
fd int
}
fn C.perror(&char)
fn C.open(&byte, int, int) int
fn C.write(voidptr, &byte, int) int
fn C.close(int) int
pub fn create(path string) ?File {
fd := C.open(path.str, C.O_CREAT | C.O_TRUNC | C.O_WRONLY, o644) // 511
if fd == -1 {
return error('failed to create "$path":')
// os.print_c_errno()
}
return File{fd}
}
pub fn (f File) writeln(s string) {
ss := s + '\n'
ret := C.write(f.fd, ss.str, s.len + 1)
if ret == -1 {
C.perror('failed to write')
}
}
pub fn (f File) close() {
C.close(f.fd)
}

View File

@ -1,11 +0,0 @@
// import os2
fn test_open() {
/*
$if macos {
f := os2.create('os2.test')
f.writeln('hello world!')
f.close()
}
*/
}