File indexing completed on 2024-05-26 05:11:28
0001 /* ------------------------------------------------------------------------ 0002 @NAME : util.c 0003 @INPUT : 0004 @OUTPUT : 0005 @RETURNS : 0006 @DESCRIPTION: Miscellaneous utility functions. So far, just: 0007 strlwr 0008 strupr 0009 @CREATED : Summer 1996, Greg Ward 0010 @MODIFIED : 0011 @VERSION : $Id: util.c,v 1.6 1999/11/29 01:13:10 greg Rel $ 0012 @COPYRIGHT : Copyright (c) 1996-99 by Gregory P. Ward. All rights reserved. 0013 0014 This file is part of the btparse library. This library is 0015 free software; you can redistribute it and/or modify it under 0016 the terms of the GNU General Public License as 0017 published by the Free Software Foundation; either version 2 0018 of the License, or (at your option) any later version. 0019 -------------------------------------------------------------------------- */ 0020 0021 /*#include "bt_config.h"*/ 0022 #include <string.h> 0023 #include <ctype.h> 0024 #include "prototypes.h" 0025 /*#include "my_dmalloc.h"*/ 0026 0027 /* ------------------------------------------------------------------------ 0028 @NAME : strlwr() 0029 @INPUT : 0030 @OUTPUT : 0031 @RETURNS : 0032 @DESCRIPTION: Converts a string to lowercase in place. 0033 @GLOBALS : 0034 @CALLS : 0035 @CREATED : 1996/01/06, GPW 0036 @MODIFIED : 0037 @COMMENTS : This should work the same as strlwr() in DOS compilers -- 0038 why this isn't mandated by ANSI is a mystery to me... 0039 -------------------------------------------------------------------------- */ 0040 #if !HAVE_STRLWR 0041 char *strlwr (char *s) 0042 { 0043 int len, i; 0044 0045 len = strlen (s); 0046 for (i = 0; i < len; i++) 0047 s[i] = tolower (s[i]); 0048 0049 return s; 0050 } 0051 #endif 0052 0053 0054 0055 /* ------------------------------------------------------------------------ 0056 @NAME : strupr() 0057 @INPUT : 0058 @OUTPUT : 0059 @RETURNS : 0060 @DESCRIPTION: Converts a string to uppercase in place. 0061 @GLOBALS : 0062 @CALLS : 0063 @CREATED : 1996/01/06, GPW 0064 @MODIFIED : 0065 @COMMENTS : This should work the same as strupr() in DOS compilers -- 0066 why this isn't mandated by ANSI is a mystery to me... 0067 -------------------------------------------------------------------------- */ 0068 #if !HAVE_STRUPR 0069 char *strupr (char *s) 0070 { 0071 int len, i; 0072 0073 len = strlen (s); 0074 for (i = 0; i < len; i++) 0075 s[i] = toupper (s[i]); 0076 0077 return s; 0078 } 0079 #endif