mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	IPC_COMMAND: split on newline
This splits commands given in IPC_COMMAND on newline to match i3's behavior.
This commit is contained in:
		
							parent
							
								
									478b128c26
								
							
						
					
					
						commit
						288e35f99e
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -595,6 +595,16 @@ void ipc_client_handle_command(struct ipc_client *client) {
 | 
			
		|||
	switch (client->current_command) {
 | 
			
		||||
	case IPC_COMMAND:
 | 
			
		||||
	{
 | 
			
		||||
		char *line = strtok(buf, "\n");
 | 
			
		||||
		while (line) {
 | 
			
		||||
			size_t line_length = strlen(line);
 | 
			
		||||
			if (line + line_length >= buf + client->payload_length) {
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
			line[line_length] = ';';
 | 
			
		||||
			line = strtok(NULL, "\n");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		list_t *res_list = execute_command(buf, NULL, NULL);
 | 
			
		||||
		transaction_commit_dirty();
 | 
			
		||||
		char *json = cmd_results_to_json(res_list);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue