Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ abort(DOS) — System V/386 Software Development System 3.2.2b

Media Vault

Software Library

Restoration Projects

Artifacts Sought

     Name
          abort - Terminates a process.

     Syntax
          #include <process.h>
          #include <stdlib.h>

          void abort(void)

     Description
          The abort function prints the message

          Abnormal program termination

          to stderr, then calls raise(SIGABRT).  The action taken in
          response to the SIGABRT signal depends on what action has
          been defined for that signal in a prior call to the signal
          function.  The default SIGABRT action is for the calling
          process to terminate with exit code 3, returning control to
          the parent process or operating system.
Notes The abort function does not flush stream buffers or do atexit processing.  Return Value By default, abort returns an exit code of 3 to the parent process or operating system.  See Also exec(DOS), exit(DOS),    spawn(DOS) Example
          #include <stdio.h>

          main(argc, argv) int argc; char *argv[];

           {
                   FILE *stream;
                   if ((stream = fopen(argv[argc-1],"r")) == NULL)
                      {
                           fprintf(stderr,
                           "%s couldn't open file
                           %s\n",argv[0],argv[argc-1]);
                           abort();
                      }
           } /* Note: the program name is stored in argv[0] only ** in
          OS/2 and DOS versions 3.0 and later; ** in versions prior to
          DOS 3.0, argv[0] contains ** the string "C" */

          Sample command line:

            update employ.dat

          Output:

          C:\BIN\UPDATE.EXE couldn't open file employ.dat Abnormal
          program termination
          This program opens the file named on the command line for
          stream I/O. If this attempt fails, the program writes an
          error message to stderr and aborts.

                                                (printed 6/18/89)



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