📄 mkudndir.sh
字号:
#! /bin/sh## MKUDNDIR - create a User-Defined Node directory and install default template files## usage: mkudndir [directory] [-n node-type-name]## If the names are not given on the command line, they are read# interactively.## Bill Kuhn - November 11 1991 - Copied and adapted from mkmoddir by Stever Tynor## Note: not using shell functions for error messages since older# versions of sh (such as the one in Apollo's Domain/OS 10.3) do not# support them.# Include global XSPICE definitions. /usr/local/xspice-1-0/include/shell.includetemplate_dir=$ROOT/lib/cmt/mkudndirtempl_mf=$template_dir/Makefile.tpltempl_udn=$template_dir/udnfunc.tplprog=$0usage="mkudndir [directory] [-n node-type-name]"dirname=nodename=# Get command line argumentsechowhile [ -n "$1" ]do case $1 in -n) if [ -n "$nodename" ] then echo echo ERROR: SPICE Model name already set. echo $usage exit 1 fi shift nodename=$1 ;; ?*) if [ -n "$dirname" ] then echo echo ERROR: Directory name already set. echo $usage exit 1 fi dirname=$1 ;; esac shiftdone# Prompt for any required names not given on command lineif [ -z "$dirname" ]then echo -n "Directory name: " read dirnamefiif [ -z "$nodename" ]then nodename=`basename $dirname` echo -n "Node type name ["$nodename"]: " read tmp if [ -n "$tmp" ] then nodename=$tmp fifiif [ -z "$dirname" -o -z "$nodename" ]then echo echo ERROR: invalid directory, or udn type name. echo exit 1fi# Create the new directoryechomkdir $dirnameif [ 0 != $? ]then echo echo ERROR: mkdir failed - unable to create model directory: $dirname. echo exit 1fi# Copy over file templates and run "sed" to use user-supplied# namecp $templ_mf $dirname/Makefileif [ 0 != $? ]then echo echo ERROR: Makefile template copy failed. echo exit 1fised -e "s/NODE_TYPE_NAME/$nodename/g" \ $templ_udn > $dirname/udnfunc.cif [ 0 != $? ]then echo echo ERROR: udnfunc.c template copy failed. echo exit 1fi# Report successechoecho User-Defined Node directory \"$dirname\" created.echoecho Edit file \"udnfunc.c\" to define your node type.echo Then run \"make\" to compile it.echoexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -