Complet exercici 3a
This commit is contained in:
parent
36bac13b1b
commit
7b660cd0dc
1 changed files with 24 additions and 1 deletions
|
@ -19,6 +19,7 @@
|
||||||
#define MAX_PERSON_NAME_LEN 15
|
#define MAX_PERSON_NAME_LEN 15
|
||||||
#define MAX_PERSON_EMAIL_LEN 30
|
#define MAX_PERSON_EMAIL_LEN 30
|
||||||
#define MAX_PERSON_ADDRESS_LEN 30
|
#define MAX_PERSON_ADDRESS_LEN 30
|
||||||
|
#define VACCINE_TYPE_NAME "VACCINE"
|
||||||
|
|
||||||
// Get the API version information
|
// Get the API version information
|
||||||
const char* api_version() {
|
const char* api_version() {
|
||||||
|
@ -237,7 +238,29 @@ tApiError api_getVaccine(tApiData data, const char *name, tCSVEntry *entry) {
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
// Ex PR1 3a
|
// Ex PR1 3a
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
return E_NOT_IMPLEMENTED;
|
|
||||||
|
tApiError ret = E_NOT_IMPLEMENTED;
|
||||||
|
tVaccine* found;
|
||||||
|
char buffer[FILE_READ_BUFFER_SIZE];
|
||||||
|
|
||||||
|
found = vaccineList_find(data.vaccines,name);
|
||||||
|
|
||||||
|
if (found) { // If pointer is not null, vaccine exists
|
||||||
|
|
||||||
|
// Fill buffer with data from the vaccine on that pointer
|
||||||
|
sprintf(buffer, "%s;%d;%d", found->name, found->required, found->days);
|
||||||
|
|
||||||
|
// Init CSV entry and set values accordingly
|
||||||
|
csv_initEntry(entry);
|
||||||
|
csv_parseEntry(entry,buffer,VACCINE_TYPE_NAME);
|
||||||
|
|
||||||
|
ret = E_SUCCESS;
|
||||||
|
|
||||||
|
} else { // If pointer is null, vaccine does not exist
|
||||||
|
ret = E_VACCINE_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get vaccine lot data
|
// Get vaccine lot data
|
||||||
|
|
Reference in a new issue