Skip to content

WWIV File and OS API (Proposal)

Rushfan edited this page Nov 5, 2020 · 5 revisions

WWIV.FILE Api

package: wwiv.file

Open File

opt = wwiv.file.open_options("GFILES")
wwiv.file.open(opt, NAME, MODE)
  • first option is location, and is one of:
    • "GFILES": anything allowed
    • "MENU": any *.ans, *.msg, *.b&w allowed
  • NAME is filename
  • MODE is "R" or "W" for read or write
  • returns value a wwiv.file.handle.

Read lines of a file into string.

s = wwiv.file.readintostring(handle)
  • handle is a file handler created from wwiv.file.open
  • returns all of the lines from handle as a string

Read lines of a file into collection.

l = list()
wwiv.file.readlines(handle, l)
  • handle is a file handler created from wwiv.file.open
  • l is an empty list
  • reads all of the lines from handle into l

Get file last modified

opt = wwiv.file.open_options("GFILES")
wwiv.file.last_modified(opt, NAME)
  • returns the last modified time as a unix time_t value

WWIV OS API

package wwiv.os

Execute command

opt = wwiv.os.exec_options("DOOR32", "TEMP", "chain.txt")
opt.type = "DOOR32"
opt.dropfile = "chain.txt"
opt.dir = "TEMP"

Options are (in order):

  • TYPE (one of "DOOR32", "STDIO", "FOSSIL")
  • DIR
  • dir is one of
    • "TEMP": Temp directory for node
    • "BBS" : BBS Root Directory
  • DROPFILE (one of "CHAIN.TXT", "DOOR.SYS")

wwiv.exec(opt, cmd)

- opt is an exec_options struture
- cmd is the commandline to execute.