What you want is the distance from the center of the circle to the line, minus the radius.
You must start deriving the equation of your line in the form $ax+by=c$. Substitute $\left(x,y\right)$ for (x1,y1), and then for (x2,y2) to find out the values of $a,b,c$. You will have to choose them so that $a^2+b^2=1$ (or choose as you like, and then divide the whole equation by $a^2+b^2$). You have the following three equations to determine $a,b,c$:
$$ax_1+by_1=c$$
$$ax_2+by_2=c$$
$$a^2+b^2=1$$
This will have two solutions: one $\left(a,b,c\right)$ and one $\left(-a,-b,-c\right)$. You can choose either. One easy way is to always use $c>0$.
Now, the distance from a random point $\left(x,y\right)$ to the line will be just $ax+by-c$.
EDIT: Actually, the value $ax+by-c$ will be positive if the point $\left(x,y\right)$ is on one side of the line, and negative if it is on the other side. The distance is, of course, its absolute value.
By the way, the point $\left(a,b\right)$ represents the vector perpendicular to the line, and $c$ is the distance from the origin of the coordinate system to the line.
EDIT 2: At first, I thought you wanted the distance to the line, but it has been pointed out in the comment below that you want the distance to the segment. Well, one way is to observe the point $\left(x-ta,y-tb\right)$, where $t=ax+by-c$. This point is the projection of $\left(x,y\right)$ onto the line. If this point is inside the segment, then the distance to the line is the same as the distance to the segment. If this point is not inside the segment, then the distance to the segment is just the distance to the nearest endpoint.
For the point $\left(x-ta,y-tb\right)$ to be inside the segment, its distance to each endpoint must be less than or equal to the segment length.