mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Refactor: Formatting.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <malloc.h>
|
||||
#include <stdint.h>
|
||||
#include <libxml/xmlwriter.h>
|
||||
#include "scsi.h"
|
||||
#include "ata.h"
|
||||
#include "main.h"
|
||||
@@ -11,7 +13,6 @@
|
||||
#include "atapi_report.h"
|
||||
#include "scsi_report.h"
|
||||
#include "ata_report.h"
|
||||
#include <libxml/xmlwriter.h>
|
||||
|
||||
#define DIC_VERSION "3.99.6.0"
|
||||
#define DIC_COPYRIGHT "Copyright © 2011-2017 Natalia Portillo"
|
||||
@@ -20,20 +21,20 @@
|
||||
|
||||
int main(int argc, void *argv[])
|
||||
{
|
||||
int fd, rc;
|
||||
unsigned char *scsi_sense = NULL;
|
||||
unsigned char *scsi_inq_data = NULL;
|
||||
unsigned char *ata_ident = NULL;
|
||||
unsigned char *atapi_ident = NULL;
|
||||
int fd, rc;
|
||||
unsigned char *scsi_sense = NULL;
|
||||
unsigned char *scsi_inq_data = NULL;
|
||||
unsigned char *ata_ident = NULL;
|
||||
unsigned char *atapi_ident = NULL;
|
||||
AtaErrorRegistersCHS *ata_error_chs;
|
||||
int scsi_error, ata_error;
|
||||
unsigned char* manufacturer;
|
||||
unsigned char* product;
|
||||
unsigned char* revision;
|
||||
int scsi_error, ata_error;
|
||||
unsigned char *manufacturer;
|
||||
unsigned char *product;
|
||||
unsigned char *revision;
|
||||
int deviceType = DEVICE_TYPE_UNKNOWN;
|
||||
char* xmlFilename = malloc(NAME_MAX + 1);
|
||||
char *xmlFilename = malloc(NAME_MAX + 1);
|
||||
xmlTextWriterPtr xmlWriter;
|
||||
const char* ataName = "ATA";
|
||||
const char *ataName = "ATA";
|
||||
|
||||
printf("The Disc Image Chef Device Reporter for Linux %s\n", DIC_VERSION);
|
||||
printf("%s\n", DIC_COPYRIGHT);
|
||||
@@ -81,15 +82,15 @@ int main(int argc, void *argv[])
|
||||
deviceType = DEVICE_TYPE_ATAPI;
|
||||
}
|
||||
|
||||
if(scsi_inq_data == NULL || !strncmp((const char *)manufacturer,ataName, 3))
|
||||
if(scsi_inq_data == NULL || !strncmp((const char *)manufacturer, ataName, 3))
|
||||
{
|
||||
ata_error = Identify(fd, &ata_ident, &ata_error_chs);
|
||||
|
||||
if(!ata_error)
|
||||
{
|
||||
deviceType = DEVICE_TYPE_ATA;
|
||||
revision = AtaToCString(ata_ident + (23*2), 8);
|
||||
product = AtaToCString(ata_ident + (27*2), 40);
|
||||
revision = AtaToCString(ata_ident + (23 * 2), 8);
|
||||
product = AtaToCString(ata_ident + (27 * 2), 40);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +99,7 @@ int main(int argc, void *argv[])
|
||||
printf("Product: %s\n", product);
|
||||
printf("Revision: %s\n", revision);
|
||||
|
||||
if(deviceType != DEVICE_TYPE_ATA && deviceType!=DEVICE_TYPE_ATAPI && deviceType != DEVICE_TYPE_SCSI)
|
||||
if(deviceType != DEVICE_TYPE_ATA && deviceType != DEVICE_TYPE_ATAPI && deviceType != DEVICE_TYPE_SCSI)
|
||||
{
|
||||
printf("Unsupported device type %s.", DeviceType[deviceType]);
|
||||
return 3;
|
||||
@@ -127,7 +128,7 @@ int main(int argc, void *argv[])
|
||||
return 4;
|
||||
}
|
||||
|
||||
char* xmlComment = malloc(255);
|
||||
char *xmlComment = malloc(255);
|
||||
sprintf(xmlComment, "Report created with DiscImageChef.Device.Report v%s", DIC_VERSION);
|
||||
rc = xmlTextWriterWriteComment(xmlWriter, xmlComment);
|
||||
if(rc < 0)
|
||||
@@ -146,7 +147,8 @@ int main(int argc, void *argv[])
|
||||
AtaReport(fd, xmlWriter);
|
||||
|
||||
rc = xmlTextWriterEndDocument(xmlWriter);
|
||||
if (rc < 0) {
|
||||
if(rc < 0)
|
||||
{
|
||||
printf("Could not close XML report file.\n");
|
||||
return 4;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user