blob: 38dea2c43ad2d4e4b08239b2d1767966e1f50c6e [file] [log] [blame]
Lei YU65207482019-10-11 16:39:36 +08001#include <cstdio>
2#include <string>
3#include <vector>
4
5// Get the version string for a PSU and output to stdout
6// In this example, it just returns the last 8 bytes as the version
7constexpr int NUM_OF_BYTES = 8;
8
9int main(int argc, char** argv)
10{
11 if (argc < 2)
12 {
13 printf("Usage: %s versions...\n", argv[0]);
14 return 1;
15 }
16
17 std::vector<std::string> versions(argv + 1, argv + argc);
18 std::string latest;
19 for (const auto& s : versions)
20 {
21 if (latest < s)
22 {
23 latest = s;
24 }
25 }
26
27 printf("%s", latest.c_str());
28 return 0;
29}