From 9d742a4fa18d3bdab0ab2b68f8f57e334ea3c0e1 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Mon, 2 May 2016 21:41:17 -0700 Subject: restyle proc module to match project style Reduces lint errors from 134 to 101 (-25%). Line count from 1994 to 1466 (-26%). Another step in resolving issue #2902. --- src/print_help.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'src/print_help.cpp') diff --git a/src/print_help.cpp b/src/print_help.cpp index 856b87d5..ad479023 100644 --- a/src/print_help.cpp +++ b/src/print_help.cpp @@ -1,33 +1,22 @@ -/** \file print_help.c - Print help message for the specified command -*/ -#include +// Print help message for the specified command. #include +#include #include -#include +#include "common.h" #include "print_help.h" #define CMD_LEN 1024 #define HELP_ERR "Could not show help message\n" -/* defined in common.h */ -ssize_t write_loop(int fd, const char *buff, size_t count); - - -void print_help(const char *c, int fd) -{ - char cmd[ CMD_LEN]; +void print_help(const char *c, int fd) { + char cmd[CMD_LEN]; int printed = snprintf(cmd, CMD_LEN, "fish -c '__fish_print_help %s >&%d'", c, fd); - if (printed < CMD_LEN) - { - if ((system(cmd) == -1)) - { + if (printed < CMD_LEN) { + if ((system(cmd) == -1)) { write_loop(2, HELP_ERR, strlen(HELP_ERR)); } - } - } -- cgit v1.2.3