Staging
v0.5.1
https://github.com/python/cpython
Revision b0e51b2957f7e4ba4bd2399329bae810b57881aa authored by Guido van Rossum on 13 April 2001, 18:14:27 UTC, committed by Guido van Rossum on 13 April 2001, 18:14:27 UTC
always:

- #undef HAVE_CONFIG_H (because otherwise chardefs.h tries to include
  strings.h)

- #include readline.h and history.h

and we never declare any readline function prototypes ourselves.

This makes it compile with readline 4.2, albeit with a few warnings.
Some of the remaining warnings are about completion_matches(), which
is renamed to rl_completion_matches().

I've tested it with various other versions, from 2.0 up, and they all
seem to work (some with warnings) -- but only on Red Hat Linux 6.2.

Fixing the warnings for readline 4.2 would break compatibility with
3.0 (and maybe even earlier versions), and readline doesn't seem to
have a way to test for its version at compile time, so I'd rather
leave the warnings in than break compilation with older versions.
1 parent fc4ee0a
Raw File
Tip revision: b0e51b2957f7e4ba4bd2399329bae810b57881aa authored by Guido van Rossum on 13 April 2001, 18:14:27 UTC
Clean up the unsightly mess around the readline header files. We now
Tip revision: b0e51b2
unixstuff.c
/* Fudge unix isatty and fileno for RISCOS */

#include "h.unixstuff"
#include <math.h>
#include "h.osfile"

int fileno(FILE *f)
{ return (int)f;
}

int isatty(int fn)
{ return (fn==fileno(stdin));
}

bits unixtime(bits ld,bits ex)
{ ld&=0xFF;
  ld-=51;
  if(ex<1855548004U) ld--;
  ex-=1855548004U;
  return ex/100+42949672*ld+(95*ld)/100;
}

int unlink(char *fname)
{ remove(fname);
  return 0;
}


/*#define RET(k) {printf(" %d\n",k);return k;}*/
#define RET(k) return k

int isdir(char *fn)
{ int ob;
/*  printf("isdir %s",fn);*/
  if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0);
  switch (ob)
  {   case osfile_IS_DIR:RET(1);
    case osfile_IS_IMAGE:RET(1);
  }
  RET(0);
}

int isfile(char *fn)
{ int ob;  /*printf("isfile %s",fn);*/
  if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0);
  switch (ob)
  {  case osfile_IS_FILE:RET(1);
    case osfile_IS_IMAGE:RET(1);
  }
  RET(0);
}

int exists(char *fn)
{ int ob;  /*printf("exists %s",fn);*/
  if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) RET(0);
  switch (ob)
  {  case osfile_IS_FILE:RET(1);
      case osfile_IS_DIR:RET(1);
    case osfile_IS_IMAGE:RET(1);
  }
  RET(0);
}
back to top