d1a424c002
This will allow us to redefine the exit function.
For example:
```
#define exit(code) { \
fprintf(stderr, "%s:%d: exit(%s) in function ‘%s’\n",
__FILE__, __LINE__, #code, __func__); \
_exit(code); \
}
```
22 lines
518 B
C
22 lines
518 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
int main(void) {
|
|
char * s = "azAZ9."; // test boundaries
|
|
long l = a64l(s);
|
|
if (l != 194301926) {
|
|
printf("Invalid result: a64l(%s) = %ld\n", s, l);
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
printf("Correct a64l: %s = %ld\n", s, l);
|
|
|
|
|
|
s = "azA"; // test null terminated string
|
|
l = a64l(s);
|
|
if (l != 53222) {
|
|
printf("Invalid result: a64l(%s) = %ld\n", s, l);
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
printf("Correct a64l: %s = %ld\n", s, l);
|
|
}
|