2 * Copyright (c) 1992, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1992, 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * George V. Neville-Neil. All rights reserved.
9 * Sven Verdoolaege. All rights reserved.
11 * See the LICENSE file for redistribution information.
17 static const char sccsid[] = "@(#)ex_perl.c 8.10 (Berkeley) 9/15/96";
20 #include <sys/types.h>
21 #include <sys/queue.h>
24 #include <bitstring.h>
32 #include "../common/common.h"
35 * ex_perl -- :[line [,line]] perl [command]
36 * Run a command through the perl interpreter.
38 * ex_perldo -- :[line [,line]] perldo [command]
39 * Run a set of lines through the perl interpreter.
41 * PUBLIC: int ex_perl __P((SCR*, EXCMD *));
48 #ifdef HAVE_PERL_INTERP
52 /* Skip leading white space. */
54 for (p = cmdp->argv[0]->bp,
55 len = cmdp->argv[0]->len; len > 0; --len, ++p)
58 if (cmdp->argc == 0 || len == 0) {
59 ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
62 return (cmdp->cmd == &cmds[C_PERLCMD] ?
63 perl_ex_perl(sp, p, len, cmdp->addr1.lno, cmdp->addr2.lno) :
64 perl_ex_perldo(sp, p, len, cmdp->addr1.lno, cmdp->addr2.lno));
66 msgq(sp, M_ERR, "306|Vi was not loaded with a Perl interpreter");