c-ipfs/commands/argument.c
John Jones 50ffade515 More work on storage and cleanup
Added flatfs, as well as fixed some memory leaks. Valgrind across tests
now reports 0 memory leaks.
2016-11-28 08:09:00 -05:00

31 lines
951 B
C

#include <stdlib.h>
#include <string.h>
#include "ipfs/commands/argument.h"
int commands_argument_free(struct Argument* argument) {
free(argument);
return 1;
}
int commands_argument_init(struct Argument* argument, char* name, int required, int variadic, char* description) {
argument->name = name;
argument->required = required;
argument->variadic = variadic;
argument->description = description;
return 1;
}
int commands_argument_string_init(struct Argument* argument, char* name, int required, int variadic, char* description) {
int retVal = commands_argument_init(argument, name, required, variadic, description);
if (retVal)
argument->type = string;
return retVal;
}
int commands_argument_file_init(struct Argument* argument, char* name, int required, int variadic, char* description) {
int retVal = commands_argument_init(argument, name, required, variadic, description);
if (retVal)
argument->type = file;
return retVal;
}