1 /*
2 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
5
6 #pragma ident "%Z%%M% %I% %E% SMI"
7
8 #include "config.h"
9 #include <string.h>
10 #include "extensions.h"
11 #include "proto.h"
12
13 #define DEFXFERFORMAT "%T %Xt %R %Xn %XP %Xy %Xf %Xd %Xm %U ftp %Xa %u %Xc"
14
15 int xferdone = 0;
16 struct xferstat xfervalues;
17 char xferlog_format[MAXXFERSTRLEN] = DEFXFERFORMAT;
18
19 /*************************************************************************/
20 /* FUNCTION : get_xferlog_format */
21 /* PURPOSE : Read the xferlog format string from ftpaccess into */
22 /* xferlog_format if it exists otherwise load default string */
23 /* ARGUMENTS : none */
24 /*************************************************************************/
25
26 void get_xferlog_format(void)
27 {
28 int which;
29 struct aclmember *entry = (struct aclmember *)NULL;
30
31 /* xferlog format <formatstring> */
32 xferlog_format[0] = '\0';
33 while (getaclentry("xferlog", &entry)) {
34 if (ARG0 && (strcasecmp(ARG0, "format") == 0)) {
35 for (which = 1; (which < MAXARGS) && ARG[which]; which++) {
36 if (which > 1) {
37 if (strlcat(xferlog_format, " ",
38 sizeof(xferlog_format)) >= sizeof(xferlog_format))
39 break;
40 }
41 if (strlcat(xferlog_format, ARG[which],
42 sizeof(xferlog_format)) >= sizeof(xferlog_format))
43 break;
44 }
45 break;
46 }
47 }
48
49 /* default xferlog format */
50 if (xferlog_format[0] == '\0')
51 (void) strlcpy(xferlog_format, DEFXFERFORMAT, sizeof(xferlog_format));
52 }