⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pty.c

📁 第二层隧道模块l2tp源码,开发环境为linux
💻 C
字号:
/* * Layer Two Tunnelling Protocol Daemon * Copyright (C) 1998 Adtran, Inc. * Copyright (C) 2002 Jeff McAdams * * Mark Spencer * * This software is distributed under the terms * of the GPL, which you should have received * along with this source. * * Pseudo-pty allocation routines...  Concepts and code borrowed * from pty-redir by Magosanyi Arpad. * */#include "l2tp.h"#include <fcntl.h>#ifdef SOLARIS#define PTY00 "/dev/ptyXX"#define PTY10 "pqrstuvwxyz"#define PTY01 "0123456789abcdef"#endif#ifdef LINUX#define PTY00 "/dev/ptyXX"#define PTY10 "pqrstuvwxyzabcde"#define PTY01 "0123456789abcdef"#endif#ifdef FREEBSD#define PTY00 "/dev/ptyXX"#define PTY10 "p"#define PTY01 "0123456789abcdefghijklmnopqrstuv"#endifint getPtyMaster (char *tty10, char *tty01){    char *p10;    char *p01;    static char dev[] = PTY00;    int fd;    for (p10 = PTY10; *p10; p10++)    {        dev[8] = *p10;        for (p01 = PTY01; *p01; p01++)        {            dev[9] = *p01;            fd = open (dev, O_RDWR | O_NONBLOCK);            if (fd >= 0)            {                *tty10 = *p10;                *tty01 = *p01;                return fd;            }        }    }    log (LOG_CRIT, "%s: No more free pseudo-tty's\n", __FUNCTION__);    return -1;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -