Index: ccache.c =================================================================== --- ccache.c (révision 7695) +++ ccache.c (copie de travail) @@ -22,6 +22,7 @@ */ #include "ccache.h" +#include /* the base cache directory */ char *cache_dir = NULL; @@ -885,14 +886,14 @@ printf("\tcompiler [compile options] (via symbolic link)\n"); printf("\nOptions:\n"); - printf("-s show statistics summary\n"); - printf("-z zero statistics\n"); - printf("-c run a cache cleanup\n"); - printf("-C clear the cache completely\n"); - printf("-F set maximum files in cache\n"); - printf("-M set maximum size of cache (use G, M or K)\n"); - printf("-h this help page\n"); - printf("-V print version number\n"); + printf("-s, --show-stats show statistics summary\n"); + printf("-z, --zero-stats zero statistics\n"); + printf("-c, --cleanup run a cache cleanup\n"); + printf("-C, --clear clear the cache completely\n"); + printf("-F , --max-files= set maximum files in cache\n"); + printf("-M , --max-size= set maximum size of cache (use G, M or K)\n"); + printf("-h, --help this help page\n"); + printf("-V, --version print version number\n"); } /* the main program when not doing a compile */ @@ -901,7 +902,21 @@ int c; size_t v; - while ((c = getopt(argc, argv, "hszcCF:M:V")) != -1) { + static struct option long_options[] = + { + {"show-stats", no_argument, 0, 's'}, + {"zero-stats", no_argument, 0, 'z'}, + {"cleanup", no_argument, 0, 'c'}, + {"clear", no_argument, 0, 'C'}, + {"max-files", required_argument, 0, 'F'}, + {"max-size", required_argument, 0, 'M'}, + {"help", no_argument, 0, 'h'}, + {"version", no_argument, 0, 'V'}, + {0, 0, 0, 0} + }; + int option_index = 0; + + while ((c = getopt_long(argc, argv, "hszcCF:M:V", long_options, &option_index)) != -1) { switch (c) { case 'V': printf("ccache version %s\n", CCACHE_VERSION); Index: ccache.1 =================================================================== --- ccache.1 (révision 7695) +++ ccache.1 (copie de travail) @@ -23,14 +23,14 @@ .nf --s show statistics summary --z zero statistics --c run a cache cleanup --C clear the cache completely --F set maximum files in cache --M set maximum size of cache (use G, M or K) --h this help page --V print version number +\-s, \-\-show-stats show statistics summary +\-z, \-\-zero-stats zero statistics +\-c, \-\-cleanup run a cache cleanup +\-C, \-\-clear clear the cache completely +\-F , \-\-max-files= set maximum files in cache +\-M , \-\-max-size= set maximum size of cache (use G, M or K) +\-h, \-\-help this help page +\-V, \-\-version print version number .fi @@ -43,22 +43,22 @@ normal compiler options apply and you should refer to your compilers documentation\&. .PP -.IP "\fB-h\fP" +.IP "\fB-h, --help\fP" Print a options summary page .IP -.IP "\fB-s\fP" +.IP "\fB-s, --show-stats\fP" Print the current statistics summary for the cache\&. The statistics are stored spread across the subdirectories of the cache\&. Using "ccache -s" adds up the statistics across all subdirectories and prints the totals\&. .IP -.IP "\fB-z\fP" +.IP "\fB-z, --zero-stats\fP" Zero the cache statistics\&. .IP -.IP "\fB-V\fP" +.IP "\fB-V, --version\fP" Print the ccache version number .IP -.IP "\fB-c\fP" +.IP "\fB-c, --cleanup\fP" Clean the cache and re-calculate the cache file count and size totals\&. Normally the -c option should not be necessary as ccache keeps the cache below the specified limits at runtime and keeps @@ -66,16 +66,16 @@ if you manually modify the cache contents or believe that the cache size statistics may be inaccurate\&. .IP -.IP "\fB-C\fP" +.IP "\fB-C, --clear\fP" Clear the entire cache, removing all cached files\&. .IP -.IP "\fB-F maxfiles\fP" +.IP "\fB-F , --max-files=\fP" This sets the maximum number of files allowed in the cache\&. The value is stored inside the cache directory and applies to all future compiles\&. Due to the way the value is stored the actual value used is always rounded down to the nearest multiple of 16\&. .IP -.IP "\fB-M maxsize\fP" +.IP "\fB-M , --max-size=\fP" This sets the maximum cache size\&. You can specify a value in gigabytes, megabytes or kilobytes by appending a G, M or K to the value\&. The default is gigabytes\&. The actual value stored is