Skip to content
Extraits de code Groupes Projets
Vérifiée Valider b3efe604 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

Clean comments in lkt.c

parent f1246cd9
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!64Resolve "Installation"
......@@ -51,32 +51,6 @@ help(void)
"RANGE:\n"
" A range is specified like BEGIN:END which implies from BEGIN to END included\n"
"\n";
/*
" QUEUE COMMANDS:\n"
" pos <arg> the qrgument can be a position or a range.\n"
" <count> prints the next songs in the queue.\n"
" pop [pos] pop a song in the queue.\n"
" add <query> add a kara to the queue with a query.\n"
" seek <query> seek the next song that matchs the query.\n"
" delete <id> delete the song by its id in the queue.\n"
" clear clear the queue.\n"
" crop crop the queue.\n"
"\n"
" PLAYLIST COMMANDS:\n"
" create <plt> creates a playlist after the argument.\n"
" destroy <plt> delete a playlist after the argument.\n"
" add <plt> <type> <query> add something to a playlist from the database.\n"
" delete <plt> <id> delete domething from a playlist.\n"
"\n"
" SEARCH COMMANDS:\n"
" get <query> prints the results of the query.\n"
" add <query> add to the queue and prints the results of the query.\n"
" insert <query> insert on top of the aueue and prints the results of the query.\n"
" plt <plt> <query> search inside a playlist and prints the results.\n"
" count <query> count the number of songs that matches the query.\n"
" queue <query> prints kara that matches from the queue.\n"
"\n"
*/
write(1, help_str, strlen(help_str));
exit(EXIT_SUCCESS);
}
......@@ -408,7 +382,7 @@ noreturn void
queue_pop__(struct lkt_cmd_args *args)
{
if (args->argc != 0)
fail("Invalid argument, the status command takes no arguments");
fail("Invalid argument, the pop command takes no arguments");
int ret = EXIT_FAILURE, songid = 0;
char buff[LKT_MESSAGE_MAX];
......@@ -536,7 +510,7 @@ noreturn void
queue_delete__(struct lkt_cmd_args *args)
{
if (args->argc != 1)
fail("Invalid argument, need onlt one argument");
fail("Invalid argument, need onlt one argument: queue delete <id>");
static const char *cmd_id__ = "deleteid %d\nclose\n";
int dumy = 0;
......@@ -566,7 +540,7 @@ queue_add__(struct lkt_cmd_args *args)
int i;
if (args->argc < 1)
fail("Invalid argument, the add command should takes at least two arguments");
fail("Invalid argument, the add command should takes at least two arguments: queue add <query>");
if (!lkt_valid_type(args->argv[0]))
fail("Invalid argument, the type given to the add command is invalid");
......@@ -602,7 +576,7 @@ noreturn void
queue_seek__(struct lkt_cmd_args *args)
{
if (args->argc != 1)
fail("The seek command needs one argument");
fail("The seek command needs one argument: queue seek <id>");
char *endptr, buf[3];
long id = strtol(args->argv[0], &endptr, 0);
......@@ -627,14 +601,14 @@ queue_pos__(struct lkt_cmd_args *args)
char buff[LKT_MESSAGE_MAX], *endptr;
if (args->argc != 1)
fail("Invalid argument for the pos command");
fail("Invalid argument for the pos command: queue pos <arg> where arg is a position or a range");
long continuation = 0, up = 0;
continuation = strtol(args->argv[0], &endptr, 0);
if ((errno == ERANGE && (continuation == LONG_MAX || continuation == LONG_MIN)) || (errno != 0
&& continuation == 0) || (endptr == args->argv[0]))
fail("Invalid argument, not an integer");
fail("Invalid argument, not an integer: queue pos <arg> where arg is a position or a range");
if (*endptr != '\0') {
/* A range */
......@@ -685,7 +659,7 @@ queue_list__(struct lkt_cmd_args *args)
if (args->argc == 0)
args->argv = LKT_QUEUE_DEFAULT;
else if (args->argc != 1)
fail("Invalid argument");
fail("Invalid argument: queue <count?>");
continuation = strtol(args->argv[0], &endptr, 0);
if ((errno == ERANGE && (continuation == LONG_MAX || continuation == LONG_MIN)) || (errno != 0
......@@ -740,7 +714,7 @@ plt_add__(struct lkt_cmd_args *args)
FILE *sock = lkt_connect();
if (args->argc < 3)
fail("Invalid argument, need at least three arguments");
fail("Invalid argument, need at least three arguments: plt add <plt> <query>");
if (!lkt_valid_type(args->argv[1]))
fail("Invalid argument, type for the query is invalid");
......@@ -775,7 +749,7 @@ plt_delete__(struct lkt_cmd_args *args)
int i;
if (args->argc < 1)
fail("Invalid argument, need at least two arguments");
fail("Invalid argument, need at least two arguments: plt delete <plt> <id>");
write_socket(sock, "playlistdelete ", strlen("playlistdelete "));
write_socket(sock, args->argv[0], strlen(args->argv[0]));
......@@ -801,7 +775,7 @@ noreturn void
plt_destroy__(struct lkt_cmd_args *args)
{
if (args->argc != 1)
fail("Invalid argument, you may only specify the name of the playlist to delete");
fail("Invalid argument, you may only specify the name of the playlist to delete: plt destroy <plt>");
FILE *sock = lkt_connect();
char buff[2];
......@@ -822,7 +796,7 @@ noreturn void
plt_create__(struct lkt_cmd_args *args)
{
if (args->argc != 1)
fail("Invalid argument, you may only specify the name of the playlist to create");
fail("Invalid argument, you may only specify the name of the playlist to create: plt create <plt>");
FILE *sock = lkt_connect();
char buff[2];
......@@ -845,7 +819,7 @@ noreturn void
search_with_cmd__(struct lkt_cmd_args *args, const char *cmd)
{
if (args->argc < 2)
fail("Invalid number of arguments, need at least a valid query");
fail("Invalid number of arguments, need at least a valid query: search <action> <plt when action == plt> <query>");
if (!lkt_valid_type(args->argv[0]))
fail("Invalid type for the query");
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter