BFLibC 0.1
C Library
Loading...
Searching...
No Matches
coreutils.c File Reference
#include "coreutils.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <libgen.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <dirent.h>
#include <sys/types.h>
#include <stdlib.h>
#include <netdb.h>
#include <arpa/inet.h>
Include dependency graph for coreutils.c:

Functions

void BFErrorPrint (const char *format,...)
 
double ConvertValueToScale (unsigned long long value, long long scale)
 
int BFByteGetString (unsigned long long byteSize, unsigned char options, char *outStr)
 
bool BFArrayStringContainsString (char **strArr, int arrSize, const char *element)
 
int BFArrayStringGetIndexForString (char **strArr, int arrSize, const char *element)
 
int BFNetGetIPForHostname (const char *hostname, char *ip)
 
char * BFStringCreateBinaryStringForNumber (long long num, int byteSize, int *err)
 

Function Documentation

◆ BFArrayStringContainsString()

bool BFArrayStringContainsString ( char ** strArr,
int arrSize,
const char * element )

Sweeps the array to see of it contains the string specified by element

◆ BFArrayStringGetIndexForString()

int BFArrayStringGetIndexForString ( char ** strArr,
int arrSize,
const char * element )

returns -1 if string could not be found

◆ BFByteGetString()

int BFByteGetString ( unsigned long long byteSize,
unsigned char options,
char * outStr )

Creates a string that represents the byteSize

outStr needs to be a valid string buffer that can accept at least 10 bytes of data options : ||||||||0=KiloByte, 1=KibiByte|

returns 0 on success, anything else is an error

Here is the call graph for this function:

◆ BFErrorPrint()

void BFErrorPrint ( const char * format,
... )

author: Brando date: 6/2/22

◆ BFNetGetIPForHostname()

int BFNetGetIPForHostname ( const char * hostname,
char * ip )

returns the ip address for the hostname

◆ BFStringCreateBinaryStringForNumber()

char * BFStringCreateBinaryStringForNumber ( long long num,
int size,
int * err )

Creates binary string representation of the num variable (you know since printf() can't print in binary format

size: byte size of num

Caller must free

◆ ConvertValueToScale()

double ConvertValueToScale ( unsigned long long value,
long long scale )

Converts the value to the level specified by scale