Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Following along in chapter 34.

  • Loading branch information...
commit 4d2c878e2f2b54d469d7cd6c10296ccd815daac8 1 parent fe995e4
Nick authored
View
223 Chapter34/yostring/yostring.xcodeproj/project.pbxproj
@@ -0,0 +1,223 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 019E4BBA17D592BC0029750A /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 019E4BB917D592BC0029750A /* main.c */; };
+ 019E4BBC17D592BC0029750A /* yostring.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 019E4BBB17D592BC0029750A /* yostring.1 */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 019E4BB417D592BC0029750A /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ 019E4BBC17D592BC0029750A /* yostring.1 in CopyFiles */,
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 019E4BB617D592BC0029750A /* yostring */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = yostring; sourceTree = BUILT_PRODUCTS_DIR; };
+ 019E4BB917D592BC0029750A /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
+ 019E4BBB17D592BC0029750A /* yostring.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = yostring.1; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 019E4BB317D592BC0029750A /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 019E4BAD17D592BC0029750A = {
+ isa = PBXGroup;
+ children = (
+ 019E4BB817D592BC0029750A /* yostring */,
+ 019E4BB717D592BC0029750A /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 019E4BB717D592BC0029750A /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 019E4BB617D592BC0029750A /* yostring */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 019E4BB817D592BC0029750A /* yostring */ = {
+ isa = PBXGroup;
+ children = (
+ 019E4BB917D592BC0029750A /* main.c */,
+ 019E4BBB17D592BC0029750A /* yostring.1 */,
+ );
+ path = yostring;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 019E4BB517D592BC0029750A /* yostring */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 019E4BBF17D592BC0029750A /* Build configuration list for PBXNativeTarget "yostring" */;
+ buildPhases = (
+ 019E4BB217D592BC0029750A /* Sources */,
+ 019E4BB317D592BC0029750A /* Frameworks */,
+ 019E4BB417D592BC0029750A /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = yostring;
+ productName = yostring;
+ productReference = 019E4BB617D592BC0029750A /* yostring */;
+ productType = "com.apple.product-type.tool";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 019E4BAE17D592BC0029750A /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0460;
+ ORGANIZATIONNAME = "Nicholas Squire";
+ };
+ buildConfigurationList = 019E4BB117D592BC0029750A /* Build configuration list for PBXProject "yostring" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 019E4BAD17D592BC0029750A;
+ productRefGroup = 019E4BB717D592BC0029750A /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 019E4BB517D592BC0029750A /* yostring */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 019E4BB217D592BC0029750A /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 019E4BBA17D592BC0029750A /* main.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 019E4BBD17D592BC0029750A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 019E4BBE17D592BC0029750A /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ 019E4BC017D592BC0029750A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 019E4BC117D592BC0029750A /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 019E4BB117D592BC0029750A /* Build configuration list for PBXProject "yostring" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 019E4BBD17D592BC0029750A /* Debug */,
+ 019E4BBE17D592BC0029750A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 019E4BBF17D592BC0029750A /* Build configuration list for PBXNativeTarget "yostring" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 019E4BC017D592BC0029750A /* Debug */,
+ 019E4BC117D592BC0029750A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 019E4BAE17D592BC0029750A /* Project object */;
+}
View
77 Chapter34/yostring/yostring/main.c
@@ -0,0 +1,77 @@
+//
+// main.c
+// yostring
+//
+// Created by Nicholas Squire on 9/2/13.
+// Copyright (c) 2013 Nicholas Squire. All rights reserved.
+//
+
+#include <stdio.h> // For printf
+#include <stdlib.h> // For malloc/free
+#include <string.h> // For strlen
+
+int main(int argc, const char * argv[])
+{
+ char x = 0x21; // The character '!'
+
+ while (x <= 0x7e ) { // The character '~'
+ printf("%x is %c\n", x, x);
+ x++;
+ }
+
+ char y = '!'; // The character '!'
+
+ while (y <= '~' ) {
+ printf("%x is %c\n", y, y);
+ y++;
+ }
+
+ // Get a pointer to 5 bytes of memory on the heap
+ //char *start = malloc(5);
+
+// // Put 'L' in the first byte
+// *start = 'L';
+//
+// // Put 'o' in the second byte
+// *(start + 1) = 'o';
+//
+// // Put 'v' in the third byte
+// *(start + 2) = 'v';
+//
+// // Put 'e' in the fourth byte
+// *(start + 3) = 'e';
+//
+// // Put zero in the fifth byte
+// *(start + 4) = '\0';
+
+// // Put 'L' in the first byte
+// start[0] = 'L';
+//
+// // Put 'o' in the second byte
+// start[1] = 'o';
+//
+// // Put 'v' in the third byte
+// start[2] = 'v';
+//
+// // Put 'e' in the fourth byte
+// start[3] = 'e';
+//
+// // Put zero in the fifth byte
+// start[4] = '\0';
+
+ //const char *start = "Love";
+ const char *start = "A backslash after two newlines and a tab:\n\n\t\\";
+
+ // Print out the string and its length
+ printf("%s has %zu characters\n", start, strlen(start));
+
+ // Print out the third letter
+ printf("The third letter is %c\n", start[2]);
+
+ // Free the memory so it can be reused
+ //free(start);
+ start = NULL;
+
+ return 0;
+}
+
View
79 Chapter34/yostring/yostring/yostring.1
@@ -0,0 +1,79 @@
+.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
+.\"See Also:
+.\"man mdoc.samples for a complete listing of options
+.\"man mdoc for the short list of editing options
+.\"/usr/share/misc/mdoc.template
+.Dd 9/2/13 \" DATE
+.Dt yostring 1 \" Program name and manual section number
+.Os Darwin
+.Sh NAME \" Section Header - required - don't modify
+.Nm yostring,
+.\" The following lines are read in generating the apropos(man -k) database. Use only key
+.\" words here as the database is built based on the words here and in the .ND line.
+.Nm Other_name_for_same_program(),
+.Nm Yet another name for the same program.
+.\" Use .Nm macro to designate other names for the documented program.
+.Nd This line parsed for whatis database.
+.Sh SYNOPSIS \" Section Header - required - don't modify
+.Nm
+.Op Fl abcd \" [-abcd]
+.Op Fl a Ar path \" [-a path]
+.Op Ar file \" [file]
+.Op Ar \" [file ...]
+.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
+arg2 ... \" Arguments
+.Sh DESCRIPTION \" Section Header - required - don't modify
+Use the .Nm macro to refer to your program throughout the man page like such:
+.Nm
+Underlining is accomplished with the .Ar macro like this:
+.Ar underlined text .
+.Pp \" Inserts a space
+A list of items with descriptions:
+.Bl -tag -width -indent \" Begins a tagged list
+.It item a \" Each item preceded by .It macro
+Description of item a
+.It item b
+Description of item b
+.El \" Ends the list
+.Pp
+A list of flags and their descriptions:
+.Bl -tag -width -indent \" Differs from above in tag removed
+.It Fl a \"-a flag as a list item
+Description of -a flag
+.It Fl b
+Description of -b flag
+.El \" Ends the list
+.Pp
+.\" .Sh ENVIRONMENT \" May not be needed
+.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
+.\" .It Ev ENV_VAR_1
+.\" Description of ENV_VAR_1
+.\" .It Ev ENV_VAR_2
+.\" Description of ENV_VAR_2
+.\" .El
+.Sh FILES \" File used or created by the topic of the man page
+.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
+.It Pa /usr/share/file_name
+FILE_1 description
+.It Pa /Users/joeuser/Library/really_long_file_name
+FILE_2 description
+.El \" Ends the list
+.\" .Sh DIAGNOSTICS \" May not be needed
+.\" .Bl -diag
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .El
+.Sh SEE ALSO
+.\" List links in ascending order by section, alphabetically within a section.
+.\" Please do not reference files that do not exist without filing a bug report
+.Xr a 1 ,
+.Xr b 1 ,
+.Xr c 1 ,
+.Xr a 2 ,
+.Xr b 2 ,
+.Xr a 3 ,
+.Xr b 3
+.\" .Sh BUGS \" Document known, unremedied bugs
+.\" .Sh HISTORY \" Document history if command behaves in a unique manner
Please sign in to comment.
Something went wrong with that request. Please try again.