예제 #1
0
static void
command_args_expand (GbBeautifierWorkbenchAddin *self,
                     GPtrArray                  *args,
                     ProcessState               *state)
{
  g_autofree gchar *src_path = NULL;
  g_autofree gchar *config_path = NULL;
  gchar **arg_adr;
  gchar *new_arg;
  gboolean has_config = TRUE;

  src_path = g_file_get_path (state->src_file);
  if (G_IS_FILE (state->config_file))
    config_path = g_file_get_path (state->config_file);
  else
    has_config = FALSE;

  for (gint i = 0; g_ptr_array_index (args, i) != NULL; ++i)
    {
      arg_adr = (gchar **)&g_ptr_array_index (args, i);
      if (NULL != (new_arg = match_and_replace (*arg_adr, "@s@", src_path)))
        {
          g_free (*arg_adr);
          *arg_adr = new_arg;
        }
      else if (has_config &&
               NULL != (new_arg = match_and_replace (*arg_adr, "@c@", config_path)))
        {
          g_free (*arg_adr);
          *arg_adr = new_arg;
        }
    }
}
예제 #2
0
/*
   int			process(char *line)
   {

   return (0);
   }

   int			readfile(char *filename)
   {
   char	*line;
   FILE	*file = NULL;

   file = fopen(filename, "r");
   if (file != NULL)
   {
   line = (char *)malloc(1024);
   while (42)
   {
   if (fgets(line, 1024, file))
   process(line);
   else
   break ;
   }
   fclose(file);
   }
   return (0);
   }
   */
int		main(int argc, char **argv)
{
	//	readfile(argv[1]);
	match_and_replace(5000);
	return (0);
}