There are 2 things that have ways been able to cheer me up: bober kurwa (polish people reacting to beavers, but also random wildlife) and Japanese comments on YouTube (they are very nice)
🔥1
Forwarded from vx-underground
Photo sent to us from _FaceFTW.
This is by FAR the rarest kitty cat we've ever seen.
This is by FAR the rarest kitty cat we've ever seen.
Forwarded from vx-underground
praying to god we have the first president of the united states to perform a rug pull
This media is not supported in your browser
VIEW IN TELEGRAM
I'm so tired but I left my apartment so I can't nap 😭
Rate my function to read an entire file
int readwholebuffer(char **str, unsigned long int initsize, int fd) {
// Try to read bytes from fd into str
// Bytes read == 0, return 0
// Bytes read < 0, free string, return -1;
// When string hits capacity, double the capacity, and reallocate the string
char *lstr = NULL, *tmp = NULL;
ssize_t bytesread = -1;
int csize = initsize, ccap = initsize;
lstr = xcalloc(initsize, sizeof(char));
while((bytesread = read(fd, lstr + (csize - ccap), ccap)) > 0) {
ccap -= bytesread;
if(ccap <= 0) {
csize *= 2;
ccap = csize / 2;
tmp = realloc(lstr, csize * sizeof(char));
if(!tmp) {
error(0, errno, "Could not reallocate enough space for lstr");
free(lstr);
lstr = NULL; // Need to set this because of the break
bytesread = -100;
break;
}
lstr = tmp;
}
}
if(bytesread < 0 && bytesread != -100) {
error(0, errno, "Ran into a read() error");
free(lstr);
lstr = NULL;
}
if(lstr) {
tmp = realloc(lstr, csize - ccap + 1);
if(!tmp) {
error(0, errno, "Could not shrink lstr after reading buffer");
free(lstr);
bytesread = -100;
}
lstr = tmp;
}
if(lstr) {
lstr[csize - ccap - 1] = '\0'; // Don't include the newline
}
*str = lstr;
return ((bytesread == 0) ? (csize - ccap) : -1);
}