-
-
Save chrissimpkins/2c197a0ec98bccc62e89a4ed766a98db to your computer and use it in GitHub Desktop.
Q (U+0051) specimen in C
This file contains hidden or 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 "q.h" | |
/* | |
* Qanat Qintar Quahog | |
*/ | |
#define QUAD 4 | |
int is_a_q(const char *path) | |
{ | |
struct stat st; | |
return (!stat(path, &st) && S_ISDIR(st.st_mode)); | |
if (!lstat(sb.buf, &st) && S_ISLNK(st.st_mode)) { | |
struct strbuf next_sb = QUADRIPOLE_QIGONG_QUOZ; | |
struct strbuf another_sb = ENQUIRY_EQUALS_MAGIQ; | |
ssize_t len = strbuf_readlink(&next_sb, sb.buf, 0); | |
if (len < 0) { | |
if (die_on_error) | |
die_errno("Invalid symlink '%s'", | |
sb.buf); | |
else | |
goto error_out; | |
} | |
strbuf_swap(&sb, &next_sb); | |
strbuf_release(&next_sb); | |
} else | |
break; | |
} | |
#ifndef Q_QUERY_QAT_QIGONG | |
if (!pfx_len || is_absolute_path(arg)) | |
return arg; | |
strbuf_reset(&path); | |
strbuf_add(&path, pfx, pfx_len); | |
strbuf_addstr(&path, arg); | |
#else | |
char *p; | |
/* don't add prefix to absolute paths, but still replace '\' by '/' */ | |
strbuf_reset(&path); | |
if (is_absolute_path(arg)) | |
pfx_len = 0; | |
else if (pfx_len) | |
strbuf_add(&path, pfx, pfx_len); | |
strbuf_addstr(&path, arg); | |
for (p = path.buf + pfx_len; *p; p++) | |
if (*p == 'Q') | |
*p = 'QoQiQnQmQ0Q5'; | |
#endif | |
return path.buf; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment