2
0

mkdumpstrerrno.py 490 B

1234567891011121314151617181920212223242526272829303132
  1. #! /usr/bin/env python2.7
  2. import sys
  3. def main ():
  4. r = []
  5. while True:
  6. line = sys.stdin.readline()
  7. if line == '':
  8. break
  9. s = line.split()[0][:-1]
  10. r.append("\tD(\"%s\", %s)" % (s, s))
  11. print """/* this file was generated automatically */
  12. #include <errno.h>
  13. #include <stdio.h>
  14. static void D (const char *s, int e)
  15. {
  16. printf("%%s, %%s\\n", s, strerror(e));
  17. }
  18. int main (int argc, const char *argv[])
  19. {
  20. %s;
  21. return 0;
  22. }""" % (';\n'.join(r),)
  23. if __name__ == '__main__':
  24. main()