mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-03 16:44:00 +08:00
14c84ffbcb
darcs-hash:20090222202852-ac50b-b0e79142af5b7a99e55271d4001fa252d9684a1d.gz
31 lines
500 B
C
31 lines
500 B
C
|
|
/** \file print_help.c
|
|
Print help message for the specified command
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include "print_help.h"
|
|
|
|
#define CMD_LEN 1024
|
|
|
|
#define HELP_ERR "Could not show help message\n"
|
|
|
|
void print_help( 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));
|
|
}
|
|
|
|
}
|
|
|
|
}
|