mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
os2 process implementation for linux
This commit is contained in:
@@ -3,7 +3,8 @@ package os2
|
||||
|
||||
import "base:intrinsics"
|
||||
import "base:runtime"
|
||||
|
||||
import "core:fmt"
|
||||
import "core:strings"
|
||||
|
||||
// Splits pattern by the last wildcard "*", if it exists, and returns the prefix and suffix
|
||||
// parts which are split by the last "*"
|
||||
@@ -47,6 +48,16 @@ temp_cstring :: proc(s: string) -> (cstring, runtime.Allocator_Error) {
|
||||
return clone_to_cstring(s, temp_allocator())
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
ctprintf :: proc(format: string, args: ..any, newline := false) -> cstring {
|
||||
str: strings.Builder
|
||||
strings.builder_init(&str, temp_allocator())
|
||||
fmt.sbprintf(&str, format, ..args, newline=newline)
|
||||
strings.write_byte(&str, 0)
|
||||
s := strings.to_string(str)
|
||||
return cstring(raw_data(s))
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
string_from_null_terminated_bytes :: proc(b: []byte) -> (res: string) {
|
||||
s := string(b)
|
||||
@@ -126,5 +137,3 @@ random_string :: proc(buf: []byte) -> string {
|
||||
buf[i] = digits[u % b]
|
||||
return string(buf[i:])
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user