The R Project SVN R

Rev

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

Rev 62580 Rev 62583
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Langage for Statistical Data Analysis
2
 *  R : A Computer Langage for Statistical Data Analysis
3
 *  Copyright (C) 1998--2005  Guido Masarotto and Brian Ripley
3
 *  Copyright (C) 1998--2005  Guido Masarotto and Brian Ripley
4
 *  Copyright (C) 2004--2011  The R Foundation
4
 *  Copyright (C) 2004--2013  The R Foundation
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 393... Line 393...
393
    } else {
393
    } else {
394
	c0 = "TRUE";
394
	c0 = "TRUE";
395
	check(mfncomplete);
395
	check(mfncomplete);
396
	filename_completion_on = 1;
396
	filename_completion_on = 1;
397
    }
397
    }
398
    sprintf(cmd, "utils::rc.settings(files=%s)", c0);
398
    snprintf(cmd, 200, "utils::rc.settings(files=%s)", c0);
399
    consolecmd(RConsole, cmd);
399
    consolecmd(RConsole, cmd);
400
 
400
 
401
}
401
}
402
 
402
 
403
static void menuconsolestayontop(control m)
403
static void menuconsolestayontop(control m)
Line 661... Line 661...
661
{
661
{
662
    char  s[256], s2[256];
662
    char  s[256], s2[256];
663
 
663
 
664
 
664
 
665
    PrintVersionString(s2, 256);
665
    PrintVersionString(s2, 256);
666
    sprintf(s, "%s\n%s %s %s",
666
    snprintf(s, 256, "%s\n%s %s %s",
667
	    s2,
667
	     s2,
668
	    "Copyright (C)", R_YEAR,
668
	     "Copyright (C)", R_YEAR,
669
	    "The R Foundation for Statistical Computing");
669
	     "The R Foundation for Statistical Computing");
670
    askok(s);
670
    askok(s);
671
/*    show(RConsole); */
671
/*    show(RConsole); */
672
}
672
}
673
 
673
 
674
static void menuRhome(control m)
674
static void menuRhome(control m)
Line 773... Line 773...
773
 
773
 
774
void readconsolecfg()
774
void readconsolecfg()
775
{
775
{
776
    char  fn[128];
776
    char  fn[128];
777
    int   sty = Plain;
777
    int   sty = Plain;
778
    char  optf[PATH_MAX];
778
    char  optf[PATH_MAX+1];
779
 
779
 
780
    struct structGUI gui;
780
    struct structGUI gui;
781
 
781
 
782
    getDefaults(&gui);
782
    getDefaults(&gui);
783
 
783
 
784
    if (R_LoadRconsole) {
784
    if (R_LoadRconsole) {
785
	sprintf(optf, "%s/Rconsole", getenv("R_USER"));
785
	snprintf(optf, PATH_MAX+1, "%s/Rconsole", getenv("R_USER"));
786
	if (!loadRconsole(&gui, optf)) {
786
	if (!loadRconsole(&gui, optf)) {
787
	    sprintf(optf, "%s/etc/Rconsole", getenv("R_HOME"));
787
	    snprintf(optf, PATH_MAX+1, "%s/etc/Rconsole", getenv("R_HOME"));
788
	    if (!loadRconsole(&gui, optf)) {
788
	    if (!loadRconsole(&gui, optf)) {
789
		app_cleanup();
789
		app_cleanup();
790
		RConsole = NULL;
790
		RConsole = NULL;
791
		exit(10);
791
		exit(10);
792
	    }
792
	    }
Line 817... Line 817...
817
    Rwin_graphicsx = gui.grx;
817
    Rwin_graphicsx = gui.grx;
818
    Rwin_graphicsy = gui.gry;
818
    Rwin_graphicsy = gui.gry;
819
 
819
 
820
    if(strlen(gui.language)) {
820
    if(strlen(gui.language)) {
821
	char *buf = malloc(50);
821
	char *buf = malloc(50);
822
	sprintf(buf, "LANGUAGE=%s", gui.language);
822
	snprintf(buf, 50, "LANGUAGE=%s", gui.language);
823
	putenv(buf);
823
	putenv(buf);
824
    }
824
    }
825
    setconsoleoptions(fn, sty, gui.pointsize, gui.crows, gui.ccols,
825
    setconsoleoptions(fn, sty, gui.pointsize, gui.crows, gui.ccols,
826
		      gui.cx, gui.cy,
826
		      gui.cx, gui.cy,
827
		      gui.guiColors,
827
		      gui.guiColors,
Line 1257... Line 1257...
1257
}
1257
}
1258
 
1258
 
1259
menuItems *wingetmenuitems(const char *mname, char *errmsg) {
1259
menuItems *wingetmenuitems(const char *mname, char *errmsg) {
1260
    menuItems *items;
1260
    menuItems *items;
1261
    char mitem[1002], *p, *q, *r;
1261
    char mitem[1002], *p, *q, *r;
1262
    int i,j=0;
1262
    int i,j = 0;
1263
 
1263
 
1264
    q = (char *)malloc(1000 * sizeof(char));
1264
    q = (char *)malloc(1000 * sizeof(char));
1265
    r = (char *)malloc(1000 * sizeof(char));
1265
    r = (char *)malloc(1000 * sizeof(char));
1266
 
1266
 
1267
    if (strlen(mname) > 1000) {
1267
    if (strlen(mname) > 1000) {
Line 1289... Line 1289...
1289
	strcpy(q, p+strlen(mitem));
1289
	strcpy(q, p+strlen(mitem));
1290
	/* Due to the way menu items are stored, it can't be */
1290
	/* Due to the way menu items are stored, it can't be */
1291
	/* determined if this is say item 'foo' from menu 'Blah/bar' */
1291
	/* determined if this is say item 'foo' from menu 'Blah/bar' */
1292
	/* or item 'bar/foo' from menu 'Blah'.  Check this manually */
1292
	/* or item 'bar/foo' from menu 'Blah'.  Check this manually */
1293
	/* by adding the item label to the menu we're looking for. */
1293
	/* by adding the item label to the menu we're looking for. */
1294
	sprintf(r, "%s%s", mitem, umitems[i]->m->text);
1294
	snprintf(r, 1000, "%s%s", mitem, umitems[i]->m->text);
1295
	if (strcmp(r, p) != 0)
1295
	if (strcmp(r, p) != 0)
1296
	    continue;
1296
	    continue;
1297
 
1297
 
1298
	items->mItems[j] = (Uitem)malloc(sizeof(uitem));
1298
	items->mItems[j] = (Uitem)malloc(sizeof(uitem));
1299
	items->mItems[j]->name = (char *)malloc((strlen(q) + 1) * sizeof(char));
1299
	items->mItems[j]->name = (char *)malloc((strlen(q) + 1) * sizeof(char));