/**
 * Client1 is a finger client.
 *
 * <p>You may <code>#define DEBUG</code> to see debug output.</p>
 *
 * <h2>Sample in/output (with debug info)</h2>
 * <p><pre>
allegro 55>./Client1 alpha.cs.bgsu.edu rblasch
D:Resolved finger service at port 79
Host not found: alpha.cs.bgsu.edu
allegro 56>./Client1 alpha.bgsu.edu rblasch
D:Resolved finger service at port 79
D:alpha.bgsu.edu resolved as hostname to 129.1.2.12
Login name: rblasch                     In real life: Ronald Blaschke
Directory: /home/45/rblasch             Shell: /bin/csh
Last login Sat Sep 18 17:18 on ttyp3 from allegro.cs.bgsu.
No Plan.
allegro 57>./Client1 allegro.cs
D:Resolved finger service at port 79
D:allegro.cs resolved as hostname to 129.1.64.6
Login       Name               TTY         Idle    When    Where
root     Super-User            console       3d Tue 23:43  :0
rblasch  Ronald Blaschke       pts/9            Sat 16:03  dhcp154.cs.bgsu.edu
jbarnes  Julie Barnes          pts/10        2d Thu 15:51  amnesia2.cs.bgsu.edu
jamie    James Blustein        pts/7         1d Fri 17:04  chip.cs.bgsu.edu
rblasch  Ronald Blaschke       pts/11           Sat 16:12  dhcp154.cs.bgsu.edu
 * </pre></p>
 *
 * @author Ronald Blaschke &lt;rblasch@cs.bgsu.edu&gt;
 * @version 1.0
 */
//@{

/**
 * Finger a host and printf result; debug info & errors go to stderr.
 *
 * <p>It works as follows: First, the port number of the finger service is
 * resolved by a <code>getservbyname</code> call.  It should be 79/TCP, which
 * is the default value if the resolution fails.</p>
 *
 * <p>Then the host address is resolved.  First we try to treat it as a
 * www.xxx.yyy.zzzz numerical address (via <code>inet_addr</code>).  If that
 * fails we try a hostname lookup (via <code>gethostbyname</code>).</p>
 *
 * <p>Now we create a socket (<code>socket(AF_INET, SOCK_STREAM, 0)</code>) and
 * connect to the host (<code>connect(sock, (sockaddr *)&sin,
 * sizeof(sin))</code>).</p>
 *
 * <p>Send query with <code>write</code>, terminated with a &lt;CR/LF&gt;.</p>
 *
 * <p>Finally receive the result with <code>read</code> and printf it out.</p>
 *
 * @param address Internet address of host, may be numerical or by name.
 * @param query Query string to send to finger server, without trailing
 *              &lt;CR/LF&gt; sequence.
 * @return 0 if ok, 1 on error.
 * @see RFC1288
 */
int
finger(char *address, char *query);

/**
 * Main for finger client.
 *
 * Just calls <code>finger</code>.
 *
 * @param argc Number of args.
 * @param argv Program args.
 * <dl>
 *   <dt>1 (program name)
 *   <dd>Print usage info
 *   <dt>2 (1 + hostname)
 *   <dd>Finger host with empty query string
 *   <dt>3 (2 + querystring)
 *   <dd>Finger host with querystring
 * </dl>
 *
 * @return 0 if ok, 1 on error.
 */
int
main(int argc, char **argv);
//@}

