ports/80178: [PATCH] sysutils/eject: update to 1.5, take maintainership
sylvio cesar
sylvioc at gmail.com
Thu Apr 21 03:50:26 UTC 2005
>Number: 80178
>Category: ports
>Synopsis: [PATCH] sysutils/eject: update to 1.5, take maintainership
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Apr 21 03:50:25 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: sylvio cesar
>Release: FreeBSD 5.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD sylvioc.gmail.com 5.4-STABLE FreeBSD 5.4-STABLE #2: Sun Apr 10 04:35:12 BRT 2005
>Description:
- Update to 1.5
- Removed patchfile patch-eject.c
- Take maintainership
Added file(s):
- files/patch-eject.1
Removed file(s):
- files/patch-aa
- files/patch-ab
Generated with FreeBSD Port Tools 0.63
>How-To-Repeat:
>Fix:
--- eject-1.5.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/sysutils/eject/Makefile,v
retrieving revision 1.7
diff -u -r1.7 Makefile
--- Makefile 1 Feb 2004 17:02:40 -0000 1.7
+++ Makefile 20 Apr 2005 20:21:07 -0000
@@ -6,14 +6,13 @@
#
PORTNAME= eject
-PORTVERSION= 1.4
-PORTREVISION= 2
+PORTVERSION= 1.5
CATEGORIES= sysutils
MASTER_SITES= ftp://ports.jp.FreeBSD.org/pub/FreeBSD-jp/OD/ \
ftp://ftp4.jp.FreeBSD.org/pub/FreeBSD-jp/OD/ \
ftp://ftp.ics.es.osaka-u.ac.jp/pub/mirrors/FreeBSD-jp/OD/
-MAINTAINER= ports at FreeBSD.org
+MAINTAINER= sylvioc at gmail.com
COMMENT= Utility for ejecting media from CD or optical disk drive
PLIST_FILES= sbin/eject
Index: distinfo
===================================================================
RCS file: /home/ncvs/ports/sysutils/eject/distinfo,v
retrieving revision 1.2
diff -u -r1.2 distinfo
--- distinfo 29 Jan 2004 16:11:46 -0000 1.2
+++ distinfo 20 Apr 2005 20:21:07 -0000
@@ -1,2 +1,2 @@
-MD5 (eject-1.4.tar.gz) = 9145efa126d09876b72502bf08075d98
-SIZE (eject-1.4.tar.gz) = 4712
+MD5 (eject-1.5.tar.gz) = 28c72f0e3a3657348749295a6afd72a6
+SIZE (eject-1.4.tar.gz) = 4928
Index: files/patch-aa
===================================================================
RCS file: files/patch-aa
diff -N files/patch-aa
--- files/patch-aa 1 Feb 2004 17:02:40 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,204 +0,0 @@
---- eject.c.orig Tue Jan 4 15:42:12 2000
-+++ eject.c Sun Feb 1 17:59:10 2004
-@@ -43,8 +43,8 @@
- extern int optind;
-
- void usage(void);
--int check_device(char *, char *);
--int unmount_fs(char *, char *);
-+int check_device(char *, char **);
-+int unmount_fs(char *, char **);
- int eject(char *, char *);
-
- char *program = "eject";
-@@ -52,6 +52,7 @@
- int fflag; /* force unmount filesystem */
- int nflag; /* not execute operation */
- int vflag; /* verbose operation */
-+int tflag; /* tray close */
-
- /*
- * simple eject program
-@@ -65,14 +66,14 @@
- {
- int ch;
- int sts;
-- char device[256], name[256];
-- char err[256];
-+ char *device, *name;
-+ char *err;
- char *defdev;
-
-- fflag = nflag = vflag = 0;
-+ fflag = nflag = vflag = tflag = 0;
- defdev = getenv("EJECT");
-
-- while ((ch = getopt(argc, argv, "fnv?")) != EOF) {
-+ while ((ch = getopt(argc, argv, "fnvt?")) != EOF) {
- switch (ch) {
- case 'f' :
- fflag = 1;
-@@ -83,6 +84,9 @@
- case 'v' :
- vflag = 1;
- break;
-+ case 't' :
-+ tflag = 1;
-+ break;
- case '?' :
- default :
- usage();
-@@ -95,18 +99,51 @@
- if (argc == 0) {
- usage();
- }
-- strcpy(name, *argv);
-+ name = strdup(*argv);
- } else {
-- strcpy(name, defdev);
-+ name = strdup(defdev);
- }
-
-- sts = check_device(name, device);
-+ sts = check_device(name, &device);
- if (sts < 0) {
- perror(program);
- exit(1);
-+ } else {
-+ int c;
-+ char *dev_bak = malloc(MAXPATHLEN);
-+ free(name);
-+ if ((c = readlink(device, dev_bak, MAXPATHLEN))>0) {
-+ dev_bak[c] = '\0';
-+ name = dev_bak;
-+ } else {
-+ free(dev_bak);
-+ name = device;
-+ }
-+ if (strncmp(device, "/dev/", 5) != 0)
-+ {
-+ int mnts;
-+ struct statfs *mntbuf;
-+ mnts = getmntinfo(&mntbuf, MNT_NOWAIT);
-+ if (mnts == 0) {
-+ perror(program);
-+ exit(1);
-+ }
-+ for (ch = 0; ch < mnts; ch++) {
-+ if (strcmp(mntbuf[ch].f_mntonname, name) == 0) {
-+ device = strdup(mntbuf[ch].f_mntfromname);
-+ name = strdup(mntbuf[ch].f_mntfromname);
-+ break;
-+ }
-+ }
-+ if (strncmp(device, "/dev/", 5) != 0)
-+ {
-+ perror(program);
-+ exit(1);
-+ }
-+ }
- }
-
-- sts = unmount_fs(name, err);
-+ sts = unmount_fs(name, &err);
- if (sts < 0) {
- perror(err);
- exit(1);
-@@ -128,16 +165,26 @@
- int
- check_device(name, device)
- char *name;
-- char *device;
-+ char **device;
- {
-- int sts;
-+ int sts = 0, i;
- struct stat sb;
-
-- sprintf(device, "/dev/r%sc", name);
-- if (vflag || nflag) {
-- printf("%s: using device %s\n", program, device);
-+ const char* dev_list[] = { "/dev/%sc", "/dev/%s", "%s" };
-+ for (i = 0; i < 3; i++) {
-+ if ((sts = asprintf(device, dev_list[i], name)) == -1)
-+ return sts;
-+ if (vflag || nflag) {
-+ printf("%s: trying device %s\n", program, *device);
-+ }
-+ sts = stat(*device, &sb);
-+ if (sts) { /* stat failed, try next */
-+ free(*device);
-+ continue;
-+ } else {
-+ break;
-+ }
- }
-- sts = stat(device, &sb);
-
- return sts;
- }
-@@ -155,7 +202,7 @@
- int
- unmount_fs(name, err)
- char *name;
-- char *err;
-+ char **err;
- {
- int mnts;
- struct statfs *mntbuf;
-@@ -173,7 +220,7 @@
- /* get proper mount information into the list */
- len = strlen(name);
- for (n = 0; n < mnts; n++) {
-- p = rindex(mntbuf[n].f_mntfromname, '/');
-+ p = mntbuf[n].f_mntfromname - 1;
- if (p == NULL) {
- continue;
- }
-@@ -221,7 +268,7 @@
- sts = 0;
- }
- if (sts < 0 && fflag == 0) {
-- sprintf(err, "%s: %s", program, mp->mntonname);
-+ asprintf(err, "%s: %s", program, mp->mntonname);
- return sts;
- }
- nextp = mp->next;
-@@ -255,14 +302,26 @@
- }
- if (!nflag) {
- if (vflag) {
-- printf("%s: ejecting media from %s\n", program, name);
-+ if (tflag) {
-+ printf("%s: tray close on %s\n", program, name);
-+ } else {
-+ printf("%s: ejecting media from %s\n", program, name);
-+ }
- }
- sts = ioctl(fd, CDIOCALLOW);
- if (sts >= 0) {
-- sts = ioctl(fd, CDIOCEJECT);
-+ if (tflag) {
-+ sts = ioctl(fd, CDIOCCLOSE);
-+ } else {
-+ sts = ioctl(fd, CDIOCEJECT);
-+ }
- }
- } else {
-- printf("%s: ejecting media from %s\n", program, name);
-+ if (tflag) {
-+ printf("%s: tray close on %s\n", program, name);
-+ } else {
-+ printf("%s: ejecting media from %s\n", program, name);
-+ }
- sts = 0;
- }
- close(fd);
-@@ -277,6 +336,6 @@
- void
- usage(void)
- {
-- fprintf(stderr, "usage: %s [-fnv] device\n", program);
-+ fprintf(stderr, "usage: %s [-fnvt] device\n", program);
- exit(1);
- }
Index: files/patch-ab
===================================================================
RCS file: files/patch-ab
diff -N files/patch-ab
--- files/patch-ab 1 Feb 2004 17:02:40 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
---- eject.1.orig Tue Jan 4 14:49:41 2000
-+++ eject.1 Sun Feb 1 00:49:17 2004
-@@ -53,6 +53,8 @@
- Not execute operation but print it.
- .It Fl v
- Verbose mode.
-+.It Fl t
-+Give drive tray close command.
- .Sh ENVIRONMENT
- If the following environment variable exists, it is used by
- .Nm eject :
Index: files/patch-eject.1
===================================================================
RCS file: files/patch-eject.1
diff -N files/patch-eject.1
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/patch-eject.1 20 Apr 2005 20:21:07 -0000
@@ -0,0 +1,11 @@
+--- eject.1.orig Tue Jan 4 14:49:41 2000
++++ eject.1 Sun Feb 1 00:49:17 2004
+@@ -53,6 +53,8 @@
+ Not execute operation but print it.
+ .It Fl v
+ Verbose mode.
++.It Fl t
++Give drive tray close command.
+ .Sh ENVIRONMENT
+ If the following environment variable exists, it is used by
+ .Nm eject :
--- eject-1.5.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list