The R Project SVN R

Rev

Rev 89087 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 89087 Rev 89910
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
 *  Copyright (C) 1997--2026  The R Core Team
3
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1997--2025  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 1068... Line 1068...
1068
		buf[len - 1] = '\0';
1068
		buf[len - 1] = '\0';
1069
		rl_rest_offset += len - 1;
1069
		rl_rest_offset += len - 1;
1070
	    }
1070
	    }
1071
	    return 1;
1071
	    return 1;
1072
	}
1072
	}
1073
	
1073
 
1074
	R_ReadlineData rl_data;
1074
	R_ReadlineData rl_data;
1075
	if (UsingReadline) {
1075
	if (UsingReadline) {
1076
	    rl_data.readline_gotaline = 0;
1076
	    rl_data.readline_gotaline = 0;
1077
	    rl_data.readline_buf = buf;
1077
	    rl_data.readline_buf = buf;
1078
	    rl_data.readline_rest = NULL;
1078
	    rl_data.readline_rest = NULL;
Line 1375... Line 1375...
1375
 
1375
 
1376
#include <ctype.h>  /* for isspace */
1376
#include <ctype.h>  /* for isspace */
1377
 
1377
 
1378
attribute_hidden int Rstd_ChooseFile(int _new, char *buf, int len)
1378
attribute_hidden int Rstd_ChooseFile(int _new, char *buf, int len)
1379
{
1379
{
1380
    size_t namelen;
-
 
1381
    char *bufp;
-
 
1382
    R_ReadConsole("Enter file name: ", (unsigned char *)buf, len, 0);
1380
    if (!R_ReadConsole("Enter file name: ", (unsigned char *)buf, len, 0))
-
 
1381
	return 0;
1383
    namelen = strlen(buf);
1382
    size_t namelen = strlen(buf);
-
 
1383
    if (namelen == 0)
-
 
1384
	return 0;
1384
    bufp = &buf[namelen - 1];
1385
    char *bufp = &buf[namelen - 1];
1385
    while (bufp >= buf && isspace((int)*bufp))
1386
    while (bufp >= buf && isspace((int)*bufp))
1386
	*bufp-- = '\0';
1387
	*bufp-- = '\0';
1387
    return (int) strlen(buf);
1388
    return (int) strlen(buf);
1388
}
1389
}
1389
 
1390