1 /* 2 3 * Copyright (c) 1984, 1985, 1986 AT&T 4 * All Rights Reserved 5 6 * THIS IS UNPUBLISHED PROPRIETARY SOURCE 7 * CODE OF AT&T. 8 * The copyright notice above does not 9 * evidence any actual or intended 10 * publication of such source code. 11 12 */ 13 /* @(#)convert.c 1.1 */ 14 15 /* 16 * CONVERT.C 17 * 18 * 19 * LTOU (STR1, STR2) 20 * Copy STR1 to STR2, changing lower case to upper case. 21 * 22 * UTOL (STR1, STR2) 23 * Copy STR1 to STR2, changing upper case to lower case. 24 * 25 */ 26 27 #ifdef KSHELL 28 #include "shtype.h" 29 #else 30 #include <ctype.h> 31 #endif /* KSHELL */ 32 33 /* 34 * LTOU (STR1, STR2) 35 * char *STR1; 36 * char *STR2; 37 * 38 * Copy STR1 to STR2, converting uppercase alphabetics to 39 * lowercase. STR2 should be big enough to hold STR1. 40 * 41 * STR1 and STR2 may point to the same place. 42 * 43 */ 44 45 void ltou(str1,str2) 46 char *str1,*str2; 47 { 48 register char *s,*d; 49 for(s=str1,d=str2;*s;s++,d++) 50 { 51 if(islower(*s)) 52 *d = toupper(*s); 53 else 54 *d = *s; 55 } 56 *d = 0; 57 } 58 59 60 /* 61 * UTOL (STR1, STR2) 62 * char *STR1; 63 * char *STR2; 64 * 65 * Copy STR1 to STR2, converting lowercase alphabetics to 66 * uppercase. STR2 should be big enough to hold STR1. 67 * 68 * STR1 and STR2 may point to the same place. 69 * 70 */ 71 72 void utol(str1,str2) 73 char *str1,*str2; 74 { 75 register char *s,*d; 76 for(s=str1,d=str2;*s;s++,d++) 77 { 78 if(isupper(*s)) 79 *d = tolower(*s); 80 else 81 *d = *s; 82 } 83 *d = 0; 84 } 85 86