pkg://xcdroast-debuginfo-0.98a15-14.fc7.ppc.rpm:614443/
usr/
src/
debug/
xcdroast-0.98alpha15/
src/rmtool.c
info downloads
/*
rmtool.c
22.09.99 tn
simple program that deletes some files on the harddrive
and give nice parseable output.
Because I do this in an external programm, the GUI-interface
wont be lagging due the long unlink-calls.
does not complain when an .inf file can't be deleted
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "largefile.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include <glib.h>
#include "xcdroast.h"
gint main(gint argc, gchar **argv) {
gint i;
gchar tmp[MAXLINE];
gint inffile;
gchar *p;
gint errflag;
if (argc <= 1) {
g_print("Usage: rmtool [list of files to delete] (Version: %s)\n", XCDROAST_VERSION);
exit(1);
}
g_print("\nStarting to delete files...\n");
fflush(stdout);
errflag = 0;
/* loop through the arguments */
for (i = 1; i < argc; i++) {
/* check if an .inf file */
inffile = 0;
strncpy(tmp,argv[i],MAXLINE);
p = rindex(tmp,'.');
if (p != NULL) {
if ((strncmp(p,XCDROAST_INFO_EXT,MAXLINE) == 0)
|| (strncmp(p,CDDA2WAV_INFO_EXT,MAXLINE) == 0)) {
inffile = 1;
}
}
if (unlink(argv[i]) != 0) {
if (inffile == 0) {
/* keep silent when try to delete inffile */
g_print("Error deleting %s: %s\n",argv[i],
strerror(errno));
errflag = 1;
}
} else {
g_print("Deleted %s successfully.\n", argv[i]);
}
g_print(" %d%%\n", (gint) ( (gfloat)i/(argc-1)*100.0));
fflush(stdout);
}
return errflag;
}