1219820Sjeff#!/bin/bash 2219820Sjeff# 3219820Sjeff# Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved. 4219820Sjeff# Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 5219820Sjeff# Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 6219820Sjeff# 7219820Sjeff# This software is available to you under a choice of one of two 8219820Sjeff# licenses. You may choose to be licensed under the terms of the GNU 9219820Sjeff# General Public License (GPL) Version 2, available from the file 10219820Sjeff# COPYING in the main directory of this source tree, or the 11219820Sjeff# OpenIB.org BSD license below: 12219820Sjeff# 13219820Sjeff# Redistribution and use in source and binary forms, with or 14219820Sjeff# without modification, are permitted provided that the following 15219820Sjeff# conditions are met: 16219820Sjeff# 17219820Sjeff# - Redistributions of source code must retain the above 18219820Sjeff# copyright notice, this list of conditions and the following 19219820Sjeff# disclaimer. 20219820Sjeff# 21219820Sjeff# - Redistributions in binary form must reproduce the above 22219820Sjeff# copyright notice, this list of conditions and the following 23219820Sjeff# disclaimer in the documentation and/or other materials 24219820Sjeff# provided with the distribution. 25219820Sjeff# 26219820Sjeff# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27219820Sjeff# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28219820Sjeff# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29219820Sjeff# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 30219820Sjeff# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 31219820Sjeff# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 32219820Sjeff# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33219820Sjeff# SOFTWARE. 34219820Sjeff# 35219820Sjeff######################################################################### 36219820Sjeff# 37219820Sjeff# Abstract: 38219820Sjeff# Indent script for source code formatting. 39219820Sjeff# 40219820Sjeff# Environment: 41219820Sjeff# Linux User Mode 42219820Sjeff# 43219820Sjeff# This is the indent format used for OpenSM (similar to one used in 44219820Sjeff# linux/scripts/Lindent). 45219820Sjeff 46219820Sjeffindent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs "$@" 47219820Sjeff 48219820Sjeff# indent doesn't have an option for label indentation, so do it with sed 49219820Sjefffor f in $@ ; do 50219820Sjeff test -f $f || continue 51219820Sjeff temp=`mktemp -t osm_indent.XXXXXXXX` 52219820Sjeff cat $f \ 53219820Sjeff | sed -e 's/^ \([A-Za-z_]\+[A-Za-z_0-9]*:\)$/\1/' > $temp 54219820Sjeff diff $f $temp > /dev/null || cat $temp > $f 55219820Sjeff rm -f $temp 56219820Sjeffdone 57