bl/spawn.c
changeset 6 faab25d520dd
parent 5 f600b0d1fc5d
child 7 721e468c10f3
     1.1 --- a/bl/spawn.c	Fri Jan 27 10:30:16 2012 +0000
     1.2 +++ b/bl/spawn.c	Fri Jan 27 16:18:02 2012 +0000
     1.3 @@ -7,10 +7,10 @@
     1.4  
     1.5  #define SPAWN_BUFSIZE	128
     1.6  
     1.7 -boolean spawn_sync(char **argv,char **standard_output,int *exit_status)
     1.8 +gboolean spawn_sync(char **argv,char **standard_output,int *exit_status)
     1.9  {
    1.10  /* Don't use g_spawn_sync on WIN32 for now to avoid needing the helper */
    1.11 -#if HAVE_GLIB && !defined(WIN32)
    1.12 +#ifndef WIN32
    1.13      char *standard_error;
    1.14      GError *error=NULL;
    1.15      gboolean retval;
    1.16 @@ -33,41 +33,41 @@
    1.17      FILE *fp;
    1.18      int i,r;
    1.19      size_t n,len;
    1.20 -    String *command_line,*string;
    1.21 -    command_line=string_new(NULL);
    1.22 +    GString *command_line,*string;
    1.23 +    command_line=g_string_new(NULL);
    1.24      for(i=0;argv[i];i++)
    1.25      {
    1.26  	if (i)
    1.27 -	    string_append_c(command_line,' ');
    1.28 -	string_append(command_line,argv[i]);
    1.29 +	    g_string_append_c(command_line,' ');
    1.30 +	g_string_append(command_line,argv[i]);
    1.31      }
    1.32      fp=popen(command_line->str,"r");
    1.33 -    string_free(command_line,TRUE);
    1.34 +    g_string_free(command_line,TRUE);
    1.35      if (!fp)
    1.36      {
    1.37  	perror(command_line->str);
    1.38  	return FALSE;
    1.39      }
    1.40 -    string=string_new(NULL);
    1.41 +    string=g_string_new(NULL);
    1.42      do
    1.43      {
    1.44  	len=string->len;
    1.45 -	string_set_size(string,len+SPAWN_BUFSIZE);
    1.46 +	g_string_set_size(string,len+SPAWN_BUFSIZE);
    1.47  	n=fread(string->str+len,1,SPAWN_BUFSIZE,fp);
    1.48  	if (n<0)
    1.49  	{
    1.50  	    perror("fread");
    1.51  	    (void)pclose(fp);
    1.52 -	    string_free(string,TRUE);
    1.53 +	    g_string_free(string,TRUE);
    1.54  	    return FALSE;
    1.55  	}
    1.56 -	string_set_size(string,len+n);
    1.57 +	g_string_set_size(string,len+n);
    1.58      } while(n);
    1.59      r=pclose(fp);
    1.60      if (r<0)
    1.61      {
    1.62  	perror("pclose");
    1.63 -	string_free(string,TRUE);
    1.64 +	g_string_free(string,TRUE);
    1.65  	return FALSE;
    1.66      }
    1.67      else
    1.68 @@ -75,9 +75,9 @@
    1.69  	if (exit_status)
    1.70  	    *exit_status=r;
    1.71  	if (standard_output)
    1.72 -	    *standard_output=string_free(string,FALSE);
    1.73 +	    *standard_output=g_string_free(string,FALSE);
    1.74  	else
    1.75 -	    string_free(string,TRUE);
    1.76 +	    g_string_free(string,TRUE);
    1.77  	return TRUE;
    1.78      }
    1.79  #endif