Changeset 7e3e00a for util.c


Ignore:
Timestamp:
Feb 11, 2003, 11:14:36 AM (18 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
a2641cd9
Parents:
8f44c6b
Message:
Added thew 'newlinestrip' variable, on by default, that strips leading
and trailing newlines from incoming zephyrs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • util.c

    ra15a84f r7e3e00a  
    616616}
    617617
     618char *owl_util_stripnewlines(char *in) {
     619  /* strip leading and trailing new lines.
     620     caller must free the return */
     621 
     622  char  *tmp, *ptr1, *ptr2, *out;
     623
     624  ptr1=tmp=owl_strdup(in);
     625  while (ptr1[0]=='\n') {
     626    ptr1++;
     627  }
     628  ptr2=ptr1+strlen(ptr1)-1;
     629  while (ptr2[0]=='\n' && ptr2>ptr1) {
     630    ptr2[0]='\0';
     631    ptr2--;
     632  }
     633
     634  out=owl_strdup(ptr1);
     635  owl_free(tmp);
     636  return(out);
     637}
     638
    618639/**************************************************************************/
    619640/************************* REGRESSION TESTS *******************************/
Note: See TracChangeset for help on using the changeset viewer.