The R Project SVN R

Rev

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

Rev 59039 Rev 62583
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  file rt_complete.c
3
 *  file rt_complete.c
4
 *  Copyright (C) 2007 The R Core Team.
4
 *  Copyright (C) 2007-13 The R Core Team.
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
9
 *  (at your option) any later version.
Line 95... Line 95...
95
    strcpy(pline, partial_line);
95
    strcpy(pline, partial_line);
96
    /* poor attempt at escaping quotes that sort of works */
96
    /* poor attempt at escaping quotes that sort of works */
97
    alen = strlen(pline);
97
    alen = strlen(pline);
98
    for (i = 0; i < alen; i++) if (pline[i] == '"') pline[i] = '\'';
98
    for (i = 0; i < alen; i++) if (pline[i] == '"') pline[i] = '\'';
99
 
99
 
100
    char cmd[strlen(pline) + 100];
100
    size_t len = strlen(pline) + 100; 
-
 
101
    char cmd[len];
-
 
102
    snprintf(cmd, len,
101
    sprintf(cmd, "utils:::.win32consoleCompletion(\"%s\", %d)",
103
	     "utils:::.win32consoleCompletion(\"%s\", %d)",
102
	    pline, cursor_position);
104
	     pline, cursor_position);
103
    PROTECT(cmdSexp = mkString(cmd));
105
    PROTECT(cmdSexp = mkString(cmd));
104
    cmdexpr = PROTECT(R_ParseVector(cmdSexp, -1, &status, R_NilValue));
106
    cmdexpr = PROTECT(R_ParseVector(cmdSexp, -1, &status, R_NilValue));
105
    if (status != PARSE_OK) {
107
    if (status != PARSE_OK) {
106
	UNPROTECT(2);
108
	UNPROTECT(2);
107
	/* Uncomment next line to debug */
109
	/* Uncomment next line to debug */