util.c 972 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #include "sysdep1.h" /* here to get stat64 on some badly designed Linux systems */
  2. #include "f2c.h"
  3. #include "fio.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. VOID
  8. #ifdef KR_headers
  9. #define Const /*nothing*/
  10. g_char(a,alen,b) char *a,*b; ftnlen alen;
  11. #else
  12. #define Const const
  13. g_char(const char *a, ftnlen alen, char *b)
  14. #endif
  15. {
  16. Const char *x = a + alen;
  17. char *y = b + alen;
  18. for(;; y--) {
  19. if (x <= a) {
  20. *b = 0;
  21. return;
  22. }
  23. if (*--x != ' ')
  24. break;
  25. }
  26. *y-- = 0;
  27. do *y-- = *x;
  28. while(x-- > a);
  29. }
  30. VOID
  31. #ifdef KR_headers
  32. b_char(a,b,blen) char *a,*b; ftnlen blen;
  33. #else
  34. b_char(const char *a, char *b, ftnlen blen)
  35. #endif
  36. { int i;
  37. for(i=0;i<blen && *a!=0;i++) *b++= *a++;
  38. for(;i<blen;i++) *b++=' ';
  39. }
  40. #ifndef NON_UNIX_STDIO
  41. #ifdef KR_headers
  42. long f__inode(a, dev) char *a; int *dev;
  43. #else
  44. long f__inode(char *a, int *dev)
  45. #endif
  46. { struct STAT_ST x;
  47. if(STAT(a,&x)<0) return(-1);
  48. *dev = x.st_dev;
  49. return(x.st_ino);
  50. }
  51. #endif
  52. #ifdef __cplusplus
  53. }
  54. #endif