-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathemkt.cpp
More file actions
executable file
·99 lines (74 loc) · 2.32 KB
/
Copy pathemkt.cpp
File metadata and controls
executable file
·99 lines (74 loc) · 2.32 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/***************************************************************************
* Copyright (C) 2003 by eddiedu *
* eddiedu@scale.com.br *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdlib.h>
#include <mysql/mysql.h>
#ifdef __cplusplus
}
#endif
#include "global.h"
#include "Pointer.h"
#include "PecaHandler.h"
#include "QueueManager.h"
#include "Mailer.h"
#include <fstream>
#include <iostream>
using namespace std;
QueueManager queue;
PecaHandler peca_handler;
void leConfiguracao();
int main() {
Debug debug("main");
debug.info("Iniciando o PROGRAMA DE ENVIO!");
leConfiguracao();
peca_handler.Start();
queue.Start();
while (1) {
Thread::Sleep(30);
} //FIM DO While forever
debug.info("Exiting...");
return 0;
}
void leConfiguracao() {
ifstream hfile(CONF_DIR);
debug.info("Configuration file: %s", CONF_DIR);
string temp;
while (!hfile.eof()) {
getline(hfile, temp);
if (temp.find("database") == 0) {
Database::db = temp.substr(temp.find("=") + 1, temp.length());
}
if (temp.find("host") == 0) {
Database::host = temp.substr(temp.find("=") + 1, temp.length());
}
if (temp.find("user") == 0) {
Database::user = temp.substr(temp.find("=") + 1, temp.length());
}
if (temp.find("pass") == 0) {
Database::pass = temp.substr(temp.find("=") + 1, temp.length());
}
if (temp.find("DNS") == 0) {
DNS = temp.substr(temp.find("=") + 1, temp.length());
}
if (temp.find("instante_id") == 0) {
INSTANCE_NUM = atoi(
temp.substr(temp.find("=") + 1, temp.length()).c_str());
}
}
debug.info("Parametros encontrados: %s@%s:/%s - DNS: %s para instancia %d",
Database::user.c_str(), Database::host.c_str(),
Database::db.c_str(), DNS.c_str(), INSTANCE_NUM);
hfile.close();
}