/*
* 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;
}