networking · beginner · ~15 min
Distinguish abstract from filesystem sockets.
Linux supports "abstract" Unix-domain sockets that live in a private namespace with no filesystem entry. In this exercise's notation, an abstract address is written with a leading @. Distinguish abstract addresses from filesystem paths.
Implement int is_abstract(const char *path) that returns 1 if path begins with @, otherwise 0.
A NUL-terminated path string.
Returns 1 for an abstract address (leading @), else 0.
is_abstract("@myapp") -> 1
is_abstract("/tmp/x.sock") -> 0
A NUL-terminated path string.
1 if the first character is '@', else 0.
Abstract addresses are marked by a leading '@' in this notation.
int is_abstract(const char *path) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.