1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00
freebsd/contrib/amd/m4/amindent
2003-09-02 15:27:38 +00:00

329 lines
3.9 KiB
Bash
Executable File

#!/bin/sh
# indent all am-utils files
if [ ! -f amd/amd.c ]; then
# maybe we are in a subdir
echo cd ..
cd ..
fi
if [ ! -f amd/amd.c ]; then
echo "please run $0 from the top level of the am-utils source tree"
exit 2
fi
# files="
# */*.[hc]
# */*.h.in
# conf/*/*.[hc]
# OLD/*/*.[hc]
# "
#files="conf/*/*.[hc]"
files="specify_the_file.c"
sunopts="
-npro
-nbad
-bap
-bbb
-nbc
-br
-ncdb
-d0
-di0
-nei
-eei
-nfc1
-i2
-lp
-nsc
-TIntFuncPtr
-Tadd_fn
-Taddrlist
-Tam_node
-Tam_ops
-Tam_opts
-Tam_stats
-Tamq_mount_info
-Tamq_mount_info_list
-Tamq_mount_stats
-Tamq_mount_tree
-Tamq_mount_tree_list
-Tamq_mount_tree_p
-Tamq_opt
-Tamq_setopt
-Tamq_string
-Tattrstat
-Tauto_tree
-Tautomount
-Tcallout
-Tcreateargs
-Tdict
-Tdict_data
-Tdict_ent
-Tdirlist
-Tdiropargs
-Tdiropokres
-Tdiropres
-Tdirpath
-Tdisk_fs
-Tentry
-Tether_if
-Texportnode
-Texports
-Tfattr
-Tfh_cache
-Tfhandle
-Tfhandle_t
-Tfhstatus
-Tfilename
-Tfserver
-Tfsmount
-Tftype
-Tfwd_fun
-Tgid_t
-Tgroupnode
-Tgroups
-Thost
-Tioloc
-Tkv
-Tlinkargs
-Tmap_type
-Tmnt_map
-Tmntfs
-Tmntlist
-Tmount
-Tmountbody
-Tmountlist
-Tname
-Tnfs_fh
-Tnfs_private
-Tnfscookie
-Tnfspath
-Tnfsstat
-Tnfstime
-Tnfsx_mnt
-Tnsw_lookup
-Tnsw_switchconfig
-Topt_apply
-Tpid_t
-Tpjob
-Tqelem
-Treadargs
-Treaddirargs
-Treaddirres
-Treadlinkres
-Treadokres
-Treadres
-Trenameargs
-Trpc_forward
-Tsattr
-Tsattrargs
-Tserv_state
-Tstatfsokres
-Tstatfsres
-Tsymlinkargs
-Ttask_fun
-Ttime_t
-Ttime_type
-Tuid2home_t
-Tuid_t
-Tusername2uid_t
-Tvffserver
-Tvfmount_fs
-Tvfs_init
-Tvfs_match
-Tvfumount_fs
-Tvmount_fs
-Tvmounted
-Tvoidp
-Tvumount_fs
-Tvumounted
-Twriteargs
"
gnuopts="
-npro
-nbad
-bap
-sob
-fca
-nfc1
-ncdb
-br
-ce
-ss
-npcs
-cs
-nbc
-psl
-lp
-sc
-T IntFuncPtr
-T add_fn
-T addrlist
-T am_node
-T am_ops
-T am_opts
-T am_stats
-T amq_mount_info
-T amq_mount_info_list
-T amq_mount_stats
-T amq_mount_tree
-T amq_mount_tree_list
-T amq_mount_tree_p
-T amq_opt
-T amq_setopt
-T amq_string
-T attrstat
-T auto_tree
-T automount
-T callout
-T createargs
-T dict
-T dict_data
-T dict_ent
-T dirlist
-T diropargs
-T diropokres
-T diropres
-T dirpath
-T disk_fs
-T entry
-T ether_if
-T exportnode
-T exports
-T fattr
-T fh_cache
-T fhandle
-T fhandle_t
-T fhstatus
-T filename
-T fserver
-T fsmount
-T ftype
-T fwd_fun
-T gid_t
-T groupnode
-T groups
-T host
-T ioloc
-T kv
-T linkargs
-T map_type
-T mnt_map
-T mntfs
-T mntlist
-T mount
-T mountbody
-T mountlist
-T name
-T nfs_fh
-T nfs_private
-T nfscookie
-T nfspath
-T nfsstat
-T nfstime
-T nfsx_mnt
-T nsw_lookup
-T nsw_switchconfig
-T opt_apply
-T pid_t
-T pjob
-T qelem
-T readargs
-T readdirargs
-T readdirres
-T readlinkres
-T readokres
-T readres
-T renameargs
-T rpc_forward
-T sattr
-T sattrargs
-T serv_state
-T statfsokres
-T statfsres
-T symlinkargs
-T task_fun
-T time_t
-T time_type
-T uid2home_t
-T uid_t
-T username2uid_t
-T vffserver
-T vfmount_fs
-T vfs_init
-T vfs_match
-T vfumount_fs
-T vmount_fs
-T vmounted
-T voidp
-T vumount_fs
-T vumounted
-T writeargs
"
#prefix=".C"
# check args
if [ $# -lt 1 ]; then
echo "Usage: $0 <-g|-s> [files...]"
exit 1
fi
if [ $1 = "-g" -o "$1" = "-s" ]; then
OPT=$1
shift
else
echo "Usage: $0 <-g|-s> [files...]"
exit 1
fi
# check if specified files to process
if [ $# -gt 0 ]; then
files="$*"
fi
for i in ${files}; do
if [ ! -f $i ]; then
echo "No such file: $i"
continue
fi
case $OPT in
-g )
icmd="/usr/local/gnu/bin/indent"
cmd="${icmd} $i -o $i$prefix $gnuopts"
showcmd="${icmd} $i -o $i$prefix"
;;
-s )
icmd="/opt/SUNWspro/bin/indent"
cmd="${icmd} $i $i$prefix $sunopts"
showcmd="${icmd} $i $i$prefix"
;;
* )
echo "Usage: $0 <-g|-s>"
exit 1
;;
esac
echo ${showcmd}
${cmd}
if [ $? != 0 ]; then
echo Failed!
exit $?
fi
# remove trailing spaces
cmd="./m4/rmtspc $i"
echo ${cmd}
${cmd}
if [ $? != 0 ]; then
echo Failed!
exit $?
fi
done