Core Base Classes for the Light Endpoints
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
Diff: main.cpp
- Revision:
- 80:805143f36554
- Parent:
- 78:afb93ba1dbfd
- Child:
- 81:9e902c2b855e
--- a/main.cpp Wed Mar 05 17:36:11 2014 +0000 +++ b/main.cpp Tue Mar 11 15:45:30 2014 +0000 @@ -67,9 +67,20 @@ lcd.printf("Endpoint Shutdown %s",strCode(code)); exit(1); } + + // strdup() + char *strdup(char *str) { + if (str != NULL) { + char *cp = (char *)malloc(strlen(str)+1)); + memset(cp,0,strlen(str)+1); + memcpy(cp,str,strlen(str)); + return cp; + } + return NULL; + } -// Main Entry -int main() { + // Main Entry + int main() { #ifdef MAC_ADDRESS mbed_mac_address(mac); memset(fmt_mac,0,RESOURCE_VALUE_LEN+1); @@ -78,4 +89,4 @@ error_handler = new ErrorHandler(&pc,&lcd); endpoint = new MBEDEndpoint(error_handler,ðernet); if (endpoint != NULL) endpoint->run(); -} + }