[comp.sys.sgi] Problems at C

S090726@UMRVMA.UMR.EDU (Bob Funchess) (12/27/89)

I have been trying to figure out what is wrong with this piece of code...
unsuccesfully.  Could someone point me in the right direction or suggest
a substitute?

#include <bsd/strings.h>
#include "kernel.h"

/*
**  Open file for read/write or die trying
*/
static FILE *Do_fopen(char *name, char *mode)
{
  FILE *file;

  if (*name == '-' && !name[1])
    return *mode == 'w' ? stdout : stdin;
  if (!(file = fopen(name,mode))) {
    perror(name);
    (void)fprintf(stderr, "Unable to open file for %s\n",
		  *mode == 'w' ? "write" : "read");
    exit(1);
  }
  return file;
}

static void make_reset(int argc, char *argv[])
{
  FILE	*In, *Out;
  int	*ip;
  int	i, blob[10000];
  char	buff[128];

  if (argc < 3) {
    (void)fprintf(stderr, "Usage error\n");
    exit(1);
  }
  In = Do_fopen(argv[1], "r");
  Out = Do_fopen(argv[2], "w");

  /* Read thru object file, ignoring nonnumeric lines and collecting */
  /* others into blob[] for write to output file... */
  for (ip = blob, i = 0; fgets(buff, sizeof(buff), In); ) {
    if (*buff == '-' || isdigit(*buff))      >>>>>> Here is the problem...
      *ip++ = ((i++ & 0x03) == 2) ? flags(buff) : atoi(buff);
  }

  sec_write(Out, blob, 0, ip - blob);
  (void)fclose(In);
  (void)fclose(Out);
  exit(0);
}

The problem is that at the location indicated I get a segmentation fault.
I also tried replacing that line with
firstin = *buff;
and
firstin = buff(1)


                             < Bob | S090726@UMRVMA.UMR.EDU | Funchess >
   The 'S' stands for student.  Think the university shares MY opinions?