=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-show-messages.c,v retrieving revision 1.11 retrieving revision 1.12 diff -c -r1.11 -r1.12 *** src/usr.bin/tmux/cmd-show-messages.c 2015/04/25 18:33:59 1.11 --- src/usr.bin/tmux/cmd-show-messages.c 2015/05/12 19:36:08 1.12 *************** *** 1,4 **** ! /* $OpenBSD: cmd-show-messages.c,v 1.11 2015/04/25 18:33:59 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cmd-show-messages.c,v 1.12 2015/05/12 19:36:08 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 47,57 **** cmd_show_messages_exec }; ! void cmd_show_messages_server(struct cmd_q *); ! void cmd_show_messages_terminals(struct cmd_q *); ! void cmd_show_messages_jobs(struct cmd_q *); ! void cmd_show_messages_server(struct cmd_q *cmdq) { char *tim; --- 47,57 ---- cmd_show_messages_exec }; ! int cmd_show_messages_server(struct cmd_q *); ! int cmd_show_messages_terminals(struct cmd_q *, int); ! int cmd_show_messages_jobs(struct cmd_q *, int); ! int cmd_show_messages_server(struct cmd_q *cmdq) { char *tim; *************** *** 63,72 **** cmdq_print(cmdq, "socket path %s", socket_path); cmdq_print(cmdq, "debug level %d", debug_level); cmdq_print(cmdq, "protocol version %d", PROTOCOL_VERSION); } ! void ! cmd_show_messages_terminals(struct cmd_q *cmdq) { struct tty_term *term; const struct tty_term_code_entry *ent; --- 63,74 ---- cmdq_print(cmdq, "socket path %s", socket_path); cmdq_print(cmdq, "debug level %d", debug_level); cmdq_print(cmdq, "protocol version %d", PROTOCOL_VERSION); + + return (1); } ! int ! cmd_show_messages_terminals(struct cmd_q *cmdq, int blank) { struct tty_term *term; const struct tty_term_code_entry *ent; *************** *** 76,83 **** n = 0; LIST_FOREACH(term, &tty_terms, entry) { ! cmdq_print(cmdq, ! "Terminal %u: %s [references=%u, flags=0x%x]:", n, term->name, term->references, term->flags); n++; for (i = 0; i < NTTYCODE; i++) { --- 78,88 ---- n = 0; LIST_FOREACH(term, &tty_terms, entry) { ! if (blank) { ! cmdq_print(cmdq, "%s", ""); ! blank = 0; ! } ! cmdq_print(cmdq, "Terminal %u: %s [references=%u, flags=0x%x]:", n, term->name, term->references, term->flags); n++; for (i = 0; i < NTTYCODE; i++) { *************** *** 106,126 **** } } } } ! void ! cmd_show_messages_jobs(struct cmd_q *cmdq) { struct job *job; u_int n; n = 0; LIST_FOREACH(job, &all_jobs, lentry) { ! cmdq_print(cmdq, ! "Job %u: %s [fd=%d, pid=%d, status=%d]", n, job->cmd, job->fd, job->pid, job->status); n++; } } enum cmd_retval --- 111,136 ---- } } } + return (n != 0); } ! int ! cmd_show_messages_jobs(struct cmd_q *cmdq, int blank) { struct job *job; u_int n; n = 0; LIST_FOREACH(job, &all_jobs, lentry) { ! if (blank) { ! cmdq_print(cmdq, "%s", ""); ! blank = 0; ! } ! cmdq_print(cmdq, "Job %u: %s [fd=%d, pid=%d, status=%d]", n, job->cmd, job->fd, job->pid, job->status); n++; } + return (n != 0); } enum cmd_retval *************** *** 130,152 **** struct client *c; struct message_entry *msg; char *tim; ! int done; ! done = 0; if (args_has(args, 'I') || self->entry == &cmd_server_info_entry) { ! cmd_show_messages_server(cmdq); done = 1; } if (args_has(args, 'T') || self->entry == &cmd_server_info_entry) { ! if (done) ! cmdq_print(cmdq, "%s", ""); ! cmd_show_messages_terminals(cmdq); done = 1; } if (args_has(args, 'J') || self->entry == &cmd_server_info_entry) { ! if (done) ! cmdq_print(cmdq, "%s", ""); ! cmd_show_messages_jobs(cmdq); done = 1; } if (done) --- 140,158 ---- struct client *c; struct message_entry *msg; char *tim; ! int done, blank; ! done = blank = 0; if (args_has(args, 'I') || self->entry == &cmd_server_info_entry) { ! blank = cmd_show_messages_server(cmdq); done = 1; } if (args_has(args, 'T') || self->entry == &cmd_server_info_entry) { ! blank = cmd_show_messages_terminals(cmdq, blank); done = 1; } if (args_has(args, 'J') || self->entry == &cmd_server_info_entry) { ! cmd_show_messages_jobs(cmdq, blank); done = 1; } if (done)