rsc | 24f4e66 | 2004-11-08 16:04:01 +0000 | [diff] [blame^] | 1 | #include <u.h> |
| 2 | #include <libc.h> |
| 3 | #include <thread.h> |
| 4 | |
| 5 | extern int _threaddebuglevel; |
| 6 | |
| 7 | void |
| 8 | usage(void) |
| 9 | { |
| 10 | fprint(2, "usage: tsignal [-[ednf] note]*\n"); |
| 11 | threadexitsall("usage"); |
| 12 | } |
| 13 | |
| 14 | void |
| 15 | threadmain(int argc, char **argv) |
| 16 | { |
| 17 | Channel *c; |
| 18 | char *msg; |
| 19 | |
| 20 | ARGBEGIN{ |
| 21 | case 'D': |
| 22 | _threaddebuglevel = ~0; |
| 23 | break; |
| 24 | default: |
| 25 | usage(); |
| 26 | case 'e': |
| 27 | notifyenable(EARGF(usage())); |
| 28 | break; |
| 29 | case 'd': |
| 30 | notifydisable(EARGF(usage())); |
| 31 | break; |
| 32 | case 'n': |
| 33 | notifyon(EARGF(usage())); |
| 34 | break; |
| 35 | case 'f': |
| 36 | notifyoff(EARGF(usage())); |
| 37 | break; |
| 38 | }ARGEND |
| 39 | |
| 40 | c = threadnotechan(); |
| 41 | while((msg = recvp(c)) != nil) |
| 42 | print("note: %s\n", msg); |
| 43 | } |