Merge from vendor branch GCC:
[dragonfly.git] / contrib / libf2c / libI77 / util.c
1 #ifndef NON_UNIX_STDIO
2 #define _INCLUDE_POSIX_SOURCE   /* for HP-UX */
3 #define _INCLUDE_XOPEN_SOURCE   /* for HP-UX */
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #endif
7 #include "f2c.h"
8 #include "fio.h"
9
10  VOID
11 #ifdef KR_headers
12 g_char(a,alen,b) char *a,*b; ftnlen alen;
13 #else
14 g_char(char *a, ftnlen alen, char *b)
15 #endif
16 {
17         char *x = a + alen, *y = b + alen;
18
19         for(;; y--) {
20                 if (x <= a) {
21                         *b = 0;
22                         return;
23                         }
24                 if (*--x != ' ')
25                         break;
26                 }
27         *y-- = 0;
28         do *y-- = *x;
29                 while(x-- > a);
30         }
31
32  VOID
33 #ifdef KR_headers
34 b_char(a,b,blen) char *a,*b; ftnlen blen;
35 #else
36 b_char(char *a, char *b, ftnlen blen)
37 #endif
38 {       int i;
39         for(i=0;i<blen && *a!=0;i++) *b++= *a++;
40         for(;i<blen;i++) *b++=' ';
41 }
42 #ifndef NON_UNIX_STDIO
43 #ifdef KR_headers
44 long f__inode(a, dev) char *a; int *dev;
45 #else
46 long f__inode(char *a, int *dev)
47 #endif
48 {       struct stat x;
49         if(stat(a,&x)<0) return(-1);
50         *dev = x.st_dev;
51         return(x.st_ino);
52 }
53 #endif