1#include <stdio.h> 2#include <nvcommons5.h> 3 4char * strsep_with_validation(char **ptr,char *sep,char * retchar) 5{ 6 char * strptr ; 7 char *cptr; 8 9 if (*ptr == NULL) 10 return retchar; 11 12 strptr =strsep(ptr,sep); 13 if (strptr != NULL) { 14 15 /* change eny last \n to NULL */ 16 cptr = strchr(strptr,'\r');; 17 if (cptr != NULL) 18 *cptr =' '; 19 20 21 if (*strptr == 0x00) 22 return retchar; 23 24 }else if (strptr == NULL) 25 return retchar; 26 27 return strptr; 28} 29 30