~ubuntu-branches/debian/jessie/ccache/jessie

« back to all changes in this revision

Viewing changes to debian/patches/03_long_options.diff

  • Committer: Bazaar Package Importer
  • Author(s): Loïc Minier
  • Date: 2010-10-13 17:14:13 UTC
  • mfrom: (5.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101013171413-4ehrj1y89huf069u
Tags: 3.0.1-1ubuntu1
* Merge with Debian; remaining changes:
  - Add gcc/g++-4.4 and -4.5 symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff --git a/ccache.1 b/ccache.1
2
 
index 9d1cbcd..87b3a85 100644
3
 
--- a/ccache.1
4
 
+++ b/ccache.1
5
 
@@ -23,14 +23,14 @@ Here is a summary of the options to ccache\&.
6
 
 .nf 
7
 
  
8
 
 
9
 
--s                      show statistics summary
10
 
--z                      zero statistics
11
 
--c                      run a cache cleanup
12
 
--C                      clear the cache completely
13
 
--F <maxfiles>           set maximum files in cache
14
 
--M <maxsize>            set maximum size of cache (use G, M or K)
15
 
--h                      this help page
16
 
--V                      print version number
17
 
+\-s, \-\-show-stats        show statistics summary
18
 
+\-z, \-\-zero-stats        zero statistics
19
 
+\-c, \-\-cleanup           run a cache cleanup
20
 
+\-C, \-\-clear             clear the cache completely
21
 
+\-F <n>, \-\-max-files=<n> set maximum files in cache
22
 
+\-M <n>, \-\-max-size=<n>  set maximum size of cache (use G, M or K)
23
 
+\-h, \-\-help              this help page
24
 
+\-V, \-\-version           print version number
25
 
 
26
 
 .fi 
27
 
  
28
 
@@ -43,22 +43,22 @@ invoked as a compiler none of these options apply\&. In that case your
29
 
 normal compiler options apply and you should refer to your compilers
30
 
 documentation\&.
31
 
 .PP 
32
 
-.IP "\fB-h\fP" 
33
 
+.IP "\fB-h, --help\fP"
34
 
 Print a options summary page
35
 
 .IP 
36
 
-.IP "\fB-s\fP" 
37
 
+.IP "\fB-s, --show-stats\fP"
38
 
 Print the current statistics summary for the cache\&. The
39
 
 statistics are stored spread across the subdirectories of the
40
 
 cache\&. Using "ccache -s" adds up the statistics across all
41
 
 subdirectories and prints the totals\&.
42
 
 .IP 
43
 
-.IP "\fB-z\fP" 
44
 
+.IP "\fB-z, --zero-stats\fP"
45
 
 Zero the cache statistics\&. 
46
 
 .IP 
47
 
-.IP "\fB-V\fP" 
48
 
+.IP "\fB-V, --version\fP" 
49
 
 Print the ccache version number
50
 
 .IP 
51
 
-.IP "\fB-c\fP" 
52
 
+.IP "\fB-c, --cleanup\fP" 
53
 
 Clean the cache and re-calculate the cache file count and
54
 
 size totals\&. Normally the -c option should not be necessary as ccache
55
 
 keeps the cache below the specified limits at runtime and keeps
56
 
@@ -66,16 +66,16 @@ statistics up to date on each compile\&. This option is mostly useful
57
 
 if you manually modify the cache contents or believe that the cache
58
 
 size statistics may be inaccurate\&.
59
 
 .IP 
60
 
-.IP "\fB-C\fP" 
61
 
+.IP "\fB-C, --clear\fP" 
62
 
 Clear the entire cache, removing all cached files\&.
63
 
 .IP 
64
 
-.IP "\fB-F maxfiles\fP" 
65
 
+.IP "\fB-F <maxfiles>, --max-files=<maxfiles>\fP" 
66
 
 This sets the maximum number of files allowed in
67
 
 the cache\&. The value is stored inside the cache directory and applies
68
 
 to all future compiles\&. Due to the way the value is stored the actual
69
 
 value used is always rounded down to the nearest multiple of 16\&.
70
 
 .IP 
71
 
-.IP "\fB-M maxsize\fP" 
72
 
+.IP "\fB-M <maxsize>, --max-size=<maxsize>\fP" 
73
 
 This sets the maximum cache size\&. You can specify
74
 
 a value in gigabytes, megabytes or kilobytes by appending a G, M or K
75
 
 to the value\&. The default is gigabytes\&. The actual value stored is
76
 
diff --git a/ccache.c b/ccache.c
77
 
index f6be1bc..f9b7b82 100644
78
 
--- a/ccache.c
79
 
+++ b/ccache.c
80
 
@@ -22,6 +22,7 @@
81
 
 */
82
 
 
83
 
 #include "ccache.h"
84
 
+#include <getopt.h>
85
 
 
86
 
 /* the base cache directory */
87
 
 char *cache_dir = NULL;
88
 
@@ -911,14 +912,14 @@ static void usage(void)
89
 
        printf("\tcompiler [compile options]    (via symbolic link)\n");
90
 
        printf("\nOptions:\n");
91
 
 
92
 
-       printf("-s                      show statistics summary\n");
93
 
-       printf("-z                      zero statistics\n");
94
 
-       printf("-c                      run a cache cleanup\n");
95
 
-       printf("-C                      clear the cache completely\n");
96
 
-       printf("-F <maxfiles>           set maximum files in cache\n");
97
 
-       printf("-M <maxsize>            set maximum size of cache (use G, M or K)\n");
98
 
-       printf("-h                      this help page\n");
99
 
-       printf("-V                      print version number\n");
100
 
+       printf("-s, --show-stats         show statistics summary\n");
101
 
+       printf("-z, --zero-stats         zero statistics\n");
102
 
+       printf("-c, --cleanup            run a cache cleanup\n");
103
 
+       printf("-C, --clear              clear the cache completely\n");
104
 
+       printf("-F <n>, --max-files=<n>  set maximum files in cache\n");
105
 
+       printf("-M <n>, --max-size=<n>   set maximum size of cache (use G, M or K)\n");
106
 
+       printf("-h, --help               this help page\n");
107
 
+       printf("-V, --version            print version number\n");
108
 
 }
109
 
 
110
 
 static void check_cache_dir(void)
111
 
@@ -934,7 +935,21 @@ static int ccache_main(int argc, char *argv[])
112
 
        int c;
113
 
        size_t v;
114
 
 
115
 
-       while ((c = getopt(argc, argv, "hszcCF:M:V")) != -1) {
116
 
+       static struct option long_options[] =
117
 
+        {
118
 
+               {"show-stats", no_argument,       0, 's'},
119
 
+               {"zero-stats", no_argument,       0, 'z'},
120
 
+               {"cleanup",    no_argument,       0, 'c'},
121
 
+               {"clear",      no_argument,       0, 'C'},
122
 
+               {"max-files",  required_argument, 0, 'F'},
123
 
+               {"max-size",   required_argument, 0, 'M'},
124
 
+               {"help",       no_argument,       0, 'h'},
125
 
+               {"version",    no_argument,       0, 'V'},
126
 
+               {0, 0, 0, 0}
127
 
+        };
128
 
+       int option_index = 0;
129
 
+
130
 
+       while ((c = getopt_long(argc, argv, "hszcCF:M:V", long_options, &option_index)) != -1) {
131
 
                switch (c) {
132
 
                case 'V':
133
 
                        printf("ccache version %s\n", CCACHE_VERSION);