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 librararies 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>
64 static void ErrMsgTable_GetDefaultFile();
65 static int falcom_split_data() ;
66 static void dsp_font_list() ;
67 static int search_Font_File_Name();
69 extern int searchFontFileName();
70 extern int falReadFontProp() ;
73 * get "character size" and "letter size" from a character of an interface
76 * 1... get "character size"
77 * 2... get "character size" and "letter size"
82 #define BODY_AND_LETTER 2
85 GetSize( size_str, body, letter )
86 char *size_str; /* a character of a size */
87 int *body; /* set "character size" (output) */
88 int *letter; /* set "letter size" (output) */
94 str_dot = strchr( size_str, '.');
95 /* str_end = strchr( size_str, '\0'); */
97 if ( str_dot == NULL) {
98 /* change a size of "character size"*/
99 if (falcom_atoi( size_str, '\0', &bdy ) ==-1) {
106 /* change a size of "character size"*/
107 if (falcom_atoi( size_str, '.', &bdy ) ==-1) {
111 /* change a size of "letter size"*/
113 if (falcom_atoi( str_dot, '\0', <r ) ==-1) {
118 return BODY_AND_LETTER;
124 * change numerical character for numarical data
129 #if NeedFunctionPrototypes
131 char *str, /* numerical character */
132 char ed_code,/* an end code in numerical character */
133 int *val /* set numarical data */
136 falcom_atoi(str, ed_code, val)
137 char *str; /* numerical character */
138 char ed_code;/* an end code in numerical character */
139 int *val; /* set numarical data */
146 /* get an end index */
147 str_end = strchr( str, ed_code );
149 /* change numarical data */
150 tmp = (int)strtol(str, &ptr, 10);
153 if ((ptr == str) || (ptr != str_end)) {
162 falcom_cr_to_null(buf)
165 buf = strchr( buf, '\n');
174 #define FALCOM_DATA_ELM 3
176 #define FALCOM_ELM_SIZE 0
177 #define FALCOM_ELM_STYLE 1
178 #define FALCOM_ELM_FNAME 2
182 #if NeedFunctionPrototypes
189 GetDefaultFile( size, style, fname )
190 int size; /* character size */
191 char *style; /* character style */
192 char *fname; /* buffer */
200 char *fal_search_path;
201 char uflist_d[BUFSIZE];
202 char uflist_c[ BUFSIZE ];
203 char uflist_l[ BUFSIZE ];
205 GETLISTFILEPATH( locale, fal_search_path, uflist_d, uflist_c, uflist_l, UDFLIST_DEF ) ;
207 if ( ( fp = fopen( uflist_l, "r" ) ) == NULL ) {
208 if ( ( fp = fopen( uflist_c, "r" ) ) == NULL ) {
209 if ( ( fp = fopen( uflist_d, "r" ) ) == NULL ) {
215 ret = get_default_file( fp, size, style, fname );
222 #if NeedFunctionPrototypes
230 get_default_file( fp, size, style, fname )
232 int size; /* character size */
233 char *style; /* character style */
234 char *fname; /* buffer */
237 char buf[BUFSIZE]; /* buffer */
238 int size_tmp; /* size (read file) */
240 char *elm[FALCOM_DATA_ELM];
244 /* read from a file */
245 while( fgets(buf, BUFSIZE, fp) != (char *)NULL ) {
247 falcom_cr_to_null( buf );
248 if ((buf[0] == '#') || (buf[0] == '\0')) {
251 if (falcom_split_data( buf, FALCOM_DATA_ELM, &elm ) == -1) {
255 if (falcom_atoi( elm[FALCOM_ELM_SIZE], '\0', &size_tmp ) == -1) {
260 if ((size_tmp == size) && !strcmp(elm[FALCOM_ELM_STYLE], style)) {
261 strcpy( fname, elm[FALCOM_ELM_FNAME] );
271 if ( feof(fp) != 0 ) {
277 /**************************************************************/
278 /* read from a file and divide a data that read from file */
279 /**************************************************************/
282 falcom_split_data( buf, entry_num, elm )
283 char *buf; /* read a font information character array from a file */
287 int cnt; /* counter */
288 int strtop_flg; /* flag of a head of a character array */
292 for (cnt=0 ; *buf != '\0' && cnt < entry_num ; buf++){
293 /* skip a separate character */
294 if ((*buf == '\t') || (*buf == ' ')) {
297 /* skip a separate character */
300 } while((*buf == '\t') || (*buf == ' '));
309 /* check a data's number */
310 if (cnt != entry_num ) {
318 #if NeedFunctionPrototypes
319 falcom_get_base_name( char *str )
321 falcom_get_base_name( str )
322 char *str; /* a full path character of a file name */
327 str_slash = strrchr( str, '/');
328 if ( str_slash == NULL ) {
336 is_letter_size_not_only_one( lst )
337 FalFontDataList *lst; /* a font list */
341 letter_cmp = lst->list[0].letter.h;
342 for (i=0 ; i < lst->num ; i++) {
343 if (lst->list[i].letter.h != letter_cmp){
352 * get a real file name from a character of "size" and "style"
360 #if NeedFunctionPrototypes
369 GetFileName(com, size_str, style, codeset, ofile)
370 char *com; /* a character of a command name(case error) */
371 char *size_str; /* a character of "size" */
372 char *style; /* a character of "style" */
373 int codeset; /* a codeset */
374 char *ofile; /* set a target file name (output) */
378 int size_sw; /* a size flag */
379 char buf[BUFSIZE] ; /* an area for a file name */
380 char *filename; /* a pointer for a file name */
381 char fname[BUFSIZE]; /* a pointer for a file name */
382 FalFontDataList *lst; /* a font list */
383 FalFontData key; /* search an information of a font */
384 unsigned int mask; /* search a mask of a font */
386 struct stat statbuf ;
389 char *fal_search_path;
390 char uflist_d[ BUFSIZE ];
391 char uflist_c[ BUFSIZE ];
392 char uflist_l[ BUFSIZE ];
394 GETLISTFILEPATH( locale, fal_search_path, uflist_d, uflist_c, uflist_l, UDFLIST_DEF ) ;
396 /* change a character of a size */
397 if ((size_sw = GetSize(size_str, &body, &letter)) == -1) {
398 USAGE2("%s : The specification of the character size is improper.\"%s\"\n",
404 mask |= FAL_FONT_MASK_UNDEFINED ;
405 mask |= FAL_FONT_MASK_DEFINED ;
406 memset( &key, '\0', sizeof(FalFontData) ) ;
407 /* set information to search fonts */
409 key.cd_set = FALGETFALCODESET( codeset ) ;
410 mask |= FAL_FONT_MASK_CODE_SET ;
413 case BODY_AND_LETTER:
414 key.letter.h = letter;
415 mask |= FAL_FONT_MASK_LETTER_H;
418 mask |= FAL_FONT_MASK_SIZE_H;
421 /* aet and check an information of a style */
422 COMM_SETSTYLE_TO_FONTDATA( style, key, mask ) ;
424 /* get a font information */
425 if (FalGetFontList( &key, mask, &lst ) == FAL_ERROR ) {
426 ErrMsgTable_FalGetFontList( com, fal_utyerror, fal_utyderror );
430 if ( lst->num == 0 ) {
431 USAGE3("%s : The user defined character of the specified size and style does not exist.\"%s , %s\"\n",
432 com, size_str, (style)?style:" ");
433 FalFreeFontList( lst );
437 memset( fname, '\0', sizeof(fname) ) ;
441 if ( is_letter_size_not_only_one(lst) ) {
442 ret = GetDefaultFile( key.size.h, style, buf) ;
444 COMM_GET_DEFAULTFILE_ERROR( buf, com, ret, key.size.h, style, uflist_d, uflist_c, uflist_l, statbuf ) ;
446 for ( i = 0 ; i < lst->num; i++ ) {
447 ret = search_Font_File_Name( lst->list[i], fname );
448 if ( ret == FAL_ERROR ) {
449 FalFreeFontList( lst );
452 filename = falcom_get_base_name( fname );
453 if ( (buf[0] != '\0' && fname[0] != '\0')
454 && !strcmp( buf, filename ) ) {
455 strcpy( ofile, fname );
456 FalFreeFontList( lst );
460 COMM_DISPERRORFILE( com, lst, style, i, size_str ) ;
461 FalFreeFontList( lst );
465 case BODY_AND_LETTER:
468 ret = search_Font_File_Name( lst->list[0], fname );
469 if ( ret == FAL_ERROR ) {
470 FalFreeFontList( lst );
473 strcpy( ofile, fname );
474 FalFreeFontList( lst );
477 ret = GetDefaultFile( key.size.h, style, buf);
481 for( i = 0 ; i < lst->num; i++ ) {
482 ret = search_Font_File_Name( lst->list[0], fname );
483 if ( ret == FAL_ERROR ) {
484 FalFreeFontList( lst );
487 filename = falcom_get_base_name( fname );
488 if ( (buf[0] != '\0' && fname[0] != '\0')
489 && !strcmp( buf, filename ) ) {
490 strcpy( ofile, fname );
491 FalFreeFontList( lst );
495 USAGE1("%s : Two or more corresponding user defined characters exist.\n", com);
496 for ( i = 0 ; i < lst->num; i++ ) {
497 ret = search_Font_File_Name( lst->list[i], fname );
498 if ( ret == FAL_ERROR ) {
499 FalFreeFontList( lst );
502 fprintf( stdout, "\t%s\n", fname );
504 FalFreeFontList( lst );
506 } /* <--- switch( lst->num ) { */
507 } /* <--- switch( size_sw ) { */
512 /* take out an error message of "FalGetFontList()" */
515 * Error messages(by origin)
517 char *fal_errmsg_org[0xff] = {
520 "Cannot open the font file.",
521 "Cannot read the font file.",
522 "There is no more memory .",
523 "Fatal error occurred.",
524 "The specified font file does not exist.",
525 "This font is not a pcf or snf format.",
526 "Cannot open fonts.list file.",
527 "The format of fonts.list file is illegal.",
528 "The descriptions of the fonts.list file are incorrect.",
529 "The format of fonts.list file is illegal.",
530 "Cannot open fonts.dir file.",
531 "Cannot read fonts.dir file.",
532 "Cannot read font properties.",
533 "Cannot get \"FONT\" property.",
534 "Cannot get \"FAMILY_NAME\" property.",
536 "This font file is already opened by other application.",
537 "Cannot lock font file.",
538 "Cannot unlock font file.",
539 "Cannot get lock information from the font file.",
540 "Cannot find the specified font file.",
541 "Cannot read NLS database.",
542 "Cannot get charset names from NLS database.",
543 "Charset name not defined in NLS database.",
544 "The specified font has not been opened.",
545 "Fatal error occurred.",
546 " "," "," "," "," "," ",
548 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
550 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
552 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
554 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
556 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
558 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
560 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
562 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
564 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
566 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
568 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
570 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
572 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ",
574 " "," "," "," "," "," "," "," "," "," "," "," "," "," "," "
579 #if NeedFunctionPrototypes
580 ErrMsgTable_FalGetFontList(
586 ErrMsgTable_FalGetFontList( com, utyerr, utyderr )
587 char *com; /* command name */
588 int utyerr; /* fal_utyerror */
589 int utyderr; /* fal_utyderror */
592 char *fontsdir, *locale ;
594 if( (locale = (char *)getenv( "LANG" )) == NULL ){
598 if( (fontsdir = (char *)getenv( "DTUDCFONTS" )) == NULL ) {
599 fontsdir = DTUDCFONTSLISTDIR ;
604 USAGE2("%s : %s\n", com, fal_errmsg_org[ fal_utyerrno & 0xff ] ) ;
607 USAGE4("%s : The font directory information file(%s/%s/%s) cannot be opened.\n",
608 com, fontsdir, locale, FONTS_LIST_FILE ) ;
611 USAGE4("%s : Information cannot be read from the font directory information file(%s/%s/%s).\n", com, fontsdir, locale, FONTS_LIST_FILE );
614 USAGE1("%s : The work area cannot be secured.\n", com );
617 USAGE4("%s : Abnormality is found in the content of the font directory information file((%s/%s/%s).\n",
618 com , fontsdir, locale, FONTS_LIST_FILE);
621 USAGE4("%s : The font directory information file(%s/%s/%s) cannot be opened.\n",
622 com , fontsdir, locale, FONTS_LIST_FILE);
625 USAGE4("%s : Information cannot be read from the font directory information file(%s/%s/%s).\n",
626 com , fontsdir, locale, FONTS_LIST_FILE);
629 USAGE2("%s : %s\n", com, fal_errmsg_org[ fal_utyerrno & 0xff ] ) ;
632 USAGE1("%s : Terminates abnormally.\n", com );
638 /* take out an error message of "GetDefaultFile()" */
641 ErrMsgTable_GetDefaultFile( com, ret, size, style, fname )
642 char *com; /* a command name */
643 int ret; /* return code */
644 int size; /* a character size */
645 char *style; /* a character style */
646 char *fname; /* user defined character information file name */
650 USAGE2("%s : The user defined character information file cannot be opened. \"%s \"\n",
654 USAGE4("%s : The representative user defined character of the character size (%d) and style (%s) is not defined.\"%s\"\n",
655 com, size, (style)?style:" ", fname);
658 USAGE2("%s : Information cannot be read from the user defined character information file.\"%s\"\n", com, fname);
661 USAGE2("%s : The mistake is found in the description of the user defined character information file. \"%s\"\n", com, fname);
668 * if an end character of a file name is "/",it is cleared
675 #if NeedFunctionPrototypes
676 fal_cut_tailslash( char *name )
678 fal_cut_tailslash( name )
684 p = strrchr( name, '\0');
688 for (p-- ; (p>=name) && (*p == '/') ; p--) {
695 * get a real file name from a link file name
698 * OK¡¡¡¥¡¥a pointer of a file name
704 #if NeedFunctionPrototypes
705 GetRealFileName( char *name )
707 GetRealFileName( name )
711 static char *ret_name ;
712 char link_name[BUFSIZE];
717 AllocString( ret_name, name, NULL ) ;
718 /* strcpy( ret_name, name ) ; */
719 fal_cut_tailslash( ret_name ); /* for example /tmp/aa/ --> /tmp/aa */
722 if ( lstat( ret_name, &st ) == -1) {
723 FreeString( ret_name ) ;
727 if ( ( len = readlink( ret_name, link_name, BUFSIZE ) ) == -1 ) {
728 if ( errno == EINVAL ) {
730 /* return( strdup( ret_name ) ) ; */
732 FreeString( ret_name ) ;
736 link_name[len] = '\0';
737 if ( link_name[0] == '/' ) {
738 /* strcpy( ret_name, link_name ) ; */
739 FreeString( ret_name ) ;
740 AllocString( ret_name, link_name, NULL ) ;
744 slash = strrchr( ret_name, '/' );
747 fal_cut_tailslash( ret_name );
748 ResizeString( ret_name, NULL );
749 AddString(ret_name, "/", NULL);
751 /* ret_name[0] = '\0' ; */
752 FreeString( ret_name ) ;
753 AllocString(ret_name, "/", NULL);
755 /* strcat( ret_name, "/" ) ;
756 strcat( ret_name, link_name ) ; */
757 AddString( ret_name, link_name, NULL ) ;
765 * funtctions for search fonts by XLFD and NLS database
769 #if NeedFunctionPrototypes
776 IsInRegion(code, num_gr, gr)
783 if( code < MIN_CODE || code > MAX_CODE ) return -1 ;
784 for( i=0; i<num_gr; i++ ) {
785 if( gr[i].start < MIN_CODE || gr[i].end > MAX_CODE ) continue ;
786 if( gr[i].start <= code && gr[i].end >= code )
796 search_Font_File_Name( data, fname )
801 FalFontDataList *flist ;
805 mask = FAL_FONT_MASK_UNDEFINED | FAL_FONT_MASK_DEFINED ;
807 if( data.xlfdname ) mask |= FAL_FONT_MASK_XLFDNAME ;
808 if( data.size.h ) mask |= FAL_FONT_MASK_SIZE_H ;
809 if( data.size.w >= 0 ) mask |= FAL_FONT_MASK_SIZE_W ;
810 if( data.style.name ) mask |= FAL_FONT_MASK_STYLE_NAME ;
811 if( data.cd_set ) mask |= FAL_FONT_MASK_CODE_SET ;
813 if( data.letter.w ) mask |= FAL_FONT_MASK_LETTER_W ;
814 if( data.letter.h ) mask |= FAL_FONT_MASK_LETTER_H ;
815 if( data.letter.x ) mask |= FAL_FONT_MASK_LETTER_X ;
816 if( data.letter.y ) mask |= FAL_FONT_MASK_LETTER_Y ;
818 if( data.style.def ) mask |= FAL_FONT_MASK_STYLE_DEF ;
819 if( data.shape.name ) mask |= FAL_FONT_MASK_SHAPE_NAME ;
820 if( data.shape.def ) mask |= FAL_FONT_MASK_SHAPE_DEF ;
821 COMM_SBCHR_SETFONTDATA( data, mask ) ;
822 if( data.prm ) mask |= FAL_FONT_MASK_PERMISSION ;
824 fid = FalOpenSysFont( &data, mask, &flist ) ;
826 memset( fname, '\0', sizeof(fname) ) ;
828 dsp_font_list( flist ) ;
829 FalFreeFontList( flist ) ;
832 switch( fal_utyerror ) {
836 switch( fal_utyderror ) {
841 USAGE3("There is no font file correspond to specified font.\n(%s)\n fal_utyerror = %d fal_utyderror = %d\n",
842 ((data.xlfdname)?data.xlfdname:"null font name"), fal_utyerror, fal_utyderror ) ;
846 USAGE("System call error occured.\n" ) ;
849 USAGE3("There is no font file correspond to specified font.\n(%s)\n fal_utyerror = %d fal_utyderror = %d\n",
850 ((data.xlfdname)?data.xlfdname:"null font name"), fal_utyerror, fal_utyderror ) ;
855 if( FalFontIDToFileName( fid, &tmp_fname ) == FAL_ERROR ) {
856 USAGE3("There is no font file correspond to specified font.\n(%s)\n fal_utyerror = %d fal_utyderror = %d\n",
857 ((data.xlfdname)?data.xlfdname:"null font name"), fal_utyerror, fal_utyderror ) ;
858 FalCloseFont( fid ) ;
861 strcpy( fname, tmp_fname ) ;
862 FalFree( tmp_fname ) ;
863 FalCloseFont( fid ) ;
870 #if NeedFunctionPrototypes
878 GetUdcFileName( com, code_no, xlfdname, fname )
887 if( !xlfdname || !fname ) {
888 USAGE1("%s: null parameter\n", com ) ;
891 memset( &data, '\0', sizeof(FalFontData) ) ;
893 data.xlfdname = xlfdname ;
894 data.cd_set = FALGETFALCODESET( code_no ) ;
895 return( search_Font_File_Name( data, fname ) ) ;
900 dsp_font_list( flist )
901 FalFontDataList *flist ;
905 USAGE(" code set / size / style / xlfd\n" ) ;
906 USAGE("-------------------------------------------------------\n" ) ;
907 for( i=0; i<flist->num; i++ ) {
908 USAGE4("\t%d\t%d\t%s\t%s\n",
909 FALCODESETTONUM( flist->list[i].cd_set ),
910 flist->list[i].size.h,
911 flist->list[i].style.name,
912 flist->list[i].xlfdname
919 #if NeedFunctionPrototypes
928 GetUdcRegion( com, codeset, gpf_file, num_gr, gr )
933 FalGlyphRegion **gr ;
937 char *locale, *char_set, *tmp_gpf ;
939 if( (locale = (char *)getenv( "LANG" )) == NULL ){
942 /* parameter check */
943 if( gpf_file == NULL || gr == NULL ) {
944 USAGE1("%s : null parameters.\n", com);
948 /* get font properties */
949 tmp_gpf = (char *)GetRealFileName( gpf_file ) ;
950 if( tmp_gpf == NULL ){
953 if( falReadFontProp( tmp_gpf, FAL_FONT_PRM, &fdata, 1 ) ) {
954 USAGE1("%s : Failed to get font properties.\n", com ) ;
958 GETCHARSETSTR( char_set, fdata.xlfdname ) ;
959 if( FalGetUDCGIArea( locale, FALGETFALCODESET(codeset), char_set, gr, num_gr ) == FAL_ERROR )
961 USAGE3("%s : Failed to get UDC code region. ( code set %d charset %s )\n",
962 com, codeset, char_set ) ;
967 USAGE3("%s : Failed to get UDC code region. ( code set %d charset %s )\n",
968 com, codeset, char_set ) ;
977 #define MAX_CODESET 8
980 #if NeedFunctionPrototypes
981 DispUdcCpArea( FILE *fp )
988 FalFontDataList *fls ;
995 if( (locale = (char *)getenv( "LANG" )) == NULL ){
998 memset( &fdata, 0, sizeof(FalFontData) ) ;
1000 mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED |
1001 FAL_FONT_MASK_CODE_SET ;
1003 for( cd_set=0; cd_set<MAX_CODESET; cd_set++ ){
1005 fdata.cd_set = FALGETFALCODESET(cd_set) ;
1006 if( FalGetFontList(&fdata, mask, &fls) == FAL_ERROR ){
1009 if( fls->num == 0 ){
1012 GETCHARSETSTR( char_set, fls->list[0].xlfdname ) ;
1013 if( FalGetUDCCPArea( locale,
1014 fls->list[0].cd_set, char_set, &cr, &num_cr ) == FAL_ERROR ){
1020 /* display UDC code region */
1021 USAGE1(" %d", cd_set ) ;
1022 for( j=0; j<num_cr; j++ ){
1023 USAGE2("\t\t0x%x - 0x%x\n", cr[j].start, cr[j].end ) ;
1025 if( FalFreeFontList( fls ) == FAL_ERROR ){
1035 #if NeedFunctionPrototypes
1042 GetUdcFontName( gpf_file, bdf_file, fontname )
1050 #if defined( SVR4 ) || defined( SYSV ) || defined(CSRG_BASED)
1053 union wait chld_stat ;
1055 struct ptobhead head ;
1056 char *p, *tmp_font ;
1057 char readbuf[BUFSIZE], fntbuf[BUFSIZE] ;
1058 unsigned int getstat;
1061 p = tmp_font = NULL ;
1065 memset( &head, 0, sizeof(struct ptobhead) ) ;
1067 head.snf_file = GetRealFileName( gpf_file ) ;
1068 if( head.snf_file == NULL ) return STAT_ERROR ;
1069 }else if( bdf_file ){
1070 head.bdf_file = GetRealFileName( bdf_file ) ;
1071 if( head.bdf_file == NULL ) return STAT_ERROR ;
1077 * write BDF header into FIFO
1079 if (head.snf_file != NULL) {
1080 if (pipe(fd) != 0) {
1083 switch (chld_pid = fork()) {
1086 if(dup(fd[1]) < 0) {
1091 execl( oakgtobdf, oakgtobdf, head.snf_file, "-H", 0);
1092 USAGE1("Cannot execute %s\n", oakgtobdf ) ;
1100 if((fp = (FILE *)fdopen(fd[0], "r")) == NULL) {
1102 kill( chld_pid, SIGKILL );
1103 WaitID( chld_pid, chld_stat ) ;
1104 return FDOPEN_ERROR;
1107 if ((fp = fopen(head.bdf_file, "r")) == NULL) {
1108 return(BDF_OPEN_HEAD);
1117 if (fgets(readbuf, BUFSIZE, fp) == NULL) {
1119 if (head.snf_file != NULL) {
1120 kill( chld_pid, SIGKILL );
1121 WaitID( chld_pid, chld_stat ) ;
1128 if (!strncmp( p, "ENDPROPERTIES", strlen("ENDPROPERTIES") )) {
1130 if (head.snf_file != NULL) {
1131 kill( chld_pid, SIGKILL );
1132 WaitID( chld_pid, chld_stat ) ;
1136 if (!strncmp( p, "FONT ", strlen("FONT ") )) {
1141 while( *ep != '\n' ){
1145 strcpy(fntbuf, sp) ;
1148 if (head.snf_file != NULL) {
1149 kill( chld_pid, SIGKILL );
1150 WaitID( chld_pid, chld_stat ) ;
1156 if( getstat != 0x01 ){
1163 if( (tmp_font = (char *)strdup( fntbuf )) == NULL ){
1164 return MALLOC_ERROR ;
1166 *fontname = tmp_font ;