2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: getfname.c /main/9 1996/11/08 02:06:43 cde-fuj $ */
25 * (c) Copyright 1995 FUJITSU LIMITED
26 * This is source code modified by FUJITSU LIMITED under the Joint
27 * Development Agreement for the CDEnext PST.
28 * This is unpublished proprietary source code of FUJITSU LIMITED
32 #include <sys/types.h>
48 #include <sys/resource.h>
58 static void ErrMsgTable_GetDefaultFile();
59 static int falcom_split_data() ;
60 static void dsp_font_list() ;
61 static int search_Font_File_Name();
63 extern int searchFontFileName();
64 extern int falReadFontProp() ;
67 * get "character size" and "letter size" from a character of an interface
70 * 1... get "character size"
71 * 2... get "character size" and "letter size"
76 #define BODY_AND_LETTER 2
79 GetSize( size_str, body, letter )
80 char *size_str; /* a character of a size */
81 int *body; /* set "character size" (output) */
82 int *letter; /* set "letter size" (output) */
88 str_dot = strchr( size_str, '.');
89 /* str_end = strchr( size_str, '\0'); */
91 if ( str_dot == NULL) {
92 /* change a size of "character size"*/
93 if (falcom_atoi( size_str, '\0', &bdy ) ==-1) {
100 /* change a size of "character size"*/
101 if (falcom_atoi( size_str, '.', &bdy ) ==-1) {
105 /* change a size of "letter size"*/
107 if (falcom_atoi( str_dot, '\0', <r ) ==-1) {
112 return BODY_AND_LETTER;
118 * change numerical character for numarical data
123 #if NeedFunctionPrototypes
125 char *str, /* numerical character */
126 char ed_code,/* an end code in numerical character */
127 int *val /* set numarical data */
130 falcom_atoi(str, ed_code, val)
131 char *str; /* numerical character */
132 char ed_code;/* an end code in numerical character */
133 int *val; /* set numarical data */
140 /* get an end index */
141 str_end = strchr( str, ed_code );
143 /* change numarical data */
144 tmp = (int)strtol(str, &ptr, 10);
147 if ((ptr == str) || (ptr != str_end)) {
156 falcom_cr_to_null(buf)
159 buf = strchr( buf, '\n');
168 #define FALCOM_DATA_ELM 3
170 #define FALCOM_ELM_SIZE 0
171 #define FALCOM_ELM_STYLE 1
172 #define FALCOM_ELM_FNAME 2
176 #if NeedFunctionPrototypes
183 GetDefaultFile( size, style, fname )
184 int size; /* character size */
185 char *style; /* character style */
186 char *fname; /* buffer */
194 char *fal_search_path;
195 char uflist_d[BUFSIZE];
196 char uflist_c[ BUFSIZE ];
197 char uflist_l[ BUFSIZE ];
199 GETLISTFILEPATH( locale, fal_search_path, uflist_d, uflist_c, uflist_l, UDFLIST_DEF ) ;
201 if ( ( fp = fopen( uflist_l, "r" ) ) == NULL ) {
202 if ( ( fp = fopen( uflist_c, "r" ) ) == NULL ) {
203 if ( ( fp = fopen( uflist_d, "r" ) ) == NULL ) {
209 ret = get_default_file( fp, size, style, fname );
216 #if NeedFunctionPrototypes
224 get_default_file( fp, size, style, fname )
226 int size; /* character size */
227 char *style; /* character style */
228 char *fname; /* buffer */
231 char buf[BUFSIZE]; /* buffer */
232 int size_tmp; /* size (read file) */
234 char *elm[FALCOM_DATA_ELM];
238 /* read from a file */
239 while( fgets(buf, BUFSIZE, fp) != (char *)NULL ) {
241 falcom_cr_to_null( buf );
242 if ((buf[0] == '#') || (buf[0] == '\0')) {
245 if (falcom_split_data( buf, FALCOM_DATA_ELM, &elm ) == -1) {
249 if (falcom_atoi( elm[FALCOM_ELM_SIZE], '\0', &size_tmp ) == -1) {
254 if ((size_tmp == size) && !strcmp(elm[FALCOM_ELM_STYLE], style)) {
255 strcpy( fname, elm[FALCOM_ELM_FNAME] );
265 if ( feof(fp) != 0 ) {
271 /**************************************************************/
272 /* read from a file and divide a data that read from file */
273 /**************************************************************/
276 falcom_split_data( buf, entry_num, elm )
277 char *buf; /* read a font information character array from a file */
281 int cnt; /* counter */
282 int strtop_flg; /* flag of a head of a character array */
286 for (cnt=0 ; *buf != '\0' && cnt < entry_num ; buf++){
287 /* skip a separate character */
288 if ((*buf == '\t') || (*buf == ' ')) {
291 /* skip a separate character */
294 } while((*buf == '\t') || (*buf == ' '));
303 /* check a data's number */
304 if (cnt != entry_num ) {
312 #if NeedFunctionPrototypes
313 falcom_get_base_name( char *str )
315 falcom_get_base_name( str )
316 char *str; /* a full path character of a file name */
321 str_slash = strrchr( str, '/');
322 if ( str_slash == NULL ) {
330 is_letter_size_not_only_one( lst )
331 FalFontDataList *lst; /* a font list */
335 letter_cmp = lst->list[0].letter.h;
336 for (i=0 ; i < lst->num ; i++) {
337 if (lst->list[i].letter.h != letter_cmp){
346 * get a real file name from a character of "size" and "style"
354 #if NeedFunctionPrototypes
363 GetFileName(com, size_str, style, codeset, ofile)
364 char *com; /* a character of a command name(case error) */
365 char *size_str; /* a character of "size" */
366 char *style; /* a character of "style" */
367 int codeset; /* a codeset */
368 char *ofile; /* set a target file name (output) */
372 int size_sw; /* a size flag */
373 char buf[BUFSIZE] ; /* an area for a file name */
374 char *filename; /* a pointer for a file name */
375 char fname[BUFSIZE]; /* a pointer for a file name */
376 FalFontDataList *lst; /* a font list */
377 FalFontData key; /* search an information of a font */
378 unsigned int mask; /* search a mask of a font */
380 struct stat statbuf ;
383 char *fal_search_path;
384 char uflist_d[ BUFSIZE ];
385 char uflist_c[ BUFSIZE ];
386 char uflist_l[ BUFSIZE ];
388 GETLISTFILEPATH( locale, fal_search_path, uflist_d, uflist_c, uflist_l, UDFLIST_DEF ) ;
390 /* change a character of a size */
391 if ((size_sw = GetSize(size_str, &body, &letter)) == -1) {
392 USAGE2("%s : The specification of the character size is improper.\"%s\"\n",
398 mask |= FAL_FONT_MASK_UNDEFINED ;
399 mask |= FAL_FONT_MASK_DEFINED ;
400 memset( &key, '\0', sizeof(FalFontData) ) ;
401 /* set information to search fonts */
403 key.cd_set = FALGETFALCODESET( codeset ) ;
404 mask |= FAL_FONT_MASK_CODE_SET ;
407 case BODY_AND_LETTER:
408 key.letter.h = letter;
409 mask |= FAL_FONT_MASK_LETTER_H;
412 mask |= FAL_FONT_MASK_SIZE_H;
415 /* aet and check an information of a style */
416 COMM_SETSTYLE_TO_FONTDATA( style, key, mask ) ;
418 /* get a font information */
419 if (FalGetFontList( &key, mask, &lst ) == FAL_ERROR ) {
420 ErrMsgTable_FalGetFontList( com, fal_utyerror, fal_utyderror );
424 if ( lst->num == 0 ) {
425 USAGE3("%s : The user defined character of the specified size and style does not exist.\"%s , %s\"\n",
426 com, size_str, (style)?style:" ");
427 FalFreeFontList( lst );
431 memset( fname, '\0', sizeof(fname) ) ;
435 if ( is_letter_size_not_only_one(lst) ) {
436 ret = GetDefaultFile( key.size.h, style, buf) ;
438 COMM_GET_DEFAULTFILE_ERROR( buf, com, ret, key.size.h, style, uflist_d, uflist_c, uflist_l, statbuf ) ;
440 for ( i = 0 ; i < lst->num; i++ ) {
441 ret = search_Font_File_Name( lst->list[i], fname );
442 if ( ret == FAL_ERROR ) {
443 FalFreeFontList( lst );
446 filename = falcom_get_base_name( fname );
447 if ( (buf[0] != '\0' && fname[0] != '\0')
448 && !strcmp( buf, filename ) ) {
449 strcpy( ofile, fname );
450 FalFreeFontList( lst );
454 COMM_DISPERRORFILE( com, lst, style, i, size_str ) ;
455 FalFreeFontList( lst );
459 case BODY_AND_LETTER:
462 ret = search_Font_File_Name( lst->list[0], fname );
463 if ( ret == FAL_ERROR ) {
464 FalFreeFontList( lst );
467 strcpy( ofile, fname );
468 FalFreeFontList( lst );
471 ret = GetDefaultFile( key.size.h, style, buf);
475 for( i = 0 ; i < lst->num; i++ ) {
476 ret = search_Font_File_Name( lst->list[0], fname );
477 if ( ret == FAL_ERROR ) {
478 FalFreeFontList( lst );
481 filename = falcom_get_base_name( fname );
482 if ( (buf[0] != '\0' && fname[0] != '\0')
483 && !strcmp( buf, filename ) ) {
484 strcpy( ofile, fname );
485 FalFreeFontList( lst );
489 USAGE1("%s : Two or more corresponding user defined characters exist.\n", com);
490 for ( i = 0 ; i < lst->num; i++ ) {
491 ret = search_Font_File_Name( lst->list[i], fname );
492 if ( ret == FAL_ERROR ) {
493 FalFreeFontList( lst );
496 fprintf( stdout, "\t%s\n", fname );
498 FalFreeFontList( lst );
500 } /* <--- switch( lst->num ) { */
501 } /* <--- switch( size_sw ) { */
506 /* take out an error message of "FalGetFontList()" */
509 * Error messages(by origin)
511 char *fal_errmsg_org[0xff] = {
514 "Cannot open the font file.",
515 "Cannot read the font file.",
516 "There is no more memory .",
517 "Fatal error occurred.",
518 "The specified font file does not exist.",
519 "This font is not a pcf or snf format.",
520 "Cannot open fonts.list file.",
521 "The format of fonts.list file is illegal.",
522 "The descriptions of the fonts.list file are incorrect.",
523 "The format of fonts.list file is illegal.",
524 "Cannot open fonts.dir file.",
525 "Cannot read fonts.dir file.",
526 "Cannot read font properties.",
527 "Cannot get \"FONT\" property.",
528 "Cannot get \"FAMILY_NAME\" property.",
530 "This font file is already opened by other application.",
531 "Cannot lock font file.",
532 "Cannot unlock font file.",
533 "Cannot get lock information from the font file.",
534 "Cannot find the specified font file.",
535 "Cannot read NLS database.",
536 "Cannot get charset names from NLS database.",
537 "Charset name not defined in NLS database.",
538 "The specified font has not been opened.",
539 "Fatal error occurred.",
540 " "," "," "," "," "," ",
542 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
544 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
546 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
548 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
550 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
552 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
554 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
556 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
558 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
560 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
562 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
564 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
566 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
568 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
573 #if NeedFunctionPrototypes
574 ErrMsgTable_FalGetFontList(
580 ErrMsgTable_FalGetFontList( com, utyerr, utyderr )
581 char *com; /* command name */
582 int utyerr; /* fal_utyerror */
583 int utyderr; /* fal_utyderror */
586 char *fontsdir, *locale ;
588 if( (locale = (char *)getenv( "LANG" )) == NULL ){
592 if( (fontsdir = (char *)getenv( "DTUDCFONTS" )) == NULL ) {
593 fontsdir = DTUDCFONTSLISTDIR ;
598 USAGE2("%s : %s\n", com, fal_errmsg_org[ fal_utyerrno & 0xff ] ) ;
601 USAGE4("%s : The font directory information file(%s/%s/%s) cannot be opened.\n",
602 com, fontsdir, locale, FONTS_LIST_FILE ) ;
605 USAGE4("%s : Information cannot be read from the font directory information file(%s/%s/%s).\n", com, fontsdir, locale, FONTS_LIST_FILE );
608 USAGE1("%s : The work area cannot be secured.\n", com );
611 USAGE4("%s : Abnormality is found in the content of the font directory information file((%s/%s/%s).\n",
612 com , fontsdir, locale, FONTS_LIST_FILE);
615 USAGE4("%s : The font directory information file(%s/%s/%s) cannot be opened.\n",
616 com , fontsdir, locale, FONTS_LIST_FILE);
619 USAGE4("%s : Information cannot be read from the font directory information file(%s/%s/%s).\n",
620 com , fontsdir, locale, FONTS_LIST_FILE);
623 USAGE2("%s : %s\n", com, fal_errmsg_org[ fal_utyerrno & 0xff ] ) ;
626 USAGE1("%s : Terminates abnormally.\n", com );
632 /* take out an error message of "GetDefaultFile()" */
635 ErrMsgTable_GetDefaultFile( com, ret, size, style, fname )
636 char *com; /* a command name */
637 int ret; /* return code */
638 int size; /* a character size */
639 char *style; /* a character style */
640 char *fname; /* user defined character information file name */
644 USAGE2("%s : The user defined character information file cannot be opened. \"%s \"\n",
648 USAGE4("%s : The representative user defined character of the character size (%d) and style (%s) is not defined.\"%s\"\n",
649 com, size, (style)?style:" ", fname);
652 USAGE2("%s : Information cannot be read from the user defined character information file.\"%s\"\n", com, fname);
655 USAGE2("%s : The mistake is found in the description of the user defined character information file. \"%s\"\n", com, fname);
662 * if an end character of a file name is "/",it is cleared
669 #if NeedFunctionPrototypes
670 fal_cut_tailslash( char *name )
672 fal_cut_tailslash( name )
678 p = strrchr( name, '\0');
682 for (p-- ; (p>=name) && (*p == '/') ; p--) {
689 * get a real file name from a link file name
692 * OK¡¡¡¥¡¥a pointer of a file name
698 #if NeedFunctionPrototypes
699 GetRealFileName( char *name )
701 GetRealFileName( name )
705 static char *ret_name ;
706 char link_name[BUFSIZE];
711 AllocString( ret_name, name, NULL ) ;
712 /* strcpy( ret_name, name ) ; */
713 fal_cut_tailslash( ret_name ); /* for example /tmp/aa/ --> /tmp/aa */
716 if ( lstat( ret_name, &st ) == -1) {
717 FreeString( ret_name ) ;
721 if ( ( len = readlink( ret_name, link_name, BUFSIZE ) ) == -1 ) {
722 if ( errno == EINVAL ) {
724 /* return( strdup( ret_name ) ) ; */
726 FreeString( ret_name ) ;
730 link_name[len-1] = 0;
731 if ( link_name[0] == '/' ) {
732 /* strcpy( ret_name, link_name ) ; */
733 FreeString( ret_name ) ;
734 AllocString( ret_name, link_name, NULL ) ;
738 slash = strrchr( ret_name, '/' );
741 fal_cut_tailslash( ret_name );
742 ResizeString( ret_name, NULL );
743 AddString(ret_name, "/", NULL);
745 /* ret_name[0] = '\0' ; */
746 FreeString( ret_name ) ;
747 AllocString(ret_name, "/", NULL);
749 /* strcat( ret_name, "/" ) ;
750 strcat( ret_name, link_name ) ; */
751 AddString( ret_name, link_name, NULL ) ;
759 * funtctions for search fonts by XLFD and NLS database
763 #if NeedFunctionPrototypes
770 IsInRegion(code, num_gr, gr)
777 if( code < MIN_CODE || code > MAX_CODE ) return -1 ;
778 for( i=0; i<num_gr; i++ ) {
779 if( gr[i].start < MIN_CODE || gr[i].end > MAX_CODE ) continue ;
780 if( gr[i].start <= code && gr[i].end >= code )
790 search_Font_File_Name( data, fname )
795 FalFontDataList *flist ;
799 mask = FAL_FONT_MASK_UNDEFINED | FAL_FONT_MASK_DEFINED ;
801 if( data.xlfdname ) mask |= FAL_FONT_MASK_XLFDNAME ;
802 if( data.size.h ) mask |= FAL_FONT_MASK_SIZE_H ;
803 if( data.size.w >= 0 ) mask |= FAL_FONT_MASK_SIZE_W ;
804 if( data.style.name ) mask |= FAL_FONT_MASK_STYLE_NAME ;
805 if( data.cd_set ) mask |= FAL_FONT_MASK_CODE_SET ;
807 if( data.letter.w ) mask |= FAL_FONT_MASK_LETTER_W ;
808 if( data.letter.h ) mask |= FAL_FONT_MASK_LETTER_H ;
809 if( data.letter.x ) mask |= FAL_FONT_MASK_LETTER_X ;
810 if( data.letter.y ) mask |= FAL_FONT_MASK_LETTER_Y ;
812 if( data.style.def ) mask |= FAL_FONT_MASK_STYLE_DEF ;
813 if( data.shape.name ) mask |= FAL_FONT_MASK_SHAPE_NAME ;
814 if( data.shape.def ) mask |= FAL_FONT_MASK_SHAPE_DEF ;
815 COMM_SBCHR_SETFONTDATA( data, mask ) ;
816 if( data.prm ) mask |= FAL_FONT_MASK_PERMISSION ;
818 fid = FalOpenSysFont( &data, mask, &flist ) ;
820 memset( fname, '\0', sizeof(fname) ) ;
822 dsp_font_list( flist ) ;
823 FalFreeFontList( flist ) ;
826 switch( fal_utyerror ) {
830 switch( fal_utyderror ) {
835 USAGE3("There is no font file correspond to specified font.\n(%s)\n fal_utyerror = %d fal_utyderror = %d\n",
836 ((data.xlfdname)?data.xlfdname:"null font name"), fal_utyerror, fal_utyderror ) ;
840 USAGE("System call error occurred.\n" ) ;
843 USAGE3("There is no font file correspond to specified font.\n(%s)\n fal_utyerror = %d fal_utyderror = %d\n",
844 ((data.xlfdname)?data.xlfdname:"null font name"), fal_utyerror, fal_utyderror ) ;
849 if( FalFontIDToFileName( fid, &tmp_fname ) == FAL_ERROR ) {
850 USAGE3("There is no font file correspond to specified font.\n(%s)\n fal_utyerror = %d fal_utyderror = %d\n",
851 ((data.xlfdname)?data.xlfdname:"null font name"), fal_utyerror, fal_utyderror ) ;
852 FalCloseFont( fid ) ;
855 strcpy( fname, tmp_fname ) ;
856 FalFree( tmp_fname ) ;
857 FalCloseFont( fid ) ;
864 #if NeedFunctionPrototypes
872 GetUdcFileName( com, code_no, xlfdname, fname )
881 if( !xlfdname || !fname ) {
882 USAGE1("%s: null parameter\n", com ) ;
885 memset( &data, '\0', sizeof(FalFontData) ) ;
887 data.xlfdname = xlfdname ;
888 data.cd_set = FALGETFALCODESET( code_no ) ;
889 return( search_Font_File_Name( data, fname ) ) ;
894 dsp_font_list( flist )
895 FalFontDataList *flist ;
899 USAGE(" code set / size / style / xlfd\n" ) ;
900 USAGE("-------------------------------------------------------\n" ) ;
901 for( i=0; i<flist->num; i++ ) {
902 USAGE4("\t%d\t%d\t%s\t%s\n",
903 FALCODESETTONUM( flist->list[i].cd_set ),
904 flist->list[i].size.h,
905 flist->list[i].style.name,
906 flist->list[i].xlfdname
913 #if NeedFunctionPrototypes
922 GetUdcRegion( com, codeset, gpf_file, num_gr, gr )
927 FalGlyphRegion **gr ;
931 char *locale, *char_set, *tmp_gpf ;
933 if( (locale = (char *)getenv( "LANG" )) == NULL ){
936 /* parameter check */
937 if( gpf_file == NULL || gr == NULL ) {
938 USAGE1("%s : null parameters.\n", com);
942 /* get font properties */
943 tmp_gpf = (char *)GetRealFileName( gpf_file ) ;
944 if( tmp_gpf == NULL ){
947 if( falReadFontProp( tmp_gpf, FAL_FONT_PRM, &fdata, 1 ) ) {
948 USAGE1("%s : Failed to get font properties.\n", com ) ;
952 GETCHARSETSTR( char_set, fdata.xlfdname ) ;
953 if( FalGetUDCGIArea( locale, FALGETFALCODESET(codeset), char_set, gr, num_gr ) == FAL_ERROR )
955 USAGE3("%s : Failed to get UDC code region. ( code set %d charset %s )\n",
956 com, codeset, char_set ) ;
961 USAGE3("%s : Failed to get UDC code region. ( code set %d charset %s )\n",
962 com, codeset, char_set ) ;
971 #define MAX_CODESET 8
974 #if NeedFunctionPrototypes
975 DispUdcCpArea( FILE *fp )
982 FalFontDataList *fls ;
989 if( (locale = (char *)getenv( "LANG" )) == NULL ){
992 memset( &fdata, 0, sizeof(FalFontData) ) ;
994 mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED |
995 FAL_FONT_MASK_CODE_SET ;
997 for( cd_set=0; cd_set<MAX_CODESET; cd_set++ ){
999 fdata.cd_set = FALGETFALCODESET(cd_set) ;
1000 if( FalGetFontList(&fdata, mask, &fls) == FAL_ERROR ){
1003 if( fls->num == 0 ){
1006 GETCHARSETSTR( char_set, fls->list[0].xlfdname ) ;
1007 if( FalGetUDCCPArea( locale,
1008 fls->list[0].cd_set, char_set, &cr, &num_cr ) == FAL_ERROR ){
1014 /* display UDC code region */
1015 USAGE1(" %d", cd_set ) ;
1016 for( j=0; j<num_cr; j++ ){
1017 USAGE2("\t\t0x%x - 0x%x\n", cr[j].start, cr[j].end ) ;
1019 if( FalFreeFontList( fls ) == FAL_ERROR ){
1029 #if NeedFunctionPrototypes
1036 GetUdcFontName( gpf_file, bdf_file, fontname )
1044 #if defined( SVR4 ) || defined( SYSV ) || defined(CSRG_BASED) || defined(linux)
1047 union wait chld_stat ;
1049 struct ptobhead head ;
1050 char *p, *tmp_font ;
1051 char readbuf[BUFSIZE], fntbuf[BUFSIZE] ;
1052 unsigned int getstat;
1055 p = tmp_font = NULL ;
1059 memset( &head, 0, sizeof(struct ptobhead) ) ;
1061 head.snf_file = GetRealFileName( gpf_file ) ;
1062 if( head.snf_file == NULL ) return STAT_ERROR ;
1063 }else if( bdf_file ){
1064 head.bdf_file = GetRealFileName( bdf_file ) ;
1065 if( head.bdf_file == NULL ) return STAT_ERROR ;
1071 * write BDF header into FIFO
1073 if (head.snf_file != NULL) {
1074 if (pipe(fd) != 0) {
1077 switch (chld_pid = fork()) {
1080 if(dup(fd[1]) < 0) {
1085 execl( oakgtobdf, oakgtobdf, head.snf_file, "-H", 0);
1086 USAGE1("Cannot execute %s\n", oakgtobdf ) ;
1094 if((fp = (FILE *)fdopen(fd[0], "r")) == NULL) {
1096 kill( chld_pid, SIGKILL );
1097 WaitID( chld_pid, chld_stat ) ;
1098 return FDOPEN_ERROR;
1101 if ((fp = fopen(head.bdf_file, "r")) == NULL) {
1102 return(BDF_OPEN_HEAD);
1111 if (fgets(readbuf, BUFSIZE, fp) == NULL) {
1113 if (head.snf_file != NULL) {
1114 kill( chld_pid, SIGKILL );
1115 WaitID( chld_pid, chld_stat ) ;
1122 if (!strncmp( p, "ENDPROPERTIES", strlen("ENDPROPERTIES") )) {
1124 if (head.snf_file != NULL) {
1125 kill( chld_pid, SIGKILL );
1126 WaitID( chld_pid, chld_stat ) ;
1130 if (!strncmp( p, "FONT ", strlen("FONT ") )) {
1135 while( *ep != '\n' ){
1139 snprintf(fntbuf, sizeof(fntbuf), "%s", sp) ;
1142 if (head.snf_file != NULL) {
1143 kill( chld_pid, SIGKILL );
1144 WaitID( chld_pid, chld_stat ) ;
1150 if( getstat != 0x01 ){
1157 if( (tmp_font = (char *)strdup( fntbuf )) == NULL ){
1158 return MALLOC_ERROR ;
1160 *fontname = tmp_font ;