-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.c
More file actions
34 lines (26 loc) · 714 Bytes
/
example.c
File metadata and controls
34 lines (26 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#define _GNU_SOURCE
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "example.h"
#include "otherfile.h"
static bool is_acceptable_id(unsigned int id) {
if (database_id_exists(id))
return 0;
return id > 1000 && id < 10000;
}
void some_function(int argument) {
printf("..... %s wasn't supposed to be called\n", __func__);
function_somewhere_else(argument);
}
int main(int argc, char **argv) {
if (argc < 2) {
fprintf(stderr, "Usage: %s <id>\n", basename(argv[0]));
return 1;
}
int id = atoi(argv[1]);
int is_acceptable = is_acceptable_id(id);
printf("ID is acceptable: %d\n", is_acceptable);
return 0;
}