Skip to content

libec (mini-libc) #35

@enkore

Description

@enkore

Just a scrapbook

Obligatory functions

Memory managment

  • malloc(words)
  • free(pointer)
  • memcpy(dst, src, words)
  • memset(pointer, val, words)

Strings

  • strcat(dst, src)
  • strdup(src)
  • strcmp(val1, val2)
  • strlen(val)
  • strtok(val, delim)

IO

  • fopen(file [mode?])
  • fwrite(src, words, handle)
  • fread(dst, words, handle)
  • ftell(handle)
  • fseek(dest, origin, handle)
  • fclose(handle)
  • Something for reading directories contents + file attributes
  • getc() (read character from keyboard)
  • puts() (write string to screen)

Networking

  • opensocket(proto)
  • connect(sock, target, port)
  • send(sock, buf, len)
  • recv(sock, buf, len)
  • listen(sock)
  • bind(sock, port)
  • Probably name resolution, if any

Additional functions

Screen management

  • clear() - clear screen & set cursor position to 0,0 (upper left corner)
  • sloc(x, y) - set cursor position
  • scroll() - scrolls screen contents by one line (upper line vanishes, blank line at the bottom of the screen)
  • gets() - get line from keyboard
  • mirror(boolean) - enable/disable automatic mirroring (typed text automatically appears at current cursor pos)
  • color(foreground, background, blink) - explicit way to change color(?)

Security Considerations

  • A malicious program can corrupt all files on the hard disk, but it could also use direct IO for that anyway

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions