Deleted Added
full compact
version.c (222035) version.c (226436)
1/*
2 * FreeBSD install - a package for the installation and maintenance
3 * of non-core utilities.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * Maxim Sobolev
15 * 31 July 2001
16 *
17 */
18
19#include <sys/cdefs.h>
1/*
2 * FreeBSD install - a package for the installation and maintenance
3 * of non-core utilities.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * Maxim Sobolev
15 * 31 July 2001
16 *
17 */
18
19#include <sys/cdefs.h>
20__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/lib/version.c 131274 2004-06-29 18:52:13Z eik $");
20__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/lib/version.c 226436 2011-10-16 14:30:28Z eadler $");
21
22#include "lib.h"
23#include <err.h>
24
25/*
26 * Routines to assist with PLIST_FMT_VER numbers in the packing
27 * lists.
28 *

--- 32 unchanged lines hidden (view full) ---

61{
62 char *ch;
63 const char *versionstr;
64 const char *endversionstr;
65
66 if (pkgname == NULL)
67 errx(2, "%s: Passed NULL pkgname.", __func__);
68
21
22#include "lib.h"
23#include <err.h>
24
25/*
26 * Routines to assist with PLIST_FMT_VER numbers in the packing
27 * lists.
28 *

--- 32 unchanged lines hidden (view full) ---

61{
62 char *ch;
63 const char *versionstr;
64 const char *endversionstr;
65
66 if (pkgname == NULL)
67 errx(2, "%s: Passed NULL pkgname.", __func__);
68
69 /* Look for the last '-' the the pkgname */
69 /* Look for the last '-' the pkgname */
70 ch = strrchr(pkgname, '-');
71 /* Cheat if we are just passed a version, not a valid package name */
72 versionstr = ch ? ch + 1 : pkgname;
73
74 /* Look for the last '_' in the version string, advancing the end pointer */
75 ch = strrchr(versionstr, '_');
76 if (revision != NULL) {
77 *revision = ch ? strtoul(ch + 1, NULL, 10) : 0;

--- 251 unchanged lines hidden ---
70 ch = strrchr(pkgname, '-');
71 /* Cheat if we are just passed a version, not a valid package name */
72 versionstr = ch ? ch + 1 : pkgname;
73
74 /* Look for the last '_' in the version string, advancing the end pointer */
75 ch = strrchr(versionstr, '_');
76 if (revision != NULL) {
77 *revision = ch ? strtoul(ch + 1, NULL, 10) : 0;

--- 251 unchanged lines hidden ---