00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2.1 of the GNU Lesser General Public License 00007 as published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this program; if not, write the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00023 USA. 00024 00025 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00026 Mountain View, CA 94043, or: 00027 00028 http://www.sgi.com 00029 00030 For further information regarding this notice, see: 00031 00032 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00033 00034 */ 00035 00036 00037 #pragma ident "@(#) libf/pxf/pxftcgetpgrp.c 92.2 06/29/99 11:36:06" 00038 00039 /* 00040 * PXFTCGETPGRP -- Get Foreground Process Group Id. 00041 * (section 7.2.3 of Posix 1003.9-1992) 00042 * 00043 * Synopsis: 00044 * 00045 * SUBROUTINE PXFTCGETPGRP(ifildes, ipgid, ierror) 00046 * INTEGER ifildes, ipgid, ierror 00047 * 00048 * Description: 00049 * 00050 * PXFTCGETPGRP uses the pxftcgetpgrp system call to return the 00051 * value of the foreground process group. 00052 * 00053 * The arguments are: 00054 * 00055 * ifildes - default integer input variable containing a file 00056 * descriptor. 00057 * ipgid - default output integer variable specifying the 00058 * foreground process group ID of the terminal 00059 * specified by ifildes. 00060 * ierror - default integer output variable that contains zero 00061 * if the operation was successful or nonzero if the 00062 * operation was not successful. 00063 * 00064 * PXFTCGETPGRP may return one of the following error values: 00065 * 00066 * EBADF - ifildes is not a valid file descriptor. 00067 * 00068 * ENOTTY - the file associated with ifildes is not a terminal. 00069 * 00070 */ 00071 00072 #include <errno.h> 00073 #include <fortran.h> 00074 #include <liberrno.h> 00075 #include <stdlib.h> 00076 #include <string.h> 00077 #include <termios.h> 00078 #include <sys/errno.h> 00079 #include <sys/types.h> 00080 #include <unistd.h> 00081 00082 #ifdef _UNICOS 00083 void 00084 PXFTCGETPGRP( 00085 #else /* _UNICOS */ 00086 void 00087 pxftcgetpgrp_( 00088 #endif /* _UNICOS */ 00089 _f_int *ifildes, 00090 _f_int *ipgid, 00091 _f_int *ierror) 00092 { 00093 int fildes; 00094 int stat; 00095 fildes = *ifildes; 00096 *ierror = 0; 00097 if (stat = tcgetpgrp(fildes) == -1) 00098 *ierror = errno; 00099 else 00100 *ipgid = (_f_int)stat; 00101 return; 00102 }
1.5.6