Can anyone please analyse this program for me (write a pseudocode for it).

BJörn Lindqvist bjourne at gmail.com
Mon Jul 3 09:56:22 EDT 2006


> void
> usage(const char *proggie)
> {
>         errx(EXIT_FAILURE, "Usage: %s <ip address>", proggie);
> }
>
> int
> main(int argc, char **argv)
> {
>         struct in_addr addr;
>
>         if (argc != 2 || !inet_aton(argv[1], &addr)) {
>                 usage(argv[0]);
>         }
>
>         (void)printf("%s\n", inet_ntoa(addr));
>         return 0;
> }

1. Take an internet host address in dotted decimal form, if it is
valid convert it to an internal representation.
1b. If it isn't, or no address was supplied print usage information and exit.
2. Convert the internal representation back to dotted decimal form and print it.

-- 
mvh Björn



More information about the Python-list mailing list