1 /* 2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 3 * Use is subject to license terms. 4 */ 5 6 #pragma ident "%Z%%M% %I% %E% SMI" 7 8 /* 9 * This program is copyright Alec Muffett 1993. The author disclaims all 10 * responsibility or liability with respect to it's usage or its effect 11 * upon hardware or computer systems, and maintains copyright as set out 12 * in the "LICENCE" document which accompanies distributions of Crack v4.0 13 * and upwards. 14 */ 15 16 #include "packer.h" 17 18 19 char Chop(register char * string)20Chop(register char *string) 21 { 22 register char c; 23 register char *ptr; 24 25 c = '\0'; 26 27 for (ptr = string; *ptr; ptr++); 28 if (ptr != string) { 29 c = *(--ptr); 30 *ptr = '\0'; 31 } 32 return (c); 33 } 34 35 char Chomp(register char * string)36Chomp(register char *string) 37 { 38 register char c; 39 register char *ptr; 40 41 c = '\0'; 42 43 for (ptr = string; *ptr; ptr++) 44 ; 45 if (ptr != string && isspace(*(--ptr))) { 46 c = *ptr; 47 *ptr = '\0'; 48 } 49 return (c); 50 } 51 52 53 char * Trim(register char * string)54Trim(register char *string) 55 { 56 register char *ptr; 57 58 for (ptr = string; *ptr; ptr++); 59 60 while ((--ptr >= string) && isspace(*ptr)); 61 62 *(++ptr) = '\0'; 63 64 return (ptr); 65 } 66