Sí más más

Sep 05, 2007 17:17

As an elective, I may take a class in the near future on programming languages where i'm sure an assignment will be to create one. This got me to thinking about programming languages - specifically that for non-english speakers, at least with their first programming language, they're probably learning 2 languages at once. I've had this thought before but today I was bored so I decided to see what a program might look like in spanish. Seems easy enough to follow. Now I wonder if it'd be acceptable for a class assignment. Seems like a decent idea:

/* $empieza hostinfo */
#incluye csapp.H

int principal (argc de int, carboniza **argv)
{
carboniza **pp;
struct in_addr addr;
struct hostent *hostp;

si (argc =! 2) {
Fprintf (stderr, "el uso: % s n",
argv[0]);

exit(0);
}

si (inet_aton(argv[1], &addr) =! 0)
hostp = Gethostbyaddr ((const carboniza sizeof(addr) *)&addr,, AF_INET);
más
hostp = Gethostbyname(argv[1]);

Printf (" hostname oficial: % s\N", hostp->h_name);

para (pp = hostp->h_aliases; *pp =! NULO; pp + +)
Printf (" alias: % s\N", *pp);

para (pp = hostp->h_addr_list; *pp =! NULO; pp + +) {
addr. s_addr = int *((unsigned *)*pp);

Printf (" la dirección: % s\N", inet_ntoa(addr));}

exit(0);}

/* $hostinfo final */
Previous post Next post
Up