Aggiunto flag D per scaricare tutti i tracciati standard in un direttorio
a scelta. Usage: BA1 -0 -D <directory> [1|0] [modulo] . Dove gli ultimi 2 parametri servono per scaricare anche le descrizioni (default vero) e per scaricare solo un cero modulo (default tutti). git-svn-id: svn://10.65.10.50/trunk@3464 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
101672e1c2
commit
2573318e73
@ -10,7 +10,6 @@
|
|||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <validate.h>
|
#include <validate.h>
|
||||||
#include <progind.h>
|
|
||||||
#include <extcdecl.h>
|
#include <extcdecl.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
|
|
||||||
@ -65,6 +64,7 @@ protected:
|
|||||||
void open_history();
|
void open_history();
|
||||||
void put_history(const char* firm);
|
void put_history(const char* firm);
|
||||||
void close_history();
|
void close_history();
|
||||||
|
void dump_trc(const char * dir, const bool des_too, const long modules);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -265,18 +265,46 @@ bool TManutenzione_app::create() // initvar e arrmask
|
|||||||
TApplication::create();
|
TApplication::create();
|
||||||
|
|
||||||
_firm = get_firm();
|
_firm = get_firm();
|
||||||
|
TString sw(argc()>2 ? argv(2) : "");
|
||||||
|
|
||||||
if (argc() > 2)
|
if (argc() > 2 && sw == "-C")
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (sw == "-D")
|
||||||
|
{
|
||||||
|
const int c = argc();
|
||||||
|
bool des_too = 1; // Anche le descrizioni
|
||||||
|
long modules = -1; // Tutti i moduli
|
||||||
|
if (c < 4)
|
||||||
|
{
|
||||||
|
error_box("Usage: BA1 -0 -D <directory> [0|1] [<module number>]");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
TFilename dir(argv(3));
|
||||||
|
if (!fexist(dir))
|
||||||
|
{
|
||||||
|
error_box("Non esiste il direttorio %s", (const char*)dir);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (c == 5)
|
||||||
|
des_too = (bool)atoi(argv(4));
|
||||||
|
if (c == 6)
|
||||||
|
modules = atol(argv(5));
|
||||||
|
prefix().set("");
|
||||||
|
load_des();
|
||||||
|
dump_trc(dir,des_too,modules);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
if (!set_firm())
|
if (!set_firm())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
load_des();
|
load_des();
|
||||||
|
|
||||||
|
|
||||||
const bool superprassi = user() == "PRASSI";
|
const bool superprassi = user() == "PRASSI";
|
||||||
_mask = new TMask ("ba1100a");
|
_mask = new TMask ("ba1100a");
|
||||||
_browse = new TDir_sheet ("Manutenzione file di sistema", superprassi ? 0xC : 0x8);
|
_browse = new TDir_sheet ("Manutenzione file di sistema", superprassi ? 0xC : 0x8);
|
||||||
@ -379,6 +407,40 @@ void TManutenzione_app::close_history()
|
|||||||
remove(History_file);
|
remove(History_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TManutenzione_app::dump_trc(const char * dir, const bool des_too, const long modules)
|
||||||
|
{
|
||||||
|
const int items = _recs.items();
|
||||||
|
TString s("Scarico dei tracciati standard in ");
|
||||||
|
s << dir;
|
||||||
|
TProgind p(items ? items : 1, s, FALSE, TRUE, 70);
|
||||||
|
p.setstatus(1);
|
||||||
|
for (int i=2;i<=items;i++) //Salta il primo (dir.gen)
|
||||||
|
{
|
||||||
|
p.addstatus(1);
|
||||||
|
TTrec& rc = (TTrec&)_recs[i];
|
||||||
|
TDir& dr = (TDir&)_dirs[i];
|
||||||
|
const long file_mod = (long)abs((int)dr.flags());
|
||||||
|
if (modules != -1 && file_mod != modules) continue; // se non fa parte del modulo lo salta
|
||||||
|
TFilename descfname;
|
||||||
|
descfname.format("%s/d%d.des", DESCDIR, i);
|
||||||
|
if (!fexist(descfname)) // crea la descrizione se non esiste
|
||||||
|
{
|
||||||
|
FILE * fd = fopen(descfname, "w");
|
||||||
|
|
||||||
|
if (fd != NULL)
|
||||||
|
fclose(fd);
|
||||||
|
}
|
||||||
|
TConfig conf_des(descfname,DESCPAR);
|
||||||
|
|
||||||
|
if (des_too) rc.set_des(&conf_des);
|
||||||
|
TFilename fn(dir);
|
||||||
|
fn << "/d";fn << i;
|
||||||
|
fn.ext("trr");
|
||||||
|
ofstream out(fn);
|
||||||
|
out << rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const char* TManutenzione_app::dumpfilename(const FileDes& dep) const
|
const char* TManutenzione_app::dumpfilename(const FileDes& dep) const
|
||||||
{
|
{
|
||||||
TFilename n; n.tempdir();
|
TFilename n; n.tempdir();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user