earlybrowserreborn - Blame information for rev 5

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 roytam 1 #include "midas.uic"
2 #include "midaswww.uic"
3 #include <stdio.h>
4 #include <string.h>
5 #include <fcntl.h>
6 #include <sys/stat.h>
7 #include <X11/Intrinsic.h>
8  
9 /* MidasMakeUid (): to make a uid file from the data input of a uic file.
10    parameters: filename
11    return: 1 if make uid file success, 0 if make uid file fail.
12            filename if make uid file success
13 */
14  
15 int MidasMakeUid(filename)
16 char **filename;
17 {
18         int fileout;
19         char *buffer = XtMalloc(L_tmpnam);
20         char *temp = tmpnam(buffer);
21  
22         if ((fileout = open(temp, O_CREAT | O_RDWR, 0666)) > 0)
23         {
5 roytam 24           if (strstr(*filename, "midas.uid"))
1 roytam 25               write(fileout, midas, sizeof(midas));
5 roytam 26           else if (strstr(*filename, "midaswww.uid"))
1 roytam 27               write(fileout, midaswww, sizeof(midaswww));
28           else
29           {
30               printf("MidasMakeUid error: don't find the UIC file of %s\n",*filename);
31               unlink(temp);
32               XtFree(temp);
33               return 0;
34           }
35           *filename = temp;
36           return 1;
37         }
38         else
39         {
40                 printf("Unable to open file %s \n",temp);
41                 XtFree(temp);
42                 return 0;
43         }
44 }