perform.c (228990) | perform.c (240682) |
---|---|
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 --- 5 unchanged lines hidden (view full) --- 14 * Jeremy D. Lea. 15 * 11 May 2002 16 * 17 * This is the version module. Based on pkg_version.pl by Bruce A. Mah. 18 * 19 */ 20 21#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 --- 5 unchanged lines hidden (view full) --- 14 * Jeremy D. Lea. 15 * 11 May 2002 16 * 17 * This is the version module. Based on pkg_version.pl by Bruce A. Mah. 18 * 19 */ 20 21#include <sys/cdefs.h> |
22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/version/perform.c 228990 2011-12-30 10:58:14Z uqs $"); | 22__FBSDID("$FreeBSD: head/usr.sbin/pkg_install/version/perform.c 240682 2012-09-18 22:09:23Z bapt $"); |
23 24#include "lib.h" 25#include "version.h" 26#include <err.h> 27#include <fetch.h> 28#include <signal.h> 29 30FILE *IndexFile; --- 20 unchanged lines hidden (view full) --- 51 char **pkgs, *pat[2], **patterns; 52 struct index_entry *ie; 53 int i, err_cnt = 0, rel_major_ver; 54 int MatchType; 55 56 struct utsname u; 57 58 if (uname(&u) == -1) { | 23 24#include "lib.h" 25#include "version.h" 26#include <err.h> 27#include <fetch.h> 28#include <signal.h> 29 30FILE *IndexFile; --- 20 unchanged lines hidden (view full) --- 51 char **pkgs, *pat[2], **patterns; 52 struct index_entry *ie; 53 int i, err_cnt = 0, rel_major_ver; 54 int MatchType; 55 56 struct utsname u; 57 58 if (uname(&u) == -1) { |
59 warn("%s(): failed to determine uname information", __func__); | 59 warn("%s: failed to determine uname information", __func__); |
60 return 1; 61 } else if ((rel_major_ver = (int) strtol(u.release, NULL, 10)) <= 0) { | 60 return 1; 61 } else if ((rel_major_ver = (int) strtol(u.release, NULL, 10)) <= 0) { |
62 | 62 warnx("%s: bad release version specified: %s", __func__, u.release); 63 return 1; |
63 } 64 65 /* 66 * Try to find and open the INDEX. We only check IndexFile != NULL 67 * later, if we actually need the INDEX. 68 */ 69 if (*indexarg == NULL) { 70 snprintf(IndexPath, sizeof(IndexPath), "%s/INDEX-%d", PORTS_DIR, --- 245 unchanged lines hidden (view full) --- 316 } 317 printf("\n"); 318 } 319 } else { 320 cmp = version_cmp(plist.name, latest); 321 ver = strrchr(latest, '-'); 322 ver = ver ? &ver[1] : latest; 323 if (cmp < 0 && OUTPUT('<')) { | 64 } 65 66 /* 67 * Try to find and open the INDEX. We only check IndexFile != NULL 68 * later, if we actually need the INDEX. 69 */ 70 if (*indexarg == NULL) { 71 snprintf(IndexPath, sizeof(IndexPath), "%s/INDEX-%d", PORTS_DIR, --- 245 unchanged lines hidden (view full) --- 317 } 318 printf("\n"); 319 } 320 } else { 321 cmp = version_cmp(plist.name, latest); 322 ver = strrchr(latest, '-'); 323 ver = ver ? &ver[1] : latest; 324 if (cmp < 0 && OUTPUT('<')) { |
324 printf("%-34s %c", tmp, Quiet ? '\0' : '<'); 325 if (Verbose) 326 printf(" needs updating (%s has %s)", source, ver); | 325 if (Quiet) 326 printf("%s", tmp); 327 else { 328 printf("%-34s <", tmp); 329 if (Verbose) 330 printf(" needs updating (%s has %s)", source, ver); 331 } |
327 printf("\n"); 328 } else if (cmp == 0 && OUTPUT('=')) { | 332 printf("\n"); 333 } else if (cmp == 0 && OUTPUT('=')) { |
329 printf("%-34s %c", tmp, Quiet ? '\0' : '='); 330 if (Verbose) 331 printf(" up-to-date with %s", source); | 334 if (Quiet) 335 printf("%s", tmp); 336 else { 337 printf("%-34s =", tmp); 338 if (Verbose) 339 printf(" up-to-date with %s", source); 340 } |
332 printf("\n"); 333 } else if (cmp > 0 && OUTPUT('>')) { | 341 printf("\n"); 342 } else if (cmp > 0 && OUTPUT('>')) { |
334 printf("%-34s %c", tmp, Quiet ? '\0' : '>'); 335 if (Verbose) 336 printf(" succeeds %s (%s has %s)", source, source, ver); | 343 if (Quiet) 344 printf("%s", tmp); 345 else { 346 printf("%-34s >", tmp); 347 if (Verbose) 348 printf(" succeeds %s (%s has %s)", source, source, ver); 349 } |
337 printf("\n"); 338 } 339 } 340} 341 342int 343version_match(char *pattern, const char *pkgname) 344{ --- 77 unchanged lines hidden --- | 350 printf("\n"); 351 } 352 } 353} 354 355int 356version_match(char *pattern, const char *pkgname) 357{ --- 77 unchanged lines hidden --- |