Mercurial > gftp.yaz
comparison lib/misc.c @ 80:f4f6f44225d3
2002-12-10 Brian Masney <masneyb@gftp.org>
* configure.in - check for grantpt function
* lib/misc.c (pty[ms]_open) - use Unix98 PTY allocation if grantpt()
is on the current system
* lib/gftp.h - include stropts.h if grantpt is here
2002-12-5 Brian Masney <masneyb@gftp.org>
* Release final 2.0.14
* lib/Chagelog-old - brief updates since 2.0.13
author | masneyb |
---|---|
date | Wed, 11 Dec 2002 02:33:33 +0000 |
parents | 100a4b310c60 |
children | 7ef60ce2bdb2 |
comparison
equal
deleted
inserted
replaced
79:89fd76d345e4 | 80:f4f6f44225d3 |
---|---|
616 strcpy (pts_name, tempstr); | 616 strcpy (pts_name, tempstr); |
617 return (fd); | 617 return (fd); |
618 | 618 |
619 #else /* !__sgi */ | 619 #else /* !__sgi */ |
620 | 620 |
621 #ifdef SYSV | 621 #ifdef HAVE_GRANTPT |
622 | 622 |
623 char *tempstr; | 623 char *tempstr; |
624 | 624 |
625 strcpy (pts_name, "/dev/ptmx"); | 625 strcpy (pts_name, "/dev/ptmx"); |
626 if ((fd = open (pts_name, O_RDWR)) < 0) | 626 if ((fd = open (pts_name, O_RDWR)) < 0) |
645 } | 645 } |
646 | 646 |
647 strcpy (pts_name, tempstr); | 647 strcpy (pts_name, tempstr); |
648 return (fd); | 648 return (fd); |
649 | 649 |
650 #else /* !SYSV */ | 650 #else /* !GRANTPT */ |
651 | 651 |
652 char *pos1, *pos2; | 652 char *pos1, *pos2; |
653 | 653 |
654 strcpy (pts_name, "/dev/ptyXY"); | 654 strcpy (pts_name, "/dev/ptyXY"); |
655 for (pos1 = "pqrstuvwxyzPQRST"; *pos1 != '\0'; pos1++) | 655 for (pos1 = "pqrstuvwxyzPQRST"; *pos1 != '\0'; pos1++) |
676 int | 676 int |
677 ptys_open (int fdm, char *pts_name) | 677 ptys_open (int fdm, char *pts_name) |
678 { | 678 { |
679 int fds; | 679 int fds; |
680 | 680 |
681 #if !defined (SYSV) && !defined (__sgi) | 681 #if !defined (HAVE_GRANTPT) && !defined (__sgi) |
682 | 682 |
683 chmod (pts_name, S_IRUSR | S_IWUSR); | 683 chmod (pts_name, S_IRUSR | S_IWUSR); |
684 chown (pts_name, getuid (), -1); | 684 chown (pts_name, getuid (), -1); |
685 | 685 |
686 #endif | 686 #endif |
689 { | 689 { |
690 close (fdm); | 690 close (fdm); |
691 return (-1); | 691 return (-1); |
692 } | 692 } |
693 | 693 |
694 #ifdef SYSV | 694 #ifdef HAVE_GRANTPT |
695 | 695 /* I intentionally ignore these errors */ |
696 if (ioctl (fds, I_PUSH, "ptem") < 0) | 696 ioctl (fds, I_PUSH, "ptem"); |
697 { | 697 ioctl (fds, I_PUSH, "ldterm"); |
698 close (fdm); | 698 ioctl (fds, I_PUSH, "ttcompat"); |
699 close (fds); | |
700 return (-1); | |
701 } | |
702 | |
703 if (ioctl (fds, I_PUSH, "ldterm") < 0) | |
704 { | |
705 close (fdm); | |
706 close (fds); | |
707 return (-1); | |
708 } | |
709 | |
710 if (ioctl (fds, I_PUSH, "ttcompat") < 0) | |
711 { | |
712 close (fdm); | |
713 close (fds); | |
714 return (-1); | |
715 } | |
716 | |
717 #endif | 699 #endif |
718 | 700 |
719 #if !defined(SYSV) && !defined (__sgi) && defined(TIOCSCTTY) && !defined(CIBAUD) | 701 #if !defined(HAVE_GRANTPT) && !defined (__sgi) && defined(TIOCSCTTY) && !defined(CIBAUD) |
720 | 702 |
721 if (ioctl (fds, TIOCSCTTY, (char *) 0) < 0) | 703 if (ioctl (fds, TIOCSCTTY, (char *) 0) < 0) |
722 { | 704 { |
723 close (fdm); | 705 close (fdm); |
724 return (-1); | 706 return (-1); |