699
699
#define NL APR_EOL_STR
700
static void usage(void)
700
static void usage(const char *error)
702
apr_file_printf(errfile,
703
apr_file_printf(errfile, "%s error: %s\n", shortname, error);
705
apr_file_printf(errfile,
703
706
"%s -- program for cleaning the disk cache." NL
704
707
"Usage: %s [-Dvtrn] -pPATH -lLIMIT" NL
705
708
" %s [-nti] -dINTERVAL -pPATH -lLIMIT" NL
800
804
else if (status != APR_SUCCESS) {
806
810
if (intelligent) {
811
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
818
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
825
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
832
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
839
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
846
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
884
888
if (rv != APR_SUCCESS) {
885
apr_file_printf(errfile, "Invalid limit: %s"
886
APR_EOL_STR APR_EOL_STR, arg);
889
usage(apr_psprintf(pool, "Invalid limit: %s"
890
APR_EOL_STR APR_EOL_STR, arg));
897
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
896
899
proxypath = apr_pstrdup(pool, arg);
897
if (apr_filepath_set(proxypath, pool) != APR_SUCCESS) {
900
if ((status = apr_filepath_set(proxypath, pool)) != APR_SUCCESS) {
901
usage(apr_psprintf(pool, "Could not set filepath to '%s': %s",
902
proxypath, apr_strerror(status, errmsg, sizeof errmsg)));
905
913
if (o->ind != argc) {
909
if (isdaemon && (repeat <= 0 || verbose || realclean || dryrun)) {
914
usage("Additional parameters specified on the command line, aborting");
917
if (isdaemon && repeat <= 0) {
918
usage("Option -d must be greater than zero");
921
if (isdaemon && (verbose || realclean || dryrun)) {
922
usage("Option -d cannot be used with -v, -r or -D");
913
925
if (!isdaemon && intelligent) {
917
if (!proxypath || max <= 0) {
926
usage("Option -i cannot be used without -d");
930
usage("Option -p must be specified");
934
usage("Option -l must be greater than zero");
921
937
if (apr_filepath_get(&path, 0, pool) != APR_SUCCESS) {
938
usage(apr_psprintf(pool, "Could not get the filepath: %s",
939
apr_strerror(status, errmsg, sizeof errmsg)));
924
941
baselen = strlen(path);