{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

err - #include#include#include#include#include#include...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <err.h> #include <unistd.h> #include <stdio.h> #include <errno.h> #include <string.h> #include <stdlib.h> /* * 4.4BSD error printing functions. */ /* * This is initialized by crt0, though it actually lives in errno.c */ extern char **__argv; /* * Routine to print error message text to stderr. */ static void __senderr(void *junk, const char *data, size_t len) { (void)junk; /* not needed or used */ write(STDERR_FILENO, data, len); } /* * Shortcut to call __senderr on a null-terminated string. * (__senderr is set up to be called by __vprintf.) */ static void __senderrstr(const char *str) { __senderr(NULL, str, strlen(str)); } /* * Common routine for all the *err* and *warn* functions. */ static void __printerr(int use_errno, const char *fmt, va_list ap) { const char *errmsg; const char *prog; /* * Get the error message for the current errno. * Do this early, before doing anything that might change the * value in errno. */ errmsg = strerror(errno); /* * Look up the program name. * Strictly speaking we should pull off the rightmost
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
* path component of argv[0] and use that as the program * name (this is how BSD err* prints) but it doesn't make * much difference.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern