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