~mathiaz/ubuntu/lucid/mysql-dfsg-5.1/zap-bug-552053

« back to all changes in this revision

Viewing changes to cmd-line-utils/libedit/refresh.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-06-25 12:55:45 UTC
  • mfrom: (1.1.2 upstream) (0.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20090625125545-m8ogs96zzsri74xe
Tags: 5.1.34-1ubuntu1
* Merge from debian experimental (and 5.0 from main), remaining changes:
  - debian/mysql-server-5.1.config:
    + ask for MySQL root password at priority high instead of medium so
      that the password prompt is seen on a default install. (LP: #319843)
    + don't ask for root password when upgrading from a 5.0 install.
  - debian/control:
    + Make libmysqlclient16-dev a transitional package depending on
      libmysqlclient-dev.
    + Make libmysqlclient-dev conflict with libmysqlclient15-dev.
    + Don't build mysql-server, mysql-client, mysql-common and
      libmysqlclient15-dev binary packages since they're still provided
      by mysql-dfsg-5.0.
    + Make mysql-{client,server}-5.1 packages conflict and
      replace mysql-{client,server}-5.0, but not provide
      mysql-{client,server}.
    + Depend on a specific version of mysql-common rather than the src
      version of mysql-dfsg-5.1 since mysql-common is currently part of
      mysql-dfsg-5.0.
    + Lower mailx from a Recommends to a Suggests to avoid pulling in
      a full MTA on all installs of mysql-server. (LP: #259477)
  - debian/rules:
    + added -fno-strict-aliasing to CFLAGS to get around mysql testsuite
      build failures.
    + install mysql-test and sql-bench to /usr/share/mysql/ rather than
      /usr/.
  - debian/additions/debian-start.inc.sh: support ANSI mode (LP: #310211)
  - Add AppArmor profile:
    - debian/apparmor-profile: apparmor profile.
    - debian/rules, debian/mysql-server-5.0.files: install apparmor profile.
    - debian/mysql-server-5.0.dirs: add etc/apparmor.d/force-complain
    - debian/mysql-server-5.0.postrm: remove symlink in force-complain/ on
      purge.
    - debian/mysql-server-5.1.README.Debian: add apparmor documentation.
    - debian/additions/my.cnf: Add warning about apparmor. (LP: #201799)
    - debian/mysql-server-5.1.postinst: reload apparmor profiles.
  - debian/additions/my.cnf: remove language option. Error message files are
    located in a different directory in MySQL 5.0. Setting the language
    option to use /usr/share/mysql/english breaks 5.0. Both 5.0 and 5.1
    use a default value that works. (LP: #316974)
  - debian/mysql-server-5.1.mysql.init:
    + Clearly indicate that we do not support running multiple instances
      of mysqld by duplicating the init script.
      (closes: #314785, #324834, #435165, #444216)
    + Properly parameterize all existing references to the mysql config
      file (/etc/mysql/my.cnf).
  - debian/mysql-server-5.0.postinst: Clear out the second password
    when setting up mysql. (LP: #344816)
  - mysql-server-core-5.1 package for files needed by Akonadi:
    + debian/control: create mysql-server-core-5.1 package.
    + debian/mysql-server-core-5.1.files, debian/mysql-server-5.1.files:
      move core mysqld files to mysql-server-core-5.1 package.
  - Don't package sql-bench and mysql-test file.
* Dropped changes:
  - debian/patches/92_ssl_test_cert.dpatch: certificate expiration in
    test suite (LP: #323755). Included upstream.
* Dropped from 5.0:
  - apparmor profile:
    - debian/control: Recommends apparmor >= 2.1+1075-0ubuntu6. All version
      of apparmor-profile (>hardy) are higher than this version.
    - debian/mysql-server-5.0.preinst: create symlink for force-complain/
      on pre-feisty upgrades, upgrades where apparmor-profiles profile is
      unchanged (ie non-enforcing) and upgrades where the profile
      doesn't exist. Support for pre-hardy upgrades is no longer needed.
* debian/mysql-server-5.1.postinst: fix debian-sys-maint user creation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*      $NetBSD: refresh.c,v 1.26 2003/08/07 16:44:33 agc Exp $ */
 
1
/*      $NetBSD: refresh.c,v 1.28 2008/09/10 15:45:37 christos Exp $    */
2
2
 
3
3
/*-
4
4
 * Copyright (c) 1992, 1993
32
32
 * SUCH DAMAGE.
33
33
 */
34
34
 
35
 
#include <config.h>
 
35
#include "config.h"
 
36
#if !defined(lint) && !defined(SCCSID)
 
37
#if 0
 
38
static char sccsid[] = "@(#)refresh.c   8.1 (Berkeley) 6/4/93";
 
39
#else
 
40
#endif
 
41
#endif /* not lint && not SCCSID */
36
42
 
37
43
/*
38
44
 * refresh.c: Lower level screen refreshing functions
49
55
private void    re_insert (EditLine *, char *, int, int, char *, int);
50
56
private void    re_delete(EditLine *, char *, int, int, int);
51
57
private void    re_fastputc(EditLine *, int);
 
58
private void    re_clear_eol(EditLine *, int, int, int);
52
59
private void    re__strncopy(char *, char *, size_t);
53
60
private void    re__copy_and_pad(char *, const char *, size_t);
54
61
 
315
322
{
316
323
 
317
324
        term_move_to_line(el, el->el_refresh.r_oldcv);
318
 
        term__putc('\n');
 
325
        term__putc(el, '\n');
319
326
        re_clear_display(el);
320
 
        term__flush();
 
327
        term__flush(el);
321
328
}
322
329
 
323
330
 
340
347
        ELRE_DEBUG(1,
341
348
            (__F, "re_insert() starting: %d at %d max %d, d == \"%s\"\n",
342
349
            num, dat, dlen, d));
343
 
        ELRE_DEBUG(1, (__F, "s == \"%s\"n", s));
 
350
        ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
344
351
 
345
352
        /* open up the space for num chars */
346
353
        if (num > 0) {
353
360
        ELRE_DEBUG(1, (__F,
354
361
                "re_insert() after insert: %d at %d max %d, d == \"%s\"\n",
355
362
                num, dat, dlen, d));
356
 
        ELRE_DEBUG(1, (__F, "s == \"%s\"n", s));
 
363
        ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
357
364
 
358
365
        /* copy the characters */
359
366
        for (a = d + dat; (a < d + dlen) && (num > 0); num--)
362
369
        ELRE_DEBUG(1,
363
370
            (__F, "re_insert() after copy: %d at %d max %d, %s == \"%s\"\n",
364
371
            num, dat, dlen, d, s));
365
 
        ELRE_DEBUG(1, (__F, "s == \"%s\"n", s));
 
372
        ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
366
373
}
367
374
 
368
375
 
411
418
                *a++ = *b++;
412
419
}
413
420
 
 
421
/* re_clear_eol():
 
422
 *      Find the number of characters we need to clear till the end of line
 
423
 *      in order to make sure that we have cleared the previous contents of
 
424
 *      the line. fx and sx is the number of characters inserted or deleted
 
425
 *      int the first or second diff, diff is the difference between the
 
426
 *      number of characters between the new and old line.
 
427
 */
 
428
private void
 
429
re_clear_eol(EditLine *el, int fx, int sx, int diff)
 
430
{
 
431
 
 
432
        ELRE_DEBUG(1, (__F, "re_clear_eol sx %d, fx %d, diff %d\n",
 
433
            sx, fx, diff));
 
434
 
 
435
        if (fx < 0)
 
436
                fx = -fx;
 
437
        if (sx < 0)
 
438
                sx = -sx;
 
439
        if (fx > diff)
 
440
                diff = fx;
 
441
        if (sx > diff)
 
442
                diff = sx;
 
443
 
 
444
        ELRE_DEBUG(1, (__F, "re_clear_eol %d\n", diff));
 
445
        term_clear_EOL(el, diff);
 
446
}
414
447
 
415
448
/*****************************************************************
416
449
    re_update_line() is based on finding the middle difference of each line
626
659
        fx = (nsb - nfd) - (osb - ofd);
627
660
        sx = (nls - nse) - (ols - ose);
628
661
 
629
 
        ELRE_DEBUG(1, (__F, "\n"));
 
662
        ELRE_DEBUG(1, (__F, "fx %d, sx %d\n", fx, sx));
630
663
        ELRE_DEBUG(1, (__F, "ofd %d, osb %d, ose %d, ols %d, oe %d\n",
631
664
                ofd - old, osb - old, ose - old, ols - old, oe - old));
632
665
        ELRE_DEBUG(1, (__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n",
775
808
                         * write (nsb-nfd) chars of new starting at nfd
776
809
                         */
777
810
                        term_overwrite(el, nfd, (nsb - nfd));
778
 
                        ELRE_DEBUG(1, (__F,
779
 
                            "cleareol %d\n", (oe - old) - (ne - new)));
780
 
                        term_clear_EOL(el, (oe - old) - (ne - new));
 
811
                        re_clear_eol(el, fx, sx, (oe - old) - (ne - new));
781
812
                        /*
782
813
                         * Done
783
814
                         */
818
849
                        ELRE_DEBUG(1, (__F,
819
850
                            "but with nothing left to save\r\n"));
820
851
                        term_overwrite(el, nse, (nls - nse));
821
 
                        ELRE_DEBUG(1, (__F,
822
 
                            "cleareol %d\n", (oe - old) - (ne - new)));
823
 
                        if ((oe - old) - (ne - new) != 0)
824
 
                                term_clear_EOL(el, (oe - old) - (ne - new));
 
852
                        re_clear_eol(el, fx, sx, (oe - old) - (ne - new));
825
853
                }
826
854
        }
827
855
        /*
982
1010
        /* now go there */
983
1011
        term_move_to_line(el, v);
984
1012
        term_move_to_char(el, h);
985
 
        term__flush();
 
1013
        term__flush(el);
986
1014
}
987
1015
 
988
1016
 
993
1021
re_fastputc(EditLine *el, int c)
994
1022
{
995
1023
 
996
 
        term__putc(c);
 
1024
        term__putc(el, c);
997
1025
        el->el_display[el->el_cursor.v][el->el_cursor.h++] = c;
998
1026
        if (el->el_cursor.h >= el->el_term.t_size.h) {
999
1027
                /* if we must overflow */
1020
1048
                }
1021
1049
                if (EL_HAS_AUTO_MARGINS) {
1022
1050
                        if (EL_HAS_MAGIC_MARGINS) {
1023
 
                                term__putc(' ');
1024
 
                                term__putc('\b');
 
1051
                                term__putc(el, ' ');
 
1052
                                term__putc(el, '\b');
1025
1053
                        }
1026
1054
                } else {
1027
 
                        term__putc('\r');
1028
 
                        term__putc('\n');
 
1055
                        term__putc(el, '\r');
 
1056
                        term__putc(el, '\n');
1029
1057
                }
1030
1058
        }
1031
1059
}
1065
1093
                re_fastputc(el, (int)(((((unsigned int)c) >> 3) & 7) + '0'));
1066
1094
                re_fastputc(el, (c & 7) + '0');
1067
1095
        }
1068
 
        term__flush();
 
1096
        term__flush(el);
1069
1097
}
1070
1098
 
1071
1099
 
1104
1132
        } else {
1105
1133
                term_move_to_line(el, el->el_refresh.r_oldcv);
1106
1134
                                        /* go to last line */
1107
 
                term__putc('\r');       /* go to BOL */
1108
 
                term__putc('\n');       /* go to new line */
 
1135
                term__putc(el, '\r');   /* go to BOL */
 
1136
                term__putc(el, '\n');   /* go to new line */
1109
1137
        }
1110
1138
}