Fotobot
Get data from your photovoltaic plant
Main Page
Classes
Files
File List
File Members
main
main.cpp
Go to the documentation of this file.
1
24
#include <QDebug>
25
#include "
startup.h
"
26
#include "
database_tables.h
"
27
#include <sys/types.h>
28
#include <unistd.h>
29
#include <pwd.h>
30
32
#define APPNAME "Nekardas"
33
35
#define ORGANISATION "Hobrasoft"
36
38
#define DESCRIPTION "Applications gets data from fronius invertors"
39
44
int
main
(
int
argc,
char
*argv[]) {
45
46
char
*username = NULL;
47
for
(
int
a=0; a<argc; a++) {
48
if
(QString(argv[a]) ==
"-U"
) {
49
if
(++a >= argc)
break
;
50
username = argv[a];
51
}
52
}
53
54
if
(username != NULL) {
55
struct
passwd *spw;
56
spw = getpwnam(username);
57
if
(spw != NULL) {
58
int
unused;
59
Q_UNUSED(unused);
60
unused = seteuid(spw->pw_uid);
61
unused = setegid(spw->pw_gid);
62
unused = setgid(spw->pw_gid);
63
}
else
{
64
qFatal( QString(
"Cannot change effective user to %1"
).arg(username).toUtf8() );
65
exit(2);
66
}
67
}
68
69
qRegisterMetaType<DBT_DATA>(
"DBT_DATA"
);
70
71
// Use a qtservice wrapper to start the application as a Windows service or Unix daemon
72
Startup
startup(argc, argv);
73
return
startup.exec();
74
75
}
76
Startup
Definition:
startup.h:17
startup.h
database_tables.h
main
int main(int argc, char *argv[])
Definition:
main.cpp:44
Generated on Tue Sep 13 2016 14:22:30 for Fotobot by
1.8.9.1