2 * Copyright (c) 1990,1993 Regents of The University of Michigan.
3 * All Rights Reserved. See COPYRIGHT.
12 #include <sys/types.h>
13 #include <sys/param.h>
15 #include <netatalk/endian.h>
16 #include <netatalk/at.h>
17 #include <atalk/netddp.h>
18 #include <atalk/util.h>
25 if (( p = strrchr( av0, '/' )) == 0 ) {
31 fprintf( stderr, "Usage: %s [ -A address ] obj:type@zone\n", p );
39 struct sockaddr_at addr;
40 struct at_addr ataddr;
41 char *Obj = 0, *Type = 0, *Zone = 0;
47 memset(&ataddr, 0, sizeof(ataddr));
48 while (( c = getopt( ac, av, "p:A:" )) != EOF ) {
51 if (!atalk_aton(optarg, &ataddr)) {
52 fprintf(stderr, "Bad address.\n");
58 port = atoi( optarg );
66 if ( ac - optind != 1 ) {
71 * Get the name. If Type or Obj aren't specified, error.
73 if ( nbp_name( av[ optind ], &Obj, &Type, &Zone ) || !Obj || !Type ) {
77 memset(&addr, 0, sizeof(addr));
78 memcpy(&addr.sat_addr, &ataddr, sizeof(addr.sat_addr));
79 if ((s = netddp_open(&addr, NULL)) < 0)
86 if ( nbp_rgstr( &addr, Obj, Type, Zone ) < 0 ) {
87 perror( "nbp_rgstr" );
88 fprintf( stderr, "Can't register %s:%s@%s\n", Obj, Type,