mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 12:35:44 +08:00
cd9102214b
darcs-hash:20060811011835-ac50b-847fc790288e3bb3f3a0ee7734ff278d2dc65bef.gz
25 lines
751 B
C
25 lines
751 B
C
/** \file count.c
|
|
The length command, used for determining the number of items in an
|
|
environment variable array.
|
|
*/
|
|
#include "config.h"
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
/**
|
|
The main function. Does nothing but return the number of arguments.
|
|
|
|
This command, unlike all other fish commands, does not feature a -h
|
|
or --help option. This is because we want to avoid errors on arrays
|
|
that have -h or --help as entries, which is very common when
|
|
parsing options, etc. For this reason, the main fish binary does a
|
|
check and prints help usage if -h or --help is explicitly given to
|
|
the command, but not if it is the contents of a variable.
|
|
*/
|
|
int main( int argc, char **argv )
|
|
{
|
|
printf( "%d\n", argc-1 );
|
|
return argc==1;
|
|
}
|