Date: Thu, 15 Nov 2012 00:08:10 GMT From: Brooks Davis <brooks@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 219788 for review Message-ID: <201211150008.qAF08ALq026564@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@219788?ac=10 Change 219788 by brooks@brooks_zenith on 2012/11/15 00:08:08 Launch cheripoint from the lower left corner rather than the internal slide show tool. Submitted by: bz Affected files ... .. //depot/projects/ctsrd/cheribsd/src/ctsrd/pictview/pictview.c#6 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/ctsrd/pictview/pictview.c#6 (text+ko) ==== @@ -695,7 +695,7 @@ return display_image; } - +#ifdef USE_HW_ENG_CODE void pictview_pan() { int pan_direction = -1; @@ -767,6 +767,70 @@ } } } +#else +static void +pictview_pan(void) +{ + static int pmaster; + int pslave, n; + char buf[1024]; + ssize_t rlen; + struct pollfd pfd[1]; + + if (openpty(&pmaster, &pslave, NULL, NULL, NULL) == -1) + err(1, "openpty"); + browser_pid = fork(); + if (browser_pid < 0) + err(1, "fork()"); + else if (browser_pid > 0) + close(pslave); + else { + close(pmaster); + if (login_tty(pslave) < 0) { + syslog(LOG_ALERT, "login_tty failed in child: %s", strerror(errno)); + err(1, "tty_login"); + } + execl("/usr/bin/cheripoint", "cheripoint", slide_dir, NULL); + syslog(LOG_ALERT, "exec of /usr/bin/cheripoint failed: %s", strerror(errno)); + err(1, "execl()"); + } + + for(;;) { + /* + * If the child has exited, reset the state and return to the + * main screen. + */ + if (browser_pid == 0) { + close(pmaster); + break; + } + + /* Check for output from the child and post it if needed */ + pfd[0].fd = pmaster; + pfd[0].events = POLLIN; + n = poll(pfd, 1, INFTIM); + if (n == 0) + continue; + else if (n < 0) { + if (errno == EINTR) + continue; + err(1, "poll"); + } + if (n < 0) { + syslog(LOG_ALERT, "poll failed with %s", strerror(errno)); + err(1, "poll"); + } + if (pfd[0].revents & POLLIN) { + rlen = read(pfd[0].fd, buf, sizeof(buf)); + if (rlen < 0) { + syslog(LOG_ALERT, "read failed: %s", strerror(errno)); + err(1, "read"); + } else if (rlen > 0) + writeall(0, buf, rlen); + } + } +} +#endif void @@ -898,6 +962,7 @@ slide_dir = optarg; default: usage(); + /* ENOKABOOMHERE */ } } argc -= optind; @@ -922,6 +987,13 @@ } } +#ifndef USE_HW_ENG_CODE + if (slide_dir == NULL) { + usage(); + err(1, "usage: must pass in -s <dir>"); + } +#endif + pictview(); fb_fini();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211150008.qAF08ALq026564>