PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/CCache/debian/patches/03_long_options.diff

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