⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 part01

📁 speech signal process tools
💻
📖 第 1 页 / 共 3 页
字号:
#! /bin/sh# This is a shell archive, meaning:# 1. Remove everything above the #! /bin/sh line.# 2. Save the resulting text in a file.# 3. Execute the file with /bin/sh (not csh) to create the files:#	sf.1 README MANIFEST COPYRIGHT TODO Print Stty Lib basic.h#	form.h field.h term.h Makefileexport PATH; PATH=/bin:$PATHecho shar: extracting "'sf.1'" '(6409 characters)'if test -f 'sf.1'then	echo shar: will not over-write existing file "'sf.1'"elsesed 's/^X//' << \SHAR_EOF > 'sf.1'X.TH sf 1-gsg "Ver 1.8  01/28/88"X.SH NAMEXsf - shell form (form editor to be used in shell scripts)X.SH SYNOPSISX.B sfX[-Hbhmpru] [-o outfile] [formfile]X.IP -HXdisplay help messageX.IP -bXgenerate Bourne shell script, default is Csh scriptX.IP -hXdisplay input field in highlight modeX.IP -mXdisplay help message automatically for selection fieldsX.IP -oXset output file to outfile (if not given, no output)X.IP -pXgenerate perl script, default is Csh scriptX.IP -rXdisplay input field in reverse video modeX.IP -uXdisplay input field in underline modeX.IP formfileXfile contains form layout (default to stdin)X.SH DESCRIPTIONX.I SfXis a tool that allows users write shell scripts with elegant formXediting user interface.  It reads an input form, displays it on theXscreen, and process all the data entry.  At the end of the formXfilling session, sf generates a file contains Csh set commands (orXBourne shell commands if -b is specified, Perl script if -p isXspecified) which is intended to be 'sourced' by Csh (or "." if you useXBourne shell, "eval" in perl).  After source operation, all the fieldsXin the form will be defined as shell variables and shell script canXcontinue after that.X.PPXThe form template may be stored in a file, but the easiest way to useXsf is to send it thru stdin so you do not have to have a script fileXand a separate form file to do one job.X.SH FORM DEFINITIONXInput field are specified by '~' characters in the form template,Xtherefore, it it not possible to have ~ characters displayed on theXform.  If the 1st char of a line is a CTRL L (^L) character, itXindicates the end of form layout part and the start of fieldXdefinition part.  In field definition part, the 1st character on aXline will be used as the delimiter of each token on that line.XCurrently only five tokens are valid:X.IP "v="Xthis means the following token string (until the next delimiter orXeol) will be used as the symbol to set at shell.X.IP "d="Xthis means the following token should be used as the default value toXstore in the form before form is displayed.X.IP "s="Xthis means the following string is the selection list with the firstXcharacter as the delimiter, the ending delimiter is optional.X.IP "h="Xthis means the possible help message for selection field, multiple h=Xis needed. For example, if you have a selection field:X.IPXs=/find/add/delete/print/quitX.IPXyou should specify the help message by:X.spX.nfX	h=find record based on user nameX	h=add a new record to databaseX	h=delete current user from databaseX	h=print current user record on printerX	h=quit this programX.fiX.IPXwhere each h= entry refers to each of the fields in selection list.X.IP "a="Xthis specifies the possible attributes for the given field whichXshould be supplied as parameters, the following characters will beXrecognized:X.RSX.IP "a"Xautotab, when user typed a character at the last position, the fieldXediting will be terminated and cursor will move to next field on theXform.X.IP "d"Xdigits only field, any characters not '0' - '9' will not be accepted.X.IP "b"Xblock field, next/prev block command (ESC N, ESC P) will move cursorXto next field with block attribute set. This makes it easier for userXto move to the desired 'block' of fields. (not implemented yet)X.REX.SH COMMANDSXField editing commands are designed to be simple.  Sf understandsXarrow keys so it can be used easily for non-technical personnel.XField cursor movement keys are Emacs-like with one major difference:Xthere is no insert mode (any volunteer?), character entered willXoverwrite existing data.  The following is a list of them:X.IP "TAB"XMove to next field on the screen. If there are more fields on the currentXline, move to the first one to the right of current field.  If there isXno more fields, moves to the first field on the following lines.X.IP "CTRL T"XSame as TAB except moves backwards.X.IP "RETURN or LINEFEED"XTerminates the form edit session.X.IP "up arrow or CTRL P"XMoves to the closest fields on the previous lines, wrap around if no more.X.IP "down arrow or CTRL N"XSame as up arrow execpt moves downward instead.X.IP "left arrow or CTRL B"XMoves cursor left on character on the current field.X.IP "right arrow or CTRL F"XMoves cursor right on character on the current field.X.IP "CTRL E"XMoves cursor to the end of last non-blank characters on the current field.X.IP "CTRL A"XMoves cursor to the beginning of the current field.X.IP "CTRL U"XBlanks all the characters from cursor to beginning of the current field.X.IP "CTRL K"XBlanks all the characters from cursor to the end of the current field.X.IP "CTRL W"XBlanks the previous word before cusor on the current field.X.IP "CTRL L"XRedisplay the form.X.IP "CTRL Z"X(Or whatever your stop key is) Stop sf.X.IP "CTRL C"X(Or whatever your interrupt key is) Aborts the form editing session,Xsf will display a message and terminate.X.SH EXAMPLEXThe following is an example of how to use it (C shell script):X.PPX.nfX#! /bin/csh -fXset srcfile = "/tmp/form.$$"Xsf -o ${srcfile} -u << sf_eofXX	     General Systems Group Fast Printer SpoolerXX   File Name: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~XX	[-#] Number of copies:	~~~	      [-h] Burst Header Page: ~~~X	[-m] Send mail on completion: ~~~     [-p] Format with pr:    ~~~XX	[-J] Job Name:		~~~~~~~~~~~~~X	[-C] Class Name:	~~~~~~~~~~~~~X	[-T] Title for pr:	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~XX		    Current Print Queue StatusX`lpq | head -5`XX	[Press TAB to move to next field, RETURN to execute]XX@v=fn@d=$*@X@v=copy@d=1@a=d@v=burst@s=/Yes/No@X@v=mail@s=/No/Yes@v=pr@s=/Yes/No@X@v=job@d=$1@X@v=class@d=`hostname`@X@v=title@d=$1@Xsf_eofXif ( ! -e ${srcfile} ) goto endXsource ${srcfile}Xset copy burst pr mail tf cf jfXif ( "${copy}" != "1" ) set copy = "-#${copy}"Xif ( "${burst}" != "Yes" ) set burst = "-h"Xif ( "${pr}" == "Yes" ) set pr = "-p"Xif ( "${mail}" == "Yes" ) set mail = "-m"Xif ( "${title}" != "" ) set tf = "-T"Xif ( "${class}" != "" ) set cf = "-C"Xif ( "${job}" != "" ) set jf = "-J"Xif ( "${fn}" != "" ) thenX	lpr ${copy} ${burst} ${pr} ${mail} ${tf} "${title}" \X	${cf} "${class}" ${jf} "${job}" ${fn}X	endifX/bin/rm -f ${srcfile}Xend:X.nfX.fiX.SH AUTHORXPaul LewX.brXGeneral Systems Group, Salem NHX.SH BUGSXThis version of sf comes from my previous work on IBM-PC for my friends andXit is rather primitive.  Form editor itself may be improved comments areXwelcome.SHAR_EOFif test 6409 -ne "`wc -c < 'sf.1'`"then	echo shar: error transmitting "'sf.1'" '(should have been 6409 characters)'fifi # end of overwriting checkecho shar: extracting "'README'" '(1618 characters)'if test -f 'README'then	echo shar: will not over-write existing file "'README'"elsesed 's/^X//' << \SHAR_EOF > 'README'XThis is sf (shell form) version 1.8.  Having used so many high qualityXprograms from the net, this is my time to contribute.XXThis  program  was written to   augment the versatility  of  Unix userXinterface in shell level.   It does  only  one  thing -- form editing.XShell script writer has to process the data afterwards.XXSome typical usage for this program are:XX    o interface for non-Unix user  to access system  resource. One canX      easily write shell  scripts  display menus and forms  for noviceX      users.XX    o Something like bulletin board system might use sf interface.XX    o I personally  use   it   to interface  with those commands  withX      zillions of  options  (e.g.,  stty, sa, admin,  cpio)  or  thoseX      commands used infrequently   (e.g., print).  I  used capitalizedX      command  names for those  shell scripts with sf interface, e.g.,X      Stty for stty, Admin for admin, etc.XX    o With  proper database  interface  program,  sf  may be  used forX      system administrator to configure system, e.g.,  add new user toX      system, configure I/O ports,  etc.   The recently posted  "perl"X      might be a good candidate.XXTo build sf, simply type: "make".  Sf  has not been  tested on non-BSDXsystem,  some porting will  be   needed.  You might   want to run someXsample scripts supplied with the package to see how it works.  Enjoy!XXSample scripts:XX	Print	(csh)	interface to BSD 4.2 print commandX	Stty	(sh)	interface to BSD 4.3 stty commandX	Lib	(csh)	maintain on-line library index (need modification)XXMail bugs/comments to Paul Lew at {olivea,harvard,decvax}!gsg!lewSHAR_EOFif test 1618 -ne "`wc -c < 'README'`"then	echo shar: error transmitting "'README'" '(should have been 1618 characters)'fifi # end of overwriting checkecho shar: extracting "'MANIFEST'" '(1002 characters)'if test -f 'MANIFEST'then	echo shar: will not over-write existing file "'MANIFEST'"elsesed 's/^X//' << \SHAR_EOF > 'MANIFEST'X----shar.01-----X 35fe 31508    185   1131   6409 sf.1X 8d87  7256     37    245   1618 READMEX ab4a   988      1      1     17 MANIFESTX f02a 23081      6     48    284 COPYRIGHTX e960 10353     24    145    894 TODOX 6608 50247     95    334   2591 PrintX 927c  8727    266   1316  10025 SttyX 9fe4 53398    282   1157   8749 LibX e24c 59953     52    121    829 basic.hX 89f3 38278     36    257   1383 form.hX b07c 51385     17    113    665 field.hX cece 19140     21     63    285 term.hX 867f 47573    121    477   3543 MakefileX----shar.02-----X 2f99 30654    124    581   4115 sf.cX fd6c 10497    225    813   5898 form.cX 0269   995    349   1238   8779 load.cX 50ad 52985    259   1001   6631 field.cX ddfa  7101    219    818   5773 selection.cX 8c69 16251     49    168   1253 keyword.cX e398 32766     50    171   1317 option.cX 9695 13569    109    380   2999 msg.cX 1a39 56277    242   1037   6575 term.cX 5b38  5787    177    486   4106 io.cX aa6e  1634     56    277   1880 summary.cSHAR_EOFif test 1002 -ne "`wc -c < 'MANIFEST'`"then	echo shar: error transmitting "'MANIFEST'" '(should have been 1002 characters)'fifi # end of overwriting checkecho shar: extracting "'COPYRIGHT'" '(284 characters)'if test -f 'COPYRIGHT'then	echo shar: will not over-write existing file "'COPYRIGHT'"elsesed 's/^X//' << \SHAR_EOF > 'COPYRIGHT'Xsf Version 1.8, Copyright (c) 1988, Paul LewXX    You may copy this program (sf) in whole or in  part as long as youX    don't try to make  money off it,   or pretend that  you  wrote it.X    This   COPYRIGHT notice   should  always   be  included with   allX    distributions of sf.SHAR_EOFif test 284 -ne "`wc -c < 'COPYRIGHT'`"then	echo shar: error transmitting "'COPYRIGHT'" '(should have been 284 characters)'fifi # end of overwriting checkecho shar: extracting "'TODO'" '(894 characters)'if test -f 'TODO'then	echo shar: will not over-write existing file "'TODO'"elsesed 's/^X//' << \SHAR_EOF > 'TODO'XWhat should be added:XX	* insert  mode in field  editing.  The  original  idea is thatX	  most of the fields should be short and  there  is no need toX	  duplicate editor function in sf.  For novice user, they dontX	  know fancy commands  anyway; for expert  user, sf is  usefulX	  only in  special  occasion.  This  delayed  the  addition ofX	  extra editing function  (insert mode, delete  word,  move byX	  word, etc).XXWhat should not be added:XX	* Database function: I could not think of an  easy way so thatX	  sf can read  standard Unix database  files like /etc/passwd,X	  /etc/ttys, any  idea?    It   will  be good   to have  theseX	  functions, but again, it violate Unix principle: "doing justX	  one thing".XXSomething to think about:XX	* scroll regionX	* multiple forms, chaining to different form files.X	* range checking.X	* pipe field data to Unix program and put result back.SHAR_EOFif test 894 -ne "`wc -c < 'TODO'`"then	echo shar: error transmitting "'TODO'" '(should have been 894 characters)'fifi # end of overwriting checkecho shar: extracting "'Print'" '(2591 characters)'if test -f 'Print'then	echo shar: will not over-write existing file "'Print'"elsesed 's/^X//' << \SHAR_EOF > 'Print'X#! /bin/csh -fX#X#-	print -  print file(s) to line printer (with sf interface)X#-X#	Author:		Paul Lew, General Systems Group, Salem, NHX#	Created at:	5/8/86X#	Last update:	01/27/88  00:03 AM  (Edition: 11)X#X#-	Usage:	Print filenames <CR>X#---------------------------------------------------------------#X#	      Display help if requested by user			#X#---------------------------------------------------------------#Xswitch ( "$1" )X	case -H[xX]:X		set echo; set verbose; shiftX		breakswX	case -H*:X		show_help `which $0` $1X		goto endX	default:X	endswX#---------------------------------------------------------------#X#	  Display form to take input from the user		#X#---------------------------------------------------------------#Xset srcfile = "/tmp/form.$$"Xsf -o ${srcfile} -u <<!XX	     General Systems Group Fast Printer SpoolerXX   File Name: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~XX	[-#] Number of copies:	~~~	      [-h] Burst Header Page: ~~~X	[-m] Send mail on completion: ~~~     [-p] Format with pr:    ~~~XX	[-J] Job Name:		~~~~~~~~~~~~~X	[-C] Class Name:	~~~~~~~~~~~~~X	[-T] Title for pr:	~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~XX		    Current Print Queue StatusX`lpq | head -5`XX	[Press TAB to move to next field, RETURN to execute]XXv=fnd=$*Xv=copya=add=1v=bursts=/Yes/Noa=aXv=mails=/No/Yesa=av=prs=/Yes/Noa=aXv=jobd=$1Xv=classd=`hostname`Xv=titled=$1X!X#---------------------------------------------------------------#X#	Execute script to set variables from form		#X#---------------------------------------------------------------#Xif ( ! -e ${srcfile} ) goto endXsource ${srcfile}X#---------------------------------------------------------------#X#	  Re-arrange variables before execution			#X#---------------------------------------------------------------#Xif ( "${copy}" != "1" ) thenX	set copy = "-#${copy}"XelseX	set copy = ''X	endifX#Xif ( "${burst}" != "Yes" ) thenX	set burst = "-h"XelseX	set burst = ''X	endifX#Xif ( "${pr}" == "Yes" ) thenX	set pr = "-p"XelseX	set pr = ''X	endifX#Xif ( "${mail}" == "Yes" ) thenX	set mail = "-m"XelseX	set mail = ''X	endifX#Xset tf; set cf; set jfXif ( "${title}" != "" ) set tf = "-T"Xif ( "${class}" != "" ) set cf = "-C"Xif ( "${job}" != "" ) set jf = "-J"X#---------------------------------------------------------------#X#		   Execute proper command ....			#X#---------------------------------------------------------------#Xif ( "${fn}" != "" ) thenX	lpr ${copy} ${burst} ${pr} ${mail} ${tf} "${title}" \X	${cf} "${class}" ${jf} "${job}" ${fn}X	endifX/bin/rm -f ${srcfile}Xend:SHAR_EOF

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -