This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import rename, remove, path | |
from conans import ConanFile | |
from conans.tools import download, check_sha256, unzip | |
class CmockaConan(ConanFile): | |
name = 'cmocka' | |
version = '1.1.3' | |
sha256 = '43eabcf72a9c80e3d03f7c8a1c04e408c18d2db5121eb058a3ef732a9dfabfaf' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.12) | |
project(c VERSION 0.0.1) | |
set(CMAKE_C_STANDARD 11) | |
configure_file(lib/version.h.in version.h @ONLY) | |
include_directories(${CMAKE_CURRENT_BINARY_DIR}) | |
add_definitions(-Wno-implicit-function-declaration) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
static inline void trim(char *&); | |
int main(int argc, char *argv[]) { | |
char *s = " foo bar "; | |
trim(s); | |
printf("s = \"%s\"\n", s); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <unistd.h> | |
static inline void parse_cli(int, char *[], const char *&, const char *&, const char *&); | |
static inline void usage_and_exit(const char *); | |
static inline void parse_args_and_exec(char *, const char *); | |
static inline const std::vector<const char *> split(char *, const char *); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.12) | |
project(cc) | |
set(CMAKE_CXX_STANDARD 11) | |
set(CMAKE_CXX_FLAGS_DEBUG -O3) | |
set(CMAKE_CXX_FLAGS_RELEASE -O3) | |
add_definitions(-O3) | |
set(CMAKE_CXX_FLAGS "-O3") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
// #include <vector> | |
#include <unistd.h> | |
void execute(const char*, const char*); | |
int main(int argc, char *argv[]) { | |
if (argv[1] == NULL || argv[2] == NULL) { | |
printf("Usage %s PATH 'cmd0 ; cmd1 ; ...\n", argv[0]); | |
exit(2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine | |
RUN apk add --no-cache gcc musl-dev | |
ADD env.c /env.c | |
RUN gcc -static -o /env /env.c -Wno-implicit-function-declaration | |
FROM scratch | |
COPY --from=0 /env /env | |
ENTRYPOINT ["/env"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM frolvlad/alpine-glibc | |
COPY copy.c copy.c | |
RUN apk --no-cache add gcc libc-dev musl musl-dev && \ | |
gcc copy.c -static -o /bin/copy -Wno-implicit-function-declaration -static-libgcc && \ | |
ldd /bin/copy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM scratch | |
RUN echo foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM scratch | |
COPY env /env | |
ENTRYPOINT ["/env"] |