#include #include const int MAX_LENGTH = 256; int main(int argc, char *args[]) { char *tag = args[1]; char buffer[MAX_LENGTH]; printf("Node %s started.\n", tag); fflush(stdout); while (fgets(buffer, sizeof(buffer), stdin) > 0) { // Remove the '\n' at the end. buffer[strlen(buffer) - 1] = '\0'; printf("[%s: %s]\n", tag, buffer); fflush(stdout); } printf("Node %s done!\n", tag); return 0; }