Versão limpa em 04/09/2014. Telnet funcionando.

Dependencies:   EthernetInterface mbed-rtos mbed NTPClient

Committer:
rebonatto
Date:
Mon Jan 18 18:26:03 2016 +0000
Revision:
43:69afea5f5a4d
Parent:
0:66d8bd1f9d4c
Aquisi??o sem DMA, 256 amostras.; Buffer simples com  copia de buffer para calculo da FFT.; Com telnetr e TFTP ativos. Telnet funcionando sem travar.; Vers?o com WhatDog.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rebonatto 0:66d8bd1f9d4c 1 /*
rebonatto 0:66d8bd1f9d4c 2 * Split.c
rebonatto 0:66d8bd1f9d4c 3 *
rebonatto 0:66d8bd1f9d4c 4 * Created on: 12/04/2012
rebonatto 0:66d8bd1f9d4c 5 * Author: francisco
rebonatto 0:66d8bd1f9d4c 6 */
rebonatto 0:66d8bd1f9d4c 7
rebonatto 0:66d8bd1f9d4c 8 #include "Split.h"
rebonatto 0:66d8bd1f9d4c 9
rebonatto 0:66d8bd1f9d4c 10 int split(char* str,char* delim,char*** ret )
rebonatto 0:66d8bd1f9d4c 11 {
rebonatto 0:66d8bd1f9d4c 12 char *p = NULL;
rebonatto 0:66d8bd1f9d4c 13 char *e = NULL;
rebonatto 0:66d8bd1f9d4c 14 char **array = NULL;
rebonatto 0:66d8bd1f9d4c 15 int qty = 0;
rebonatto 0:66d8bd1f9d4c 16 int len = strlen(str);
rebonatto 0:66d8bd1f9d4c 17
rebonatto 0:66d8bd1f9d4c 18 p = str;
rebonatto 0:66d8bd1f9d4c 19
rebonatto 0:66d8bd1f9d4c 20 e = strstr(p,delim);
rebonatto 0:66d8bd1f9d4c 21
rebonatto 0:66d8bd1f9d4c 22 while( e != NULL)
rebonatto 0:66d8bd1f9d4c 23 {
rebonatto 0:66d8bd1f9d4c 24 qty++;
rebonatto 0:66d8bd1f9d4c 25 if(qty==1)
rebonatto 0:66d8bd1f9d4c 26 array = (char**)malloc(sizeof(char*)*qty);
rebonatto 0:66d8bd1f9d4c 27 else
rebonatto 0:66d8bd1f9d4c 28 array = (char**)realloc(array,sizeof(char*)*qty);
rebonatto 0:66d8bd1f9d4c 29
rebonatto 0:66d8bd1f9d4c 30 array[qty-1] = p;
rebonatto 0:66d8bd1f9d4c 31 *e = '\0';
rebonatto 0:66d8bd1f9d4c 32 p = e + strlen(delim);
rebonatto 0:66d8bd1f9d4c 33 e = strstr(p,delim);
rebonatto 0:66d8bd1f9d4c 34 }
rebonatto 0:66d8bd1f9d4c 35 if(p-str < len)
rebonatto 0:66d8bd1f9d4c 36 {
rebonatto 0:66d8bd1f9d4c 37 qty++;
rebonatto 0:66d8bd1f9d4c 38 if(qty==1)
rebonatto 0:66d8bd1f9d4c 39 array = (char**)malloc(sizeof(char*)*qty);
rebonatto 0:66d8bd1f9d4c 40 else
rebonatto 0:66d8bd1f9d4c 41 array = (char**)realloc(array,sizeof(char*)*qty);
rebonatto 0:66d8bd1f9d4c 42 array[qty-1] = p;
rebonatto 0:66d8bd1f9d4c 43 }
rebonatto 0:66d8bd1f9d4c 44
rebonatto 0:66d8bd1f9d4c 45 *ret = array;
rebonatto 0:66d8bd1f9d4c 46 return qty;
rebonatto 0:66d8bd1f9d4c 47 }