#include "str.h"
int
-cmd_include_at (void)
+cmd_include (void)
{
- char *incfn, *s, *bp, *ep;
-
- s = bp = lex_entire_line ();
- while (isspace ((unsigned char) *bp))
- bp++;
- bp++; /* skip `@' */
- while (isspace ((unsigned char) *bp))
- bp++;
- if (*bp == '\'')
- bp++;
-
- ep = bp + strlen (bp);
- while (isspace ((unsigned char) *--ep));
- if (*ep != '\'')
- ep++;
+ /* Skip optional FILE=. */
+ if (lex_match_id ("FILE"))
+ lex_match ('=');
- if (ep <= bp)
+ /* Filename can be identifier or string. */
+ if (token != T_ID && token != T_STRING)
{
- msg (SE, _("Unrecognized filename format."));
+ lex_error (_("expecting filename"));
return CMD_FAILURE;
}
-
- /* Now the filename is trapped between bp and ep. */
- incfn = xmalloc (ep - bp + 1);
- strncpy (incfn, bp, ep - bp);
- incfn[ep - bp] = 0;
- getl_include (incfn);
- free (incfn);
-
- return CMD_SUCCESS;
-}
-
-int
-cmd_include (void)
-{
- lex_get ();
-
- if (!lex_force_string ())
- return CMD_SUCCESS;
getl_include (ds_value (&tokstr));
lex_get ();