[hackers] [surf] Dropping -f/-u arguments as suggested by Kai Hendry || Enno Boland (tox)

From: <hg_AT_suckless.org>
Date: Sun, 6 Sep 2009 11:25:57 +0000 (UTC)

changeset: 50:b6f246add11d
tag: tip
user: Enno Boland (tox) <tox_AT_s01.de>
date: Sun Sep 06 13:27:28 2009 +0200
files: surf.1 surf.c
description:
Dropping -f/-u arguments as suggested by Kai Hendry

diff -r 0ab6436bf28f -r b6f246add11d surf.1
--- a/surf.1 Sun Sep 06 13:15:53 2009 +0200
+++ b/surf.1 Sun Sep 06 13:27:28 2009 +0200
@@ -4,8 +4,7 @@
 .SH SYNOPSIS
 .B surf
 .RB [ \-ehvx ]
-.RB [ \-f " FILE"]
-.RB [ \-u " URI"]
+.RB "URI"
 .SH DESCRIPTION
 surf is a simple Web browser based on WebKit/GTK+. It is able
 to display websites and follow links. It supports the XEmbed protocol
@@ -17,16 +16,9 @@
 Prints xid to standard output and waits until an application reparents the
 window.
 .TP
-.B \-f FILE
-Sets the browser's URI to FILE. It is also possible to read from standard
-input.
-.TP
 .B \-h
 Prints usage information to standard output, then exits.
 .TP
-.B \-u URI
-Sets the browser's URI.
-.TP
 .B \-v
 Prints version information to standard output, then exits.
 .TP
diff -r 0ab6436bf28f -r b6f246add11d surf.c
--- a/surf.c Sun Sep 06 13:15:53 2009 +0200
+++ b/surf.c Sun Sep 06 13:27:28 2009 +0200
@@ -524,7 +524,7 @@
 void
 usage() {
         fputs("surf - simple browser\n", stderr);
- die("usage: surf [-e] [-x] [-u uri] [-f file]\n");
+ die("usage: surf [-e] [-x] [uri]\n");
 }
 
 void
@@ -564,21 +564,21 @@
                         showxid = TRUE;
                         embed = TRUE;
                         break;
- case 'u':
- c = newclient();
- loaduri(c, optarg);
- break;
- case 'f':
- c = newclient();
- loadfile(c, optarg);
- break;
                 case 'v':
                         die("surf-"VERSION", © 2009 surf engineers, see LICENSE for details\n");
                         break;
                 default:
                         usage();
                 }
- if(optind != argc)
+ if(optind + 1 == argc) {
+ c = newclient();
+ if(strchr("./", argv[optind][0]) || strcmp("-", argv[optind]) == 0)
+ loadfile(c, argv[optind]);
+ else
+ loaduri(c, argv[optind]);
+
+ }
+ else if(optind != argc)
                 usage();
         if(!clients)
                 newclient();
Received on Sun Sep 06 2009 - 11:25:57 UTC

This archive was generated by hypermail 2.2.0 : Sun Sep 06 2009 - 11:36:05 UTC