whereis.c (298371) | whereis.c (298879) |
---|---|
1/* 2 * Copyright �� 2002, J��rg Wunsch 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 18 unchanged lines hidden (view full) --- 27 * 4.3BSD UI-compatible whereis(1) utility. Rewritten from scratch 28 * since the original 4.3BSD version suffers legal problems that 29 * prevent it from being redistributed, and since the 4.4BSD version 30 * was pretty inferior in functionality. 31 */ 32 33#include <sys/types.h> 34 | 1/* 2 * Copyright �� 2002, J��rg Wunsch 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 18 unchanged lines hidden (view full) --- 27 * 4.3BSD UI-compatible whereis(1) utility. Rewritten from scratch 28 * since the original 4.3BSD version suffers legal problems that 29 * prevent it from being redistributed, and since the 4.4BSD version 30 * was pretty inferior in functionality. 31 */ 32 33#include <sys/types.h> 34 |
35__FBSDID("$FreeBSD: head/usr.bin/whereis/whereis.c 298371 2016-04-20 20:56:06Z bapt $"); | 35__FBSDID("$FreeBSD: head/usr.bin/whereis/whereis.c 298879 2016-05-01 16:13:05Z pfg $"); |
36 37#include <sys/stat.h> 38#include <sys/sysctl.h> 39 40#include <dirent.h> 41#include <err.h> 42#include <errno.h> 43#include <locale.h> --- 456 unchanged lines hidden (view full) --- 500 501 if ((cp2 = strchr(buf, '\n')) != NULL) 502 *cp2 = '\0'; 503 if (regexec(&re, buf, 2, 504 matches, 0) == 0 && 505 (rlen = matches[1].rm_eo - 506 matches[1].rm_so) > 0) { 507 /* | 36 37#include <sys/stat.h> 38#include <sys/sysctl.h> 39 40#include <dirent.h> 41#include <err.h> 42#include <errno.h> 43#include <locale.h> --- 456 unchanged lines hidden (view full) --- 500 501 if ((cp2 = strchr(buf, '\n')) != NULL) 502 *cp2 = '\0'; 503 if (regexec(&re, buf, 2, 504 matches, 0) == 0 && 505 (rlen = matches[1].rm_eo - 506 matches[1].rm_so) > 0) { 507 /* |
508 * man -w found formated | 508 * man -w found formatted |
509 * page, need to pick up 510 * source page name. 511 */ 512 cp2 = malloc(rlen + 1); 513 if (cp2 == NULL) 514 abort(); 515 memcpy(cp2, 516 buf + matches[1].rm_so, --- 175 unchanged lines hidden --- | 509 * page, need to pick up 510 * source page name. 511 */ 512 cp2 = malloc(rlen + 1); 513 if (cp2 == NULL) 514 abort(); 515 memcpy(cp2, 516 buf + matches[1].rm_so, --- 175 unchanged lines hidden --- |