Skip to content

Commit b4fbba5

Browse files
committed
1 parent c148bed commit b4fbba5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

vncserver.c

+11
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,17 @@ void printUsage(char *str) {
164164
int main(int argc, char **argv) {
165165
long usec;
166166

167+
// Set the default server name based on the hostname
168+
gethostname(VNC_SERVERNAME, sizeof(VNC_SERVERNAME));
169+
170+
// Preset values from environment variables (However, the values specified in the arguments have priority.)
171+
if (getenv("VNC_SERVERNAME"))
172+
strcpy(VNC_SERVERNAME, getenv("VNC_SERVERNAME"));
173+
if (getenv("VNC_PASSWORD"))
174+
strcpy(VNC_PASSWORD, getenv("VNC_PASSWORD"));
175+
if (getenv("VNC_PORT"))
176+
VNC_PORT = atoi(getenv("VNC_PORT"));
177+
167178
if(argc > 1) {
168179
int i = 1;
169180
while(i < argc) {

0 commit comments

Comments
 (0)