# HG changeset patch # User Jacob Dawid # Date 1315679267 -7200 # Node ID 803ac0c6a2c0d8350a556672bf1aa0787f2cac61 # Parent 421afeae929bc3d4f83887dffba70cf8e51ec76b Fixed bug with including pty.h. diff -r 421afeae929b -r 803ac0c6a2c0 gui/src/terminal/KPty.cpp --- a/gui/src/terminal/KPty.cpp Sat Sep 10 18:33:58 2011 +0200 +++ b/gui/src/terminal/KPty.cpp Sat Sep 10 20:27:47 2011 +0200 @@ -24,128 +24,6 @@ #include "KPty.h" -#if defined(Q_OS_MAC) -#define HAVE_UTIL_H -#define HAVE_UTMPX -#define _UTMPX_COMPAT -#define HAVE_PTSNAME -#define HAVE_SYS_TIME_H -#else -#define HAVE_PTY_H -#endif - -#define HAVE_OPENPTY - -#include - -#ifdef __sgi -#define __svr4__ -#endif - -#ifdef __osf__ -#define _OSF_SOURCE -#include -#endif - -#ifdef _AIX -#define _ALL_SOURCE -#endif - -// __USE_XOPEN isn't defined by default in ICC -// (needed for ptsname(), grantpt() and unlockpt()) -#ifdef __INTEL_COMPILER -#ifndef __USE_XOPEN -#define __USE_XOPEN -#endif -#endif - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(HAVE_PTY_H) -#include -#endif - -#ifdef HAVE_LIBUTIL_H -#include -#elif defined(HAVE_UTIL_H) -#include -#endif - -#define HAVE_UTMPX -#define _UTMPX_COMPAT - -#ifdef HAVE_UTEMPTER -extern "C" -{ -#include -} -#else -#include -#ifdef HAVE_UTMPX -#include -#endif -#if !defined(_PATH_UTMPX) && defined(_UTMPX_FILE) -#define _PATH_UTMPX _UTMPX_FILE -#endif -#if !defined(_PATH_WTMPX) && defined(_WTMPX_FILE) -#define _PATH_WTMPX _WTMPX_FILE -#endif -#endif - -/* for HP-UX (some versions) the extern C is needed, and for other - platforms it doesn't hurt */ -extern "C" -{ -#include -#if defined(HAVE_TERMIO_H) -#include // struct winsize on some systems -#endif -} - -#if defined (_HPUX_SOURCE) -#define _TERMIOS_INCLUDED -#include -#endif - -#ifdef HAVE_SYS_STROPTS_H -#include // Defines I_PUSH -#define _NEW_TTY_CTRL -#endif - -#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__) -#define _tcgetattr(fd, ttmode) ioctl(fd, TIOCGETA, (char *)ttmode) -#else -#if defined(_HPUX_SOURCE) || defined(__Lynx__) || defined (__CYGWIN__) || defined(__sun) -#define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode) -#else -#define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode) -#endif -#endif - -#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__) -#define _tcsetattr(fd, ttmode) ioctl(fd, TIOCSETA, (char *)ttmode) -#else -#if defined(_HPUX_SOURCE) || defined(__CYGWIN__) || defined(__sun) -#define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode) -#else -#define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode) -#endif -#endif - #include #define TTY_GROUP "tty" diff -r 421afeae929b -r 803ac0c6a2c0 gui/src/terminal/KPty.h --- a/gui/src/terminal/KPty.h Sat Sep 10 18:33:58 2011 +0200 +++ b/gui/src/terminal/KPty.h Sat Sep 10 20:27:47 2011 +0200 @@ -21,6 +21,128 @@ #ifndef kpty_h #define kpty_h +#if defined(Q_OS_MAC) +#define HAVE_UTIL_H +#define HAVE_UTMPX +#define _UTMPX_COMPAT +#define HAVE_PTSNAME +#define HAVE_SYS_TIME_H +#else +#define HAVE_PTY_H +#endif + +#define HAVE_OPENPTY + +#include + +#ifdef __sgi +#define __svr4__ +#endif + +#ifdef __osf__ +#define _OSF_SOURCE +#include +#endif + +#ifdef _AIX +#define _ALL_SOURCE +#endif + +// __USE_XOPEN isn't defined by default in ICC +// (needed for ptsname(), grantpt() and unlockpt()) +#ifdef __INTEL_COMPILER +#ifndef __USE_XOPEN +#define __USE_XOPEN +#endif +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(HAVE_PTY_H) +#include +#endif + +#ifdef HAVE_LIBUTIL_H +#include +#elif defined(HAVE_UTIL_H) +#include +#endif + +#define HAVE_UTMPX +#define _UTMPX_COMPAT + +#ifdef HAVE_UTEMPTER +extern "C" +{ +#include +} +#else +#include +#ifdef HAVE_UTMPX +#include +#endif +#if !defined(_PATH_UTMPX) && defined(_UTMPX_FILE) +#define _PATH_UTMPX _UTMPX_FILE +#endif +#if !defined(_PATH_WTMPX) && defined(_WTMPX_FILE) +#define _PATH_WTMPX _WTMPX_FILE +#endif +#endif + +/* for HP-UX (some versions) the extern C is needed, and for other + platforms it doesn't hurt */ +extern "C" +{ +#include +#if defined(HAVE_TERMIO_H) +#include // struct winsize on some systems +#endif +} + +#if defined (_HPUX_SOURCE) +#define _TERMIOS_INCLUDED +#include +#endif + +#ifdef HAVE_SYS_STROPTS_H +#include // Defines I_PUSH +#define _NEW_TTY_CTRL +#endif + +#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__) +#define _tcgetattr(fd, ttmode) ioctl(fd, TIOCGETA, (char *)ttmode) +#else +#if defined(_HPUX_SOURCE) || defined(__Lynx__) || defined (__CYGWIN__) || defined(__sun) +#define _tcgetattr(fd, ttmode) tcgetattr(fd, ttmode) +#else +#define _tcgetattr(fd, ttmode) ioctl(fd, TCGETS, (char *)ttmode) +#endif +#endif + +#if defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__bsdi__) || defined(__APPLE__) || defined (__DragonFly__) +#define _tcsetattr(fd, ttmode) ioctl(fd, TIOCSETA, (char *)ttmode) +#else +#if defined(_HPUX_SOURCE) || defined(__CYGWIN__) || defined(__sun) +#define _tcsetattr(fd, ttmode) tcsetattr(fd, TCSANOW, ttmode) +#else +#define _tcsetattr(fd, ttmode) ioctl(fd, TCSETS, (char *)ttmode) +#endif +#endif + #include #include diff -r 421afeae929b -r 803ac0c6a2c0 gui/src/terminal/LinuxTerminalEmulation.cpp --- a/gui/src/terminal/LinuxTerminalEmulation.cpp Sat Sep 10 18:33:58 2011 +0200 +++ b/gui/src/terminal/LinuxTerminalEmulation.cpp Sat Sep 10 20:27:47 2011 +0200 @@ -1,13 +1,29 @@ +/* OctaveGUI - A graphical user interface for Octave + * Copyright (C) 2011 John P. Swensen, Jacob Dawid + * jacob.dawid@googlemail.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include "LinuxTerminalEmulation.h" LinuxTerminalEmulation::LinuxTerminalEmulation () : TerminalEmulation () { int fdm, fds; - if (openpty (&fdm, &fds, 0, 0, 0) < 0) - { - assert (0); - } + openpty (&fdm, &fds, 0, 0, 0); + dup2 (fds, STDIN_FILENO); dup2 (fds, STDOUT_FILENO); dup2 (fds, STDERR_FILENO); diff -r 421afeae929b -r 803ac0c6a2c0 gui/src/terminal/LinuxTerminalEmulation.h --- a/gui/src/terminal/LinuxTerminalEmulation.h Sat Sep 10 18:33:58 2011 +0200 +++ b/gui/src/terminal/LinuxTerminalEmulation.h Sat Sep 10 20:27:47 2011 +0200 @@ -1,11 +1,25 @@ +/* OctaveGUI - A graphical user interface for Octave + * Copyright (C) 2011 John P. Swensen, Jacob Dawid + * jacob.dawid@googlemail.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef LINUXTERMINALEMULATION_H #define LINUXTERMINALEMULATION_H #include "TerminalEmulation.h" -#include "pty.h" -#include "unistd.h" -#include -#include #include "KPtyDevice.h" class LinuxTerminalEmulation : public TerminalEmulation diff -r 421afeae929b -r 803ac0c6a2c0 gui/src/terminal/TerminalEmulation.cpp --- a/gui/src/terminal/TerminalEmulation.cpp Sat Sep 10 18:33:58 2011 +0200 +++ b/gui/src/terminal/TerminalEmulation.cpp Sat Sep 10 20:27:47 2011 +0200 @@ -1,3 +1,21 @@ +/* OctaveGUI - A graphical user interface for Octave + * Copyright (C) 2011 John P. Swensen, Jacob Dawid + * jacob.dawid@googlemail.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include "TerminalEmulation.h" #ifdef Q_OS_UNIX diff -r 421afeae929b -r 803ac0c6a2c0 gui/src/terminal/TerminalEmulation.h --- a/gui/src/terminal/TerminalEmulation.h Sat Sep 10 18:33:58 2011 +0200 +++ b/gui/src/terminal/TerminalEmulation.h Sat Sep 10 20:27:47 2011 +0200 @@ -1,3 +1,21 @@ +/* OctaveGUI - A graphical user interface for Octave + * Copyright (C) 2011 John P. Swensen, Jacob Dawid + * jacob.dawid@googlemail.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #ifndef TERMINALEMULATION_H #define TERMINALEMULATION_H