もう解決してるけど・・
一行処理はこんな感じでうか?
while((c=fgetc(stdin)) != '\n'){
if(c == ','){
while((c=fgetc(stdin)) == ',')
fprintf(stdout," NULL");
if(c == '\n'){
fprintf(stdout, " NULL");
break;
}
fputc(' ',stdout);
}
fputc(c, stdout);
}