aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/print_help.cpp
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-05-02 21:41:17 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-05-02 22:07:58 -0700
commit9d742a4fa18d3bdab0ab2b68f8f57e334ea3c0e1 (patch)
treec10a76c3c8813f74d2e3b814e91d7dc6475ad0fb /src/print_help.cpp
parentdc8d31a12abc2dbd2aebd7a9c9b34207110c1233 (diff)
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.
Diffstat (limited to 'src/print_help.cpp')
-rw-r--r--src/print_help.cpp25
1 files changed, 7 insertions, 18 deletions
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 <stdlib.h>
+// Print help message for the specified command.
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
+#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));
}
-
}
-
}