

#include<stdio.h>
#include<unistd.h>
#include<sys/wait.h>
#include<netinet/in.h>
#include<string.h>
#include<stdlib.h>
#include<pthread.h>

#include"sitar.h"
#include"sitar_com.h"
#include<almemsys/almemsys.h>
#include"jpreturn.h"
#include<file_comp/file_comp.h>




char * check_strtol(char * data)
{
char * swap;
int count, count0; 
int cmax = (int)strlen(data);

swap = (char *)calloc((cmax + 35), sizeof(char));

count0 = 0;
for(count = 0; count < cmax; count++){
   switch(data[count]){
      case ',' : 
                 if(count > 0){
                    if(data[count - 1] == ','){
                       swap[count0] = 'N';
                       count0++;
                       swap[count0] = 'O';
                       count0++;
                       swap[count0] = 'T';
                       count0++;
                       swap[count0] = ',';
                       }
                    else{
                       swap[count0] = data[count];
                       }
                    }
                 else{
                    swap[count0] = data[count];
                    }
                 break;
      default  : 
                 swap[count0] = data[count];
                 break;
      }
   count0++;
   }

if(count0 > 0){
   swap[count0] = (char)0x00;
   data = safe_memcpy(data, swap, BUF_MAX);
   }

#ifdef FREE_BUG
printf("FREE: single check_strtol(1): swap %s\n", swap);
#endif
free(swap);

return data;
}






