getrpcent.c 296 B

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