Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
b29f0fa8
Commit
b29f0fa8
authored
4 years ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Replace print() with writeln()
parent
4baf1a3d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!463
MRC mods by Codefenix (2024-10-20)
Pipeline
#1871
passed
4 years ago
Stage: build
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/addfiles.js
+33
-33
33 additions, 33 deletions
exec/addfiles.js
with
33 additions
and
33 deletions
exec/addfiles.js
+
33
−
33
View file @
b29f0fa8
...
...
@@ -13,22 +13,22 @@ const default_excludes = [
];
if
(
argv
.
indexOf
(
"
-help
"
)
>=
0
||
argv
.
indexOf
(
"
-?
"
)
>=
0
)
{
p
ri
n
t
(
"
usage: [-options] [dir-code] [listfile]
"
);
p
ri
n
t
(
"
options:
"
);
p
ri
nt
(
"
-all add files in all libraries/directories (implies -auto)
"
);
p
ri
nt
(
"
-lib=<name> add files in all directories of specified library (implies -auto)
"
);
p
ri
nt
(
"
-from=<name> specify uploader's user name (may require quotes)
"
);
p
ri
nt
(
"
-ex=<filename> add to excluded filename list
"
);
p
ri
nt
(
"
(default:
"
+
default_excludes
.
join
(
'
,
'
)
+
"
)
"
);
p
ri
nt
(
"
-diz always extract/use description in archive
"
);
p
ri
nt
(
"
-update update existing file entries (default is to skip them)
"
);
p
ri
nt
(
"
-date[=fmt] include today's date in description
"
);
p
ri
nt
(
"
-fdate[=fmt] include file's date in description
"
);
p
ri
nt
(
"
-adate[=fmt] include newest archived file date in description
"
);
p
ri
nt
(
"
(fmt = optional strftime date/time format string)
"
);
p
ri
nt
(
"
-delete delete list after import
"
);
p
ri
nt
(
"
-v increase verbosity of output
"
);
p
ri
nt
(
"
-debug enable debug output
"
);
w
rit
eln
(
"
usage: [-options] [dir-code] [listfile]
"
);
w
rit
eln
(
"
options:
"
);
w
ri
teln
(
"
-all add files in all libraries/directories (implies -auto)
"
);
w
ri
teln
(
"
-lib=<name> add files in all directories of specified library (implies -auto)
"
);
w
ri
teln
(
"
-from=<name> specify uploader's user name (may require quotes)
"
);
w
ri
teln
(
"
-ex=<filename> add to excluded filename list
"
);
w
ri
teln
(
"
(default:
"
+
default_excludes
.
join
(
'
,
'
)
+
"
)
"
);
w
ri
teln
(
"
-diz always extract/use description in archive
"
);
w
ri
teln
(
"
-update update existing file entries (default is to skip them)
"
);
w
ri
teln
(
"
-date[=fmt] include today's date in description
"
);
w
ri
teln
(
"
-fdate[=fmt] include file's date in description
"
);
w
ri
teln
(
"
-adate[=fmt] include newest archived file date in description
"
);
w
ri
teln
(
"
(fmt = optional strftime date/time format string)
"
);
w
ri
teln
(
"
-delete delete list after import
"
);
w
ri
teln
(
"
-v increase verbosity of output
"
);
w
ri
teln
(
"
-debug enable debug output
"
);
exit
(
0
);
}
...
...
@@ -126,7 +126,7 @@ if(!dir_list.length) {
var
code
;
while
(
!
file_area
.
dir
[
code
]
&&
!
js
.
terminated
)
{
for
(
var
d
in
file_area
.
dir
)
p
ri
n
t
(
d
);
w
rit
eln
(
d
);
code
=
prompt
(
"
Directory code
"
);
}
dir_list
.
push
(
code
);
...
...
@@ -144,7 +144,7 @@ for(var d = 0; d < dir_list.length; d++) {
}
if
(
options
.
auto
&&
(
dir
.
settings
&
DIR_NOAUTO
))
continue
;
p
ri
n
t
(
"
Adding files to
"
+
dir
.
lib_name
+
"
"
+
dir
.
name
);
w
rit
eln
(
"
Adding files to
"
+
dir
.
lib_name
+
"
"
+
dir
.
name
);
var
filebase
=
new
FileBase
(
code
);
if
(
!
filebase
.
open
(
"
r
"
))
{
...
...
@@ -157,7 +157,7 @@ for(var d = 0; d < dir_list.length; d++) {
for
(
var
i
=
0
;
i
<
name_list
.
length
;
i
++
)
{
name_list
[
i
]
=
name_list
[
i
].
toUpperCase
();
if
(
options
.
debug
)
p
ri
n
t
(
name_list
[
i
]);
w
rit
eln
(
name_list
[
i
]);
}
var
file_list
=
[];
...
...
@@ -166,7 +166,7 @@ for(var d = 0; d < dir_list.length; d++) {
listpath
=
file_getcase
(
dir
.
path
+
listfile
)
||
file_getcase
(
listfile
);
var
f
=
new
File
(
listpath
);
if
(
f
.
exists
)
{
p
ri
n
t
(
"
Opening
"
+
f
.
name
);
w
rit
eln
(
"
Opening
"
+
f
.
name
);
if
(
!
f
.
open
(
'
r
'
))
{
alert
(
"
Error
"
+
f
.
error
+
"
(
"
+
strerror
(
f
.
error
)
+
"
) opening
"
+
f
.
name
);
exit
(
1
);
...
...
@@ -190,21 +190,21 @@ for(var d = 0; d < dir_list.length; d++) {
var
file
=
file_list
[
i
];
file
.
from
=
uploader
;
if
(
options
.
debug
)
p
ri
n
t
(
JSON
.
stringify
(
file
,
null
,
4
));
w
rit
eln
(
JSON
.
stringify
(
file
,
null
,
4
));
else
if
(
verbosity
)
p
ri
ntf
(
"
%s
"
,
file
.
name
);
w
ri
te
(
file
.
name
+
"
"
);
if
(
exclude
.
indexOf
(
file
.
name
.
toUpperCase
())
>=
0
)
{
if
(
verbosity
)
p
ri
n
t
(
"
excluded (ignored)
"
);
w
rit
eln
(
"
excluded (ignored)
"
);
continue
;
}
file
.
extdesc
=
lfexpand
(
file
.
extdesc
);
if
(
verbosity
>
1
)
p
ri
n
t
(
JSON
.
stringify
(
file
));
w
rit
eln
(
JSON
.
stringify
(
file
));
var
exists
=
name_list
.
indexOf
(
filebase
.
get_name
(
file
.
name
).
toUpperCase
())
>=
0
;
if
(
exists
&&
!
options
.
update
)
{
if
(
verbosity
)
p
ri
n
t
(
"
already added
"
);
w
rit
eln
(
"
already added
"
);
continue
;
}
var
path
=
file_area
.
dir
[
code
].
path
+
file
.
name
;
...
...
@@ -231,7 +231,7 @@ for(var d = 0; d < dir_list.length; d++) {
if
(
!
filebase
.
update
(
file
.
name
,
file
,
options
.
diz
))
{
alert
(
"
Error
"
+
filebase
.
last_error
+
"
updating
"
+
file
.
name
);
}
else
{
p
ri
n
t
(
"
Updated
"
+
file
.
name
);
w
rit
eln
(
"
Updated
"
+
file
.
name
);
updated
++
;
}
}
else
{
...
...
@@ -239,24 +239,24 @@ for(var d = 0; d < dir_list.length; d++) {
if
(
!
filebase
.
add
(
file
,
options
.
diz
))
{
alert
(
"
Error
"
+
filebase
.
last_error
+
"
adding
"
+
file
.
name
);
}
else
{
p
ri
n
t
(
"
Added
"
+
file
.
name
);
w
rit
eln
(
"
Added
"
+
file
.
name
);
added
++
;
}
}
}
if
(
listpath
&&
options
.
delete
)
{
if
(
verbosity
)
p
ri
n
t
(
"
Deleting list file:
"
+
listpath
);
w
rit
eln
(
"
Deleting list file:
"
+
listpath
);
if
(
file_remove
(
listpath
))
p
ri
n
t
(
"
List file deleted:
"
+
listpath
);
w
rit
eln
(
"
List file deleted:
"
+
listpath
);
else
alert
(
"
Failed to delete list file:
"
+
listpath
);
}
filebase
.
close
();
}
p
ri
n
t
(
added
+
"
files added
"
);
w
rit
eln
(
added
+
"
files added
"
);
if
(
updated
)
p
ri
n
t
(
updated
+
"
files updated
"
);
w
rit
eln
(
updated
+
"
files updated
"
);
// Parse a FILES.BBS (or similar) file listing file
// Note: file descriptions must begin with an alphabetic character
...
...
@@ -266,7 +266,7 @@ function parse_file_list(lines)
for
(
var
i
=
0
;
i
<
lines
.
length
;
i
++
)
{
var
line
=
lines
[
i
];
var
match
=
line
.
match
(
/
(
^
[\w]
+
[\w\-\!\#\.]
*
)\W
+
[^
A-Za-z
]
*
(
.*
)
/
);
//
p
ri
n
t('fname line match: ' + JSON.stringify(match));
//
w
rit
eln
('fname line match: ' + JSON.stringify(match));
if
(
match
&&
match
.
length
>
1
)
{
var
file
=
{
name
:
match
[
1
],
desc
:
match
[
2
]
};
if
(
file
.
desc
&&
file
.
desc
.
length
>
LEN_FDESC
)
...
...
@@ -280,7 +280,7 @@ function parse_file_list(lines)
alert
(
"
Ignoring line:
"
+
line
);
continue
;
}
//
p
ri
n
t('match: ' + JSON.stringify(match));
//
w
rit
eln
('match: ' + JSON.stringify(match));
if
(
match
&&
match
.
length
>
1
&&
file_list
.
length
)
{
var
file
=
file_list
[
file_list
.
length
-
1
];
if
(
!
file
.
extdesc
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment