Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Natália Hoclárová
os2018-copymatster-kostra
Commits
dff40d4e
Commit
dff40d4e
authored
Oct 01, 2018
by
Michal Vrabel
Browse files
Premenovanie misc -> options, presunutie FatalError do copymaster.c
parent
3c0f6739
Changes
4
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
dff40d4e
CC
=
gcc
CFLAGS
=
-std
=
gnu11
-Wall
-Wextra
LDFLAGS
=
SOURCES
=
copymaster.c
misc
.c
HEADERS
=
misc
.h
SOURCES
=
copymaster.c
options
.c
HEADERS
=
options
.h
OBJDIR
=
obj
EXECUTABLE
=
copymaster
...
...
copymaster.c
View file @
dff40d4e
#include
<stdio.h>
#include
<stdlib.h>
#include
<errno.h>
#include
<string.h>
#include
"misc.h"
#include
"options.h"
void
FatalError
(
char
c
,
const
char
*
msg
,
int
exit_status
);
int
main
(
int
argc
,
char
*
argv
[])
...
...
@@ -90,3 +95,12 @@ int main(int argc, char* argv[])
return
0
;
}
void
FatalError
(
char
c
,
const
char
*
msg
,
int
exit_status
)
{
fprintf
(
stderr
,
"%c:%d
\n
"
,
c
,
errno
);
fprintf
(
stderr
,
"%c:%s
\n
"
,
c
,
strerror
(
errno
));
fprintf
(
stderr
,
"%c:%s
\n
"
,
c
,
msg
);
exit
(
exit_status
);
}
misc
.c
→
options
.c
View file @
dff40d4e
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdlib.h>
#include
<fcntl.h>
#include
<unistd.h>
#include
<getopt.h>
#include
<errno.h>
#include
<string.h>
#include
"
misc
.h"
#include
"
options
.h"
struct
CopymasterOptions
ParseCopymaterOptions
(
int
argc
,
char
*
argv
[])
{
struct
CopymasterOptions
ParseCopymaterOptions
(
int
argc
,
char
*
argv
[])
{
extern
int
optind
;
extern
char
*
optarg
;
...
...
@@ -161,10 +159,3 @@ struct CopymasterOptions ParseCopymaterOptions(int argc, char *argv[]) {
return
cpm_options
;
}
void
FatalError
(
char
c
,
const
char
*
msg
,
int
exit_status
)
{
fprintf
(
stderr
,
"%c:%d
\n
"
,
c
,
errno
);
fprintf
(
stderr
,
"%c:%s
\n
"
,
c
,
strerror
(
errno
));
fprintf
(
stderr
,
"%c:%s
\n
"
,
c
,
msg
);
exit
(
exit_status
);
}
misc
.h
→
options
.h
View file @
dff40d4e
File moved
Write
Preview
Supports
Markdown
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