You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
718 B

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define SCALA_BIN "@l_prefix@/bin"
#define SCALA_SH "@l_prefix@/lib/scala/bin/scala"
int main(int argn, char **argv)
{
char *path_old;
char *path_new;
/* add Scala binary directory to PATH */
if ((path_old = getenv("PATH")) == NULL)
path_old = "/bin:/usr/bin:/sbin:/usr/sbin";
if ((path_new = (char *)malloc(strlen(SCALA_BIN) + 1 + strlen(path_old) + 1)) == NULL)
abort();
sprintf(path_new, "%s:%s", SCALA_BIN, path_old);
setenv("PATH", path_new, 1);
/* execute Scala wrapper script */
argv[0] = SCALA_SH;
if (execv(argv[0], argv) == -1)
abort();
return 0;
}