Better Makefile, cleaned up code a bit.

This commit is contained in:
Michael Jumper
2010-09-06 16:44:31 -07:00
parent e77c76915a
commit f20fa375ad
4 changed files with 18 additions and 11 deletions

View File

@@ -1,22 +1,25 @@
CFLAGS=-O2 -ansi -pedantic -Wall -Werror
LDFLAGS=-lpng -lvncclient
.PHONY: clean
all: guacd
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
$(CC) -O2 -c -ansi -pedantic proxy.c
$(CC) $(CFLAGS) -c proxy.c
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
$(CC) -O2 -c -ansi -pedantic guacio.c
$(CC) $(CFLAGS) -c guacio.c
daemon.o: daemon.c proxy.h
$(CC) -O2 -c -ansi -pedantic daemon.c
$(CC) $(CFLAGS) -c daemon.c
clean:
$(RM) *.o guacd

View File

@@ -21,6 +21,8 @@ GUACIO* guac_open(int fd) {
io->written = 0;
io->fd = fd;
return io;
}
void guac_close(GUACIO* io) {

View File

@@ -60,9 +60,15 @@ char* guac_escape_string(const char* str) {
}
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, ";");
free(escaped);
}
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_infop png_info;
png_byte* row;
/* Write image */

View File

@@ -90,13 +90,12 @@ char* guac_vnc_get_password(rfbClient* client) {
void proxy(int client_fd) {
char* hostname;
char* escaped;
int wait_result;
rfbClient* rfb_client;
png_byte** png_rows;
png_byte* row;
int x, y;
int y;
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);
/* Send name */
escaped = guac_escape_string(rfb_client->desktopName);
guac_send_name(io, escaped);
free(escaped);
guac_send_name(io, rfb_client->desktopName);
/* Send size */
guac_send_size(io, rfb_client->width, rfb_client->height);