      INTEGER OPEN
      INTEGER GETARG,SVGET,STRBSR,INDEX,CTOC
      INTEGER SEARCH(102),COMMA0(102),LOCAT0(102),EXECU0(102)
      INTEGER FD
      INTEGER I,J,K,L
      INTEGER INTPOS(47)
      INTEGER INTCMD(299)
      INTEGER AAAAA0(13)
      INTEGER AAAAB0(29)
      INTEGER AAAAC0(7)
      INTEGER AAAAD0(7)
      INTEGER AAAAE0(7)
      INTEGER AAAAF0(5)
      INTEGER AAAAG0(22)
      DATA INTCMD/225,225,242,231,0,225,225,242,231,243,0,225,225,242,23
     *1,243,244,239,0,227,227,225,243,229,0,228,227,228,0,232,228,225,24
     *4,229,0,232,228,225,249,0,248,228,226,231,0,246,228,229,227,236,22
     *5,242,229,0,246,228,229,227,236,225,242,229,228,0,237,228,242,239,
     *240,0,226,228,245,237,240,0,232,229,227,232,239,0,227,229,236,233,
     *230,0,227,229,236,243,229,0,227,229,243,225,227,0,232,229,246,225,
     *236,0,227,229,248,233,244,0,227,230,233,0,243,230,239,242,231,229,
     *244,0,227,231,239,244,239,0,243,232,233,243,244,0,227,233,230,0,23
     *7,233,238,228,229,248,0,232,233,238,243,244,225,236,236,225,244,23
     *3,239,238,0,227,236,225,226,229,236,0,232,236,233,238,229,0,232,23
     *6,239,231,233,238,223,238,225,237,229,0,225,238,225,242,231,243,0,
     *227,239,245,244,0,248,240,242,233,237,239,243,0,225,241,245,239,24
     *4,229,0,227,242,229,240,229,225,244,0,243,243,229,244,0,243,243,23
     *2,0,226,243,232,244,242,225,227,229,0,241,243,244,239,240,0,237,24
     *3,245,226,243,244,242,0,237,244,225,235,229,0,227,244,232,229,238,
     *0,232,244,233,237,229,0,227,245,238,244,233,236,0,246,246,225,242,
     *243,0,248,246,240,243,228,0,227,247,232,229,238,0,248,248,0/
      DATA INTPOS/46,1,6,12,20,26,30,36,41,46,55,65,71,77,83,89,95,101,1
     *07,113,117,125,131,137,141,148,162,169,175,187,194,199,207,214,222
     *,227,231,240,246,254,260,266,272,279,285,291,297/
      DATA AAAAA0/223,243,229,225,242,227,232,223,242,245,236,229,0/
      DATA AAAAB0/222,233,238,244,172,222,246,225,242,172,166,172,189,23
     *6,226,233,238,189,175,166,172,189,226,233,238,189,175,166,0/
      DATA AAAAC0/222,233,238,244,170,238,0/
      DATA AAAAD0/222,233,238,244,170,238,0/
      DATA AAAAE0/222,246,225,242,170,238,0/
      DATA AAAAF0/170,243,170,238,0/
      DATA AAAAG0/170,243,186,160,238,239,244,160,230,239,245,238,228,16
     *0,233,238,160,170,243,170,238,0/
      IF((GETARG(1,COMMA0,102).EQ.-1))GOTO 10000
        IF((SVGET(AAAAA0,SEARCH,102).NE.-1))GOTO 10001
          CALL SCOPY(AAAAB0,1,SEARCH,1)
10001   GOTO 10002
10000   CALL ERROR('Usage: which <command>.')
10002 I=1
      GOTO 10005
10003 I=I+(1)
10005 IF((SEARCH(I).EQ.0))GOTO 10004
        J=1
        GOTO 10008
10006   I=I+(1)
        J=J+(1)
10008   IF((SEARCH(I).EQ.172))GOTO 10007
        IF((SEARCH(I).EQ.0))GOTO 10007
          LOCAT0(J)=SEARCH(I)
        GOTO 10006
10007   LOCAT0(J)=0
        IF((SEARCH(I).NE.0))GOTO 10009
          I=I-(1)
10009   IF((LOCAT0(1).NE.222))GOTO 10010
        IF((LOCAT0(2).NE.233))GOTO 10010
        IF((LOCAT0(3).NE.238))GOTO 10010
        IF((LOCAT0(4).NE.244))GOTO 10010
          K=STRBSR(INTPOS,INTCMD,1,COMMA0)
          IF((K.EQ.-1))GOTO 10011
            IF((LOCAT0(5).NE.175))GOTO 10012
              IF((INDEX(LOCAT0(6),INTCMD(INTPOS(K))).NE.0))GOTO 10013
                CALL PRINT(-11,AAAAC0)
                CALL SWT
10013         GOTO 10014
10012         CALL PRINT(-11,AAAAD0)
              CALL SWT
10014     CONTINUE
10011     GOTO 10015
10010     IF((LOCAT0(1).NE.222))GOTO 10016
          IF((LOCAT0(2).NE.246))GOTO 10016
          IF((LOCAT0(3).NE.225))GOTO 10016
          IF((LOCAT0(4).NE.242))GOTO 10016
            IF((SVGET(COMMA0,K,1).EQ.-1))GOTO 10017
              CALL PRINT(-11,AAAAE0)
              CALL SWT
10017       GOTO 10018
10016       K=1
            L=1
            GOTO 10021
10019       L=L+(1)
10021       IF((LOCAT0(L).EQ.0))GOTO 10020
            IF((K.GE.102))GOTO 10020
              IF((LOCAT0(L).EQ.166))GOTO 10022
                EXECU0(K)=LOCAT0(L)
                K=K+(1)
                GOTO 10023
10022           K=K+(CTOC(COMMA0,EXECU0(K),102-K+1))
10023       GOTO 10019
10020       EXECU0(K)=0
            FD=OPEN(EXECU0,1)
            IF((FD.EQ.-3))GOTO 10024
              CALL CLOSE(FD)
              CALL PRINT(-11,AAAAF0,EXECU0)
              CALL SWT
10024     CONTINUE
10018   CONTINUE
10015 GOTO 10003
10004 CALL PRINT(-15,AAAAG0,COMMA0,SEARCH)
      CALL SWT
      END
C ---- Long Name Map ----
C execute                        execu0
C location                       locat0
C command                        comma0