Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# vi: set et ts=2 sw=2 :
name: build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
linux:
strategy:
matrix:
os: [ ubuntu-16.04, ubuntu-18.04, ubuntu-20.04 ]
runs-on: ${{ matrix.os }}
steps:
- name: install dependencies
run: |
sudo apt install \
libjson-c-dev \
cmake \
gcc \
git \
make \
- uses: actions/checkout@v2
- name: cmake
run: mkdir build && cd build && cmake ..
- name: make
run: make -C build

macos-catalina:
runs-on: macos-10.15

steps:
- name: install dependencies
run: brew install cmake json-c
- uses: actions/checkout@v2
- name: cmake
run: mkdir build && cd build && cmake ..
- name: make
run: make -C build

win-srv-2019:

runs-on: windows-2019

steps:
- name: install dependencies
run: |-
choco install cygwin -y
choco install cyg-get -y
# Line continuation in PowerShell is backtick. Weird as Windows.
cyg-get gcc-g++ `
cmake `
make `
libjson-c-devel `
dos2unix
echo "C:/tools/cygwin/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:/tools/cygwin/usr/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: actions/checkout@v2
- name: cmake
run: bash -c "mkdir build && cd build && cmake .."
- name: make
run: make -C build
20 changes: 20 additions & 0 deletions fru.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,28 @@
#include <unistd.h>
#include <errno.h>

#ifdef __APPLE__
#include <libkern/OSByteOrder.h>

#define htobe16(x) OSSwapHostToBigInt16(x)
#define htole16(x) OSSwapHostToLittleInt16(x)
#define be16toh(x) OSSwapBigToHostInt16(x)
#define le16toh(x) OSSwapLittleToHostInt16(x)

#define htobe32(x) OSSwapHostToBigInt32(x)
#define htole32(x) OSSwapHostToLittleInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#define le32toh(x) OSSwapLittleToHostInt32(x)

#define htobe64(x) OSSwapHostToBigInt64(x)
#define htole64(x) OSSwapHostToLittleInt64(x)
#define be64toh(x) OSSwapBigToHostInt64(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)

#else
#define _BSD_SOURCE
#include <endian.h>
#endif

#ifdef __STANDALONE__
#include <stdio.h>
Expand Down