Root/
Source at commit 1672 created 12 years 7 months ago. By blackosx, Reset language translations for the Welcome/Description and Conclusion files to english to match latest style I have for English (Sorry everyone who had previously translated). Localizable strings remain as they were as ErmaC had previously amended those to include my recent additions. French translation up to date - thanks Tenval. This will ease merging to the Trunk. | |
---|---|
1 | /* ␊ |
2 | * Copyright (c) 2001 Apple Computer, Inc. All rights reserved. ␊ |
3 | * ␊ |
4 | * @APPLE_LICENSE_HEADER_START@ ␊ |
5 | * ␊ |
6 | * The contents of this file constitute Original Code as defined in and ␊ |
7 | * are subject to the Apple Public Source License Version 1.1 (the ␊ |
8 | * "License"). You may not use this file except in compliance with the ␊ |
9 | * License. Please obtain a copy of the License at ␊ |
10 | * http://www.apple.com/publicsource and read it before using this file. ␊ |
11 | * ␊ |
12 | * This Original Code and all software distributed under the License are ␊ |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ␊ |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ␊ |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ␊ |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ␊ |
17 | * License for the specific language governing rights and limitations ␊ |
18 | * under the License. ␊ |
19 | * ␊ |
20 | * @APPLE_LICENSE_HEADER_END@ ␊ |
21 | */ ␊ |
22 | /* ␊ |
23 | * Shantonu Sen <<EMAIL REMOVED>> ␊ |
24 | * openUp.c - program to set the "first-open-window" field of a volume ␊ |
25 | * ␊ |
26 | * Get the directory ID for the first argument, and set it as word 2 ␊ |
27 | * of the Finder Info fields for the volume it lives on ␊ |
28 | * ␊ |
29 | * cc -o openUp openUp.c ␊ |
30 | * Usage: openUp /Volumes/Foo/OpenMe/ ␊ |
31 | * ␊ |
32 | */ ␊ |
33 | ␊ |
34 | #include <stdio.h>␊ |
35 | #include <unistd.h>␊ |
36 | #include <stdlib.h>␊ |
37 | #include <sys/attr.h>␊ |
38 | #include <sys/stat.h>␊ |
39 | #include <sys/mount.h>␊ |
40 | #include <memory.h>␊ |
41 | ␊ |
42 | struct directoryinfo { ␊ |
43 | ␉long unsigned length; ␊ |
44 | ␉uintptr_t dirid; // changed from: u_int32_t dirid;␊ |
45 | }; ␊ |
46 | ␊ |
47 | struct volumeinfo { ␊ |
48 | ␉long unsigned length; ␊ |
49 | ␉uintptr_t finderinfo[8]; // changed from: u_int32_t finderinfo[8];␊ |
50 | }; ␊ |
51 | ␊ |
52 | ␊ |
53 | int main(int argc, char *argv[]) {␊ |
54 | ␉char *path = NULL;␊ |
55 | ␉struct attrlist alist;␊ |
56 | ␉struct directoryinfo dirinfo;␊ |
57 | ␉struct volumeinfo volinfo;␊ |
58 | ␉struct statfs sfs;␊ |
59 | ␊ |
60 | ␉path = argv[1];␊ |
61 | ␊ |
62 | ␉bzero(&alist, sizeof(alist));␊ |
63 | ␉alist.bitmapcount = 5;␊ |
64 | ␉alist.commonattr = ATTR_CMN_OBJID;␊ |
65 | ␊ |
66 | ␉getattrlist(path, &alist, &dirinfo, sizeof(dirinfo), 0);␊ |
67 | ␊ |
68 | ␉printf("directory id: %lu\n", dirinfo.dirid);␊ |
69 | ␊ |
70 | ␉statfs(path, &sfs);␊ |
71 | ␊ |
72 | ␉printf("mountpoint: %s\n", sfs.f_mntonname);␊ |
73 | ␊ |
74 | ␉alist.commonattr = ATTR_CMN_FNDRINFO;␊ |
75 | ␉alist.volattr = ATTR_VOL_INFO;␊ |
76 | ␊ |
77 | ␉getattrlist(sfs.f_mntonname, &alist, &volinfo, sizeof(volinfo), 0);␊ |
78 | ␉volinfo.finderinfo[2] = dirinfo.dirid;␊ |
79 | ␉setattrlist(sfs.f_mntonname, &alist, volinfo.finderinfo, sizeof(volinfo.finderinfo), 0);␊ |
80 | ␊ |
81 | ␉return EXIT_SUCCESS;␊ |
82 | } ␊ |
83 |