Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/cs/vcs_src/mnt_touch.c
1810 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 1990-2011 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Glenn Fowler <[email protected]> *
18
* *
19
***********************************************************************/
20
#include "mnt_imount.h"
21
22
#define USAGE "rm file ... # remove cached files"
23
24
int im_touch_help(s)
25
char* s;
26
{
27
printf("\t%s\n", USAGE);
28
return (0);
29
}
30
31
int im_touch(argc, argv)
32
int argc;
33
register char** argv;
34
{
35
register int n;
36
register char* s;
37
int fd;
38
39
error_info.id = argv[0];
40
opt_info.index = 1;
41
while (n = optget(argv, "s:[server] "))
42
switch (n)
43
{
44
case 's':
45
s = opt_info.arg;
46
if ((fd = csopen(s, CS_OPEN_READ)) < 0)
47
{
48
printf("cannot connect cs server %s\n", s);
49
return (-1);
50
}
51
istate.cs_svc = strdup(s);
52
istate.fd = fd;
53
break;
54
case '?':
55
case ':':
56
printf(USAGE);
57
return (1);
58
}
59
60
argc -= opt_info.index;
61
argv += opt_info.index;
62
63
while(argc > 0)
64
{
65
s = *argv;
66
unlink(s);
67
argc--;
68
argv++;
69
}
70
return (0);
71
}
72
73
74
75