336a337,396 > // We loop through the packages and for each packages we loop through files to check if they exist > static void verify(alpm_list_t *pkgs) > { > alpm_list_t *i, *files, *file, *pkgs2repair; > pmpkg_t *pkg; > struct stat stFileInfo; > int pkgs_n = alpm_list_count(pkgs); > int j = 0, k = 0; > for(i = pkgs; i; i = alpm_list_next(i)) { > j++; > pkg = alpm_list_getdata(i); > char *pkgname = alpm_pkg_get_name(pkg); > if(filter(pkg)) { > files = alpm_pkg_get_files(pkg); > for(file = files; file; file = alpm_list_next(file)){ > char *x = alpm_list_getdata(file); > char *f = malloc (strlen(x)+2); > strcpy(f,"/"); > strcat(f, x); > k++; > if(strncmp(f, "/tmp", 4)==0){ > continue; // ignore files in /tmp > } > if(lstat(f,&stFileInfo) == 0) { // we use lstat to prevent errors from symbolic links > if(!config->quiet){ > fprintf(stderr, "\rfile n°%i (package %i/%i): OK", k, j, pkgs_n); fflush(stdout); > } > } > else { > if(config->quiet){ > fprintf(stderr, "%s %s\n", pkgname, f); fflush(stdout); > } else { > fprintf(stderr, "\rfile n°%i (package %i/%i): Missing file owned by \"%s\": %s\n", k, j, pkgs_n, pkgname, f); fflush(stdout); > } > if(alpm_list_find_ptr(pkgs2repair, pkgname) == NULL) { > pkgs2repair = alpm_list_add(pkgs2repair, pkgname); > } > } > } > } > } > if(!config->quiet){ > fprintf(stderr, "\n"); > } > if(alpm_list_count(pkgs2repair) > 0) { > if(!config->quiet){ > fprintf(stderr, "Damaged packages: "); > } > for(i = pkgs2repair; i; i = alpm_list_next(i)) { > fprintf(stdout, "%s ", alpm_list_getdata(i)); > } > } else { > if(!config->quiet){ > fprintf(stderr, "No damaged packages."); > } > } > fprintf(stdout, "\n"); > fflush(stdout); > } > 340c400 < alpm_list_t *i; --- > alpm_list_t *i, *pkgs; 366c426 < * valid: no-op (plain -Q), list, info --- > * valid: no-op (plain -Q), list, info, verify 372,377c432,439 < } < < for(i = alpm_db_get_pkgcache(db_local); i; i = alpm_list_next(i)) { < pmpkg_t *pkg = alpm_list_getdata(i); < if(filter(pkg)) { < display(pkg); --- > } else if(config->op_q_verify) { > verify(alpm_db_get_pkgcache(db_local)); > } else { > for(i = alpm_db_get_pkgcache(db_local); i; i = alpm_list_next(i)) { > pmpkg_t *pkg = alpm_list_getdata(i); > if(filter(pkg)) { > display(pkg); > } 392c454 < * valid: no-op (plain -Q), list, info */ --- > * valid: no-op (plain -Q), list, info, verify */ 408a471 > 410a474,476 > if(config->op_q_verify){ > pkgs = alpm_list_add(pkgs, pkg); > } 417a484,486 > if(config->op_q_verify){ > verify(pkgs); > }