Make whitespace changes

Status lines for Emacs and Vim have been added to Python sources so
they'll be easier to edit using Python's preferred coding style.

Some DNS helper functions have been broken up into multiple files. It's
nice to have one function per file whenever possible, since that way we
don't need -ffunction-sections.  Another reason it's good to have small
source files, is because the build will be enforcing resource limits on
compilation and testing soon.
This commit is contained in:
Justine Tunney 2021-08-13 03:20:45 -07:00
parent 71273bc5c9
commit 9b29358511
293 changed files with 1975 additions and 609 deletions

View file

@ -20,6 +20,9 @@
#include "libc/sysv/consts/termios.h" #include "libc/sysv/consts/termios.h"
uint32_t cfgetispeed(const struct termios *t) { uint32_t cfgetispeed(const struct termios *t) {
/* return t->c_cflag & CBAUD; */ /* ??? */ if (CBAUD) {
return t->c_cflag & CBAUD;
} else {
return t->c_ispeed; return t->c_ispeed;
} }
}

View file

@ -20,6 +20,9 @@
#include "libc/sysv/consts/termios.h" #include "libc/sysv/consts/termios.h"
uint32_t cfgetospeed(const struct termios *t) { uint32_t cfgetospeed(const struct termios *t) {
/* return t->c_cflag & CBAUD; */ /* ??? */ if (CBAUD) {
return t->c_cflag & CBAUD;
} else {
return t->c_ospeed; return t->c_ospeed;
} }
}

View file

@ -22,11 +22,15 @@
int cfsetospeed(struct termios *t, int speed) { int cfsetospeed(struct termios *t, int speed) {
if (CBAUD) { if (CBAUD) {
if (speed & ~CBAUD) return einval(); if (!(speed & ~CBAUD)) {
t->c_cflag &= ~CBAUD; t->c_cflag &= ~CBAUD;
t->c_cflag |= speed; t->c_cflag |= speed;
return 0;
} else {
return einval();
}
} else { } else {
t->c_ospeed = speed; t->c_ospeed = speed;
}
return 0; return 0;
} }
}

View file

@ -64,8 +64,8 @@ int CompareDnsNames(const char *, const char *) paramsnonnull();
int PascalifyDnsName(uint8_t *, size_t, const char *) paramsnonnull(); int PascalifyDnsName(uint8_t *, size_t, const char *) paramsnonnull();
int ResolveDns(const struct ResolvConf *, int, const char *, struct sockaddr *, int ResolveDns(const struct ResolvConf *, int, const char *, struct sockaddr *,
uint32_t) paramsnonnull(); uint32_t) paramsnonnull();
int ResolveDnsReverse(const struct ResolvConf *resolvconf, int, const char *, int ResolveDnsReverse(const struct ResolvConf *, int, const char *, char *,
char *, size_t) paramsnonnull(); size_t) paramsnonnull();
struct addrinfo *newaddrinfo(uint16_t); struct addrinfo *newaddrinfo(uint16_t);
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_

View file

@ -1,7 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_DNS_ENT_H_ #ifndef COSMOPOLITAN_LIBC_DNS_ENT_H_
#define COSMOPOLITAN_LIBC_DNS_ENT_H_ #define COSMOPOLITAN_LIBC_DNS_ENT_H_
#include "libc/dns/dns.h" #include "libc/dns/dns.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_

View file

@ -50,7 +50,6 @@ int getaddrinfo(const char *name, const char *service,
struct addrinfo *ai; struct addrinfo *ai;
char proto[32]; char proto[32];
port = 0; port = 0;
if (!name && !service) return EAI_NONAME; if (!name && !service) return EAI_NONAME;
if (!name && (hints->ai_flags & AI_CANONNAME)) return EAI_BADFLAGS; if (!name && (hints->ai_flags & AI_CANONNAME)) return EAI_BADFLAGS;
if (service && (port = parseport(service)) == -1) { if (service && (port = parseport(service)) == -1) {
@ -60,11 +59,11 @@ int getaddrinfo(const char *name, const char *service,
strcpy(proto, "udp"); strcpy(proto, "udp");
else /* ai_socktype == 0 */ else /* ai_socktype == 0 */
strcpy(proto, ""); strcpy(proto, "");
if ((port = LookupServicesByName(service, proto, sizeof(proto), NULL, 0, if ((port = LookupServicesByName(service, proto, sizeof(proto), NULL, 0,
NULL)) == -1) NULL)) == -1) {
return EAI_NONAME; return EAI_NONAME;
} }
}
if (!(ai = newaddrinfo(port))) return EAI_MEMORY; if (!(ai = newaddrinfo(port))) return EAI_MEMORY;
if (service) ai->ai_addr4->sin_port = htons(port); if (service) ai->ai_addr4->sin_port = htons(port);
if (hints) { if (hints) {

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/ent.h" #include "libc/dns/ent.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
@ -35,35 +34,25 @@ struct hostent *gethostbyaddr(const void *s_addr, socklen_t len, int type) {
static char *h_aliases[1]; static char *h_aliases[1];
static char *h_addr_list[2]; static char *h_addr_list[2];
static char h_addr_list0[4]; static char h_addr_list0[4];
struct sockaddr_in addr; struct sockaddr_in addr;
if (!ptr1) { if (!ptr1) {
he1.h_name = h_name; he1.h_name = h_name;
he1.h_aliases = h_aliases; he1.h_aliases = h_aliases;
he1.h_aliases[0] = NULL; he1.h_aliases[0] = NULL;
he1.h_addrtype = AF_INET; he1.h_addrtype = AF_INET;
he1.h_length = 4; he1.h_length = 4;
he1.h_addr_list = h_addr_list; he1.h_addr_list = h_addr_list;
he1.h_addr_list[0] = h_addr_list0; he1.h_addr_list[0] = h_addr_list0;
he1.h_addr_list[1] = NULL; he1.h_addr_list[1] = NULL;
ptr1 = &he1; ptr1 = &he1;
} }
if (type != AF_INET || len != sizeof(uint32_t)) return NULL; if (type != AF_INET || len != sizeof(uint32_t)) return NULL;
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_port = 0; addr.sin_port = 0;
addr.sin_addr.s_addr = *(uint32_t *)(s_addr); addr.sin_addr.s_addr = *(uint32_t *)(s_addr);
if (getnameinfo((struct sockaddr *)&addr, sizeof(addr), ptr1->h_name, if (getnameinfo((struct sockaddr *)&addr, sizeof(addr), ptr1->h_name,
DNS_NAME_MAX, NULL, 0, 0)) DNS_NAME_MAX, NULL, 0, 0))
return NULL; return NULL;
*((uint32_t *)ptr1->h_addr_list[0]) = (addr.sin_addr.s_addr); *((uint32_t *)ptr1->h_addr_list[0]) = (addr.sin_addr.s_addr);
return ptr1; return ptr1;
} }

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/ent.h" #include "libc/dns/ent.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/bits/safemacros.internal.h" #include "libc/bits/safemacros.internal.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"

View file

@ -0,0 +1,41 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#include "libc/dns/prototxt.h"
#include "libc/nt/systeminfo.h"
textwindows char *GetNtProtocolsTxtPath(char *pathbuf, uint32_t size) {
/* protocol, not plural */
const char *const kWinHostsPath = "\\drivers\\etc\\protocol";
uint32_t len = GetSystemDirectoryA(&pathbuf[0], size);
if (len && len + strlen(kWinHostsPath) + 1 < size) {
if (pathbuf[len] == '\\') pathbuf[len--] = '\0';
memcpy(&pathbuf[len], kWinHostsPath, strlen(kWinHostsPath) + 1);
return &pathbuf[0];
} else {
return NULL;
}
}

View file

@ -0,0 +1,40 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#include "libc/dns/servicestxt.h"
#include "libc/nt/systeminfo.h"
textwindows char *GetNtServicesTxtPath(char *pathbuf, uint32_t size) {
const char *const kWinHostsPath = "\\drivers\\etc\\services";
uint32_t len = GetSystemDirectoryA(&pathbuf[0], size);
if (len && len + strlen(kWinHostsPath) + 1 < size) {
if (pathbuf[len] == '\\') pathbuf[len--] = '\0';
memcpy(&pathbuf[len], kWinHostsPath, strlen(kWinHostsPath) + 1);
return &pathbuf[0];
} else {
return NULL;
}
}

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/ent.h" #include "libc/dns/ent.h"
#include "libc/dns/prototxt.h" #include "libc/dns/prototxt.h"

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/ent.h" #include "libc/dns/ent.h"
#include "libc/dns/prototxt.h" #include "libc/dns/prototxt.h"

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/ent.h" #include "libc/dns/ent.h"
#include "libc/dns/servicestxt.h" #include "libc/dns/servicestxt.h"
@ -35,7 +34,6 @@ struct servent *getservbyname(const char *name, const char *proto) {
static char s_name[DNS_NAME_MAX + 1]; static char s_name[DNS_NAME_MAX + 1];
static char localproto[DNS_NAME_MAX + 1]; static char localproto[DNS_NAME_MAX + 1];
int p; int p;
if (!ptr0) { if (!ptr0) {
se0.s_name = s_name; se0.s_name = s_name;
if (!(se0.s_aliases = calloc(1, sizeof(char *)))) return NULL; if (!(se0.s_aliases = calloc(1, sizeof(char *)))) return NULL;
@ -43,17 +41,13 @@ struct servent *getservbyname(const char *name, const char *proto) {
se0.s_proto = localproto; se0.s_proto = localproto;
ptr0 = &se0; ptr0 = &se0;
} }
if (proto) { if (proto) {
if (!memccpy(localproto, proto, '\0', DNS_NAME_MAX)) return NULL; if (!memccpy(localproto, proto, '\0', DNS_NAME_MAX)) return NULL;
} else } else
strcpy(localproto, ""); strcpy(localproto, "");
p = LookupServicesByName(name, ptr0->s_proto, DNS_NAME_MAX, ptr0->s_name, p = LookupServicesByName(name, ptr0->s_proto, DNS_NAME_MAX, ptr0->s_name,
DNS_NAME_MAX, NULL); DNS_NAME_MAX, NULL);
if (p == -1) return NULL; if (p == -1) return NULL;
ptr0->s_port = htons(p); ptr0->s_port = htons(p);
return ptr0; return ptr0;
} }

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/ent.h" #include "libc/dns/ent.h"
#include "libc/dns/servicestxt.h" #include "libc/dns/servicestxt.h"
@ -34,7 +33,6 @@ struct servent *getservbyport(int port, const char *proto) {
static struct servent *ptr1, se1; static struct servent *ptr1, se1;
static char s_name[DNS_NAME_MAX + 1]; static char s_name[DNS_NAME_MAX + 1];
static char localproto[DNS_NAME_MAX + 1]; static char localproto[DNS_NAME_MAX + 1];
if (!ptr1) { if (!ptr1) {
se1.s_name = s_name; se1.s_name = s_name;
if (!(se1.s_aliases = calloc(1, sizeof(char *)))) return NULL; if (!(se1.s_aliases = calloc(1, sizeof(char *)))) return NULL;
@ -42,16 +40,14 @@ struct servent *getservbyport(int port, const char *proto) {
se1.s_proto = localproto; se1.s_proto = localproto;
ptr1 = &se1; ptr1 = &se1;
} }
if (proto) { if (proto) {
if (!memccpy(localproto, proto, '\0', DNS_NAME_MAX)) return NULL; if (!memccpy(localproto, proto, '\0', DNS_NAME_MAX)) return NULL;
} else } else
strcpy(localproto, ""); strcpy(localproto, "");
if (LookupServicesByPort(ntohs(port), ptr1->s_proto, DNS_NAME_MAX, if (LookupServicesByPort(ntohs(port), ptr1->s_proto, DNS_NAME_MAX,
ptr1->s_name, DNS_NAME_MAX, NULL) == -1) ptr1->s_name, DNS_NAME_MAX, NULL) == -1) {
return NULL; return NULL;
}
ptr1->s_port = port; ptr1->s_port = port;
return ptr1; return ptr1;
} }

View file

@ -23,11 +23,10 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/ent.h" #include "libc/dns/ent.h"
int h_errno = 0; int h_errno;
void herror(const char *s) { void herror(const char *s) {
} }

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/ent.h" #include "libc/dns/ent.h"

View file

@ -23,103 +23,12 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/prototxt.h"
#include "libc/bits/safemacros.internal.h" #include "libc/bits/safemacros.internal.h"
#include "libc/dce.h" #include "libc/dns/prototxt.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/nt/systeminfo.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
static textwindows noinline char *GetNtProtocolsTxtPath(char *pathbuf,
uint32_t size) {
/* protocol, not plural */
const char *const kWinHostsPath = "\\drivers\\etc\\protocol";
uint32_t len = GetSystemDirectoryA(&pathbuf[0], size);
if (len && len + strlen(kWinHostsPath) + 1 < size) {
if (pathbuf[len] == '\\') pathbuf[len--] = '\0';
memcpy(&pathbuf[len], kWinHostsPath, strlen(kWinHostsPath) + 1);
return &pathbuf[0];
} else {
return NULL;
}
}
/**
* Opens and searches /etc/protocols to find name for a given number.
*
* format of /etc/protocols is like this:
*
* # comment
* # NAME PROTOCOL ALIASES
* ip 0 IP
* icmp 1 ICMP
*
* @param protonum is the protocol number
* @param buf is a buffer to store the official name of the protocol
* @param bufsize is the size of buf
* @param filepath is the location of the protocols file
* (if NULL, uses /etc/protocols)
* @return 0 on success, -1 on error
*
* @note aliases are not read from the file.
*/
int LookupProtoByNumber(const int protonum, char *buf, size_t bufsize,
const char *filepath) {
FILE *f;
char *line;
char pathbuf[PATH_MAX];
const char *path;
size_t linesize;
int found;
char *name, *number, *comment, *tok;
if (!(path = filepath)) {
path = "/etc/protocols";
if (IsWindows()) {
path =
firstnonnull(GetNtProtocolsTxtPath(pathbuf, ARRAYLEN(pathbuf)), path);
}
}
if (bufsize == 0 || !(f = fopen(path, "r"))) {
return -1;
}
line = NULL;
linesize = 0;
found = 0;
while (found == 0 && (getline(&line, &linesize, f)) != -1) {
if ((comment = strchr(line, '#'))) *comment = '\0';
name = strtok_r(line, " \t\r\n\v", &tok);
number = strtok_r(NULL, " \t\r\n\v", &tok);
if (name && number && protonum == atoi(number)) {
if (!memccpy(buf, name, '\0', bufsize)) {
strcpy(buf, "");
break;
}
found = 1;
}
}
free(line);
if (ferror(f)) {
errno = ferror(f);
return -1;
}
fclose(f);
if (!found) return -1;
return 0;
}
/** /**
* Opens and searches /etc/protocols to find number for a given name. * Opens and searches /etc/protocols to find number for a given name.
@ -144,7 +53,6 @@ int LookupProtoByName(const char *protoname, char *buf, size_t bufsize,
size_t linesize; size_t linesize;
int found, result; int found, result;
char *name, *number, *alias, *comment, *tok; char *name, *number, *alias, *comment, *tok;
if (!(path = filepath)) { if (!(path = filepath)) {
path = "/etc/protocols"; path = "/etc/protocols";
if (IsWindows()) { if (IsWindows()) {
@ -152,7 +60,6 @@ int LookupProtoByName(const char *protoname, char *buf, size_t bufsize,
firstnonnull(GetNtProtocolsTxtPath(pathbuf, ARRAYLEN(pathbuf)), path); firstnonnull(GetNtProtocolsTxtPath(pathbuf, ARRAYLEN(pathbuf)), path);
} }
} }
if (bufsize == 0 || !(f = fopen(path, "r"))) { if (bufsize == 0 || !(f = fopen(path, "r"))) {
return -1; return -1;
} }
@ -160,7 +67,6 @@ int LookupProtoByName(const char *protoname, char *buf, size_t bufsize,
linesize = 0; linesize = 0;
found = 0; found = 0;
result = -1; result = -1;
while (found == 0 && (getline(&line, &linesize, f)) != -1) { while (found == 0 && (getline(&line, &linesize, f)) != -1) {
if ((comment = strchr(line, '#'))) *comment = '\0'; if ((comment = strchr(line, '#'))) *comment = '\0';
name = strtok_r(line, " \t\r\n\v", &tok); name = strtok_r(line, " \t\r\n\v", &tok);
@ -169,7 +75,6 @@ int LookupProtoByName(const char *protoname, char *buf, size_t bufsize,
alias = name; alias = name;
while (alias && strcasecmp(alias, protoname) != 0) while (alias && strcasecmp(alias, protoname) != 0)
alias = strtok_r(NULL, " \t\r\n\v", &tok); alias = strtok_r(NULL, " \t\r\n\v", &tok);
if (alias) /* alias matched with protoname */ if (alias) /* alias matched with protoname */
{ {
if (!memccpy(buf, name, '\0', bufsize)) { if (!memccpy(buf, name, '\0', bufsize)) {
@ -182,14 +87,11 @@ int LookupProtoByName(const char *protoname, char *buf, size_t bufsize,
} }
} }
free(line); free(line);
if (ferror(f)) { if (ferror(f)) {
errno = ferror(f); errno = ferror(f);
return -1; return -1;
} }
fclose(f); fclose(f);
if (!found) return -1; if (!found) return -1;
return result; return result;
} }

View file

@ -0,0 +1,93 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#include "libc/bits/safemacros.internal.h"
#include "libc/dns/prototxt.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/macros.internal.h"
/**
* Opens and searches /etc/protocols to find name for a given number.
*
* The format of /etc/protocols is like this:
*
* # comment
* # NAME PROTOCOL ALIASES
* ip 0 IP
* icmp 1 ICMP
*
* @param protonum is the protocol number
* @param buf is a buffer to store the official name of the protocol
* @param bufsize is the size of buf
* @param filepath is the location of the protocols file
* (if NULL, uses /etc/protocols)
* @return 0 on success, -1 on error
* @note aliases are not read from the file.
*/
int LookupProtoByNumber(const int protonum, char *buf, size_t bufsize,
const char *filepath) {
FILE *f;
char *line;
char pathbuf[PATH_MAX];
const char *path;
size_t linesize;
int found;
char *name, *number, *comment, *tok;
if (!(path = filepath)) {
path = "/etc/protocols";
if (IsWindows()) {
path =
firstnonnull(GetNtProtocolsTxtPath(pathbuf, ARRAYLEN(pathbuf)), path);
}
}
if (bufsize == 0 || !(f = fopen(path, "r"))) {
return -1;
}
line = NULL;
linesize = 0;
found = 0;
while (found == 0 && (getline(&line, &linesize, f)) != -1) {
if ((comment = strchr(line, '#'))) *comment = '\0';
name = strtok_r(line, " \t\r\n\v", &tok);
number = strtok_r(NULL, " \t\r\n\v", &tok);
if (name && number && protonum == atoi(number)) {
if (!memccpy(buf, name, '\0', bufsize)) {
strcpy(buf, "");
break;
}
found = 1;
}
}
free(line);
if (ferror(f)) {
errno = ferror(f);
return -1;
}
fclose(f);
if (!found) return -1;
return 0;
}

View file

@ -23,117 +23,12 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/servicestxt.h"
#include "libc/bits/safemacros.internal.h" #include "libc/bits/safemacros.internal.h"
#include "libc/dce.h" #include "libc/dns/servicestxt.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/nt/systeminfo.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
static textwindows noinline char *GetNtServicesTxtPath(char *pathbuf,
uint32_t size) {
const char *const kWinHostsPath = "\\drivers\\etc\\services";
uint32_t len = GetSystemDirectoryA(&pathbuf[0], size);
if (len && len + strlen(kWinHostsPath) + 1 < size) {
if (pathbuf[len] == '\\') pathbuf[len--] = '\0';
memcpy(&pathbuf[len], kWinHostsPath, strlen(kWinHostsPath) + 1);
return &pathbuf[0];
} else {
return NULL;
}
}
/**
* Opens and searches /etc/services to find name for a given port.
*
* format of /etc/services is like this:
*
* # comment
* # NAME PORT/PROTOCOL ALIASES
* ftp 21/tcp
* fsp 21/udp fspd
* ssh 22/tcp
*
* @param servport is the port number
* @param servproto is a NULL-terminated string (eg "tcp", "udp")
* (if servproto is an empty string,
* if is filled with the first matching
* protocol)
* @param servprotolen the size of servproto
* @param buf is a buffer to store the official name of the service
* @param bufsize is the size of buf
* @param filepath is the location of the services file
* (if NULL, uses /etc/services)
* @return 0 on success, -1 on error
*
* @note aliases are not read from the file.
*/
int LookupServicesByPort(const int servport, char *servproto,
size_t servprotolen, char *buf, size_t bufsize,
const char *filepath) {
FILE *f;
char *line;
char pathbuf[PATH_MAX];
const char *path;
size_t linesize;
int found;
char *name, *port, *proto, *comment, *tok;
if (!(path = filepath)) {
path = "/etc/services";
if (IsWindows()) {
path =
firstnonnull(GetNtServicesTxtPath(pathbuf, ARRAYLEN(pathbuf)), path);
}
}
if (servprotolen == 0 || bufsize == 0 || !(f = fopen(path, "r"))) {
return -1;
}
line = NULL;
linesize = 0;
found = 0;
strcpy(buf, "");
while (found == 0 && (getline(&line, &linesize, f)) != -1) {
if ((comment = strchr(line, '#'))) *comment = '\0';
name = strtok_r(line, " \t\r\n\v", &tok);
port = strtok_r(NULL, "/ \t\r\n\v", &tok);
proto = strtok_r(NULL, " \t\r\n\v", &tok);
if (name && port && proto && servport == atoi(port)) {
if (!servproto[0] || strncasecmp(proto, servproto, servprotolen) == 0) {
if (!servproto[0] && !memccpy(servproto, proto, '\0', servprotolen)) {
strcpy(servproto, "");
break;
}
if (!memccpy(buf, name, '\0', bufsize)) {
strcpy(buf, "");
break;
}
found = 1;
}
}
}
free(line);
if (ferror(f)) {
errno = ferror(f);
return -1;
}
fclose(f);
if (!found) return -1;
return 0;
}
/** /**
* Opens and searches /etc/services to find port for a given name. * Opens and searches /etc/services to find port for a given name.
@ -149,9 +44,7 @@ int LookupServicesByPort(const int servport, char *servproto,
* @param bufsize is the size of buf * @param bufsize is the size of buf
* @param filepath is the location of services file * @param filepath is the location of services file
* (if NULL, uses /etc/services) * (if NULL, uses /etc/services)
* @return -1 on error, or * @return -1 on error, or positive port number
* positive port number
*
* @note aliases are read from file for comparison, but not returned. * @note aliases are read from file for comparison, but not returned.
* @see LookupServicesByPort * @see LookupServicesByPort
*/ */
@ -165,7 +58,6 @@ int LookupServicesByName(const char *servname, char *servproto,
size_t linesize; size_t linesize;
int found, result; int found, result;
char *name, *port, *proto, *alias, *comment, *tok; char *name, *port, *proto, *alias, *comment, *tok;
if (!(path = filepath)) { if (!(path = filepath)) {
path = "/etc/services"; path = "/etc/services";
if (IsWindows()) { if (IsWindows()) {
@ -173,7 +65,6 @@ int LookupServicesByName(const char *servname, char *servproto,
firstnonnull(GetNtServicesTxtPath(pathbuf, ARRAYLEN(pathbuf)), path); firstnonnull(GetNtServicesTxtPath(pathbuf, ARRAYLEN(pathbuf)), path);
} }
} }
if (servprotolen == 0 || !(f = fopen(path, "r"))) { if (servprotolen == 0 || !(f = fopen(path, "r"))) {
return -1; return -1;
} }
@ -182,7 +73,6 @@ int LookupServicesByName(const char *servname, char *servproto,
found = 0; found = 0;
result = -1; result = -1;
if (buf && bufsize != 0) strcpy(buf, ""); if (buf && bufsize != 0) strcpy(buf, "");
while (found == 0 && (getline(&line, &linesize, f)) != -1) { while (found == 0 && (getline(&line, &linesize, f)) != -1) {
if ((comment = strchr(line, '#'))) *comment = '\0'; if ((comment = strchr(line, '#'))) *comment = '\0';
name = strtok_r(line, " \t\r\n\v", &tok); name = strtok_r(line, " \t\r\n\v", &tok);
@ -192,7 +82,6 @@ int LookupServicesByName(const char *servname, char *servproto,
alias = name; alias = name;
while (alias && strcasecmp(alias, servname) != 0) while (alias && strcasecmp(alias, servname) != 0)
alias = strtok_r(NULL, " \t\r\n\v", &tok); alias = strtok_r(NULL, " \t\r\n\v", &tok);
if (alias) /* alias matched with servname */ if (alias) /* alias matched with servname */
{ {
if (!servproto[0] || strncasecmp(proto, servproto, servprotolen) == 0) { if (!servproto[0] || strncasecmp(proto, servproto, servprotolen) == 0) {
@ -211,14 +100,11 @@ int LookupServicesByName(const char *servname, char *servproto,
} }
} }
free(line); free(line);
if (ferror(f)) { if (ferror(f)) {
errno = ferror(f); errno = ferror(f);
return -1; return -1;
} }
fclose(f); fclose(f);
if (!found) return -1; if (!found) return -1;
return result; return result;
} }

View file

@ -0,0 +1,108 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
#include "libc/bits/safemacros.internal.h"
#include "libc/dns/servicestxt.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/macros.internal.h"
/**
* Opens and searches /etc/services to find name for a given port.
*
* The format of /etc/services is like this:
*
* # comment
* # NAME PORT/PROTOCOL ALIASES
* ftp 21/tcp
* fsp 21/udp fspd
* ssh 22/tcp
*
* @param servport is the port number
* @param servproto is a NULL-terminated string (eg "tcp", "udp")
* (if servproto is an empty string,
* if is filled with the first matching
* protocol)
* @param servprotolen the size of servproto
* @param buf is a buffer to store the official name of the service
* @param bufsize is the size of buf
* @param filepath is the location of the services file
* (if NULL, uses /etc/services)
* @return 0 on success, -1 on error
* @note aliases are not read from the file.
*/
int LookupServicesByPort(const int servport, char *servproto,
size_t servprotolen, char *buf, size_t bufsize,
const char *filepath) {
FILE *f;
char *line;
char pathbuf[PATH_MAX];
const char *path;
size_t linesize;
int found;
char *name, *port, *proto, *comment, *tok;
if (!(path = filepath)) {
path = "/etc/services";
if (IsWindows()) {
path =
firstnonnull(GetNtServicesTxtPath(pathbuf, ARRAYLEN(pathbuf)), path);
}
}
if (servprotolen == 0 || bufsize == 0 || !(f = fopen(path, "r"))) {
return -1;
}
line = NULL;
linesize = 0;
found = 0;
strcpy(buf, "");
while (found == 0 && (getline(&line, &linesize, f)) != -1) {
if ((comment = strchr(line, '#'))) *comment = '\0';
name = strtok_r(line, " \t\r\n\v", &tok);
port = strtok_r(NULL, "/ \t\r\n\v", &tok);
proto = strtok_r(NULL, " \t\r\n\v", &tok);
if (name && port && proto && servport == atoi(port)) {
if (!servproto[0] || strncasecmp(proto, servproto, servprotolen) == 0) {
if (!servproto[0] && !memccpy(servproto, proto, '\0', servprotolen)) {
strcpy(servproto, "");
break;
}
if (!memccpy(buf, name, '\0', bufsize)) {
strcpy(buf, "");
break;
}
found = 1;
}
}
}
free(line);
if (ferror(f)) {
errno = ferror(f);
return -1;
}
fclose(f);
if (!found) return -1;
return 0;
}

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/ent.h" #include "libc/dns/ent.h"

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/ent.h" #include "libc/dns/ent.h"

View file

@ -2,7 +2,6 @@
#define COSMOPOLITAN_LIBC_DNS_PROTOTXT_H_ #define COSMOPOLITAN_LIBC_DNS_PROTOTXT_H_
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
@ -10,6 +9,7 @@ int LookupProtoByNumber(const int, char *, size_t, const char *)
paramsnonnull((2)); paramsnonnull((2));
int LookupProtoByName(const char *, char *, size_t, const char *) int LookupProtoByName(const char *, char *, size_t, const char *)
paramsnonnull((1, 2)); paramsnonnull((1, 2));
char *GetNtProtocolsTxtPath(char *, uint32_t);
/* TODO: implement like struct HostsTxt? */ /* TODO: implement like struct HostsTxt? */

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/bits/bits.h" #include "libc/bits/bits.h"
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
@ -52,7 +51,6 @@
* @param name is a reversed IP address string ending with .in-addr.arpa * @param name is a reversed IP address string ending with .in-addr.arpa
* @param buf to store the obtained hostname if any * @param buf to store the obtained hostname if any
* @param bufsize is size of buf * @param bufsize is size of buf
*
* @return 0 on success, or -1 w/ errno * @return 0 on success, or -1 w/ errno
* @error EAFNOSUPPORT, ENETDOWN, ENAMETOOLONG, EBADMSG * @error EAFNOSUPPORT, ENETDOWN, ENAMETOOLONG, EBADMSG
*/ */
@ -63,7 +61,6 @@ int ResolveDnsReverse(const struct ResolvConf *resolvconf, int af,
struct DnsHeader h, h2; struct DnsHeader h, h2;
uint8_t *p, *pe, msg[512]; uint8_t *p, *pe, msg[512];
uint16_t rtype, rclass, rdlength; uint16_t rtype, rclass, rdlength;
if (af != AF_INET && af != AF_UNSPEC) return eafnosupport(); if (af != AF_INET && af != AF_UNSPEC) return eafnosupport();
if (!resolvconf->nameservers.i) return 0; if (!resolvconf->nameservers.i) return 0;
memset(&h, 0, sizeof(h)); memset(&h, 0, sizeof(h));
@ -76,7 +73,6 @@ int ResolveDnsReverse(const struct ResolvConf *resolvconf, int af,
q.qclass = DNS_CLASS_IN; q.qclass = DNS_CLASS_IN;
memset(msg, 0, sizeof(msg)); memset(msg, 0, sizeof(msg));
SerializeDnsHeader(msg, &h); SerializeDnsHeader(msg, &h);
if ((n = SerializeDnsQuestion(msg + 12, 500, &q)) == -1) return -1; if ((n = SerializeDnsQuestion(msg + 12, 500, &q)) == -1) return -1;
if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) return -1; if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) return -1;
if (sendto(fd, msg, 12 + n, 0, resolvconf->nameservers.p, if (sendto(fd, msg, 12 + n, 0, resolvconf->nameservers.p,
@ -103,7 +99,6 @@ int ResolveDnsReverse(const struct ResolvConf *resolvconf, int af,
rclass = READ16BE(p), p += 2; rclass = READ16BE(p), p += 2;
/* ttl */ p += 4; /* ttl */ p += 4;
rdlength = READ16BE(p), p += 2; rdlength = READ16BE(p), p += 2;
if (p + rdlength <= pe && rtype == DNS_TYPE_PTR && if (p + rdlength <= pe && rtype == DNS_TYPE_PTR &&
rclass == DNS_CLASS_IN) { rclass == DNS_CLASS_IN) {
if (strnlen((char *)p, pe - p) + 1 > bufsize) if (strnlen((char *)p, pe - p) + 1 > bufsize)

View file

@ -23,7 +23,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include "libc/dns/ent.h" #include "libc/dns/ent.h"

View file

@ -2,7 +2,6 @@
#define COSMOPOLITAN_LIBC_DNS_SERVICESTXT_H_ #define COSMOPOLITAN_LIBC_DNS_SERVICESTXT_H_
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
@ -10,6 +9,7 @@ int LookupServicesByPort(const int, char *, size_t, char *, size_t,
const char *) paramsnonnull((2, 4)); const char *) paramsnonnull((2, 4));
int LookupServicesByName(const char *, char *, size_t, char *, size_t, int LookupServicesByName(const char *, char *, size_t, char *, size_t,
const char *) paramsnonnull((1, 2)); const char *) paramsnonnull((1, 2));
char *GetNtServicesTxtPath(char *, uint32_t);
/* TODO: implement like struct HostsTxt? */ /* TODO: implement like struct HostsTxt? */

View file

@ -22,7 +22,6 @@
#include "libc/log/internal.h" #include "libc/log/internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/fileno.h"
/** /**
* Prints initial part of fatal message. * Prints initial part of fatal message.
@ -31,18 +30,21 @@
* @see __start_fatal_ndebug() * @see __start_fatal_ndebug()
*/ */
relegated void __start_fatal(const char *file, int line) { relegated void __start_fatal(const char *file, int line) {
char s[16 + 16 + 16 + 16 + PATH_MAX + 16 + NAME_MAX + 16], *p; bool colorful;
p = stpcpy(s, CLS); char s[16 + 16 + 16 + 16 + PATH_MAX + 16 + NAME_MAX + 16], *p = s;
p = stpcpy(p, RED); colorful = cancolor();
*p++ = '\r';
if (colorful) p = stpcpy(p, "\e[J\e[30;101m");
p = stpcpy(p, "error"); p = stpcpy(p, "error");
p = stpcpy(p, BLUE1); if (colorful) p = stpcpy(p, "\e[94;49m");
p = stpcpy(p, ":"); *p++ = ':';
p = stpcpy(p, file); p = stpcpy(p, file);
p = stpcpy(p, ":"); *p++ = ':';
p += int64toarray_radix10(line, p); p += int64toarray_radix10(line, p);
p = stpcpy(p, ":"); *p++ = ':';
p = stpcpy(p, program_invocation_short_name); p = stpcpy(p, program_invocation_short_name);
p = stpcpy(p, RESET); if (colorful) p = stpcpy(p, "\e[0m");
p = stpcpy(p, ": "); *p++ = ':';
*p++ = ' ';
write(2, s, p - s); write(2, s, p - s);
} }

View file

@ -16,8 +16,9 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/calls/calls.h"
#include "libc/log/color.internal.h" #include "libc/log/color.internal.h"
#include "libc/runtime/runtime.h" #include "libc/log/internal.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
/** /**
@ -27,8 +28,11 @@
* @see __start_fatal() * @see __start_fatal()
*/ */
relegated void __start_fatal_ndebug(void) { relegated void __start_fatal_ndebug(void) {
if (cancolor()) __print_string("\r\e[J"); char s[16 + 16 + 16 + 16 + PATH_MAX + 16], *p = s;
__print_string("error:"); *p++ = '\r';
__print_string(program_invocation_name); if (cancolor()) p = stpcpy(p, "\e[J");
__print_string(": "); p = stpcpy(p, "error:");
p = stpcpy(p, program_invocation_name);
p = stpcpy(p, ": ");
write(2, s, p - s);
} }

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/boolobject.h"
#include "third_party/python/Include/descrobject.h" #include "third_party/python/Include/descrobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/longobject.h" #include "third_party/python/Include/longobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/bytesobject.h" #include "third_party/python/Include/bytesobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/modsupport.h" #include "third_party/python/Include/modsupport.h"
#include "third_party/python/Include/object.h" #include "third_party/python/Include/object.h"
#include "third_party/python/Include/pymacro.h" #include "third_party/python/Include/pymacro.h"

View file

@ -1,4 +1,11 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
/* clang-format off */ /* clang-format off */
/* /*
* Interface to the ncurses panel library * Interface to the ncurses panel library
* *

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/assert.h" #include "libc/assert.h"
#include "libc/calls/weirdtypes.h" #include "libc/calls/weirdtypes.h"
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -27,7 +27,6 @@
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/boolobject.h"
@ -5946,5 +5945,3 @@ error:
return NULL; /* GCOV_NOT_REACHED */ return NULL; /* GCOV_NOT_REACHED */
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -654,6 +654,3 @@ _mpd_shortdiv_b(mpd_uint_t *w, const mpd_uint_t *u, mpd_size_t n,
return rem; return rem;
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -133,5 +133,3 @@ const char *mpd_clamp_string[MPD_CLAMP_GUARD] = {
"CLAMP_DEFAULT", "CLAMP_DEFAULT",
"CLAMP_IEEE_754" "CLAMP_IEEE_754"
}; };

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -287,5 +287,3 @@ mpd_addstatus_raise(mpd_context_t *ctx, uint32_t flags)
mpd_traphandler(ctx); mpd_traphandler(ctx);
} }
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -176,5 +176,3 @@ fnt_autoconvolute(mpd_uint_t *c1, mpd_size_t n, int modnum)
return 1; return 1;
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -174,5 +174,3 @@ fnt_dif2(mpd_uint_t a[], mpd_size_t n, struct fnt_params *tparams)
bitreverse_permute(a, n); bitreverse_permute(a, n);
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -81,6 +81,3 @@ std_inv_fnt(mpd_uint_t *a, mpd_size_t n, int modnum)
mpd_free(tparams); mpd_free(tparams);
return 1; return 1;
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -259,5 +259,3 @@ inv_four_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum)
return 1; return 1;
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -1581,5 +1581,3 @@ mpd_print(const mpd_t *dec)
fputs("mpd_fprint: output error\n", stderr); /* GCOV_NOT_REACHED */ fputs("mpd_fprint: output error\n", stderr); /* GCOV_NOT_REACHED */
} }
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -292,5 +292,3 @@ mpd_realloc_dyn(mpd_t *result, mpd_ssize_t nwords, uint32_t *status)
return 1; return 1;
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -8399,6 +8399,3 @@ mpd_qimport_u32(mpd_t *result,
mpd_qresize(result, result->len, status); mpd_qresize(result, result->len, status);
mpd_qfinalize(result, ctx, status); mpd_qfinalize(result, ctx, status);
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -133,5 +133,3 @@ _mpd_init_w3table(mpd_uint_t w3table[3], int sign, int modnum)
w3table[1] = kernel; w3table[1] = kernel;
w3table[2] = POWMOD(kernel, 2); w3table[2] = POWMOD(kernel, 2);
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -214,5 +214,3 @@ inv_six_step_fnt(mpd_uint_t *a, mpd_size_t n, int modnum)
return 1; return 1;
} }

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Copyright (c) 2008-2016 Stefan Krah. All rights reserved. Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
@ -274,5 +274,3 @@ transpose_pow2(mpd_uint_t *matrix, mpd_size_t rows, mpd_size_t cols)
return 1; return 1;
} }

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/bytesobject.h" #include "third_party/python/Include/bytesobject.h"
@ -17,6 +23,7 @@
#include "third_party/python/Include/structmember.h" #include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/warnings.h" #include "third_party/python/Include/warnings.h"
/* clang-format off */ /* clang-format off */
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
* Licensed to PSF under a Contributor Agreement. * Licensed to PSF under a Contributor Agreement.
* See http://www.python.org/psf/license for licensing details. * See http://www.python.org/psf/license for licensing details.

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
/* clang-format off */ /* clang-format off */
/* DBM module using dictionary interface */ /* DBM module using dictionary interface */

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/assert.h" #include "libc/assert.h"
#include "third_party/python/Include/listobject.h" #include "third_party/python/Include/listobject.h"
#include "third_party/python/Include/modsupport.h" #include "third_party/python/Include/modsupport.h"
@ -13,7 +19,6 @@ annotated by François Pinard, and converted to C by Raymond Hettinger.
*/ */
static int static int
siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos)
{ {

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3 Python 3
https://docs.python.org/3/license.html │ https://docs.python.org/3/license.html │
@ -21,6 +21,7 @@
#include "third_party/python/Include/weakrefobject.h" #include "third_party/python/Include/weakrefobject.h"
#include "third_party/python/Modules/_io/_iomodule.h" #include "third_party/python/Modules/_io/_iomodule.h"
/* clang-format off */ /* clang-format off */
/* /*
An implementation of the new I/O lib as defined by PEP 3116 - "New I/O" An implementation of the new I/O lib as defined by PEP 3116 - "New I/O"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "libc/errno.h" #include "libc/errno.h"
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/assert.h" #include "libc/assert.h"
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/boolobject.h"

View file

@ -1,5 +1,5 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*- /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ │vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi│
╞══════════════════════════════════════════════════════════════════════════════╡ ╞══════════════════════════════════════════════════════════════════════════════╡
Python 3 Python 3
https://docs.python.org/3/license.html https://docs.python.org/3/license.html

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/errno.h" #include "libc/errno.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/boolobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/accu.h" #include "third_party/python/Include/accu.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/boolobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Modules/_io/_iomodule.h" #include "third_party/python/Modules/_io/_iomodule.h"
/* clang-format off */ /* clang-format off */

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "libc/unicode/locale.h" #include "libc/unicode/locale.h"
#include "third_party/python/Include/dictobject.h" #include "third_party/python/Include/dictobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Include/structmember.h" #include "third_party/python/Include/structmember.h"
/* clang-format off */ /* clang-format off */

View file

@ -1,5 +1,12 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Modules/_multiprocessing/multiprocessing.h" #include "third_party/python/Modules/_multiprocessing/multiprocessing.h"
/* clang-format off */ /* clang-format off */
/* /*
* Extension module used by multiprocessing package * Extension module used by multiprocessing package
* *

View file

@ -1,5 +1,12 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Modules/_multiprocessing/multiprocessing.h" #include "third_party/python/Modules/_multiprocessing/multiprocessing.h"
/* clang-format off */ /* clang-format off */
/* /*
* A type which wraps a semaphore * A type which wraps a semaphore
* *

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/compile.h" #include "third_party/python/Include/compile.h"
#include "third_party/python/Include/longobject.h" #include "third_party/python/Include/longobject.h"
#include "third_party/python/Include/modsupport.h" #include "third_party/python/Include/modsupport.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/boolobject.h"
#include "third_party/python/Include/dictobject.h" #include "third_party/python/Include/dictobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/weirdtypes.h" #include "libc/calls/weirdtypes.h"
#include "libc/dce.h" #include "libc/dce.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "third_party/python/Include/floatobject.h" #include "third_party/python/Include/floatobject.h"
#include "third_party/python/Include/longobject.h" #include "third_party/python/Include/longobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/bytesobject.h" #include "third_party/python/Include/bytesobject.h"
#include "third_party/python/Include/descrobject.h" #include "third_party/python/Include/descrobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/boolobject.h"
#include "third_party/python/Include/bytesobject.h" #include "third_party/python/Include/bytesobject.h"

View file

@ -1,4 +1,11 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Modules/socketmodule.h"
/* clang-format off */ /* clang-format off */
/* SSL socket module /* SSL socket module
@ -39,7 +46,6 @@
#endif #endif
/* Include symbols from _socket module */ /* Include symbols from _socket module */
#include "third_party/python/Modules/socketmodule.h"
static PySocketModule_APIObject PySocketModule; static PySocketModule_APIObject PySocketModule;

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/weirdtypes.h" #include "libc/calls/weirdtypes.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "libc/assert.h" #include "libc/assert.h"
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/boolobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#undef Py_BUILD_CORE #undef Py_BUILD_CORE
#include "libc/calls/calls.h" #include "libc/calls/calls.h"

View file

@ -1,58 +0,0 @@
/* clang-format off */
/*
* C extensions module to test importing multiple modules from one compiled
* file (issue16421). This file defines 3 modules (_testimportmodule,
* foo, bar), only the first one is called the same as the compiled file.
*/
#include<Python.h>
static struct PyModuleDef _testimportmultiple = {
PyModuleDef_HEAD_INIT,
"_testimportmultiple",
"_testimportmultiple doc",
-1,
NULL,
NULL,
NULL,
NULL,
NULL
};
PyMODINIT_FUNC PyInit__testimportmultiple(void)
{
return PyModule_Create(&_testimportmultiple);
}
static struct PyModuleDef _foomodule = {
PyModuleDef_HEAD_INIT,
"_testimportmultiple_foo",
"_testimportmultiple_foo doc",
-1,
NULL,
NULL,
NULL,
NULL,
NULL
};
PyMODINIT_FUNC PyInit__testimportmultiple_foo(void)
{
return PyModule_Create(&_foomodule);
}
static struct PyModuleDef _barmodule = {
PyModuleDef_HEAD_INIT,
"_testimportmultiple_bar",
"_testimportmultiple_bar doc",
-1,
NULL,
NULL,
NULL,
NULL,
NULL
};
PyMODINIT_FUNC PyInit__testimportmultiple_bar(void){
return PyModule_Create(&_barmodule);
}

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/dictobject.h" #include "third_party/python/Include/dictobject.h"
#include "third_party/python/Include/longobject.h" #include "third_party/python/Include/longobject.h"
#include "third_party/python/Include/methodobject.h" #include "third_party/python/Include/methodobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/structmember.h" #include "third_party/python/Include/structmember.h"
/* clang-format off */ /* clang-format off */

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/boolobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/dictobject.h" #include "third_party/python/Include/dictobject.h"
#include "third_party/python/Include/listobject.h" #include "third_party/python/Include/listobject.h"
#include "third_party/python/Include/longobject.h" #include "third_party/python/Include/longobject.h"

View file

@ -1,4 +1,14 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/Python.h"
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Modules/winreparse.h"
/* clang-format off */ /* clang-format off */
/* /*
* Support routines from the Windows API * Support routines from the Windows API
* *
@ -35,10 +45,6 @@
/* Licensed to PSF under a Contributor Agreement. */ /* Licensed to PSF under a Contributor Agreement. */
/* See http://www.python.org/2.4/license for licensing details. */ /* See http://www.python.org/2.4/license for licensing details. */
#include "third_party/python/Include/Python.h"
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Modules/winreparse.h"
#if defined(MS_WIN32) && !defined(MS_WIN64) #if defined(MS_WIN32) && !defined(MS_WIN64)
#define HANDLE_TO_PYNUM(handle) \ #define HANDLE_TO_PYNUM(handle) \
PyLong_FromUnsignedLong((unsigned long) handle) PyLong_FromUnsignedLong((unsigned long) handle)

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/boolobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/longobject.h" #include "third_party/python/Include/longobject.h"
#include "third_party/python/Include/modsupport.h" #include "third_party/python/Include/modsupport.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "libc/math.h" #include "libc/math.h"
#include "third_party/python/Include/dictobject.h" #include "third_party/python/Include/dictobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "libc/assert.h" #include "libc/assert.h"
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
@ -12,6 +18,7 @@
#include "third_party/python/Include/unicodeobject.h" #include "third_party/python/Include/unicodeobject.h"
#include "third_party/zlib/zlib.h" #include "third_party/zlib/zlib.h"
/* clang-format off */ /* clang-format off */
/* /*
** Routines to represent binary data in ASCII and vice-versa ** Routines to represent binary data in ASCII and vice-versa
** **
@ -153,8 +160,6 @@ static const char table_a2b_base64[] = {
static const unsigned char table_b2a_base64[] = static const unsigned char table_b2a_base64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const unsigned short crctab_hqx[256] = { static const unsigned short crctab_hqx[256] = {
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
@ -1411,11 +1416,9 @@ static struct PyMethodDef binascii_module_methods[] = {
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };
/* Initialization function for the module (*must* be called PyInit_binascii) */ /* Initialization function for the module (*must* be called PyInit_binascii) */
PyDoc_STRVAR(doc_binascii, "Conversion between binary data and ASCII"); PyDoc_STRVAR(doc_binascii, "Conversion between binary data and ASCII");
static struct PyModuleDef binasciimodule = { static struct PyModuleDef binasciimodule = {
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"binascii", "binascii",

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h" #include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Modules/cjkcodecs/mappings_cn.inc" #include "third_party/python/Modules/cjkcodecs/mappings_cn.inc"
/* clang-format off */ /* clang-format off */

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define USING_IMPORTED_MAPS #define USING_IMPORTED_MAPS
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h" #include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Modules/cjkcodecs/mappings_hk.inc" #include "third_party/python/Modules/cjkcodecs/mappings_hk.inc"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
/* clang-format off */ /* clang-format off */
/* /*
* _codecs_iso2022.c: Codecs collection for ISO-2022 encodings. * _codecs_iso2022.c: Codecs collection for ISO-2022 encodings.

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
/* clang-format off */ /* clang-format off */
/* /*
* _codecs_jp.c: Codecs collection for Japanese encodings * _codecs_jp.c: Codecs collection for Japanese encodings

View file

@ -1,4 +1,11 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
/* clang-format off */ /* clang-format off */
/* /*
* _codecs_kr.c: Codecs collection for Korean encodings * _codecs_kr.c: Codecs collection for Korean encodings
* *

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "third_party/python/Include/abstract.h" #include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/codecs.h" #include "third_party/python/Include/codecs.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/math.h" #include "libc/math.h"
#include "third_party/python/Include/boolobject.h" #include "third_party/python/Include/boolobject.h"

View file

@ -1,4 +1,11 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
/* clang-format off */ /* clang-format off */
/* Generated automatically from ./Modules/config.c.in by makesetup. */ /* Generated automatically from ./Modules/config.c.in by makesetup. */
/* -*- C -*- *********************************************** /* -*- C -*- ***********************************************
Copyright (c) 2000, BeOpen.com. Copyright (c) 2000, BeOpen.com.

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "third_party/python/Include/dictobject.h" #include "third_party/python/Include/dictobject.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/sigbits.h" #include "libc/calls/sigbits.h"
#include "libc/calls/struct/sigaction.h" #include "libc/calls/struct/sigaction.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/calls/ioctl.h" #include "libc/calls/ioctl.h"

View file

@ -1,3 +1,9 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "third_party/python/Include/dictobject.h" #include "third_party/python/Include/dictobject.h"
#include "third_party/python/Include/methodobject.h" #include "third_party/python/Include/methodobject.h"

Some files were not shown because too many files have changed in this diff Show more