it's not width but height which defines ratio
[awesome.git] / awesome-client.c
blob6d6886cbd4a762c602df0ec974cba77102f96543
1 /*
2 * awesome-client.c - awesome client, communicate with socket
4 * Copyright © 2007 Julien Danjou <julien@danjou.info>
5 * Copyright © 2007 daniel@brinkers.de
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <errno.h>
24 #include <stdio.h>
25 #include <sys/socket.h>
26 #include <sys/un.h>
28 #include "awesome-client.h"
29 #include "util.h"
31 /* GNU/Hurd workaround */
32 #ifndef MSG_NOSIGNAL
33 #define MSG_NOSIGNAL 0
34 #endif
36 int
37 main(void)
39 struct sockaddr_un *addr;
40 char buf[1024];
41 int csfd, ret_value = EXIT_SUCCESS;
43 csfd = get_client_socket();
44 addr = get_client_addr(getenv("DISPLAY"));
46 if(!addr || csfd < 0)
47 return EXIT_FAILURE;
49 while(fgets(buf, sizeof(buf), stdin))
50 if(sendto(csfd, buf, a_strlen(buf), MSG_NOSIGNAL,
51 (const struct sockaddr *) addr, sizeof(struct sockaddr_un)) == -1)
53 switch (errno)
55 case ENOENT:
56 fprintf(stderr, "Can't write to %s\n", addr->sun_path);
57 break;
58 default:
59 perror("error sending datagram");
61 ret_value = errno;
62 break;
65 close(csfd);
67 p_delete(&addr);
69 return ret_value;
71 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80