blob: 1330176827c3d2649b3f25c1cc0b2d681472828e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/* ------------------------------------------------------------------------
@NAME : util.c
@INPUT :
@OUTPUT :
@RETURNS :
@DESCRIPTION: Miscellaneous utility functions. So far, just:
strlwr
strupr
@CREATED : Summer 1996, Greg Ward
@MODIFIED :
@VERSION : $Id: util.c,v 1.6 1999/11/29 01:13:10 greg Rel $
@COPYRIGHT : Copyright (c) 1996-99 by Gregory P. Ward. All rights reserved.
This file is part of the btparse library. This library is
free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-------------------------------------------------------------------------- */
/*#include "bt_config.h"*/
#include <string.h>
#include <ctype.h>
#include "prototypes.h"
/*#include "my_dmalloc.h"*/
/* ------------------------------------------------------------------------
@NAME : strlwr()
@INPUT :
@OUTPUT :
@RETURNS :
@DESCRIPTION: Converts a string to lowercase in place.
@GLOBALS :
@CALLS :
@CREATED : 1996/01/06, GPW
@MODIFIED :
@COMMENTS : This should work the same as strlwr() in DOS compilers --
why this isn't mandated by ANSI is a mystery to me...
-------------------------------------------------------------------------- */
#if !HAVE_STRLWR
char *strlwr (char *s)
{
int len, i;
len = strlen (s);
for (i = 0; i < len; i++)
s[i] = tolower (s[i]);
return s;
}
#endif
/* ------------------------------------------------------------------------
@NAME : strupr()
@INPUT :
@OUTPUT :
@RETURNS :
@DESCRIPTION: Converts a string to uppercase in place.
@GLOBALS :
@CALLS :
@CREATED : 1996/01/06, GPW
@MODIFIED :
@COMMENTS : This should work the same as strupr() in DOS compilers --
why this isn't mandated by ANSI is a mystery to me...
-------------------------------------------------------------------------- */
#if !HAVE_STRUPR
char *strupr (char *s)
{
int len, i;
len = strlen (s);
for (i = 0; i < len; i++)
s[i] = toupper (s[i]);
return s;
}
#endif
|