HTStyle 0.11 → 0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55d6daeb4bfdb633b78f35a9e6916af79758503e
4
- data.tar.gz: 84ccfe452432f403389f8d8201b0fccdbcd008c7
3
+ metadata.gz: 5c5cb0251745e1f858523629322ff0b55c2c7564
4
+ data.tar.gz: 46286cea55f179570edb3b53a7d39f246f60cec3
5
5
  SHA512:
6
- metadata.gz: 5dff2264902ed223381d738ca80fd0a8989ffbdfec167435d8824232a087ed0f0069dc8afd65949650c086f1bd3de4a8c36d719607692022f369a80e8ebd7ec2
7
- data.tar.gz: 28940ce2e843e5faeb045ed3c0e0c10e8bbf9e61afd2c185c33728c2d4da5c30561b7a7e5606423496e8ea646641d9282d00fc7a2bb77ee0c0ca469fbcafc3a8
6
+ metadata.gz: bf73eabf35cd7e68d33008532857b7114eaa0fceb3ebf81b51d8a7b3d3ed631da6c6e6b62970c49934096463ba66bb05f19d9c433eb7feeab8ba3f4d9708ca37
7
+ data.tar.gz: 89dd83cae6b2a87ccebdfc9d9715ef2511ff46be3a4e3fe15534bec6e97e4adf17997a2ebc6d2c9750703bc25046cf2d577391fc2c275303de60ca071b3c3dff
data/README.md CHANGED
@@ -1,8 +1,13 @@
1
1
  ##HTStyle
2
- Now that everyone looks up to Hack Team, you probably want to implement their coding style.
2
+ Now that everyone looks up to Hacking Team, you probably want to implement their coding style.
3
3
 
4
4
  This application can re-indent you rexisting codebase to match the awesome style.
5
5
 
6
+ ###Install
7
+ This is now a published gem.
8
+
9
+ gem install HTStyle
10
+
6
11
  ###Usage
7
12
 
8
13
  ./htstyle < input.c > output.c
data/htstyle.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.version = HTStyle::VERSION
8
8
  spec.authors = ["Technion"]
9
9
  spec.email = ["technion@lolware.net"]
10
- spec.summary = %q{Implements Hack Team code style}
10
+ spec.summary = %q{Implements Hacking Team code style}
11
11
  spec.description = %q{Implements Hack Team code style}
12
12
  spec.homepage = "https://github.com/technion/htstyle"
13
13
  spec.license = "BSD"
data/lib/htstyle.rb CHANGED
@@ -6,8 +6,9 @@ module HTStyle
6
6
  accum = 0
7
7
  handle.each_line do |line|
8
8
  line.lstrip!
9
- accum += 4 if line.chomp[-1] == '{'
10
- accum -= 4 if line.chomp[-1] == '}'
9
+ line.chomp!
10
+ accum += 4 if line[-1] == '{'
11
+ accum -= 4 if line[-1] == '}'
11
12
  white = 80 - line.length - accum
12
13
  white = 0 if white < 0
13
14
  puts " " * white + line
data/lib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # Main re-indent module for HTStyle. See https://github.com/technion/htstyle
2
2
  module HTStyle
3
- VERSION = "0.11"
3
+ VERSION = "0.12"
4
4
  end
@@ -1,74 +1,74 @@
1
- /* Example socket code - find a free port
2
- * technion@lolware.net
3
- * 10/2/2015
4
- * Example only - not production tested
5
- */
6
- #include <stdio.h>
7
- #include <sys/socket.h>
8
- #include <arpa/inet.h>
9
- #include <string.h>
10
- #ifndef S_SPLINT_S
11
- #include <unistd.h>
12
- #endif
13
- #include <stdlib.h>
14
- #include <errno.h>
1
+ /* Example socket code - find a free port
2
+ * technion@lolware.net
3
+ * 10/2/2015
4
+ * Example only - not production tested
5
+ */
6
+ #include <stdio.h>
7
+ #include <sys/socket.h>
8
+ #include <arpa/inet.h>
9
+ #include <string.h>
10
+ #ifndef S_SPLINT_S
11
+ #include <unistd.h>
12
+ #endif
13
+ #include <stdlib.h>
14
+ #include <errno.h>
15
15
 
16
- #define STARTPORT 8081 /* Start port range to check for a free port */
17
- #define ENDPOINT 8090
16
+ #define STARTPORT 8081 /* Start port range to check for a free port */
17
+ #define ENDPOINT 8090
18
18
 
19
- static uint16_t bind_open_port(int sock);
19
+ static uint16_t bind_open_port(int sock);
20
20
 
21
- int main()
22
- {
23
- int sock;
24
- uint16_t port;
21
+ int main()
22
+ {
23
+ int sock;
24
+ uint16_t port;
25
25
 
26
- /* Generic socket creation, ipv4, TCP */
27
- sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
28
- if (sock < 0) {
29
- perror("Failed to create socket");
30
- exit(EXIT_FAILURE);
31
- }
26
+ /* Generic socket creation, ipv4, TCP */
27
+ sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
28
+ if (sock < 0) {
29
+ perror("Failed to create socket");
30
+ exit(EXIT_FAILURE);
31
+ }
32
32
 
33
- port = bind_open_port(sock);
34
- printf("Successfully bound to socket %d\n", port);
35
- (void)close(sock);
33
+ port = bind_open_port(sock);
34
+ printf("Successfully bound to socket %d\n", port);
35
+ (void)close(sock);
36
36
 
37
- return 0;
38
- }
37
+ return 0;
38
+ }
39
39
 
40
- /* Cycles from STARTPORT to ENDPORT, looking for a port that is
41
- * available for bind().
42
- * int sock: Valid socket
43
- * Returns: port number, or 0 for error
44
- */
40
+ /* Cycles from STARTPORT to ENDPORT, looking for a port that is
41
+ * available for bind().
42
+ * int sock: Valid socket
43
+ * Returns: port number, or 0 for error
44
+ */
45
45
 
46
- static uint16_t bind_open_port(int sock)
47
- {
48
- struct sockaddr_in servAddr;
49
- uint16_t port;
46
+ static uint16_t bind_open_port(int sock)
47
+ {
48
+ struct sockaddr_in servAddr;
49
+ uint16_t port;
50
50
 
51
- for(port = STARTPORT; port <= ENDPOINT; port++) {
52
- memset(&servAddr, 0, sizeof(servAddr));
53
- servAddr.sin_family = AF_INET;
54
- servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
55
- servAddr.sin_port = htons(port);
56
- if (bind(sock, (struct sockaddr *) &servAddr,
57
- (socklen_t)sizeof(servAddr)) == 0) {
58
- /* Successful bind */
59
- return port;
60
- }
61
- /* Error condition on bind() */
62
- if(errno == EADDRINUSE) {
63
- /* This is the "port in use" error, try for another port */
64
- printf("Port %d is in use\n", port);
65
- continue;
66
- }
67
- /* Reaching here indicates a different error */
68
- perror("Failed to bind");
69
- }
70
- printf("Unable to find a valid port");
71
- return 0;
51
+ for(port = STARTPORT; port <= ENDPOINT; port++) {
52
+ memset(&servAddr, 0, sizeof(servAddr));
53
+ servAddr.sin_family = AF_INET;
54
+ servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
55
+ servAddr.sin_port = htons(port);
56
+ if (bind(sock, (struct sockaddr *) &servAddr,
57
+ (socklen_t)sizeof(servAddr)) == 0) {
58
+ /* Successful bind */
59
+ return port;
60
+ }
61
+ /* Error condition on bind() */
62
+ if(errno == EADDRINUSE) {
63
+ /* This is the "port in use" error, try for another port */
64
+ printf("Port %d is in use\n", port);
65
+ continue;
66
+ }
67
+ /* Reaching here indicates a different error */
68
+ perror("Failed to bind");
69
+ }
70
+ printf("Unable to find a valid port");
71
+ return 0;
72
72
 
73
- }
73
+ }
74
74
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HTStyle
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.11'
4
+ version: '0.12'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Technion
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-08 00:00:00.000000000 Z
11
+ date: 2015-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,7 +83,7 @@ rubyforge_project:
83
83
  rubygems_version: 2.4.6
84
84
  signing_key:
85
85
  specification_version: 4
86
- summary: Implements Hack Team code style
86
+ summary: Implements Hacking Team code style
87
87
  test_files:
88
88
  - spec/example_output.c
89
89
  - spec/htstyle_spec.rb