getrpcent.c 334 B

12345678910111213141516171819
  1. #include <netdb.h>
  2. #include <stdio.h>
  3. int main(int argc, char *argv[])
  4. {
  5. #if defined(__UCLIBC_HAS_RPC__)
  6. struct rpcent *ent;
  7. while ((ent = getrpcent()) != NULL) {
  8. printf("%s: %i", ent->r_name, ent->r_number);
  9. while (ent->r_aliases[0])
  10. printf(" %s", *ent->r_aliases++);
  11. printf("\n");
  12. }
  13. endrpcent();
  14. #endif
  15. return 0;
  16. }