-
- pid = fork();
- switch (pid)
- {
- case -1: break;
- case 0: execlp ("slrnface", "slrnface", fifo, (char *)0);
- /* This is child, exit on error. */
- _exit (10);
- default: do {
- pidst = waitpid (pid, &status, 0);
- } while (pidst == -1 && errno == EINTR);
-
- if (!WIFEXITED (status))
- mutt_error (_("Slrnface abnormaly exited, code %d."), status);
- else
- {
- char *message;
-
- switch (WEXITSTATUS (status))
- {
- case 0: /* All fine, open the pipe */
- slrnface_fd = open (fifo, O_WRONLY, 0600);
- write (slrnface_fd, "start\n", sizeof "start");
- goto clean_face;
- case 1: message = "couldn't connect to display";
- break;
- case 2: message = "WINDOWID not found in environment";
- break;
- case 3: message = "couldn't find controlling terminal";
- break;
- case 4: message = "terminal doesn't export width and height";
- break;
- case 5: message = "cannot open FIFO";
- break;
- case 6: message = "fork() failed";
- break;
- case 10: message = "executable not found";
- break;
- default: message = "unknown error";
- }
- mutt_error (_("Slrnface failed: %s."), message);
- }
- }
-
-clean_face:
- unlink (fifo);
- free (fifo);
-}
-
-void mutt_stop_slrnface(void)
-{
- if (slrnface_fd >= 0)
- close(slrnface_fd);
- slrnface_fd = -1;
-
- /* FIFO has been unlinked in the startup function. */