Code cleanup and patches to fix the test code
Someone should apply the following patch.
- Correct prototypes and return values
- Make it easier to test different translation codes in release_notes_test
- Avoid crash in net-fetch_test on internationalized build with no
lang availabe (and remove wasted goto).
- Make sure the terminal is reset when exiting from net-fetch_test
Index: boxes.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/boxes.c,v
retrieving revision 1.62
diff -u -3 -p -u -r1.62 boxes.c
--- boxes.c 2002/02/28 17:11:50 1.62
+++ boxes.c 2002/02/28 18:50:53
@@ -7,7 +7,7 @@
#endif
#ifdef _TESTING_
# define RB_AUTOBOOT 1
-reboot(int blah);
+void reboot(int blah);
#endif
#include <sys/types.h>
#include <fcntl.h>
@@ -1427,7 +1442,7 @@ int main (void)
boxFinished();
- exit (0);
+ return 0;
}
#endif
Index: release_notes.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/release_notes.c,v
retrieving revision 1.8
diff -u -3 -p -u -r1.8 release_notes.c
--- release_notes.c 2001/12/03 02:39:21 1.8
+++ release_notes.c 2002/02/28 19:00:04
@@ -64,14 +64,20 @@ release_notes (const char *suffix)
#ifdef _TESTING_
/* To test, compile using: make release_notes_test */
-void main(void){
+int main(int argc, char *argv[]){
+ char *msgcat = NULL;
+
LOAD_TRMFILE("test.trm");
get_kver();
boxInit();
-
- release_notes (NULL);
+
+ if (2 == argc)
+ msgcat = argv[1];
+
+ release_notes (msgcat);
boxFinished();
+ return 0;
}
#endif
Index: util.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/util.c,v
retrieving revision 1.73
diff -u -3 -p -u -r1.73 util.c
--- util.c 2002/02/28 16:10:03 1.73
+++ util.c 2002/02/28 19:00:05
@@ -1191,17 +1191,17 @@ have_cdrom ()
#ifdef USE_LANGUAGE_CHOOSER
void find_opt_server (char * hostname)
{
+ if (NULL != lang && NULL != lang->msgcat)
{
int i = 0;
while(mirror_country_map[i] != NULL) {
if(strcmp(lang->msgcat,mirror_country_map[i]) == 0) {
sprintf(hostname, "ftp.%s.debian.org", mirror_country_map[i+1]);
- goto hostname_set;
+ return;
}
else
i+=2;
}
}
-hostname_set:
}
#endif
Index: net-fetch.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/net-fetch.c,v
retrieving revision 1.56
diff -u -3 -p -u -r1.56 net-fetch.c
--- net-fetch.c 2002/02/27 17:27:52 1.56
+++ net-fetch.c 2002/02/28 19:00:05
@@ -584,6 +584,10 @@ main ()
nf_select_server ();
nf_fetchfile ("ls-lR.gz", "foo");
+
+ boxFinished();
+
+ return 0;
}
#endif /* _TESTING_ */
Reply to: