comparison toys/posix/kill.c @ 674:7e846e281e38

New build infrastructure to generate FLAG_ macros and TT alias, #define FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
author Rob Landley <rob@landley.net>
date Mon, 08 Oct 2012 00:02:30 -0500
parents 2986aa63a021
children 786841fdb1e0
comparison
equal deleted inserted replaced
673:c102f31a753e 674:7e846e281e38
16 16
17 Send a signal to a process 17 Send a signal to a process
18 18
19 */ 19 */
20 20
21 #define FOR_kill
21 #include "toys.h" 22 #include "toys.h"
22 23
23 DEFINE_GLOBALS( 24 GLOBALS(
24 char *signame; 25 char *signame;
25 ) 26 )
26
27 #define TT this.kill
28 27
29 void kill_main(void) 28 void kill_main(void)
30 { 29 {
31 int signum; 30 int signum;
32 char *tmp, **args = toys.optargs; 31 char *tmp, **args = toys.optargs;
33 pid_t pid; 32 pid_t pid;
34 33
35 // list signal(s) 34 // list signal(s)
36 if (toys.optflags & 1) { 35 if (toys.optflags & FLAG_l) {
37 if (*args) { 36 if (*args) {
38 int signum = sig_to_num(*args); 37 int signum = sig_to_num(*args);
39 char *s = NULL; 38 char *s = NULL;
40 39
41 if (signum>=0) s = num_to_sig(signum&127); 40 if (signum>=0) s = num_to_sig(signum&127);