74 lines
1.6 KiB
C
74 lines
1.6 KiB
C
/*
|
|
mp3fw.c - mp3 player firmware
|
|
|
|
This file is part of mp3fw.
|
|
|
|
mp3fw 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 3 of the License, or (at your
|
|
option) any later version.
|
|
|
|
mp3fw 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 mp3fw. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "common.h"
|
|
|
|
static void
|
|
usage(int argc, char *argv[])
|
|
{
|
|
printf("%s - play audio files\n", argv[0]);
|
|
printf("usage: %s [-h] [-v] [-p] FILE\n", argv[0]);
|
|
printf("\n");
|
|
printf("%s {-h} Show this message\n", argv[0]);
|
|
printf("%s {-v} Show the current version\n", argv[0]);
|
|
printf("%s {-p} FILE Play an audio file\n", argv[0]);
|
|
printf("\n");
|
|
printf("mp3fw is free software.\n");
|
|
printf("See the GNU GPL version 3 for details.\n");
|
|
}
|
|
|
|
static void
|
|
usage_small(int argc, char *argv[])
|
|
{
|
|
printf("usage: %s [-h] [-v] [-p] FILE\n", argv[0]);
|
|
}
|
|
|
|
int
|
|
main(int argc, char *argv[])
|
|
{
|
|
|
|
if (argc < 2) {
|
|
usage_small(argc, argv);
|
|
exit(1);
|
|
}
|
|
|
|
int opt;
|
|
|
|
while ((opt = getopt(argc, argv, ":if:hvp")) != -1) {
|
|
switch(opt) {
|
|
case 'h':
|
|
usage(argc, argv);
|
|
exit(0);
|
|
break;
|
|
case 'v':
|
|
printf(MP3FW_VERSION "\n");
|
|
exit(0);
|
|
break;
|
|
case 'p':
|
|
mp3fw_playfile(argc, argv);
|
|
exit(0);
|
|
break;
|
|
case '?':
|
|
usage_small(argc, argv);
|
|
exit(1);
|
|
break;
|
|
}
|
|
}
|
|
}
|