diff options
author | ache <ache@ache.one> | 2017-07-17 00:24:08 +0200 |
---|---|---|
committer | ache <ache@ache.one> | 2017-07-17 00:24:08 +0200 |
commit | 242be95344b62ee1f64c205d8046b9e96b5241e6 (patch) | |
tree | 9a94f939cedc005d018f5d15f639c9ac427d3b77 | |
parent | New files (diff) |
New main
-rwxr-xr-x | main.c (renamed from h.c) | 46 | ||||
-rw-r--r-- | main.h | 31 |
2 files changed, 76 insertions, 1 deletions
@@ -49,7 +49,7 @@ void fail_exit(const char *msg) { } - +void edit_rl(menuC* menu,void func(TagLib_Tag *, const char*), int c); void edit_rl(menuC* menu,void func(TagLib_Tag *, const char*), int c) { status[1]=c; @@ -81,6 +81,50 @@ void edit_rl(menuC* menu,void func(TagLib_Tag *, const char*), int c) { } int main(int argc, char* argv[]){ + + while (1) { + int c; + int optIndex = 0; + static struct option optlv[] = { + {"help", no_argument, 0, 'h' }, + {"version", no_argument, 0, 'v' }, + {"dir", required_argument, 0, 'd' }, + {NULL, 0, 0, 0 } + }; + + + c = getopt_long(argc, argv, "hvd:", optlv, &optIndex); + if (c == -1) + break; + + switch (c) { + case 'v': + if( !strcmp(optlv[optIndex].name, "version") ) { + puts( VERSION_METAG ); + } + break; + + case 'h': + puts( HELP_STRING_METAG ); + return EXIT_SUCCESS; + + break; + case 'c': + if( optarg ) { + + } else { + fprintf(stderr, "Veuillez indiquer un directory\n"); + } + break; + case '?': + default: + return EXIT_FAILURE; + } + } + + + + itemC* menuL = NULL; int size = 0; int c; @@ -16,6 +16,7 @@ #include <string.h> #include <ctype.h> #include <ncurses.h> +#include <getopt.h> #include <taglib/tag_c.h> @@ -74,6 +75,36 @@ void fail_exit(const char *msg); _a > _b ? _a : _b; }) +#define VERSION_METAG "Alpha" +#define HELP_STRING_METAG "Utilisation : metag [OPTION]...\n" \ + "Editeur de tag mp3" \ + "Options :\n" \ + "\t\t--help -h Affiche l'aide simple\n" \ + "\t\t--version -v Affiche la version\n" \ + "\t\t--dir -d Change le répertoire de travail\n"\ + "\n" \ + "Basic control :\n" \ + " 'e%' - edit % where % can be :\n" \ + " t for title | a for artist | b for album | g for genre" \ + " y for year | y for comment | n for track number" \ + "" \ + " 'q' to exit" \ + "" \ + " 's' select by regex" \ + "" \ + " 'x' extract information from the title by regex" \ + "" \ + " ' ' toggle selection of the current item" \ + "" \ + " 'k' selection up" \ + " 'j' selection down" \ + "" + + + + + + #endif |