1*e89934bbSchristos /* $NetBSD: spawn_command.h,v 1.2 2017/02/14 01:16:49 christos Exp $ */ 241fbaed0Stron 341fbaed0Stron #ifndef _SPAWN_COMMAND_H_INCLUDED_ 441fbaed0Stron #define _SPAWN_COMMAND_H_INCLUDED_ 541fbaed0Stron 641fbaed0Stron /*++ 741fbaed0Stron /* NAME 841fbaed0Stron /* spawn_command 3h 941fbaed0Stron /* SUMMARY 1041fbaed0Stron /* run external command 1141fbaed0Stron /* SYNOPSIS 1241fbaed0Stron /* #include <spawn_command.h> 1341fbaed0Stron /* DESCRIPTION 1441fbaed0Stron /* .nf 1541fbaed0Stron 1641fbaed0Stron /* 17e262b48eSchristos * Utility library. 1841fbaed0Stron */ 19e262b48eSchristos #include <check_arg.h> 20e262b48eSchristos 21e262b48eSchristos /* Legacy API: type-unchecked arguments, internal use. */ 2241fbaed0Stron #define SPAWN_CMD_END 0 /* terminator */ 2341fbaed0Stron #define SPAWN_CMD_ARGV 1 /* command is array */ 2441fbaed0Stron #define SPAWN_CMD_COMMAND 2 /* command is string */ 2541fbaed0Stron #define SPAWN_CMD_STDIN 3 /* mail_copy() flags */ 2641fbaed0Stron #define SPAWN_CMD_STDOUT 4 /* mail_copy() sender */ 2741fbaed0Stron #define SPAWN_CMD_STDERR 5 /* mail_copy() recipient */ 2841fbaed0Stron #define SPAWN_CMD_UID 6 /* privileges */ 2941fbaed0Stron #define SPAWN_CMD_GID 7 /* privileges */ 3041fbaed0Stron #define SPAWN_CMD_TIME_LIMIT 8 /* time limit */ 3141fbaed0Stron #define SPAWN_CMD_ENV 9 /* extra environment */ 3241fbaed0Stron #define SPAWN_CMD_SHELL 10 /* alternative shell */ 3341fbaed0Stron #define SPAWN_CMD_EXPORT 11 /* exportable parameters */ 3441fbaed0Stron 35e262b48eSchristos /* Safer API: type-checked arguments, external use. */ 36e262b48eSchristos #define CA_SPAWN_CMD_END SPAWN_CMD_END 37e262b48eSchristos #define CA_SPAWN_CMD_ARGV(v) SPAWN_CMD_ARGV, CHECK_PPTR(CA_SPAWN_CMD, char, (v)) 38e262b48eSchristos #define CA_SPAWN_CMD_COMMAND(v) SPAWN_CMD_COMMAND, CHECK_CPTR(CA_SPAWN_CMD, char, (v)) 39e262b48eSchristos #define CA_SPAWN_CMD_STDIN(v) SPAWN_CMD_STDIN, CHECK_VAL(CA_SPAWN_CMD, int, (v)) 40e262b48eSchristos #define CA_SPAWN_CMD_STDOUT(v) SPAWN_CMD_STDOUT, CHECK_VAL(CA_SPAWN_CMD, int, (v)) 41e262b48eSchristos #define CA_SPAWN_CMD_STDERR(v) SPAWN_CMD_STDERR, CHECK_VAL(CA_SPAWN_CMD, int, (v)) 42e262b48eSchristos #define CA_SPAWN_CMD_UID(v) SPAWN_CMD_UID, CHECK_VAL(CA_SPAWN_CMD, uid_t, (v)) 43e262b48eSchristos #define CA_SPAWN_CMD_GID(v) SPAWN_CMD_GID, CHECK_VAL(CA_SPAWN_CMD, gid_t, (v)) 44e262b48eSchristos #define CA_SPAWN_CMD_TIME_LIMIT(v) SPAWN_CMD_TIME_LIMIT, CHECK_VAL(CA_SPAWN_CMD, int, (v)) 45e262b48eSchristos #define CA_SPAWN_CMD_ENV(v) SPAWN_CMD_ENV, CHECK_PPTR(CA_SPAWN_CMD, char, (v)) 46e262b48eSchristos #define CA_SPAWN_CMD_SHELL(v) SPAWN_CMD_SHELL, CHECK_CPTR(CA_SPAWN_CMD, char, (v)) 47e262b48eSchristos #define CA_SPAWN_CMD_EXPORT(v) SPAWN_CMD_EXPORT, CHECK_PPTR(CA_SPAWN_CMD, char, (v)) 48e262b48eSchristos 49e262b48eSchristos CHECK_VAL_HELPER_DCL(CA_SPAWN_CMD, uid_t); 50e262b48eSchristos CHECK_VAL_HELPER_DCL(CA_SPAWN_CMD, int); 51e262b48eSchristos CHECK_VAL_HELPER_DCL(CA_SPAWN_CMD, gid_t); 52e262b48eSchristos CHECK_PPTR_HELPER_DCL(CA_SPAWN_CMD, char); 53e262b48eSchristos CHECK_CPTR_HELPER_DCL(CA_SPAWN_CMD, char); 54e262b48eSchristos 5541fbaed0Stron extern WAIT_STATUS_T spawn_command(int,...); 5641fbaed0Stron 5741fbaed0Stron /* LICENSE 5841fbaed0Stron /* .ad 5941fbaed0Stron /* .fi 6041fbaed0Stron /* The Secure Mailer license must be distributed with this software. 6141fbaed0Stron /* AUTHOR(S) 6241fbaed0Stron /* Wietse Venema 6341fbaed0Stron /* IBM T.J. Watson Research 6441fbaed0Stron /* P.O. Box 704 6541fbaed0Stron /* Yorktown Heights, NY 10598, USA 6641fbaed0Stron /*--*/ 6741fbaed0Stron 6841fbaed0Stron #endif 69