diff options
author | Dr. Michael Lauer <mickey@vanille-media.de> | 2018-03-06 15:04:27 +0100 |
---|---|---|
committer | Dr. Michael Lauer <mickey@vanille-media.de> | 2018-03-06 15:04:27 +0100 |
commit | 1464eb4c1463b44b856cd1650a9d95d9d7228556 (patch) | |
tree | 13c4b49f1c363d1e763db9dfa438eb88fdd98b4e /vapi/posix.vapi | |
parent | 24a4e8c510351ed1a07504a1b38b5969839ef651 (diff) | |
download | vala-1464eb4c1463b44b856cd1650a9d95d9d7228556.tar.gz |
posix: Add wordexp(3), wordexp_t, and assorted constants
Based on a patch by Andre Masella.
https://bugzilla.gnome.org/show_bug.cgi?id=663633
Diffstat (limited to 'vapi/posix.vapi')
-rw-r--r-- | vapi/posix.vapi | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/vapi/posix.vapi b/vapi/posix.vapi index 7e4d7a0ac..155e70429 100644 --- a/vapi/posix.vapi +++ b/vapi/posix.vapi @@ -2949,4 +2949,46 @@ namespace Posix { public static int opterr; [CCode (cheader_filename = "unistd.h")] public static int optopt; + + [CCode(cname = "wordexp_t", cheader_filename = "wordexp.h", destroy_function = "wordfree")] + public struct Wordexp { + [CCode(cname = "we_wordv", array_length_cname = "we_wordc", array_length_type = "size_t")] + public string[] words; + + [CCode(cname = "wordexp", instance_pos = 1.1)] + private int _wordexp (string s, int flags = 0); + [CCode(cname = "wordfree")] + private int _wordfree (); + + public int expand (string s, int flags = 0) { + if (!(WRDE_APPEND in flags || WRDE_REUSE in flags)) { + _wordfree(); + } + return _wordexp (s, flags); + } + public int append(string s, int flags = 0) { + return _wordexp (s, flags | WRDE_APPEND); + } + } + + [CCode(cheader_filename = "wordexp.h")] + private const int WRDE_APPEND; + [CCode(cheader_filename = "wordexp.h")] + public const int WRDE_BADCHAR; + [CCode(cheader_filename = "wordexp.h")] + public const int WRDE_BADVAL; + [CCode(cheader_filename = "wordexp.h")] + public const int WRDE_CMDSUB; + [CCode(cheader_filename = "wordexp.h")] + public const int WRDE_NOCMD; + [CCode(cheader_filename = "wordexp.h")] + public const int WRDE_NOSPACE; + [CCode(cheader_filename = "wordexp.h")] + public const int WRDE_REUSE; + [CCode(cheader_filename = "wordexp.h")] + public const int WRDE_SHOWERR; + [CCode(cheader_filename = "wordexp.h")] + public const int WRDE_SYNTAX; + [CCode(cheader_filename = "wordexp.h")] + public const int WRDE_UNDEF; } |