Example #1
0
gboolean
cfg_args_validate(CfgArgs *self, CfgArgs *defs, const gchar *context)
{
  gpointer validate_params[] = { defs, NULL, NULL };

  cfg_args_foreach(self, cfg_args_validate_callback, validate_params);

  if (validate_params[1])
    {
      msg_error("Unknown argument",
                evt_tag_str("context", context),
                evt_tag_str("arg", validate_params[1]),
                evt_tag_str("value", validate_params[2]),
                NULL);
      return FALSE;
    }
  return TRUE;
}
Example #2
0
static inline gboolean
_seek_to_head(JournalReader *self)
{
  gint rc = journald_seek_head(self->journal);
  if (rc != 0)
    {
      msg_error("Failed to seek to the start position of the journal",
                evt_tag_errno("error", errno),
                NULL);
      return FALSE;
    }
  else
    {
      msg_debug("Seeking the journal to the start position",
                NULL);
    }
  return TRUE;
}
Example #3
0
/* Read a booleanean value */
static gboolean
readbool(unsigned char **input)
{
    gchar c;

    c = **input;
    *input += 1;

    if (c!=0 && c!=1)
    {
        msg_error("Error while processing the time zone file",
                  evt_tag_str("message", "Boolean value out-of-range"),
                  evt_tag_int("value", c),
                  NULL);
        g_assert_not_reached();
    }
    return (c != 0);
}
Example #4
0
static gboolean
_create_store(PersistState *self)
{
  self->fd = open(self->temp_filename, O_RDWR | O_CREAT | O_TRUNC, 0600);
  if (self->fd < 0)
    {
      msg_error("Error creating persistent state file",
                evt_tag_str("filename", self->temp_filename),
                evt_tag_errno("error", errno),
                NULL);
      return FALSE;
    }
  g_fd_set_cloexec(self->fd, TRUE);
  self->current_key_block = offsetof(PersistFileHeader, initial_key_store);
  self->current_key_ofs = 0;
  self->current_key_size = sizeof((((PersistFileHeader *) NULL))->initial_key_store);
  return _grow_store(self, PERSIST_FILE_INITIAL_SIZE);
}
Example #5
0
static gboolean
pwrite_strict(gint fd, const void *buf, size_t count, off_t offset)
{
  ssize_t written = pwrite(fd, buf, count, offset);
  gboolean result = TRUE;
  if (written != count)
    {
      if (written != -1)
        {
          msg_error("Short written",
                    evt_tag_int("Number of bytes want to write", count),
                    evt_tag_int("Number of bytes written", written));
          errno = ENOSPC;
        }
      result = FALSE;
    }
  return result;
}
Example #6
0
/* ------------------------------------------------------------------
 *	write_user_settings ()
 */
static void write_user_settings ( const char *in_file, CFPropertyListRef in_data )
{
	CFURLRef cf_url = CFURLCreateFromFileSystemRepresentation(NULL, (const UInt8 *)in_file, strlen(in_file), FALSE);
	if ( !cf_url ) {
		msg_error("aod: could not create URL from: %s", in_file);
		return;
	}

	CFDataRef cf_data = CFPropertyListCreateXMLData(NULL, in_data);
	if ( cf_data ) {
		SInt32 write_err = noErr;
		if ( !CFURLWriteDataAndPropertiesToResource(cf_url, cf_data, NULL, &write_err) )
			if ( msg_verbose )
				msg_warn("aod: could not write to %s (error: %d)", in_file, (int) write_err);
		CFRelease(cf_data);
	}
	CFRelease(cf_url);
} /* write_user_settings */
Example #7
0
static gboolean
log_db_parser_init(LogParser *s, GlobalConfig *cfg)
{
  LogDBParser *self = (LogDBParser *) s;

  if (self->initialized)
    {
      return TRUE;
    }
  self->initialized = TRUE;

  self->db = cfg_persist_config_fetch(cfg, log_db_parser_format_persist_name(self));
  if (self->db)
    {
      struct stat st;

      if (stat(self->db_file, &st) < 0)
        {
          msg_error("Error stating pattern database file, no automatic reload will be performed",
                    evt_tag_str("error", g_strerror(errno)),
                    NULL);
        }
      else
        {
          self->db_file_inode = st.st_ino;
          self->db_file_mtime = st.st_mtime;
        }
    }
  else
    {
      self->db = pattern_db_new();
      log_db_parser_reload_database(self);
    }

  if (self->db)
    pattern_db_set_emit_func(self->db, log_db_parser_emit, self);

#if GLIB_MAJOR_VERSION > 2 && GLIB_MINOR_VERSION > 13
  self->timer_tick_id = g_timeout_add_seconds(1, log_db_parser_timer_tick, self);
#else
  self->timer_tick_id = g_timeout_add(1000, log_db_parser_timer_tick, self);
#endif
  return self->db != NULL;
}
Example #8
0
gboolean
afsocket_dd_init(LogPipe *s)
{
  AFSocketDestDriver *self = (AFSocketDestDriver *) s;
  GlobalConfig *cfg = log_pipe_get_config(s);

#if ENABLE_SSL
  if (self->flags & AFSOCKET_REQUIRE_TLS && !self->tls_context)
    {
      msg_error("Transport TLS was specified, but TLS related parameters missing", NULL);
      return FALSE;
    }
#endif
  
  if (cfg)
    {
      self->time_reopen = cfg->time_reopen;
    }
    
  if (!self->writer)
    {
      log_writer_options_init(&self->writer_options, cfg, 0);
      /* NOTE: we open our writer with no fd, so we can send messages down there
       * even while the connection is not established */

      if ((self->flags & AFSOCKET_KEEP_ALIVE))
        self->writer = cfg_persist_config_fetch(cfg, afsocket_dd_format_persist_name(self, self->dest_name, FALSE), NULL, NULL);

      if (!self->writer)
        self->writer = log_writer_new(LW_FORMAT_PROTO | 
#if ENABLE_SSL
                                      (((self->flags & AFSOCKET_STREAM) && !self->tls_context) ? LW_DETECT_EOF : 0) | 
#else
                                      ((self->flags & AFSOCKET_STREAM) ? LW_DETECT_EOF : 0) | 
#endif
                                      (self->flags & AFSOCKET_SYSLOG_PROTOCOL ? LW_SYSLOG_PROTOCOL : 0));
      log_writer_set_options((LogWriter *) self->writer, &self->super.super, &self->writer_options, 0, afsocket_dd_stats_source(self), self->super.id, afsocket_dd_stats_instance(self));
      log_pipe_init(self->writer, NULL);
      log_pipe_append(&self->super.super, self->writer);
    }

  afsocket_dd_reconnect(self);
  return TRUE;
}
Example #9
0
static gboolean
_save_queue(QDisk *self, GQueue *q, gint64 *q_ofs, gint32 *q_len)
{
  LogMessage *msg;
  LogPathOptions path_options = LOG_PATH_OPTIONS_INIT;
  SerializeArchive *sa;
  GString *serialized;

  if (q->length == 0)
    {
      *q_ofs = 0;
      *q_len = 0;
      return TRUE;
    }

  serialized = g_string_sized_new(4096);
  sa = serialize_string_archive_new(serialized);
  while ((msg = g_queue_pop_head(q)))
    {

      /* NOTE: we might have some flow-controlled events on qout, when
       * saving them to disk, we ack them, they are restored as
       * non-flow-controlled entries later, but then we've saved them to
       * disk anyway. */

      POINTER_TO_LOG_PATH_OPTIONS(g_queue_pop_head(q), &path_options);
      log_msg_serialize(msg, sa); 
      log_msg_ack(msg, &path_options, AT_PROCESSED);
      log_msg_unref(msg);
    }
  serialize_archive_free(sa);
  *q_ofs = lseek(self->fd, 0, SEEK_END);
  if (!pwrite_strict(self->fd, serialized->str, serialized->len, *q_ofs))
    {
      msg_error("Error writing in-memory buffer of disk-queue to disk",
                evt_tag_str("filename", self->filename),
                evt_tag_errno("error", errno));
      g_string_free(serialized, TRUE);
      return FALSE;
    }
  *q_len = serialized->len;
  g_string_free(serialized, TRUE);
  return TRUE;
}
Example #10
0
std::istream& FlagTreeItem::read(std::istream &in)
{
    std::map<std::string, bool> parse_map;
    create_parse_map(this,parse_map);
    std::string token;
    while(in >> token)
    {
        if( parse_map.find(token) != parse_map.end() )
        {
            parse_map[token] = true;
        }
        else
            msg_error("DisplayFlags") << "FlagTreeItem: unknown token " << token;
    }
    if( in.rdstate() & std::ios_base::eofbit ) { in.clear(); }

    read_recursive(this,parse_map);
    return in;
}
Example #11
0
gint
cfg_ts_format_value(gchar *format)
{
  if (strcmp(format, "rfc3164") == 0 || strcmp(format, "bsd") == 0)
    return TS_FMT_BSD;
  else if (strcmp(format, "rfc3339") == 0 || strcmp(format, "iso") == 0)
    return TS_FMT_ISO;
  else if (strcmp(format, "full") == 0)
    return TS_FMT_FULL;
  else if (strcmp(format, "unix") == 0 || strcmp(format, "utc") == 0)
    return TS_FMT_UNIX;
  else
    {
      msg_error("Invalid ts_format() value",
                evt_tag_str("value", format),
                NULL);
      return TS_FMT_BSD;
    }
}
Example #12
0
File: cmds.c Project: hankem/jed
static void eob_bob_error (int f)
{
   char *str;

   if ((CBuf->buffer_hooks != NULL)
       && (CBuf->buffer_hooks->bob_eob_error_hook != NULL))
     {
	SLang_push_integer (f);
	SLexecute_function (CBuf->buffer_hooks->bob_eob_error_hook);
	return;
     }

   if (f < 0)
     str = Top_Of_Buffer_Error;
   else
     str = End_Of_Buffer_Error;

   msg_error (str);
}
Example #13
0
/**
 * afsql_dd_begin_txn:
 *
 * Commit SQL transaction.
 *
 * NOTE: This function can only be called from the database thread.
 **/
static gboolean
afsql_dd_commit_txn(AFSqlDestDriver *self)
{
  gboolean success;

  success = afsql_dd_run_query(self, "COMMIT", FALSE, NULL);
  if (success)
    {
      log_queue_ack_backlog(self->queue, self->flush_lines_queued);
      self->flush_lines_queued = 0;
    }
  else
    {
      msg_error("SQL transaction commit failed, rewinding backlog and starting again",
                NULL);
      afsql_dd_handle_transaction_error(self);
    }
  return success;
}
Example #14
0
static GString *
afsql_dd_ensure_accessible_database_table(AFSqlDestDriver *self, LogMessage *msg)
{
  GString *table = g_string_sized_new(32);

  log_template_format(self->table, msg, &self->template_options, LTZ_LOCAL, 0, NULL, table);

  if (!afsql_dd_validate_table(self, table))
    {
      /* If validate table is FALSE then close the connection and wait time_reopen time (next call) */
      msg_error("Error checking table, disconnecting from database, trying again shortly",
                evt_tag_int("time_reopen", self->time_reopen),
                NULL);
      g_string_free(table, TRUE);
      return NULL;
    }

  return table;
}
Example #15
0
static gboolean
log_db_parser_init(LogPipe *s)
{
  LogDBParser *self = (LogDBParser *) s;
  GlobalConfig *cfg = log_pipe_get_config(s);

  self->db = cfg_persist_config_fetch(cfg, log_db_parser_format_persist_name(self));
  if (self->db)
    {
      struct stat st;

      if (stat(self->db_file, &st) < 0)
        {
          msg_error("Error stating pattern database file, no automatic reload will be performed",
                    evt_tag_str("error", g_strerror(errno)),
                    NULL);
        }
      else if (self->db_file_inode != st.st_ino || self->db_file_mtime != st.st_mtime)
        {
          self->db = pattern_db_new();
          log_db_parser_reload_database(self);
          self->db_file_inode = st.st_ino;
          self->db_file_mtime = st.st_mtime;
        }
    }
  else
    {
      self->db = pattern_db_new();
      log_db_parser_reload_database(self);
    }
  if (self->db)
    pattern_db_set_emit_func(self->db, log_db_parser_emit, self);
  iv_validate_now();
  IV_TIMER_INIT(&self->tick);
  self->tick.cookie = self;
  self->tick.handler = log_db_parser_timer_tick;
  self->tick.expires = iv_now;
  self->tick.expires.tv_sec++;
  self->tick.expires.tv_nsec = 0;
  iv_timer_register(&self->tick);
  return self->db != NULL;
}
Example #16
0
static gboolean
afsocket_sd_setup_transport(AFSocketSourceDriver *self)
{
  GlobalConfig *cfg = log_pipe_get_config(&self->super.super.super);

  if (!transport_mapper_apply_transport(self->transport_mapper, cfg))
    return FALSE;

  self->proto_factory = log_proto_server_get_factory(cfg, self->transport_mapper->logproto);
  if (!self->proto_factory)
    {
      msg_error("Unknown value specified in the transport() option, no such LogProto plugin found",
                evt_tag_str("transport", self->transport_mapper->logproto),
                NULL);
      return FALSE;
    }

  afsocket_sd_setup_reader_options(self);
  return TRUE;
}
void HexahedronSetTopologyModifier::removeHexahedra(const sofa::helper::vector< unsigned int >& hexahedraIds)
{
    sofa::helper::vector<unsigned int> hexahedraIds_filtered;
    for (unsigned int i = 0; i < hexahedraIds.size(); i++)
    {
        if( hexahedraIds[i] >= m_container->getNumberOfHexahedra())
            msg_error() << "Unable to remove the hexahedra: "<< hexahedraIds[i] <<" its index is out of bound." ;
        else
            hexahedraIds_filtered.push_back(hexahedraIds[i]);
    }

    // add the topological changes in the queue
    removeHexahedraWarning(hexahedraIds_filtered);
    // inform other objects that the hexa are going to be removed
    propagateTopologicalChanges();
    // now destroy the old hexahedra.
    removeHexahedraProcess(hexahedraIds_filtered ,true);

    m_container->checkTopology();
}
Example #18
0
gboolean
resolve_hostname_to_sockaddr(GSockAddr **addr, gint family, const gchar *name)
{
  gboolean result;

  if (is_wildcard_hostname(name))
    return resolve_wildcard_hostname_to_sockaddr(addr, family, name);

#ifdef SYSLOG_NG_HAVE_GETADDRINFO
  result = resolve_hostname_to_sockaddr_using_getaddrinfo(addr, family, name);
#else
  result = resolve_hostname_to_sockaddr_using_gethostbyname(addr, family, name);
#endif
  if (!result)
    {
      msg_error("Error resolving hostname",
                evt_tag_str("host", name));
    }
  return result;
}
Example #19
0
int     main(int argc, char **argv)
{
    VSTRING *vp = vstring_alloc(256);

    msg_syslog_init(argv[0], LOG_PID, LOG_MAIL);
    if (argc < 2)
	msg_error("usage: %s text to be logged", argv[0]);
    while (--argc && *++argv) {
	vstring_strcat(vp, *argv);
	if (argv[1])
	    vstring_strcat(vp, " ");
    }
    msg_warn("static text");
    msg_warn("dynamic text: >%s<", vstring_str(vp));
    msg_warn("dynamic numeric: >%d<", 42);
    msg_warn("error text: >%m<");
    msg_warn("dynamic: >%s<: error: >%m<", vstring_str(vp));
    vstring_free(vp);
    return (0);
}
Example #20
0
TimeZoneInfo*
time_zone_info_new(const gchar *tz)
{
    TimeZoneInfo *self = g_new0(TimeZoneInfo,1);
    self->zone_offset = -1;

    /* if no time zone was specified return with an empty TimeZoneInfo pointer */
    if (!tz)
        return self;

    if ((*tz == '+' || *tz == '-') && strlen(tz) == 6 &&
            isdigit((int) *(tz+1)) && isdigit((int) *(tz+2)) &&
            (*(tz+3) == ':') && isdigit((int) *(tz+4)) &&
            isdigit((int) *(tz+5)))
    {
        /* timezone offset */
        gint sign = *tz == '-' ? -1 : 1;
        gint hours, mins;
        tz++;

        hours = (*tz - '0') * 10 + *(tz+1) - '0';
        mins = (*(tz+3) - '0') * 10 + *(tz+4) - '0';
        if ((hours < 24 && mins <= 60) || (hours == 24 && mins == 0))
        {
            self->zone_offset = sign * (hours * 3600 + mins * 60);
            return self;
        }
    }
    else if (zone_info_read(tz, &self->zone, &self->zone64))
    {
        return self;
    }

    time_zone_info_free(self);

    /* failed to read time zone data */
    msg_error("Bogus timezone spec, must be in the format [+-]HH:MM, offset must be less than 24:00",
              evt_tag_str("value", tz),
              NULL);
    return NULL;
}
Example #21
0
void mail_conf_checkdir(const char *config_dir)
{
    VSTRING *buf;
    VSTREAM *fp;
    char   *path;
    char   *name;
    char   *value;
    char   *cp;
    int     found = 0;

    /*
     * If running set-[ug]id, require that a non-default configuration
     * directory name is blessed as a bona fide configuration directory in
     * the default main.cf file.
     */
    path = concatenate(DEF_CONFIG_DIR, "/", "main.cf", (char *) 0);
    if ((fp = vstream_fopen(path, O_RDONLY, 0)) == 0)
	msg_fatal("open file %s: %m", path);

    buf = vstring_alloc(1);
    while (found == 0 && readlline(buf, fp, (int *) 0)) {
	if (split_nameval(vstring_str(buf), &name, &value) == 0
	    && (strcmp(name, VAR_CONFIG_DIRS) == 0
		|| strcmp(name, VAR_MULTI_CONF_DIRS) == 0)) {
	    while (found == 0 && (cp = mystrtok(&value, CHARS_COMMA_SP)) != 0)
		if (strcmp(cp, config_dir) == 0)
		    found = 1;
	}
    }
    if (vstream_fclose(fp))
	msg_fatal("read file %s: %m", path);
    vstring_free(buf);

    if (found == 0) {
	msg_error("unauthorized configuration directory name: %s", config_dir);
	msg_fatal("specify \"%s = %s\" or \"%s = %s\" in %s",
		  VAR_CONFIG_DIRS, config_dir,
		  VAR_MULTI_CONF_DIRS, config_dir, path);
    }
    myfree(path);
}
Example #22
0
static void trigger_server_accept_pass(int unused_event, char *context)
{
    const char *myname = "trigger_server_accept_pass";
    int     listen_fd = CAST_CHAR_PTR_TO_INT(context);
    int     time_left = 0;
    int     fd;

    if (msg_verbose)
	msg_info("%s: trigger arrived", myname);

    /*
     * Read a message from a socket. Be prepared for accept() to fail because
     * some other process already got the connection. The socket is
     * non-blocking so we won't get stuck when multiple processes wake up.
     * Don't get stuck when the client connects but sends no data. Restart
     * the idle timer if this was a false alarm.
     */
    if (var_idle_limit > 0)
	time_left = event_cancel_timer(trigger_server_timeout, (char *) 0);

    if (trigger_server_pre_accept)
	trigger_server_pre_accept(trigger_server_name, trigger_server_argv);
    fd = pass_accept(listen_fd);
    if (trigger_server_lock != 0
	&& myflock(vstream_fileno(trigger_server_lock), INTERNAL_LOCK,
		   MYFLOCK_OP_NONE) < 0)
	msg_fatal("select unlock: %m");
    if (fd < 0) {
	if (errno != EAGAIN)
	    msg_error("accept connection: %m");
	if (time_left >= 0)
	    event_request_timer(trigger_server_timeout, (char *) 0, time_left);
	return;
    }
    close_on_exec(fd, CLOSE_ON_EXEC);
    if (read_wait(fd, 10) == 0)
	trigger_server_wakeup(fd);
    else if (time_left >= 0)
	event_request_timer(trigger_server_timeout, (char *) 0, time_left);
    close(fd);
}
Example #23
0
static gboolean
log_source_group_deinit(LogPipe *s)
{
  LogSourceGroup *self = (LogSourceGroup *) s;
  LogDriver *p;
  gboolean success = TRUE;

  stats_unregister_counter(SCS_SOURCE | SCS_GROUP, self->name, NULL, SC_TYPE_PROCESSED, &self->processed_messages);
  for (p = self->drivers; p; p = p->drv_next)
    {
      if (!log_pipe_deinit(&p->super))
        {
          msg_error("Error deinitializing source driver",
                    evt_tag_str("source", self->name),
                    evt_tag_str("id", p->id),
                    NULL);
          success = FALSE;
	}
    }
  return success;
}
Example #24
0
int sound_rdhr( AppClass *ss )
{
   SoundStream *snd = (SoundStream *) ss;
   char signam[16];
   int i;

   if ( sound_init_soundCard(snd->sndParams) ) {
      msg_error(_("Can't initialize sound card"));
      return -1;
   }
   snd->wds = wavetable_get_cur_dataset(snd->wt); /* curent wds */
   
   dataset_var_add( snd->wds, "time", TIME, 1 );

   for ( i = 0; i < snd->ncols - 1 ; i++) {
      sprintf( signam, _("channel_%d"), i );
      dataset_var_add( snd->wds, signam, VOLTAGE, 1 );
   }

   return 1;
}
Example #25
0
static gboolean
afinter_sd_init(LogPipe *s)
{
  AFInterSourceDriver *self = (AFInterSourceDriver *) s;
  GlobalConfig *cfg = log_pipe_get_config(s);

  if (!log_src_driver_init_method(s))
    return FALSE;

  if (current_internal_source != NULL)
    {
      msg_error("Multiple internal() sources were detected, this is not possible", NULL);
      return FALSE;
    }

  log_source_options_init(&self->source_options, cfg, self->super.group);
  self->source = afinter_source_new(self, &self->source_options);
  log_pipe_append(&self->source->super, s);
  log_pipe_init(&self->source->super, cfg);
  return TRUE;
}
Example #26
0
File: cmds.c Project: hankem/jed
int delete_char_cmd (void)
{
   CHECK_READ_ONLY
#if 0
     ;
#endif

#if JED_HAS_LINE_ATTRIBUTES
   if (check_line_attr_no_modify (CLine))
     return 0;
#endif

   if (eobp())
     {
	msg_error(End_Of_Buffer_Error);
	return(0);
     }

   (void) jed_del_wchar ();
   return 1;
}
Example #27
0
static gboolean
perl_worker_init(LogPipe *d)
{
  PerlDestDriver *self = (PerlDestDriver *)d;
  GlobalConfig *cfg = log_pipe_get_config(d);

  if (!self->filename)
    {
      msg_error("Error initializing Perl destination: no script specified!",
                evt_tag_str("driver", self->super.super.super.id),
                NULL);
      return FALSE;
    }

  if (!log_dest_driver_init_method(d))
    return FALSE;

  log_template_options_init(&self->template_options, cfg);

  return log_threaded_dest_driver_start(d);
}
Example #28
0
int
stomp_write(stomp_connection *connection, stomp_frame *frame)
{
  GString *data;

  if (!stomp_check_for_frame(connection))
    return FALSE;

  data = create_gstring_from_frame(frame);
  if (!write_gstring_to_socket(connection->socket, data))
    {
      msg_error("Write error, partial write", NULL);
      stomp_frame_deinit(frame);
      g_string_free(data, TRUE);
      return FALSE;
    }

  g_string_free(data, TRUE);
  stomp_frame_deinit(frame);
  return TRUE;
}
static gint
log_proto_record_server_read_data(LogProtoBufferedServer *s, guchar *buf, gsize len, LogTransportAuxData *aux)
{
  LogProtoRecordServer *self = (LogProtoRecordServer *) s;
  gint rc;

  /* assert that we have enough space in the buffer to read record_size bytes */
  g_assert(len >= self->record_size);
  len = self->record_size;
  rc = log_transport_read(self->super.super.transport, buf, len, aux);
  if (rc > 0 && rc != self->record_size)
    {
      msg_error("Record size was set, and couldn't read enough bytes",
                evt_tag_int(EVT_TAG_FD, self->super.super.transport->fd),
                evt_tag_int("record_size", self->record_size),
                evt_tag_int("read", rc));
      errno = EIO;
      return -1;
    }
  return rc;
}
Example #30
0
int GUIManager::Init(const char* argv0, const char* name)
{
    BaseGUI::SetProgramName(argv0);
    BaseGUI::SetArgumentParser(currentArgumentParser);
    sofa::simulation::common::init();

    static bool first = true;
    if (first)
    {
        sofa::component::initComponentBase();
        sofa::component::initComponentCommon();
        sofa::component::initComponentGeneral();
        sofa::component::initComponentAdvanced();
        sofa::component::initComponentMisc();

        first = false;
    }

    if (currentGUI)
        return 0; // already initialized

    if (guiCreators.empty())
    {
        msg_error("GUIManager") << "No GUI registered.";
        return 1;
    }

    if( name == NULL || strcmp(name,"") == 0 )
    {
        name = GetValidGUIName(); // get the default gui name
    }
    GUICreator *creator = GetGUICreator(name);
    if(!creator)
    {
        return 1;
    }
    valid_guiname = name; // at this point we must have a valid name for the gui.

    return 0;
}