From c39509ffdf2f01fdac4ef95606c105e73af208cc Mon Sep 17 00:00:00 2001 From: David Wragg Date: Tue, 5 Jul 2011 16:15:30 +0100 Subject: Remove trailing whitespace --- tools/common.c | 28 ++++++++++++++-------------- tools/consume.c | 12 ++++++------ tools/doc/consume.xml | 4 ++-- tools/doc/declare_queue.xml | 2 +- tools/doc/delete_queue.xml | 2 +- tools/doc/get.xml | 2 +- tools/doc/publish.xml | 2 +- tools/get.c | 6 +++--- tools/publish.c | 10 +++++----- tools/unix/process.c | 2 +- tools/windows/process.c | 16 ++++++++-------- 11 files changed, 43 insertions(+), 43 deletions(-) (limited to 'tools') diff --git a/tools/common.c b/tools/common.c index cd38753..02c0655 100644 --- a/tools/common.c +++ b/tools/common.c @@ -133,7 +133,7 @@ char *amqp_rpc_reply_string(amqp_rpc_reply_t r) switch (r.reply_type) { case AMQP_RESPONSE_NORMAL: return strdup("normal response"); - + case AMQP_RESPONSE_NONE: return strdup("missing RPC reply type"); @@ -155,7 +155,7 @@ void die_rpc(amqp_rpc_reply_t r, const char *fmt, ...) if (r.reply_type == AMQP_RESPONSE_NORMAL) return; - + va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); @@ -188,7 +188,7 @@ amqp_connection_state_t make_connection(void) amqp_connection_state_t conn; char *host = amqp_server; int port = 0; - + /* parse the server string into a hostname and a port */ char *colon = strchr(amqp_server, ':'); if (colon) { @@ -199,7 +199,7 @@ amqp_connection_state_t make_connection(void) host[host_len] = 0; port = strtol(colon+1, &port_end, 10); - if (port < 0 + if (port < 0 || port > 65535 || port_end == colon+1 || *port_end != 0) @@ -208,10 +208,10 @@ amqp_connection_state_t make_connection(void) s = amqp_open_socket(host, port ? port : 5672); die_amqp_error(s, "opening socket to %s", amqp_server); - + conn = amqp_new_connection(); amqp_set_sockfd(conn, s); - + die_rpc(amqp_login(conn, amqp_vhost, 0, 131072, 0, AMQP_SASL_METHOD_PLAIN, amqp_username, amqp_password), @@ -219,7 +219,7 @@ amqp_connection_state_t make_connection(void) if (!amqp_channel_open(conn, 1)) die_rpc(amqp_get_rpc_reply(conn), "opening channel"); - + return conn; } @@ -230,7 +230,7 @@ void close_connection(amqp_connection_state_t conn) "closing channel"); die_rpc(amqp_connection_close(conn, AMQP_REPLY_SUCCESS), "closing connection"); - + res = amqp_destroy_connection(conn); die_amqp_error(res, "closing connection"); } @@ -271,7 +271,7 @@ void write_all(int fd, amqp_bytes_t data) ssize_t res = write(fd, data.bytes, data.len); if (res < 0) die_errno(errno, "write"); - + data.len -= res; data.bytes += res; } @@ -281,13 +281,13 @@ void copy_body(amqp_connection_state_t conn, int fd) { size_t body_remaining; amqp_frame_t frame; - + int res = amqp_simple_wait_frame(conn, &frame); die_amqp_error(res, "waiting for header frame"); if (frame.frame_type != AMQP_FRAME_HEADER) die("expected header, got frame type 0x%X", frame.frame_type); - + body_remaining = frame.payload.properties.body_size; while (body_remaining) { res = amqp_simple_wait_frame(conn, &frame); @@ -295,7 +295,7 @@ void copy_body(amqp_connection_state_t conn, int fd) if (frame.frame_type != AMQP_FRAME_BODY) die("expected body, got frame type 0x%X", frame.frame_type); - + write_all(fd, frame.payload.body_fragment); body_remaining -= frame.payload.body_fragment.len; } @@ -330,13 +330,13 @@ void process_all_options(int argc, const char **argv, poptContext opts = process_options(argc, argv, options, "[OPTIONS]..."); const char *opt = poptPeekArg(opts); - + if (opt) { fprintf(stderr, "unexpected operand: %s\n", opt); poptPrintUsage(opts, stderr, 0); exit(1); } - + poptFreeContext(opts); } diff --git a/tools/consume.c b/tools/consume.c index 7e50aa2..3a19d78 100644 --- a/tools/consume.c +++ b/tools/consume.c @@ -53,7 +53,7 @@ static char *stringify_bytes(amqp_bytes_t bytes) uint8_t *data = bytes.bytes; char *p = res; size_t i; - + for (i = 0; i < bytes.len; i++) { if (data[i] >= 32 && data[i] != 127) { *p++ = data[i]; @@ -61,7 +61,7 @@ static char *stringify_bytes(amqp_bytes_t bytes) else { *p++ = '\\'; *p++ = '0' + (data[i] >> 6); - *p++ = '0' + (data[i] >> 3 & 0x7); + *p++ = '0' + (data[i] >> 3 & 0x7); *p++ = '0' + (data[i] & 0x7); } } @@ -112,7 +112,7 @@ static amqp_bytes_t setup_queue(amqp_connection_state_t conn, "queue.bind"); } } - + return queue_bytes; } @@ -137,7 +137,7 @@ static void do_consume(amqp_connection_state_t conn, amqp_bytes_t queue, amqp_basic_deliver_t *deliver = (amqp_basic_deliver_t *)frame.payload.method.decoded; delivery_tag = deliver->delivery_tag; - + pipeline(argv, &pl); copy_body(conn, pl.infd); @@ -177,10 +177,10 @@ int main(int argc, const char **argv) POPT_AUTOHELP { NULL, 0, 0, NULL, 0 } }; - + opts = process_options(argc, argv, options, "[OPTIONS]... "); - + cmd_argv = poptGetArgs(opts); if (!cmd_argv || !cmd_argv[0]) { fprintf(stderr, "consuming command not specified\n"); diff --git a/tools/doc/consume.xml b/tools/doc/consume.xml index c6dc65c..a912e19 100644 --- a/tools/doc/consume.xml +++ b/tools/doc/consume.xml @@ -38,7 +38,7 @@ - + Description @@ -73,7 +73,7 @@ The name of the queue to consume messages from. - + If the option is omitted, the AMQP server will assign a unique diff --git a/tools/doc/declare_queue.xml b/tools/doc/declare_queue.xml index 7e9da32..0fc0440 100644 --- a/tools/doc/declare_queue.xml +++ b/tools/doc/declare_queue.xml @@ -34,7 +34,7 @@ -q queue name - + Description diff --git a/tools/doc/delete_queue.xml b/tools/doc/delete_queue.xml index 69d03d8..040a384 100644 --- a/tools/doc/delete_queue.xml +++ b/tools/doc/delete_queue.xml @@ -33,7 +33,7 @@ -q queue name - + Description diff --git a/tools/doc/get.xml b/tools/doc/get.xml index 9770a8b..08abe2b 100644 --- a/tools/doc/get.xml +++ b/tools/doc/get.xml @@ -33,7 +33,7 @@ -q queue name - + Description diff --git a/tools/doc/publish.xml b/tools/doc/publish.xml index d2e8d2e..e609972 100644 --- a/tools/doc/publish.xml +++ b/tools/doc/publish.xml @@ -32,7 +32,7 @@ - + Description diff --git a/tools/get.c b/tools/get.c index dd60366..fff1db5 100644 --- a/tools/get.c +++ b/tools/get.c @@ -47,7 +47,7 @@ static int do_get(amqp_connection_state_t conn, char *queue) amqp_rpc_reply_t r = amqp_basic_get(conn, 1, cstring_bytes(queue), 1); die_rpc(r, "basic.get"); - + if (r.reply.id == AMQP_BASIC_GET_EMPTY_METHOD) return 0; @@ -68,14 +68,14 @@ int main(int argc, const char **argv) POPT_AUTOHELP { NULL, 0, 0, NULL, 0 } }; - + process_all_options(argc, argv, options); if (!queue) { fprintf(stderr, "queue not specified\n"); return 1; } - + conn = make_connection(); got_something = do_get(conn, queue); close_connection(conn); diff --git a/tools/publish.c b/tools/publish.c index a99b330..d4caff8 100644 --- a/tools/publish.c +++ b/tools/publish.c @@ -80,14 +80,14 @@ int main(int argc, const char **argv) {"content-encoding", 'E', POPT_ARG_STRING, &content_encoding, 0, "the content-encoding for the message", "content encoding"}, - {"body", 'b', POPT_ARG_STRING, &body, 0, - "specify the message body", "body"}, + {"body", 'b', POPT_ARG_STRING, &body, 0, + "specify the message body", "body"}, POPT_AUTOHELP { NULL, 0, 0, NULL, 0 } }; process_all_options(argc, argv, options); - + if (!exchange && !routing_key) { fprintf(stderr, "neither exchange nor routing key specified\n"); @@ -114,12 +114,12 @@ int main(int argc, const char **argv) body_bytes = amqp_cstring_bytes(body); else body_bytes = read_all(0); - + do_publish(conn, exchange, routing_key, &props, body_bytes); if (!body) free(body_bytes.bytes); - + close_connection(conn); return 0; } diff --git a/tools/unix/process.c b/tools/unix/process.c index 835fc7d..1170ab1 100644 --- a/tools/unix/process.c +++ b/tools/unix/process.c @@ -69,7 +69,7 @@ void pipeline(const char *const *argv, struct pipeline *pl) die_errno(posix_spawn_file_actions_destroy(&file_acts), "posix_spawn_file_actions_destroy"); - + if (close(pipefds[0])) die_errno(errno, "close"); diff --git a/tools/windows/process.c b/tools/windows/process.c index 3bf7e58..0cd09fc 100644 --- a/tools/windows/process.c +++ b/tools/windows/process.c @@ -54,7 +54,7 @@ void die_windows_error(const char *fmt, ...) if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, GetLastError(), + NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&msg, 0, NULL)) msg = "(failed to retrieve Windows error message)"; @@ -146,10 +146,10 @@ void pipeline(const char *const *argv, struct pipeline *pl) { HANDLE in_read_handle, in_write_handle; SECURITY_ATTRIBUTES sec_attr; - PROCESS_INFORMATION proc_info; + PROCESS_INFORMATION proc_info; STARTUPINFO start_info; char *cmdline = make_command_line(argv); - + sec_attr.nLength = sizeof sec_attr; sec_attr.bInheritHandle = TRUE; sec_attr.lpSecurityDescriptor = NULL; @@ -159,11 +159,11 @@ void pipeline(const char *const *argv, struct pipeline *pl) if (!SetHandleInformation(in_write_handle, HANDLE_FLAG_INHERIT, 0)) die_windows_error("SetHandleInformation"); - + /* when in Rome... */ ZeroMemory(&proc_info, sizeof proc_info); ZeroMemory(&start_info, sizeof start_info); - + start_info.cb = sizeof start_info; start_info.dwFlags |= STARTF_USESTDHANDLES; @@ -172,7 +172,7 @@ void pipeline(const char *const *argv, struct pipeline *pl) || (start_info.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE)) == INVALID_HANDLE_VALUE) die_windows_error("GetStdHandle"); - + start_info.hStdInput = in_read_handle; if (!CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, @@ -196,7 +196,7 @@ int finish_pipeline(struct pipeline *pl) if (close(pl->infd)) die_errno(errno, "close"); - + for (;;) { if (!GetExitCodeProcess(pl->proc_handle, &code)) die_windows_error("GetExitCodeProcess"); @@ -210,6 +210,6 @@ int finish_pipeline(struct pipeline *pl) if (!CloseHandle(pl->proc_handle)) die_windows_error("CloseHandle for process"); - + return code; } -- cgit v1.2.1