~ubuntu-branches/ubuntu/lucid/9base/lucid

« back to all changes in this revision

Viewing changes to touch/touch.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-08-20 17:34:06 UTC
  • mfrom: (6.2.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090820173406-xpwqa9ruyevvc0ut
Tags: 1:3-3
* Updating maintainer field.
* Updating vcs fields.
* Updating package to standards version 3.8.3.
* Updatin variables writing in rules to consistent style.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
int touch(int, char *);
5
5
ulong now;
 
6
int tflag;
6
7
 
7
8
void
8
9
usage(void)
20
21
        now = time(0);
21
22
        ARGBEGIN{
22
23
        case 't':
 
24
                tflag = 1;
23
25
                now = strtoul(EARGF(usage()), 0, 0);
24
26
                break;
25
27
        case 'c':
52
54
                fprint(2, "touch: %s: cannot wstat: %r\n", name);
53
55
                return 1;
54
56
        }
55
 
        if ((fd = create(name, OREAD, 0666)) < 0) {
 
57
        if((fd = create(name, OREAD, 0666)) < 0) {
56
58
                fprint(2, "touch: %s: cannot create: %r\n", name);
57
59
                return 1;
58
60
        }
59
 
        dirfwstat(fd, &stbuff);
 
61
        if(tflag && dirfwstat(fd, &stbuff) < 0){
 
62
                fprint(2, "touch: %s: cannot wstat: %r\n", name);
 
63
                close(fd);
 
64
                return 1;
 
65
        }
60
66
        close(fd);
61
67
        return 0;
62
68
}