Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Adam Borowski
On Wed, Jun 22, 2016 at 12:35:22PM +0100, Simon Hobson wrote: > Rainer Weikusat wrote: > > Lastly, if the target system is Linux (as here), one can safely assume > > that EBCDIC won't be used. > > > > None of this matter anyhow for solving algorithm exercises in an > > entry-level book about a pr

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Irrwahn
On Wed, 22 Jun 2016 18:37:32 +0100, Katolaz wrote: [...] > It is perfectly legal in C to do something like: > > = > > int fun (int *v){ > > v[4] = 17; > } > > int fun2(char *p){ > > p[32] = 0; > > } > > int fun3(float *f){ > > f[7] = 3.1415; > } > > > int main(){ > >

Re: [DNG] How to stop udev from re-ordering devices

2016-06-22 Thread Rainer Weikusat
Simon Hobson writes: > Rainer Weikusat wrote: >> In absences of post hoc driver shuffling, these names *are not* >> random. [...] > You've posted a statement that says drivers are loaded in a > non-deterministic order. Therefore, in the general case where not all > interfaces are using the same

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread KatolaZ
On Wed, Jun 22, 2016 at 08:23:08PM +0200, Irrwahn wrote: > On Wed, 22 Jun 2016 18:37:32 +0100, Katolaz wrote: > [...] > > no array can be actually "passed" to function, > [...] > > I'm not trying to argue against anything you wrote in your > spot-on analysis, but regarding that one claim quoted

Re: [DNG] How to stop udev from re-ordering devices

2016-06-22 Thread Simon Hobson
Rainer Weikusat wrote: > In absences of post hoc driver shuffling, these names *are not* > random. But as that's clearly something you're not willing to believe > in, this discussion seems pretty pointless. I think we must be making assumptions about what each other are talking about - you appe

[DNG] [Fwd: Re: policykit-1 | Requires libpam-systemd which can't be installed (#7)]

2016-06-22 Thread Svante Signell
--- Begin Message --- On Tue, 2016-06-21 at 18:42 +0200, ItchyPirate wrote: > policykit-1 requires libpam-systemd which in turn requires systemd . Since > systemd is currently not available in Devuan, that makes policykit-1 > impossible to install. This is a big problem for for those of us with HP

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Rainer Weikusat
KatolaZ writes: [...] > and the reason is that arrays in C are just syntactic sugar around > memory addresses. This has nothing to do with polymorphism or generic > programming, and is indeed much lower-level and more basic than > that. Simply put, arrays do not effectively *exist* in C. This i

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Edward Bartolo
Hi, These are my worked examples. I am posting just in case some may want to comment. exercise1-17: - #include #define MAXLINE 1000 /* maximum length of line */ int lgetline(char line[], int maxline); /* print lines longer than 80 characters */ int main() { int len;

[DNG] Fwd: Studying C as told. (For help)

2016-06-22 Thread Edward Bartolo
Hi KatolaZ, This reply was intended to you, but I mistakenly addressed it to Irrwahn. Sorry. Edward -- Forwarded message -- From: Irrwahn Date: Wed, 22 Jun 2016 19:27:01 +0200 Subject: Re: [DNG] Studying C as told. (For help) To: Edward Bartolo , irrwah...@freenet.de Cc: dng@lis

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Irrwahn
On Wed, 22 Jun 2016 18:37:32 +0100, Katolaz wrote: [...] > no array can be actually "passed" to function, [...] I'm not trying to argue against anything you wrote in your spot-on analysis, but regarding that one claim quoted above one could postulate that an exception to that rule exists for a

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread KatolaZ
On Wed, Jun 22, 2016 at 05:04:38PM +0200, Edward Bartolo wrote: [cut] > > This is why I am finding it hard to logically accept that "passing by > reference" is NOT equivalent to passing a pointer for the machine. For > the programmer, it is using a different syntax, but the machine sees > no dif

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Irrwahn
On Wed, 22 Jun 2016 17:04:38 +0200, Edward Bartolo wrote: > Hi, > > Irrwhan35 wrote: > << > There is no "passing by reference" in C. Forget it. No > references. Only *values*. Everything is passed *by* *value* in C. You > will never pass "an array" to a function call in C. You will instead > pass

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Steve Litt
On Wed, 22 Jun 2016 11:15:44 +0200 Edward Bartolo wrote: > The program: > -- > #include > > void times2(int i[]) { > i[0] = 33; > } Others have commented on value and reference. What I have to add is this: Always take special care to name functions and variables desc

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Steve Litt
On Wed, 22 Jun 2016 14:08:55 +0200 Irrwahn wrote: > On Wed, 22 Jun 2016 12:35:22 +0100, Simon Hobson wrote: > > I suspect we've all conversed with people who have approximately > > zero knowledge or interest in how "the greasy bits" of the machine > > ends up running their code. My first compute

Re: [DNG] How to stop udev from re-ordering devices

2016-06-22 Thread Rainer Weikusat
Simon Hobson writes: > Rainer Weikusat wrote: >>> If you just use the default kernel naming scheme then you open >>> yourself to the problem that udev was designed to solve - that of >>> random device names. >> >> If you'll neither believe me nor the code wrt causes these 'random >> device names

Re: [DNG] tool to check for updates without root??

2016-06-22 Thread Paweł Cholewiński
W dniu 22.06.2016 o 08:20, KatolaZ pisze: The easiest way is to have a cron script that runs once a day, with root provileges, and calls "apt-get update". Then, your notifier could be as simple as: apt-get -s upgrade | grep "^[0-9]* upgr" | cut -d " " -f 1 which will give the number of package

Re: [DNG] How to stop udev from re-ordering devices

2016-06-22 Thread Simon Hobson
I wrote: >> Unless the admin transfers the installation to another system. Assuming >> that everything used to work fine with eth0 - eth3, all hell will >> break lose because the sole four interfaces are now called eth4 - eth7. > > But the point is, the admin can then, with one simple edit, retur

Re: [DNG] How to stop udev from re-ordering devices

2016-06-22 Thread Simon Hobson
Rainer Weikusat wrote: >> If you just use the default kernel naming scheme then you open >> yourself to the problem that udev was designed to solve - that of >> random device names. > > If you'll neither believe me nor the code wrt causes these 'random > device names', may I try some kind of aut

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Edward Bartolo
Hi, Irrwhan35 wrote: << There is no "passing by reference" in C. Forget it. No references. Only *values*. Everything is passed *by* *value* in C. You will never pass "an array" to a function call in C. You will instead pass the *value* of a *pointer* to a contiguous region of RAM which contains th

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Rainer Weikusat
Edward Bartolo writes: > Now I have several exercises from "The C programming language" > (Kernighan & Ritchie). Some question look rather challenging... > > I learnt arrays are always passed by reference to function calls. As was already pointed out, all arguments to C functions are passed via v

Re: [DNG] How to stop udev from re-ordering devices

2016-06-22 Thread Adam Borowski
On Wed, Jun 22, 2016 at 10:35:39AM +0200, Stephan Seitz wrote: > On Wed, Jun 22, 2016 at 08:08:38AM +0100, Simon Hobson wrote: > >But once you go down the route of udev (or equivalent, eg vdev) and > >persistent rules, then "eth0" is just a subset of "admin set interface > >name". > > The problem

Re: [DNG] How to stop udev from re-ordering devices

2016-06-22 Thread Rainer Weikusat
Didier Kryn writes: > Le 22/06/2016 09:08, Simon Hobson a écrit : >> If you just use the default kernel naming scheme then you open >> yourself to the problem that udev was designed to solve - that of >> random device names. I do have personal experience of that - boot >> with a different disk (fo

Re: [DNG] How to stop udev from re-ordering devices

2016-06-22 Thread Rainer Weikusat
Simon Hobson writes: > Rainer Weikusat wrote: > >>> All in all, the easiest way by far is to use stable and user(admin) >>> set names for interfaces ! >> >> This is going to bite you in the posterior in case of canned OS >> installations intended to be usable on a wide range of differently >> co

Re: [DNG] tool to check for updates without root??

2016-06-22 Thread KatolaZ
On Wed, Jun 22, 2016 at 01:46:43PM +0200, emnin...@riseup.net wrote: [cut] > > Thanks for your pointer. So, essentially, there is no way to play > around the need of root. > Well, if you are not root, and you cannot become root, or you cannot email root and ask him a favour, it might be quite

Re: [DNG] tool to check for updates without root??

2016-06-22 Thread Irrwahn
On Wed, 22 Jun 2016 13:46:43 +0200, Emninger wrote: > Am Wed, 22 Jun 2016 08:35:48 + > schrieb KatolaZ : >> The easiest way is to have a cron script that runs once a day, with >> root provileges, and calls "apt-get update". [...] > Thanks for your pointer. So, essentially, there is no way to p

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Irrwahn
On Wed, 22 Jun 2016 12:35:22 +0100, Simon Hobson wrote: > On 21 Jun 2016, at 18:50, Irrwahn wrote: >> Source code is written for humans, not machines! Clarity and >> simplicity can help minimize code maintenance cost, and thus >> easily outweigh some slight runtime penalty. Whoever has found >>

Re: [DNG] tool to check for updates without root??

2016-06-22 Thread emninger
Am Wed, 22 Jun 2016 08:35:48 + schrieb KatolaZ : Hi KatolaZ! > The easiest way is to have a cron script that runs once a day, with > root provileges, and calls "apt-get update". Then, your notifier could > be as simple as: > > apt-get -s upgrade | grep "^[0-9]* upgr" | cut -d " " -f 1 > >

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Simon Hobson
Rainer Weikusat wrote: > Lastly, if the target system is Linux (as here), one can safely assume > that EBCDIC won't be used. > > None of this matter anyhow for solving algorithm exercises in an > entry-level book about a programming language. On the other hand, it might just give a newbie to C

Re: [DNG] How to stop udev from re-ordering devices

2016-06-22 Thread Didier Kryn
Le 22/06/2016 09:08, Simon Hobson a écrit : If you just use the default kernel naming scheme then you open yourself to the problem that udev was designed to solve - that of random device names. I do have personal experience of that - boot with a different disk (for maintenance) and eth0 & eth1

Re: [DNG] tool to check for updates without root??

2016-06-22 Thread Giovanni Rapagnani
On 22/06/16 08:20, KatolaZ wrote: > On Wed, Jun 22, 2016 at 02:15:17AM +0200, emnin...@riseup.net wrote: > The easiest way is to have a cron script that runs once a day, with > root provileges, and calls "apt-get update". another way of periodically updating the lists of packages is to add this

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Irrwahn
On Wed, 22 Jun 2016 11:15:44 +0200, Edward Bartolo wrote: > I learnt arrays are always passed by reference to function calls. So, KatolaZ already posted a very clear and correct comment regarding by-reference vs. by-value, but anyway: It is a fact that there are no *references* in C, but only

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread KatolaZ
On Wed, Jun 22, 2016 at 11:15:44AM +0200, Edward Bartolo wrote: > Hi, > > Now I have several exercises from "The C programming language" > (Kernighan & Ritchie). Some question look rather challenging... > > I learnt arrays are always passed by reference to function calls. So, > I wrote the follow

Re: [DNG] Studying C as told. (For help)

2016-06-22 Thread Edward Bartolo
Hi, Now I have several exercises from "The C programming language" (Kernighan & Ritchie). Some question look rather challenging... I learnt arrays are always passed by reference to function calls. So, I wrote the following program to make use of this so that a variable in main() is modified in a

Re: [DNG] How to stop udev from re-ordering devices

2016-06-22 Thread Stephan Seitz
On Wed, Jun 22, 2016 at 08:08:38AM +0100, Simon Hobson wrote: But once you go down the route of udev (or equivalent, eg vdev) and persistent rules, then "eth0" is just a subset of "admin set interface name". The problem with udev and eth0 is, that you have race conditions if you let udev rena

Re: [DNG] How to stop udev from re-ordering devices

2016-06-22 Thread Simon Hobson
Rainer Weikusat wrote: >> All in all, the easiest way by far is to use stable and user(admin) >> set names for interfaces ! > > This is going to bite you in the posterior in case of canned OS > installations intended to be usable on a wide range of differently > configured 'servers' and not supp