-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdbdestroy.cpp
More file actions
40 lines (34 loc) · 773 Bytes
/
Copy pathdbdestroy.cpp
File metadata and controls
40 lines (34 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <unistd.h>
#include "rm.h"
#include "sm.h"
#include "redbase.h"
using namespace std;
//
// main
//
int main(int argc, char *argv[])
{
RC rc;
// Look for 2 arguments. The first is always the name of the program
// that was executed, and the second should be the name of the
// database.
if (argc != 2) {
cerr << "Usage: " << argv[0] << " <dbname> \n";
exit(1);
}
// The database name is the second argument
string dbname(argv[1]);
// Create a subdirectory for the database
stringstream command;
command << "rm -r " << dbname;
rc = system(command.str().c_str());
if (rc != 0) {
cerr << argv[0] << " rmdir error for " << dbname << "\n";
exit(rc);
}
return(0);
}