/PC/generrmap.c

http://unladen-swallow.googlecode.com/ · C · 20 lines · 17 code · 2 blank · 1 comment · 3 complexity · 48c944fe404946a8bc82016c618e2aea MD5 · raw file

  1. #include <stdio.h>
  2. #include <errno.h>
  3. /* Extract the mapping of Win32 error codes to errno */
  4. int main()
  5. {
  6. int i;
  7. printf("/* Generated file. Do not edit. */\n");
  8. printf("int winerror_to_errno(int winerror)\n");
  9. printf("{\n\tswitch(winerror) {\n");
  10. for(i=1; i < 65000; i++) {
  11. _dosmaperr(i);
  12. if (errno == EINVAL)
  13. continue;
  14. printf("\t\tcase %d: return %d;\n", i, errno);
  15. }
  16. printf("\t\tdefault: return EINVAL;\n");
  17. printf("\t}\n}\n");
  18. }