Patch from vodz:
[oweals/busybox.git] / libbb / chomp.c
index e5a522f01df3665aa40217befb6e31bd87f38c98..4fcbb263d90faa451e64fc6dd43ed44539116cfe 100644 (file)
@@ -2,8 +2,8 @@
 /*
  * Utility routines.
  *
- * Copyright (C) many different people.  If you wrote this, please
- * acknowledge your work.
+ * Copyright (C) many different people.  
+ * If you wrote this, please acknowledge your work.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <string.h>
 #include "libbb.h"
 
+
 void chomp(char *s)
 {
-       if (!(s && *s)) return;
-       while (*s && (*s != '\n')) s++;
-       *s = 0;
+       char *lc = last_char_is(s, '\n');
+       
+       if(lc)
+               *lc = 0;
 }