aboutsummaryrefslogtreecommitdiff
path: root/netnuke.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunk@stsci.edu>2009-09-17 14:15:20 -0400
committerJoseph Hunkeler <jhunk@stsci.edu>2009-09-17 14:15:20 -0400
commit5fcb64142ee72a66cfbcf3be233a1b93f694ccba (patch)
treee41183a0f7d7fedc926b344743088dc5434bf455 /netnuke.c
parent4eea3bc9a09d90187a025c0eb4462dbfdc4a8234 (diff)
downloadNetNuke-5fcb64142ee72a66cfbcf3be233a1b93f694ccba.tar.gz
Various small bug fixes and verbosity with the command line.
Diffstat (limited to 'netnuke.c')
-rw-r--r--netnuke.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/netnuke.c b/netnuke.c
index e139a15..95c6b66 100644
--- a/netnuke.c
+++ b/netnuke.c
@@ -173,8 +173,6 @@ int nuke(media_t device)
if(udef_testmode == true)
sprintf(media, "%s", "/tmp/testmode.img");
-
-
/* Generate a size string based on the media size. example: 256M */
humanize_number(mediaSize, 5, (uint64_t)size, "",
HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL);
@@ -282,6 +280,9 @@ void buildMediaList(media_t devices[])
int i = 0;
int mt = 0;
+ if(udef_verbose)
+ printf("\n--Device List--\n");
+
do
{
char media[BUFSIZ];
@@ -308,12 +309,13 @@ void buildMediaList(media_t devices[])
/* This is not the only way to do this. Especially because it is NOT
* dynamic to the mediaList at all... */
if(strstr(device.name, "ad") == 0 ||
- (strstr(device.name, "hd") == 0))
+ strstr(device.name, "hd") == 0)
{
device_stats.ide++;
}
- else if(strstr(device.name, "da") == 0 ||
- (device.usable && strstr(device.name, "sa") == 0))
+
+ if(strstr(device.name, "da") == 0 ||
+ strstr(device.name, "sd") == 0)
{
device_stats.scsi++;
}
@@ -331,6 +333,15 @@ void buildMediaList(media_t devices[])
device_stats.total = 0;
devices[device_stats.total] = device;
}
+
+ if(udef_verbose)
+ {
+#ifdef __FreeBSD__
+ printf("%s:\t%s:\t%jd bytes\n", device.nameshort, device.ident, device.size);
+#else
+ printf("%s:\t%jd bytes\n", device.nameshort, device.size);
+#endif
+ }
}
else
{
@@ -349,7 +360,8 @@ void buildMediaList(media_t devices[])
} while( 1 );
-
+ if(udef_verbose)
+ putchar('\n');
}
@@ -627,7 +639,7 @@ int main(int argc, char* argv[])
devices = (media_t*)calloc(BUFSIZ, sizeof(media_t));
if(devices == NULL)
{
- printf("Could not allocate memory for devices array.\n");
+ fprintf(stderr, "Could not allocate %d bytes of memory for devices array.\n", BUFSIZ * sizeof(media_t));
exit(1);
}
@@ -638,7 +650,7 @@ int main(int argc, char* argv[])
devices = (media_t*)realloc(devices, device_stats.total * sizeof(media_t));
if(devices == NULL)
{
- printf("Could not reallocate memory for devices array.\n");
+ printf("Could not reallocate %d bytes of memory for devices array.\n", device_stats.total * sizeof(media_t));
exit(1);
}