teken_demo.c (197115) | teken_demo.c (197117) |
---|---|
1/*- 2 * Copyright (c) 2008-2009 Ed Schouten <ed@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2008-2009 Ed Schouten <ed@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/teken/teken_demo.c 197115 2009-09-12 10:34:34Z ed $ | 26 * $FreeBSD: head/sys/teken/teken_demo.c 197117 2009-09-12 12:44:21Z ed $ |
27 */ 28 29#include <sys/ioctl.h> 30 31#include <assert.h> 32#include <errno.h> 33#include <inttypes.h> 34#include <locale.h> --- 31 unchanged lines hidden (view full) --- 66}; 67 68struct pixel { 69 teken_char_t c; 70 teken_attr_t a; 71}; 72 73#define NCOLS 80 | 27 */ 28 29#include <sys/ioctl.h> 30 31#include <assert.h> 32#include <errno.h> 33#include <inttypes.h> 34#include <locale.h> --- 31 unchanged lines hidden (view full) --- 66}; 67 68struct pixel { 69 teken_char_t c; 70 teken_attr_t a; 71}; 72 73#define NCOLS 80 |
74#ifdef TEKEN_XTERM | |
75#define NROWS 24 | 74#define NROWS 24 |
76#else /* !TEKEN_XTERM */ 77#define NROWS 25 78#endif /* TEKEN_XTERM */ | |
79struct pixel buffer[NCOLS][NROWS]; 80 81static int ptfd; 82 83static void 84printchar(const teken_pos_t *p) 85{ 86 int y, x, attr = 0; --- 208 unchanged lines hidden (view full) --- 295 tp.tp_row = ws.ws_row = NROWS; 296 tp.tp_col = ws.ws_col = NCOLS; 297 298 switch (forkpty(&ptfd, NULL, NULL, &ws)) { 299 case -1: 300 perror("forkpty"); 301 exit(1); 302 case 0: | 75struct pixel buffer[NCOLS][NROWS]; 76 77static int ptfd; 78 79static void 80printchar(const teken_pos_t *p) 81{ 82 int y, x, attr = 0; --- 208 unchanged lines hidden (view full) --- 291 tp.tp_row = ws.ws_row = NROWS; 292 tp.tp_col = ws.ws_col = NCOLS; 293 294 switch (forkpty(&ptfd, NULL, NULL, &ws)) { 295 case -1: 296 perror("forkpty"); 297 exit(1); 298 case 0: |
303#ifdef TEKEN_XTERM | |
304 setenv("TERM", "xterm", 1); | 299 setenv("TERM", "xterm", 1); |
305#else /* !TEKEN_XTERM */ 306 setenv("TERM", "cons25", 1); 307#endif /* TEKEN_XTERM */ | |
308 setenv("LC_CTYPE", "UTF-8", 0); 309 execlp("zsh", "-zsh", NULL); 310 execlp("bash", "-bash", NULL); 311 execlp("sh", "-sh", NULL); 312 _exit(1); 313 } 314 315 teken_init(&t, &tf, NULL); --- 46 unchanged lines hidden --- | 300 setenv("LC_CTYPE", "UTF-8", 0); 301 execlp("zsh", "-zsh", NULL); 302 execlp("bash", "-bash", NULL); 303 execlp("sh", "-sh", NULL); 304 _exit(1); 305 } 306 307 teken_init(&t, &tf, NULL); --- 46 unchanged lines hidden --- |