File: fcatcmd.c

package info (click to toggle)
fsp 2.71-8hamm10
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 988 kB
  • ctags: 1,287
  • sloc: ansic: 7,715; makefile: 363; sh: 118
file content (68 lines) | stat: -rw-r--r-- 1,672 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    /*********************************************************************\
    *  Copyright (c) 1991 by Wen-King Su (wen-king@vlsi.cs.caltech.edu)   *
    *                                                                     *
    *  You may copy or modify this file in any manner you wish, provided  *
    *  that this notice is always included, and that you hold the author  *
    *  harmless for any loss or damage resulting from the installation or *
    *  use of this software.                                              *
    \*********************************************************************/

#include "tweak.h"
#include "client_def.h"
#include "c_extern.h"
#include "bsd_extern.h"

static  int     optletter;
extern  int     optind;

static void dont_die PROTO1(int, signum)
{
}
     
static int get_file PROTO4(char *, path, struct stat *, sbufp, int, mode, int, level)
{
  util_download(path,stdout,0);
}

static int rec PROTO3 (char *, name, struct stat *, sbufp, u_long *, mode)
{
    if (*mode != RECURSIVE) return (-1);
    return (0);
}

int main PROTO3(int, argc, char **, argv, char **, envp)
{
  char **av, *av2[2];
  int mode;

  env_client();
  
  signal(SIGPIPE,dont_die);
  if(isatty(1)) client_trace = 0;

/* Parse options
 * -r   recursively show files 
 */
  while ((optletter=getopt(argc, argv,"r")) != EOF)
   switch (optletter)
   {
    case 'r':       
	mode=RECURSIVE;
        break;
   }

  argv+=(optind-1);
 
  while(*++argv) {
    if(!(av = glob(*argv))) {
      av = av2;
      av2[0] = *argv; 
      av2[1] = 0;
    }
    while(*av) util_process_file(*av++, mode, get_file, rec, 0L, 0);
  }
  
  client_done();
  
  exit(0);
}