dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / ldap / common / dtest.c
blob47fe932c82487368b5c7874566e9a410f4d250cf
1 /*
3 * Portions Copyright 1998 Sun Microsystems, Inc. All rights reserved.
4 * Use is subject to license terms.
6 */
8 #pragma ident "%Z%%M% %I% %E% SMI"
9 /* dtest.c - lber decoding test program */
11 * Copyright (c) 1990 Regents of the University of Michigan.
12 * All rights reserved.
14 * Redistribution and use in source and binary forms are permitted
15 * provided that this notice is preserved and that due credit is given
16 * to the University of Michigan at Ann Arbor. The name of the University
17 * may not be used to endorse or promote products derived from this
18 * software without specific prior written permission. This software
19 * is provided ``as is'' without express or implied warranty.
22 #include <stdio.h>
23 #include <string.h>
24 #ifdef MACOS
25 #include <stdlib.h>
26 #include <console.h>
27 #else /* MACOS */
28 #include <sys/types.h>
29 #include <sys/socket.h>
30 #endif /* MACOS */
31 #include "lber.h"
33 static usage( char *name )
35 fprintf( stderr, "usage: %s fmt\n", name );
38 main( int argc, char **argv )
40 long i, i2, num;
41 unsigned long len;
42 int tag;
43 char *str, *s1, *s2;
44 BerElement ber;
45 Sockbuf sb;
46 extern char *optarg;
48 #ifdef MACOS
49 ccommand( &argv );
50 cshow( stdout );
51 #endif /* MACOS */
53 bzero( &sb, sizeof(sb) );
54 sb.sb_sd = 0;
55 sb.sb_ber.ber_buf = NULL;
56 if ( (tag = ber_get_next( &sb, &len, &ber )) == -1 ) {
57 perror( "ber_get_next" );
58 exit( 1 );
60 printf( "message has tag 0x%x and length %ld\n", tag, len );
62 if ( ber_scanf( &ber, "i", &i ) == -1 ) {
63 fprintf( stderr, "ber_scanf returns -1\n" );
64 exit( 1 );
66 printf( "got int %d\n", i );
68 return( 0 );