home *** CD-ROM | disk | FTP | other *** search
- /* emacs.rexx - GNU Emacs client */
- /* by Elad Tsur Email: elad@math.tau.ac.il */
-
- OPTIONS FAILAT 21
- exitcode = 0
- PARSE ARG line
-
- IF SHOW('P','EMACS1') THEN
- DO /* we need to parse the command line */
- DO i=1
- PARSE VAR line prefix '"' filename '"' postfix
- line = prefix||postfix
- IF filename = '' THEN LEAVE
- file.i = filename
- END
- DO WHILE line ~= ''
- PARSE VAR line filename line
- file.i = filename
- i = i + 1
- END
- cd = PRAGMA('D') /* add the current directory to relative paths */
- IF RIGHT(cd,1) ~= ":" THEN
- cd = cd||'/'
- DO j=1 TO i-1
- IF POS(':',file.j) = 0 THEN
- file.j = cd||file.j
- ADDRESS 'EMACS1' '(find-file "'||file.j||'")'
- IF RC ~= 0 THEN
- DO
- SAY "emacs: can't open file "||file.j
- exitcode =5
- END
- END
- END
-
- ELSE /* we need to start emacs... */
- DO
- oldstack = PRAGMA('S',50000) /* emacs need large stack */
- oldpri = PRAGMA('P',1)
- ADDRESS COMMAND "Run <NIL: >NIL: GNUEMACS:temacs "||line
- IF RC ~= 0 THEN
- DO
- SAY "emacs: can't run GNUEMACS:temacs RC= "||RC
- exitcode = 20
- END
- CALL PRAGMA('S',oldstack)
- CALL PRAGMA('P',oldpri)
- END
-
- EXIT exitcode
-
-
-
-