38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
* still remote-working on German time because his
* employers are kind of assholes. i'm aware that's
* not an excuse and i apologize sincerely. if
* anyone wants to submit a MR to tidy up this
* abomination without sacrificing performance, i
* would welcome it gratefully. */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <dirent.h>
#include <unistd.h>
#define _POSIX_C_SOURCE 200809L
#include <string.h>
#define ssz(str) (str), (sizeof str)
#define dupl(x) x,x
#ifndef _default_qutebrowser_location
# define _default_qutebrowser_location "/usr/bin/qutebrowser"
................................................................................
int sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (connect(sock, (struct sockaddr*)&srv, sizeof srv) != 0)
return start_instance;
const char msg_blank [] = json_msg_start json_msg_end;
const size_t extra = uri != NULL ? strlen(uri) : 0;
char msg_start [(sizeof json_msg_start) + extra];
const size_t msgsz = sizeof msg_blank + extra - 1;
const char* msg;
if (uri == NULL) msg = msg_blank; else {
strcpy(msg_start, json_msg_start);
strcpy(msg_start + (sizeof json_msg_start) - 1, uri);
strcpy(msg_start + (sizeof json_msg_start) - 1 + extra, json_msg_end);
|
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
...
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
* still remote-working on German time because his
* employers are kind of assholes. i'm aware that's
* not an excuse and i apologize sincerely. if
* anyone wants to submit a MR to tidy up this
* abomination without sacrificing performance, i
* would welcome it gratefully. */
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <dirent.h>
#include <unistd.h>
#include <string.h>
#define ssz(str) (str), (sizeof str)
#define dupl(x) x,x
#ifndef _default_qutebrowser_location
# define _default_qutebrowser_location "/usr/bin/qutebrowser"
................................................................................
int sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (connect(sock, (struct sockaddr*)&srv, sizeof srv) != 0)
return start_instance;
const char msg_blank [] = json_msg_start json_msg_end;
const size_t extra = uri != NULL ? strlen(uri) : 0;
char msg_start [(sizeof json_msg_start) + extra + (sizeof json_msg_end) - 1];
const size_t msgsz = sizeof msg_blank + extra - 1;
const char* msg;
if (uri == NULL) msg = msg_blank; else {
strcpy(msg_start, json_msg_start);
strcpy(msg_start + (sizeof json_msg_start) - 1, uri);
strcpy(msg_start + (sizeof json_msg_start) - 1 + extra, json_msg_end);
|