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
743f77a6
Commit
743f77a6
authored
22 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Moved C-exported functions to str_util.c
parent
a4da9482
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/str.cpp
+0
-159
0 additions, 159 deletions
src/sbbs3/str.cpp
with
0 additions
and
159 deletions
src/sbbs3/str.cpp
+
0
−
159
View file @
743f77a6
...
...
@@ -37,81 +37,6 @@
#include
"sbbs.h"
const
char
*
wday
[]
=
{
"Sun"
,
"Mon"
,
"Tue"
,
"Wed"
,
"Thu"
,
"Fri"
,
"Sat"
};
const
char
*
mon
[]
=
{
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"Jun"
,
"Jul"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
};
/****************************************************************************/
/* Removes ctrl-a codes from the string 'instr' */
/****************************************************************************/
char
*
DLLCALL
remove_ctrl_a
(
char
*
instr
,
char
*
outstr
)
{
char
str
[
1024
],
*
p
;
uint
i
,
j
;
for
(
i
=
j
=
0
;
instr
[
i
]
&&
j
<
sizeof
(
str
)
-
1
;
i
++
)
{
if
(
instr
[
i
]
==
CTRL_A
&&
instr
[
i
+
1
]
!=
0
)
i
++
;
else
str
[
j
++
]
=
instr
[
i
];
}
str
[
j
]
=
0
;
if
(
outstr
!=
NULL
)
p
=
outstr
;
else
p
=
instr
;
strcpy
(
p
,
str
);
return
(
p
);
}
char
*
DLLCALL
strip_ctrl
(
char
*
str
)
{
char
tmp
[
1024
];
int
i
,
j
;
for
(
i
=
j
=
0
;
str
[
i
]
&&
j
<
(
int
)
sizeof
(
tmp
)
-
1
;
i
++
)
if
(
str
[
i
]
==
CTRL_A
&&
str
[
i
+
1
]
!=
0
)
i
++
;
else
if
((
uchar
)
str
[
i
]
>=
SP
)
tmp
[
j
++
]
=
str
[
i
];
tmp
[
j
]
=
0
;
strcpy
(
str
,
tmp
);
return
(
str
);
}
char
*
DLLCALL
strip_exascii
(
char
*
str
)
{
char
tmp
[
1024
];
int
i
,
j
;
for
(
i
=
j
=
0
;
str
[
i
]
&&
j
<
(
int
)
sizeof
(
tmp
)
-
1
;
i
++
)
if
(
!
(
str
[
i
]
&
0x80
))
tmp
[
j
++
]
=
str
[
i
];
tmp
[
j
]
=
0
;
strcpy
(
str
,
tmp
);
return
(
str
);
}
char
*
DLLCALL
prep_file_desc
(
char
*
str
)
{
char
tmp
[
1024
];
int
i
,
j
;
for
(
i
=
j
=
0
;
str
[
i
];
i
++
)
if
(
str
[
i
]
==
CTRL_A
&&
str
[
i
+
1
]
!=
0
)
i
++
;
else
if
(
j
&&
str
[
i
]
<=
SP
&&
tmp
[
j
-
1
]
==
SP
)
continue
;
else
if
(
i
&&
!
isalnum
(
str
[
i
])
&&
str
[
i
]
==
str
[
i
-
1
])
continue
;
else
if
((
uchar
)
str
[
i
]
>=
SP
)
tmp
[
j
++
]
=
str
[
i
];
else
if
(
str
[
i
]
==
TAB
||
(
str
[
i
]
==
CR
&&
str
[
i
+
1
]
==
LF
))
tmp
[
j
++
]
=
SP
;
tmp
[
j
]
=
0
;
strcpy
(
str
,
tmp
);
return
(
str
);
}
/****************************************************************************/
/* Lists all users who have access to the current sub. */
/****************************************************************************/
...
...
@@ -784,90 +709,6 @@ void sbbs_t::dirinfo(uint dirnum)
printfile
(
str
,
0
);
}
/****************************************************************************/
/* Pattern matching string search of 'insearchof' in 'fname'. */
/****************************************************************************/
extern
"C"
BOOL
DLLCALL
findstr
(
scfg_t
*
cfg
,
char
*
insearchof
,
char
*
fname
)
{
char
*
p
;
char
str
[
128
];
char
search
[
81
];
int
c
;
int
i
;
BOOL
found
;
FILE
*
stream
;
if
((
stream
=
fopen
(
fname
,
"r"
))
==
NULL
)
return
(
FALSE
);
SAFECOPY
(
search
,
insearchof
);
strupr
(
search
);
found
=
FALSE
;
while
(
!
feof
(
stream
)
&&
!
ferror
(
stream
)
&&
!
found
)
{
if
(
!
fgets
(
str
,
sizeof
(
str
),
stream
))
break
;
found
=
FALSE
;
p
=
str
;
while
(
*
p
&&
*
p
<=
' '
)
p
++
;
/* Skip white-space */
if
(
*
p
==
';'
)
/* comment */
continue
;
if
(
*
p
==
'!'
)
{
/* !match */
found
=
TRUE
;
p
++
;
}
truncsp
(
p
);
c
=
strlen
(
p
);
if
(
c
)
{
c
--
;
strupr
(
p
);
if
(
p
[
c
]
==
'~'
)
{
p
[
c
]
=
0
;
if
(
strstr
(
search
,
p
))
found
=!
found
;
}
else
if
(
p
[
c
]
==
'^'
||
p
[
c
]
==
'*'
)
{
p
[
c
]
=
0
;
if
(
!
strncmp
(
p
,
search
,
c
))
found
=!
found
;
}
else
if
(
p
[
0
]
==
'*'
)
{
i
=
strlen
(
search
);
if
(
i
<
c
)
continue
;
if
(
!
strncmp
(
p
+
1
,
search
+
(
i
-
c
),
c
))
found
=!
found
;
}
else
if
(
!
strcmp
(
p
,
search
))
found
=!
found
;
}
}
fclose
(
stream
);
return
(
found
);
}
/****************************************************************************/
/* Searches the file <name>.can in the TEXT directory for matches */
/* Returns TRUE if found in list, FALSE if not. */
/****************************************************************************/
extern
"C"
BOOL
DLLCALL
trashcan
(
scfg_t
*
cfg
,
char
*
insearchof
,
char
*
name
)
{
char
fname
[
MAX_PATH
+
1
];
sprintf
(
fname
,
"%s%s.can"
,
cfg
->
text_dir
,
name
);
return
(
findstr
(
cfg
,
insearchof
,
fname
));
}
/****************************************************************************/
/* Searches the file <name>.can in the TEXT directory for matches */
/* Returns TRUE if found in list, FALSE if not. */
...
...
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