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