idx

C library providing a standard for (non-standard) 64-bit file indexing functions.
git clone git://src.gearsix.net/idxidx.zip
Log | Files | Refs | Atom | README

idx_ukwn.c (raw) (545B)


   1 #include "idx.h"
   2 
   3 #if defined(IDX_UNKW) || defined(IDX_UNKWC99)
   4 
   5 int idxseek(FILE *stream, idx_t offset, int origin)
   6 {
   7 	return fseek(stream, (long int)offset, origin);
   8 }
   9 
  10 idx_t idxtell(FILE *stream)
  11 {
  12 	return (idx_t)ftell(stream);
  13 }
  14 
  15 idx_t strtoidx(const char *s, char **end, int base)
  16 {
  17 #ifdef IDX_UKWNC99
  18 	return (idx_t)strtoull(s, end, base);
  19 #else
  20 	return (idx_t)strtoul(s, end, base);
  21 #endif
  22 }
  23 
  24 int idxtostr(idx_t i, char **buf)
  25 {
  26 #ifdef IDX_UKWNC99
  27 	return sprintf(*buf, "%llu", i);
  28 #else
  29 	return sprintf(*buf, "%lu", i);
  30 #endif
  31 }
  32 
  33 #endif