Commit 666a561a authored by Nigel Kukard's avatar Nigel Kukard
Browse files

* Moved argv & argc handling functions to misc.h

parent c0ac78e0
......@@ -30,31 +30,6 @@
#include "common.h"
// Macro to add a double -a .... parameter to a char ** array
#define ADD_DOUBLE_PARAM(paramList,numParams,param,format,...) \
{ \
int i; \
\
numParams += 2; \
paramList = (char **) realloc(paramList, numParams * sizeof(char*)); \
for (i = numParams - 2; i < numParams; i++) \
paramList[i] = malloc0(BUFFER_SIZE); \
strcpy(paramList[numParams - 2], param); \
snprintf(paramList[numParams - 1], BUFFER_SIZE, format, __VA_ARGS__); \
}
// Macro to add a single -a parameter to a char ** array
#define ADD_SINGLE_PARAM(paramList,numParams,format,...) \
{ \
int i; \
\
numParams += 1; \
paramList = (char **) realloc(paramList, numParams * sizeof(char*)); \
for (i = numParams - 1; i < numParams; i++) \
paramList[i] = malloc0(BUFFER_SIZE); \
snprintf(paramList[numParams - 1], BUFFER_SIZE, format, __VA_ARGS__); \
}
// Macro to decide the correct date and time
#define STR_TIME(time_p,buffer_size,buffer) \
{ \
......
......@@ -26,6 +26,32 @@
#define _MISC_H
// Macro to add a double -a .... parameter to a char ** array
#define ADD_DOUBLE_PARAM(paramList,numParams,param,format,...) \
{ \
int i; \
\
numParams += 2; \
paramList = (char **) realloc(paramList, numParams * sizeof(char*)); \
for (i = numParams - 2; i < numParams; i++) \
paramList[i] = malloc0(BUFFER_SIZE); \
strcpy(paramList[numParams - 2], param); \
snprintf(paramList[numParams - 1], BUFFER_SIZE, format, __VA_ARGS__); \
}
// Macro to add a single -a parameter to a char ** array
#define ADD_SINGLE_PARAM(paramList,numParams,format,...) \
{ \
int i; \
\
numParams += 1; \
paramList = (char **) realloc(paramList, numParams * sizeof(char*)); \
for (i = numParams - 1; i < numParams; i++) \
paramList[i] = malloc0(BUFFER_SIZE); \
snprintf(paramList[numParams - 1], BUFFER_SIZE, format, __VA_ARGS__); \
}
// Convert everything between start & end into an integer
int aptrtoi(char *start, char *end);
......
Supports Markdown
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