tests/readlink.py
author Yuya Nishihara <yuya@tcha.org>
Fri, 14 Aug 2015 12:25:14 +0900
changeset 26080 83c9edcac05c
parent 25660 328739ea70c3
child 29175 7bcfb9090c86
permissions -rwxr-xr-x
reachableroots: silence warning of implicit integer narrowing issued by clang Tested with CFLAGS=-Wshorten-64-to-32 CC=clang which is the default of Mac OS X. Because a valid revnum shouldn't exceed INT_MAX, we don't need long width for large tovisit array.

#!/usr/bin/env python

import errno, os, sys

for f in sys.argv[1:]:
    try:
        print f, '->', os.readlink(f)
    except OSError as err:
        if err.errno != errno.EINVAL:
            raise
        print f, 'not a symlink'

sys.exit(0)