fish-shell/src/print_help.cpp
Kurtis Rader 9d742a4fa1 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.
2016-05-02 22:07:58 -07:00

22 lines
516 B
C++

// Print help message for the specified command.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "print_help.h"
#define CMD_LEN 1024
#define HELP_ERR "Could not show help message\n"
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)) {
write_loop(2, HELP_ERR, strlen(HELP_ERR));
}
}
}