#include "quipu/attrvalue.h"
#include "quipu/malloc.h"
char * parse_file
= NULLCP
;
extern AttributeType last_at
;
int dflt_attr_file (at
,x
,full
)
/* make default file name */
fs
= (struct file_syntax
*) x
->av_struct
;
if ((parse_file
!= NULLCP
) && ((pathend
= rindex (parse_file
,'/')) != NULLCP
)) {
last_heap
= mem_heap
; /* put PS on general heap */
sps
= ps_alloc (str_open
);
if (str_setup (sps
,buffer
,LINESIZE
,1) == NOTOK
) {
if (parse_rdn
== NULLRDN
) {
ps_printf (sps
,"/tmp/%s_%d",at
->oa_ot
.ot_name
,getpid());
rdn_print (sps
,parse_rdn
,EDBOUT
);
ps_printf (sps
,".%s",at
->oa_ot
.ot_name
);
|| ((full
) && (strlen(buffer
) > MAXFILENAMELEN
))) {
/* Multi valued file attribute - can only default 1st case */
/* Would be much nicer if the file names were consistent. */
/* At the moment unreferenced files will be left undeleted */
/* (Unless management tools clean up ) */
for (i
=0 ; (*nptr
!=0) && (i
< MAXFILENAMELEN
-6) ; nptr
++)
(void) strcpy (mptr
,"XXXXXX");
fs
->fs_name
= mktemp(strdup (_isodefile(path
,nbuf
)));
fs
->fs_name
= mktemp(strdup (nbuf
));
fs
->fs_name
= strdup (_isodefile(path
,buffer
));
fs
->fs_name
= strdup (buffer
);
fileattr_print (ps
,y
,format
)
fs
= (struct file_syntax
*) y
->av_struct
;
AttrV_print (ps
,fs
->fs_attr
,format
);
ps_print (ps
,"Internal error, need to load the file!!!");
if (fs
->fs_name
== NULLCP
) {
if (dflt_attr_file (last_at
,y
,0) == NOTOK
) {
LLOG (log_dsap
,LLOG_EXCEPTIONS
,("Could not make default attribute file"));
ps_print (ps
,fs
->fs_name
);
} else if ( ! (fs
->fs_mode
& FS_DEFAULT
))
ps_print (ps
,fs
->fs_name
);
if (fs
->fs_attr
== NULLAttrV
) /* already exists */
if (fs
->fs_mode
& FS_CREATE
) /* already written */
if ((fptr
= fopen (fs
->fs_name
,"w")) != NULL
) {
if ((fps
= ps_alloc (std_open
)) == NULLPS
) {
LLOG (log_dsap
,LLOG_EXCEPTIONS
,("Could not alloc PS file '%s'",fs
->fs_name
));
if ((std_setup (fps
,fptr
)) == NOTOK
) {
LLOG (log_dsap
,LLOG_EXCEPTIONS
,("Could not open PS file '%s'",fs
->fs_name
));
LLOG ( log_dsap
,LLOG_EXCEPTIONS
,("Could not open attribute file '%s'",fs
->fs_name
));
AttrV_print (fps
,fs
->fs_attr
,FILEOUT
);
AttrV_free (fs
->fs_attr
);
fs
->fs_mode
|= FS_CREATE
;
DLOG (log_dsap
,LLOG_DEBUG
,("Written photo file '%s'",fs
->fs_name
));