Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
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
RadioObservatory
LOFAR
Commits
ffdf6379
Commit
ffdf6379
authored
9 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
Task #8725: adapted a32 to accept stdin as input, to enable piping.
parent
d52757cc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
LTA/LTAIngest/md5adler/a32
+0
-0
0 additions, 0 deletions
LTA/LTAIngest/md5adler/a32
LTA/LTAIngest/md5adler/a32.c
+27
-10
27 additions, 10 deletions
LTA/LTAIngest/md5adler/a32.c
with
27 additions
and
10 deletions
LTA/LTAIngest/md5adler/a32
+
0
−
0
View file @
ffdf6379
No preview for this file type
This diff is collapsed.
Click to expand it.
LTA/LTAIngest/md5adler/a32.c
+
27
−
10
View file @
ffdf6379
# include <stdio.h>
#include
<stdlib.h>
#include
<sys/poll.h>
#include
"md5.h"
unsigned
int
adlercount
=
1
;
int
main
(
int
argc
,
char
*
argv
[])
{
FILE
*
fp
;
char
res
[
16
];
fp
=
fopen
(
argv
[
1
],
"rb"
);
if
(
fp
==
(
FILE
*
)
NULL
)
{
fprintf
(
stderr
,
"failed: can't open %s"
,
argv
[
1
]);
exit
(
-
1
);
}
parse_stream
(
fp
,
res
);
fprintf
(
stderr
,
"ADLER32 %x
\n
"
,
adlercount
);
fclose
(
fp
);
FILE
*
fp
;
char
res
[
16
];
struct
pollfd
fds
;
fds
.
fd
=
0
;
/* this is STDIN */
fds
.
events
=
POLLIN
;
int
inputViaStdIn
=
poll
(
&
fds
,
1
,
0
);
if
(
inputViaStdIn
)
{
fp
=
stdin
;
}
else
{
fp
=
fopen
(
argv
[
1
],
"rb"
);
if
(
fp
==
(
FILE
*
)
NULL
)
{
fprintf
(
stderr
,
"failed: can't open %s
\n
"
,
argv
[
1
]);
exit
(
-
1
);
}
}
parse_stream
(
fp
,
res
);
fprintf
(
stdout
,
"ADLER32 %x
\n
"
,
adlercount
);
if
(
!
inputViaStdIn
)
fclose
(
fp
);
exit
(
0
);
}
...
...
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