summarylogtreecommitdiffstats
path: root/mp3rename-jf-long-options.patch
blob: dcb8c420879f84c43e23461ba6616dfa2028d008 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
--- a/mp3rename.c
+++ b/mp3rename.c
@@ -15,6 +15,7 @@
 #include <ctype.h>
 #include <string.h>
 #include <signal.h>
+#include <getopt.h>
 
 void pad(char *string, int length);
 void display_help();
@@ -37,14 +38,34 @@
   
   if (argc < 2 ) /* If nothing is given */
   {
-    fprintf(stderr,"Mp3rename\n\nusage: [-vfhsbia] [file ...]\n\nUse 'mp3rename -h' for a usage summary\n\n");
+    fprintf(stderr,"Mp3rename\n\nusage: [-vfhsbia] [file ...]\n\nUse 'mp3rename --help' for a usage summary\n\n");
 
     return 0;
   }
   
   /* Lets checkout the options */
 
-  while ((ch = getopt(argc, argv, "vfhsbiap")) != -1)
+  while (1) {
+                   int this_option_optind = optind ? optind : 1;
+                   int option_index = 0;
+                   static struct option long_options[] = {
+                       {"ask", 0, 0, 'a'},
+                       {"padding", 0, 0, 'p'},
+                       {"burn", 0, 0, 'b'},
+                       {"source-look", 1, 0, 's'},
+                       {"help", 0, 0, 'h'},
+                       {"verbose",0, NULL, 'v'},
+                       {"create", 0, 0, 'c'},
+                       {"force", 0, 0, 'f'},
+                       {"info", 0, 0, 'i'},
+                       {0, 0, 0, 0}
+                     };
+
+    ch = getopt_long (argc, argv, "vfhsbiap",
+        long_options, &option_index);
+    if (ch == -1)
+      break;
+
     switch (ch) 
     {
       case 'v':                      /* Verbose mode */
@@ -72,9 +93,10 @@
 	padtrack = 1;
 	break;
       default:                       /* If wrong option is given */
-        fprintf(stderr,"Mp3rename\n\nusage: [-vfhsbia] [file ...]\n\nUse 'mp3rename -h' for a usage summary\n\n");
+        fprintf(stderr,"Mp3rename\n\nusage: [-vfhsbia] [file ...]\n\nUse 'mp3rename --help' for a usage summary\n\n");
         exit(1);
     }
+  }
   argv += optind;
 
   if ( info == 1 && ( forced == 1 || verbose == 1)) 
@@ -501,15 +523,15 @@
 {
   printf("Mp3rename 0.6\n\n");
   printf("Options:\n");
-  printf("\t-f\t Force non id3 rename.\n");
-  printf("\t-v\t Verbose mode.\n");
-  printf("\t-h\t Display this help message.\n");
-  printf("\t-b\t Limit the file size to 32 chars.\n");
-  printf("\t-i\t Only show the id3tags.\n");
-  printf("\t-p\t Pad the track number with a leading zero when less than 10.\n");
-  printf("\t-a\t Ask everything for the id3tag.\n\n");
-  printf("\t-s\t Set the default filename look.\n");
-  printf("\t  \t for more help on this option: -s help\n\n");
+  printf("\t-f, --force\t Force non id3 rename.\n");
+  printf("\t-v, --verbose\t Verbose mode.\n");
+  printf("\t-h, --help\t Display this help message.\n");
+  printf("\t-b, --burn\t Limit the file size to 32 chars.\n");
+  printf("\t-i, --info\t Only show the id3tags.\n");
+  printf("\t-p, --pad\t Pad the track number with a leading zero when less than 10.\n");
+  printf("\t-a, --ask\t Ask everything for the id3tag.\n\n");
+  printf("\t-s, --source\t Set the default filename look.\n");
+  printf("\t \t \t for more help on this option take a look at -s help\n\n");
   printf("Sander Janssen <janssen@rendo.dekooi.nl>\n\n");
 
 }