LIBCGI_GENERAL(3)
πΈ General purpose(3) β from the Library Functions Manual π
okay bestie, gather round, because this is the LibCGI general-purpose grab bag β¨ three little functions that do three very specific things, and they're all lowkey iconic. no cap.
π NAME π
General purpose β like, the vibes are "assorted utility functions," and honestly? it ate.
π¦ Functions π¦
char * htmlentities (const char *str)β Transforms HTML special chars. it's giving "escape my text before it does crimes."char ** file (const char *filename, unsigned int *total)β Reads entire file into an array. the whole file. all of it. periodt.char * md5 (const char *str)β Converts a string to MD5 format. hash queen π
π Function Documentation π
β¨ char** file (const char * filename, unsigned int * total)
Reads entire file into an array. literally the whole file, into an array, in one go π«Ά
Parameters:
filenameβ Filename to opentotalβ Integer variable passed as reference, which will store the total of items
Returns:
Returns the file in an array. Each element of the array corresponds to a line in the file.
char **lines;
unsigned int total, i;
lines = file('filename.ext', &total);
printf('Total of lines: %u0, total);
for (i = 0; i < total; i++)
printf('[%u] %s0, i, lines[i]);
for (i = 0; i < total; i++) {
if (lines[i])
free(lines[i]);
}
π psst β see how everylines[i]getsfree'd at the end? that's the clean-up era, bestie. don't skip it, or your memory leaks and that's not the main character energy we're going for π
π char* htmlentities (const char * str)
Transforms HTML special chars. Transforms chars like '<', '>' and others in HTML form, like '<' and '>' π
Parameters:
strβ String containing code to parse
Returns:
The new string
Author:
Robert Csok <rcsok@gmx.de>
π char* md5 (const char * str)
Converts a string to MD5 format. one-way trip, no takebacks π
Author:
Diogo Gonzaga
Parameters:
strβ String to convert to MD5 hash
Returns:
MD5 hash code
that's the whole page, bestie β three functions, three authors' worth of credit, zero filler. go forth and parse responsibly π§
and before you go: this lil number came from LibCGI, dated 13 Mar 2003 β yes, 2003, it's vintage and it's still serving. iykyk πβ¨
π¦ where this page comes from
- fedora 43: libcgi-devel 1.0-43.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: libcgi-devel 1.0-43.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: libcgi-devel 1.0-44.fc44 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: libcgi-devel 1.0-44.fc44 Β· LicenseRef-Callaway-LGPLv2+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms