2018-12-06 01:52:14 +01:00
|
|
|
#!/usr/bin/env bash
|
2020-04-16 10:50:39 +02:00
|
|
|
# Copyright (C) 2017-2020 The Project X-Ray Authors.
|
|
|
|
|
#
|
|
|
|
|
# Use of this source code is governed by a ISC-style
|
|
|
|
|
# license that can be found in the LICENSE file or at
|
|
|
|
|
# https://opensource.org/licenses/ISC
|
|
|
|
|
#
|
|
|
|
|
# SPDX-License-Identifier: ISC
|
2018-12-06 01:52:14 +01:00
|
|
|
# Wrapper to clean up newlines
|
|
|
|
|
# We could do this in tcl...but tcl
|
|
|
|
|
|
|
|
|
|
fn=$1
|
|
|
|
|
|
2018-12-14 02:27:44 +01:00
|
|
|
third_party/reformat.tcl $fn >/dev/null
|
2018-12-06 01:52:14 +01:00
|
|
|
# Always puts a newline at the end, even if there was one before
|
|
|
|
|
# remove duplicates, but keep at least one
|
|
|
|
|
printf "%s\n" "$(< $fn)" >$fn.tmp
|
|
|
|
|
mv $fn.tmp $fn
|
|
|
|
|
|
|
|
|
|
# Remove trailing spaces
|
|
|
|
|
sed -i 's/[ \t]*$//' "$fn"
|
|
|
|
|
|