www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/01/20/05:14:25

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
Message-ID: <3886E0DE.EE734589@vinschen.de>
Date: Thu, 20 Jan 2000 11:18:06 +0100
From: Corinna Vinschen <corinna AT vinschen DOT de>
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: de,en
MIME-Version: 1.0
To: DJ Delorie <dj AT delorie DOT com>
CC: cygdev <cygwin-developers AT sourceware DOT cygnus DOT com>
Subject: Suggestion for regtool

Hi DJ,

I have made a small patch to your new regtool. It's a nice tool
but personally I hate using backslashes on the command line.

My patch checks the first char of the key value to be a slash.
If so, all slashes are translated to backslashes if they
are not preceded by a backslash itself.

I have done the check for the first char is a slash to avoid
some fuzzy kind of automatism.

If you don't like this patch, simply ignore it :)

Bye,
Corinna

========== SNIP ===========
Index: regtool.cc
===================================================================
RCS file: /src/cvsroot/winsup-000108/utils/regtool.cc,v
retrieving revision 1.1
diff -u -p -r1.1 regtool.cc
--- regtool.cc  2000/01/20 09:36:29     1.1
+++ regtool.cc  2000/01/20 09:35:52
@@ -92,11 +92,23 @@ struct {
   { 0, 0 }
 };

+void translate(char *key)
+{
+  char *c = key;
+  while (c = strchr (c, '/'))
+    if (c > key && c[-1] == '\\')
+      memmove(c-1, c, strlen(c)+1);
+    else
+      *c++ = '\\';
+}
+
 void
 find_key(int howmanyparts)
 {
   char *n = argv[0], *e, c;
   int i;
+  if (*n == '/')
+    translate(n);
   while (*n == '\\')
     n++;
   for (e=n; *e && *e != '\\'; e++);

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019