LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 912|回复: 1

关于sgttyb这个结构是不是在Linux上没有实现?

[复制链接]
发表于 2007-1-3 21:53:52 | 显示全部楼层 |阅读模式
今在分析一些老的Unix程序,在分析到ed的时候,它用到一个结构sgttyb。
grep了一下,发现在glibc的头文件中并没有sgttyb的实现:
/usr/include/sgtty.h

  1. /* Copyright (C) 1991, 1992, 1996, 1998, 1999 Free Software Foundation, Inc.
  2.    This file is part of the GNU C Library.

  3.    The GNU C Library is free software; you can redistribute it and/or
  4.    modify it under the terms of the GNU Lesser General Public
  5.    License as published by the Free Software Foundation; either
  6.    version 2.1 of the License, or (at your option) any later version.

  7.    The GNU C Library is distributed in the hope that it will be useful,
  8.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  10.    Lesser General Public License for more details.

  11.    You should have received a copy of the GNU Lesser General Public
  12.    License along with the GNU C Library; if not, write to the Free
  13.    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14.    02111-1307 USA.  */

  15. #ifndef _SGTTY_H
  16. #define _SGTTY_H        1

  17. #include <features.h>

  18. #include <sys/ioctl.h>

  19. /* On some systems this type is not defined by <bits/ioctl-types.h>;
  20.    in that case, the functions are just stubs that return ENOSYS.  */
  21. struct sgttyb;

  22. __BEGIN_DECLS

  23. /* Fill in *PARAMS with terminal parameters associated with FD.  */
  24. extern int gtty (int __fd, struct sgttyb *__params) __THROW;

  25. /* Set the terminal parameters associated with FD to *PARAMS.  */
  26. extern int stty (int __fd, __const struct sgttyb *__params) __THROW;


  27. __END_DECLS

  28. #endif /* sgtty.h  */

复制代码


man 了一下发现有些函数如gtty在Linux上没实现,还有就是太老了被丢掉了。
不知道sgttyb这个结构是属于什么?那么用什么东西代替?
有没有遇到类似问题的朋友,请不吝赐教!
发表于 2007-1-3 23:42:18 | 显示全部楼层
随便搜了一下
/usr/include$ grep -r sgttyb .
./sgtty.h:struct sgttyb;
./sgtty.h:extern int gtty (int __fd, struct sgttyb *__params) __THROW;
./sgtty.h:extern int stty (int __fd, __const struct sgttyb *__params) __THROW;
./rpcsvc/rex.h:struct sgttyb {
./rpcsvc/rex.h:typedef struct sgttyb sgttyb;
./rpcsvc/rex.h: sgttyb basic;
./rpcsvc/rex.h:extern  bool_t xdr_sgttyb (XDR *, sgttyb*);
./rpcsvc/rex.h:extern bool_t xdr_sgttyb ();
./rpcsvc/rex.x:struct sgttyb {
./rpcsvc/rex.x:    sgttyb basic;    /* standard unix tty flags */
./term.h: * termios/termio/sgttyb interfaces.
./term.h:#define TTY struct sgttyb
看term.h中的说明,应该是用TTY来替代,然后自动根据你系统的情况选用struct termios、struct termio或者struct sgttyb来代换TTY
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表