2 * $Id: nbprgstr.c,v 1.4 2001-06-29 14:14:46 rufustfirefly Exp $
4 * Copyright (c) 1990,1993 Regents of The University of Michigan.
5 * All Rights Reserved. See COPYRIGHT.
10 #endif /* HAVE_CONFIG_H */
15 #include <sys/types.h>
16 #include <sys/param.h>
18 #include <netatalk/endian.h>
19 #include <netatalk/at.h>
20 #include <atalk/netddp.h>
21 #include <atalk/nbp.h>
22 #include <atalk/util.h>
29 if (( p = strrchr( av0, '/' )) == 0 ) {
35 fprintf( stderr, "Usage: %s [ -A address ] obj:type@zone\n", p );
43 struct sockaddr_at addr;
44 struct at_addr ataddr;
45 char *Obj = 0, *Type = 0, *Zone = 0;
51 memset(&ataddr, 0, sizeof(ataddr));
52 while (( c = getopt( ac, av, "p:A:" )) != EOF ) {
55 if (!atalk_aton(optarg, &ataddr)) {
56 fprintf(stderr, "Bad address.\n");
62 port = atoi( optarg );
70 if ( ac - optind != 1 ) {
75 * Get the name. If Type or Obj aren't specified, error.
77 if ( nbp_name( av[ optind ], &Obj, &Type, &Zone ) || !Obj || !Type ) {
81 memset(&addr, 0, sizeof(addr));
82 memcpy(&addr.sat_addr, &ataddr, sizeof(addr.sat_addr));
83 if ((s = netddp_open(&addr, NULL)) < 0)
90 if ( nbp_rgstr( &addr, Obj, Type, Zone ) < 0 ) {
91 perror( "nbp_rgstr" );
92 fprintf( stderr, "Can't register %s:%s@%s\n", Obj, Type,