|
1 | 1 | /*
|
2 | 2 | * R : A Computer Language for Statistical Data Analysis
|
3 |
| - * Copyright (C) 2000-2020 R Core Team |
| 3 | + * Copyright (C) 2000-2021 R Core Team |
4 | 4 | *
|
5 | 5 | * This program is free software; you can redistribute it and/or modify
|
6 | 6 | * it under the terms of the GNU General Public License as published by
|
@@ -119,7 +119,7 @@ int rcmdfn (int cmdarg, int argc, char **argv)
|
119 | 119 | read R_HOME\etc\Rcmd_environ
|
120 | 120 | launch %R_HOME%\bin\$*
|
121 | 121 | */
|
122 |
| - int i, iused, status = 0; |
| 122 | + int i, iused; |
123 | 123 | char *p, cmd[CMD_LEN];
|
124 | 124 | char RCMD[] = "R CMD";
|
125 | 125 | int len = strlen(argv[0]);
|
@@ -167,21 +167,9 @@ int rcmdfn (int cmdarg, int argc, char **argv)
|
167 | 167 | return(0);
|
168 | 168 | }
|
169 | 169 | snprintf(cmd, CMD_LEN, "\"\"%s/%s/Rterm.exe\"", getRHOME(3), BINDIR);
|
170 |
| - for (i = cmdarg + 1; i < argc; i++){ |
171 |
| - strcat(cmd, " "); |
172 |
| - if (strlen(cmd) + strlen(argv[i]) > 9900) { |
173 |
| - fprintf(stderr, "command line too long\n"); |
174 |
| - return(27); |
175 |
| - } |
176 |
| - strcat(cmd, "\""); |
177 |
| - strcat(cmd, argv[i]); |
178 |
| - strcat(cmd, "\""); |
179 |
| - } |
180 |
| - /* the outermost double quotes are needed for cmd.exe */ |
181 |
| - strcat(cmd, "\""); |
182 | 170 | /* R.exe should ignore Ctrl-C, and let Rterm.exe handle it */
|
183 | 171 | SetConsoleCtrlHandler(NULL, TRUE);
|
184 |
| - return system(cmd); |
| 172 | + PROCESS_CMD(" "); |
185 | 173 | }
|
186 | 174 |
|
187 | 175 | /* From here on down, this was called as Rcmd or R CMD */
|
@@ -397,20 +385,7 @@ int rcmdfn (int cmdarg, int argc, char **argv)
|
397 | 385 | snprintf(cmd, CMD_LEN,
|
398 | 386 | "\"\"%s/%s/Rterm.exe\" -f \"%s/share/R/REMOVE.R\" R_DEFAULT_PACKAGES=NULL --no-restore --no-echo --args",
|
399 | 387 | getRHOME(3), BINDIR, getRHOME(3));
|
400 |
| - for (i = cmdarg + 1; i < argc; i++){ |
401 |
| - strcat(cmd, " "); |
402 |
| - if (strlen(cmd) + strlen(argv[i]) > 9900) { |
403 |
| - fprintf(stderr, "command line too long\n"); |
404 |
| - return(27); |
405 |
| - } |
406 |
| - /* Library names could contain spaces and other special characters */ |
407 |
| - strcat(cmd, "\""); |
408 |
| - strcat(cmd, argv[i]); |
409 |
| - strcat(cmd, "\""); |
410 |
| - } |
411 |
| - /* the outermost double quotes are needed for cmd.exe */ |
412 |
| - strcat(cmd, "\""); |
413 |
| - return(system(cmd)); |
| 388 | + PROCESS_CMD(" "); |
414 | 389 | } else if (!strcmp(argv[cmdarg], "build")) {
|
415 | 390 | snprintf(cmd, CMD_LEN,
|
416 | 391 | "\"\"%s/%s/Rterm.exe\" -e tools:::.build_packages() R_DEFAULT_PACKAGES= LC_COLLATE=C --no-restore --no-echo --args ",
|
@@ -483,21 +458,7 @@ int rcmdfn (int cmdarg, int argc, char **argv)
|
483 | 458 | else strcpy(cmd, "\"");
|
484 | 459 | strcat(cmd, p);
|
485 | 460 | }
|
486 |
| - |
487 |
| - for (i = cmdarg + 1; i < argc; i++){ |
488 |
| - strcat(cmd, " "); |
489 |
| - if (strlen(cmd) + strlen(argv[i]) > 9900) { |
490 |
| - fprintf(stderr, "command line too long\n"); |
491 |
| - return(27); |
492 |
| - } |
493 |
| - strcat(cmd, "\""); |
494 |
| - strcat(cmd, argv[i]); |
495 |
| - strcat(cmd, "\""); |
496 |
| - } |
497 |
| - /* the outermost double quotes are needed for cmd.exe */ |
498 |
| - strcat(cmd, "\""); |
499 |
| - /* printf("cmd is %s\n", cmd); */ |
500 |
| - status = system(cmd); |
| 461 | + PROCESS_CMD(" "); |
501 | 462 | }
|
502 |
| - return(status); |
| 463 | + /* not reachable */ |
503 | 464 | }
|
0 commit comments