The toplist.c example shows how you can use toplist functions. It is part of the spshell program
#include <string.h>
#include "spshell.h"
#include "cmd.h"
static void print_album(
int index,
sp_album *album)
{
printf(
" Album %3d: \"%s\" by \"%s\"\n", index,
sp_album_name(album),
}
static void print_artist(
int index,
sp_artist *artist)
{
char url[200];
if(l != NULL) {
printf(" Portrait: %s\n", url);
}
}
{
int i;
printf("%3d: ", i + 1);
}
cmd_done();
}
static void toplist_usage(void)
{
fprintf(stderr, "Usage: toplist (tracks | albums | artists) (global | region <countrycode> | user)\n");
}
int cmd_toplist(int argc, char **argv)
{
if(argc < 3) {
toplist_usage();
return -1;
}
if(!strcasecmp(argv[1], "artists"))
else if(!strcasecmp(argv[1], "albums"))
else if(!strcasecmp(argv[1], "tracks"))
else {
toplist_usage();
return -1;
}
if(!strcasecmp(argv[2], "global"))
else if(!strcasecmp(argv[2], "user"))
else if(!strcasecmp(argv[2], "region")) {
if(argc != 4 || strlen(argv[3]) != 2) {
toplist_usage();
return -1;
}
} else {
toplist_usage();
return -1;
}
return 0;
}