o Remove $Id$ from copyright; there's $FreeBSD$,

o  Remove static function uuid_print(); use uuid_to_string(3) in
   combination with printf(3) to achieve the same,
o  Remove unneeded includes,
o  Add a reference to uuid(3) to the manpage.
This commit is contained in:
Marcel Moolenaar 2002-11-01 06:20:14 +00:00
parent 14ffdae94d
commit 9b2f268fb5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=106283
4 changed files with 16 additions and 36 deletions

View File

@ -65,7 +65,8 @@ reflected in the distance between two successive identifiers.
.Sh DIAGNOSTICS .Sh DIAGNOSTICS
.Ex -std .Ex -std
.Sh SEE ALSO .Sh SEE ALSO
.Xr uuidgen 2 .Xr uuidgen 2 ,
.Xr uuid 3
.Sh HISTORY .Sh HISTORY
The The
.Nm .Nm

View File

@ -23,20 +23,16 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id$
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/endian.h>
#include <sys/uuid.h>
#include <err.h> #include <err.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <uuid.h>
static void static void
usage(void) usage(void)
@ -45,16 +41,6 @@ usage(void)
exit(1); exit(1);
} }
static void
uuid_print(uuid_t *uuid)
{
printf("%08x-%04x-%04x-%02x%02x-", uuid->time_low, uuid->time_mid,
uuid->time_hi_and_version, uuid->clock_seq_hi_and_reserved,
uuid->clock_seq_low);
printf("%02x%02x%02x%02x%02x%02x\n", uuid->node[0], uuid->node[1],
uuid->node[2], uuid->node[3], uuid->node[4], uuid->node[5]);
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -105,8 +91,11 @@ main(int argc, char *argv[])
} }
uuid = store; uuid = store;
while (count--) while (count--) {
uuid_print(uuid++); uuid_to_string(uuid++, &p, NULL);
printf("%s\n", p);
free(p);
}
free(store); free(store);
return (0); return (0);

View File

@ -65,7 +65,8 @@ reflected in the distance between two successive identifiers.
.Sh DIAGNOSTICS .Sh DIAGNOSTICS
.Ex -std .Ex -std
.Sh SEE ALSO .Sh SEE ALSO
.Xr uuidgen 2 .Xr uuidgen 2 ,
.Xr uuid 3
.Sh HISTORY .Sh HISTORY
The The
.Nm .Nm

View File

@ -23,20 +23,16 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id$
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/endian.h>
#include <sys/uuid.h>
#include <err.h> #include <err.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <uuid.h>
static void static void
usage(void) usage(void)
@ -45,16 +41,6 @@ usage(void)
exit(1); exit(1);
} }
static void
uuid_print(uuid_t *uuid)
{
printf("%08x-%04x-%04x-%02x%02x-", uuid->time_low, uuid->time_mid,
uuid->time_hi_and_version, uuid->clock_seq_hi_and_reserved,
uuid->clock_seq_low);
printf("%02x%02x%02x%02x%02x%02x\n", uuid->node[0], uuid->node[1],
uuid->node[2], uuid->node[3], uuid->node[4], uuid->node[5]);
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -105,8 +91,11 @@ main(int argc, char *argv[])
} }
uuid = store; uuid = store;
while (count--) while (count--) {
uuid_print(uuid++); uuid_to_string(uuid++, &p, NULL);
printf("%s\n", p);
free(p);
}
free(store); free(store);
return (0); return (0);