author | viric@llimona |
Tue, 27 Mar 2007 23:29:56 +0200 | |
changeset 58 | 3c492266923e |
parent 55 | 678ca291d545 |
child 62 | 2b29d4666f6c |
permissions | -rw-r--r-- |
31 | 1 |
enum Request |
2 |
{ |
|
3 |
c_QUEUE, |
|
4 |
c_TAIL, |
|
5 |
c_KILL_SERVER, |
|
6 |
c_LIST, |
|
7 |
c_CLEAR_FINISHED, |
|
8 |
c_SHOW_HELP, |
|
37 | 9 |
c_SHOW_VERSION, |
33 | 10 |
c_CAT, |
11 |
c_SHOW_OUTPUT_FILE, |
|
35 | 12 |
c_SHOW_PID, |
42 | 13 |
c_REMOVEJOB, |
53 | 14 |
c_WAITJOB, |
15 |
c_URGENT |
|
31 | 16 |
}; |
17 |
||
30
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
18 |
struct Command_line { |
31 | 19 |
enum Request request; |
30
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
20 |
int need_server; |
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
21 |
int store_output; |
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
22 |
int should_go_background; |
55
678ca291d545
Now the '-nf' doesn't leave a job in 'finished' state.
viric@llimona
parents:
53
diff
changeset
|
23 |
int should_keep_finished; |
30
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
24 |
int jobid; |
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
25 |
}; |
3 | 26 |
|
30
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
27 |
extern struct Command_line command_line; |
32 | 28 |
extern int server_socket; |
3 | 29 |
|
30 |
struct msg; |
|
31 |
||
32 |
/* client.c */ |
|
30
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
33 |
void c_new_job(const char *command); |
8 | 34 |
void c_list_jobs(); |
44 | 35 |
void c_shutdown_server(); |
5 | 36 |
void c_wait_server_lines(); |
44 | 37 |
void c_clear_finished(); |
38
768d009604b3
The program returns the errorlevel of the job, if it doesn't go to background.
viric@llimona
parents:
37
diff
changeset
|
38 |
int c_wait_server_commands(const char *my_command); |
35 | 39 |
void c_send_runjob_ok(const char *ofname, int pid); |
32 | 40 |
void c_tail(); |
33 | 41 |
void c_cat(); |
42 |
void c_show_output_file(); |
|
41 | 43 |
void c_remove_job(); |
44 | 44 |
void c_show_pid(); |
51
aa6e05d77537
'-w' returns the waited errorlevel. Added a testbench.
viric@llimona
parents:
44
diff
changeset
|
45 |
int c_wait_job(); |
53 | 46 |
void c_move_urgent(); |
3 | 47 |
|
48 |
/* jobs.c */ |
|
49 |
void s_list(int s); |
|
18 | 50 |
int s_newjob(int s, struct msg *m); |
3 | 51 |
void s_removejob(int jobid); |
19
5efc347cca8d
The finished jobs store the errorlevel, and can be listed.
viric@llimona
parents:
18
diff
changeset
|
52 |
void job_finished(int errorlevel); |
8 | 53 |
int next_run_job(); |
19
5efc347cca8d
The finished jobs store the errorlevel, and can be listed.
viric@llimona
parents:
18
diff
changeset
|
54 |
void s_mark_job_running(); |
20
d85b4c0745fa
"-c" added, for clearing the finished tasks' list.
viric@llimona
parents:
19
diff
changeset
|
55 |
void s_clear_finished(); |
35 | 56 |
void s_process_runjob_ok(int jobid, char *oname, int pid); |
32 | 57 |
void s_send_output(int socket, int jobid); |
41 | 58 |
void s_remove_job(int s, int jobid); |
42 | 59 |
void s_remove_notification(int s); |
44 | 60 |
void check_notify_list(int jobid); |
61 |
void s_wait_job(int s, int jobid); |
|
53 | 62 |
void s_move_urgent(int s, int jobid); |
3 | 63 |
|
64 |
/* server.c */ |
|
28
107abb4ec98a
Unified socket path, depending on the username and $TMPDIR.
viric@llimona
parents:
27
diff
changeset
|
65 |
void server_main(int notify_fd, char *_path); |
3 | 66 |
|
67 |
/* server_start.c */ |
|
68 |
int try_connect(int s); |
|
69 |
void wait_server_up(); |
|
70 |
int ensure_server_up(); |
|
25 | 71 |
void notify_parent(int fd); |
8 | 72 |
|
73 |
/* execute.c */ |
|
30
ab88478a7e9b
The commandline parameters are centered in a struct.
viric@llimona
parents:
28
diff
changeset
|
74 |
int run_job(const char *command); |
32 | 75 |
|
33 | 76 |
/* client_run.c */ |
32 | 77 |
void c_run_tail(const char *filename); |
33 | 78 |
void c_run_cat(const char *filename); |