2 * Copyright (c) 1990,1993 Regents of The University of Michigan.
3 * All Rights Reserved. See COPYRIGHT.
13 #include <sys/types.h>
14 #include <sys/param.h>
16 #include <netatalk/endian.h>
17 #include <netatalk/at.h>
18 #include <atalk/netddp.h>
19 #include <atalk/nbp.h>
20 #include <atalk/util.h>
27 if (( p = strrchr( av0, '/' )) == 0 ) {
33 fprintf( stderr, "Usage: %s [ -A address ] obj:type@zone\n", p );
41 struct sockaddr_at addr;
42 struct at_addr ataddr;
43 char *Obj = 0, *Type = 0, *Zone = 0;
49 memset(&ataddr, 0, sizeof(ataddr));
50 while (( c = getopt( ac, av, "p:A:" )) != EOF ) {
53 if (!atalk_aton(optarg, &ataddr)) {
54 fprintf(stderr, "Bad address.\n");
60 port = atoi( optarg );
68 if ( ac - optind != 1 ) {
73 * Get the name. If Type or Obj aren't specified, error.
75 if ( nbp_name( av[ optind ], &Obj, &Type, &Zone ) || !Obj || !Type ) {
79 memset(&addr, 0, sizeof(addr));
80 memcpy(&addr.sat_addr, &ataddr, sizeof(addr.sat_addr));
81 if ((s = netddp_open(&addr, NULL)) < 0)
88 if ( nbp_rgstr( &addr, Obj, Type, Zone ) < 0 ) {
89 perror( "nbp_rgstr" );
90 fprintf( stderr, "Can't register %s:%s@%s\n", Obj, Type,