00001 00002 /* 00003 00004 Copyright (C) 1999,2000,2001, Silicon Graphics, Inc. All Rights Reserved. 00005 00006 This program is free software; you can redistribute it and/or modify it 00007 under the terms of version 2.1 of the GNU Lesser General Public License 00008 as published by the Free Software Foundation. 00009 00010 This program is distributed in the hope that it would be useful, but 00011 WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, any 00013 license provided herein, whether implied or otherwise, is limited to 00014 this program in accordance with the express provisions of the 00015 GNU Lesser General Public License. 00016 00017 Patent licenses, if any, provided herein do not apply to combinations 00018 of this program with other product or programs, or any other product 00019 whatsoever. This program is distributed without any warranty that the 00020 program is delivered free of the rightful claim of any third person by 00021 way of infringement or the like. 00022 00023 See the GNU Lesser General Public License for more details. 00024 00025 You should have received a copy of the GNU General Public License along 00026 with this program; if not, write the Free Software Foundation, Inc., 59 00027 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00028 00029 */ 00030 00031 /* $Header: /proj/osprey/CVS/open64/osprey1.0/libU77/charutil.c,v 1.1.1.1 2005/10/21 19:00:00 marcel Exp $ */ 00032 /* 3.0 SID # 1.2 */ 00033 #include <stdlib.h> 00034 #include <string.h> 00035 00036 int 00037 g_char (char *a, int alen, char *b) 00038 { 00039 char *x, *y; 00040 00041 if (alen == 0) 00042 alen = (int) strlen (a); 00043 #ifdef sgi_test 00044 /* This doesn't work if a string have tab character, e.g., before 00045 * blanks and then filename. Using isspace() requires importing 00046 * it for the shared version. Too late to make such a risky 00047 * change this late in the cypress release . Calvin 8/8/91 */ 00048 x = a + alen; 00049 for (; a < x && *a == ' '; a++); 00050 for (; a < x && *a != ' ';) 00051 *b++ = *a++; 00052 *b = '\0'; 00053 #else 00054 x = a + alen - 1; 00055 y = b + alen - 1; 00056 *(y + 1) = 0; 00057 for (; x >= a && *x == ' '; x--) 00058 *y-- = 0; 00059 for (; x >= a; *y-- = *x--); 00060 #endif 00061 return (0); 00062 } 00063 00064 int 00065 b_char (char *a, char *b, int blen) 00066 { 00067 int i; 00068 00069 for (i = 0; i < blen && *a != 0; i++) 00070 *b++ = *a++; 00071 for (; i < blen; i++) 00072 *b++ = ' '; 00073 return(0); 00074 } 00075 00076 00077 int 00078 up_low (char c) 00079 { 00080 if (c >= 'A' && c <= 'Z') 00081 return (c - 'A' + 'a'); 00082 return ((int)c); 00083 } 00084
1.5.6