mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Better Makefile, cleaned up code a bit.
This commit is contained in:
@@ -1,22 +1,25 @@
|
|||||||
|
|
||||||
|
CFLAGS=-O2 -ansi -pedantic -Wall -Werror
|
||||||
|
LDFLAGS=-lpng -lvncclient
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
all: guacd
|
all: guacd
|
||||||
|
|
||||||
guacd: daemon.o proxy.o guacio.o protocol.o
|
guacd: daemon.o proxy.o guacio.o protocol.o
|
||||||
$(CC) -O2 daemon.o proxy.o protocol.o guacio.o -l png -l vncclient -o guacd
|
$(CC) $(CFLAGS) $(LDFLAGS) daemon.o proxy.o protocol.o guacio.o -o guacd
|
||||||
|
|
||||||
proxy.o: proxy.c proxy.h guacio.h
|
proxy.o: proxy.c proxy.h guacio.h
|
||||||
$(CC) -O2 -c -ansi -pedantic proxy.c
|
$(CC) $(CFLAGS) -c proxy.c
|
||||||
|
|
||||||
protocol.o: protocol.c protocol.h guacio.h
|
protocol.o: protocol.c protocol.h guacio.h
|
||||||
$(CC) -O2 -c -ansi -pedantic protocol.c
|
$(CC) $(CFLAGS) -c protocol.c
|
||||||
|
|
||||||
guacio.o: guacio.c guacio.h
|
guacio.o: guacio.c guacio.h
|
||||||
$(CC) -O2 -c -ansi -pedantic guacio.c
|
$(CC) $(CFLAGS) -c guacio.c
|
||||||
|
|
||||||
daemon.o: daemon.c proxy.h
|
daemon.o: daemon.c proxy.h
|
||||||
$(CC) -O2 -c -ansi -pedantic daemon.c
|
$(CC) $(CFLAGS) -c daemon.c
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) *.o guacd
|
$(RM) *.o guacd
|
||||||
|
@@ -21,6 +21,8 @@ GUACIO* guac_open(int fd) {
|
|||||||
io->written = 0;
|
io->written = 0;
|
||||||
io->fd = fd;
|
io->fd = fd;
|
||||||
|
|
||||||
|
return io;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_close(GUACIO* io) {
|
void guac_close(GUACIO* io) {
|
||||||
|
@@ -60,9 +60,15 @@ char* guac_escape_string(const char* str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void guac_send_name(GUACIO* io, const char* name) {
|
void guac_send_name(GUACIO* io, const char* name) {
|
||||||
|
|
||||||
|
char* escaped = guac_escape_string(name);
|
||||||
|
|
||||||
guac_write_string(io, "name:");
|
guac_write_string(io, "name:");
|
||||||
guac_write_string(io, name);
|
guac_write_string(io, name);
|
||||||
guac_write_string(io, ";");
|
guac_write_string(io, ";");
|
||||||
|
|
||||||
|
free(escaped);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void guac_send_size(GUACIO* io, int w, int h) {
|
void guac_send_size(GUACIO* io, int w, int h) {
|
||||||
@@ -106,7 +112,6 @@ void guac_send_png(GUACIO* io, int x, int y, png_byte** png_rows, int w, int h)
|
|||||||
|
|
||||||
png_structp png;
|
png_structp png;
|
||||||
png_infop png_info;
|
png_infop png_info;
|
||||||
png_byte* row;
|
|
||||||
|
|
||||||
/* Write image */
|
/* Write image */
|
||||||
|
|
||||||
|
@@ -90,13 +90,12 @@ char* guac_vnc_get_password(rfbClient* client) {
|
|||||||
void proxy(int client_fd) {
|
void proxy(int client_fd) {
|
||||||
|
|
||||||
char* hostname;
|
char* hostname;
|
||||||
char* escaped;
|
|
||||||
int wait_result;
|
int wait_result;
|
||||||
rfbClient* rfb_client;
|
rfbClient* rfb_client;
|
||||||
|
|
||||||
png_byte** png_rows;
|
png_byte** png_rows;
|
||||||
png_byte* row;
|
png_byte* row;
|
||||||
int x, y;
|
int y;
|
||||||
|
|
||||||
GUACIO* io = guac_open(client_fd);
|
GUACIO* io = guac_open(client_fd);
|
||||||
|
|
||||||
@@ -133,9 +132,7 @@ void proxy(int client_fd) {
|
|||||||
rfbClientSetClientData(rfb_client, __GUAC_VNC_TAG_PNG_ROWS, png_rows);
|
rfbClientSetClientData(rfb_client, __GUAC_VNC_TAG_PNG_ROWS, png_rows);
|
||||||
|
|
||||||
/* Send name */
|
/* Send name */
|
||||||
escaped = guac_escape_string(rfb_client->desktopName);
|
guac_send_name(io, rfb_client->desktopName);
|
||||||
guac_send_name(io, escaped);
|
|
||||||
free(escaped);
|
|
||||||
|
|
||||||
/* Send size */
|
/* Send size */
|
||||||
guac_send_size(io, rfb_client->width, rfb_client->height);
|
guac_send_size(io, rfb_client->width, rfb_client->height);
|
||||||
|
Reference in New Issue
Block a user