~pi-rho/tmux/master-sf-old

« back to all changes in this revision

Viewing changes to cmd-show-messages.c

  • Committer: Thomas Adam
  • Date: 2015-05-13 08:44:11 UTC
  • mfrom: (0.1.1708)
  • Revision ID: git-v1:00471dc78358bde092df65de5e2c375bf9be7437
Merge branch 'obsd-master'

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        cmd_show_messages_exec
47
47
};
48
48
 
49
 
void    cmd_show_messages_server(struct cmd_q *);
50
 
void    cmd_show_messages_terminals(struct cmd_q *);
51
 
void    cmd_show_messages_jobs(struct cmd_q *);
 
49
int     cmd_show_messages_server(struct cmd_q *);
 
50
int     cmd_show_messages_terminals(struct cmd_q *, int);
 
51
int     cmd_show_messages_jobs(struct cmd_q *, int);
52
52
 
53
 
void
 
53
int
54
54
cmd_show_messages_server(struct cmd_q *cmdq)
55
55
{
56
56
        char    *tim;
62
62
        cmdq_print(cmdq, "socket path %s", socket_path);
63
63
        cmdq_print(cmdq, "debug level %d", debug_level);
64
64
        cmdq_print(cmdq, "protocol version %d", PROTOCOL_VERSION);
 
65
 
 
66
        return (1);
65
67
}
66
68
 
67
 
void
68
 
cmd_show_messages_terminals(struct cmd_q *cmdq)
 
69
int
 
70
cmd_show_messages_terminals(struct cmd_q *cmdq, int blank)
69
71
{
70
72
        struct tty_term                         *term;
71
73
        const struct tty_term_code_entry        *ent;
75
77
 
76
78
        n = 0;
77
79
        LIST_FOREACH(term, &tty_terms, entry) {
78
 
                cmdq_print(cmdq,
79
 
                    "Terminal %u: %s [references=%u, flags=0x%x]:",
 
80
                if (blank) {
 
81
                        cmdq_print(cmdq, "%s", "");
 
82
                        blank = 0;
 
83
                }
 
84
                cmdq_print(cmdq, "Terminal %u: %s [references=%u, flags=0x%x]:",
80
85
                    n, term->name, term->references, term->flags);
81
86
                n++;
82
87
                for (i = 0; i < NTTYCODE; i++) {
105
110
                        }
106
111
                }
107
112
        }
 
113
        return (n != 0);
108
114
}
109
115
 
110
 
void
111
 
cmd_show_messages_jobs(struct cmd_q *cmdq)
 
116
int
 
117
cmd_show_messages_jobs(struct cmd_q *cmdq, int blank)
112
118
{
113
119
        struct job      *job;
114
120
        u_int            n;
115
121
 
116
122
        n = 0;
117
123
        LIST_FOREACH(job, &all_jobs, lentry) {
118
 
                cmdq_print(cmdq,
119
 
                    "Job %u: %s [fd=%d, pid=%d, status=%d]",
 
124
                if (blank) {
 
125
                        cmdq_print(cmdq, "%s", "");
 
126
                        blank = 0;
 
127
                }
 
128
                cmdq_print(cmdq, "Job %u: %s [fd=%d, pid=%d, status=%d]",
120
129
                    n, job->cmd, job->fd, job->pid, job->status);
121
130
                n++;
122
131
        }
 
132
        return (n != 0);
123
133
}
124
134
 
125
135
enum cmd_retval
129
139
        struct client           *c;
130
140
        struct message_entry    *msg;
131
141
        char                    *tim;
132
 
        int                      done;
 
142
        int                      done, blank;
133
143
 
134
 
        done = 0;
 
144
        done = blank = 0;
135
145
        if (args_has(args, 'I') || self->entry == &cmd_server_info_entry) {
136
 
                cmd_show_messages_server(cmdq);
 
146
                blank = cmd_show_messages_server(cmdq);
137
147
                done = 1;
138
148
        }
139
149
        if (args_has(args, 'T') || self->entry == &cmd_server_info_entry) {
140
 
                if (done)
141
 
                        cmdq_print(cmdq, "%s", "");
142
 
                cmd_show_messages_terminals(cmdq);
 
150
                blank = cmd_show_messages_terminals(cmdq, blank);
143
151
                done = 1;
144
152
        }
145
153
        if (args_has(args, 'J') || self->entry == &cmd_server_info_entry) {
146
 
                if (done)
147
 
                        cmdq_print(cmdq, "%s", "");
148
 
                cmd_show_messages_jobs(cmdq);
 
154
                cmd_show_messages_jobs(cmdq, blank);
149
155
                done = 1;
150
156
        }
151
157
        if (done)