1 |
/************************************************* -*- mode: C -*- |
2 |
* $Header: $ |
3 |
* $Name: $ |
4 |
*/ |
5 |
|
6 |
/* Here, we get the definition of the FC_NAMEMANGLE() macro. */ |
7 |
#include "FC_NAMEMANGLE.h" |
8 |
|
9 |
#include <stdio.h> |
10 |
#include <stdlib.h> |
11 |
#include <unistd.h> |
12 |
#include <sys/stat.h> |
13 |
#include <sys/types.h> |
14 |
|
15 |
void FC_NAMEMANGLE(mncfsize) ( int *nienc, int *ienc, int *nbyte ) |
16 |
{ |
17 |
char name[512]; |
18 |
struct stat astat; |
19 |
int i, j, n; |
20 |
char * cenc = |
21 |
{"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.,+-=/~\0"}; |
22 |
int ncenc = 70; |
23 |
|
24 |
n = ((*nienc) > 200) ? 200 : (*nienc); |
25 |
for (i=0; i<n; i++) { |
26 |
/* printf("ienc = %d, %c\n", ienc[i], cenc[ienc[i] - 1]); */ |
27 |
name[i] = cenc[ienc[i] - 1]; |
28 |
} |
29 |
name[n] = '\0'; |
30 |
/* printf("name = \"%s\", n = %d\n", name, n); */ |
31 |
|
32 |
/* At this point we have the file name and would like to |
33 |
* determine the file size. */ |
34 |
if (! stat(name, &astat)) |
35 |
*nbyte = (int)(astat.st_size); |
36 |
else |
37 |
*nbyte = -1; |
38 |
} |
39 |
|
40 |
|