View | Details | Raw Unified | Return to bug 210374 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/ports/net-p2p/mktorrent/Makefile (+1 lines)
Lines 3-8 Link Here
3
3
4
PORTNAME=	mktorrent
4
PORTNAME=	mktorrent
5
PORTVERSION=	1.0
5
PORTVERSION=	1.0
6
PORTREVISION=	1
6
CATEGORIES=	net-p2p
7
CATEGORIES=	net-p2p
7
MASTER_SITES=	SF
8
MASTER_SITES=	SF
8
9
(-)/usr/ports/net-p2p/mktorrent/files/patch-init.c (+112 lines)
Line 0 Link Here
1
--- init.c.orig	2009-08-25 18:53:22 UTC
2
+++ init.c
3
@@ -277,7 +277,7 @@ static void print_help()
4
 	  "Options:\n"
5
 #ifdef USE_LONG_OPTIONS
6
 	  "-a, --announce=<url>[,<url>]* : specify the full announce URLs\n"
7
-	  "                                at least one is required\n"
8
+	  "                                at least one is required on private torrent\n"
9
 	  "                                additional -a adds backup trackers\n"
10
 	  "-c, --comment=<comment>       : add a comment to the metainfo\n"
11
 	  "-d, --no-date                 : don't write the creation date\n"
12
@@ -298,7 +298,7 @@ static void print_help()
13
 	  "                                additional -w adds more URLs\n"
14
 #else
15
 	  "-a <url>[,<url>]* : specify the full announce URLs\n"
16
-	  "                    at least one is required\n"
17
+	  "                    at least one is required on private torrent\n"
18
 	  "                    additional -a adds backup trackers\n"
19
 	  "-c <comment>      : add a comment to the metainfo\n"
20
 	  "-d                : don't write the creation date\n"
21
@@ -343,7 +343,7 @@ static void print_announce_list(llist_t 
22
  */
23
 static void print_web_seed_list(slist_t *list)
24
 {
25
-	printf("  Web Seed URL: ");
26
+	printf("  Web Seed URLs: ");
27
 
28
 	if (list == NULL) {
29
 		printf("none\n");
30
@@ -361,17 +361,20 @@ static void print_web_seed_list(slist_t 
31
 static void dump_options(metafile_t *m)
32
 {
33
 	printf("Options:\n"
34
-	       "  Announce URLs:\n");
35
+	       "  Announce URLs:");
36
 
37
-	print_announce_list(m->announce_list);
38
+	if (m->announce_list) {
39
+		printf("\n");
40
+		print_announce_list(m->announce_list);
41
+	} else
42
+		printf(" none\n");
43
 
44
-	printf("  Torrent name: %s\n"
45
-	       "  Metafile:     %s\n"
46
-	       "  Piece length: %u\n"
47
-	       "  Be verbose:   yes\n",
48
+	printf("  Torrent name:  %s\n"
49
+	       "  Metafile:      %s\n"
50
+	       "  Piece length:  %u\n",
51
 	       m->torrent_name, m->metainfo_file_path, m->piece_length);
52
 
53
-	printf("  Write date:   ");
54
+	printf("  Write date:    ");
55
 	if (m->no_creation_date)
56
 		printf("no\n");
57
 	else
58
@@ -379,11 +382,17 @@ static void dump_options(metafile_t *m)
59
 
60
 	print_web_seed_list(m->web_seed_list);
61
 
62
-	printf("  Comment:      ");
63
+	printf("  Comment:       ");
64
 	if (m->comment == NULL)
65
-		printf("none\n\n");
66
+		printf("none\n");
67
 	else
68
-		printf("\"%s\"\n\n", m->comment);
69
+		printf("\"%s\"\n", m->comment);
70
+
71
+	printf("  Private:       ");
72
+	if (m->private)
73
+		printf("yes\n\n");
74
+	else
75
+		printf("no\n\n");
76
 }
77
 
78
 /*
79
@@ -495,22 +504,25 @@ EXPORT void init(metafile_t *m, int argc
80
 
81
 	/* set the correct piece length.
82
 	   default is 2^18 = 256kb. */
83
-	if (m->piece_length < 15 || m->piece_length > 28) {
84
+	if (m->piece_length < 15 || m->piece_length > 30) {
85
 		fprintf(stderr,
86
 			"The piece length must be a number between "
87
-			"15 and 28.\n");
88
+			"15 and 30.\n");
89
 		exit(EXIT_FAILURE);
90
 	}
91
 	m->piece_length = 1 << m->piece_length;
92
 
93
-	/* user must specify at least one announce URL as it wouldn't make
94
-	 * any sense to have a default for this */
95
+	/* user must specify at least one announce URL when private flag set
96
+	   as it wouldn't make any sense to have a default for this */
97
 	if (m->announce_list == NULL) {
98
-		fprintf(stderr, "Must specify an announce URL. "
99
-			"Use -h for help.\n");
100
-		exit(EXIT_FAILURE);
101
+		if (m->private == 1) {
102
+			fprintf(stderr, "Must specify an announce URL. "
103
+					"Use -h for help.\n");
104
+			exit(EXIT_FAILURE);
105
+		}
106
+	} else {
107
+		announce_last->next = NULL;
108
 	}
109
-	announce_last->next = NULL;
110
 
111
 	/* ..and a file or directory from which to create the torrent */
112
 	if (optind >= argc) {
(-)/usr/ports/net-p2p/mktorrent/files/patch-output.c (+32 lines)
Line 0 Link Here
1
--- output.c.orig	2009-08-25 18:53:22 UTC
2
+++ output.c
3
@@ -119,15 +119,20 @@ EXPORT void write_metainfo(FILE *f, meta
4
 	printf("Writing metainfo file... ");
5
 	fflush(stdout);
6
 
7
-	/* every metainfo file is one big dictonary
8
-	   and the first entry is the announce URL */
9
-	fprintf(f, "d8:announce%lu:%s",
10
-		(unsigned long)strlen(m->announce_list->l->s),
11
-		m->announce_list->l->s);
12
-	/* write the announce-list entry if we have
13
-	   more than one announce URL */
14
-	if (m->announce_list->next || m->announce_list->l->next)
15
-		write_announce_list(f, m->announce_list);
16
+	/* every metainfo file is one big dictonary */
17
+	fprintf(f, "d");
18
+
19
+	/* first entry is the announce URL (optional) */
20
+	if (m->announce_list != NULL) {
21
+		fprintf(f, "8:announce%lu:%s",
22
+			(unsigned long)strlen(m->announce_list->l->s),
23
+			m->announce_list->l->s);
24
+		/* write the announce-list entry if we have
25
+		   more than one announce URL */
26
+		if (m->announce_list->next || m->announce_list->l->next)
27
+			write_announce_list(f, m->announce_list);
28
+	}
29
+
30
 	/* add the comment if one is specified */
31
 	if (m->comment != NULL)
32
 		fprintf(f, "7:comment%lu:%s",

Return to bug 210374