reHDD/src/delete.cpp

43 lines
861 B
C++
Raw Normal View History

2020-08-23 11:04:10 +02:00
/**
* @file delete.cpp
* @brief delete drive
* @author hendrik schutter
* @date 23.08.2020
*/
#include "../include/reHDD.h"
/**
* \brief delete drive with wipefs
* \param pointer of Drive instance
* \return void
*/
void Delete::deleteDrive(Drive* drive)
{
size_t len = 0; //lenght of found line
char* cLine = NULL; //found line
#ifndef DRYRUN
string sCMD = ("wipefs -af ");
sCMD.append(drive->getPath());
2020-09-18 14:42:45 +02:00
sCMD.append("*");
2020-08-23 11:04:10 +02:00
#endif
#ifdef DRYRUN
//cout << "dryrun for " << drive->getPath() << endl;
string sCMD = ("echo");
#endif
const char* cpComand = sCMD.c_str();
//cout << "delete: " << cpComand << endl;
FILE* deleteCmdOutput = popen(cpComand, "r");
while ((getline(&cLine, &len, deleteCmdOutput)) != -1)
{
//wipefs running
}
2022-01-26 15:44:32 +01:00
pclose(deleteCmdOutput);
2020-08-23 11:04:10 +02:00
}