[Mplayer-cvslog] CVS: main/input input.c,1.8,1.9
Alban Bedel CVS
albeu at mplayer.dev.hu
Wed Feb 20 15:45:25 CET 2002
Update of /cvsroot/mplayer/main/input
In directory mplayer:/var/tmp.root/cvs-serv13184/input
Modified Files:
input.c
Log Message:
Added comments support in input.conf (comments lines with #)
And fixed a possible bug
Index: input.c
===================================================================
RCS file: /cvsroot/mplayer/main/input/input.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- input.c 17 Feb 2002 01:06:50 -0000 1.8
+++ input.c 20 Feb 2002 14:45:18 -0000 1.9
@@ -555,6 +555,9 @@
n++;
}
+ if(num_key_fd == 0)
+ return NULL;
+
if(time >= 0 ) {
tv.tv_sec=time/1000;
tv.tv_usec = (time%1000)*1000;
@@ -701,6 +704,9 @@
n++;
}
+ if(num_cmd_fd == 0)
+ return NULL;
+
if(time >= 0) {
tv.tv_sec=time/1000;
tv.tv_usec = (time%1000)*1000;
@@ -885,7 +891,7 @@
static int
mp_input_parse_config(char *file) {
int fd;
- int bs = 0,r,eof = 0;
+ int bs = 0,r,eof = 0,comments = 0;
char *iter,*end;
char buffer[BS_MAX];
int n_binds = 0, keys[MP_MAX_KEY_DOWN+1] = { 0 };
@@ -927,6 +933,23 @@
iter = buffer;
+ if(comments) {
+ for( ; iter[0] != '\0' && iter[0] != '\n' ; iter++)
+ /* NOTHING */;
+ if(iter[0] == '\0') { // Buffer was full of comment
+ bs = 0;
+ continue;
+ }
+ iter++;
+ r = strlen(iter);
+ if(r)
+ memmove(buffer,iter,r+1);
+ bs = r+1;
+ if(iter[0] != '#')
+ comments = 0;
+ continue;
+ }
+
// Find the wanted key
if(keys[0] == 0) {
// Jump beginnig space
@@ -934,6 +957,10 @@
/* NOTHING */;
if(iter[0] == '\0') { // Buffer was full of space char
bs = 0;
+ continue;
+ }
+ if(iter[0] == '#') { // Comments
+ comments = 1;
continue;
}
// Find the end of the key code name
More information about the MPlayer-cvslog
mailing list