No Medium Found, 2.0, Notes

.hy 0 .ad l .nf

Prev, Top | Slide, Next

# 2. Using the Library

## 2.1 The simple case

const char *explain_rename(const char *oldpath, const char *newpath);
slide

## 2.2 The errno case

const char *explain_errno_rename(int errno, const char *oldpath, const char *newpath);
slide

## 2.3 Multi-thread

const char *explain_message_rename(char *msg, size_t msg_size, int errno, const char *oldpath, const char *newpath);
const char *explain_message_errno_rename(char *msg, size_t msg_size, int errno, const char *oldpath, const char *newpath);
slide

## 2.4 Interface Sugar

int explain_rename_or_die(const char *oldpath, const char *newpath);
int explain_rename_on_error(const char *oldpath, const char *newpath);
slide

## 2.5 All the other system calls

as above, but as appropriate
slide

## 2.6 cat

slide

- code example
- full error handling, no tramp data
- even works for stdout

## 2.7 Rusty's Scale of Interface Goodness

slide

10. | It's impossible to get wrong.
9. | The compiler or linker won't let you get it wrong.
8. | The compiler will warn if you get it wrong.
7. | The obvious use is (probably) the correct one.
6. | The name tells you how to use it.
5. | Do it right or it will break at runtime.
4. | Follow common convention and you'll get it right.
3. | Read the documentation and you'll get it right.