Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ extended_perror(3C) — DG/UX 4.30

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     extendedperror(3C)        DG/UX 4.30         extendedperror(3C)



     NAME
          extended_perror - Print an error message to standard error.

     SYNOPSIS
          void extendedperror();
          char *string;
          extendedperror(string);

          where:

          string is a pointer to a null-terminated string that is
          printed (along with a colon) before the error message is
          printed.

     DESCRIPTION
          The extendedperror function prints to the standard error
          file a string and an error message corresponding to the last
          DG/UX extended error with the dgexterrno function.  If no
          extended error message is available, nothing is printed.

     RETURNS
          The extendedperror function returns no value.

     SEE ALSO
          See also the perror function.

     EXAMPLE
          The following program copies data from the tape drive to the
          standard output.  If an error occurs, the extendedperror
          function prints an error message.

          /* Program test for the extended_perror() function */

          #include <fcntl.h>


          #define MBUF   32768
          #define STDOUT 1

          char buf[MBUF];
          void perror(), extended_perror();
          int read(), write();

          main() {
              int len, fd = open("/dev/rmt/0", O_RDONLY);

              if (fd == -1) {
                  perror("Open of /dev/rmt/0");
                  return 1;
              }
              while ((len = read(fd, buf, MBUF)) > 0) {
                  if (write(STDOUT, buf, len) < 0) {



     Licensed material--property of copyright holder(s)         Page 1





     extendedperror(3C)        DG/UX 4.30         extendedperror(3C)



                      perror("Write to stdout");
                      return 1;
                  }
              }
              if (len < 0) {
                  extended_perror("Read of /dev/rmt/0");
                  return 1;
              }
              return 0;
          }













































     Licensed material--property of copyright holder(s)         Page 2



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