Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
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
Harbor 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
Admin message
Today at 12:05 p.m. CEST
GitLab will be temporarily unavailable due to brief maintenance.
Show more breadcrumbs
dCache
cta
Commits
73f7a391
Commit
73f7a391
authored
25 years ago
by
Olof Barring
Committed by
Steven Murray
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Go back to use strtok_r instead of strpbrk
parent
e80fdd95
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
mediachanger/castorrmc/common/getconfent.c
+67
-76
67 additions, 76 deletions
mediachanger/castorrmc/common/getconfent.c
with
67 additions
and
76 deletions
mediachanger/castorrmc/common/getconfent.c
+
67
−
76
View file @
73f7a391
/*
* $Id: getconfent.c,v 1.
5
1999/07/2
1
1
2:42:20 jdurand
Exp $
* $Id: getconfent.c,v 1.
6
1999/07/2
2
1
5:29:53 obarring
Exp $
* $Log: getconfent.c,v $
* Revision 1.6 1999/07/22 15:29:53 obarring
* Go back to use strtok_r instead of strpbrk
*
* Revision 1.5 1999/07/21 12:42:20 jdurand
* HP-UX's cc [without options] don't like function prototypes. Changed it
* to old C style.
...
...
@@ -23,16 +26,9 @@
#endif
#endif
/* PATH_CONFIG */
#ifdef CONST
#undef CONST
#endif
#if defined(__STDC__)
#define CONST const
#else
#define CONST
#endif
CONST
char
char_set
[]
=
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+|~`
\\
=-{}[]:;''
\"
,./<>?"
;
#if defined(_REENTRANT) || defined(_THREAD_SAFE)
#define strtok(X,Y) strtok_r(X,Y,&last)
#endif
/* _REENTRANT || _THREAD_SAFE */
char
*
getconfent_r
(
category
,
name
,
flags
,
buffer
,
bufsiz
)
...
...
@@ -42,72 +38,67 @@ char *getconfent_r(category, name, flags, buffer, bufsiz)
char
*
buffer
;
int
bufsiz
;
{
char
*
filename
=
PATH_CONFIG
;
FILE
*
fp
;
char
*
p
,
*
cp
,
*
ep
;
char
*
getenv
();
int
found
=
0
;
char
path_config
[
256
];
char
*
separator
;
if
((
p
=
getenv
(
"PATH_CONFIG"
))
!=
NULL
)
{
filename
=
p
;
}
char
*
filename
=
PATH_CONFIG
;
FILE
*
fp
;
char
*
p
,
*
cp
;
char
*
getenv
();
int
found
=
0
;
char
path_config
[
256
];
char
*
separator
;
#if defined(_REENTRANT) || defined(_THREAD_SAFE)
char
*
last
=
NULL
;
#endif
/* _REENTRANT || _THREAD_SAFE */
if
((
p
=
getenv
(
"PATH_CONFIG"
))
!=
NULL
)
{
filename
=
p
;
}
#if defined(_WIN32)
if
(
strncmp
(
filename
,
"%SystemRoot%
\\
"
,
13
)
==
0
&&
(
p
=
getenv
(
"SystemRoot"
)))
sprintf
(
path_config
,
"%s
\\
%s"
,
p
,
strchr
(
filename
,
'\\'
));
else
if
(
strncmp
(
filename
,
"%SystemRoot%
\\
"
,
13
)
==
0
&&
(
p
=
getenv
(
"SystemRoot"
)))
sprintf
(
path_config
,
"%s
\\
%s"
,
p
,
strchr
(
filename
,
'\\'
));
else
#endif
strcpy
(
path_config
,
filename
);
strcpy
(
path_config
,
filename
);
if
((
fp
=
fopen
(
path_config
,
"r"
))
==
NULL
)
{
serrno
=
SENOCONFIG
;
return
(
NULL
);
if
((
fp
=
fopen
(
path_config
,
"r"
))
==
NULL
)
{
serrno
=
SENOCONFIG
;
return
(
NULL
);
}
for
(;;)
{
p
=
fgets
(
buffer
,
bufsiz
-
1
,
fp
);
if
(
p
==
NULL
)
{
break
;
}
for
(;;)
{
p
=
fgets
(
buffer
,
bufsiz
-
1
,
fp
);
if
(
p
==
NULL
)
{
break
;
if
(
(
cp
=
strtok
(
p
,
"
\t
"
))
==
NULL
)
continue
;
/* empty line */
if
(
*
cp
==
'#'
)
continue
;
/* comment */
if
(
strcmp
(
cp
,
category
)
==
0
)
{
/* A category match */
if
(
(
cp
=
strtok
(
NULL
,
"
\t
"
))
==
NULL
)
continue
;
if
(
*
cp
==
'#'
)
continue
;
/* comment, invalid */
if
(
strcmp
(
cp
,
name
)
==
0
)
{
/* A match */
if
(
flags
!=
0
)
{
/* Don't tokenize next arg */
separator
=
"#
\n
"
;
}
else
{
separator
=
"#
\t
\n
"
;
}
if
(
*
p
==
'#'
)
continue
;
if
((
cp
=
strpbrk
(
p
,
char_set
))
==
NULL
)
continue
;
if
(
*
cp
==
'#'
)
continue
;
if
((
ep
=
strpbrk
(
cp
,
"
\t
"
))
==
NULL
)
ep
=
&
cp
[
strlen
(
cp
)];
if
(
*
ep
==
'\n'
)
continue
;
*
ep
=
'\0'
;
if
(
strcmp
(
cp
,
category
)
==
0
)
{
p
=
&
ep
[
1
];
if
((
cp
=
strpbrk
(
p
,
char_set
))
==
NULL
)
continue
;
if
(
*
cp
==
'#'
)
continue
;
if
((
ep
=
strpbrk
(
cp
,
"
\t
"
))
==
NULL
)
ep
=
&
cp
[
strlen
(
cp
)];
if
(
*
ep
==
'\n'
)
continue
;
*
ep
=
'\0'
;
if
(
strcmp
(
cp
,
name
)
==
0
)
{
if
(
flags
!=
0
)
{
separator
=
"#
\n
"
;
}
else
{
separator
=
"#
\t
\n
"
;
}
p
=
&
ep
[
1
];
if
((
cp
=
strpbrk
(
p
,
char_set
))
==
NULL
)
continue
;
if
(
*
cp
==
'#'
)
continue
;
if
((
ep
=
strpbrk
(
cp
,
separator
))
==
NULL
)
ep
=
&
cp
[
strlen
(
cp
)];
*
ep
=
'\0'
;
found
++
;
break
;
}
else
{
continue
;
}
}
else
{
continue
;
}
}
if
(
fclose
(
fp
))
return
(
NULL
);
if
(
found
==
0
)
return
(
NULL
);
else
return
(
cp
);
if
(
(
cp
=
strtok
(
NULL
,
separator
))
==
NULL
)
continue
;
if
(
*
cp
==
'#'
)
continue
;
found
++
;
break
;
}
else
{
continue
;
}
}
else
{
continue
;
}
}
if
(
fclose
(
fp
))
return
(
NULL
);
if
(
found
==
0
)
return
(
NULL
);
else
return
(
cp
);
}
static
int
value_key
=
-
1
;
...
...
@@ -117,12 +108,12 @@ char *getconfent(category, name, flags)
char
*
name
;
int
flags
;
{
char
*
value
=
NULL
;
char
*
value
=
NULL
;
Cglobals_get
(
&
value_key
,(
void
**
)
&
value
,
BUFSIZ
+
1
);
if
(
value
==
NULL
)
{
return
(
NULL
);
}
Cglobals_get
(
&
value_key
,(
void
**
)
&
value
,
BUFSIZ
+
1
);
if
(
value
==
NULL
)
{
return
(
NULL
);
}
return
(
getconfent_r
(
category
,
name
,
flags
,
value
,
BUFSIZ
+
1
));
return
(
getconfent_r
(
category
,
name
,
flags
,
value
,
BUFSIZ
+
1
));
}
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