Commit 25ab5979 authored by chenhaowen's avatar chenhaowen

fix: version marco expand error

parent 8883866c
...@@ -5,10 +5,6 @@ ...@@ -5,10 +5,6 @@
#include <unistd.h> #include <unistd.h>
#include <getopt.h> #include <getopt.h>
#ifndef VERSION
#define VERSION 0.0.0
#endif
struct option_s { struct option_s {
char key[256]; char key[256];
char value[256]; char value[256];
...@@ -46,7 +42,7 @@ void set_enable_crypt(int enable) ...@@ -46,7 +42,7 @@ void set_enable_crypt(int enable)
void get_version(char* version) void get_version(char* version)
{ {
strcpy(version, "VERSION"); strcpy(version, _VERSION);
} }
void set_log_file(char * log_file, int len) void set_log_file(char * log_file, int len)
......
...@@ -3,6 +3,14 @@ ...@@ -3,6 +3,14 @@
#include <stdio.h> #include <stdio.h>
#ifndef VERSION
#define VERSION 0.0.0
#endif
#define _VERSION __VERSION(VERSION)
#define __VERSION(str) ___VERSION(str)
#define ___VERSION(str) #str
enum CRYPT_TYPE { enum CRYPT_TYPE {
DISABLE_CRYPT=0, DISABLE_CRYPT=0,
ENABLE_CRYPT=1, ENABLE_CRYPT=1,
......
...@@ -5,10 +5,6 @@ ...@@ -5,10 +5,6 @@
#include "auth.h" #include "auth.h"
#include "config.h" #include "config.h"
#ifndef VERSION
#define VERSION 0.0.0
#endif
static void print_help(char * name); static void print_help(char * name);
int main(int argc, char *argv[]) int main(int argc, char *argv[])
...@@ -67,7 +63,7 @@ int main(int argc, char *argv[]) ...@@ -67,7 +63,7 @@ int main(int argc, char *argv[])
exit(0); exit(0);
break; break;
case 'v': case 'v':
fprintf(stdout, "version: %s\n", "VERSION"); fprintf(stdout, "version: %s\n", _VERSION);
exit(0); exit(0);
break; break;
case 'l': case 'l':
...@@ -107,7 +103,7 @@ static void print_help(char *name) ...@@ -107,7 +103,7 @@ static void print_help(char *name)
" /___/ " " /___/ "
); );
fprintf(stdout, "A third-party drcom client for gdut. version %s\n", "VERSION"); fprintf(stdout, "A third-party drcom client for gdut. version %s\n", _VERSION);
fprintf(stdout, "usage:\n"); fprintf(stdout, "usage:\n");
fprintf(stdout, " %s\n", name); fprintf(stdout, " %s\n", name);
fprintf(stdout, " --remote-ip <ip addr> The server ip.\n"); fprintf(stdout, " --remote-ip <ip addr> The server ip.\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment