strcpy(exclude,searchWeekDay(buffer,"")); // salvo in eclude il giorno della settimana trovato
strcpy(tmp2,exclude); //salvo il giorno della settimana in un altra variabile temporanea
strcat(ricorrenza,strcat(tmp2,"_to_")); //salvo in ricorrenza "giornoSettimana_to_"
strcat(ricorrenza,searchWeekDay(buffer,exclude)); //richiamo la funzione
puts(ricorrenza); //Output atteso: giornoSettimana_to_GiornoSettimanaDiversoDalPrimo
char * searchWeekDay(char * buffer, char * exclude)
{
char *tmp = buffer;
int n=0;
if(exclude != "Lun" && strstr(tmp,"(ricorrente: Lun") != NULL)
{
return "Lun";
}
else if((exclude != "Mar") && strstr(tmp,"(ricorrente: Mar") != NULL)
{
return "Mar";
}
else if((exclude != "Mer") && strstr(tmp,"(ricorrente: Mer") != NULL)
{
return "Mer";
}
else if((exclude != "Gio") && strstr(tmp,"(ricorrente: Gio") != NULL)
{
return "Gio";
}
else if((exclude != "Ven") && strstr(tmp,"(ricorrente: Ven") != NULL)
{
return "Ven";
}
else if((exclude != "Sab") && strstr(tmp,"(ricorrente: Sab") != NULL)
{
return "Sab";
}
else if((exclude != "Dom") && strstr(tmp,"(ricorrente: Dom") != NULL)
{
return "Dom";
}
}