#include #include #include int main(int args, char* argv) { char line[257]; // 256 chars + ending zero char c; int l; fprintf(stderr,"--Relay PID=%d\n",getpid()); while (1) { // Read line of lenght up to 256 bytes for (l=0; l < 256; l++) { c = getchar(); if (c==EOF || c=='\n') break; line[l] = c; } if (l==0 && c==EOF) break; line[l] = 0; // terminate string fprintf(stdout,"[%s]\n",line); // Relay line in brackets fflush(stdout); } exit(0); }