File: libprm

package info (click to toggle)
ngspice 26-1
  • links: PTS, VCS
  • area: non-free
  • in suites: jessie-kfreebsd
  • size: 49,436 kB
  • sloc: ansic: 463,259; sh: 11,107; xml: 6,938; makefile: 3,574; yacc: 1,509; perl: 1,214; tcl: 1,025; pascal: 702; lex: 319
file content (58 lines) | stat: -rwxr-xr-x 966 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#set -x -v 

# MW. Lip / Param parsing program for spice

# -n normal, -f full (keep everything), -r replace original file

export TMPLP=/tmp/LibPrm.$$-

function trapper()
    {
     echo User break! 
     echo Exiting . . .
     rm -f -v ${TMPLP}*
     unset TMPLP 
     exit 1
    }
    
trap trapper SIGINT SIGQUIT 

function operror()
    {
     echo Incorrect parameters: $*, $#
     unset TMPLP 
     exit 2
    }

function repnormpl()
    {
     mslib $1 ${TMPLP}1
     sed -n -e 'p' -e "1r ${TMPLP}1" $1 >${TMPLP}2
     spiceprm ${TMPLP}2 $2
    }

function keepall()
    {
     mslib $1
     sed -n -e 'p' -e "1r $1.lib" $1 >${TMPLP}2
     spiceprm ${TMPLP}2 $2
    }
    

# Main body
if test $# -lt 2 -o $# -gt 3; then operror $*; fi

case $1$# in
-r3) operror $*;;
-n2) repnormpl $2 ${2%.cir}.ckt;;
-n3) repnormpl $2 $3;;
-r2) repnormpl $2 $2;;
-f2) keepall $2 ${2%.cir}.ckt;;
-f3) keepall $2 $3;;
esac

rm -f ${TMPLP}*
unset TMPLP 
exit 0