00001 /* 00002 * Copyright 2004, 2005, 2006 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 1999-2001, Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2.1 of the GNU Lesser General Public License 00011 as published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, any 00016 license provided herein, whether implied or otherwise, is limited to 00017 this program in accordance with the express provisions of the 00018 GNU Lesser General Public License. 00019 00020 Patent licenses, if any, provided herein do not apply to combinations 00021 of this program with other product or programs, or any other product 00022 whatsoever. This program is distributed without any warranty that the 00023 program is delivered free of the rightful claim of any third person by 00024 way of infringement or the like. 00025 00026 See the GNU Lesser General Public License for more details. 00027 00028 You should have received a copy of the GNU General Public License along 00029 with this program; if not, write the Free Software Foundation, Inc., 59 00030 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00031 00032 */ 00033 00034 /* $Header: /proj/osprey/CVS/open64/osprey1.0/libU77/getlog_.c,v 1.1.1.1 2005/10/21 19:00:00 marcel Exp $ */ 00035 /* 00036 * 00037 * get login name of user 00038 * 00039 * calling sequence: 00040 * character*8 getlog, name 00041 * name = getlog() 00042 * or 00043 * call getlog (name) 00044 * where: 00045 * name will receive the login name of the user, or all blanks if 00046 * this is a detached process. 00047 */ 00048 00049 #include <unistd.h> 00050 #include "externals.h" 00051 00052 #ifdef KEY /* Bug 1683, 5019 */ 00053 00054 #include <alloca.h> 00055 00056 #include "pathf90_libU_intrin.h" 00057 00058 void 00059 pathf90_getlog(char *name, int len) 00060 { 00061 char *l = alloca(len + 1); 00062 int err = getlogin_r(l, len + 1); 00063 00064 b_char((err == 0) ?l:" ", name, len); 00065 } 00066 00067 #else 00068 00069 extern void 00070 getlog_(char *name, int len) 00071 { 00072 char *l = getlogin(); 00073 00074 b_char(l?l:" ", name, len); 00075 } 00076 00077 #endif /* KEY Bug 1683, 5019 */
1.5.6