[desktop-discuss] Re: Trouble compiling gnome-cups-manager 0.32

David Clack david.clack at sun.com
Thu Jan 11 13:46:25 PST 2007


Very cool, you nailed it

This is how I changed the code, works great, Thanks

static GSList *
get_cups_backend_devices (const char *backend)
{
	char *argv[2], *path, *stdout1, *inptr;
	LocalPrinter *desc;
	GSList *ret = NULL;
	
	path = g_alloca (sizeof (CUPS_BACKENDS_DIR) + sizeof (G_DIR_SEPARATOR_S) + strlen (backend) + 1);
	sprintf (path, "%s%s%s", CUPS_BACKENDS_DIR, G_DIR_SEPARATOR_S, backend); 
	
	argv[0] = path;
	argv[1] = NULL;
	
	if (!g_spawn_sync (NULL, argv, NULL, G_SPAWN_STDERR_TO_DEV_NULL,
			   NULL, NULL, &stdout1, NULL, NULL, NULL))
		return NULL; 
	
	inptr = stdout;
	while ((desc = parse_cups_backend_device_list (&inptr))) {
		if (!strcmp (backend, "hal") && !strcmp (desc->uri, "hal")) {
			
			local_printer_free (desc);
			break;
		} else if (!strcmp (backend, "usb") && !strncmp (desc->uri, "usb:/dev", 8)) {
			
			local_printer_free (desc);
			break;
		} 
		
		ret = g_slist_prepend (ret, desc);
	}
	
	g_free (stdout1);
	
	return ret;
}
 
 
This message posted from opensolaris.org



More information about the desktop-discuss mailing list