Skip to content

Commit 8684d5e

Browse files
committed
termux-api.c: break some long lines
And fix a typo.
1 parent 08bcd73 commit 8684d5e

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

termux-api.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ _Noreturn void contact_plugin(int argc, char** argv,
5959
const char outsock_str[] = "--es socket_output \"";
6060
const char method_str[] = "--es api_method \"";
6161

62-
int len = sizeof(insock_str)-1+strlen(output_address_string)+2+sizeof(outsock_str)-1+strlen(input_address_string)+2+sizeof(method_str)-1+strlen(argv[1])+2;
62+
int len = 0;
63+
len += sizeof(insock_str)-1 + strlen(output_address_string)+2;
64+
len += sizeof(outsock_str)-1 + strlen(input_address_string)+2;
65+
len += sizeof(method_str)-1 + strlen(argv[1])+2;
6366
for (int i = 2; i<argc; i++) {
6467
len += strlen(argv[i])+1;
6568
if (strcmp(argv[i], "--es") == 0 || strcmp(argv[i], "-e") == 0 || strcmp(argv[i], "--esa") == 0) {
@@ -68,7 +71,10 @@ _Noreturn void contact_plugin(int argc, char** argv,
6871
for (int a = 0; a<strlen(argv[i]); a++) {
6972
if (argv[i][a] == '"') {
7073
len += 1; // " has to be escaped, so one character more.
71-
// This assumes " is only present in string extra arguments, but that is probably an acceptable assumption to make
74+
/* This assumes " is only present in
75+
string extra arguments, but that is
76+
probably an acceptable assumption to
77+
make */
7278
}
7379
}
7480
}
@@ -185,7 +191,7 @@ _Noreturn void contact_plugin(int argc, char** argv,
185191
bool first = true;
186192
err = true;
187193
while ((ret = read(listenfd, readbuffer, 99)) > 0) {
188-
// if a single null byte is received as the first message, the call was successfull
194+
// if a single null byte is received as the first message, the call was successful
189195
if (ret == 1 && readbuffer[0] == 0 && first) {
190196
err = false;
191197
break;

0 commit comments

Comments
 (0)