<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>mac_string.c Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.3-20001105 on Thu Mar 28 09:47:30 2002 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>mac_string.c</h1><div class="fragment"><pre>00001 <font class="comment">/**********************************************************************</font> 00002 <font class="comment"> * $Id: mac_string_c-source.html,v 1.2 2002/04/16 13:11:49 warmerda Exp $</font> 00003 <font class="comment"> *</font> 00004 <font class="comment"> * Project: CPL - Common Portability Library</font> 00005 <font class="comment"> * Purpose: String functions for MacOS (pre MacOS X).</font> 00006 <font class="comment"> * Author: Dennis Christopher, dennis@avenza.com</font> 00007 <font class="comment"> *</font> 00008 <font class="comment"> **********************************************************************</font> 00009 <font class="comment"> * Copyright (c) 2001, Avenza Systems, Inc.</font> 00010 <font class="comment"> *</font> 00011 <font class="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</font> 00012 <font class="comment"> * copy of this software and associated documentation files (the "Software"),</font> 00013 <font class="comment"> * to deal in the Software without restriction, including without limitation</font> 00014 <font class="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</font> 00015 <font class="comment"> * and/or sell copies of the Software, and to permit persons to whom the</font> 00016 <font class="comment"> * Software is furnished to do so, subject to the following conditions:</font> 00017 <font class="comment"> * </font> 00018 <font class="comment"> * The above copyright notice and this permission notice shall be included</font> 00019 <font class="comment"> * in all copies or substantial portions of the Software.</font> 00020 <font class="comment"> * </font> 00021 <font class="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</font> 00022 <font class="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</font> 00023 <font class="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL</font> 00024 <font class="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</font> 00025 <font class="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</font> 00026 <font class="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER </font> 00027 <font class="comment"> * DEALINGS IN THE SOFTWARE.</font> 00028 <font class="comment"> **********************************************************************</font> 00029 <font class="comment"> *</font> 00030 <font class="comment"> * $Log: mac_string_c-source.html,v $ 00030 <font class="comment"> * Revision 1.2 2002/04/16 13:11:49 warmerda 00030 <font class="comment"> * updated 00030 <font class="comment"> *</font> 00031 <font class="comment"> * Revision 1.4 2002/03/05 14:26:57 warmerda</font> 00032 <font class="comment"> * expanded tabs</font> 00033 <font class="comment"> *</font> 00034 <font class="comment"> * Revision 1.3 2001/07/18 04:00:49 warmerda</font> 00035 <font class="comment"> * added CPL_CVSID</font> 00036 <font class="comment"> *</font> 00037 <font class="comment"> * Revision 1.2 2001/04/30 18:16:16 warmerda</font> 00038 <font class="comment"> * added big pre10 ifdef</font> 00039 <font class="comment"> *</font> 00040 <font class="comment"> * Revision 1.1 2001/04/30 18:15:39 warmerda</font> 00041 <font class="comment"> * New</font> 00042 <font class="comment"> *</font> 00043 <font class="comment"> *</font> 00044 <font class="comment"> **********************************************************************/</font> 00045 00046 <font class="preprocessor">#include <string.h></font> 00047 <font class="preprocessor">#include <ctype.h></font> 00048 <font class="preprocessor">#include <stdlib.h></font> 00049 00050 <font class="preprocessor">#include "<a class="code" href="cpl_port_h.html">cpl_port.h</a>"</font> 00051 00052 <font class="preprocessor">#ifdef macos_pre10</font> 00053 <font class="preprocessor"></font> 00054 CPL_CVSID(<font class="stringliteral">"$Id: mac_string_c-source.html,v 1.2 2002/04/16 13:11:49 warmerda Exp $"</font>); 00055 00056 <font class="keywordtype">int</font> strcasecmp(<font class="keywordtype">char</font> * str1, <font class="keywordtype">char</font> * str2)<font class="keyword"></font> 00057 <font class="keyword"></font>{ 00058 <font class="keywordtype">int</font> i; 00059 <font class="keywordtype">char</font> * temp1, *temp2; 00060 00061 <font class="keywordflow">for</font>(i=0;str1[i]!=<font class="charliteral">'\0'</font>;i++) 00062 temp1[i]=tolower(str1[i]); 00063 temp1[i]=<font class="charliteral">'\0'</font>; 00064 00065 <font class="keywordflow">for</font>(i=0;str2[i]!=<font class="charliteral">'\0'</font>;i++) 00066 temp2[i]=tolower(str2[i]); 00067 temp2[i]=<font class="charliteral">'\0'</font>; 00068 00069 <font class="keywordflow">return</font> (strcmp( temp1, temp2) ); 00070 00071 00072 } 00073 00074 <font class="keywordtype">int</font> strncasecmp(<font class="keywordtype">char</font> * str1, <font class="keywordtype">char</font> * str2, <font class="keywordtype">int</font> len)<font class="keyword"></font> 00075 <font class="keyword"></font>{ 00076 <font class="keywordtype">int</font> i; 00077 <font class="keywordtype">char</font> * temp1, *temp2; 00078 00079 <font class="keywordflow">for</font>(i=0;str1[i]!=<font class="charliteral">'\0'</font>;i++) 00080 temp1[i]=tolower(str1[i]); 00081 temp1[i]=<font class="charliteral">'\0'</font>; 00082 00083 <font class="keywordflow">for</font>(i=0;str2[i]!=<font class="charliteral">'\0'</font>;i++) 00084 temp2[i]=tolower(str2[i]); 00085 temp2[i]=<font class="charliteral">'\0'</font>; 00086 00087 <font class="keywordflow">return</font> (strncmp( temp1, temp2, len) ); 00088 00089 } 00090 00091 <font class="keywordtype">char</font> * strdup (<font class="keywordtype">char</font> *instr)<font class="keyword"></font> 00092 <font class="keyword"></font>{ 00093 <font class="keywordtype">char</font> * temp = calloc(strlen(instr)+1, 1); 00094 00095 <font class="keywordflow">if</font> (temp) 00096 { 00097 strcpy(temp, instr); 00098 } 00099 00100 <font class="keywordflow">return</font> temp; 00101 } 00102 00103 <font class="preprocessor">#endif </font><font class="comment">/* defined(macos_pre10) */</font> </div></pre><hr><address><small>Generated at Thu Mar 28 09:47:30 2002 for GDAL by <a href="http://www.stack.nl/~dimitri/doxygen/index.html"> <img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.3-20001105 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2000</small></address> </body> </html>