version 1.15 | | version 1.16 |
---|
| | |
/* | | /* |
* static char *rcsid_utils_c = | | * static char *rcsid_utils_c = |
* "$Id: utils.c,v 1.15 2005/05/06 21:10:07 tchize Exp $"; | | * "$Id: utils.c,v 1.16 2005/05/29 15:37:53 tchize Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
} | | } |
*dest='\0'; | | *dest='\0'; |
} | | } |
| | |
| | char* strrstr(const char* haystack, const char* needle){ |
| | const char* lastneedle; |
| | lastneedle=NULL; |
| | while(haystack=strstr(haystack,needle)){ |
| | lastneedle=haystack; |
| | haystack++; |
| | } |
| | return lastneedle; |
| | |
| | } |
| | #define EOL_SIZE (sizeof("\n")-1) |
| | void strip_endline(char* buf){ |
| | if (strlen(buf)<sizeof("\n")){ |
| | return; |
| | } |
| | if (!strcmp(buf+strlen(buf)-EOL_SIZE,"\n")) |
| | buf[strlen(buf)-EOL_SIZE]='\0'; |
| | } |
| | |