Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
79f5495a
Commit
79f5495a
authored
Aug 13, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
custom basename(3) and dirname(3)
parent
0ce0fd7b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
128 additions
and
12 deletions
+128
-12
asn1c/asn1c.c
asn1c/asn1c.c
+5
-4
configure
configure
+1
-1
configure.in
configure.in
+1
-1
libasn1compiler/Makefile.am
libasn1compiler/Makefile.am
+1
-0
libasn1compiler/Makefile.in
libasn1compiler/Makefile.in
+5
-1
libasn1compiler/asn1c_compat.c
libasn1compiler/asn1c_compat.c
+94
-0
libasn1compiler/asn1c_compat.h
libasn1compiler/asn1c_compat.h
+11
-0
libasn1compiler/asn1c_internal.h
libasn1compiler/asn1c_internal.h
+4
-1
libasn1compiler/asn1c_save.c
libasn1compiler/asn1c_save.c
+5
-3
libasn1parser/Makefile.in
libasn1parser/Makefile.in
+1
-1
No files found.
asn1c/asn1c.c
View file @
79f5495a
...
...
@@ -8,7 +8,6 @@
#include <sys/types.h>
#include <sys/stat.h>
/* for stat(2) */
#include <unistd.h>
#include <libgen.h>
/* for basename(3) */
#include <sysexits.h>
/* for EX_USAGE */
#include <assert.h>
#include <errno.h>
...
...
@@ -18,6 +17,8 @@
#include <asn1print.h>
/* Print the ASN.1 tree */
#include <asn1compiler.h>
/* Compile the ASN.1 tree */
#include <asn1c_compat.h>
/* Portable basename(3) and dirname(3) */
static
void
usage
(
char
*
av0
);
/* Print the Usage screen and exit(EX_USAGE) */
int
...
...
@@ -118,7 +119,7 @@ main(int ac, char **av) {
av
+=
optind
;
}
else
{
fprintf
(
stderr
,
"%s: No input files specified
\n
"
,
basename
(
av
[
0
]));
a1c_
basename
(
av
[
0
]));
exit
(
1
);
}
...
...
@@ -201,7 +202,7 @@ main(int ac, char **av) {
char
*
p
;
int
len
;
p
=
dirname
(
av
[
-
optind
]);
p
=
a1c_
dirname
(
av
[
-
optind
]);
len
=
strlen
(
p
)
+
sizeof
(
"/../skeletons"
);
skeletons_dir
=
alloca
(
len
);
...
...
@@ -261,7 +262,7 @@ usage(char *av0) {
"
\t
-Wdebug-fixer
\t
Debug ASN.1 semantics processor
\n
"
"
\t
-Wdebug-compiler
\t
Debug ASN.1 compiler
\n
"
,
basename
(
av0
),
DATADIR
a1c_
basename
(
av0
),
DATADIR
);
exit
(
EX_USAGE
);
}
...
...
configure
View file @
79f5495a
...
...
@@ -21588,7 +21588,7 @@ _ACEOF
fi
for
ac_header
in
errno
.h
for
ac_header
in
sys/param
.h
do
as_ac_Header
=
`
echo
"ac_cv_header_
$ac_header
"
|
$as_tr_sh
`
if
eval
"test
\"\$
{
$as_ac_Header
+set}
\"
= set"
;
then
...
...
configure.in
View file @
79f5495a
...
...
@@ -67,7 +67,7 @@ esac
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(
errno
.h)
AC_CHECK_HEADERS(
sys/param
.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
...
...
libasn1compiler/Makefile.am
View file @
79f5495a
...
...
@@ -13,6 +13,7 @@ libasn1compiler_la_SOURCES = \
asn1c_lang.c asn1c_lang.h
\
asn1c_save.c asn1c_save.h
\
asn1c_C.c asn1c_C.h
\
asn1c_compat.c asn1c_compat.h
\
asn1c_internal.h
libasn1compiler_la_LIBADD
=
\
...
...
libasn1compiler/Makefile.in
View file @
79f5495a
...
...
@@ -54,7 +54,8 @@ libasn1compiler_la_DEPENDENCIES = \
${top_builddir}
/libasn1parser/libasn1parser.la
\
${top_builddir}
/libasn1fix/libasn1fix.la
am_libasn1compiler_la_OBJECTS
=
asn1compiler.lo asn1c_misc.lo
\
asn1c_out.lo asn1c_lang.lo asn1c_save.lo asn1c_C.lo
asn1c_out.lo asn1c_lang.lo asn1c_save.lo asn1c_C.lo
\
asn1c_compat.lo
libasn1compiler_la_OBJECTS
=
$(am_libasn1compiler_la_OBJECTS)
check_compiler_SOURCES
=
check_compiler.c
check_compiler_OBJECTS
=
check_compiler.
$(OBJEXT)
...
...
@@ -68,6 +69,7 @@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp
=
$(SHELL)
$(top_srcdir)
/depcomp
am__depfiles_maybe
=
depfiles
@AMDEP_TRUE@
DEP_FILES
=
./
$(DEPDIR)
/asn1c_C.Plo
\
@AMDEP_TRUE@ ./
$(DEPDIR)
/asn1c_compat.Plo
\
@AMDEP_TRUE@ ./
$(DEPDIR)
/asn1c_lang.Plo
\
@AMDEP_TRUE@ ./
$(DEPDIR)
/asn1c_misc.Plo
\
@AMDEP_TRUE@ ./
$(DEPDIR)
/asn1c_out.Plo
\
...
...
@@ -210,6 +212,7 @@ libasn1compiler_la_SOURCES = \
asn1c_lang.c asn1c_lang.h
\
asn1c_save.c asn1c_save.h
\
asn1c_C.c asn1c_C.h
\
asn1c_compat.c asn1c_compat.h
\
asn1c_internal.h
libasn1compiler_la_LIBADD
=
\
...
...
@@ -281,6 +284,7 @@ distclean-compile:
-
rm
-f
*
.tab.c
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/asn1c_C.Plo@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/asn1c_compat.Plo@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/asn1c_lang.Plo@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/asn1c_misc.Plo@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/asn1c_out.Plo@am__quote@
...
...
libasn1compiler/asn1c_compat.c
0 → 100644
View file @
79f5495a
#include <asn1c_compat.h>
#include <string.h>
#include <errno.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
/* For MAXPATHLEN */
#endif
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
char
*
a1c_basename
(
const
char
*
path
)
{
static
char
strbuf
[
MAXPATHLEN
];
const
char
*
pend
;
const
char
*
name
;
pend
=
path
+
strlen
(
path
);
if
(
pend
==
path
)
{
strcpy
(
strbuf
,
"."
);
return
strbuf
;
}
/* Skip tailing slashes */
for
(
pend
--
;
pend
>
path
&&
*
pend
==
'/'
;
pend
--
);
if
(
pend
==
path
&&
*
path
==
'/'
)
{
strcpy
(
strbuf
,
"/"
);
return
strbuf
;
}
for
(
name
=
pend
;
name
>
path
&&
name
[
-
1
]
!=
'/'
;
name
--
);
if
((
pend
-
name
)
>=
sizeof
(
strbuf
)
-
1
)
{
errno
=
ENAMETOOLONG
;
return
0
;
}
memcpy
(
strbuf
,
name
,
pend
-
name
+
1
);
strbuf
[
pend
-
name
+
1
]
=
'\0'
;
return
strbuf
;
}
char
*
a1c_dirname
(
const
char
*
path
)
{
static
char
strbuf
[
MAXPATHLEN
];
const
char
*
pend
;
const
char
*
last
=
0
;
int
in_slash
=
0
;
/* One-pass determination of the last char of the pathname */
for
(
pend
=
path
;
;
pend
++
)
{
printf
(
"-%c"
,
*
pend
);
switch
(
*
pend
)
{
case
'\0'
:
break
;
case
'/'
:
if
(
!
in_slash
)
{
last
=
pend
;
in_slash
=
1
;
}
continue
;
default:
if
(
in_slash
)
in_slash
=
0
;
continue
;
}
break
;
}
printf
(
"
\n
"
);
if
(
last
<=
path
)
{
strcpy
(
strbuf
,
*
path
==
'/'
?
"/"
:
"."
);
return
strbuf
;
}
if
(
!
last
)
{
strcpy
(
strbuf
,
"/"
);
return
strbuf
;
}
if
((
last
-
path
)
>=
sizeof
(
strbuf
))
{
errno
=
ENAMETOOLONG
;
return
0
;
}
memcpy
(
strbuf
,
path
,
last
-
path
);
strbuf
[
last
-
path
]
=
'\0'
;
return
strbuf
;
}
libasn1compiler/asn1c_compat.h
0 → 100644
View file @
79f5495a
#ifndef ASN1C_COMPAT_H
#define ASN1C_COMPAT_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
char
*
a1c_basename
(
const
char
*
path
);
char
*
a1c_dirname
(
const
char
*
path
);
#endif
/* ASN1C_COMPAT_H */
libasn1compiler/asn1c_internal.h
View file @
79f5495a
#ifndef _ASN1_COMPILER_INTERNAL_H_
#define _ASN1_COMPILER_INTERNAL_H_
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
/* for fstat(2) */
#include <unistd.h>
/* for unlink(2) */
#include <fcntl.h>
/* for open(2) */
#include <glob.h>
/* for glob(3) */
#include <libgen.h>
/* for basename(3) */
#include <string.h>
#include <ctype.h>
/* for isalnum(3) */
#include <stdarg.h>
...
...
libasn1compiler/asn1c_save.c
View file @
79f5495a
#include "asn1c_internal.h"
#include "asn1c_compat.h"
static
int
asn1c_dump_streams
(
arg_t
*
arg
);
static
int
asn1c_print_streams
(
arg_t
*
arg
);
...
...
@@ -73,7 +74,7 @@ asn1c_save_compiled_output(arg_t *arg, const char *datadir) {
return
-
1
;
}
else
{
fprintf
(
mkf
,
"
\t\\\n\t
%s"
,
basename
(
pg
.
gl_pathv
[
i
]));
a1c_
basename
(
pg
.
gl_pathv
[
i
]));
}
}
...
...
@@ -213,11 +214,12 @@ asn1c_save_streams(arg_t *arg) {
static
int
asn1c_copy_over
(
arg_t
*
arg
,
char
*
path
)
{
char
*
fname
=
basename
(
path
)
;
char
*
fname
;
(
void
)
arg
;
/* Unused argument */
if
(
symlink
(
path
,
fname
))
{
fname
=
a1c_basename
(
path
);
if
(
!
fname
||
symlink
(
path
,
fname
))
{
if
(
errno
==
EEXIST
)
{
struct
stat
sb1
,
sb2
;
if
(
stat
(
path
,
&
sb1
)
==
0
...
...
libasn1parser/Makefile.in
View file @
79f5495a
...
...
@@ -546,8 +546,8 @@ distclean-generic:
maintainer-clean-generic
:
@
echo
"This command is intended for maintainers to use"
@
echo
"it deletes files that may require special tools to rebuild."
-
rm
-f
asn1p_y.c
-
rm
-f
asn1p_y.h
-
rm
-f
asn1p_y.c
-
rm
-f
asn1p_l.c
clean
:
clean-am
...
...
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