Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ defopen(S) — OpenDesktop Software Development System 1.0.0d

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     DEFOPEN(S)                UNIX System V                DEFOPEN(S)



     Name
          defopen, defread - reads default entries

     Syntax
          int defopen(filename)
          char *filename;

          char *defread(pattern)
          char *pattern;

     Description
          defopen and defread are a pair of routines designed to allow
          easy access to default definition files.  UNIX is normally
          distributed in binary form; the use of default files allows
          OEMs or site administrators to customize utility defaults
          without having the source code.

          defopen opens the default file named by the pathname in
          filename.  defopen returns null if it is successful in
          opening the file, or the fopen failure code (errno) if the
          open fails.

          defread reads the previously opened file from the beginning
          until it encounters a line beginning with pattern. defread
          then returns a pointer to the first character in the line
          after the initial pattern. If a trailing newline character
          is read it is replaced by a null byte.

          When all items of interest have been extracted from the
          opened file the program may call defopen with the name of
          another file to be searched, or it may call defopen with
          NULL, which closes the default file without opening another.

     Files
          The UNIX convention is for a system program xyz to store its
          defaults (if any) in the file /etc/default/xyz.

     Diagnostics
          defopen returns zero on success and nonzero if the open
          fails. The return value is the errno value set by fopen(S).

          defread returns NULL if a default file is not open, if the
          indicated pattern could not be found, or if it encounters
          any line in the file greater than the maximum length of 128
          characters.

     Notes
          The return value points to static data, whose contents are
          overwritten by each call.

     Value Added
          defopen and defread are extensions of AT&T System V provided
          by the Santa Cruz Operation.



                                             (printed 6/20/89)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026