Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ extended_perror(3C) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                      extendedperror(3C)



        _________________________________________________________________
        extendedperror                                          function
        Print an error message on stderr.
        _________________________________________________________________


        Calling Sequence

        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 extended_perror function prints to the standard error file a
        string and an error message corresponding to the last DG/UX
        extended error with the dg_ext_errno function.  If no extended
        error message is available, nothing is printed.


        Returns

        The extended_perror function returns no value.


        Related Functions

        See also the perror function.


        Example

        The following program copies data from the tape drive to the
        standard output.  If an error occurs, the extended_perror
        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();



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                      extendedperror(3C)



        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) {
                    perror("Write to stdout");
                    return 1;
                }
            }
            if (len < 0) {
                extended_perror("Read of /dev/rmt/0");
                return 1;
            }
            return 0;
        }

































        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)



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