diff options
Diffstat (limited to 'include/grpc/support/cmdline.h')
-rw-r--r-- | include/grpc/support/cmdline.h | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/include/grpc/support/cmdline.h b/include/grpc/support/cmdline.h index 3058cf905a..6f442e3cf2 100644 --- a/include/grpc/support/cmdline.h +++ b/include/grpc/support/cmdline.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,6 +34,8 @@ #ifndef GRPC_SUPPORT_CMDLINE_H #define GRPC_SUPPORT_CMDLINE_H +#include <grpc/support/port_platform.h> + #ifdef __cplusplus extern "C" { #endif @@ -68,31 +70,31 @@ typedef struct gpr_cmdline gpr_cmdline; /* Construct a command line parser: takes a short description of the tool doing the parsing */ -gpr_cmdline *gpr_cmdline_create(const char *description); +GPR_API gpr_cmdline *gpr_cmdline_create(const char *description); /* Add an integer parameter, with a name (used on the command line) and some helpful text (used in the command usage) */ -void gpr_cmdline_add_int(gpr_cmdline *cl, const char *name, const char *help, - int *value); +GPR_API void gpr_cmdline_add_int(gpr_cmdline *cl, const char *name, + const char *help, int *value); /* The same, for a boolean flag */ -void gpr_cmdline_add_flag(gpr_cmdline *cl, const char *name, const char *help, - int *value); +GPR_API void gpr_cmdline_add_flag(gpr_cmdline *cl, const char *name, + const char *help, int *value); /* And for a string */ -void gpr_cmdline_add_string(gpr_cmdline *cl, const char *name, const char *help, - char **value); +GPR_API void gpr_cmdline_add_string(gpr_cmdline *cl, const char *name, + const char *help, char **value); /* Set a callback for non-named arguments */ -void gpr_cmdline_on_extra_arg( +GPR_API void gpr_cmdline_on_extra_arg( gpr_cmdline *cl, const char *name, const char *help, void (*on_extra_arg)(void *user_data, const char *arg), void *user_data); /* Enable surviving failure: default behavior is to exit the process */ -void gpr_cmdline_set_survive_failure(gpr_cmdline *cl); +GPR_API void gpr_cmdline_set_survive_failure(gpr_cmdline *cl); /* Parse the command line; returns 1 on success, on failure either dies (by default) or returns 0 if gpr_cmdline_set_survive_failure() has been called */ -int gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv); +GPR_API int gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv); /* Destroy the parser */ -void gpr_cmdline_destroy(gpr_cmdline *cl); +GPR_API void gpr_cmdline_destroy(gpr_cmdline *cl); /* Get a string describing usage */ -char *gpr_cmdline_usage_string(gpr_cmdline *cl, const char *argv0); +GPR_API char *gpr_cmdline_usage_string(gpr_cmdline *cl, const char *argv0); #ifdef __cplusplus } |