--- recover-1.3c.orig/ui.c
+++ recover-1.3c/ui.c
@@ -26,6 +26,7 @@
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
+#include <string.h>
#include "questions.h"
#include "recover.h"
@@ -85,17 +86,14 @@
// This function prints a list of all ext2 devices
-int print_devices()
+void print_devices()
{
char *tmp=(char*) malloc(125),
*buf=(char*) malloc(101),
ext2_fs[256][100],
ext2_fs_root[256][100],
fs_type[20];
- int count=0,
- part,
- dev,
- ext2_fs_count=0,
+ int ext2_fs_count=0,
counter=1;
FILE *file;
printf ("Scanning devices...\n");
@@ -103,11 +101,11 @@
file = fopen ("/etc/fstab", "r");
printf ("Ext2 devices:\n");
for (;counter!= EOF;) {
- counter=fscanf (file, "%s%s%s", &ext2_fs[ext2_fs_count],
- &ext2_fs_root[ext2_fs_count], &fs_type);
+ counter=fscanf (file, "%s%s%s", ext2_fs[ext2_fs_count],
+ ext2_fs_root[ext2_fs_count], fs_type);
if (strcmp (fs_type, "ext2") == 0 && ext2_fs[ext2_fs_count][0]=='/') {
ext2_fs_count++;
- printf ("device: %s mount point: %s\n", ext2_fs[ext2_fs_count-1], &ext2_fs_root[ext2_fs_count-1]);
+ printf ("device: %s mount point: %s\n", ext2_fs[ext2_fs_count-1], ext2_fs_root[ext2_fs_count-1]);
}
}
fclose (file);
@@ -152,7 +150,7 @@
void print_uid()
{
char name[100], number[50];
- int x, y, z, temp;
+ int x, y, z, temp=0;
char login[]="Name", uid[]="User ID", line[]="----------------------";
FILE *passwd_file;
passwd_file = fopen ("/etc/passwd", "r");
@@ -195,7 +193,7 @@
static char tmp[12];
do {
printf ("%s", question);
- scanf ("%12s", &tmp);
+ scanf ("%12s", tmp);
dec = atoi (tmp);
} while ((dec > max || dec < min) && dec != -1);
return dec;
@@ -208,7 +206,7 @@
static char tmp[22];
do {
printf ("%s", question);
- scanf ("%22s", &tmp);
+ scanf ("%22s", tmp);
dec = atol (tmp);
} while (dec < min && dec != -1);
return dec;
@@ -220,7 +218,7 @@
maxday, minday,
maxmin, minmin,
maxhour, minhour,
- uid, ch;
+ uid, ch, c;
long minsize, maxsize;
int result, inode_numb, count;
char weekd[4], month[4],
@@ -228,7 +226,7 @@
dir[126],
*command=(char*)malloc(256),
text_str[512],
- *buf=(char*) malloc (101), c;
+ *buf=(char*) malloc (101);
inode *firstinode;
inode_list *startinode, *tmp_inode;
FILE *tmp;
@@ -246,7 +244,7 @@
exit (1);
}
}
-start_device:
+//start_device:
#ifndef lsdel_file
print_devices();
//printf ("Done printing devices\n");
@@ -286,7 +284,7 @@
month_question:
printf("%s", ask_month);
printf("%s", month_eg);
- scanf("%3s", &month);
+ scanf("%3s", month);
if (!check_month (month) )
goto month_question;
if (!strcmp(month,"-1"))
@@ -295,7 +293,7 @@
weekd_question:
printf("%s", ask_weekd);
printf("%s", weekd_eg);
- scanf("%3s", &weekd);
+ scanf("%3s", weekd);
if (!check_week (weekd) )
goto weekd_question;
if (!strcmp(weekd,"-1"))
@@ -320,7 +318,7 @@
printf ("No inodes found");
if (startinode != NULL && result > 0) {
printf ("\n%d %s ", result, ask_dump);
- scanf ("%125s", &dir);
+ scanf ("%125s", dir);
//sprintf (command, "mkdir %s &> /dev/null", dir);
//tmp = get_output (command);
//fclose (tmp);
--- recover-1.3c.orig/Makefile
+++ recover-1.3c/Makefile
@@ -3,7 +3,7 @@
# if you change this, don't forget to change RECOVER_QUESTIONS
# in recover.h
-PREFIX=/usr
+PREFIX=$(DESTDIR)/usr
CC=gcc
CFLAGS=-g -x c # To compile as C
@@ -30,9 +30,10 @@
install: recover
rm -f -r $(PREFIX)/share/recover
- mkdir -p $(PREFIX)/bin
+ mkdir -p $(PREFIX)/sbin
mkdir -p $(PREFIX)/share/recover
- mkdir -p $(PREFIX)/man/man1
+ mkdir -p $(PREFIX)/share/man/man1
cp recover_questions $(PREFIX)/share/recover
- cp -f recover $(PREFIX)/bin
- cp -f recover.1.gz $(PREFIX)/man/man1
+ cp -f recover $(PREFIX)/sbin
+ #cp -f recover.1.gz $(PREFIX)/share/man/man1
+ gzip -c debian/recover.1 > $(PREFIX)/share/man/man1/recover.1.gz
--- recover-1.3c.orig/recover.c
+++ recover-1.3c/recover.c
@@ -71,7 +71,7 @@
//// F U N C T I O N S ////
extern void prn_error (char *message);
-extern int print_devices (void);
+extern void print_devices (void);
extern void print_uid ();
extern void start_it (char *device1, int all);
@@ -150,9 +150,9 @@
get_inodes (char *device)
{
char temp[256], dummy[12];
- int num_del_inodes, x, pid, fd[2];
+// int num_del_inodes, x;
int blocks;
- inode *cur_inode, *lastinode = NULL, *firstinode;
+ inode *cur_inode = NULL, *lastinode = NULL, *firstinode = NULL;
FILE *list;
printf ("Getting inodes (this can take some time)...\n");
#ifdef lsdel_file
@@ -164,27 +164,25 @@
sprintf (temp, "debugfs -R lsdel %s", device);
list = get_output (temp);
#endif
- fgets (temp, 256, list);
- sscanf (temp, "%d", &num_del_inodes);
- fgets (temp, 256, list);
+ fgets (temp, 256, list); /* header */
- for (x = 0; x </*=*/ num_del_inodes; x++) {
+ while(1) {
+ if(!fgets (temp, 256, list)) break;
+ if(strstr(temp, "found")) break;
cur_inode = (inode *)malloc (sizeof (inode));
if (lastinode != NULL)
lastinode->next_inode = cur_inode;
else
firstinode = cur_inode;
- if (fgets (temp, 256, list) == NULL)
- break;
sscanf (temp, "%d %d %d %d %[^/]/%d %s %s %d %d:%d:%d %d",
&(cur_inode->number),
&(cur_inode->UID),
&(cur_inode->mode),
&(cur_inode->size),
- &dummy,
+ dummy,
&blocks,
- &(cur_inode->weekd),
- &(cur_inode->month),
+ cur_inode->weekd,
+ cur_inode->month,
&(cur_inode->day),
&(cur_inode->hour),
&(cur_inode->min),
@@ -200,7 +198,8 @@
lastinode = cur_inode;
}
fclose (list);
- cur_inode->next_inode = NULL;
+ if(firstinode)
+ cur_inode->next_inode = NULL;
return (firstinode);
}
@@ -276,16 +275,16 @@
return count;
}
-// This function isn't used
-int free_inodes (inode * firstinode)
-{
- inode *curinode = firstinode, *tempinode;
- for (; curinode != NULL;) {
- tempinode = curinode->next_inode;
- free (curinode);
- curinode = tempinode;
- }
-}
+// // This function isn't used
+//int free_inodes (inode * firstinode)
+//{
+// inode *curinode = firstinode, *tempinode;
+// for (; curinode != NULL;) {
+// tempinode = curinode->next_inode;
+// free (curinode);
+// curinode = tempinode;
+// }
+//}
// erases the /n in the string. This function could
// be way easier, but allows now other filtering.
@@ -300,20 +299,17 @@
}
// This function reads recover_questions
-int get_questions(char *lang)
+void get_questions(char *lang)
{
char line[101],
- header[20],
temp[20],
temp2[20],
- temp3[20],
- *dest;
+ temp3[20];
FILE *txt;
int x,
xx,
langcount=1,
- tmp,
- place;
+ tmp;
txt = fopen (QUESTIONS_LOCATION, "r");
if (txt == NULL) {
@@ -331,7 +327,7 @@
if (line[0]=='[') {
if (strncmp (line, "[language",9)==0) {
for (x=1; temp[0]!='#';x++) {
- tmp = fscanf (txt, "%s%s%s", &temp, &temp2, &temp3);
+ tmp = fscanf (txt, "%s%s%s", temp, temp2, temp3);
strtoupper (temp);
strtoupper (temp2);
strtoupper (temp3);
@@ -396,7 +392,7 @@
if (!argv[1]) {
tmp = getenv ("LANG");
if (tmp != NULL)
- strcpy (lang, tmp);
+ strncpy (lang, tmp, sizeof(lang)-1);
else
strcpy (lang, "EN");
strtoupper (lang);
--- recover-1.3c.orig/recover_questions
+++ recover-1.3c/recover_questions
@@ -6,15 +6,17 @@
# Portuguese and Spanish support by Osvaldo J. Filho <osvaldojaneri@uol.com.br>
# German support by Peter Suetterlin <P.Suetterlin@astro.uu.nl>
# French support by Denis Bodor <d.bodor@calixo.net>
+# Italian support by Luca Bruno <luca.br@uno.it>
# recover is already translated in:
[languages]
-EN ENG english
+EN EN_US english
PT PT_BR portugese
NL BE_NL DUTCH
-DE GER german
-FR francais franais
-ES espanol Espanol
+DE DE_DE german
+FR FR_FR franais
+ES ES_ES Espanol
+IT IT_IT Italiano
# Here are the questions:
@@ -25,6 +27,7 @@
Geben Sie den Namen der Partition ein:
Entrez le nom du peripherique partition SVP:
Entre com el nombre de dispositivo de la particin:
+Inserire il nome del dispositivo della partizione:
[ask_year]
In what year did you delete the file? (eg. 1999):
@@ -33,6 +36,7 @@
In welchem Jahr wurde die Datei gel÷scht? (z.B. 2000)
Quelle annee avez-vous efface le fichier? (ex. 1999):
En qu a±o usted suprimi el fichero? (eg. 1999):
+In che anno è stato cancellato il file? (es. 1999):
[ask_month]
In what month did you delete the file?
@@ -41,6 +45,7 @@
In welchem Monat wurde die Datei gel÷scht?
Quel mois avez-vous efface le fichier?
En qu mes usted suprimi el fichero?
+In che mese è stato cancellato il file?
[month_eg]
(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec or -1=unknown):
@@ -49,6 +54,7 @@
(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec of -1=unbekannt):
(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec of -1=inconnu):
(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec of -1=desconocido):
+(Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec o -1=sconosciuto):
[ask_weekd]
On which day of the week did you delete the file?
@@ -57,6 +63,7 @@
An welchem Wochentag wurde die Datei gel÷scht?
Quel jour avez-vous efface le fichier?
En qu da de la semana usted suprimi el fichero?
+In che giorno della settimana è stato cancellato il file?
[weekd_eg]
(Mon, Tue, Wed, Thu, Fri, Sat, Sun or -1=unknown):
@@ -65,7 +72,7 @@
(Mon, Tue, Wed, Thu, Fri, Sat, Sun of -1=unbekannt):
(Mon, Tue, Wed, Thu, Fri, Sat, Sun of -1=inconnu):
(Mon, Tue, Wed, Thu, Fri, Sat, Sun ou -1=desconocido):
-
+(Mon, Tue, Wed, Thu, Fri, Sat, Sun o -1=sconosciuto):
[ask_day1]
What was the first possible day of the month on which you deleted the file? (1 - 31):
@@ -74,6 +81,7 @@
An welchem Tag des Monats wurde die Datei frhestens gel÷scht? (1 - 31):
Quel est le premier jour du mois ou vous avez pu effacer le fichier? (1 - 31):
Cußl era el primer da posible del mes en el cual usted suprimido el fichero? (1 - 31):
+Quale era il primo giorno del mese possibile in cui il file è stato cancellato? (1 - 31)
[ask_day2]
@@ -83,6 +91,7 @@
An welchem Tag des Monats wurde die Datei sptestens gel÷scht? (1 - 31):
Quel est le dernier jour du mois ou vous avez pu effacer le fichier? (1 - 31):
Cußl era el da posible pasado del mes en el cual usted suprimido el fichero? (1 - 31):
+Quale era l'ultimo giorno del mese possibile in cui il file è stato cancellato? (1 - 31)
[ask_minsize]
What was the minimum possibly file size in bytes? (0-2147483640):
@@ -99,6 +108,7 @@
Wie gro war die Datei h÷chstens? (0-2147483640):
Quelle est la taille maximum du fichier en octets ? (0-2147483640):
Cußl era el tama±o del archivo del mßximo posiblemente en bytes? (0-2147483640):
+Quale era la possibile dimensione massima (in byte) del file? (0-2147483640):
[ask_hour1]
What was the soonest possible hour(0-23) when you deleted the file?
@@ -107,6 +117,7 @@
Zu welcher Stunde wurde die Datei frhestens gel÷scht? (0 - 23):
Quelle est l'heure(0-23) d'effacement la plus tot ?
Cußl era el hour(0-23) lo mßs pronto posible cuando usted suprimi el fichero?
+Quale era la prima ora possibile in cui il file è stato cancellato? (0-23)
[ask_hour2]
What was the latest possible hour(0-23) when you deleted the file?
@@ -115,6 +126,7 @@
Zu welcher Stunde wurde die Datei sptestens gel÷scht? (0 - 23):
Quelle est l'heure(0-23) d'effacement la plus tard ?
Cußl era hour(0-23) posible mßs finales de cuando usted suprimi el fichero?
+Quale era l'ultima ora possibile in cui il file è stato cancellato? (0-23)
[ask_min1]
@@ -124,6 +136,7 @@
Zu welcher Minute wurde die Datei frhestens gel÷scht? (0 - 59):
Quelle est la minute(0-59) d'effacement la plus tot ?
Cußl era el minute(0-59) lo mßs pronto posible cuando usted suprimi el fichero?
+Quale era il primo minuto possibile in cui il file è stato cancellato? (0-59)
[ask_min2]
@@ -133,7 +146,7 @@
Zu welcher Minute wurde die Datei sptestens gel÷scht? (0 - 59):
Quelle est la minute(0-59) d'effacement la plus tard ?
Cußl era el minute(0-59) posible mßs finales cuando usted suprimi el fichero?
-
+Quale era l'ultimo minuto possibile in cui il file è stato cancellato? (0-59)
[ask_id]
What was the user ID of the deleted the file? (-1 if you have no idea):
@@ -142,6 +155,7 @@
Welchem Nutzer (UID) geh÷rte die gel÷schte Datei? (-1 wenn Sie es nicht wissen):
Quel est ID utilisateur du fichier efface? (-1 si vous ne savez pas):
Cußl era la ID del usuario del suprimido el fichero? (-1 si usted no tiene ninguna idea):
+Quale era l'ID utente del file cancellato? (-1 se non lo si conosce)
[ask_dump]
inodes found. Where shall i dump them? (directory):
@@ -150,6 +164,7 @@
inodes wurde(n) gefunden. Wohin sollen sie gespeichert werden? (Verzeichnis):
inodes trouves. Dois-je les dumper? (repertoire):
los inodes encontraron. Dnde vaciarlos? (directorio):
+inodes trovati. Dove devo copiarli? (cartella):
[ask_refilter]
Do you want to refilter the inodes?
@@ -158,3 +173,4 @@
Wollen Sie die Inodes ein weiteres Mal durchsuchen?
Voulez-vous refiltrer les inodes?
Usted desea filtrar de nuevo los inodes?
+Filtrare nuovamente gli inodes?