Explorar el Código

Add initial POSIX support for Linux for wordexp.

Isaac Andrade hace 1 año
padre
commit
af94c4ab32
Se han modificado 1 ficheros con 21 adiciones y 0 borrados
  1. 21 0
      core/sys/posix/wordexp.odin

+ 21 - 0
core/sys/posix/wordexp.odin

@@ -102,6 +102,27 @@ when ODIN_OS == .Darwin {
 	WRDE_NOSPACE :: 4
 	WRDE_SYNTAX  :: 6
 
+} else when ODIN_OS == .Linux {
+
+	wordexp_t :: struct {
+		we_wordc: c.size_t,   /* [PSX] count of words matched by words */
+		we_wordv: [^]cstring, /* [PSX] pointer to list of expanded words */
+		we_offs:  c.size_t,   /* [PSX] slots to reserve at the beginning of we_wordv */
+	}
+
+	WRDE_DOOFFS  :: 1 << 0	/* Insert PWORDEXP->we_offs NULLs.  */
+	WRDE_APPEND  :: 1 << 1	/* Append to results of a previous call.  */
+	WRDE_NOCMD   :: 1 << 2	/* Don't do command substitution.  */
+	WRDE_REUSE   :: 1 << 3	/* Reuse storage in PWORDEXP.  */
+	WRDE_SHOWERR :: 1 << 4	/* Don't redirect stderr to /dev/null.  */
+	WRDE_UNDEF   :: 1 << 5	/* Error for expanding undefined variables.  */
+
+	WRDE_NOSPACE :: 1
+	WRDE_BADCHAR :: 2
+	WRDE_BADVAL  :: 3
+	WRDE_CMDSUB  :: 4
+	WRDE_SYNTAX  :: 5
+
 } else {
 	#panic("posix is unimplemented for the current target")
 }