[examples] code cleanup;

v0.5.xx
Alexander Vdolainen 9 years ago
parent 60e676a979
commit 0fde3f330f

@ -61,6 +61,7 @@
#include "../config.h" #include "../config.h"
#define FULL_PROGRAM_NAME "File lister client" #define FULL_PROGRAM_NAME "File lister client"
#include "helpers.h"
struct _remote_host { struct _remote_host {
char *root_x509; char *root_x509;
@ -281,13 +282,6 @@ static void __help_print(FILE *fso, const char *fmtname)
return; return;
} }
static void __version_print(FILE *fso)
{
fprintf(fso, "\nFile list example client.\n");
fprintf(fso, "Examples bundle for %s %s.\n", PACKAGE_NAME, PACKAGE_VERSION);
return;
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char *rootca, *cert, *host, *cmd; char *rootca, *cert, *host, *cmd;
@ -330,7 +324,7 @@ int main(int argc, char **argv)
return 0; return 0;
break; break;
case 'v': case 'v':
__version_print(stdout); version_print(stdout);
return 0; return 0;
break; break;
case 'r': case 'r':

@ -1,7 +1,6 @@
/* /*
* Secure X Message Passing Library v2 examples. * Secure X Message Passing Library v2 examples.
* *
* (c) Originally written by somebody else ...
* (c) Alexander Vdolainen 2013-2015 <avdolainen@gmail.com> * (c) Alexander Vdolainen 2013-2015 <avdolainen@gmail.com>
* *
* libsxmp is free software: you can redistribute it and/or modify it * libsxmp is free software: you can redistribute it and/or modify it
@ -28,4 +27,13 @@ char *nodehostname(void);
int normalize_path(char *path); int normalize_path(char *path);
#ifdef FULL_PROGRAM_NAME
static inline void version_print(FILE *fso)
{
fprintf(fso, "\n%s.\n", FULL_PROGRAM_NAME);
fprintf(fso, "Examples bundle for %s %s.\n", PACKAGE_NAME, PACKAGE_VERSION);
return;
}
#endif
#endif /* __SXMP_EXAMPLES_HELPERS_H__ */ #endif /* __SXMP_EXAMPLES_HELPERS_H__ */

@ -59,12 +59,12 @@
#include <getopt.h> #include <getopt.h>
#include <errno.h> #include <errno.h>
#include "helpers.h"
#include "smpf.h" #include "smpf.h"
#include "smpfd_defs.h" #include "smpfd_defs.h"
#include "../config.h" #include "../config.h"
#define FULL_PROGRAM_NAME "SMPF (secure message passing file) daemon" #define FULL_PROGRAM_NAME "SMPF (secure message passing file) daemon"
#include "helpers.h"
static struct smpfd_ctx daemon_ctx; static struct smpfd_ctx daemon_ctx;
@ -155,13 +155,6 @@ static void __help_print(FILE *fso, const char *fmtname)
return; return;
} }
static void __version_print(FILE *fso)
{
fprintf(fso, "\n%s.\n", FULL_PROGRAM_NAME);
fprintf(fso, "Examples bundle for %s %s.\n", PACKAGE_NAME, PACKAGE_VERSION);
return;
}
/* control operations */ /* control operations */
static int __setcwd(void *m, sexp_t *sx) static int __setcwd(void *m, sexp_t *sx)
{ {
@ -375,7 +368,7 @@ int main(int argc, char **argv)
return 0; return 0;
break; break;
case 'v': case 'v':
__version_print(stdout); version_print(stdout);
return 0; return 0;
break; break;
case 'r': case 'r':

@ -62,6 +62,7 @@
#include "../config.h" #include "../config.h"
#define FULL_PROGRAM_NAME "File lister client (builtin streams based)" #define FULL_PROGRAM_NAME "File lister client (builtin streams based)"
#include "helpers.h"
struct _remote_host { struct _remote_host {
char *root_x509; char *root_x509;
@ -174,13 +175,6 @@ static int __remote_host_connect(struct _remote_host *rh)
} }
/* standard output helpers */ /* standard output helpers */
static void __version_print(FILE *fso)
{
fprintf(fso, "\nFile list example client based on builtin streams.\n");
fprintf(fso, "Examples bundle for %s %s.\n", PACKAGE_NAME, PACKAGE_VERSION);
return;
}
static void __help_print(FILE *fso, const char *fmtname) static void __help_print(FILE *fso, const char *fmtname)
{ {
int i; int i;
@ -305,7 +299,7 @@ int main(int argc, char **argv)
return 0; return 0;
break; break;
case 'v': case 'v':
__version_print(stdout); version_print(stdout);
return 0; return 0;
break; break;
case 'r': case 'r':

@ -65,10 +65,10 @@
#include <errno.h> #include <errno.h>
#include "filelist.h" #include "filelist.h"
#include "helpers.h"
#include "../config.h" #include "../config.h"
#define FULL_PROGRAM_NAME "File lister master (builtin streams based)" #define FULL_PROGRAM_NAME "File lister master (builtin streams based)"
#include "helpers.h"
/* firstly we need to take an rpc calls data, /* firstly we need to take an rpc calls data,
* sxmp uses usrtc from libtdata to store it * sxmp uses usrtc from libtdata to store it
@ -254,13 +254,6 @@ static void __help_print(FILE *fso, const char *fmtname)
return; return;
} }
static void __version_print(FILE *fso)
{
fprintf(fso, "\nFile list example master daemon (builtin streams).\n");
fprintf(fso, "Examples bundle for %s %s.\n", PACKAGE_NAME, PACKAGE_VERSION);
return;
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char *rootca = NULL, *cert = NULL; char *rootca = NULL, *cert = NULL;
@ -290,7 +283,7 @@ int main(int argc, char **argv)
return 0; return 0;
break; break;
case 'v': case 'v':
__version_print(stdout); version_print(stdout);
return 0; return 0;
break; break;
case 'r': case 'r':

Loading…
Cancel
Save