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
366edd9d
Commit
366edd9d
authored
20 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
If a URL is passed, and the specified system is in the phone book,
use the phone book entry.
parent
c0b3478f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/syncterm/bbslist.c
+11
-5
11 additions, 5 deletions
src/syncterm/bbslist.c
src/syncterm/bbslist.h
+5
-0
5 additions, 0 deletions
src/syncterm/bbslist.h
src/syncterm/syncterm.c
+55
-30
55 additions, 30 deletions
src/syncterm/syncterm.c
with
71 additions
and
35 deletions
src/syncterm/bbslist.c
+
11
−
5
View file @
366edd9d
...
...
@@ -9,11 +9,6 @@
#include
"uifcinit.h"
#include
"conn.h"
enum
{
USER_BBSLIST
,
SYSTEM_BBSLIST
};
char
*
screen_modes
[]
=
{
"Current"
,
"80x25"
,
"80x28"
,
"80x43"
,
"80x50"
,
"80x60"
,
""
};
void
sort_list
(
struct
bbslist
**
list
)
{
...
...
@@ -34,6 +29,15 @@ void sort_list(struct bbslist **list) {
}
}
void
free_list
(
struct
bbslist
**
list
,
int
listcount
)
{
int
i
;
for
(
i
=
0
;
i
<
listcount
;
i
++
)
{
free
(
list
[
i
]);
}
}
/*
* Reads in a BBS list from listpath using *i as the counter into bbslist
* first BBS read goes into list[i]
...
...
@@ -303,6 +307,7 @@ struct bbslist *show_bbslist(int mode, char *path)
mode
=
BBSLIST_SELECT
;
break
;
case
-
1
:
/* ESC */
free_list
(
&
list
[
0
],
listcount
);
return
(
NULL
);
}
}
...
...
@@ -436,6 +441,7 @@ struct bbslist *show_bbslist(int mode, char *path)
}
else
{
memcpy
(
&
retlist
,
list
[
val
],
sizeof
(
struct
bbslist
));
free_list
(
&
list
[
0
],
listcount
);
return
(
&
retlist
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/syncterm/bbslist.h
+
5
−
0
View file @
366edd9d
...
...
@@ -8,6 +8,11 @@
#define MAX_USER_LEN 16
#define MAX_PASSWD_LEN 16
enum
{
USER_BBSLIST
,
SYSTEM_BBSLIST
};
enum
{
BBSLIST_SELECT
,
BBSLIST_EDIT
...
...
This diff is collapsed.
Click to expand it.
src/syncterm/syncterm.c
+
55
−
30
View file @
366edd9d
...
...
@@ -52,6 +52,12 @@ int main(int argc, char **argv)
char
*
p3
;
int
i
;
int
ciolib_mode
=
CIOLIB_MODE_AUTO
;
struct
bbslist
*
list
[
MAX_OPTS
+
1
];
int
listcount
=
0
;
str_list_t
inifile
;
FILE
*
listfile
;
char
listpath
[
MAX_PATH
+
1
];
char
*
home
;
/* UIFC initialization */
memset
(
&
uifc
,
0
,
sizeof
(
uifc
));
...
...
@@ -125,12 +131,34 @@ int main(int argc, char **argv)
FULLPATH
(
path
,
drive
,
sizeof
(
path
));
atexit
(
uifcbail
);
/* User BBS list path */
home
=
getenv
(
"HOME"
);
if
(
home
==
NULL
)
home
=
getenv
(
"USERPROFILE"
);
if
(
home
==
NULL
)
strcpy
(
listpath
,
path
);
else
strcpy
(
listpath
,
home
);
strncat
(
listpath
,
"/syncterm.lst"
,
sizeof
(
listpath
));
if
(
strlen
(
listpath
)
>
MAX_PATH
)
{
fprintf
(
stderr
,
"Path to syncterm.lst too long"
);
return
(
0
);
}
/* Auto-connect URL */
if
(
url
[
0
])
{
if
((
bbs
=
(
struct
bbslist
*
)
malloc
(
sizeof
(
struct
bbslist
)))
==
NULL
)
{
uifcmsg
(
"Unable to allocate memory"
,
"The system was unable to allocate memory."
);
return
(
1
);
}
bbs
->
id
=-
1
;
bbs
->
added
=
time
(
NULL
);
bbs
->
calls
=
0
;
bbs
->
user
[
0
]
=
0
;
bbs
->
password
[
0
]
=
0
;
bbs
->
type
=
USER_BBSLIST
;
bbs
->
reversed
=
FALSE
;
bbs
->
screen_mode
=
SCREEN_MODE_CURRENT
;
if
(
!
strnicmp
(
"rlogin://"
,
url
,
9
))
{
bbs
->
conn_type
=
CONN_TYPE_RLOGIN
;
bbs
->
port
=
513
;
...
...
@@ -141,12 +169,10 @@ int main(int argc, char **argv)
}
else
goto
USAGE
;
bbs
->
user
[
0
]
=
0
;
bbs
->
password
[
0
]
=
0
;
p1
=
url
+
9
;
/* Remove trailing / (Win32 adds one 'cause it hates me) */
p2
=
strchr
(
p1
,
'/'
);
if
(
p2
!=
NULL
)
;
if
(
p2
!=
NULL
)
*
p2
=
0
;
p3
=
strchr
(
p1
,
'@'
);
if
(
p3
!=
NULL
)
{
...
...
@@ -170,6 +196,20 @@ int main(int argc, char **argv)
goto
USAGE
;
}
SAFECOPY
(
bbs
->
addr
,
p1
);
/* Find BBS listing in users phone book */
read_list
(
listpath
,
&
list
[
0
],
&
listcount
,
USER_BBSLIST
);
for
(
i
=
0
;
i
<
listcount
;
i
++
)
{
if
((
stricmp
(
bbs
->
addr
,
list
[
i
]
->
addr
)
==
0
)
&&
(
bbs
->
port
==
list
[
i
]
->
port
)
&&
(
bbs
->
conn_type
==
list
[
i
]
->
conn_type
)
&&
(
bbs
->
user
[
0
]
==
0
||
(
stricmp
(
bbs
->
name
,
list
[
i
]
->
name
)
==
0
))
&&
(
bbs
->
password
[
0
]
==
0
||
(
stricmp
(
bbs
->
password
,
list
[
i
]
->
password
)
==
0
)))
{
memcpy
(
bbs
,
list
[
i
],
sizeof
(
struct
bbslist
));
break
;
}
}
free_list
(
&
list
[
0
],
listcount
);
}
if
(
!
winsock_startup
())
...
...
@@ -179,27 +219,10 @@ int main(int argc, char **argv)
if
(
!
conn_connect
(
bbs
->
addr
,
bbs
->
port
,
bbs
->
reversed
?
bbs
->
password
:
bbs
->
user
,
bbs
->
reversed
?
bbs
->
user
:
bbs
->
password
,
bbs
->
conn_type
))
{
/* ToDo: Update the entry with new lastconnected */
/* ToDo: Disallow duplicate entries */
str_list_t
inifile
;
FILE
*
listfile
;
char
listpath
[
MAX_PATH
+
1
];
char
*
home
;
/* User BBS list */
home
=
getenv
(
"HOME"
);
if
(
home
==
NULL
)
home
=
getenv
(
"USERPROFILE"
);
if
(
home
==
NULL
)
strcpy
(
listpath
,
path
);
else
strcpy
(
listpath
,
home
);
strncat
(
listpath
,
"/syncterm.lst"
,
sizeof
(
listpath
));
if
(
strlen
(
listpath
)
>
MAX_PATH
)
{
fprintf
(
stderr
,
"Path to syncterm.lst too long"
);
return
(
0
);
}
bbs
->
connected
=
time
(
NULL
);
bbs
->
calls
++
;
if
(
!
url
[
0
]
)
{
if
(
bbs
->
id
!=
-
1
)
{
if
((
listfile
=
fopen
(
listpath
,
"r"
))
!=
NULL
)
{
inifile
=
iniReadFile
(
listfile
);
fclose
(
listfile
);
...
...
@@ -239,15 +262,17 @@ int main(int argc, char **argv)
settitle
(
"SyncTERM"
);
}
if
(
url
[
0
])
{
char
*
YesNo
[
3
]
=
{
"Yes"
,
"No"
,
""
};
/* Started from the command-line with a URL */
init_uifc
();
switch
(
uifc
.
list
(
WIN_MID
|
WIN_SAV
,
0
,
0
,
0
,
&
i
,
NULL
,
"Save this BBS in directory?"
,
YesNo
))
{
case
0
:
/* Yes */
add_bbs
(
path
,
bbs
);
break
;
default:
/* ESC/No */
break
;
if
(
bbs
->
id
==-
1
)
{
char
*
YesNo
[
3
]
=
{
"Yes"
,
"No"
,
""
};
/* Started from the command-line with a URL */
init_uifc
();
switch
(
uifc
.
list
(
WIN_MID
|
WIN_SAV
,
0
,
0
,
0
,
&
i
,
NULL
,
"Save this BBS in directory?"
,
YesNo
))
{
case
0
:
/* Yes */
add_bbs
(
path
,
bbs
);
break
;
default:
/* ESC/No */
break
;
}
}
free
(
bbs
);
bbs
=
NULL
;
...
...
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