Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
u-boot-2015.04
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor 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
vesta
u-boot-2015.04
Commits
20e0e233
Commit
20e0e233
authored
22 years ago
by
Wolfgang Denk
Browse files
Options
Downloads
Patches
Plain Diff
Initial revision
parent
041b1dea
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib_generic/display_options.c
+62
-0
62 additions, 0 deletions
lib_generic/display_options.c
with
62 additions
and
0 deletions
lib_generic/display_options.c
0 → 100644
+
62
−
0
View file @
20e0e233
/*
* (C) Copyright 2000-2002
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include
<common.h>
int
display_options
(
void
)
{
extern
char
version_string
[];
#if defined(BUILD_TAG)
printf
(
"
\n\n
%s, Build: %s
\n\n
"
,
version_string
,
BUILD_TAG
);
#else
printf
(
"
\n\n
%s
\n\n
"
,
version_string
);
#endif
return
0
;
}
/*
* print sizes as "xxx kB", "xxx.y kB", "xxx MB" or "xxx.y MB" as needed;
* allow for optional trailing string (like "\n")
*/
void
print_size
(
ulong
size
,
const
char
*
s
)
{
ulong
m
,
n
;
ulong
d
=
1
<<
20
;
/* 1 MB */
char
c
=
'M'
;
if
(
size
<
d
)
{
/* print in kB */
c
=
'k'
;
d
=
1
<<
10
;
}
n
=
size
/
d
;
m
=
(
10
*
(
size
-
(
n
*
d
))
+
(
d
/
2
)
)
/
d
;
printf
(
"%2ld"
,
n
);
if
(
m
)
{
printf
(
".%ld"
,
m
);
}
printf
(
" %cB%s"
,
c
,
s
);
}
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