Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F16570317
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/kpty/CMakeLists.txt b/kpty/CMakeLists.txt
index b6538357eb..74351c3e3d 100644
--- a/kpty/CMakeLists.txt
+++ b/kpty/CMakeLists.txt
@@ -1,39 +1,40 @@
project(kpty)
include_directories( ${KDE4_KDECORE_INCLUDES} )
include_directories( ${QT_INCLUDES} )
set(kpty_LIB_SRCS
kpty.cpp
kptydevice.cpp
kptyprocess.cpp
)
kde4_add_library(kpty ${LIBRARY_TYPE} ${kpty_LIB_SRCS})
+generate_export_header(kpty)
target_link_libraries(kpty ${KDE4_KDECORE_LIBS} ${UTIL_LIBRARY} ${UTEMPTER_LIBRARY})
target_link_libraries(kpty LINK_INTERFACE_LIBRARIES kdecore ${QT_QTCORE_LIBRARY} )
set_target_properties(kpty PROPERTIES
VERSION ${GENERIC_LIB_VERSION}
SOVERSION ${GENERIC_LIB_SOVERSION}
)
install(TARGETS kpty ${INSTALL_TARGETS_DEFAULT_ARGS})
install( FILES
- kpty_export.h
+ ${CMAKE_CURRENT_BINARY_DIR}/kpty_export.h
kpty.h
kptydevice.h
kptyprocess.h
DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel
)
########### next target ###############
if (NOT HAVE_OPENPTY)
kde4_add_executable(kgrantpty NOGUI kgrantpty.c)
target_link_libraries(kgrantpty kdefakes)
install(TARGETS kgrantpty DESTINATION ${LIBEXEC_INSTALL_DIR})
endif (NOT HAVE_OPENPTY)
add_subdirectory( tests )
diff --git a/kpty/kpty.h b/kpty/kpty.h
index feffdfcad1..2560312dee 100644
--- a/kpty/kpty.h
+++ b/kpty/kpty.h
@@ -1,205 +1,207 @@
/* This file is part of the KDE libraries
Copyright (C) 2003,2007 Oswald Buddenhagen <ossi@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef kpty_h
#define kpty_h
#include "kpty_export.h"
+#include <qglobal.h>
+
struct KPtyPrivate;
struct termios;
/**
* Provides primitives for opening & closing a pseudo TTY pair, assigning the
* controlling TTY, utmp registration and setting various terminal attributes.
*/
class KPTY_EXPORT KPty {
Q_DECLARE_PRIVATE(KPty)
public:
/**
* Constructor
*/
KPty();
/**
* Destructor:
*
* If the pty is still open, it will be closed. Note, however, that
* an utmp registration is @em not undone.
*/
~KPty();
/**
* Create a pty master/slave pair.
*
* @return true if a pty pair was successfully opened
*/
bool open();
/**
* Open using an existing pty master.
*
* @param fd an open pty master file descriptor.
* The ownership of the fd remains with the caller;
* it will not be automatically closed at any point.
* @return true if a pty pair was successfully opened
*/
bool open(int fd);
/**
* Close the pty master/slave pair.
*/
void close();
/**
* Close the pty slave descriptor.
*
* When creating the pty, KPty also opens the slave and keeps it open.
* Consequently the master will never receive an EOF notification.
* Usually this is the desired behavior, as a closed pty slave can be
* reopened any time - unlike a pipe or socket. However, in some cases
* pipe-alike behavior might be desired.
*
* After this function was called, slaveFd() and setCTty() cannot be
* used.
*/
void closeSlave();
/**
* Open the pty slave descriptor.
*
* This undoes the effect of closeSlave().
*
* @return true if the pty slave was successfully opened
*/
bool openSlave();
/**
* Creates a new session and process group and makes this pty the
* controlling tty.
*/
void setCTty();
/**
* Creates an utmp entry for the tty.
* This function must be called after calling setCTty and
* making this pty the stdin.
* @param user the user to be logged on
* @param remotehost the host from which the login is coming. This is
* @em not the local host. For remote logins it should be the hostname
* of the client. For local logins from inside an X session it should
* be the name of the X display. Otherwise it should be empty.
*/
void login(const char *user = 0, const char *remotehost = 0);
/**
* Removes the utmp entry for this tty.
*/
void logout();
/**
* Wrapper around tcgetattr(3).
*
* This function can be used only while the PTY is open.
* You will need an #include <termios.h> to do anything useful
* with it.
*
* @param ttmode a pointer to a termios structure.
* Note: when declaring ttmode, @c struct @c ::termios must be used -
* without the '::' some version of HP-UX thinks, this declares
* the struct in your class, in your method.
* @return @c true on success, false otherwise
*/
bool tcGetAttr(struct ::termios *ttmode) const;
/**
* Wrapper around tcsetattr(3) with mode TCSANOW.
*
* This function can be used only while the PTY is open.
*
* @param ttmode a pointer to a termios structure.
* @return @c true on success, false otherwise. Note that success means
* that @em at @em least @em one attribute could be set.
*/
bool tcSetAttr(struct ::termios *ttmode);
/**
* Change the logical (screen) size of the pty.
* The default is 24 lines by 80 columns.
*
* This function can be used only while the PTY is open.
*
* @param lines the number of rows
* @param columns the number of columns
* @return @c true on success, false otherwise
*/
bool setWinSize(int lines, int columns);
/**
* Set whether the pty should echo input.
*
* Echo is on by default.
* If the output of automatically fed (non-interactive) PTY clients
* needs to be parsed, disabling echo often makes it much simpler.
*
* This function can be used only while the PTY is open.
*
* @param echo true if input should be echoed.
* @return @c true on success, false otherwise
*/
bool setEcho(bool echo);
/**
* @return the name of the slave pty device.
*
* This function should be called only while the pty is open.
*/
const char *ttyName() const;
/**
* @return the file descriptor of the master pty
*
* This function should be called only while the pty is open.
*/
int masterFd() const;
/**
* @return the file descriptor of the slave pty
*
* This function should be called only while the pty slave is open.
*/
int slaveFd() const;
protected:
/**
* @internal
*/
KPty(KPtyPrivate *d);
/**
* @internal
*/
KPtyPrivate * const d_ptr;
};
#endif
diff --git a/kpty/kpty_export.h b/kpty/kpty_export.h
deleted file mode 100644
index 4c60c0ed36..0000000000
--- a/kpty/kpty_export.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2007 David Faure <faure@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef KPTY_EXPORT_H
-#define KPTY_EXPORT_H
-
-/* needed for KDE_EXPORT and KDE_IMPORT macros */
-#include <kdemacros.h>
-
-#ifndef KPTY_EXPORT
-# if defined(KDELIBS_STATIC_LIBS)
- /* No export/import for static libraries */
-# define KPTY_EXPORT
-# elif defined(MAKE_KDECORE_LIB)
- /* We are building this library */
-# define KPTY_EXPORT KDE_EXPORT
-# else
- /* We are using this library */
-# define KPTY_EXPORT KDE_IMPORT
-# endif
-#endif
-
-# ifndef KPTY_EXPORT_DEPRECATED
-# define KPTY_EXPORT_DEPRECATED KDE_DEPRECATED KPTY_EXPORT
-# endif
-
-#endif
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Nov 1, 9:15 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10075659
Default Alt Text
(8 KB)
Attached To
Mode
rKL kdelibs
Attached
Detach File
Event Timeline
Log In to Comment