]>
git.saurik.com Git - apple/security.git/blob - OSX/sec/SOSCircle/Tool/syncbackup.c
3 * Copyright (c) 2003-2007,2009-2010,2013-2016 Apple Inc. All Rights Reserved.
5 * @APPLE_LICENSE_HEADER_START@
7 * This file contains Original Code and/or Modifications of Original Code
8 * as defined in and that are subject to the Apple Public Source License
9 * Version 2.0 (the 'License'). You may not use this file except in
10 * compliance with the License. Please obtain a copy of the License at
11 * http://www.opensource.apple.com/apsl/ and read it before using this
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
19 * Please see the License for the specific language governing rights and
20 * limitations under the License.
22 * @APPLE_LICENSE_HEADER_END@
33 #include "syncbackup.h"
37 #include <CoreFoundation/CoreFoundation.h>
39 #include <Security/SecureObjectSync/SOSCloudCircle.h>
40 #include <Security/SecureObjectSync/SOSCloudCircleInternal.h>
42 #include <utilities/SecCFWrappers.h>
44 #include <SecurityTool/readline.h>
45 #include "secToolFileIO.h"
48 static bool dumpBackupInfo(CFErrorRef
*error
) {
49 CFReleaseNull(*error
);
50 bool isLast
= SOSCCIsThisDeviceLastBackup(error
);
52 printmsg(CFSTR("This %s the last backup peer.\n"), (isLast
) ? "is": "isn't");
53 return *error
!= NULL
;
58 syncbackup(int argc
, char * const *argv
)
61 "Circle Backup Information"
62 " -i info (current status)"
65 setOutputTo(NULL
, NULL
);
68 CFErrorRef error
= NULL
;
69 bool hadError
= false;
71 while ((ch
= getopt(argc
, argv
, "i")) != -1)
75 hadError
= dumpBackupInfo(&error
);
80 return 2; /* Return 2 triggers usage message. */
84 printerr(CFSTR("Error: %@\n"), error
);