🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99820

lispref, context diff's to makeinfo.c for VMS GNU C

#99820
From: Roland Roberts
Date: Fri, 11 May 1990 16:58
302 lines
8084 bytes
These are the promised context diff's mentioned in my earlier message.

roland
---
Roland Roberts,  University of Rochester   BITNET: roberts@uornsrl
  Nuclear Structure Research Lab         INTERNET: rbr4@uhura.cc.rochester.edu
  271 East River Road                        UUCP: rochester!ur-cc!rbr4
  Rochester, NY  14267                       AT&T: (716) 275-8962
 
*** makeinfo.gnu
--- makeinfo.c
**************
*** 38,43
  struct passwd *getpwnam ();
  #include <fcntl.h>
  #define bcopy(source, dest, count) memcpy (dest, source, count)
  #else
  #include <strings.h>
  #include <sys/file.h>
--- 38,46 -----
  struct passwd *getpwnam ();
  #include <fcntl.h>
  #define bcopy(source, dest, count) memcpy (dest, source, count)
+ #elif defined(VMS)
+ #include <string.h>
+ #include <file.h>
  #else
  #include <strings.h>
  #include <sys/file.h>
**************
*** 42,47
  #include <strings.h>
  #include <sys/file.h>
  #endif
 
  #if defined (sparc) || defined (i386)
  #ifndef __GNUC__
--- 45,57 -----
  #include <strings.h>
  #include <sys/file.h>
  #endif
+ /* On VMS GNU C these are defined funny */
+ #ifdef VMS
+ #ifdef __GNUC__
+ #include <errno.h>
+ #include <perror.h>
+ #endif
+ #endif
 
  #if defined (sparc) || defined (i386)
  #ifndef __GNUC__
**************
*** 62,67
  /* **************************************************************** */
 
  /* Error levels */
  #define NO_ERROR 0
  #define SYNTAX 1
  #define FATAL 2
--- 72,82 -----
  /* **************************************************************** */
 
  /* Error levels */
+ #ifdef VMS            /* VMS has "backward" exit codes */
+ #define NO_ERROR 1
+ #define SYNTAX   2
+ #define FATAL    4
+ #else
  #define NO_ERROR 0
  #define SYNTAX   1
  #define FATAL    2
**************
*** 63,70
 
  /* Error levels */
  #define NO_ERROR 0
! #define SYNTAX 1
! #define FATAL 2
 
  /* Boolean values. */
  #define true  1
--- 78,86 -----
  #define FATAL    4
  #else
  #define NO_ERROR 0
! #define SYNTAX   1
! #define FATAL    2
! #endif
 
  /* Boolean values. */
  #define true  1
**************
*** 616,622
        case 'V':               /* Use requested version info? */
          fprintf (stderr, "Makeinfo verison %d.%d.\n",
                   major_version, minor_version);
!         exit (0);
          break;
 
        case '?':
--- 632,638 -----
        case 'V':               /* Use requested version info? */
          fprintf (stderr, "Makeinfo verison %d.%d.\n",
                   major_version, minor_version);
!         exit (NO_ERROR);
          break;
 
        case '?':
**************
*** 632,638
    while (optind != argc)
      convert (argv[optind++]);
 
!   exit (0);
  }
 
 
--- 648,654 -----
    while (optind != argc)
      convert (argv[optind++]);
 
!   exit (NO_ERROR);
  }
 
 
**************
*** 693,699
    either be `MN' for `make node', or `BN' for `bottom node'.\n\n",
           progname, paragraph_start_indent,
           fill_column, max_error_level, reference_warning_limit);
!   exit (2);
  }
 
  /* **************************************************************** */
--- 709,715 -----
    either be `MN' for `make node', or `BN' for `bottom node'.\n\n",
           progname, paragraph_start_indent,
           fill_column, max_error_level, reference_warning_limit);
!   exit (FATAL);
  }
 
  /* **************************************************************** */
**************
*** 741,747
       char *filename;
  {
    struct stat fileinfo;
!   int file;
    char *result = (char *) NULL;
 
    if ((stat (filename, &fileinfo)) != 0)
--- 757,763 -----
       char *filename;
  {
    struct stat fileinfo;
!   int file, n, i, count = 0;
    char *result = (char *) NULL;
 
    if (stat (filename, &fileinfo) != 0)
**************
*** 744,750
    int file;
    char *result = (char *) NULL;
 
!   if ((stat (filename, &fileinfo)) != 0)
      goto error_exit;
 
    file = open (filename, O_RDONLY);
--- 760,766 -----
    int file, n, i, count = 0;
    char *result = (char *) NULL;
 
!   if (stat (filename, &fileinfo) != 0)
      goto error_exit;
 
    file = open (filename, O_RDONLY);
**************
*** 753,758
 
    /* Load the file. */
    result = xmalloc (fileinfo.st_size);
    if (read (file, result, fileinfo.st_size) != fileinfo.st_size)
    error_exit:
      {
--- 769,785 -----
 
    /* Load the file. */
    result = xmalloc (fileinfo.st_size);
+ /*
+  * VMS stat lies about the st_size value.  The actual number of
+  * readable bytes is always less thant his value.  The arcane
+  * mysteries of VMS/RMS are too much to probe, so this hack
+  * suffices to make things work.
+  */
+ #ifdef VMS
+   while ((n = read (file, result+count, fileinfo.st_size)) > 0)
+     count += n;
+   if (n == -1)
+ #else
    if (read (file, result, fileinfo.st_size) != fileinfo.st_size)
  #endif
   error_exit:
**************
*** 754,767
    /* Load the file. */
    result = xmalloc (fileinfo.st_size);
    if (read (file, result, fileinfo.st_size) != fileinfo.st_size)
!   error_exit:
!     {
!       if (result)
!       free (result);
!       if (file != -1)
!       close (file);
!       return ((char *) NULL);
!     }
    close (file);
 
    /* Set the globals to the new file. */
--- 781,795 -----
    if (n == -1)
  #else
    if (read (file, result, fileinfo.st_size) != fileinfo.st_size)
! #endif
!  error_exit:
!   {
!     if (result)
!       free (result);
!     if (file != -1)
!       close (file);
!     return ((char *) NULL);
!   }
    close (file);
 
    /* Set the globals to the new file. */
**************
*** 766,771
 
    /* Set the globals to the new file. */
    input_text = result;
    size_of_input_text = fileinfo.st_size;
    input_filename = savestring (filename);
    node_filename = savestring (filename);
--- 794,802 -----
 
    /* Set the globals to the new file. */
    input_text = result;
+ #ifdef VMS
+   size_of_input_text = count;
+ #else
    size_of_input_text = fileinfo.st_size;
  #endif
    input_filename = savestring (filename);
**************
*** 767,772
    /* Set the globals to the new file. */
    input_text = result;
    size_of_input_text = fileinfo.st_size;
    input_filename = savestring (filename);
    node_filename = savestring (filename);
    input_text_offset = 0;
--- 798,804 -----
    size_of_input_text = count;
  #else
    size_of_input_text = fileinfo.st_size;
+ #endif
    input_filename = savestring (filename);
    node_filename = savestring (filename);
    input_text_offset = 0;
**************
*** 3396,3402
                    {
                      perror (split_file);
                      close (fd);
!                     exit (2);
                    }
 
                  if (!indirect_info)
--- 3428,3434 -----
                    {
                      perror (split_file);
                      close (fd);
!                     exit (FATAL);
                    }
 
                  if (!indirect_info)
**************
*** 3425,3431
      if (!output_stream)
        {
        perror (filename);
!       exit (2);
        }
 
      {
--- 3457,3463 -----
      if (!output_stream)
        {
        perror (filename);
!       exit (FATAL);
        }
 
      {
Technical Details
Message-ID: <9005111658.AA09297@uhura.cc.rochester.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!UHURA.CC.ROCHESTER.EDU!rbr4

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,93590b9a05f13504,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-05-11 11:04:44 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!UHURA.CC.ROCHESTER.EDU!rbr4
From: rbr4@UHURA.CC.ROCHESTER.EDU (Roland Roberts)
Newsgroups: gnu.emacs.bug
Subject: lispref, context diff's to makeinfo.c for VMS GNU C
Message-ID: <9005111658.AA09297@uhura.cc.rochester.edu>
Date: 11 May 90 16:58:28 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 302
Posted: Fri May 11 17:58:28 1990