/* * Copyright (C) 2003 Hudson Reis. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1, * or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; see the file COPYING.LIB. If * not, write to the Free Software Foundation, Inc., 59 Temple Place, * Suite 330, Boston, MA 02111-1307 USA */ /* Case routines */ #include #include #include "globals.h" /* void cbl_tolower(char *in, char *out, unsigned int *ret) { int i=0; *ret=0; if (cbl_align(in) != 0) { *ret=1; } if (*ret == 0) { for (i=0;i<=(strlen(in));i++) { *out++ = tolower(in[i]); } } } void cbl_toupper(char *in, char *out, unsigned int *ret) { int i=0; *ret=0; if (cbl_align(in) != 0) { *ret=1; } if (*ret == 0) { for (i=0;i<=(strlen(in));i++) { *out++ = toupper(in[i]); } } } */ // ---------------------------------------------------------------------- // Implemented by Walter Garrote ---------------------------------------- // garrote@dm.com.br // Brazil // Goîânia-Goiás // ---------------------------------------------------------------------- // return the string with all letter to lower void cbl_tolower(char *in, int size) { int i; char *c; c = in; for(i = 0; i < size; i++) *c++ = tolower(*c); return; } // return the string with all letter to upper void cbl_toupper(char *in, int size) { int i; char *c; c = in; for(i = 0; i < size; i++) *c++ = toupper(*c); return; } // return the string with all first word letter upper, and lower to the others void cbl_ucwords(char *in, int size) { int i; int force = 0; char *c; c = in; for(i = 0; i < size; i++) { if(!force) switch(*c) { case ' ': case '.': case ',': case ';': force = 1; break; default: force = 0; break; } if(isalpha(*c)) if(force || i == 0) { *c++ = toupper(*c); force = 0; } else *c++ = tolower(*c); else *c++; } return; } // return the string with the first word letter upper and lower to the others void cbl_ucfirst(char *in, int size) { int i; int first = 0; char *c; c = in; for(i = 0; i < size; i++) { if(isalpha(*c)) if(first == 0) { *c++ = toupper(*c); first = 1; } else *c++ = tolower(*c); else *c++; } return; } // return character for the ascii code void cbl_char(int *a, unsigned char *c) { *c = (char) *a; return; } // return ascii code for the character void cbl_ord(unsigned char *c, int *a) { unsigned char ch; ch = *c; *a = (int) *(c); *c = ch; return; }