Commit Diff


commit - 4b5f1dbafa91a3f6e5bc3b252f2a046388059ca6
commit + 13833da7de30c2d663df96dd16dfd1dced98117e
blob - 3a531fb894eba3c84b592c57c990b672540067f2
blob + aab284ab57515688f19377cda1779f77b8b71759
--- 3-2-output
+++ 3-2-output
@@ -1,129 +1,43 @@
-_What maintains\tone\tVice,\twould\n
 _What maintains	one	Vice,	would
-
-\tbring\tup\ttwo\tChildren_. You may think     \n
 	bring	up	two	Children_. You may think     
-
-perhaps, that a _little_ Tea, or a _little_ Punch\n
 perhaps, that a _little_ Tea, or a _little_ Punch
-
-     now and\t\tthen, Diet a  \t    _little_ more\n
      now and		then, Diet a  	    _little_ more
-
-   costly,\t  \tClothes a _little_    finer    \n
    costly,	  	Clothes a _little_    finer    
-
-     , and a _little_\t\t     Entertainment now\t\t\t\n
      , and a _little_		     Entertainment now			
-
-          and then, can be no _great_ Matter;    \t\t    \n
           and then, can be no _great_ Matter;    		    
-
-but     remember what      _Poor Richard_ says, _Many a Little makes a Mickle._\n
 but     remember what      _Poor Richard_ says, _Many a Little makes a Mickle._
 
-\n
-
-
-_Bewareoflittleexpenses;AsmallLeakwillsinkagreatShip_;andagain,_WhoDaintieslove,shallBeggarsprove_;andmoreover,_FoolsmakeFeasts,andwiseMeneatthem._\n
 _Bewareoflittleexpenses;AsmallLeakwillsinkagreatShip_;andagain,_WhoDaintieslove,shallBeggarsprove_;andmoreover,_FoolsmakeFeasts,andwiseMeneatthem._
 
-\n
-
-
-         Buy   \twhat\t\t     thou\t\t    hast\n
          Buy   	what		     thou		    hast
-
- \t\t\t    no Need of,    \t\tand ere\t\tlong     thou     shalt\t\tsell thy Necessaries.  \t\t\t\n
  			    no Need of,    		and ere		long     thou     shalt		sell thy Necessaries.  			
 
-\n
-
-
-If you would know the Value of Money, go and try to borrow some; for, he that goes a borrowing goes a sorrowing.\n
 If you would know the Value of Money, go and try to borrow some; for, he that goes a borrowing goes a sorrowing.
 
-\n
-
-
-Andnowtoconclude,_ExperiencekeepsadearSchool,butFoolswilllearninnoother,andscarceinthat_;foritistrue,_wemaygiveAdvice,butwecannotgiveConduct_,as_PoorRichard_says:However,rememberthis,_Theythatwon'tbecounseled,can'tbehelped_,as_PoorRichard_says:andfarther,That_ifyouwillnothearReason,she'llsurelyrapyourKnuckles_.\n
 Andnowtoconclude,_ExperiencekeepsadearSchool,butFoolswilllearninnoother,andscarceinthat_;foritistrue,_wemaygiveAdvice,butwecannotgiveConduct_,as_PoorRichard_says:However,rememberthis,_Theythatwon'tbecounseled,can'tbehelped_,as_PoorRichard_says:andfarther,That_ifyouwillnothearReason,she'llsurelyrapyourKnuckles_.
 
-\n
-
-
-It would be thought a hard Government that should tax its People\n
 It would be thought a hard Government that should tax its People
-
-one-tenth Part of their _Time_, to be employed in its Service. But\n
 one-tenth Part of their _Time_, to be employed in its Service. But
-
-_Idleness_ taxes many of us much more, if we reckon all that is spent\n
 _Idleness_ taxes many of us much more, if we reckon all that is spent
-
-in absolute _Sloth_, or doing of nothing, with that which is spent in\n
 in absolute _Sloth_, or doing of nothing, with that which is spent in
-
-idle Employments or Amusements, that amount to nothing. _Sloth_, by\n
 idle Employments or Amusements, that amount to nothing. _Sloth_, by
-
-bringing on Diseases, absolutely shortens Life. _Sloth, like Rust,\n
 bringing on Diseases, absolutely shortens Life. _Sloth, like Rust,
-
-consumes faster than Labor wears; while the used key is always bright,\n
 consumes faster than Labor wears; while the used key is always bright,
-
-as Poor Richard says. But dost thou love Life, then do not squander\n
 as Poor Richard says. But dost thou love Life, then do not squander
-
-Time, for that's the stuff Life is made of, as Poor Richard_ says. How\n
 Time, for that's the stuff Life is made of, as Poor Richard_ says. How
-
-much more than is necessary do we spend in sleep, forgetting that _The\n
 much more than is necessary do we spend in sleep, forgetting that _The
-
-sleeping Fox catches no Poultry_, and that _There will be sleeping\n
 sleeping Fox catches no Poultry_, and that _There will be sleeping
-
-enough in the Grave_, as _Poor Richard_ says.\n
 enough in the Grave_, as _Poor Richard_ says.
 
-\n
-
-
-_If Time be of all Things the most precious, wasting Time must be, as\n
 _If Time be of all Things the most precious, wasting Time must be, as
-
-Poor Richard_ says, _the_ _greatest Prodigality_; since, as he\n
 Poor Richard_ says, _the_ _greatest Prodigality_; since, as he
-
-elsewhere tells us, _Lost Time is never found again; and what we call\n
 elsewhere tells us, _Lost Time is never found again; and what we call
-
-Time enough, always proves little enough_: Let us then up and be\n
 Time enough, always proves little enough_: Let us then up and be
-
-doing, and doing to the Purpose; so by Diligence shall we do more with\n
 doing, and doing to the Purpose; so by Diligence shall we do more with
-
-less Perplexity. _Sloth makes all Things difficult, but Industry all\n
 less Perplexity. _Sloth makes all Things difficult, but Industry all
-
-easy_, as _Poor Richard_ says; and _He that riseth late must trot all\n
 easy_, as _Poor Richard_ says; and _He that riseth late must trot all
-
-Day, and shall scarce overtake his Business at Night; while Laziness\n
 Day, and shall scarce overtake his Business at Night; while Laziness
-
-travels so slowly, that Poverty soon overtakes him_, as we read in\n
 travels so slowly, that Poverty soon overtakes him_, as we read in
-
-_Poor Richard_, who adds, _Drive thy Business, let not that drive\n
 _Poor Richard_, who adds, _Drive thy Business, let not that drive
-
-thee_; and _Early to Bed, and early to rise, makes a Man healthy,\n
 thee_; and _Early to Bed, and early to rise, makes a Man healthy,
-
-wealthy, and wise._\n
 wealthy, and wise._
-
blob - 312c1d34e005189d398c8b206f72fc4e1962fbc6
blob + 8fe3369e8ce8239f9faa9b02ba0c7a5221b739b8
--- 3-2.c
+++ 3-2.c
@@ -20,7 +20,7 @@ int main() {
 		escape(output, input);
 //		printf("%s\n", output);
 		unescape(output2, output);
-		printf("%s\n", output2);
+		printf("%s", output2);
 	}
 
 	return 0;
@@ -48,6 +48,14 @@ int escape(char s[], const char t[]) {
 		switch (t[j]) {
 			case '\t': s[i++] = '\\'; s[i] = 't'; break;
 			case '\n': s[i++] = '\\'; s[i] = 'n'; break;
+			case '\a': s[i++] = '\\'; s[i] = 'a'; break;
+			case '\b': s[i++] = '\\'; s[i] = 'b'; break;
+			case '\f': s[i++] = '\\'; s[i] = 'f'; break;
+			case '\r': s[i++] = '\\'; s[i] = 'r'; break;
+			case '\\': s[i++] = '\\'; s[i] = '\\'; break;
+			case '\?': s[i++] = '\\'; s[i] = '?'; break;
+			case '\'': s[i++] = '\\'; s[i] = '\''; break;
+			case '\"': s[i++] = '\\'; s[i] = '"'; break;
 			default: s[i] = t[j]; break;
 		};
 	}
@@ -66,6 +74,14 @@ int unescape(char s[], const char t[]) {
 				switch(t[j]) {
 					case 'n': s[i] = '\n'; break;
 					case 't': s[i] = '\t'; break;
+					case 'a': s[i] = '\a'; break;
+					case 'b': s[i] = '\b'; break;
+					case 'f': s[i] = '\f'; break;
+					case 'r': s[i] = '\r'; break;
+					case '\\': s[i] = '\\'; break;
+					case '\?': s[i] = '\?'; break;
+					case '\'': s[i] = '\''; break;
+					case '\"': s[i] = '\"'; break;
 					default: s[i] = t[j]; break;
 				}
 			} break;