home *** CD-ROM | disk | FTP | other *** search
- /*********************
- *
- * me_alph.c - memory alphabetic functions.
- *
- * Purpose: This file contains functions which operate on buffers
- * for alpha manipulation.
- *
- * Blackstar C Function Library
- * (c) Copyright 1985,1989 Sterling Castle Software
- *
- *******/
-
- #include <ctype.h>
- #include "blackstr.h"
-
-
- /********
- *
- * me_upper(buf,n) - convert buffer to upper case
- *
- **/
-
- void me_upper(char *buf, int n)
- {
- while(n--) {
- if(isalpha(*buf))
- *buf =toupper(*buf);
- ++buf;
- }
- }
-
-
- /********
- *
- * me_lower(buf,n) - convert buffer to lower case
- *
- **/
-
- void me_lower(char *buf, int n)
- {
- while(n--) {
- if(isalpha(*buf))
- *buf = tolower(*buf);
- ++buf;
- }
- }
-
-
- /********
- *
- * me_cmpu(buf1,buf2,n) - compare two buffers in upper case
- *
- **/
-
- int me_cmpu(char *buf1, char *buf2, int n)
- {
- while(n--) {
- if(toupper(*buf1)<toupper(*buf2))
- return(-1);
- else if(toupper(*buf1)>toupper(*buf2))
- return(TRUE);
- else ++buf1,++buf2;
- }
- return(FALSE);
- }
-
-
- /********
- *
- * me_squ(buf,c,n) - squeeze c characters out of buff
- *
- **/
-
- void me_squ(char *buf, char c, int n)
- {
- int i,j;
-
- for(i=j=0; n-->0; i++)
- if(buf[i] != c)
- buf[j++] = buf[i];
- }
-