amindent revision 1.1
1#!/bin/sh 2# indent all am-utils files 3if [ ! -f amd/amd.c ]; then 4 # maybe we are in a subdir 5 echo cd .. 6 cd .. 7fi 8if [ ! -f amd/amd.c ]; then 9 echo "please run $0 from the top level of the am-utils source tree" 10 exit 2 11fi 12 13# files=" 14# */*.[hc] 15# */*.h.in 16# conf/*/*.[hc] 17# OLD/*/*.[hc] 18# " 19#files="conf/*/*.[hc]" 20files="specify_the_file.c" 21 22sunopts=" 23-npro 24-nbad 25-bap 26-bbb 27-nbc 28-br 29-ncdb 30-d0 31-di0 32-nei 33-eei 34-nfc1 35-i2 36-lp 37-nsc 38-TIntFuncPtr 39-Tadd_fn 40-Taddrlist 41-Tam_node 42-Tam_ops 43-Tam_opts 44-Tam_stats 45-Tamq_mount_info 46-Tamq_mount_info_list 47-Tamq_mount_stats 48-Tamq_mount_tree 49-Tamq_mount_tree_list 50-Tamq_mount_tree_p 51-Tamq_opt 52-Tamq_setopt 53-Tamq_string 54-Tattrstat 55-Tauto_tree 56-Tautomount 57-Tcallout 58-Tcreateargs 59-Tdict 60-Tdict_data 61-Tdict_ent 62-Tdirlist 63-Tdiropargs 64-Tdiropokres 65-Tdiropres 66-Tdirpath 67-Tdisk_fs 68-Tentry 69-Tether_if 70-Texportnode 71-Texports 72-Tfattr 73-Tfh_cache 74-Tfhandle 75-Tfhandle_t 76-Tfhstatus 77-Tfilename 78-Tfserver 79-Tfsmount 80-Tftype 81-Tfwd_fun 82-Tgid_t 83-Tgroupnode 84-Tgroups 85-Thost 86-Tioloc 87-Tkv 88-Tlinkargs 89-Tmap_type 90-Tmnt_map 91-Tmntfs 92-Tmntlist 93-Tmount 94-Tmountbody 95-Tmountlist 96-Tname 97-Tnfs_fh 98-Tnfs_private 99-Tnfscookie 100-Tnfspath 101-Tnfsstat 102-Tnfstime 103-Tnfsx_mnt 104-Tnsw_lookup 105-Tnsw_switchconfig 106-Topt_apply 107-Tpid_t 108-Tpjob 109-Tqelem 110-Treadargs 111-Treaddirargs 112-Treaddirres 113-Treadlinkres 114-Treadokres 115-Treadres 116-Trenameargs 117-Trpc_forward 118-Tsattr 119-Tsattrargs 120-Tserv_state 121-Tstatfsokres 122-Tstatfsres 123-Tsymlinkargs 124-Ttask_fun 125-Ttime_t 126-Ttime_type 127-Tuid2home_t 128-Tuid_t 129-Tusername2uid_t 130-Tvffserver 131-Tvfmount_fs 132-Tvfs_init 133-Tvfs_match 134-Tvfumount_fs 135-Tvmount_fs 136-Tvmounted 137-Tvoidp 138-Tvumount_fs 139-Tvumounted 140-Twriteargs 141" 142 143gnuopts=" 144-npro 145-nbad 146-bap 147-sob 148-fca 149-nfc1 150-ncdb 151-br 152-ce 153-ss 154-npcs 155-cs 156-nbc 157-psl 158-lp 159-sc 160-T IntFuncPtr 161-T add_fn 162-T addrlist 163-T am_node 164-T am_ops 165-T am_opts 166-T am_stats 167-T amq_mount_info 168-T amq_mount_info_list 169-T amq_mount_stats 170-T amq_mount_tree 171-T amq_mount_tree_list 172-T amq_mount_tree_p 173-T amq_opt 174-T amq_setopt 175-T amq_string 176-T attrstat 177-T auto_tree 178-T automount 179-T callout 180-T createargs 181-T dict 182-T dict_data 183-T dict_ent 184-T dirlist 185-T diropargs 186-T diropokres 187-T diropres 188-T dirpath 189-T disk_fs 190-T entry 191-T ether_if 192-T exportnode 193-T exports 194-T fattr 195-T fh_cache 196-T fhandle 197-T fhandle_t 198-T fhstatus 199-T filename 200-T fserver 201-T fsmount 202-T ftype 203-T fwd_fun 204-T gid_t 205-T groupnode 206-T groups 207-T host 208-T ioloc 209-T kv 210-T linkargs 211-T map_type 212-T mnt_map 213-T mntfs 214-T mntlist 215-T mount 216-T mountbody 217-T mountlist 218-T name 219-T nfs_fh 220-T nfs_private 221-T nfscookie 222-T nfspath 223-T nfsstat 224-T nfstime 225-T nfsx_mnt 226-T nsw_lookup 227-T nsw_switchconfig 228-T opt_apply 229-T pid_t 230-T pjob 231-T qelem 232-T readargs 233-T readdirargs 234-T readdirres 235-T readlinkres 236-T readokres 237-T readres 238-T renameargs 239-T rpc_forward 240-T sattr 241-T sattrargs 242-T serv_state 243-T statfsokres 244-T statfsres 245-T symlinkargs 246-T task_fun 247-T time_t 248-T time_type 249-T uid2home_t 250-T uid_t 251-T username2uid_t 252-T vffserver 253-T vfmount_fs 254-T vfs_init 255-T vfs_match 256-T vfumount_fs 257-T vmount_fs 258-T vmounted 259-T voidp 260-T vumount_fs 261-T vumounted 262-T writeargs 263" 264 265 266#prefix=".C" 267 268# check args 269if [ $# -lt 1 ]; then 270 echo "Usage: $0 <-g|-s> [files...]" 271 exit 1 272fi 273if [ $1 = "-g" -o "$1" = "-s" ]; then 274 OPT=$1 275 shift 276else 277 echo "Usage: $0 <-g|-s> [files...]" 278 exit 1 279fi 280# check if specified files to process 281if [ $# -gt 0 ]; then 282 files="$*" 283fi 284 285for i in ${files}; do 286 if [ ! -f $i ]; then 287 echo "No such file: $i" 288 continue 289 fi 290 291 case $OPT in 292 293 -g ) 294 icmd="/usr/local/gnu/bin/indent" 295 cmd="${icmd} $i -o $i$prefix $gnuopts" 296 showcmd="${icmd} $i -o $i$prefix" 297 298 ;; 299 300 -s ) 301 icmd="/opt/SUNWspro/bin/indent" 302 cmd="${icmd} $i $i$prefix $sunopts" 303 showcmd="${icmd} $i $i$prefix" 304 ;; 305 306 * ) 307 echo "Usage: $0 <-g|-s>" 308 exit 1 309 ;; 310 esac 311 312 echo ${showcmd} 313 ${cmd} 314 if [ $? != 0 ]; then 315 echo Failed! 316 exit $? 317 fi 318 319 # remove trailing spaces 320 cmd="./m4/rmtspc $i" 321 echo ${cmd} 322 ${cmd} 323 if [ $? != 0 ]; then 324 echo Failed! 325 exit $? 326 fi 327 328done 329