Esempio n. 1
0
msgdomain_list_ty *
msgdomain_read_java (const char *resource_name, const char *locale_name)
{
  const char *class_name = "gnu.gettext.DumpResource";
  const char *gettextjexedir;
  const char *gettextjar;
  const char *args[3];
  struct locals locals;

#if USEJEXE
  /* Make it possible to override the executable's location.  This is
     necessary for running the testsuite before "make install".  */
  gettextjexedir = getenv ("GETTEXTJEXEDIR");
  if (gettextjexedir == NULL || gettextjexedir[0] == '\0')
    gettextjexedir = relocate (GETTEXTJEXEDIR);
#else
  gettextjexedir = NULL;
#endif

  /* Make it possible to override the gettext.jar location.  This is
     necessary for running the testsuite before "make install".  */
  gettextjar = getenv ("GETTEXTJAR");
  if (gettextjar == NULL || gettextjar[0] == '\0')
    gettextjar = relocate (GETTEXTJAR);

  /* Assign a default value to the resource name.  */
  if (resource_name == NULL)
    resource_name = "Messages";

  /* Prepare arguments.  */
  args[0] = resource_name;
  if (locale_name != NULL)
    {
      args[1] = locale_name;
      args[2] = NULL;
    }
  else
    args[1] = NULL;

  /* Dump the resource and retrieve the resulting output.
     Here we use the user's CLASSPATH, not a minimal one, so that the
     resource can be found.  */
  if (execute_java_class (class_name, &gettextjar, 1, false, gettextjexedir,
			  args,
			  verbose, false,
			  execute_and_read_po_output, &locals))
    /* An error message should already have been provided.  */
    exit (EXIT_FAILURE);

  return locals.mdlp;
}
Esempio n. 2
0
char *
javaexec_version (void)
{
  const char *class_name = "javaversion";
  const char *pkgdatadir = relocate (PKGDATADIR);
  const char *args[1];
  struct locals locals;

  args[0] = NULL;
  locals.line = NULL;
  execute_java_class (class_name, &pkgdatadir, 1, true, NULL, args,
                      false, false, execute_and_read_line, &locals);

  return locals.line;
}