CMPS-3600 - Fall 2025 - Semester Project

Phase-2 - Send and receive signals - multiple child windows ----------------------------------------------------------- You may start with myxwindow.c or execve.c. Name your program: 3600/6/bbphase2.c Compile like this... gcc bbphase2.c -Wall -lX11 Phase-2 is very similar to phase-1. Note: You may use keyboard input only for this program. There is no requirement for mouse control. Graphics are used to show which keys would be pressed. Rules for phase-2... 1. Remove your call to main when starting your child window. ------------------------------------------------------------ Instead, call execve() like we did in class together. 2. Choose one or more --------------------- of xeyes, xclock, or xlogo as additional child windows. 3. Use signals only for communication. -------------------------------------- Your parent should have 1 signal handler. Inside the parent's signal handler, you should call waitpid(). This will let you determine which child window closed. Call waitpid like this: int status; int child_pid = waitpid(-1, &status, WUNTRACED | WNOHANG); This program does not use signal masks or signal blocking. Keep your signal code simple like in our 3600/3/mysignals.c program. 4. The child window should have 2 signal handlers. -------------------------------------------------- You may use the SIGUSR1 and SIGURS2 signals. One handler will watch for a color change request. One handler will watch for a signal to terminate itself. You should put usleep(100000); in each signal handler. You may call render() from your signal handlers. You can set a random background color something like this: child_background_color = rand(); render(); 5. Your colors can vary from the animation shown ------------------------------------------------ but your text must be readable against the background. You may attempt to write a color algorithm to keep the child window text always readable against the random background color. 6. The child window will print a 'c' to the terminal on mouse move. ------------------------------------------------------------------- Keep your program as simple as possible.