Commit f59b403a f59b403aa3ef3bb13e992c1e69aa4976a2b7486d by Sergey Poznyakoff

For compatibility with older mails take a number alone to mean "print NUMBER"

1 parent b7a7196b
...@@ -87,7 +87,7 @@ util_do_command (const char *c, ...) ...@@ -87,7 +87,7 @@ util_do_command (const char *c, ...)
87 char *cmd = NULL; 87 char *cmd = NULL;
88 va_list ap; 88 va_list ap;
89 static const char *delim = "="; 89 static const char *delim = "=";
90 90
91 va_start (ap, c); 91 va_start (ap, c);
92 status = vasprintf (&cmd, c, ap); 92 status = vasprintf (&cmd, c, ap);
93 va_end (ap); 93 va_end (ap);
...@@ -114,6 +114,16 @@ util_do_command (const char *c, ...) ...@@ -114,6 +114,16 @@ util_do_command (const char *c, ...)
114 if (argcv_get (cmd, delim, NULL, &argc, &argv) == 0) 114 if (argcv_get (cmd, delim, NULL, &argc, &argv) == 0)
115 { 115 {
116 struct mail_command_entry entry; 116 struct mail_command_entry entry;
117 char *p;
118
119 /* Special case: a number alone implies "print" */
120 if (argc == 1 && strtoul (argv[0], &p, 10) > 0 && *p == 0)
121 {
122 asprintf (&p, "print %s", argv[0]);
123 argcv_free (argc, argv);
124 argcv_get (p, delim, NULL, &argc, &argv);
125 free (p);
126 }
117 127
118 entry = util_find_entry (mail_command_table, argv[0]); 128 entry = util_find_entry (mail_command_table, argv[0]);
119 command = entry.func; 129 command = entry.func;
......