You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

proto.c 667B

12345678910111213141516171819202122232425
  1. #include "stddef.h"
  2. #include "string.h"
  3. #include "proto.h"
  4. static struct protocol protocols[0] __protocol_start;
  5. static struct protocol default_protocols[0] __default_protocol_start;
  6. static struct protocol protocols_end[0] __protocol_end;
  7. /*
  8. * Identify protocol given a name. name may be NULL, in which case
  9. * the first default protocol (if any) will be used.
  10. *
  11. */
  12. struct protocol * identify_protocol ( const char *name ) {
  13. struct protocol *proto = default_protocols;
  14. if ( name ) {
  15. for ( proto = protocols ; proto < protocols_end ; proto++ ) {
  16. if ( strcmp ( name, proto->name ) == 0 )
  17. break;
  18. }
  19. }
  20. return proto < protocols_end ? proto : NULL;
  21. }