blob: 6782f8d0c95c6854fbff9acd4e4e9a73908bac3c (
plain)
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
35
36
37
|
/*
* Detect GDB using env
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int gdb_columns() {
return (getenv("COLUMNS") != NULL);
}
int gdb_lines() {
return (getenv("LINES") != NULL);
}
int gdb_path() {
char *gdb_path = getenv("_");
if (gdb_path == NULL) {
return 0;
}
char *block_path = strtok(gdb_path, "/");
char *str = NULL;
while (block_path != NULL) {
str = block_path;
block_path = strtok(NULL, "/");
}
if (str == NULL) {
return 0;
}
else {
return !strcmp(str,"gdb");
}
}
|