/* the main program when not doing a compile */ static int ccache_main(int argc, char *argv[]) { int c; size_t v; while ((c = getopt(argc, argv, "hszcCF:M:V")) != -1) { switch (c) { case 'V': printf("ccache version %s\n", CCACHE_VERSION); printf("Copyright Andrew Tridgell 2002\n"); printf("Released under the GNU GPL v2 or later\n"); exit(0); case 'h': usage(); exit(0); case 's': stats_summary(); break; case 'c': cleanup_all(cache_dir); printf("Cleaned cache\n"); break; case 'C': wipe_all(cache_dir); printf("Cleared cache\n"); break; case 'z': stats_zero(); printf("Statistics cleared\n"); break; case 'F': v = atoi(optarg); stats_set_limits(v, -1); printf("Set cache file limit to %u\n", (unsigned)v); break; case 'M': v = value_units(optarg); stats_set_limits(-1, v); printf("Set cache size limit to %uk\n", (unsigned)v); break; default: usage(); exit(1); } } return 0; }
int ev_check_so_error(int fd) { int error = sk_check_so_error(fd); if (error != 0) { char src_ip[128] = {0}; int src_port = 0; sk_getsockname(fd, src_ip, 128, &src_port); if (error == ECONNREFUSED) { stats_summary(&myreq, &net_record); exit(EXIT_FAILURE); } } return error; }