mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	Expanding shell variables, including tilde, enables the following type
of keybind:
<keyboard>
    <keybind key="XF86AudioMute">
      <action name="Execute">
        <command>bash ~/mute-script.sh</command>
      </action>
    </keybind>
</keyboard>
Fixes issue #32
		
	
			
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			723 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			723 B
		
	
	
	
		
			C
		
	
	
	
	
	
/*
 | 
						|
 * Very simple C string buffer implementation
 | 
						|
 *
 | 
						|
 * Copyright Johan Malm 2020
 | 
						|
 */
 | 
						|
 | 
						|
#ifndef __LABWC_BUF_H
 | 
						|
#define __LABWC_BUF_H
 | 
						|
 | 
						|
#include <stdio.h>
 | 
						|
#include <stdlib.h>
 | 
						|
#include <string.h>
 | 
						|
 | 
						|
struct buf {
 | 
						|
	char *buf;
 | 
						|
	int alloc;
 | 
						|
	int len;
 | 
						|
};
 | 
						|
 | 
						|
/**
 | 
						|
 * buf_expand_shell_variables - expand $foo and ~ in buffer
 | 
						|
 * @s: buffer
 | 
						|
 * Note: ${foo} and $$ are not handled
 | 
						|
 */
 | 
						|
void buf_expand_shell_variables(struct buf *s);
 | 
						|
 | 
						|
/**
 | 
						|
 * buf_init - allocate NULL-terminated C string buffer
 | 
						|
 * @s: buffer
 | 
						|
 * Note: use free(s->buf) to free it.
 | 
						|
 */
 | 
						|
void buf_init(struct buf *s);
 | 
						|
 | 
						|
/**
 | 
						|
 * buf_add - add data to C string buffer
 | 
						|
 * @s: buffer
 | 
						|
 * @data: data to be added
 | 
						|
 */
 | 
						|
void buf_add(struct buf *s, const char *data);
 | 
						|
 | 
						|
#endif /* __LABWC_BUF_H */
 |