Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
0a9640c7
Commit
0a9640c7
authored
Sep 09, 2007
by
rswindell
Browse files
Added -new option, to specify the maximum number of days since files were
uploaded to include the list output.
parent
1a726f2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
7 deletions
+26
-7
src/sbbs3/filelist.c
src/sbbs3/filelist.c
+26
-7
No files found.
src/sbbs3/filelist.c
View file @
0a9640c7
...
...
@@ -10,7 +10,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 200
0
Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 200
7
Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
...
...
@@ -39,7 +39,7 @@
#include "sbbs.h"
#define FILELIST_VER "3.
0
0"
#define FILELIST_VER "3.
1
0"
#define MAX_NOTS 25
...
...
@@ -106,8 +106,9 @@ int main(int argc, char **argv)
uchar
*
datbuf
,
*
ixbbuf
;
int
i
,
j
,
file
,
dirnum
,
libnum
,
desc_off
,
lines
,
nots
=
0
,
omode
=
O_WRONLY
|
O_CREAT
|
O_TRUNC
;
ulong
l
,
m
,
n
,
cdt
,
misc
=
0
,
total_cdt
=
0
,
total_files
=
0
,
datbuflen
;
time_t
uld
,
dld
;
ulong
l
,
m
,
n
,
cdt
,
misc
=
0
,
total_cdt
=
0
,
total_files
=
0
,
dir_files
,
datbuflen
;
time_t
uld
,
dld
,
now
;
long
max_age
=
0
;
FILE
*
in
,
*
out
=
NULL
;
sscanf
(
"$Revision$"
,
"%*s %s"
,
revision
);
...
...
@@ -129,6 +130,7 @@ int main(int argc, char **argv)
printf
(
"
\n
"
);
printf
(
"switches: -lib name All directories of specified library
\n
"
);
printf
(
" -not code Exclude specific directory
\n
"
);
printf
(
" -new days Include only new files in listing (days since upload)
\n
"
);
printf
(
" -cat Concatenate to existing outfile
\n
"
);
printf
(
" -pad Pad filename with spaces
\n
"
);
printf
(
" -hdr Include directory headers
\n
"
);
...
...
@@ -156,6 +158,8 @@ int main(int argc, char **argv)
exit
(
1
);
}
now
=
time
(
NULL
);
memset
(
&
scfg
,
0
,
sizeof
(
scfg
));
scfg
.
size
=
sizeof
(
scfg
);
SAFECOPY
(
scfg
.
ctrl_dir
,
p
);
...
...
@@ -221,6 +225,14 @@ int main(int argc, char **argv)
printf
(
"
\n
Both library name and -all parameters were used.
\n
"
);
exit
(
1
);
}
misc
|=
ALL
;
}
else
if
(
!
stricmp
(
argv
[
i
],
"-new"
))
{
i
++
;
if
(
i
>=
argc
)
{
printf
(
"
\n
Days since upload must follow -new parameter.
\n
"
);
exit
(
1
);
}
max_age
=
strtol
(
argv
[
i
],
NULL
,
0
);
}
else
if
(
!
stricmp
(
argv
[
i
],
"-pad"
))
misc
|=
PAD
;
else
if
(
!
stricmp
(
argv
[
i
],
"-cat"
))
...
...
@@ -271,6 +283,7 @@ int main(int argc, char **argv)
misc
|=
AUTO
;
}
for
(
i
=
0
;
i
<
scfg
.
total_dirs
;
i
++
)
{
dir_files
=
0
;
if
(
!
(
misc
&
ALL
)
&&
i
!=
dirnum
&&
scfg
.
dir
[
i
]
->
lib
!=
libnum
)
continue
;
for
(
j
=
0
;
j
<
nots
;
j
++
)
...
...
@@ -344,8 +357,6 @@ int main(int argc, char **argv)
str
[
j
]
=
ixbbuf
[
m
++
];
/* Turns FILENAMEEXT into FILENAME.EXT */
str
[
j
]
=
0
;
unpadfname
(
str
,
fname
);
fprintf
(
out
,
"%-12.12s"
,
misc
&
PAD
?
str
:
fname
);
total_files
++
;
n
=
ixbbuf
[
m
]
|
((
long
)
ixbbuf
[
m
+
1
]
<<
8
)
|
((
long
)
ixbbuf
[
m
+
2
]
<<
16
);
uld
=
(
ixbbuf
[
m
+
3
]
|
((
long
)
ixbbuf
[
m
+
4
]
<<
8
)
|
((
long
)
ixbbuf
[
m
+
5
]
<<
16
)
|
((
long
)
ixbbuf
[
m
+
6
]
<<
24
));
...
...
@@ -358,7 +369,14 @@ int main(int argc, char **argv)
fprintf
(
stderr
,
"
\n\7
%s%s is corrupted!
\n
"
,
scfg
.
dir
[
i
]
->
data_dir
,
scfg
.
dir
[
i
]
->
code
);
exit
(
-
1
);
}
if
(
max_age
&&
((
now
-
uld
)
/
(
24
*
60
*
60
)
>
max_age
))
continue
;
fprintf
(
out
,
"%-12.12s"
,
misc
&
PAD
?
str
:
fname
);
total_files
++
;
dir_files
++
;
if
(
misc
&
PLUS
&&
datbuf
[
n
+
F_MISC
]
!=
ETX
&&
(
datbuf
[
n
+
F_MISC
]
-
' '
)
&
FM_EXTDESC
)
...
...
@@ -449,7 +467,8 @@ int main(int argc, char **argv)
fprintf
(
out
,
"
\r\n
"
);
}
free
((
char
*
)
datbuf
);
free
((
char
*
)
ixbbuf
);
fprintf
(
out
,
"
\r\n
"
);
/* blank line at end of dir */
if
(
dir_files
)
fprintf
(
out
,
"
\r\n
"
);
/* blank line at end of dir */
if
(
misc
&
AUTO
)
fclose
(
out
);
}
if
(
misc
&
TOT
&&
!
(
misc
&
AUTO
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment