From d1cd99244f96bd95bbd67cc737248df346dec08b Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Thu, 25 Apr 2024 03:50:51 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/cimp?= =?UTF-8?q?le@8e652dd2cb69928ea1596aa3e59845fef6854e2c=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...md_line.c.fc55483624faae9ff92546137d095857.html | 680 +++++++++++++++++++++ 1 file changed, 680 insertions(+) create mode 100644 coverage/index.cmd_line.c.fc55483624faae9ff92546137d095857.html (limited to 'coverage/index.cmd_line.c.fc55483624faae9ff92546137d095857.html') diff --git a/coverage/index.cmd_line.c.fc55483624faae9ff92546137d095857.html b/coverage/index.cmd_line.c.fc55483624faae9ff92546137d095857.html new file mode 100644 index 0000000..fbaa218 --- /dev/null +++ b/coverage/index.cmd_line.c.fc55483624faae9ff92546137d095857.html @@ -0,0 +1,680 @@ + + + + + + GCC Code Coverage Report + + + + + +

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/cmd_line.c
Date:2024-04-25 03:45:42
+
+
+ + + + + + + + + + + + + + + + + + + +
ExecTotalCoverage
Lines:283190.3%
Branches:71450.0%
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineBranchExecSource
1 + /*
2 + * Copyright (c) 2023 Egor Tensin <egor@tensin.name>
3 + * This file is part of the "cimple" project.
4 + * For details, see https://github.com/egor-tensin/cimple.
5 + * Distributed under the MIT License.
6 + */
7 +
8 + #include "cmd_line.h"
9 + #include "const.h"
10 + #include "file.h"
11 + #include "log.h"
12 +
13 + #include <stdio.h>
14 + #include <stdlib.h>
15 + #include <string.h>
16 +
17 + 20static char *get_current_binary_path(void)
18 + {
19 + 20 return my_readlink("/proc/self/exe");
20 + }
21 +
22 + 20static char *get_current_binary_name(void)
23 + {
24 + 20 char *path = get_current_binary_path();
25 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 20 times.
+
+
+
20 if (!path)
26 + return NULL;
27 +
28 + 20 char *name = basename(path);
29 +
30 + 20 char *result = strdup(name);
31 +
+ 1/2 +
+
✓ Branch 0 taken 20 times.
+
✗ Branch 1 not taken.
+
+
+
20 if (!result) {
32 + log_errno("strdup");
33 + goto free_path;
34 + }
35 +
36 + 20free_path:
37 + 20 free(path);
38 +
39 + 20 return result;
40 + }
41 +
42 + 14void exit_with_usage(int ec)
43 + {
44 + 14 FILE *dest = stdout;
45 +
+ 2/2 +
+
✓ Branch 0 taken 8 times.
+
✓ Branch 1 taken 6 times.
+
+
+
14 if (ec)
46 + 8 dest = stderr;
47 +
48 + 14 char *binary = get_current_binary_name();
49 +
50 +
+ 1/2 +
+
✓ Branch 1 taken 14 times.
+
✗ Branch 2 not taken.
+
+
+
14 fprintf(dest, "usage: %s %s\n", binary ? binary : "prog", get_usage_string());
51 + 14 free(binary);
52 + 14 exit(ec);
53 + }
54 +
55 + 2void exit_with_usage_err(const char *msg)
56 + {
57 +
+ 1/2 +
+
✓ Branch 0 taken 2 times.
+
✗ Branch 1 not taken.
+
+
+
2 if (msg)
58 + 2 fprintf(stderr, "usage error: %s\n", msg);
59 + 2 exit_with_usage(1);
60 + }
61 +
62 + 6void exit_with_version(void)
63 + {
64 + 6 char *binary = get_current_binary_name();
65 +
66 +
+ 1/2 +
+
✓ Branch 0 taken 6 times.
+
✗ Branch 1 not taken.
+
+
+
6 printf("%s v%s (%s)\n", binary ? binary : "prog", project_version, project_rev);
67 + 6 free(binary);
68 + 6 exit(0);
69 + }
70 +
+
+ +
+ + + + -- cgit v1.2.3