Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37863452
en ru br
Репозитории ALT
5.1: 2.5-alt2
4.1: 2.5-alt1
4.0: 2.5-ipl15mdk
www.altlinux.org/Changes

Группа :: Разработка/C
Пакет: cdecl

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: cdecl-2.5-modernization.patch
Скачать


diff -ru cdecl-2.5/cdecl.c cdecl-2.5.new/cdecl.c
--- cdecl-2.5/cdecl.c	1996-01-16 06:54:46 +0300
+++ cdecl-2.5.new/cdecl.c	2006-05-21 00:33:20 +0400
@@ -89,11 +89,13 @@
 
 #ifdef USE_READLINE
 # include <readline/readline.h>
+# include <readline/history.h>
   /* prototypes for functions related to readline() */
   char * getline();
   char ** attempt_completion(char *, int, int);
-  char * keyword_completion(char *, int);
-  char * command_completion(char *, int);
+  char * keyword_completion(const char *, int);
+  char * command_completion(const char *, int);
+  int dotmpfile_from_string(char*);
 #endif
 
 /* maximum # of chars from progname to display in prompt */
@@ -124,7 +126,6 @@
 
 #if __STDC__
   char *ds(char *), *cat(char *, ...), *visible(int);
-  int getopt(int,char **,char *);
   int main(int, char **);
   int yywrap(void);
   int dostdin(void);
@@ -208,15 +209,15 @@
 /* to save 9 bytes, the "long" row can be removed. */
 char crosscheck[9][9] = {
     /*			L, I, S, C, V, U, S, F, D, */
-    /* long */		_, _, _, _, _, _, _, _, _,
-    /* int */		_, _, _, _, _, _, _, _, _,
-    /* short */		X, _, _, _, _, _, _, _, _,
-    /* char */		X, X, X, _, _, _, _, _, _,
-    /* void */		X, X, X, X, _, _, _, _, _,
-    /* unsigned */	R, _, R, R, X, _, _, _, _,
-    /* signed */	P, P, P, P, X, X, _, _, _,
-    /* float */		A, X, X, X, X, X, X, _, _,
-    /* double */	P, X, X, X, X, X, X, X, _
+    /* long */		{_, _, _, _, _, _, _, _, _},
+    /* int */		{_, _, _, _, _, _, _, _, _},
+    /* short */		{X, _, _, _, _, _, _, _, _},
+    /* char */		{X, X, X, _, _, _, _, _, _},
+    /* void */		{X, X, X, X, _, _, _, _, _},
+    /* unsigned */	{R, _, R, R, X, _, _, _, _},
+    /* signed */	{P, P, P, P, X, X, _, _, _},
+    /* float */		{A, X, X, X, X, X, X, _, _},
+    /* double */	{P, X, X, X, X, X, X, X, _}
 };
 
 /* the names and bits checked for each row in the above array */
@@ -399,12 +400,13 @@
 {
   char **matches = NULL;
 
-  if (start == 0) matches = completion_matches(text, command_completion);
+  if (start == 0)
+	  matches = rl_completion_matches(text, command_completion);
 
   return matches;
 }
 
-char * command_completion(char *text, int flag)
+char * command_completion(const char *text, int flag)
 {
   static int index, len;
   char *command;
@@ -414,14 +416,14 @@
     len = strlen(text);
   }
 
-  while (command = commands[index]) {
+  while ((command = commands[index])) {
     index++;
     if (!strncmp(command, text, len)) return strdup(command);
   }
   return NULL;
 }
 
-char * keyword_completion(char *text, int flag)
+char * keyword_completion(const char *text, int flag)
 {
   static int index, len, set, into;
   char *keyword, *option;
@@ -435,7 +437,7 @@
   }
 
   if (set) {
-    while (option = options[index]) {
+    while ((option = options[index])) {
       index++;
       if (!strncmp(option, text, len)) return strdup(option);
     }
@@ -455,7 +457,7 @@
         return strdup("into");
       else
         return strdup("int");
-    } else while (keyword = keywords[index]) {
+    } else while ((keyword = keywords[index])) {
       index++;
       if (!strncmp(keyword, text, len)) return strdup(keyword);
     }
@@ -1100,6 +1102,7 @@
 char *storage, *constvol, *type, *decl;
 {
     if (type && (strcmp(type, "void") == 0))
+    {
 	if (prev == 'n')
 	    unsupp("Variable of type void",
 		   "variable of type pointer to void");
@@ -1109,6 +1112,7 @@
 	else if (prev == 'r')
 	    unsupp("reference to type void",
 		   "pointer to void");
+    }
 
     if (*storage == 'r')
 	switch (prev)
@@ -1132,12 +1136,14 @@
 char *constvol, *type, *cast, *name;
 {
     if (strcmp(type, "void") == 0)
+    {
 	if (prev == 'a')
 	    unsupp("array of type void",
 		   "array of type pointer to void");
 	else if (prev == 'r')
 	    unsupp("reference to type void",
 		   "pointer to void");
+    }
     (void) printf("cast %s into %s", name, cast);
     if (strlen(constvol) > 0)
 	    (void) printf("%s ", constvol);
@@ -1245,6 +1251,7 @@
 }
 
 int main(argc, argv)
+int argc;
 char **argv;
 {
     int c, ret = 0;
@@ -1252,7 +1259,7 @@
 #ifdef USE_READLINE
     /* install completion handlers */
     rl_attempted_completion_function = (CPPFunction *)attempt_completion;
-    rl_completion_entry_function = (Function *)keyword_completion;
+    rl_completion_entry_function = keyword_completion;
 #endif
 
     setprogname(argv[0]);
diff -ru cdecl-2.5/Makefile cdecl-2.5.new/Makefile
--- cdecl-2.5/Makefile	1996-01-16 08:36:38 +0300
+++ cdecl-2.5.new/Makefile	2006-05-21 00:32:00 +0400
@@ -17,7 +17,7 @@
 
 CFLAGS= -s -O2 -DUSE_READLINE
 CC= gcc
-LIBS= -lreadline -ltermcap
+LIBS= -lreadline
 ALLFILES= makefile cdgram.y cdlex.l cdecl.c cdecl.1 testset testset++
 BINDIR= /usr/bin
 MANDIR= /usr/man/man1
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin