The R Project SVN R

Rev

Rev 4626 | Rev 4742 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4626 Rev 4631
Line 56... Line 56...
56
}
56
}
57
 
57
 
58
 
58
 
59
SEXP do_edit(SEXP call, SEXP op, SEXP args, SEXP rho)
59
SEXP do_edit(SEXP call, SEXP op, SEXP args, SEXP rho)
60
{
60
{
61
    int   i, status;
61
    int   i, rc, status;
62
    SEXP  x, fn, envir, ed;
62
    SEXP  x, fn, envir, ed;
63
    char *filename, *editcmd, *vmaxsave;
63
    char *filename, *editcmd, *vmaxsave;
64
    FILE *fp;
64
    FILE *fp;
65
 
65
 
66
    checkArity(op, args);
66
    checkArity(op, args);
Line 93... Line 93...
93
    ed = CAR(CDDR(args));
93
    ed = CAR(CDDR(args));
94
    if (!isString(ed))
94
    if (!isString(ed))
95
	error("editor type not valid\n");
95
	error("editor type not valid\n");
96
    editcmd = R_alloc(strlen(CHAR(STRING(ed)[0])) + strlen(filename) + 2, sizeof(char));
96
    editcmd = R_alloc(strlen(CHAR(STRING(ed)[0])) + strlen(filename) + 2, sizeof(char));
97
    sprintf(editcmd, "%s %s", CHAR(STRING(ed)[0]), filename);
97
    sprintf(editcmd, "%s %s", CHAR(STRING(ed)[0]), filename);
98
    runcmd(editcmd, 1, 1, "");
98
    rc = runcmd(editcmd, 1, 1, "");
-
 
99
    if (rc == NOLAUNCH)
-
 
100
	errorcall(call, "unable to run editor\n");
-
 
101
    if (rc != 0)
-
 
102
	warningcall(call, "editor ran but returned error status\n");
99
 
103
 
100
    if ((fp = R_fopen(filename, "r")) == NULL)
104
    if ((fp = R_fopen(filename, "r")) == NULL)
101
	errorcall(call, "unable to open file to read\n");
105
	errorcall(call, "unable to open file to read\n");
102
    R_ParseCnt = 0;
106
    R_ParseCnt = 0;
103
    x = R_ParseFile(fp, -1, &status);
107
    x = R_ParseFile(fp, -1, &status);