2013-12-25 13:29:54 +01:00
|
|
|
#include "cmdlineoptions.h"
|
2013-12-25 17:27:41 +01:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2013-12-25 13:29:54 +01:00
|
|
|
|
|
|
|
CmdOptions cmdoptions;
|
|
|
|
|
2013-12-25 17:27:41 +01:00
|
|
|
void CmdOptions_Init() {
|
2013-12-25 13:29:54 +01:00
|
|
|
if (cmdoptions.init == 0) {
|
|
|
|
cmdoptions.init = 1;
|
|
|
|
// do we have to init something?
|
|
|
|
// add the help option
|
2013-12-25 17:27:41 +01:00
|
|
|
CmdOptions_Add("help", "--help");
|
|
|
|
CmdOptions_Add("help", "-h");
|
|
|
|
CmdOptions_Add("help", "-?");
|
|
|
|
CmdOptions_AddDescription("help", "Display the help text.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int CmdOptions_Create(char* name) {
|
|
|
|
if (CmdOptions_NodeGet(name) == 0) {
|
|
|
|
CONode* newnode = 0;
|
|
|
|
newnode = malloc(sizeof(CONode));
|
|
|
|
if (cmdoptions.options == 0) {
|
|
|
|
cmdoptions.options = newnode;
|
|
|
|
} else {
|
|
|
|
CONode* last = cmdoptions.options;
|
|
|
|
while (last->next != 0)
|
|
|
|
last = last->next;
|
|
|
|
last->next = newnode;
|
|
|
|
}
|
|
|
|
newnode->next = 0;
|
|
|
|
newnode->option = malloc(sizeof(Option));
|
|
|
|
newnode->option->name = name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CONode* CmdOptions_NodeGet(char* name) {
|
|
|
|
if (cmdoptions.options != 0) {
|
|
|
|
CONode* node = cmdoptions.options;
|
|
|
|
while (node != 0) {
|
|
|
|
if (strcmp(name, node->option->name) == 0) {
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
node = node->next;
|
|
|
|
}
|
2013-12-25 13:29:54 +01:00
|
|
|
}
|
2013-12-25 17:27:41 +01:00
|
|
|
return 0;
|
2013-12-25 13:29:54 +01:00
|
|
|
}
|
|
|
|
|
2013-12-25 17:27:41 +01:00
|
|
|
int CmdOptions_Parse(int argc, char** argv) {
|
2013-12-25 13:29:54 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-12-25 17:27:41 +01:00
|
|
|
int CmdOptions_Add(char* name, char* option) {
|
2013-12-25 13:29:54 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-12-25 17:27:41 +01:00
|
|
|
int CmdOptions_AddDefaultParameter(char* name, char* defaultparameter) {
|
2013-12-25 13:29:54 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-12-25 17:27:41 +01:00
|
|
|
int CmdOptions_AddPossibleParameter(char* name, char* possibleParameter) {
|
2013-12-25 13:29:54 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int CmdOptions_AddDescription(char* name, char* description) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-12-25 17:27:41 +01:00
|
|
|
int CmdOptions_IsSet(char* name) {
|
2013-12-25 13:29:54 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-12-25 17:27:41 +01:00
|
|
|
char* CmdOptions_Get(char* name) {
|
2013-12-25 13:29:54 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-12-25 17:27:41 +01:00
|
|
|
int CmdOptions_GetInt(char* name) {
|
2013-12-25 13:29:54 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-12-25 17:27:41 +01:00
|
|
|
long CmdOptions_GetLong(char* name) {
|
2013-12-25 13:29:54 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-12-25 17:27:41 +01:00
|
|
|
double CmdOptions_GetDouble(char* name) {
|
2013-12-25 13:29:54 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-12-25 17:27:41 +01:00
|
|
|
int CmdOptions_GetAll(char* name, char** values, unsigned int* count) {
|
2013-12-25 13:29:54 +01:00
|
|
|
|
|
|
|
}
|