[613] | 1 | FSCRPXG ;SLC/STAFF-NOIS RPC Driver - General Use ;1/13/98 16:36
|
---|
| 2 | ;;1.1;NOIS;;Sep 06, 1998
|
---|
| 3 | ;
|
---|
| 4 | RPC(OUTPUT,INPUT) ;
|
---|
| 5 | ; routes all NOIS Workstation Calls
|
---|
| 6 | ; ensures user is authorized to use NOIS
|
---|
| 7 | ; input array sent from client should be within a safe partition size
|
---|
| 8 | ; IN and OUT arrays are not being used, param passing uses TMP instead
|
---|
| 9 | N FSCDEV,FIRSTNUM,INLINE,IN,MAX,NUM,OK,OUT,OUTLINE,RTN,START K IN,OUT
|
---|
| 10 | S MAX=30 ; max # lines that can be sent to client
|
---|
| 11 | S FSCDEV=1
|
---|
| 12 | S FIRSTNUM=+$O(INPUT(""))
|
---|
| 13 | S INLINE=$G(INPUT(FIRSTNUM))
|
---|
| 14 | S OK=1
|
---|
| 15 | I $P(INLINE,U,10)=1 D I 'OK Q ; 1st input
|
---|
| 16 | .K ^TMP("FSCRPC",$J)
|
---|
| 17 | .I $$SHUTDOWN D Q
|
---|
| 18 | ..S OK=0
|
---|
| 19 | ..S ^TMP("FSCRPC",$J,"OUTPUT",0)="^1"
|
---|
| 20 | ..S OUTPUT=$NA(^TMP("FSCRPC",$J,"OUTPUT"))
|
---|
| 21 | .M ^TMP("FSCRPC",$J,"INPUT")=INPUT
|
---|
| 22 | E D
|
---|
| 23 | .I $P(INLINE,U,4) D ; more input being sent
|
---|
| 24 | ..S START=$O(^TMP("FSCRPC",$J,"INPUT",""),-1)
|
---|
| 25 | ..S NUM=0 F S NUM=$O(INPUT(NUM)) Q:NUM<1 D
|
---|
| 26 | ...S START=START+1
|
---|
| 27 | ...S ^TMP("FSCRPC",$J,"INPUT",START)=INPUT(NUM)
|
---|
| 28 | K INPUT,OUTPUT
|
---|
| 29 | S OUTLINE="^0"
|
---|
| 30 | S OK=1
|
---|
| 31 | I $E($P(INLINE,U,2),1,6)="FSCRPC" D I 'OK Q
|
---|
| 32 | .S RTN=$P(INLINE,U,1,2)
|
---|
| 33 | .;I '$L($T(@RTN)) S $P(OUTLINE,U,3)=1 Q ; cancel if invalid routine
|
---|
| 34 | .I $P(INLINE,U,4) Q ; don't process until no more input
|
---|
| 35 | .I $P(INLINE,U,5) D MORE(MAX,OUTLINE,.OUTPUT) S OK=0 Q ; send more output
|
---|
| 36 | .K ^TMP("FSCRPC",$J,"OUTPUT")
|
---|
| 37 | .S RTN=RTN_"(.IN,.OUT)" D @RTN
|
---|
| 38 | .;D MENUS^FSCRPXM(DUZ,.OUTLINE)
|
---|
| 39 | .K ^TMP("FSCRPC",$J,"INPUT")
|
---|
| 40 | I +$G(^TMP("FSCRPC",$J,"OUTPUT"))<MAX D
|
---|
| 41 | .S ^TMP("FSCRPC",$J,"OUTPUT",0)=OUTLINE
|
---|
| 42 | .S OUTPUT=$NA(^TMP("FSCRPC",$J,"OUTPUT"))
|
---|
| 43 | E D MORE(MAX,OUTLINE,.OUTPUT)
|
---|
| 44 | Q
|
---|
| 45 | ;
|
---|
| 46 | MORE(MAX,OUTLINE,OUTPUT) ;
|
---|
| 47 | N CNT,COUNT,LINE,NUM
|
---|
| 48 | K ^TMP("FSCRPC",$J,"OUTPUTLONG")
|
---|
| 49 | S (CNT,NUM)=0 F S NUM=$O(^TMP("FSCRPC",$J,"OUTPUT",NUM)) Q:NUM<1 Q:CNT'<MAX S LINE=^(NUM) D
|
---|
| 50 | .S CNT=CNT+1
|
---|
| 51 | .S ^TMP("FSCRPC",$J,"OUTPUTLONG",CNT)=LINE
|
---|
| 52 | .K ^TMP("FSCRPC",$J,"OUTPUT",NUM)
|
---|
| 53 | I $O(^TMP("FSCRPC",$J,"OUTPUT",0))>0 S $P(OUTLINE,U,5)=1 ; more to come
|
---|
| 54 | E S $P(OUTLINE,U,5)=0 K ^TMP("FSCRPC",$J,"INPUT"),^TMP("FSCRPC",$J,"OUTPUT")
|
---|
| 55 | S ^TMP("FSCRPC",$J,"OUTPUTLONG",0)=OUTLINE
|
---|
| 56 | S OUTPUT=$NA(^TMP("FSCRPC",$J,"OUTPUTLONG"))
|
---|
| 57 | Q
|
---|
| 58 | ;
|
---|
| 59 | TEST(X) ; $$(routine entry) -> 0 or 1 if exists on system
|
---|
| 60 | X ^%ZOSF("TEST") Q $T
|
---|
| 61 | ;
|
---|
| 62 | SHUTDOWN() ; $$ -> 1 or 0 to shutdown applications
|
---|
| 63 | I $P($G(^FSC("PARAM",1,2)),U) Q 1
|
---|
| 64 | Q 0
|
---|