aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-04-19 22:10:13 +0000
committerKalle Wallin <kaw@linux.se>2004-04-19 22:10:13 +0000
commit230b0fe73ac3a07293d495e895207b43cdfb3369 (patch)
treed24f5d8f3155948e13800ee3369808279b23a92b
parentbf28b56f26bb5753c706e2e249265f95b500fd78 (diff)
downloadmpd-230b0fe73ac3a07293d495e895207b43cdfb3369.tar.gz
mpd-230b0fe73ac3a07293d495e895207b43cdfb3369.tar.xz
mpd-230b0fe73ac3a07293d495e895207b43cdfb3369.zip
Added copyright notice and license notice
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@833 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r--command.c68
-rw-r--r--conf.c43
-rw-r--r--list_window.c18
-rw-r--r--main.c18
-rw-r--r--options.c18
-rw-r--r--screen_utils.c18
-rw-r--r--support.c18
7 files changed, 181 insertions, 20 deletions
diff --git a/command.c b/command.c
index 15ebd502a..75dd75ee9 100644
--- a/command.c
+++ b/command.c
@@ -1,3 +1,21 @@
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@@ -80,9 +98,9 @@ static command_definition_t cmds[] =
{ { DWN, '.', 0 }, CMD_LIST_NEXT, "down",
"Move cursor down" },
{ { HOME, 0x01, 0 }, CMD_LIST_FIRST, "home",
- "Home" },
+ "Home " },
{ { END, 0x05, 0 }, CMD_LIST_LAST, "end",
- "End" },
+ "End " },
{ { PGUP, 'A', 0 }, CMD_LIST_PREVIOUS_PAGE, "pgup",
"Page up" },
{ { PGDN, 'B', 0 }, CMD_LIST_NEXT_PAGE, "pgdn",
@@ -111,6 +129,10 @@ static command_definition_t cmds[] =
"Browse screen" },
{ {'u', 0, 0 }, CMD_SCREEN_UPDATE, "update",
"Update screen" },
+#ifdef ENABLE_KEYDEF_SCREEN
+ { {'K', 0, 0 }, CMD_SCREEN_KEYDEF, "screen-keyedit",
+ "Key edit screen" },
+#endif
{ { 'q', 0, 0 }, CMD_QUIT, "quit",
"Quit " PACKAGE },
@@ -118,10 +140,17 @@ static command_definition_t cmds[] =
{ { -1, -1, -1 }, CMD_NONE, NULL, NULL }
};
+command_definition_t *
+get_command_definitions(void)
+{
+ return cmds;
+}
+
char *
key2str(int key)
{
- static char buf[2];
+ static char buf[4];
+ int i;
buf[0] = 0;
switch(key)
@@ -158,20 +187,16 @@ key2str(int key)
return "Shift+Tab";
case ESC:
return "Esc";
- case F1:
- return "F1";
- case F2:
- return "F2";
- case F3:
- return "F3";
- case F4:
- return "F4";
- case F5:
- return "F5";
- case F6:
- return "F6";
+ case KEY_IC:
+ return "Insert";
default:
- snprintf(buf, 2, "%c", key);
+ for(i=0; i<=63; i++)
+ if( key==KEY_F(i) )
+ {
+ snprintf(buf, 4, "F%d", i );
+ return buf;
+ }
+ snprintf(buf, 4, "%c", key);
}
return buf;
}
@@ -265,13 +290,14 @@ get_key_command_from_name(char *name)
return CMD_NONE;
}
+
command_t
-get_key_command(int key)
+find_key_command(int key, command_definition_t *cmds)
{
int i;
i=0;
- while( cmds[i].name )
+ while( cmds && cmds[i].name )
{
if( cmds[i].keys[0] == key ||
cmds[i].keys[1] == key ||
@@ -282,6 +308,12 @@ get_key_command(int key)
return CMD_NONE;
}
+command_t
+get_key_command(int key)
+{
+ return find_key_command(key, cmds);
+}
+
command_t
get_keyboard_command(void)
diff --git a/conf.c b/conf.c
index a8deb89a3..0c0448ed4 100644
--- a/conf.c
+++ b/conf.c
@@ -1,3 +1,21 @@
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
@@ -384,6 +402,28 @@ read_rc_file(char *filename, options_t *options)
return 0;
}
+int
+check_user_conf_dir(void)
+{
+ int retval;
+ char *dirname = g_build_filename(g_get_home_dir(), "." PACKAGE, NULL);
+
+ if( g_file_test(dirname, G_FILE_TEST_IS_DIR) )
+ {
+ g_free(dirname);
+ return 0;
+ }
+ retval = mkdir(dirname, 0755);
+ g_free(dirname);
+ return retval;
+}
+
+char *
+get_user_key_binding_filename(void)
+{
+ return g_build_filename(g_get_home_dir(), "." PACKAGE, "keys", NULL);
+}
+
int
read_configuration(options_t *options)
@@ -418,7 +458,7 @@ read_configuration(options_t *options)
}
/* check for user key bindings ~/.ncmpc/keys */
- filename = g_build_filename(g_get_home_dir(), "." PACKAGE, "keys", NULL);
+ filename = get_user_key_binding_filename();
if( !g_file_test(filename, G_FILE_TEST_IS_REGULAR) )
{
g_free(filename);
@@ -442,7 +482,6 @@ read_configuration(options_t *options)
read_rc_file(filename, options);
g_free(filename);
filename = NULL;
- //write_key_bindings(stderr);
}
return 0;
diff --git a/list_window.c b/list_window.c
index 5a07f603f..fcb25ca31 100644
--- a/list_window.c
+++ b/list_window.c
@@ -1,3 +1,21 @@
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
diff --git a/main.c b/main.c
index cfa1151d9..07a623b8d 100644
--- a/main.c
+++ b/main.c
@@ -1,3 +1,21 @@
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/options.c b/options.c
index 81f67bd87..16a61ece0 100644
--- a/options.c
+++ b/options.c
@@ -1,3 +1,21 @@
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/screen_utils.c b/screen_utils.c
index b93069c22..c9fff74c4 100644
--- a/screen_utils.c
+++ b/screen_utils.c
@@ -1,3 +1,21 @@
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
diff --git a/support.c b/support.c
index 564fd9b83..d292e8462 100644
--- a/support.c
+++ b/support.c
@@ -1,3 +1,21 @@
+/*
+ * (c) 2004 by Kalle Wallin (kaw@linux.se)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>