Based on the facts given, I actually believe the police were entitled to what they did. I'm assuming that the initial stop (being pulled over) was justified with reasonable suspicion that a traffic violation had been committed. If a cop stays on your tail long enough, he'll be able to find some form of a traffic violation, (e.g. failure to signal, or anything minor can justify the initial stop). He probably pulled your buddy over, walked up to the car, and saw the knife, which would then give him reasonable suspicion that your buddy is armed and dangerous. As a result of this reasonable suspicion, the law would allow him to legally frisk your friend and search the passenger compartment (including containers, where a weapon could fit) for weapons that are within reach of the occupants of the car. They cannot search your trunk b/c that is not within reach of an occupant of the car (unless your drive a pickup truck or a hatchback). The problem is, the law doesn't care about police officer pretext, and even if the cop really didn't think he was facing a gang banger, or anyone that really was 'armed and dangerous' (like us, who are plainly dressed in hiker clothes, dirty from a recent camp trip) he still had enough evidence to give him the necessary reasonable suspicion needed to search the entire car (short of the trunk), without consent. The other thing is, even if the cop didn't have a legal stop, or conducted what otherwise was an illegal search...consent cures all. So if they asked your friend if they could search his car, and he said yes, then it doesn't matter if it was a legal stop or search to begin with.
If you're pulled over, and he sees a knife, its still up to the cop to decide whether or not he wants to subject you to a pat down and a car search. Most cops will just let you go, or at most give you a quick frisk. My friends been pulled over with a folder clipped in his pocket. He got patted down, but didn't get his car searched. Cops usually just do the necessary amount to dispel their reasonable suspicion. Seeing that your buddy got taken into the station, i'm assuming they found something else during the search. Perhaps the cop already had the thought in his head that there was something illegal in the car, and most likely used the knife as a proxy to conduct a lawful search for that 'something else' in the car. Again, it sucks because studies show tons of police officer pretext. with a disproportionate amount of minorities being pulled over, ( many most likely were the result of officer pretext.) As your buddy a minority or did he look like a pot smoking hippy? :)
I have mixed feelings about cops doing this. I see the value behind it and the need to protect your own safety, but at the same time I see muchroom for abuse...but by all means its legal. Check out the supreme court case that allowed cops to do this. It also involved a knife
So my advice, dont leave your fixed blades on your body or in plain view, when you're in your car. Keep it in the trunk of the car. And if they ask you to search your car, and you have something to hide, you tell them no. If they have the legal grounds to search, theyll search without your consent anyways...but if they dont have the legal grounds for a search, then don't give them a legal basis by agreeing to a search